@agent-team-foundation/first-tree-hub 0.12.2 → 0.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.mjs +2 -2
- package/dist/{client-WubcgX-W-B2bOvgJ1.mjs → client-0RrgrMjR-DPyuu6Ls.mjs} +1 -1
- package/dist/{client-DHCSQ8kg-DjlSmE9q.mjs → client-D1TDiik_-gxtXN9bj.mjs} +12 -10
- package/dist/index.mjs +2 -2
- package/dist/{saas-connect-_2M4kfPR.mjs → saas-connect-_lNV0Liy.mjs} +146 -38
- package/dist/web/assets/index-B4EaL8S9.css +1 -0
- package/dist/web/assets/index-CJr7zpx-.js +401 -0
- package/dist/web/assets/{index-D5RJDuFw.js → index-DcMORzyx.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-C1DBMrHD.js +0 -391
- package/dist/web/assets/index-CwC0zzF5.css +0 -1
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
var mS=e=>{throw TypeError(e)};var Fp=(e,t,n)=>t.has(e)||mS("Cannot "+n);var B=(e,t,n)=>(Fp(e,t,"read from private field"),n?n.call(e):t.get(e)),Ne=(e,t,n)=>t.has(e)?mS("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),xe=(e,t,n,a)=>(Fp(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n),He=(e,t,n)=>(Fp(e,t,"access private method"),n);var sf=(e,t,n,a)=>({set _(s){xe(e,t,s,n)},get _(){return B(e,t,a)}});function R2(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const s in a)if(s!=="default"&&!(s in e)){const l=Object.getOwnPropertyDescriptor(a,s);l&&Object.defineProperty(e,s,l.get?l:{enumerable:!0,get:()=>a[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))a(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function n(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function a(s){if(s.ep)return;s.ep=!0;const l=n(s);fetch(s.href,l)}})();function ah(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $p={exports:{}},_u={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var pS;function O2(){if(pS)return _u;pS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,s,l){var c=null;if(l!==void 0&&(c=""+l),s.key!==void 0&&(c=""+s.key),"key"in s){l={};for(var d in s)d!=="key"&&(l[d]=s[d])}else l=s;return s=l.ref,{$$typeof:e,type:a,key:c,ref:s!==void 0?s:null,props:l}}return _u.Fragment=t,_u.jsx=n,_u.jsxs=n,_u}var gS;function z2(){return gS||(gS=1,$p.exports=O2()),$p.exports}var o=z2(),Hp={exports:{}},Ve={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var yS;function M2(){if(yS)return Ve;yS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),b=Symbol.iterator;function w(D){return D===null||typeof D!="object"?null:(D=b&&D[b]||D["@@iterator"],typeof D=="function"?D:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,E={};function C(D,U,T){this.props=D,this.context=U,this.refs=E,this.updater=T||S}C.prototype.isReactComponent={},C.prototype.setState=function(D,U){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,U,"setState")},C.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function _(){}_.prototype=C.prototype;function z(D,U,T){this.props=D,this.context=U,this.refs=E,this.updater=T||S}var M=z.prototype=new _;M.constructor=z,j(M,C.prototype),M.isPureReactComponent=!0;var L=Array.isArray;function O(){}var F={H:null,A:null,T:null,S:null},P=Object.prototype.hasOwnProperty;function V(D,U,T){var Z=T.ref;return{$$typeof:e,type:D,key:U,ref:Z!==void 0?Z:null,props:T}}function I(D,U){return V(D.type,U,D.props)}function Q(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function ie(D){var U={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(T){return U[T]})}var be=/\/+/g;function X(D,U){return typeof D=="object"&&D!==null&&D.key!=null?ie(""+D.key):U.toString(36)}function W(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(O,O):(D.status="pending",D.then(function(U){D.status==="pending"&&(D.status="fulfilled",D.value=U)},function(U){D.status==="pending"&&(D.status="rejected",D.reason=U)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function q(D,U,T,Z,Y){var ue=typeof D;(ue==="undefined"||ue==="boolean")&&(D=null);var Se=!1;if(D===null)Se=!0;else switch(ue){case"bigint":case"string":case"number":Se=!0;break;case"object":switch(D.$$typeof){case e:case t:Se=!0;break;case g:return Se=D._init,q(Se(D._payload),U,T,Z,Y)}}if(Se)return Y=Y(D),Se=Z===""?"."+X(D,0):Z,L(Y)?(T="",Se!=null&&(T=Se.replace(be,"$&/")+"/"),q(Y,U,T,"",function(Ge){return Ge})):Y!=null&&(Q(Y)&&(Y=I(Y,T+(Y.key==null||D&&D.key===Y.key?"":(""+Y.key).replace(be,"$&/")+"/")+Se)),U.push(Y)),1;Se=0;var ve=Z===""?".":Z+":";if(L(D))for(var me=0;me<D.length;me++)Z=D[me],ue=ve+X(Z,me),Se+=q(Z,U,T,ue,Y);else if(me=w(D),typeof me=="function")for(D=me.call(D),me=0;!(Z=D.next()).done;)Z=Z.value,ue=ve+X(Z,me++),Se+=q(Z,U,T,ue,Y);else if(ue==="object"){if(typeof D.then=="function")return q(W(D),U,T,Z,Y);throw U=String(D),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return Se}function ne(D,U,T){if(D==null)return D;var Z=[],Y=0;return q(D,Z,"","",function(ue){return U.call(T,ue,Y++)}),Z}function we(D){if(D._status===-1){var U=D._result;U=U(),U.then(function(T){(D._status===0||D._status===-1)&&(D._status=1,D._result=T)},function(T){(D._status===0||D._status===-1)&&(D._status=2,D._result=T)}),D._status===-1&&(D._status=0,D._result=U)}if(D._status===1)return D._result.default;throw D._result}var Re=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},R={map:ne,forEach:function(D,U,T){ne(D,function(){U.apply(this,arguments)},T)},count:function(D){var U=0;return ne(D,function(){U++}),U},toArray:function(D){return ne(D,function(U){return U})||[]},only:function(D){if(!Q(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ve.Activity=p,Ve.Children=R,Ve.Component=C,Ve.Fragment=n,Ve.Profiler=s,Ve.PureComponent=z,Ve.StrictMode=a,Ve.Suspense=m,Ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=F,Ve.__COMPILER_RUNTIME={__proto__:null,c:function(D){return F.H.useMemoCache(D)}},Ve.cache=function(D){return function(){return D.apply(null,arguments)}},Ve.cacheSignal=function(){return null},Ve.cloneElement=function(D,U,T){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var Z=j({},D.props),Y=D.key;if(U!=null)for(ue in U.key!==void 0&&(Y=""+U.key),U)!P.call(U,ue)||ue==="key"||ue==="__self"||ue==="__source"||ue==="ref"&&U.ref===void 0||(Z[ue]=U[ue]);var ue=arguments.length-2;if(ue===1)Z.children=T;else if(1<ue){for(var Se=Array(ue),ve=0;ve<ue;ve++)Se[ve]=arguments[ve+2];Z.children=Se}return V(D.type,Y,Z)},Ve.createContext=function(D){return D={$$typeof:c,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:l,_context:D},D},Ve.createElement=function(D,U,T){var Z,Y={},ue=null;if(U!=null)for(Z in U.key!==void 0&&(ue=""+U.key),U)P.call(U,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(Y[Z]=U[Z]);var Se=arguments.length-2;if(Se===1)Y.children=T;else if(1<Se){for(var ve=Array(Se),me=0;me<Se;me++)ve[me]=arguments[me+2];Y.children=ve}if(D&&D.defaultProps)for(Z in Se=D.defaultProps,Se)Y[Z]===void 0&&(Y[Z]=Se[Z]);return V(D,ue,Y)},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(D){return{$$typeof:d,render:D}},Ve.isValidElement=Q,Ve.lazy=function(D){return{$$typeof:g,_payload:{_status:-1,_result:D},_init:we}},Ve.memo=function(D,U){return{$$typeof:h,type:D,compare:U===void 0?null:U}},Ve.startTransition=function(D){var U=F.T,T={};F.T=T;try{var Z=D(),Y=F.S;Y!==null&&Y(T,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(O,Re)}catch(ue){Re(ue)}finally{U!==null&&T.types!==null&&(U.types=T.types),F.T=U}},Ve.unstable_useCacheRefresh=function(){return F.H.useCacheRefresh()},Ve.use=function(D){return F.H.use(D)},Ve.useActionState=function(D,U,T){return F.H.useActionState(D,U,T)},Ve.useCallback=function(D,U){return F.H.useCallback(D,U)},Ve.useContext=function(D){return F.H.useContext(D)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(D,U){return F.H.useDeferredValue(D,U)},Ve.useEffect=function(D,U){return F.H.useEffect(D,U)},Ve.useEffectEvent=function(D){return F.H.useEffectEvent(D)},Ve.useId=function(){return F.H.useId()},Ve.useImperativeHandle=function(D,U,T){return F.H.useImperativeHandle(D,U,T)},Ve.useInsertionEffect=function(D,U){return F.H.useInsertionEffect(D,U)},Ve.useLayoutEffect=function(D,U){return F.H.useLayoutEffect(D,U)},Ve.useMemo=function(D,U){return F.H.useMemo(D,U)},Ve.useOptimistic=function(D,U){return F.H.useOptimistic(D,U)},Ve.useReducer=function(D,U,T){return F.H.useReducer(D,U,T)},Ve.useRef=function(D){return F.H.useRef(D)},Ve.useState=function(D){return F.H.useState(D)},Ve.useSyncExternalStore=function(D,U,T){return F.H.useSyncExternalStore(D,U,T)},Ve.useTransition=function(){return F.H.useTransition()},Ve.version="19.2.4",Ve}var vS;function Jy(){return vS||(vS=1,Hp.exports=M2()),Hp.exports}var x=Jy();const D2=ah(x),ev=R2({__proto__:null,default:D2},[x]);var qp={exports:{}},Tu={},Zp={exports:{}},Gp={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var bS;function I2(){return bS||(bS=1,(function(e){function t(q,ne){var we=q.length;q.push(ne);e:for(;0<we;){var Re=we-1>>>1,R=q[Re];if(0<s(R,ne))q[Re]=ne,q[we]=R,we=Re;else break e}}function n(q){return q.length===0?null:q[0]}function a(q){if(q.length===0)return null;var ne=q[0],we=q.pop();if(we!==ne){q[0]=we;e:for(var Re=0,R=q.length,D=R>>>1;Re<D;){var U=2*(Re+1)-1,T=q[U],Z=U+1,Y=q[Z];if(0>s(T,we))Z<R&&0>s(Y,T)?(q[Re]=Y,q[Z]=we,Re=Z):(q[Re]=T,q[U]=we,Re=U);else if(Z<R&&0>s(Y,we))q[Re]=Y,q[Z]=we,Re=Z;else break e}}return ne}function s(q,ne){var we=q.sortIndex-ne.sortIndex;return we!==0?we:q.id-ne.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var m=[],h=[],g=1,p=null,b=3,w=!1,S=!1,j=!1,E=!1,C=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,z=typeof setImmediate<"u"?setImmediate:null;function M(q){for(var ne=n(h);ne!==null;){if(ne.callback===null)a(h);else if(ne.startTime<=q)a(h),ne.sortIndex=ne.expirationTime,t(m,ne);else break;ne=n(h)}}function L(q){if(j=!1,M(q),!S)if(n(m)!==null)S=!0,O||(O=!0,ie());else{var ne=n(h);ne!==null&&W(L,ne.startTime-q)}}var O=!1,F=-1,P=5,V=-1;function I(){return E?!0:!(e.unstable_now()-V<P)}function Q(){if(E=!1,O){var q=e.unstable_now();V=q;var ne=!0;try{e:{S=!1,j&&(j=!1,_(F),F=-1),w=!0;var we=b;try{t:{for(M(q),p=n(m);p!==null&&!(p.expirationTime>q&&I());){var Re=p.callback;if(typeof Re=="function"){p.callback=null,b=p.priorityLevel;var R=Re(p.expirationTime<=q);if(q=e.unstable_now(),typeof R=="function"){p.callback=R,M(q),ne=!0;break t}p===n(m)&&a(m),M(q)}else a(m);p=n(m)}if(p!==null)ne=!0;else{var D=n(h);D!==null&&W(L,D.startTime-q),ne=!1}}break e}finally{p=null,b=we,w=!1}ne=void 0}}finally{ne?ie():O=!1}}}var ie;if(typeof z=="function")ie=function(){z(Q)};else if(typeof MessageChannel<"u"){var be=new MessageChannel,X=be.port2;be.port1.onmessage=Q,ie=function(){X.postMessage(null)}}else ie=function(){C(Q,0)};function W(q,ne){F=C(function(){q(e.unstable_now())},ne)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(q){switch(b){case 1:case 2:case 3:var ne=3;break;default:ne=b}var we=b;b=ne;try{return q()}finally{b=we}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(q,ne){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var we=b;b=q;try{return ne()}finally{b=we}},e.unstable_scheduleCallback=function(q,ne,we){var Re=e.unstable_now();switch(typeof we=="object"&&we!==null?(we=we.delay,we=typeof we=="number"&&0<we?Re+we:Re):we=Re,q){case 1:var R=-1;break;case 2:R=250;break;case 5:R=1073741823;break;case 4:R=1e4;break;default:R=5e3}return R=we+R,q={id:g++,callback:ne,priorityLevel:q,startTime:we,expirationTime:R,sortIndex:-1},we>Re?(q.sortIndex=we,t(h,q),n(m)===null&&q===n(h)&&(j?(_(F),F=-1):j=!0,W(L,we-Re))):(q.sortIndex=R,t(m,q),S||w||(S=!0,O||(O=!0,ie()))),q},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(q){var ne=b;return function(){var we=b;b=ne;try{return q.apply(this,arguments)}finally{b=we}}}})(Gp)),Gp}var xS;function L2(){return xS||(xS=1,Zp.exports=I2()),Zp.exports}var Vp={exports:{}},Gn={};/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var wS;function P2(){if(wS)return Gn;wS=1;var e=Jy();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function l(m,h,g){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:p==null?null:""+p,children:m,containerInfo:h,implementation:g}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Gn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Gn.createPortal=function(m,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return l(m,h,null,g)},Gn.flushSync=function(m){var h=c.T,g=a.p;try{if(c.T=null,a.p=2,m)return m()}finally{c.T=h,a.p=g,a.d.f()}},Gn.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,a.d.C(m,h))},Gn.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Gn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var g=h.as,p=d(g,h.crossOrigin),b=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?a.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:p,integrity:b,fetchPriority:w}):g==="script"&&a.d.X(m,{crossOrigin:p,integrity:b,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Gn.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=d(h.as,h.crossOrigin);a.d.M(m,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&a.d.M(m)},Gn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,p=d(g,h.crossOrigin);a.d.L(m,g,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Gn.preloadModule=function(m,h){if(typeof m=="string")if(h){var g=d(h.as,h.crossOrigin);a.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else a.d.m(m)},Gn.requestFormReset=function(m){a.d.r(m)},Gn.unstable_batchedUpdates=function(m,h){return m(h)},Gn.useFormState=function(m,h,g){return c.H.useFormState(m,h,g)},Gn.useFormStatus=function(){return c.H.useHostTransitionStatus()},Gn.version="19.2.4",Gn}var SS;function vj(){if(SS)return Vp.exports;SS=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Vp.exports=P2(),Vp.exports}/**
|
|
34
|
+
* @license React
|
|
35
|
+
* react-dom-client.production.js
|
|
36
|
+
*
|
|
37
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the MIT license found in the
|
|
40
|
+
* LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/var kS;function U2(){if(kS)return Tu;kS=1;var e=L2(),t=Jy(),n=vj();function a(r){var i="https://react.dev/errors/"+r;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)i+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+r+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function l(r){var i=r,u=r;if(r.alternate)for(;i.return;)i=i.return;else{r=i;do i=r,(i.flags&4098)!==0&&(u=i.return),r=i.return;while(r)}return i.tag===3?u:null}function c(r){if(r.tag===13){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function d(r){if(r.tag===31){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function m(r){if(l(r)!==r)throw Error(a(188))}function h(r){var i=r.alternate;if(!i){if(i=l(r),i===null)throw Error(a(188));return i!==r?null:r}for(var u=r,f=i;;){var y=u.return;if(y===null)break;var v=y.alternate;if(v===null){if(f=y.return,f!==null){u=f;continue}break}if(y.child===v.child){for(v=y.child;v;){if(v===u)return m(y),r;if(v===f)return m(y),i;v=v.sibling}throw Error(a(188))}if(u.return!==f.return)u=y,f=v;else{for(var k=!1,A=y.child;A;){if(A===u){k=!0,u=y,f=v;break}if(A===f){k=!0,f=y,u=v;break}A=A.sibling}if(!k){for(A=v.child;A;){if(A===u){k=!0,u=v,f=y;break}if(A===f){k=!0,f=v,u=y;break}A=A.sibling}if(!k)throw Error(a(189))}}if(u.alternate!==f)throw Error(a(190))}if(u.tag!==3)throw Error(a(188));return u.stateNode.current===u?r:i}function g(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=g(r),i!==null)return i;r=r.sibling}return null}var p=Object.assign,b=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),z=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),I=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function ie(r){return r===null||typeof r!="object"?null:(r=Q&&r[Q]||r["@@iterator"],typeof r=="function"?r:null)}var be=Symbol.for("react.client.reference");function X(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===be?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case j:return"Fragment";case C:return"Profiler";case E:return"StrictMode";case L:return"Suspense";case O:return"SuspenseList";case V:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case S:return"Portal";case z:return r.displayName||"Context";case _:return(r._context.displayName||"Context")+".Consumer";case M:var i=r.render;return r=r.displayName,r||(r=i.displayName||i.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case F:return i=r.displayName||null,i!==null?i:X(r.type)||"Memo";case P:i=r._payload,r=r._init;try{return X(r(i))}catch{}}return null}var W=Array.isArray,q=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,we={pending:!1,data:null,method:null,action:null},Re=[],R=-1;function D(r){return{current:r}}function U(r){0>R||(r.current=Re[R],Re[R]=null,R--)}function T(r,i){R++,Re[R]=r.current,r.current=i}var Z=D(null),Y=D(null),ue=D(null),Se=D(null);function ve(r,i){switch(T(ue,i),T(Y,r),T(Z,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?Lw(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=Lw(i),r=Pw(i,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}U(Z),T(Z,r)}function me(){U(Z),U(Y),U(ue)}function Ge(r){r.memoizedState!==null&&T(Se,r);var i=Z.current,u=Pw(i,r.type);i!==u&&(T(Y,r),T(Z,u))}function Be(r){Y.current===r&&(U(Z),U(Y)),Se.current===r&&(U(Se),ju._currentValue=we)}var vt,gt;function ae(r){if(vt===void 0)try{throw Error()}catch(u){var i=u.stack.trim().match(/\n( *(at )?)/);vt=i&&i[1]||"",gt=-1<u.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+vt+r+gt}var je=!1;function De(r,i){if(!r||je)return"";je=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={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(se){var te=se}Reflect.construct(r,[],fe)}else{try{fe.call()}catch(se){te=se}r.call(fe.prototype)}}else{try{throw Error()}catch(se){te=se}(fe=r())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(se){if(se&&te&&typeof se.stack=="string")return[se.stack,te.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=f.DetermineComponentFrameRoot(),k=v[0],A=v[1];if(k&&A){var H=k.split(`
|
|
44
|
+
`),ee=A.split(`
|
|
45
|
+
`);for(y=f=0;f<H.length&&!H[f].includes("DetermineComponentFrameRoot");)f++;for(;y<ee.length&&!ee[y].includes("DetermineComponentFrameRoot");)y++;if(f===H.length||y===ee.length)for(f=H.length-1,y=ee.length-1;1<=f&&0<=y&&H[f]!==ee[y];)y--;for(;1<=f&&0<=y;f--,y--)if(H[f]!==ee[y]){if(f!==1||y!==1)do if(f--,y--,0>y||H[f]!==ee[y]){var oe=`
|
|
46
|
+
`+H[f].replace(" at new "," at ");return r.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",r.displayName)),oe}while(1<=f&&0<=y);break}}}finally{je=!1,Error.prepareStackTrace=u}return(u=r?r.displayName||r.name:"")?ae(u):""}function Ye(r,i){switch(r.tag){case 26:case 27:case 5:return ae(r.type);case 16:return ae("Lazy");case 13:return r.child!==i&&i!==null?ae("Suspense Fallback"):ae("Suspense");case 19:return ae("SuspenseList");case 0:case 15:return De(r.type,!1);case 11:return De(r.type.render,!1);case 1:return De(r.type,!0);case 31:return ae("Activity");default:return""}}function mn(r){try{var i="",u=null;do i+=Ye(r,u),u=r,r=r.return;while(r);return i}catch(f){return`
|
|
47
|
+
Error generating stack: `+f.message+`
|
|
48
|
+
`+f.stack}}var en=Object.prototype.hasOwnProperty,Er=e.unstable_scheduleCallback,Br=e.unstable_cancelCallback,hi=e.unstable_shouldYield,mi=e.unstable_requestPaint,ln=e.unstable_now,ua=e.unstable_getCurrentPriorityLevel,le=e.unstable_ImmediatePriority,ge=e.unstable_UserBlockingPriority,Ue=e.unstable_NormalPriority,Ze=e.unstable_LowPriority,nt=e.unstable_IdlePriority,on=e.log,er=e.unstable_setDisableYieldValue,$t=null,It=null;function Tt(r){if(typeof on=="function"&&er(r),It&&typeof It.setStrictMode=="function")try{It.setStrictMode($t,r)}catch{}}var rt=Math.clz32?Math.clz32:al,tr=Math.log,zn=Math.LN2;function al(r){return r>>>=0,r===0?32:31-(tr(r)/zn|0)|0}var ca=256,da=262144,za=4194304;function Zn(r){var i=r&42;if(i!==0)return i;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function Ma(r,i,u){var f=r.pendingLanes;if(f===0)return 0;var y=0,v=r.suspendedLanes,k=r.pingedLanes;r=r.warmLanes;var A=f&134217727;return A!==0?(f=A&~v,f!==0?y=Zn(f):(k&=A,k!==0?y=Zn(k):u||(u=A&~r,u!==0&&(y=Zn(u))))):(A=f&~v,A!==0?y=Zn(A):k!==0?y=Zn(k):u||(u=f&~r,u!==0&&(y=Zn(u)))),y===0?0:i!==0&&i!==y&&(i&v)===0&&(v=y&-y,u=i&-i,v>=u||v===32&&(u&4194048)!==0)?i:y}function wa(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function Ht(r,i){switch(r){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ke(){var r=za;return za<<=1,(za&62914560)===0&&(za=4194304),r}function et(r){for(var i=[],u=0;31>u;u++)i.push(r);return i}function pn(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Nr(r,i,u,f,y,v){var k=r.pendingLanes;r.pendingLanes=u,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=u,r.entangledLanes&=u,r.errorRecoveryDisabledLanes&=u,r.shellSuspendCounter=0;var A=r.entanglements,H=r.expirationTimes,ee=r.hiddenUpdates;for(u=k&~u;0<u;){var oe=31-rt(u),fe=1<<oe;A[oe]=0,H[oe]=-1;var te=ee[oe];if(te!==null)for(ee[oe]=null,oe=0;oe<te.length;oe++){var se=te[oe];se!==null&&(se.lane&=-536870913)}u&=~fe}f!==0&&pi(r,f,0),v!==0&&y===0&&r.tag!==0&&(r.suspendedLanes|=v&~(k&~i))}function pi(r,i,u){r.pendingLanes|=i,r.suspendedLanes&=~i;var f=31-rt(i);r.entangledLanes|=i,r.entanglements[f]=r.entanglements[f]|1073741824|u&261930}function gs(r,i){var u=r.entangledLanes|=i;for(r=r.entanglements;u;){var f=31-rt(u),y=1<<f;y&i|r[f]&i&&(r[f]|=i),u&=~y}}function qc(r,i){var u=i&-i;return u=(u&42)!==0?1:nr(u),(u&(r.suspendedLanes|i))!==0?0:u}function nr(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function fa(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Io(){var r=ne.p;return r!==0?r:(r=window.event,r===void 0?32:lS(r.type))}function Lo(r,i){var u=ne.p;try{return ne.p=r,i()}finally{ne.p=u}}var Fr=Math.random().toString(36).slice(2),un="__reactFiber$"+Fr,qt="__reactProps$"+Fr,Da="__reactContainer$"+Fr,il="__reactEvents$"+Fr,zh="__reactListeners$"+Fr,Zc="__reactHandles$"+Fr,Po="__reactResources$"+Fr,gi="__reactMarker$"+Fr;function Ie(r){delete r[un],delete r[qt],delete r[il],delete r[zh],delete r[Zc]}function $(r){var i=r[un];if(i)return i;for(var u=r.parentNode;u;){if(i=u[Da]||u[un]){if(u=i.alternate,i.child!==null||u!==null&&u.child!==null)for(r=Zw(r);r!==null;){if(u=r[un])return u;r=Zw(r)}return i}r=u,u=r.parentNode}return null}function he(r){if(r=r[un]||r[Da]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function Ee(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(a(33))}function bt(r){var i=r[Po];return i||(i=r[Po]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function ct(r){r[gi]=!0}var Xt=new Set,Pn={};function gn(r,i){Mn(r,i),Mn(r+"Capture",i)}function Mn(r,i){for(Pn[r]=i,r=0;r<i.length;r++)Xt.add(i[r])}var Uo=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),cn={},Bo={};function Gc(r){return en.call(Bo,r)?!0:en.call(cn,r)?!1:Uo.test(r)?Bo[r]=!0:(cn[r]=!0,!1)}function Vc(r,i,u){if(Gc(i))if(u===null)r.removeAttribute(i);else{switch(typeof u){case"undefined":case"function":case"symbol":r.removeAttribute(i);return;case"boolean":var f=i.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){r.removeAttribute(i);return}}r.setAttribute(i,""+u)}}function Qc(r,i,u){if(u===null)r.removeAttribute(i);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttribute(i,""+u)}}function Ia(r,i,u,f){if(f===null)r.removeAttribute(u);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(u);return}r.setAttributeNS(i,u,""+f)}}function $r(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Tb(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function jT(r,i,u){var f=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var y=f.get,v=f.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return y.call(this)},set:function(k){u=""+k,v.call(this,k)}}),Object.defineProperty(r,i,{enumerable:f.enumerable}),{getValue:function(){return u},setValue:function(k){u=""+k},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function Mh(r){if(!r._valueTracker){var i=Tb(r)?"checked":"value";r._valueTracker=jT(r,i,""+r[i])}}function Ab(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var u=i.getValue(),f="";return r&&(f=Tb(r)?r.checked?"true":"false":r.value),r=f,r!==u?(i.setValue(r),!0):!1}function Kc(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 CT=/[\n"\\]/g;function Hr(r){return r.replace(CT,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Dh(r,i,u,f,y,v,k,A){r.name="",k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?r.type=k:r.removeAttribute("type"),i!=null?k==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+$r(i)):r.value!==""+$r(i)&&(r.value=""+$r(i)):k!=="submit"&&k!=="reset"||r.removeAttribute("value"),i!=null?Ih(r,k,$r(i)):u!=null?Ih(r,k,$r(u)):f!=null&&r.removeAttribute("value"),y==null&&v!=null&&(r.defaultChecked=!!v),y!=null&&(r.checked=y&&typeof y!="function"&&typeof y!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?r.name=""+$r(A):r.removeAttribute("name")}function Rb(r,i,u,f,y,v,k,A){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(r.type=v),i!=null||u!=null){if(!(v!=="submit"&&v!=="reset"||i!=null)){Mh(r);return}u=u!=null?""+$r(u):"",i=i!=null?""+$r(i):u,A||i===r.value||(r.value=i),r.defaultValue=i}f=f??y,f=typeof f!="function"&&typeof f!="symbol"&&!!f,r.checked=A?r.checked:!!f,r.defaultChecked=!!f,k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(r.name=k),Mh(r)}function Ih(r,i,u){i==="number"&&Kc(r.ownerDocument)===r||r.defaultValue===""+u||(r.defaultValue=""+u)}function sl(r,i,u,f){if(r=r.options,i){i={};for(var y=0;y<u.length;y++)i["$"+u[y]]=!0;for(u=0;u<r.length;u++)y=i.hasOwnProperty("$"+r[u].value),r[u].selected!==y&&(r[u].selected=y),y&&f&&(r[u].defaultSelected=!0)}else{for(u=""+$r(u),i=null,y=0;y<r.length;y++){if(r[y].value===u){r[y].selected=!0,f&&(r[y].defaultSelected=!0);return}i!==null||r[y].disabled||(i=r[y])}i!==null&&(i.selected=!0)}}function Ob(r,i,u){if(i!=null&&(i=""+$r(i),i!==r.value&&(r.value=i),u==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=u!=null?""+$r(u):""}function zb(r,i,u,f){if(i==null){if(f!=null){if(u!=null)throw Error(a(92));if(W(f)){if(1<f.length)throw Error(a(93));f=f[0]}u=f}u==null&&(u=""),i=u}u=$r(i),r.defaultValue=u,f=r.textContent,f===u&&f!==""&&f!==null&&(r.value=f),Mh(r)}function ll(r,i){if(i){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=i;return}}r.textContent=i}var ET=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 Mb(r,i,u){var f=i.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?f?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":f?r.setProperty(i,u):typeof u!="number"||u===0||ET.has(i)?i==="float"?r.cssFloat=u:r[i]=(""+u).trim():r[i]=u+"px"}function Db(r,i,u){if(i!=null&&typeof i!="object")throw Error(a(62));if(r=r.style,u!=null){for(var f in u)!u.hasOwnProperty(f)||i!=null&&i.hasOwnProperty(f)||(f.indexOf("--")===0?r.setProperty(f,""):f==="float"?r.cssFloat="":r[f]="");for(var y in i)f=i[y],i.hasOwnProperty(y)&&u[y]!==f&&Mb(r,y,f)}else for(var v in i)i.hasOwnProperty(v)&&Mb(r,v,i[v])}function Lh(r){if(r.indexOf("-")===-1)return!1;switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var NT=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"]]),_T=/^[\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 Yc(r){return _T.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function La(){}var Ph=null;function Uh(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var ol=null,ul=null;function Ib(r){var i=he(r);if(i&&(r=i.stateNode)){var u=r[qt]||null;e:switch(r=i.stateNode,i.type){case"input":if(Dh(r,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),i=u.name,u.type==="radio"&&i!=null){for(u=r;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Hr(""+i)+'"][type="radio"]'),i=0;i<u.length;i++){var f=u[i];if(f!==r&&f.form===r.form){var y=f[qt]||null;if(!y)throw Error(a(90));Dh(f,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(i=0;i<u.length;i++)f=u[i],f.form===r.form&&Ab(f)}break e;case"textarea":Ob(r,u.value,u.defaultValue);break e;case"select":i=u.value,i!=null&&sl(r,!!u.multiple,i,!1)}}}var Bh=!1;function Lb(r,i,u){if(Bh)return r(i,u);Bh=!0;try{var f=r(i);return f}finally{if(Bh=!1,(ol!==null||ul!==null)&&(Ld(),ol&&(i=ol,r=ul,ul=ol=null,Ib(i),r)))for(i=0;i<r.length;i++)Ib(r[i])}}function Fo(r,i){var u=r.stateNode;if(u===null)return null;var f=u[qt]||null;if(f===null)return null;u=f[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(r=r.type,f=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!f;break e;default:r=!1}if(r)return null;if(u&&typeof u!="function")throw Error(a(231,i,typeof u));return u}var Pa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fh=!1;if(Pa)try{var $o={};Object.defineProperty($o,"passive",{get:function(){Fh=!0}}),window.addEventListener("test",$o,$o),window.removeEventListener("test",$o,$o)}catch{Fh=!1}var yi=null,$h=null,Xc=null;function Pb(){if(Xc)return Xc;var r,i=$h,u=i.length,f,y="value"in yi?yi.value:yi.textContent,v=y.length;for(r=0;r<u&&i[r]===y[r];r++);var k=u-r;for(f=1;f<=k&&i[u-f]===y[v-f];f++);return Xc=y.slice(r,1<f?1-f:void 0)}function Wc(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 Jc(){return!0}function Ub(){return!1}function fr(r){function i(u,f,y,v,k){this._reactName=u,this._targetInst=y,this.type=f,this.nativeEvent=v,this.target=k,this.currentTarget=null;for(var A in r)r.hasOwnProperty(A)&&(u=r[A],this[A]=u?u(v):v[A]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Jc:Ub,this.isPropagationStopped=Ub,this}return p(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=Jc)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Jc)},persist:function(){},isPersistent:Jc}),i}var ys={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ed=fr(ys),Ho=p({},ys,{view:0,detail:0}),TT=fr(Ho),Hh,qh,qo,td=p({},Ho,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gh,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==qo&&(qo&&r.type==="mousemove"?(Hh=r.screenX-qo.screenX,qh=r.screenY-qo.screenY):qh=Hh=0,qo=r),Hh)},movementY:function(r){return"movementY"in r?r.movementY:qh}}),Bb=fr(td),AT=p({},td,{dataTransfer:0}),RT=fr(AT),OT=p({},Ho,{relatedTarget:0}),Zh=fr(OT),zT=p({},ys,{animationName:0,elapsedTime:0,pseudoElement:0}),MT=fr(zT),DT=p({},ys,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),IT=fr(DT),LT=p({},ys,{data:0}),Fb=fr(LT),PT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},UT={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"},BT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function FT(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=BT[r])?!!i[r]:!1}function Gh(){return FT}var $T=p({},Ho,{key:function(r){if(r.key){var i=PT[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=Wc(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?UT[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gh,charCode:function(r){return r.type==="keypress"?Wc(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Wc(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),HT=fr($T),qT=p({},td,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$b=fr(qT),ZT=p({},Ho,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gh}),GT=fr(ZT),VT=p({},ys,{propertyName:0,elapsedTime:0,pseudoElement:0}),QT=fr(VT),KT=p({},td,{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}),YT=fr(KT),XT=p({},ys,{newState:0,oldState:0}),WT=fr(XT),JT=[9,13,27,32],Vh=Pa&&"CompositionEvent"in window,Zo=null;Pa&&"documentMode"in document&&(Zo=document.documentMode);var eA=Pa&&"TextEvent"in window&&!Zo,Hb=Pa&&(!Vh||Zo&&8<Zo&&11>=Zo),qb=" ",Zb=!1;function Gb(r,i){switch(r){case"keyup":return JT.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vb(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var cl=!1;function tA(r,i){switch(r){case"compositionend":return Vb(i);case"keypress":return i.which!==32?null:(Zb=!0,qb);case"textInput":return r=i.data,r===qb&&Zb?null:r;default:return null}}function nA(r,i){if(cl)return r==="compositionend"||!Vh&&Gb(r,i)?(r=Pb(),Xc=$h=yi=null,cl=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Hb&&i.locale!=="ko"?null:i.data;default:return null}}var rA={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 Qb(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!rA[r.type]:i==="textarea"}function Kb(r,i,u,f){ol?ul?ul.push(f):ul=[f]:ol=f,i=qd(i,"onChange"),0<i.length&&(u=new ed("onChange","change",null,u,f),r.push({event:u,listeners:i}))}var Go=null,Vo=null;function aA(r){Rw(r,0)}function nd(r){var i=Ee(r);if(Ab(i))return r}function Yb(r,i){if(r==="change")return i}var Xb=!1;if(Pa){var Qh;if(Pa){var Kh="oninput"in document;if(!Kh){var Wb=document.createElement("div");Wb.setAttribute("oninput","return;"),Kh=typeof Wb.oninput=="function"}Qh=Kh}else Qh=!1;Xb=Qh&&(!document.documentMode||9<document.documentMode)}function Jb(){Go&&(Go.detachEvent("onpropertychange",ex),Vo=Go=null)}function ex(r){if(r.propertyName==="value"&&nd(Vo)){var i=[];Kb(i,Vo,r,Uh(r)),Lb(aA,i)}}function iA(r,i,u){r==="focusin"?(Jb(),Go=i,Vo=u,Go.attachEvent("onpropertychange",ex)):r==="focusout"&&Jb()}function sA(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return nd(Vo)}function lA(r,i){if(r==="click")return nd(i)}function oA(r,i){if(r==="input"||r==="change")return nd(i)}function uA(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var _r=typeof Object.is=="function"?Object.is:uA;function Qo(r,i){if(_r(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var u=Object.keys(r),f=Object.keys(i);if(u.length!==f.length)return!1;for(f=0;f<u.length;f++){var y=u[f];if(!en.call(i,y)||!_r(r[y],i[y]))return!1}return!0}function tx(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function nx(r,i){var u=tx(r);r=0;for(var f;u;){if(u.nodeType===3){if(f=r+u.textContent.length,r<=i&&f>=i)return{node:u,offset:i-r};r=f}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=tx(u)}}function rx(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?rx(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function ax(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=Kc(r.document);i instanceof r.HTMLIFrameElement;){try{var u=typeof i.contentWindow.location.href=="string"}catch{u=!1}if(u)r=i.contentWindow;else break;i=Kc(r.document)}return i}function Yh(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i&&(i==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||i==="textarea"||r.contentEditable==="true")}var cA=Pa&&"documentMode"in document&&11>=document.documentMode,dl=null,Xh=null,Ko=null,Wh=!1;function ix(r,i,u){var f=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Wh||dl==null||dl!==Kc(f)||(f=dl,"selectionStart"in f&&Yh(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Ko&&Qo(Ko,f)||(Ko=f,f=qd(Xh,"onSelect"),0<f.length&&(i=new ed("onSelect","select",null,i,u),r.push({event:i,listeners:f}),i.target=dl)))}function vs(r,i){var u={};return u[r.toLowerCase()]=i.toLowerCase(),u["Webkit"+r]="webkit"+i,u["Moz"+r]="moz"+i,u}var fl={animationend:vs("Animation","AnimationEnd"),animationiteration:vs("Animation","AnimationIteration"),animationstart:vs("Animation","AnimationStart"),transitionrun:vs("Transition","TransitionRun"),transitionstart:vs("Transition","TransitionStart"),transitioncancel:vs("Transition","TransitionCancel"),transitionend:vs("Transition","TransitionEnd")},Jh={},sx={};Pa&&(sx=document.createElement("div").style,"AnimationEvent"in window||(delete fl.animationend.animation,delete fl.animationiteration.animation,delete fl.animationstart.animation),"TransitionEvent"in window||delete fl.transitionend.transition);function bs(r){if(Jh[r])return Jh[r];if(!fl[r])return r;var i=fl[r],u;for(u in i)if(i.hasOwnProperty(u)&&u in sx)return Jh[r]=i[u];return r}var lx=bs("animationend"),ox=bs("animationiteration"),ux=bs("animationstart"),dA=bs("transitionrun"),fA=bs("transitionstart"),hA=bs("transitioncancel"),cx=bs("transitionend"),dx=new Map,em="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");em.push("scrollEnd");function ha(r,i){dx.set(r,i),gn(i,[r])}var rd=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},qr=[],hl=0,tm=0;function ad(){for(var r=hl,i=tm=hl=0;i<r;){var u=qr[i];qr[i++]=null;var f=qr[i];qr[i++]=null;var y=qr[i];qr[i++]=null;var v=qr[i];if(qr[i++]=null,f!==null&&y!==null){var k=f.pending;k===null?y.next=y:(y.next=k.next,k.next=y),f.pending=y}v!==0&&fx(u,y,v)}}function id(r,i,u,f){qr[hl++]=r,qr[hl++]=i,qr[hl++]=u,qr[hl++]=f,tm|=f,r.lanes|=f,r=r.alternate,r!==null&&(r.lanes|=f)}function nm(r,i,u,f){return id(r,i,u,f),sd(r)}function xs(r,i){return id(r,null,null,i),sd(r)}function fx(r,i,u){r.lanes|=u;var f=r.alternate;f!==null&&(f.lanes|=u);for(var y=!1,v=r.return;v!==null;)v.childLanes|=u,f=v.alternate,f!==null&&(f.childLanes|=u),v.tag===22&&(r=v.stateNode,r===null||r._visibility&1||(y=!0)),r=v,v=v.return;return r.tag===3?(v=r.stateNode,y&&i!==null&&(y=31-rt(u),r=v.hiddenUpdates,f=r[y],f===null?r[y]=[i]:f.push(i),i.lane=u|536870912),v):null}function sd(r){if(50<yu)throw yu=0,dp=null,Error(a(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var ml={};function mA(r,i,u,f){this.tag=r,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Tr(r,i,u,f){return new mA(r,i,u,f)}function rm(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Ua(r,i){var u=r.alternate;return u===null?(u=Tr(r.tag,i,r.key,r.mode),u.elementType=r.elementType,u.type=r.type,u.stateNode=r.stateNode,u.alternate=r,r.alternate=u):(u.pendingProps=i,u.type=r.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=r.flags&65011712,u.childLanes=r.childLanes,u.lanes=r.lanes,u.child=r.child,u.memoizedProps=r.memoizedProps,u.memoizedState=r.memoizedState,u.updateQueue=r.updateQueue,i=r.dependencies,u.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},u.sibling=r.sibling,u.index=r.index,u.ref=r.ref,u.refCleanup=r.refCleanup,u}function hx(r,i){r.flags&=65011714;var u=r.alternate;return u===null?(r.childLanes=0,r.lanes=i,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=u.childLanes,r.lanes=u.lanes,r.child=u.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=u.memoizedProps,r.memoizedState=u.memoizedState,r.updateQueue=u.updateQueue,r.type=u.type,i=u.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r}function ld(r,i,u,f,y,v){var k=0;if(f=r,typeof r=="function")rm(r)&&(k=1);else if(typeof r=="string")k=b2(r,u,Z.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case V:return r=Tr(31,u,i,y),r.elementType=V,r.lanes=v,r;case j:return ws(u.children,y,v,i);case E:k=8,y|=24;break;case C:return r=Tr(12,u,i,y|2),r.elementType=C,r.lanes=v,r;case L:return r=Tr(13,u,i,y),r.elementType=L,r.lanes=v,r;case O:return r=Tr(19,u,i,y),r.elementType=O,r.lanes=v,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case z:k=10;break e;case _:k=9;break e;case M:k=11;break e;case F:k=14;break e;case P:k=16,f=null;break e}k=29,u=Error(a(130,r===null?"null":typeof r,"")),f=null}return i=Tr(k,u,i,y),i.elementType=r,i.type=f,i.lanes=v,i}function ws(r,i,u,f){return r=Tr(7,r,f,i),r.lanes=u,r}function am(r,i,u){return r=Tr(6,r,null,i),r.lanes=u,r}function mx(r){var i=Tr(18,null,null,0);return i.stateNode=r,i}function im(r,i,u){return i=Tr(4,r.children!==null?r.children:[],r.key,i),i.lanes=u,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var px=new WeakMap;function Zr(r,i){if(typeof r=="object"&&r!==null){var u=px.get(r);return u!==void 0?u:(i={value:r,source:i,stack:mn(i)},px.set(r,i),i)}return{value:r,source:i,stack:mn(i)}}var pl=[],gl=0,od=null,Yo=0,Gr=[],Vr=0,vi=null,Sa=1,ka="";function Ba(r,i){pl[gl++]=Yo,pl[gl++]=od,od=r,Yo=i}function gx(r,i,u){Gr[Vr++]=Sa,Gr[Vr++]=ka,Gr[Vr++]=vi,vi=r;var f=Sa;r=ka;var y=32-rt(f)-1;f&=~(1<<y),u+=1;var v=32-rt(i)+y;if(30<v){var k=y-y%5;v=(f&(1<<k)-1).toString(32),f>>=k,y-=k,Sa=1<<32-rt(i)+y|u<<y|f,ka=v+r}else Sa=1<<v|u<<y|f,ka=r}function sm(r){r.return!==null&&(Ba(r,1),gx(r,1,0))}function lm(r){for(;r===od;)od=pl[--gl],pl[gl]=null,Yo=pl[--gl],pl[gl]=null;for(;r===vi;)vi=Gr[--Vr],Gr[Vr]=null,ka=Gr[--Vr],Gr[Vr]=null,Sa=Gr[--Vr],Gr[Vr]=null}function yx(r,i){Gr[Vr++]=Sa,Gr[Vr++]=ka,Gr[Vr++]=vi,Sa=i.id,ka=i.overflow,vi=r}var Un=null,Bt=null,dt=!1,bi=null,Qr=!1,om=Error(a(519));function xi(r){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Xo(Zr(i,r)),om}function vx(r){var i=r.stateNode,u=r.type,f=r.memoizedProps;switch(i[un]=r,i[qt]=f,u){case"dialog":it("cancel",i),it("close",i);break;case"iframe":case"object":case"embed":it("load",i);break;case"video":case"audio":for(u=0;u<bu.length;u++)it(bu[u],i);break;case"source":it("error",i);break;case"img":case"image":case"link":it("error",i),it("load",i);break;case"details":it("toggle",i);break;case"input":it("invalid",i),Rb(i,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":it("invalid",i);break;case"textarea":it("invalid",i),zb(i,f.value,f.defaultValue,f.children)}u=f.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||i.textContent===""+u||f.suppressHydrationWarning===!0||Dw(i.textContent,u)?(f.popover!=null&&(it("beforetoggle",i),it("toggle",i)),f.onScroll!=null&&it("scroll",i),f.onScrollEnd!=null&&it("scrollend",i),f.onClick!=null&&(i.onclick=La),i=!0):i=!1,i||xi(r,!0)}function bx(r){for(Un=r.return;Un;)switch(Un.tag){case 5:case 31:case 13:Qr=!1;return;case 27:case 3:Qr=!0;return;default:Un=Un.return}}function yl(r){if(r!==Un)return!1;if(!dt)return bx(r),dt=!0,!1;var i=r.tag,u;if((u=i!==3&&i!==27)&&((u=i===5)&&(u=r.type,u=!(u!=="form"&&u!=="button")||Ep(r.type,r.memoizedProps)),u=!u),u&&Bt&&xi(r),bx(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Bt=qw(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Bt=qw(r)}else i===27?(i=Bt,Mi(r.type)?(r=Rp,Rp=null,Bt=r):Bt=i):Bt=Un?Yr(r.stateNode.nextSibling):null;return!0}function Ss(){Bt=Un=null,dt=!1}function um(){var r=bi;return r!==null&&(gr===null?gr=r:gr.push.apply(gr,r),bi=null),r}function Xo(r){bi===null?bi=[r]:bi.push(r)}var cm=D(null),ks=null,Fa=null;function wi(r,i,u){T(cm,i._currentValue),i._currentValue=u}function $a(r){r._currentValue=cm.current,U(cm)}function dm(r,i,u){for(;r!==null;){var f=r.alternate;if((r.childLanes&i)!==i?(r.childLanes|=i,f!==null&&(f.childLanes|=i)):f!==null&&(f.childLanes&i)!==i&&(f.childLanes|=i),r===u)break;r=r.return}}function fm(r,i,u,f){var y=r.child;for(y!==null&&(y.return=r);y!==null;){var v=y.dependencies;if(v!==null){var k=y.child;v=v.firstContext;e:for(;v!==null;){var A=v;v=y;for(var H=0;H<i.length;H++)if(A.context===i[H]){v.lanes|=u,A=v.alternate,A!==null&&(A.lanes|=u),dm(v.return,u,r),f||(k=null);break e}v=A.next}}else if(y.tag===18){if(k=y.return,k===null)throw Error(a(341));k.lanes|=u,v=k.alternate,v!==null&&(v.lanes|=u),dm(k,u,r),k=null}else k=y.child;if(k!==null)k.return=y;else for(k=y;k!==null;){if(k===r){k=null;break}if(y=k.sibling,y!==null){y.return=k.return,k=y;break}k=k.return}y=k}}function vl(r,i,u,f){r=null;for(var y=i,v=!1;y!==null;){if(!v){if((y.flags&524288)!==0)v=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var k=y.alternate;if(k===null)throw Error(a(387));if(k=k.memoizedProps,k!==null){var A=y.type;_r(y.pendingProps.value,k.value)||(r!==null?r.push(A):r=[A])}}else if(y===Se.current){if(k=y.alternate,k===null)throw Error(a(387));k.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(r!==null?r.push(ju):r=[ju])}y=y.return}r!==null&&fm(i,r,u,f),i.flags|=262144}function ud(r){for(r=r.firstContext;r!==null;){if(!_r(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function js(r){ks=r,Fa=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Bn(r){return xx(ks,r)}function cd(r,i){return ks===null&&js(r),xx(r,i)}function xx(r,i){var u=i._currentValue;if(i={context:i,memoizedValue:u,next:null},Fa===null){if(r===null)throw Error(a(308));Fa=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else Fa=Fa.next=i;return u}var pA=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(u,f){r.push(f)}};this.abort=function(){i.aborted=!0,r.forEach(function(u){return u()})}},gA=e.unstable_scheduleCallback,yA=e.unstable_NormalPriority,yn={$$typeof:z,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function hm(){return{controller:new pA,data:new Map,refCount:0}}function Wo(r){r.refCount--,r.refCount===0&&gA(yA,function(){r.controller.abort()})}var Jo=null,mm=0,bl=0,xl=null;function vA(r,i){if(Jo===null){var u=Jo=[];mm=0,bl=yp(),xl={status:"pending",value:void 0,then:function(f){u.push(f)}}}return mm++,i.then(wx,wx),i}function wx(){if(--mm===0&&Jo!==null){xl!==null&&(xl.status="fulfilled");var r=Jo;Jo=null,bl=0,xl=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function bA(r,i){var u=[],f={status:"pending",value:null,reason:null,then:function(y){u.push(y)}};return r.then(function(){f.status="fulfilled",f.value=i;for(var y=0;y<u.length;y++)(0,u[y])(i)},function(y){for(f.status="rejected",f.reason=y,y=0;y<u.length;y++)(0,u[y])(void 0)}),f}var Sx=q.S;q.S=function(r,i){iw=ln(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&vA(r,i),Sx!==null&&Sx(r,i)};var Cs=D(null);function pm(){var r=Cs.current;return r!==null?r:zt.pooledCache}function dd(r,i){i===null?T(Cs,Cs.current):T(Cs,i.pool)}function kx(){var r=pm();return r===null?null:{parent:yn._currentValue,pool:r}}var wl=Error(a(460)),gm=Error(a(474)),fd=Error(a(542)),hd={then:function(){}};function jx(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Cx(r,i,u){switch(u=r[u],u===void 0?r.push(i):u!==i&&(i.then(La,La),i=u),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Nx(r),r;default:if(typeof i.status=="string")i.then(La,La);else{if(r=zt,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=i,r.status="pending",r.then(function(f){if(i.status==="pending"){var y=i;y.status="fulfilled",y.value=f}},function(f){if(i.status==="pending"){var y=i;y.status="rejected",y.reason=f}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Nx(r),r}throw Ns=i,wl}}function Es(r){try{var i=r._init;return i(r._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(Ns=u,wl):u}}var Ns=null;function Ex(){if(Ns===null)throw Error(a(459));var r=Ns;return Ns=null,r}function Nx(r){if(r===wl||r===fd)throw Error(a(483))}var Sl=null,eu=0;function md(r){var i=eu;return eu+=1,Sl===null&&(Sl=[]),Cx(Sl,r,i)}function tu(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function pd(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 _x(r){function i(K,G){if(r){var J=K.deletions;J===null?(K.deletions=[G],K.flags|=16):J.push(G)}}function u(K,G){if(!r)return null;for(;G!==null;)i(K,G),G=G.sibling;return null}function f(K){for(var G=new Map;K!==null;)K.key!==null?G.set(K.key,K):G.set(K.index,K),K=K.sibling;return G}function y(K,G){return K=Ua(K,G),K.index=0,K.sibling=null,K}function v(K,G,J){return K.index=J,r?(J=K.alternate,J!==null?(J=J.index,J<G?(K.flags|=67108866,G):J):(K.flags|=67108866,G)):(K.flags|=1048576,G)}function k(K){return r&&K.alternate===null&&(K.flags|=67108866),K}function A(K,G,J,de){return G===null||G.tag!==6?(G=am(J,K.mode,de),G.return=K,G):(G=y(G,J),G.return=K,G)}function H(K,G,J,de){var Le=J.type;return Le===j?oe(K,G,J.props.children,de,J.key):G!==null&&(G.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===P&&Es(Le)===G.type)?(G=y(G,J.props),tu(G,J),G.return=K,G):(G=ld(J.type,J.key,J.props,null,K.mode,de),tu(G,J),G.return=K,G)}function ee(K,G,J,de){return G===null||G.tag!==4||G.stateNode.containerInfo!==J.containerInfo||G.stateNode.implementation!==J.implementation?(G=im(J,K.mode,de),G.return=K,G):(G=y(G,J.children||[]),G.return=K,G)}function oe(K,G,J,de,Le){return G===null||G.tag!==7?(G=ws(J,K.mode,de,Le),G.return=K,G):(G=y(G,J),G.return=K,G)}function fe(K,G,J){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=am(""+G,K.mode,J),G.return=K,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case w:return J=ld(G.type,G.key,G.props,null,K.mode,J),tu(J,G),J.return=K,J;case S:return G=im(G,K.mode,J),G.return=K,G;case P:return G=Es(G),fe(K,G,J)}if(W(G)||ie(G))return G=ws(G,K.mode,J,null),G.return=K,G;if(typeof G.then=="function")return fe(K,md(G),J);if(G.$$typeof===z)return fe(K,cd(K,G),J);pd(K,G)}return null}function te(K,G,J,de){var Le=G!==null?G.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Le!==null?null:A(K,G,""+J,de);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case w:return J.key===Le?H(K,G,J,de):null;case S:return J.key===Le?ee(K,G,J,de):null;case P:return J=Es(J),te(K,G,J,de)}if(W(J)||ie(J))return Le!==null?null:oe(K,G,J,de,null);if(typeof J.then=="function")return te(K,G,md(J),de);if(J.$$typeof===z)return te(K,G,cd(K,J),de);pd(K,J)}return null}function se(K,G,J,de,Le){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return K=K.get(J)||null,A(G,K,""+de,Le);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case w:return K=K.get(de.key===null?J:de.key)||null,H(G,K,de,Le);case S:return K=K.get(de.key===null?J:de.key)||null,ee(G,K,de,Le);case P:return de=Es(de),se(K,G,J,de,Le)}if(W(de)||ie(de))return K=K.get(J)||null,oe(G,K,de,Le,null);if(typeof de.then=="function")return se(K,G,J,md(de),Le);if(de.$$typeof===z)return se(K,G,J,cd(G,de),Le);pd(G,de)}return null}function _e(K,G,J,de){for(var Le=null,wt=null,ze=G,Xe=G=0,ut=null;ze!==null&&Xe<J.length;Xe++){ze.index>Xe?(ut=ze,ze=null):ut=ze.sibling;var St=te(K,ze,J[Xe],de);if(St===null){ze===null&&(ze=ut);break}r&&ze&&St.alternate===null&&i(K,ze),G=v(St,G,Xe),wt===null?Le=St:wt.sibling=St,wt=St,ze=ut}if(Xe===J.length)return u(K,ze),dt&&Ba(K,Xe),Le;if(ze===null){for(;Xe<J.length;Xe++)ze=fe(K,J[Xe],de),ze!==null&&(G=v(ze,G,Xe),wt===null?Le=ze:wt.sibling=ze,wt=ze);return dt&&Ba(K,Xe),Le}for(ze=f(ze);Xe<J.length;Xe++)ut=se(ze,K,Xe,J[Xe],de),ut!==null&&(r&&ut.alternate!==null&&ze.delete(ut.key===null?Xe:ut.key),G=v(ut,G,Xe),wt===null?Le=ut:wt.sibling=ut,wt=ut);return r&&ze.forEach(function(Ui){return i(K,Ui)}),dt&&Ba(K,Xe),Le}function $e(K,G,J,de){if(J==null)throw Error(a(151));for(var Le=null,wt=null,ze=G,Xe=G=0,ut=null,St=J.next();ze!==null&&!St.done;Xe++,St=J.next()){ze.index>Xe?(ut=ze,ze=null):ut=ze.sibling;var Ui=te(K,ze,St.value,de);if(Ui===null){ze===null&&(ze=ut);break}r&&ze&&Ui.alternate===null&&i(K,ze),G=v(Ui,G,Xe),wt===null?Le=Ui:wt.sibling=Ui,wt=Ui,ze=ut}if(St.done)return u(K,ze),dt&&Ba(K,Xe),Le;if(ze===null){for(;!St.done;Xe++,St=J.next())St=fe(K,St.value,de),St!==null&&(G=v(St,G,Xe),wt===null?Le=St:wt.sibling=St,wt=St);return dt&&Ba(K,Xe),Le}for(ze=f(ze);!St.done;Xe++,St=J.next())St=se(ze,K,Xe,St.value,de),St!==null&&(r&&St.alternate!==null&&ze.delete(St.key===null?Xe:St.key),G=v(St,G,Xe),wt===null?Le=St:wt.sibling=St,wt=St);return r&&ze.forEach(function(A2){return i(K,A2)}),dt&&Ba(K,Xe),Le}function Ot(K,G,J,de){if(typeof J=="object"&&J!==null&&J.type===j&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case w:e:{for(var Le=J.key;G!==null;){if(G.key===Le){if(Le=J.type,Le===j){if(G.tag===7){u(K,G.sibling),de=y(G,J.props.children),de.return=K,K=de;break e}}else if(G.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===P&&Es(Le)===G.type){u(K,G.sibling),de=y(G,J.props),tu(de,J),de.return=K,K=de;break e}u(K,G);break}else i(K,G);G=G.sibling}J.type===j?(de=ws(J.props.children,K.mode,de,J.key),de.return=K,K=de):(de=ld(J.type,J.key,J.props,null,K.mode,de),tu(de,J),de.return=K,K=de)}return k(K);case S:e:{for(Le=J.key;G!==null;){if(G.key===Le)if(G.tag===4&&G.stateNode.containerInfo===J.containerInfo&&G.stateNode.implementation===J.implementation){u(K,G.sibling),de=y(G,J.children||[]),de.return=K,K=de;break e}else{u(K,G);break}else i(K,G);G=G.sibling}de=im(J,K.mode,de),de.return=K,K=de}return k(K);case P:return J=Es(J),Ot(K,G,J,de)}if(W(J))return _e(K,G,J,de);if(ie(J)){if(Le=ie(J),typeof Le!="function")throw Error(a(150));return J=Le.call(J),$e(K,G,J,de)}if(typeof J.then=="function")return Ot(K,G,md(J),de);if(J.$$typeof===z)return Ot(K,G,cd(K,J),de);pd(K,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,G!==null&&G.tag===6?(u(K,G.sibling),de=y(G,J),de.return=K,K=de):(u(K,G),de=am(J,K.mode,de),de.return=K,K=de),k(K)):u(K,G)}return function(K,G,J,de){try{eu=0;var Le=Ot(K,G,J,de);return Sl=null,Le}catch(ze){if(ze===wl||ze===fd)throw ze;var wt=Tr(29,ze,null,K.mode);return wt.lanes=de,wt.return=K,wt}finally{}}}var _s=_x(!0),Tx=_x(!1),Si=!1;function ym(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function vm(r,i){r=r.updateQueue,i.updateQueue===r&&(i.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function ki(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function ji(r,i,u){var f=r.updateQueue;if(f===null)return null;if(f=f.shared,(jt&2)!==0){var y=f.pending;return y===null?i.next=i:(i.next=y.next,y.next=i),f.pending=i,i=sd(r),fx(r,null,u),i}return id(r,f,i,u),sd(r)}function nu(r,i,u){if(i=i.updateQueue,i!==null&&(i=i.shared,(u&4194048)!==0)){var f=i.lanes;f&=r.pendingLanes,u|=f,i.lanes=u,gs(r,u)}}function bm(r,i){var u=r.updateQueue,f=r.alternate;if(f!==null&&(f=f.updateQueue,u===f)){var y=null,v=null;if(u=u.firstBaseUpdate,u!==null){do{var k={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};v===null?y=v=k:v=v.next=k,u=u.next}while(u!==null);v===null?y=v=i:v=v.next=i}else y=v=i;u={baseState:f.baseState,firstBaseUpdate:y,lastBaseUpdate:v,shared:f.shared,callbacks:f.callbacks},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=i:r.next=i,u.lastBaseUpdate=i}var xm=!1;function ru(){if(xm){var r=xl;if(r!==null)throw r}}function au(r,i,u,f){xm=!1;var y=r.updateQueue;Si=!1;var v=y.firstBaseUpdate,k=y.lastBaseUpdate,A=y.shared.pending;if(A!==null){y.shared.pending=null;var H=A,ee=H.next;H.next=null,k===null?v=ee:k.next=ee,k=H;var oe=r.alternate;oe!==null&&(oe=oe.updateQueue,A=oe.lastBaseUpdate,A!==k&&(A===null?oe.firstBaseUpdate=ee:A.next=ee,oe.lastBaseUpdate=H))}if(v!==null){var fe=y.baseState;k=0,oe=ee=H=null,A=v;do{var te=A.lane&-536870913,se=te!==A.lane;if(se?(ot&te)===te:(f&te)===te){te!==0&&te===bl&&(xm=!0),oe!==null&&(oe=oe.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var _e=r,$e=A;te=i;var Ot=u;switch($e.tag){case 1:if(_e=$e.payload,typeof _e=="function"){fe=_e.call(Ot,fe,te);break e}fe=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=$e.payload,te=typeof _e=="function"?_e.call(Ot,fe,te):_e,te==null)break e;fe=p({},fe,te);break e;case 2:Si=!0}}te=A.callback,te!==null&&(r.flags|=64,se&&(r.flags|=8192),se=y.callbacks,se===null?y.callbacks=[te]:se.push(te))}else se={lane:te,tag:A.tag,payload:A.payload,callback:A.callback,next:null},oe===null?(ee=oe=se,H=fe):oe=oe.next=se,k|=te;if(A=A.next,A===null){if(A=y.shared.pending,A===null)break;se=A,A=se.next,se.next=null,y.lastBaseUpdate=se,y.shared.pending=null}}while(!0);oe===null&&(H=fe),y.baseState=H,y.firstBaseUpdate=ee,y.lastBaseUpdate=oe,v===null&&(y.shared.lanes=0),Ti|=k,r.lanes=k,r.memoizedState=fe}}function Ax(r,i){if(typeof r!="function")throw Error(a(191,r));r.call(i)}function Rx(r,i){var u=r.callbacks;if(u!==null)for(r.callbacks=null,r=0;r<u.length;r++)Ax(u[r],i)}var kl=D(null),gd=D(0);function Ox(r,i){r=Xa,T(gd,r),T(kl,i),Xa=r|i.baseLanes}function wm(){T(gd,Xa),T(kl,kl.current)}function Sm(){Xa=gd.current,U(kl),U(gd)}var Ar=D(null),Kr=null;function Ci(r){var i=r.alternate;T(dn,dn.current&1),T(Ar,r),Kr===null&&(i===null||kl.current!==null||i.memoizedState!==null)&&(Kr=r)}function km(r){T(dn,dn.current),T(Ar,r),Kr===null&&(Kr=r)}function zx(r){r.tag===22?(T(dn,dn.current),T(Ar,r),Kr===null&&(Kr=r)):Ei()}function Ei(){T(dn,dn.current),T(Ar,Ar.current)}function Rr(r){U(Ar),Kr===r&&(Kr=null),U(dn)}var dn=D(0);function yd(r){for(var i=r;i!==null;){if(i.tag===13){var u=i.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||Tp(u)||Ap(u)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Ha=0,Qe=null,At=null,vn=null,vd=!1,jl=!1,Ts=!1,bd=0,iu=0,Cl=null,xA=0;function tn(){throw Error(a(321))}function jm(r,i){if(i===null)return!1;for(var u=0;u<i.length&&u<r.length;u++)if(!_r(r[u],i[u]))return!1;return!0}function Cm(r,i,u,f,y,v){return Ha=v,Qe=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,q.H=r===null||r.memoizedState===null?g0:Bm,Ts=!1,v=u(f,y),Ts=!1,jl&&(v=Dx(i,u,f,y)),Mx(r),v}function Mx(r){q.H=ou;var i=At!==null&&At.next!==null;if(Ha=0,vn=At=Qe=null,vd=!1,iu=0,Cl=null,i)throw Error(a(300));r===null||bn||(r=r.dependencies,r!==null&&ud(r)&&(bn=!0))}function Dx(r,i,u,f){Qe=r;var y=0;do{if(jl&&(Cl=null),iu=0,jl=!1,25<=y)throw Error(a(301));if(y+=1,vn=At=null,r.updateQueue!=null){var v=r.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}q.H=y0,v=i(u,f)}while(jl);return v}function wA(){var r=q.H,i=r.useState()[0];return i=typeof i.then=="function"?su(i):i,r=r.useState()[0],(At!==null?At.memoizedState:null)!==r&&(Qe.flags|=1024),i}function Em(){var r=bd!==0;return bd=0,r}function Nm(r,i,u){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~u}function _m(r){if(vd){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}vd=!1}Ha=0,vn=At=Qe=null,jl=!1,iu=bd=0,Cl=null}function rr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vn===null?Qe.memoizedState=vn=r:vn=vn.next=r,vn}function fn(){if(At===null){var r=Qe.alternate;r=r!==null?r.memoizedState:null}else r=At.next;var i=vn===null?Qe.memoizedState:vn.next;if(i!==null)vn=i,At=r;else{if(r===null)throw Qe.alternate===null?Error(a(467)):Error(a(310));At=r,r={memoizedState:At.memoizedState,baseState:At.baseState,baseQueue:At.baseQueue,queue:At.queue,next:null},vn===null?Qe.memoizedState=vn=r:vn=vn.next=r}return vn}function xd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function su(r){var i=iu;return iu+=1,Cl===null&&(Cl=[]),r=Cx(Cl,r,i),i=Qe,(vn===null?i.memoizedState:vn.next)===null&&(i=i.alternate,q.H=i===null||i.memoizedState===null?g0:Bm),r}function wd(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return su(r);if(r.$$typeof===z)return Bn(r)}throw Error(a(438,String(r)))}function Tm(r){var i=null,u=Qe.updateQueue;if(u!==null&&(i=u.memoCache),i==null){var f=Qe.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(i={data:f.data.map(function(y){return y.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),u===null&&(u=xd(),Qe.updateQueue=u),u.memoCache=i,u=i.data[i.index],u===void 0)for(u=i.data[i.index]=Array(r),f=0;f<r;f++)u[f]=I;return i.index++,u}function qa(r,i){return typeof i=="function"?i(r):i}function Sd(r){var i=fn();return Am(i,At,r)}function Am(r,i,u){var f=r.queue;if(f===null)throw Error(a(311));f.lastRenderedReducer=u;var y=r.baseQueue,v=f.pending;if(v!==null){if(y!==null){var k=y.next;y.next=v.next,v.next=k}i.baseQueue=y=v,f.pending=null}if(v=r.baseState,y===null)r.memoizedState=v;else{i=y.next;var A=k=null,H=null,ee=i,oe=!1;do{var fe=ee.lane&-536870913;if(fe!==ee.lane?(ot&fe)===fe:(Ha&fe)===fe){var te=ee.revertLane;if(te===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),fe===bl&&(oe=!0);else if((Ha&te)===te){ee=ee.next,te===bl&&(oe=!0);continue}else fe={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(A=H=fe,k=v):H=H.next=fe,Qe.lanes|=te,Ti|=te;fe=ee.action,Ts&&u(v,fe),v=ee.hasEagerState?ee.eagerState:u(v,fe)}else te={lane:fe,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(A=H=te,k=v):H=H.next=te,Qe.lanes|=fe,Ti|=fe;ee=ee.next}while(ee!==null&&ee!==i);if(H===null?k=v:H.next=A,!_r(v,r.memoizedState)&&(bn=!0,oe&&(u=xl,u!==null)))throw u;r.memoizedState=v,r.baseState=k,r.baseQueue=H,f.lastRenderedState=v}return y===null&&(f.lanes=0),[r.memoizedState,f.dispatch]}function Rm(r){var i=fn(),u=i.queue;if(u===null)throw Error(a(311));u.lastRenderedReducer=r;var f=u.dispatch,y=u.pending,v=i.memoizedState;if(y!==null){u.pending=null;var k=y=y.next;do v=r(v,k.action),k=k.next;while(k!==y);_r(v,i.memoizedState)||(bn=!0),i.memoizedState=v,i.baseQueue===null&&(i.baseState=v),u.lastRenderedState=v}return[v,f]}function Ix(r,i,u){var f=Qe,y=fn(),v=dt;if(v){if(u===void 0)throw Error(a(407));u=u()}else u=i();var k=!_r((At||y).memoizedState,u);if(k&&(y.memoizedState=u,bn=!0),y=y.queue,Mm(Ux.bind(null,f,y,r),[r]),y.getSnapshot!==i||k||vn!==null&&vn.memoizedState.tag&1){if(f.flags|=2048,El(9,{destroy:void 0},Px.bind(null,f,y,u,i),null),zt===null)throw Error(a(349));v||(Ha&127)!==0||Lx(f,i,u)}return u}function Lx(r,i,u){r.flags|=16384,r={getSnapshot:i,value:u},i=Qe.updateQueue,i===null?(i=xd(),Qe.updateQueue=i,i.stores=[r]):(u=i.stores,u===null?i.stores=[r]:u.push(r))}function Px(r,i,u,f){i.value=u,i.getSnapshot=f,Bx(i)&&Fx(r)}function Ux(r,i,u){return u(function(){Bx(i)&&Fx(r)})}function Bx(r){var i=r.getSnapshot;r=r.value;try{var u=i();return!_r(r,u)}catch{return!0}}function Fx(r){var i=xs(r,2);i!==null&&yr(i,r,2)}function Om(r){var i=rr();if(typeof r=="function"){var u=r;if(r=u(),Ts){Tt(!0);try{u()}finally{Tt(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qa,lastRenderedState:r},i}function $x(r,i,u,f){return r.baseState=u,Am(r,At,typeof f=="function"?f:qa)}function SA(r,i,u,f,y){if(Cd(r))throw Error(a(485));if(r=i.action,r!==null){var v={payload:y,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(k){v.listeners.push(k)}};q.T!==null?u(!0):v.isTransition=!1,f(v),u=i.pending,u===null?(v.next=i.pending=v,Hx(i,v)):(v.next=u.next,i.pending=u.next=v)}}function Hx(r,i){var u=i.action,f=i.payload,y=r.state;if(i.isTransition){var v=q.T,k={};q.T=k;try{var A=u(y,f),H=q.S;H!==null&&H(k,A),qx(r,i,A)}catch(ee){zm(r,i,ee)}finally{v!==null&&k.types!==null&&(v.types=k.types),q.T=v}}else try{v=u(y,f),qx(r,i,v)}catch(ee){zm(r,i,ee)}}function qx(r,i,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(f){Zx(r,i,f)},function(f){return zm(r,i,f)}):Zx(r,i,u)}function Zx(r,i,u){i.status="fulfilled",i.value=u,Gx(i),r.state=u,i=r.pending,i!==null&&(u=i.next,u===i?r.pending=null:(u=u.next,i.next=u,Hx(r,u)))}function zm(r,i,u){var f=r.pending;if(r.pending=null,f!==null){f=f.next;do i.status="rejected",i.reason=u,Gx(i),i=i.next;while(i!==f)}r.action=null}function Gx(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function Vx(r,i){return i}function Qx(r,i){if(dt){var u=zt.formState;if(u!==null){e:{var f=Qe;if(dt){if(Bt){t:{for(var y=Bt,v=Qr;y.nodeType!==8;){if(!v){y=null;break t}if(y=Yr(y.nextSibling),y===null){y=null;break t}}v=y.data,y=v==="F!"||v==="F"?y:null}if(y){Bt=Yr(y.nextSibling),f=y.data==="F!";break e}}xi(f)}f=!1}f&&(i=u[0])}}return u=rr(),u.memoizedState=u.baseState=i,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vx,lastRenderedState:i},u.queue=f,u=h0.bind(null,Qe,f),f.dispatch=u,f=Om(!1),v=Um.bind(null,Qe,!1,f.queue),f=rr(),y={state:i,dispatch:null,action:r,pending:null},f.queue=y,u=SA.bind(null,Qe,y,v,u),y.dispatch=u,f.memoizedState=r,[i,u,!1]}function Kx(r){var i=fn();return Yx(i,At,r)}function Yx(r,i,u){if(i=Am(r,i,Vx)[0],r=Sd(qa)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var f=su(i)}catch(k){throw k===wl?fd:k}else f=i;i=fn();var y=i.queue,v=y.dispatch;return u!==i.memoizedState&&(Qe.flags|=2048,El(9,{destroy:void 0},kA.bind(null,y,u),null)),[f,v,r]}function kA(r,i){r.action=i}function Xx(r){var i=fn(),u=At;if(u!==null)return Yx(i,u,r);fn(),i=i.memoizedState,u=fn();var f=u.queue.dispatch;return u.memoizedState=r,[i,f,!1]}function El(r,i,u,f){return r={tag:r,create:u,deps:f,inst:i,next:null},i=Qe.updateQueue,i===null&&(i=xd(),Qe.updateQueue=i),u=i.lastEffect,u===null?i.lastEffect=r.next=r:(f=u.next,u.next=r,r.next=f,i.lastEffect=r),r}function Wx(){return fn().memoizedState}function kd(r,i,u,f){var y=rr();Qe.flags|=r,y.memoizedState=El(1|i,{destroy:void 0},u,f===void 0?null:f)}function jd(r,i,u,f){var y=fn();f=f===void 0?null:f;var v=y.memoizedState.inst;At!==null&&f!==null&&jm(f,At.memoizedState.deps)?y.memoizedState=El(i,v,u,f):(Qe.flags|=r,y.memoizedState=El(1|i,v,u,f))}function Jx(r,i){kd(8390656,8,r,i)}function Mm(r,i){jd(2048,8,r,i)}function jA(r){Qe.flags|=4;var i=Qe.updateQueue;if(i===null)i=xd(),Qe.updateQueue=i,i.events=[r];else{var u=i.events;u===null?i.events=[r]:u.push(r)}}function e0(r){var i=fn().memoizedState;return jA({ref:i,nextImpl:r}),function(){if((jt&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function t0(r,i){return jd(4,2,r,i)}function n0(r,i){return jd(4,4,r,i)}function r0(r,i){if(typeof i=="function"){r=r();var u=i(r);return function(){typeof u=="function"?u():i(null)}}if(i!=null)return r=r(),i.current=r,function(){i.current=null}}function a0(r,i,u){u=u!=null?u.concat([r]):null,jd(4,4,r0.bind(null,i,r),u)}function Dm(){}function i0(r,i){var u=fn();i=i===void 0?null:i;var f=u.memoizedState;return i!==null&&jm(i,f[1])?f[0]:(u.memoizedState=[r,i],r)}function s0(r,i){var u=fn();i=i===void 0?null:i;var f=u.memoizedState;if(i!==null&&jm(i,f[1]))return f[0];if(f=r(),Ts){Tt(!0);try{r()}finally{Tt(!1)}}return u.memoizedState=[f,i],f}function Im(r,i,u){return u===void 0||(Ha&1073741824)!==0&&(ot&261930)===0?r.memoizedState=i:(r.memoizedState=u,r=lw(),Qe.lanes|=r,Ti|=r,u)}function l0(r,i,u,f){return _r(u,i)?u:kl.current!==null?(r=Im(r,u,f),_r(r,i)||(bn=!0),r):(Ha&42)===0||(Ha&1073741824)!==0&&(ot&261930)===0?(bn=!0,r.memoizedState=u):(r=lw(),Qe.lanes|=r,Ti|=r,i)}function o0(r,i,u,f,y){var v=ne.p;ne.p=v!==0&&8>v?v:8;var k=q.T,A={};q.T=A,Um(r,!1,i,u);try{var H=y(),ee=q.S;if(ee!==null&&ee(A,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var oe=bA(H,f);lu(r,i,oe,Mr(r))}else lu(r,i,f,Mr(r))}catch(fe){lu(r,i,{then:function(){},status:"rejected",reason:fe},Mr())}finally{ne.p=v,k!==null&&A.types!==null&&(k.types=A.types),q.T=k}}function CA(){}function Lm(r,i,u,f){if(r.tag!==5)throw Error(a(476));var y=u0(r).queue;o0(r,y,i,we,u===null?CA:function(){return c0(r),u(f)})}function u0(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:we,baseState:we,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qa,lastRenderedState:we},next:null};var u={};return i.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qa,lastRenderedState:u},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function c0(r){var i=u0(r);i.next===null&&(i=r.alternate.memoizedState),lu(r,i.next.queue,{},Mr())}function Pm(){return Bn(ju)}function d0(){return fn().memoizedState}function f0(){return fn().memoizedState}function EA(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var u=Mr();r=ki(u);var f=ji(i,r,u);f!==null&&(yr(f,i,u),nu(f,i,u)),i={cache:hm()},r.payload=i;return}i=i.return}}function NA(r,i,u){var f=Mr();u={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Cd(r)?m0(i,u):(u=nm(r,i,u,f),u!==null&&(yr(u,r,f),p0(u,i,f)))}function h0(r,i,u){var f=Mr();lu(r,i,u,f)}function lu(r,i,u,f){var y={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Cd(r))m0(i,y);else{var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var k=i.lastRenderedState,A=v(k,u);if(y.hasEagerState=!0,y.eagerState=A,_r(A,k))return id(r,i,y,0),zt===null&&ad(),!1}catch{}finally{}if(u=nm(r,i,y,f),u!==null)return yr(u,r,f),p0(u,i,f),!0}return!1}function Um(r,i,u,f){if(f={lane:2,revertLane:yp(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Cd(r)){if(i)throw Error(a(479))}else i=nm(r,u,f,2),i!==null&&yr(i,r,2)}function Cd(r){var i=r.alternate;return r===Qe||i!==null&&i===Qe}function m0(r,i){jl=vd=!0;var u=r.pending;u===null?i.next=i:(i.next=u.next,u.next=i),r.pending=i}function p0(r,i,u){if((u&4194048)!==0){var f=i.lanes;f&=r.pendingLanes,u|=f,i.lanes=u,gs(r,u)}}var ou={readContext:Bn,use:wd,useCallback:tn,useContext:tn,useEffect:tn,useImperativeHandle:tn,useLayoutEffect:tn,useInsertionEffect:tn,useMemo:tn,useReducer:tn,useRef:tn,useState:tn,useDebugValue:tn,useDeferredValue:tn,useTransition:tn,useSyncExternalStore:tn,useId:tn,useHostTransitionStatus:tn,useFormState:tn,useActionState:tn,useOptimistic:tn,useMemoCache:tn,useCacheRefresh:tn};ou.useEffectEvent=tn;var g0={readContext:Bn,use:wd,useCallback:function(r,i){return rr().memoizedState=[r,i===void 0?null:i],r},useContext:Bn,useEffect:Jx,useImperativeHandle:function(r,i,u){u=u!=null?u.concat([r]):null,kd(4194308,4,r0.bind(null,i,r),u)},useLayoutEffect:function(r,i){return kd(4194308,4,r,i)},useInsertionEffect:function(r,i){kd(4,2,r,i)},useMemo:function(r,i){var u=rr();i=i===void 0?null:i;var f=r();if(Ts){Tt(!0);try{r()}finally{Tt(!1)}}return u.memoizedState=[f,i],f},useReducer:function(r,i,u){var f=rr();if(u!==void 0){var y=u(i);if(Ts){Tt(!0);try{u(i)}finally{Tt(!1)}}}else y=i;return f.memoizedState=f.baseState=y,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:y},f.queue=r,r=r.dispatch=NA.bind(null,Qe,r),[f.memoizedState,r]},useRef:function(r){var i=rr();return r={current:r},i.memoizedState=r},useState:function(r){r=Om(r);var i=r.queue,u=h0.bind(null,Qe,i);return i.dispatch=u,[r.memoizedState,u]},useDebugValue:Dm,useDeferredValue:function(r,i){var u=rr();return Im(u,r,i)},useTransition:function(){var r=Om(!1);return r=o0.bind(null,Qe,r.queue,!0,!1),rr().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,u){var f=Qe,y=rr();if(dt){if(u===void 0)throw Error(a(407));u=u()}else{if(u=i(),zt===null)throw Error(a(349));(ot&127)!==0||Lx(f,i,u)}y.memoizedState=u;var v={value:u,getSnapshot:i};return y.queue=v,Jx(Ux.bind(null,f,v,r),[r]),f.flags|=2048,El(9,{destroy:void 0},Px.bind(null,f,v,u,i),null),u},useId:function(){var r=rr(),i=zt.identifierPrefix;if(dt){var u=ka,f=Sa;u=(f&~(1<<32-rt(f)-1)).toString(32)+u,i="_"+i+"R_"+u,u=bd++,0<u&&(i+="H"+u.toString(32)),i+="_"}else u=xA++,i="_"+i+"r_"+u.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:Pm,useFormState:Qx,useActionState:Qx,useOptimistic:function(r){var i=rr();i.memoizedState=i.baseState=r;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=u,i=Um.bind(null,Qe,!0,u),u.dispatch=i,[r,i]},useMemoCache:Tm,useCacheRefresh:function(){return rr().memoizedState=EA.bind(null,Qe)},useEffectEvent:function(r){var i=rr(),u={impl:r};return i.memoizedState=u,function(){if((jt&2)!==0)throw Error(a(440));return u.impl.apply(void 0,arguments)}}},Bm={readContext:Bn,use:wd,useCallback:i0,useContext:Bn,useEffect:Mm,useImperativeHandle:a0,useInsertionEffect:t0,useLayoutEffect:n0,useMemo:s0,useReducer:Sd,useRef:Wx,useState:function(){return Sd(qa)},useDebugValue:Dm,useDeferredValue:function(r,i){var u=fn();return l0(u,At.memoizedState,r,i)},useTransition:function(){var r=Sd(qa)[0],i=fn().memoizedState;return[typeof r=="boolean"?r:su(r),i]},useSyncExternalStore:Ix,useId:d0,useHostTransitionStatus:Pm,useFormState:Kx,useActionState:Kx,useOptimistic:function(r,i){var u=fn();return $x(u,At,r,i)},useMemoCache:Tm,useCacheRefresh:f0};Bm.useEffectEvent=e0;var y0={readContext:Bn,use:wd,useCallback:i0,useContext:Bn,useEffect:Mm,useImperativeHandle:a0,useInsertionEffect:t0,useLayoutEffect:n0,useMemo:s0,useReducer:Rm,useRef:Wx,useState:function(){return Rm(qa)},useDebugValue:Dm,useDeferredValue:function(r,i){var u=fn();return At===null?Im(u,r,i):l0(u,At.memoizedState,r,i)},useTransition:function(){var r=Rm(qa)[0],i=fn().memoizedState;return[typeof r=="boolean"?r:su(r),i]},useSyncExternalStore:Ix,useId:d0,useHostTransitionStatus:Pm,useFormState:Xx,useActionState:Xx,useOptimistic:function(r,i){var u=fn();return At!==null?$x(u,At,r,i):(u.baseState=r,[r,u.queue.dispatch])},useMemoCache:Tm,useCacheRefresh:f0};y0.useEffectEvent=e0;function Fm(r,i,u,f){i=r.memoizedState,u=u(f,i),u=u==null?i:p({},i,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var $m={enqueueSetState:function(r,i,u){r=r._reactInternals;var f=Mr(),y=ki(f);y.payload=i,u!=null&&(y.callback=u),i=ji(r,y,f),i!==null&&(yr(i,r,f),nu(i,r,f))},enqueueReplaceState:function(r,i,u){r=r._reactInternals;var f=Mr(),y=ki(f);y.tag=1,y.payload=i,u!=null&&(y.callback=u),i=ji(r,y,f),i!==null&&(yr(i,r,f),nu(i,r,f))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var u=Mr(),f=ki(u);f.tag=2,i!=null&&(f.callback=i),i=ji(r,f,u),i!==null&&(yr(i,r,u),nu(i,r,u))}};function v0(r,i,u,f,y,v,k){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(f,v,k):i.prototype&&i.prototype.isPureReactComponent?!Qo(u,f)||!Qo(y,v):!0}function b0(r,i,u,f){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(u,f),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(u,f),i.state!==r&&$m.enqueueReplaceState(i,i.state,null)}function As(r,i){var u=i;if("ref"in i){u={};for(var f in i)f!=="ref"&&(u[f]=i[f])}if(r=r.defaultProps){u===i&&(u=p({},u));for(var y in r)u[y]===void 0&&(u[y]=r[y])}return u}function x0(r){rd(r)}function w0(r){console.error(r)}function S0(r){rd(r)}function Ed(r,i){try{var u=r.onUncaughtError;u(i.value,{componentStack:i.stack})}catch(f){setTimeout(function(){throw f})}}function k0(r,i,u){try{var f=r.onCaughtError;f(u.value,{componentStack:u.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Hm(r,i,u){return u=ki(u),u.tag=3,u.payload={element:null},u.callback=function(){Ed(r,i)},u}function j0(r){return r=ki(r),r.tag=3,r}function C0(r,i,u,f){var y=u.type.getDerivedStateFromError;if(typeof y=="function"){var v=f.value;r.payload=function(){return y(v)},r.callback=function(){k0(i,u,f)}}var k=u.stateNode;k!==null&&typeof k.componentDidCatch=="function"&&(r.callback=function(){k0(i,u,f),typeof y!="function"&&(Ai===null?Ai=new Set([this]):Ai.add(this));var A=f.stack;this.componentDidCatch(f.value,{componentStack:A!==null?A:""})})}function _A(r,i,u,f,y){if(u.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(i=u.alternate,i!==null&&vl(i,u,y,!0),u=Ar.current,u!==null){switch(u.tag){case 31:case 13:return Kr===null?Pd():u.alternate===null&&nn===0&&(nn=3),u.flags&=-257,u.flags|=65536,u.lanes=y,f===hd?u.flags|=16384:(i=u.updateQueue,i===null?u.updateQueue=new Set([f]):i.add(f),mp(r,f,y)),!1;case 22:return u.flags|=65536,f===hd?u.flags|=16384:(i=u.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([f])},u.updateQueue=i):(u=i.retryQueue,u===null?i.retryQueue=new Set([f]):u.add(f)),mp(r,f,y)),!1}throw Error(a(435,u.tag))}return mp(r,f,y),Pd(),!1}if(dt)return i=Ar.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=y,f!==om&&(r=Error(a(422),{cause:f}),Xo(Zr(r,u)))):(f!==om&&(i=Error(a(423),{cause:f}),Xo(Zr(i,u))),r=r.current.alternate,r.flags|=65536,y&=-y,r.lanes|=y,f=Zr(f,u),y=Hm(r.stateNode,f,y),bm(r,y),nn!==4&&(nn=2)),!1;var v=Error(a(520),{cause:f});if(v=Zr(v,u),gu===null?gu=[v]:gu.push(v),nn!==4&&(nn=2),i===null)return!0;f=Zr(f,u),u=i;do{switch(u.tag){case 3:return u.flags|=65536,r=y&-y,u.lanes|=r,r=Hm(u.stateNode,f,r),bm(u,r),!1;case 1:if(i=u.type,v=u.stateNode,(u.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Ai===null||!Ai.has(v))))return u.flags|=65536,y&=-y,u.lanes|=y,y=j0(y),C0(y,r,u,f),bm(u,y),!1}u=u.return}while(u!==null);return!1}var qm=Error(a(461)),bn=!1;function Fn(r,i,u,f){i.child=r===null?Tx(i,null,u,f):_s(i,r.child,u,f)}function E0(r,i,u,f,y){u=u.render;var v=i.ref;if("ref"in f){var k={};for(var A in f)A!=="ref"&&(k[A]=f[A])}else k=f;return js(i),f=Cm(r,i,u,k,v,y),A=Em(),r!==null&&!bn?(Nm(r,i,y),Za(r,i,y)):(dt&&A&&sm(i),i.flags|=1,Fn(r,i,f,y),i.child)}function N0(r,i,u,f,y){if(r===null){var v=u.type;return typeof v=="function"&&!rm(v)&&v.defaultProps===void 0&&u.compare===null?(i.tag=15,i.type=v,_0(r,i,v,f,y)):(r=ld(u.type,null,f,i,i.mode,y),r.ref=i.ref,r.return=i,i.child=r)}if(v=r.child,!Wm(r,y)){var k=v.memoizedProps;if(u=u.compare,u=u!==null?u:Qo,u(k,f)&&r.ref===i.ref)return Za(r,i,y)}return i.flags|=1,r=Ua(v,f),r.ref=i.ref,r.return=i,i.child=r}function _0(r,i,u,f,y){if(r!==null){var v=r.memoizedProps;if(Qo(v,f)&&r.ref===i.ref)if(bn=!1,i.pendingProps=f=v,Wm(r,y))(r.flags&131072)!==0&&(bn=!0);else return i.lanes=r.lanes,Za(r,i,y)}return Zm(r,i,u,f,y)}function T0(r,i,u,f){var y=f.children,v=r!==null?r.memoizedState:null;if(r===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((i.flags&128)!==0){if(v=v!==null?v.baseLanes|u:u,r!==null){for(f=i.child=r.child,y=0;f!==null;)y=y|f.lanes|f.childLanes,f=f.sibling;f=y&~v}else f=0,i.child=null;return A0(r,i,v,u,f)}if((u&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&dd(i,v!==null?v.cachePool:null),v!==null?Ox(i,v):wm(),zx(i);else return f=i.lanes=536870912,A0(r,i,v!==null?v.baseLanes|u:u,u,f)}else v!==null?(dd(i,v.cachePool),Ox(i,v),Ei(),i.memoizedState=null):(r!==null&&dd(i,null),wm(),Ei());return Fn(r,i,y,u),i.child}function uu(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function A0(r,i,u,f,y){var v=pm();return v=v===null?null:{parent:yn._currentValue,pool:v},i.memoizedState={baseLanes:u,cachePool:v},r!==null&&dd(i,null),wm(),zx(i),r!==null&&vl(r,i,f,!0),i.childLanes=y,null}function Nd(r,i){return i=Td({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function R0(r,i,u){return _s(i,r.child,null,u),r=Nd(i,i.pendingProps),r.flags|=2,Rr(i),i.memoizedState=null,r}function TA(r,i,u){var f=i.pendingProps,y=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(dt){if(f.mode==="hidden")return r=Nd(i,f),i.lanes=536870912,uu(null,r);if(km(i),(r=Bt)?(r=Hw(r,Qr),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:vi!==null?{id:Sa,overflow:ka}:null,retryLane:536870912,hydrationErrors:null},u=mx(r),u.return=i,i.child=u,Un=i,Bt=null)):r=null,r===null)throw xi(i);return i.lanes=536870912,null}return Nd(i,f)}var v=r.memoizedState;if(v!==null){var k=v.dehydrated;if(km(i),y)if(i.flags&256)i.flags&=-257,i=R0(r,i,u);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(a(558));else if(bn||vl(r,i,u,!1),y=(u&r.childLanes)!==0,bn||y){if(f=zt,f!==null&&(k=qc(f,u),k!==0&&k!==v.retryLane))throw v.retryLane=k,xs(r,k),yr(f,r,k),qm;Pd(),i=R0(r,i,u)}else r=v.treeContext,Bt=Yr(k.nextSibling),Un=i,dt=!0,bi=null,Qr=!1,r!==null&&yx(i,r),i=Nd(i,f),i.flags|=4096;return i}return r=Ua(r.child,{mode:f.mode,children:f.children}),r.ref=i.ref,i.child=r,r.return=i,r}function _d(r,i){var u=i.ref;if(u===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(a(284));(r===null||r.ref!==u)&&(i.flags|=4194816)}}function Zm(r,i,u,f,y){return js(i),u=Cm(r,i,u,f,void 0,y),f=Em(),r!==null&&!bn?(Nm(r,i,y),Za(r,i,y)):(dt&&f&&sm(i),i.flags|=1,Fn(r,i,u,y),i.child)}function O0(r,i,u,f,y,v){return js(i),i.updateQueue=null,u=Dx(i,f,u,y),Mx(r),f=Em(),r!==null&&!bn?(Nm(r,i,v),Za(r,i,v)):(dt&&f&&sm(i),i.flags|=1,Fn(r,i,u,v),i.child)}function z0(r,i,u,f,y){if(js(i),i.stateNode===null){var v=ml,k=u.contextType;typeof k=="object"&&k!==null&&(v=Bn(k)),v=new u(f,v),i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=$m,i.stateNode=v,v._reactInternals=i,v=i.stateNode,v.props=f,v.state=i.memoizedState,v.refs={},ym(i),k=u.contextType,v.context=typeof k=="object"&&k!==null?Bn(k):ml,v.state=i.memoizedState,k=u.getDerivedStateFromProps,typeof k=="function"&&(Fm(i,u,k,f),v.state=i.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(k=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),k!==v.state&&$m.enqueueReplaceState(v,v.state,null),au(i,f,v,y),ru(),v.state=i.memoizedState),typeof v.componentDidMount=="function"&&(i.flags|=4194308),f=!0}else if(r===null){v=i.stateNode;var A=i.memoizedProps,H=As(u,A);v.props=H;var ee=v.context,oe=u.contextType;k=ml,typeof oe=="object"&&oe!==null&&(k=Bn(oe));var fe=u.getDerivedStateFromProps;oe=typeof fe=="function"||typeof v.getSnapshotBeforeUpdate=="function",A=i.pendingProps!==A,oe||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(A||ee!==k)&&b0(i,v,f,k),Si=!1;var te=i.memoizedState;v.state=te,au(i,f,v,y),ru(),ee=i.memoizedState,A||te!==ee||Si?(typeof fe=="function"&&(Fm(i,u,fe,f),ee=i.memoizedState),(H=Si||v0(i,u,H,f,te,ee,k))?(oe||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(i.flags|=4194308)):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=f,i.memoizedState=ee),v.props=f,v.state=ee,v.context=k,f=H):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),f=!1)}else{v=i.stateNode,vm(r,i),k=i.memoizedProps,oe=As(u,k),v.props=oe,fe=i.pendingProps,te=v.context,ee=u.contextType,H=ml,typeof ee=="object"&&ee!==null&&(H=Bn(ee)),A=u.getDerivedStateFromProps,(ee=typeof A=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(k!==fe||te!==H)&&b0(i,v,f,H),Si=!1,te=i.memoizedState,v.state=te,au(i,f,v,y),ru();var se=i.memoizedState;k!==fe||te!==se||Si||r!==null&&r.dependencies!==null&&ud(r.dependencies)?(typeof A=="function"&&(Fm(i,u,A,f),se=i.memoizedState),(oe=Si||v0(i,u,oe,f,te,se,H)||r!==null&&r.dependencies!==null&&ud(r.dependencies))?(ee||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(f,se,H),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(f,se,H)),typeof v.componentDidUpdate=="function"&&(i.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof v.componentDidUpdate!="function"||k===r.memoizedProps&&te===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||k===r.memoizedProps&&te===r.memoizedState||(i.flags|=1024),i.memoizedProps=f,i.memoizedState=se),v.props=f,v.state=se,v.context=H,f=oe):(typeof v.componentDidUpdate!="function"||k===r.memoizedProps&&te===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||k===r.memoizedProps&&te===r.memoizedState||(i.flags|=1024),f=!1)}return v=f,_d(r,i),f=(i.flags&128)!==0,v||f?(v=i.stateNode,u=f&&typeof u.getDerivedStateFromError!="function"?null:v.render(),i.flags|=1,r!==null&&f?(i.child=_s(i,r.child,null,y),i.child=_s(i,null,u,y)):Fn(r,i,u,y),i.memoizedState=v.state,r=i.child):r=Za(r,i,y),r}function M0(r,i,u,f){return Ss(),i.flags|=256,Fn(r,i,u,f),i.child}var Gm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vm(r){return{baseLanes:r,cachePool:kx()}}function Qm(r,i,u){return r=r!==null?r.childLanes&~u:0,i&&(r|=zr),r}function D0(r,i,u){var f=i.pendingProps,y=!1,v=(i.flags&128)!==0,k;if((k=v)||(k=r!==null&&r.memoizedState===null?!1:(dn.current&2)!==0),k&&(y=!0,i.flags&=-129),k=(i.flags&32)!==0,i.flags&=-33,r===null){if(dt){if(y?Ci(i):Ei(),(r=Bt)?(r=Hw(r,Qr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:vi!==null?{id:Sa,overflow:ka}:null,retryLane:536870912,hydrationErrors:null},u=mx(r),u.return=i,i.child=u,Un=i,Bt=null)):r=null,r===null)throw xi(i);return Ap(r)?i.lanes=32:i.lanes=536870912,null}var A=f.children;return f=f.fallback,y?(Ei(),y=i.mode,A=Td({mode:"hidden",children:A},y),f=ws(f,y,u,null),A.return=i,f.return=i,A.sibling=f,i.child=A,f=i.child,f.memoizedState=Vm(u),f.childLanes=Qm(r,k,u),i.memoizedState=Gm,uu(null,f)):(Ci(i),Km(i,A))}var H=r.memoizedState;if(H!==null&&(A=H.dehydrated,A!==null)){if(v)i.flags&256?(Ci(i),i.flags&=-257,i=Ym(r,i,u)):i.memoizedState!==null?(Ei(),i.child=r.child,i.flags|=128,i=null):(Ei(),A=f.fallback,y=i.mode,f=Td({mode:"visible",children:f.children},y),A=ws(A,y,u,null),A.flags|=2,f.return=i,A.return=i,f.sibling=A,i.child=f,_s(i,r.child,null,u),f=i.child,f.memoizedState=Vm(u),f.childLanes=Qm(r,k,u),i.memoizedState=Gm,i=uu(null,f));else if(Ci(i),Ap(A)){if(k=A.nextSibling&&A.nextSibling.dataset,k)var ee=k.dgst;k=ee,f=Error(a(419)),f.stack="",f.digest=k,Xo({value:f,source:null,stack:null}),i=Ym(r,i,u)}else if(bn||vl(r,i,u,!1),k=(u&r.childLanes)!==0,bn||k){if(k=zt,k!==null&&(f=qc(k,u),f!==0&&f!==H.retryLane))throw H.retryLane=f,xs(r,f),yr(k,r,f),qm;Tp(A)||Pd(),i=Ym(r,i,u)}else Tp(A)?(i.flags|=192,i.child=r.child,i=null):(r=H.treeContext,Bt=Yr(A.nextSibling),Un=i,dt=!0,bi=null,Qr=!1,r!==null&&yx(i,r),i=Km(i,f.children),i.flags|=4096);return i}return y?(Ei(),A=f.fallback,y=i.mode,H=r.child,ee=H.sibling,f=Ua(H,{mode:"hidden",children:f.children}),f.subtreeFlags=H.subtreeFlags&65011712,ee!==null?A=Ua(ee,A):(A=ws(A,y,u,null),A.flags|=2),A.return=i,f.return=i,f.sibling=A,i.child=f,uu(null,f),f=i.child,A=r.child.memoizedState,A===null?A=Vm(u):(y=A.cachePool,y!==null?(H=yn._currentValue,y=y.parent!==H?{parent:H,pool:H}:y):y=kx(),A={baseLanes:A.baseLanes|u,cachePool:y}),f.memoizedState=A,f.childLanes=Qm(r,k,u),i.memoizedState=Gm,uu(r.child,f)):(Ci(i),u=r.child,r=u.sibling,u=Ua(u,{mode:"visible",children:f.children}),u.return=i,u.sibling=null,r!==null&&(k=i.deletions,k===null?(i.deletions=[r],i.flags|=16):k.push(r)),i.child=u,i.memoizedState=null,u)}function Km(r,i){return i=Td({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function Td(r,i){return r=Tr(22,r,null,i),r.lanes=0,r}function Ym(r,i,u){return _s(i,r.child,null,u),r=Km(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function I0(r,i,u){r.lanes|=i;var f=r.alternate;f!==null&&(f.lanes|=i),dm(r.return,i,u)}function Xm(r,i,u,f,y,v){var k=r.memoizedState;k===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:f,tail:u,tailMode:y,treeForkCount:v}:(k.isBackwards=i,k.rendering=null,k.renderingStartTime=0,k.last=f,k.tail=u,k.tailMode=y,k.treeForkCount=v)}function L0(r,i,u){var f=i.pendingProps,y=f.revealOrder,v=f.tail;f=f.children;var k=dn.current,A=(k&2)!==0;if(A?(k=k&1|2,i.flags|=128):k&=1,T(dn,k),Fn(r,i,f,u),f=dt?Yo:0,!A&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&I0(r,u,i);else if(r.tag===19)I0(r,u,i);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(y){case"forwards":for(u=i.child,y=null;u!==null;)r=u.alternate,r!==null&&yd(r)===null&&(y=u),u=u.sibling;u=y,u===null?(y=i.child,i.child=null):(y=u.sibling,u.sibling=null),Xm(i,!1,y,u,v,f);break;case"backwards":case"unstable_legacy-backwards":for(u=null,y=i.child,i.child=null;y!==null;){if(r=y.alternate,r!==null&&yd(r)===null){i.child=y;break}r=y.sibling,y.sibling=u,u=y,y=r}Xm(i,!0,u,null,v,f);break;case"together":Xm(i,!1,null,null,void 0,f);break;default:i.memoizedState=null}return i.child}function Za(r,i,u){if(r!==null&&(i.dependencies=r.dependencies),Ti|=i.lanes,(u&i.childLanes)===0)if(r!==null){if(vl(r,i,u,!1),(u&i.childLanes)===0)return null}else return null;if(r!==null&&i.child!==r.child)throw Error(a(153));if(i.child!==null){for(r=i.child,u=Ua(r,r.pendingProps),i.child=u,u.return=i;r.sibling!==null;)r=r.sibling,u=u.sibling=Ua(r,r.pendingProps),u.return=i;u.sibling=null}return i.child}function Wm(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&ud(r)))}function AA(r,i,u){switch(i.tag){case 3:ve(i,i.stateNode.containerInfo),wi(i,yn,r.memoizedState.cache),Ss();break;case 27:case 5:Ge(i);break;case 4:ve(i,i.stateNode.containerInfo);break;case 10:wi(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,km(i),null;break;case 13:var f=i.memoizedState;if(f!==null)return f.dehydrated!==null?(Ci(i),i.flags|=128,null):(u&i.child.childLanes)!==0?D0(r,i,u):(Ci(i),r=Za(r,i,u),r!==null?r.sibling:null);Ci(i);break;case 19:var y=(r.flags&128)!==0;if(f=(u&i.childLanes)!==0,f||(vl(r,i,u,!1),f=(u&i.childLanes)!==0),y){if(f)return L0(r,i,u);i.flags|=128}if(y=i.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),T(dn,dn.current),f)break;return null;case 22:return i.lanes=0,T0(r,i,u,i.pendingProps);case 24:wi(i,yn,r.memoizedState.cache)}return Za(r,i,u)}function P0(r,i,u){if(r!==null)if(r.memoizedProps!==i.pendingProps)bn=!0;else{if(!Wm(r,u)&&(i.flags&128)===0)return bn=!1,AA(r,i,u);bn=(r.flags&131072)!==0}else bn=!1,dt&&(i.flags&1048576)!==0&&gx(i,Yo,i.index);switch(i.lanes=0,i.tag){case 16:e:{var f=i.pendingProps;if(r=Es(i.elementType),i.type=r,typeof r=="function")rm(r)?(f=As(r,f),i.tag=1,i=z0(null,i,r,f,u)):(i.tag=0,i=Zm(null,i,r,f,u));else{if(r!=null){var y=r.$$typeof;if(y===M){i.tag=11,i=E0(null,i,r,f,u);break e}else if(y===F){i.tag=14,i=N0(null,i,r,f,u);break e}}throw i=X(r)||r,Error(a(306,i,""))}}return i;case 0:return Zm(r,i,i.type,i.pendingProps,u);case 1:return f=i.type,y=As(f,i.pendingProps),z0(r,i,f,y,u);case 3:e:{if(ve(i,i.stateNode.containerInfo),r===null)throw Error(a(387));f=i.pendingProps;var v=i.memoizedState;y=v.element,vm(r,i),au(i,f,null,u);var k=i.memoizedState;if(f=k.cache,wi(i,yn,f),f!==v.cache&&fm(i,[yn],u,!0),ru(),f=k.element,v.isDehydrated)if(v={element:f,isDehydrated:!1,cache:k.cache},i.updateQueue.baseState=v,i.memoizedState=v,i.flags&256){i=M0(r,i,f,u);break e}else if(f!==y){y=Zr(Error(a(424)),i),Xo(y),i=M0(r,i,f,u);break e}else{switch(r=i.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(Bt=Yr(r.firstChild),Un=i,dt=!0,bi=null,Qr=!0,u=Tx(i,null,f,u),i.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(Ss(),f===y){i=Za(r,i,u);break e}Fn(r,i,f,u)}i=i.child}return i;case 26:return _d(r,i),r===null?(u=Kw(i.type,null,i.pendingProps,null))?i.memoizedState=u:dt||(u=i.type,r=i.pendingProps,f=Zd(ue.current).createElement(u),f[un]=i,f[qt]=r,$n(f,u,r),ct(f),i.stateNode=f):i.memoizedState=Kw(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return Ge(i),r===null&&dt&&(f=i.stateNode=Gw(i.type,i.pendingProps,ue.current),Un=i,Qr=!0,y=Bt,Mi(i.type)?(Rp=y,Bt=Yr(f.firstChild)):Bt=y),Fn(r,i,i.pendingProps.children,u),_d(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&dt&&((y=f=Bt)&&(f=s2(f,i.type,i.pendingProps,Qr),f!==null?(i.stateNode=f,Un=i,Bt=Yr(f.firstChild),Qr=!1,y=!0):y=!1),y||xi(i)),Ge(i),y=i.type,v=i.pendingProps,k=r!==null?r.memoizedProps:null,f=v.children,Ep(y,v)?f=null:k!==null&&Ep(y,k)&&(i.flags|=32),i.memoizedState!==null&&(y=Cm(r,i,wA,null,null,u),ju._currentValue=y),_d(r,i),Fn(r,i,f,u),i.child;case 6:return r===null&&dt&&((r=u=Bt)&&(u=l2(u,i.pendingProps,Qr),u!==null?(i.stateNode=u,Un=i,Bt=null,r=!0):r=!1),r||xi(i)),null;case 13:return D0(r,i,u);case 4:return ve(i,i.stateNode.containerInfo),f=i.pendingProps,r===null?i.child=_s(i,null,f,u):Fn(r,i,f,u),i.child;case 11:return E0(r,i,i.type,i.pendingProps,u);case 7:return Fn(r,i,i.pendingProps,u),i.child;case 8:return Fn(r,i,i.pendingProps.children,u),i.child;case 12:return Fn(r,i,i.pendingProps.children,u),i.child;case 10:return f=i.pendingProps,wi(i,i.type,f.value),Fn(r,i,f.children,u),i.child;case 9:return y=i.type._context,f=i.pendingProps.children,js(i),y=Bn(y),f=f(y),i.flags|=1,Fn(r,i,f,u),i.child;case 14:return N0(r,i,i.type,i.pendingProps,u);case 15:return _0(r,i,i.type,i.pendingProps,u);case 19:return L0(r,i,u);case 31:return TA(r,i,u);case 22:return T0(r,i,u,i.pendingProps);case 24:return js(i),f=Bn(yn),r===null?(y=pm(),y===null&&(y=zt,v=hm(),y.pooledCache=v,v.refCount++,v!==null&&(y.pooledCacheLanes|=u),y=v),i.memoizedState={parent:f,cache:y},ym(i),wi(i,yn,y)):((r.lanes&u)!==0&&(vm(r,i),au(i,null,null,u),ru()),y=r.memoizedState,v=i.memoizedState,y.parent!==f?(y={parent:f,cache:f},i.memoizedState=y,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=y),wi(i,yn,f)):(f=v.cache,wi(i,yn,f),f!==y.cache&&fm(i,[yn],u,!0))),Fn(r,i,i.pendingProps.children,u),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Ga(r){r.flags|=4}function Jm(r,i,u,f,y){if((i=(r.mode&32)!==0)&&(i=!1),i){if(r.flags|=16777216,(y&335544128)===y)if(r.stateNode.complete)r.flags|=8192;else if(dw())r.flags|=8192;else throw Ns=hd,gm}else r.flags&=-16777217}function U0(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!eS(i))if(dw())r.flags|=8192;else throw Ns=hd,gm}function Ad(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?ke():536870912,r.lanes|=i,Al|=i)}function cu(r,i){if(!dt)switch(r.tailMode){case"hidden":i=r.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?r.tail=null:u.sibling=null;break;case"collapsed":u=r.tail;for(var f=null;u!==null;)u.alternate!==null&&(f=u),u=u.sibling;f===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:f.sibling=null}}function Ft(r){var i=r.alternate!==null&&r.alternate.child===r.child,u=0,f=0;if(i)for(var y=r.child;y!==null;)u|=y.lanes|y.childLanes,f|=y.subtreeFlags&65011712,f|=y.flags&65011712,y.return=r,y=y.sibling;else for(y=r.child;y!==null;)u|=y.lanes|y.childLanes,f|=y.subtreeFlags,f|=y.flags,y.return=r,y=y.sibling;return r.subtreeFlags|=f,r.childLanes=u,i}function RA(r,i,u){var f=i.pendingProps;switch(lm(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ft(i),null;case 1:return Ft(i),null;case 3:return u=i.stateNode,f=null,r!==null&&(f=r.memoizedState.cache),i.memoizedState.cache!==f&&(i.flags|=2048),$a(yn),me(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(r===null||r.child===null)&&(yl(i)?Ga(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,um())),Ft(i),null;case 26:var y=i.type,v=i.memoizedState;return r===null?(Ga(i),v!==null?(Ft(i),U0(i,v)):(Ft(i),Jm(i,y,null,f,u))):v?v!==r.memoizedState?(Ga(i),Ft(i),U0(i,v)):(Ft(i),i.flags&=-16777217):(r=r.memoizedProps,r!==f&&Ga(i),Ft(i),Jm(i,y,r,f,u)),null;case 27:if(Be(i),u=ue.current,y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==f&&Ga(i);else{if(!f){if(i.stateNode===null)throw Error(a(166));return Ft(i),null}r=Z.current,yl(i)?vx(i):(r=Gw(y,f,u),i.stateNode=r,Ga(i))}return Ft(i),null;case 5:if(Be(i),y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==f&&Ga(i);else{if(!f){if(i.stateNode===null)throw Error(a(166));return Ft(i),null}if(v=Z.current,yl(i))vx(i);else{var k=Zd(ue.current);switch(v){case 1:v=k.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:v=k.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":v=k.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":v=k.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":v=k.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof f.is=="string"?k.createElement("select",{is:f.is}):k.createElement("select"),f.multiple?v.multiple=!0:f.size&&(v.size=f.size);break;default:v=typeof f.is=="string"?k.createElement(y,{is:f.is}):k.createElement(y)}}v[un]=i,v[qt]=f;e:for(k=i.child;k!==null;){if(k.tag===5||k.tag===6)v.appendChild(k.stateNode);else if(k.tag!==4&&k.tag!==27&&k.child!==null){k.child.return=k,k=k.child;continue}if(k===i)break e;for(;k.sibling===null;){if(k.return===null||k.return===i)break e;k=k.return}k.sibling.return=k.return,k=k.sibling}i.stateNode=v;e:switch($n(v,y,f),y){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&Ga(i)}}return Ft(i),Jm(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,u),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==f&&Ga(i);else{if(typeof f!="string"&&i.stateNode===null)throw Error(a(166));if(r=ue.current,yl(i)){if(r=i.stateNode,u=i.memoizedProps,f=null,y=Un,y!==null)switch(y.tag){case 27:case 5:f=y.memoizedProps}r[un]=i,r=!!(r.nodeValue===u||f!==null&&f.suppressHydrationWarning===!0||Dw(r.nodeValue,u)),r||xi(i,!0)}else r=Zd(r).createTextNode(f),r[un]=i,i.stateNode=r}return Ft(i),null;case 31:if(u=i.memoizedState,r===null||r.memoizedState!==null){if(f=yl(i),u!==null){if(r===null){if(!f)throw Error(a(318));if(r=i.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(557));r[un]=i}else Ss(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ft(i),r=!1}else u=um(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=u),r=!0;if(!r)return i.flags&256?(Rr(i),i):(Rr(i),null);if((i.flags&128)!==0)throw Error(a(558))}return Ft(i),null;case 13:if(f=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(y=yl(i),f!==null&&f.dehydrated!==null){if(r===null){if(!y)throw Error(a(318));if(y=i.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(a(317));y[un]=i}else Ss(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ft(i),y=!1}else y=um(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=y),y=!0;if(!y)return i.flags&256?(Rr(i),i):(Rr(i),null)}return Rr(i),(i.flags&128)!==0?(i.lanes=u,i):(u=f!==null,r=r!==null&&r.memoizedState!==null,u&&(f=i.child,y=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(y=f.alternate.memoizedState.cachePool.pool),v=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(v=f.memoizedState.cachePool.pool),v!==y&&(f.flags|=2048)),u!==r&&u&&(i.child.flags|=8192),Ad(i,i.updateQueue),Ft(i),null);case 4:return me(),r===null&&wp(i.stateNode.containerInfo),Ft(i),null;case 10:return $a(i.type),Ft(i),null;case 19:if(U(dn),f=i.memoizedState,f===null)return Ft(i),null;if(y=(i.flags&128)!==0,v=f.rendering,v===null)if(y)cu(f,!1);else{if(nn!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(v=yd(r),v!==null){for(i.flags|=128,cu(f,!1),r=v.updateQueue,i.updateQueue=r,Ad(i,r),i.subtreeFlags=0,r=u,u=i.child;u!==null;)hx(u,r),u=u.sibling;return T(dn,dn.current&1|2),dt&&Ba(i,f.treeForkCount),i.child}r=r.sibling}f.tail!==null&&ln()>Dd&&(i.flags|=128,y=!0,cu(f,!1),i.lanes=4194304)}else{if(!y)if(r=yd(v),r!==null){if(i.flags|=128,y=!0,r=r.updateQueue,i.updateQueue=r,Ad(i,r),cu(f,!0),f.tail===null&&f.tailMode==="hidden"&&!v.alternate&&!dt)return Ft(i),null}else 2*ln()-f.renderingStartTime>Dd&&u!==536870912&&(i.flags|=128,y=!0,cu(f,!1),i.lanes=4194304);f.isBackwards?(v.sibling=i.child,i.child=v):(r=f.last,r!==null?r.sibling=v:i.child=v,f.last=v)}return f.tail!==null?(r=f.tail,f.rendering=r,f.tail=r.sibling,f.renderingStartTime=ln(),r.sibling=null,u=dn.current,T(dn,y?u&1|2:u&1),dt&&Ba(i,f.treeForkCount),r):(Ft(i),null);case 22:case 23:return Rr(i),Sm(),f=i.memoizedState!==null,r!==null?r.memoizedState!==null!==f&&(i.flags|=8192):f&&(i.flags|=8192),f?(u&536870912)!==0&&(i.flags&128)===0&&(Ft(i),i.subtreeFlags&6&&(i.flags|=8192)):Ft(i),u=i.updateQueue,u!==null&&Ad(i,u.retryQueue),u=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),f=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(f=i.memoizedState.cachePool.pool),f!==u&&(i.flags|=2048),r!==null&&U(Cs),null;case 24:return u=null,r!==null&&(u=r.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),$a(yn),Ft(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function OA(r,i){switch(lm(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return $a(yn),me(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return Be(i),null;case 31:if(i.memoizedState!==null){if(Rr(i),i.alternate===null)throw Error(a(340));Ss()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(Rr(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Ss()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return U(dn),null;case 4:return me(),null;case 10:return $a(i.type),null;case 22:case 23:return Rr(i),Sm(),r!==null&&U(Cs),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return $a(yn),null;case 25:return null;default:return null}}function B0(r,i){switch(lm(i),i.tag){case 3:$a(yn),me();break;case 26:case 27:case 5:Be(i);break;case 4:me();break;case 31:i.memoizedState!==null&&Rr(i);break;case 13:Rr(i);break;case 19:U(dn);break;case 10:$a(i.type);break;case 22:case 23:Rr(i),Sm(),r!==null&&U(Cs);break;case 24:$a(yn)}}function du(r,i){try{var u=i.updateQueue,f=u!==null?u.lastEffect:null;if(f!==null){var y=f.next;u=y;do{if((u.tag&r)===r){f=void 0;var v=u.create,k=u.inst;f=v(),k.destroy=f}u=u.next}while(u!==y)}}catch(A){_t(i,i.return,A)}}function Ni(r,i,u){try{var f=i.updateQueue,y=f!==null?f.lastEffect:null;if(y!==null){var v=y.next;f=v;do{if((f.tag&r)===r){var k=f.inst,A=k.destroy;if(A!==void 0){k.destroy=void 0,y=i;var H=u,ee=A;try{ee()}catch(oe){_t(y,H,oe)}}}f=f.next}while(f!==v)}}catch(oe){_t(i,i.return,oe)}}function F0(r){var i=r.updateQueue;if(i!==null){var u=r.stateNode;try{Rx(i,u)}catch(f){_t(r,r.return,f)}}}function $0(r,i,u){u.props=As(r.type,r.memoizedProps),u.state=r.memoizedState;try{u.componentWillUnmount()}catch(f){_t(r,i,f)}}function fu(r,i){try{var u=r.ref;if(u!==null){switch(r.tag){case 26:case 27:case 5:var f=r.stateNode;break;case 30:f=r.stateNode;break;default:f=r.stateNode}typeof u=="function"?r.refCleanup=u(f):u.current=f}}catch(y){_t(r,i,y)}}function ja(r,i){var u=r.ref,f=r.refCleanup;if(u!==null)if(typeof f=="function")try{f()}catch(y){_t(r,i,y)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(y){_t(r,i,y)}else u.current=null}function H0(r){var i=r.type,u=r.memoizedProps,f=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":u.autoFocus&&f.focus();break e;case"img":u.src?f.src=u.src:u.srcSet&&(f.srcset=u.srcSet)}}catch(y){_t(r,r.return,y)}}function ep(r,i,u){try{var f=r.stateNode;e2(f,r.type,u,i),f[qt]=i}catch(y){_t(r,r.return,y)}}function q0(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&Mi(r.type)||r.tag===4}function tp(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||q0(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&&Mi(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function np(r,i,u){var f=r.tag;if(f===5||f===6)r=r.stateNode,i?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(r,i):(i=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,i.appendChild(r),u=u._reactRootContainer,u!=null||i.onclick!==null||(i.onclick=La));else if(f!==4&&(f===27&&Mi(r.type)&&(u=r.stateNode,i=null),r=r.child,r!==null))for(np(r,i,u),r=r.sibling;r!==null;)np(r,i,u),r=r.sibling}function Rd(r,i,u){var f=r.tag;if(f===5||f===6)r=r.stateNode,i?u.insertBefore(r,i):u.appendChild(r);else if(f!==4&&(f===27&&Mi(r.type)&&(u=r.stateNode),r=r.child,r!==null))for(Rd(r,i,u),r=r.sibling;r!==null;)Rd(r,i,u),r=r.sibling}function Z0(r){var i=r.stateNode,u=r.memoizedProps;try{for(var f=r.type,y=i.attributes;y.length;)i.removeAttributeNode(y[0]);$n(i,f,u),i[un]=r,i[qt]=u}catch(v){_t(r,r.return,v)}}var Va=!1,xn=!1,rp=!1,G0=typeof WeakSet=="function"?WeakSet:Set,Dn=null;function zA(r,i){if(r=r.containerInfo,jp=Wd,r=ax(r),Yh(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var f=u.getSelection&&u.getSelection();if(f&&f.rangeCount!==0){u=f.anchorNode;var y=f.anchorOffset,v=f.focusNode;f=f.focusOffset;try{u.nodeType,v.nodeType}catch{u=null;break e}var k=0,A=-1,H=-1,ee=0,oe=0,fe=r,te=null;t:for(;;){for(var se;fe!==u||y!==0&&fe.nodeType!==3||(A=k+y),fe!==v||f!==0&&fe.nodeType!==3||(H=k+f),fe.nodeType===3&&(k+=fe.nodeValue.length),(se=fe.firstChild)!==null;)te=fe,fe=se;for(;;){if(fe===r)break t;if(te===u&&++ee===y&&(A=k),te===v&&++oe===f&&(H=k),(se=fe.nextSibling)!==null)break;fe=te,te=fe.parentNode}fe=se}u=A===-1||H===-1?null:{start:A,end:H}}else u=null}u=u||{start:0,end:0}}else u=null;for(Cp={focusedElem:r,selectionRange:u},Wd=!1,Dn=i;Dn!==null;)if(i=Dn,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,Dn=r;else for(;Dn!==null;){switch(i=Dn,v=i.alternate,r=i.flags,i.tag){case 0:if((r&4)!==0&&(r=i.updateQueue,r=r!==null?r.events:null,r!==null))for(u=0;u<r.length;u++)y=r[u],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&v!==null){r=void 0,u=i,y=v.memoizedProps,v=v.memoizedState,f=u.stateNode;try{var _e=As(u.type,y);r=f.getSnapshotBeforeUpdate(_e,v),f.__reactInternalSnapshotBeforeUpdate=r}catch($e){_t(u,u.return,$e)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,u=r.nodeType,u===9)_p(r);else if(u===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":_p(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(a(163))}if(r=i.sibling,r!==null){r.return=i.return,Dn=r;break}Dn=i.return}}function V0(r,i,u){var f=u.flags;switch(u.tag){case 0:case 11:case 15:Ka(r,u),f&4&&du(5,u);break;case 1:if(Ka(r,u),f&4)if(r=u.stateNode,i===null)try{r.componentDidMount()}catch(k){_t(u,u.return,k)}else{var y=As(u.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(y,i,r.__reactInternalSnapshotBeforeUpdate)}catch(k){_t(u,u.return,k)}}f&64&&F0(u),f&512&&fu(u,u.return);break;case 3:if(Ka(r,u),f&64&&(r=u.updateQueue,r!==null)){if(i=null,u.child!==null)switch(u.child.tag){case 27:case 5:i=u.child.stateNode;break;case 1:i=u.child.stateNode}try{Rx(r,i)}catch(k){_t(u,u.return,k)}}break;case 27:i===null&&f&4&&Z0(u);case 26:case 5:Ka(r,u),i===null&&f&4&&H0(u),f&512&&fu(u,u.return);break;case 12:Ka(r,u);break;case 31:Ka(r,u),f&4&&Y0(r,u);break;case 13:Ka(r,u),f&4&&X0(r,u),f&64&&(r=u.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(u=$A.bind(null,u),o2(r,u))));break;case 22:if(f=u.memoizedState!==null||Va,!f){i=i!==null&&i.memoizedState!==null||xn,y=Va;var v=xn;Va=f,(xn=i)&&!v?Ya(r,u,(u.subtreeFlags&8772)!==0):Ka(r,u),Va=y,xn=v}break;case 30:break;default:Ka(r,u)}}function Q0(r){var i=r.alternate;i!==null&&(r.alternate=null,Q0(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&Ie(i)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var Zt=null,hr=!1;function Qa(r,i,u){for(u=u.child;u!==null;)K0(r,i,u),u=u.sibling}function K0(r,i,u){if(It&&typeof It.onCommitFiberUnmount=="function")try{It.onCommitFiberUnmount($t,u)}catch{}switch(u.tag){case 26:xn||ja(u,i),Qa(r,i,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:xn||ja(u,i);var f=Zt,y=hr;Mi(u.type)&&(Zt=u.stateNode,hr=!1),Qa(r,i,u),wu(u.stateNode),Zt=f,hr=y;break;case 5:xn||ja(u,i);case 6:if(f=Zt,y=hr,Zt=null,Qa(r,i,u),Zt=f,hr=y,Zt!==null)if(hr)try{(Zt.nodeType===9?Zt.body:Zt.nodeName==="HTML"?Zt.ownerDocument.body:Zt).removeChild(u.stateNode)}catch(v){_t(u,i,v)}else try{Zt.removeChild(u.stateNode)}catch(v){_t(u,i,v)}break;case 18:Zt!==null&&(hr?(r=Zt,Fw(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,u.stateNode),Pl(r)):Fw(Zt,u.stateNode));break;case 4:f=Zt,y=hr,Zt=u.stateNode.containerInfo,hr=!0,Qa(r,i,u),Zt=f,hr=y;break;case 0:case 11:case 14:case 15:Ni(2,u,i),xn||Ni(4,u,i),Qa(r,i,u);break;case 1:xn||(ja(u,i),f=u.stateNode,typeof f.componentWillUnmount=="function"&&$0(u,i,f)),Qa(r,i,u);break;case 21:Qa(r,i,u);break;case 22:xn=(f=xn)||u.memoizedState!==null,Qa(r,i,u),xn=f;break;default:Qa(r,i,u)}}function Y0(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{Pl(r)}catch(u){_t(i,i.return,u)}}}function X0(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{Pl(r)}catch(u){_t(i,i.return,u)}}function MA(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new G0),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new G0),i;default:throw Error(a(435,r.tag))}}function Od(r,i){var u=MA(r);i.forEach(function(f){if(!u.has(f)){u.add(f);var y=HA.bind(null,r,f);f.then(y,y)}})}function mr(r,i){var u=i.deletions;if(u!==null)for(var f=0;f<u.length;f++){var y=u[f],v=r,k=i,A=k;e:for(;A!==null;){switch(A.tag){case 27:if(Mi(A.type)){Zt=A.stateNode,hr=!1;break e}break;case 5:Zt=A.stateNode,hr=!1;break e;case 3:case 4:Zt=A.stateNode.containerInfo,hr=!0;break e}A=A.return}if(Zt===null)throw Error(a(160));K0(v,k,y),Zt=null,hr=!1,v=y.alternate,v!==null&&(v.return=null),y.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)W0(i,r),i=i.sibling}var ma=null;function W0(r,i){var u=r.alternate,f=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:mr(i,r),pr(r),f&4&&(Ni(3,r,r.return),du(3,r),Ni(5,r,r.return));break;case 1:mr(i,r),pr(r),f&512&&(xn||u===null||ja(u,u.return)),f&64&&Va&&(r=r.updateQueue,r!==null&&(f=r.callbacks,f!==null&&(u=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=u===null?f:u.concat(f))));break;case 26:var y=ma;if(mr(i,r),pr(r),f&512&&(xn||u===null||ja(u,u.return)),f&4){var v=u!==null?u.memoizedState:null;if(f=r.memoizedState,u===null)if(f===null)if(r.stateNode===null){e:{f=r.type,u=r.memoizedProps,y=y.ownerDocument||y;t:switch(f){case"title":v=y.getElementsByTagName("title")[0],(!v||v[gi]||v[un]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=y.createElement(f),y.head.insertBefore(v,y.querySelector("head > title"))),$n(v,f,u),v[un]=r,ct(v),f=v;break e;case"link":var k=Ww("link","href",y).get(f+(u.href||""));if(k){for(var A=0;A<k.length;A++)if(v=k[A],v.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&v.getAttribute("rel")===(u.rel==null?null:u.rel)&&v.getAttribute("title")===(u.title==null?null:u.title)&&v.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){k.splice(A,1);break t}}v=y.createElement(f),$n(v,f,u),y.head.appendChild(v);break;case"meta":if(k=Ww("meta","content",y).get(f+(u.content||""))){for(A=0;A<k.length;A++)if(v=k[A],v.getAttribute("content")===(u.content==null?null:""+u.content)&&v.getAttribute("name")===(u.name==null?null:u.name)&&v.getAttribute("property")===(u.property==null?null:u.property)&&v.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&v.getAttribute("charset")===(u.charSet==null?null:u.charSet)){k.splice(A,1);break t}}v=y.createElement(f),$n(v,f,u),y.head.appendChild(v);break;default:throw Error(a(468,f))}v[un]=r,ct(v),f=v}r.stateNode=f}else Jw(y,r.type,r.stateNode);else r.stateNode=Xw(y,f,r.memoizedProps);else v!==f?(v===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):v.count--,f===null?Jw(y,r.type,r.stateNode):Xw(y,f,r.memoizedProps)):f===null&&r.stateNode!==null&&ep(r,r.memoizedProps,u.memoizedProps)}break;case 27:mr(i,r),pr(r),f&512&&(xn||u===null||ja(u,u.return)),u!==null&&f&4&&ep(r,r.memoizedProps,u.memoizedProps);break;case 5:if(mr(i,r),pr(r),f&512&&(xn||u===null||ja(u,u.return)),r.flags&32){y=r.stateNode;try{ll(y,"")}catch(_e){_t(r,r.return,_e)}}f&4&&r.stateNode!=null&&(y=r.memoizedProps,ep(r,y,u!==null?u.memoizedProps:y)),f&1024&&(rp=!0);break;case 6:if(mr(i,r),pr(r),f&4){if(r.stateNode===null)throw Error(a(162));f=r.memoizedProps,u=r.stateNode;try{u.nodeValue=f}catch(_e){_t(r,r.return,_e)}}break;case 3:if(Qd=null,y=ma,ma=Gd(i.containerInfo),mr(i,r),ma=y,pr(r),f&4&&u!==null&&u.memoizedState.isDehydrated)try{Pl(i.containerInfo)}catch(_e){_t(r,r.return,_e)}rp&&(rp=!1,J0(r));break;case 4:f=ma,ma=Gd(r.stateNode.containerInfo),mr(i,r),pr(r),ma=f;break;case 12:mr(i,r),pr(r);break;case 31:mr(i,r),pr(r),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,Od(r,f)));break;case 13:mr(i,r),pr(r),r.child.flags&8192&&r.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(Md=ln()),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,Od(r,f)));break;case 22:y=r.memoizedState!==null;var H=u!==null&&u.memoizedState!==null,ee=Va,oe=xn;if(Va=ee||y,xn=oe||H,mr(i,r),xn=oe,Va=ee,pr(r),f&8192)e:for(i=r.stateNode,i._visibility=y?i._visibility&-2:i._visibility|1,y&&(u===null||H||Va||xn||Rs(r)),u=null,i=r;;){if(i.tag===5||i.tag===26){if(u===null){H=u=i;try{if(v=H.stateNode,y)k=v.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none";else{A=H.stateNode;var fe=H.memoizedProps.style,te=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;A.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(_e){_t(H,H.return,_e)}}}else if(i.tag===6){if(u===null){H=i;try{H.stateNode.nodeValue=y?"":H.memoizedProps}catch(_e){_t(H,H.return,_e)}}}else if(i.tag===18){if(u===null){H=i;try{var se=H.stateNode;y?$w(se,!0):$w(H.stateNode,!1)}catch(_e){_t(H,H.return,_e)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===r)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;u===i&&(u=null),i=i.return}u===i&&(u=null),i.sibling.return=i.return,i=i.sibling}f&4&&(f=r.updateQueue,f!==null&&(u=f.retryQueue,u!==null&&(f.retryQueue=null,Od(r,u))));break;case 19:mr(i,r),pr(r),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,Od(r,f)));break;case 30:break;case 21:break;default:mr(i,r),pr(r)}}function pr(r){var i=r.flags;if(i&2){try{for(var u,f=r.return;f!==null;){if(q0(f)){u=f;break}f=f.return}if(u==null)throw Error(a(160));switch(u.tag){case 27:var y=u.stateNode,v=tp(r);Rd(r,v,y);break;case 5:var k=u.stateNode;u.flags&32&&(ll(k,""),u.flags&=-33);var A=tp(r);Rd(r,A,k);break;case 3:case 4:var H=u.stateNode.containerInfo,ee=tp(r);np(r,ee,H);break;default:throw Error(a(161))}}catch(oe){_t(r,r.return,oe)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function J0(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;J0(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function Ka(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)V0(r,i.alternate,i),i=i.sibling}function Rs(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:Ni(4,i,i.return),Rs(i);break;case 1:ja(i,i.return);var u=i.stateNode;typeof u.componentWillUnmount=="function"&&$0(i,i.return,u),Rs(i);break;case 27:wu(i.stateNode);case 26:case 5:ja(i,i.return),Rs(i);break;case 22:i.memoizedState===null&&Rs(i);break;case 30:Rs(i);break;default:Rs(i)}r=r.sibling}}function Ya(r,i,u){for(u=u&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var f=i.alternate,y=r,v=i,k=v.flags;switch(v.tag){case 0:case 11:case 15:Ya(y,v,u),du(4,v);break;case 1:if(Ya(y,v,u),f=v,y=f.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(ee){_t(f,f.return,ee)}if(f=v,y=f.updateQueue,y!==null){var A=f.stateNode;try{var H=y.shared.hiddenCallbacks;if(H!==null)for(y.shared.hiddenCallbacks=null,y=0;y<H.length;y++)Ax(H[y],A)}catch(ee){_t(f,f.return,ee)}}u&&k&64&&F0(v),fu(v,v.return);break;case 27:Z0(v);case 26:case 5:Ya(y,v,u),u&&f===null&&k&4&&H0(v),fu(v,v.return);break;case 12:Ya(y,v,u);break;case 31:Ya(y,v,u),u&&k&4&&Y0(y,v);break;case 13:Ya(y,v,u),u&&k&4&&X0(y,v);break;case 22:v.memoizedState===null&&Ya(y,v,u),fu(v,v.return);break;case 30:break;default:Ya(y,v,u)}i=i.sibling}}function ap(r,i){var u=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==u&&(r!=null&&r.refCount++,u!=null&&Wo(u))}function ip(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&Wo(r))}function pa(r,i,u,f){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)ew(r,i,u,f),i=i.sibling}function ew(r,i,u,f){var y=i.flags;switch(i.tag){case 0:case 11:case 15:pa(r,i,u,f),y&2048&&du(9,i);break;case 1:pa(r,i,u,f);break;case 3:pa(r,i,u,f),y&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&Wo(r)));break;case 12:if(y&2048){pa(r,i,u,f),r=i.stateNode;try{var v=i.memoizedProps,k=v.id,A=v.onPostCommit;typeof A=="function"&&A(k,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(H){_t(i,i.return,H)}}else pa(r,i,u,f);break;case 31:pa(r,i,u,f);break;case 13:pa(r,i,u,f);break;case 23:break;case 22:v=i.stateNode,k=i.alternate,i.memoizedState!==null?v._visibility&2?pa(r,i,u,f):hu(r,i):v._visibility&2?pa(r,i,u,f):(v._visibility|=2,Nl(r,i,u,f,(i.subtreeFlags&10256)!==0||!1)),y&2048&&ap(k,i);break;case 24:pa(r,i,u,f),y&2048&&ip(i.alternate,i);break;default:pa(r,i,u,f)}}function Nl(r,i,u,f,y){for(y=y&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var v=r,k=i,A=u,H=f,ee=k.flags;switch(k.tag){case 0:case 11:case 15:Nl(v,k,A,H,y),du(8,k);break;case 23:break;case 22:var oe=k.stateNode;k.memoizedState!==null?oe._visibility&2?Nl(v,k,A,H,y):hu(v,k):(oe._visibility|=2,Nl(v,k,A,H,y)),y&&ee&2048&&ap(k.alternate,k);break;case 24:Nl(v,k,A,H,y),y&&ee&2048&&ip(k.alternate,k);break;default:Nl(v,k,A,H,y)}i=i.sibling}}function hu(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var u=r,f=i,y=f.flags;switch(f.tag){case 22:hu(u,f),y&2048&&ap(f.alternate,f);break;case 24:hu(u,f),y&2048&&ip(f.alternate,f);break;default:hu(u,f)}i=i.sibling}}var mu=8192;function _l(r,i,u){if(r.subtreeFlags&mu)for(r=r.child;r!==null;)tw(r,i,u),r=r.sibling}function tw(r,i,u){switch(r.tag){case 26:_l(r,i,u),r.flags&mu&&r.memoizedState!==null&&x2(u,ma,r.memoizedState,r.memoizedProps);break;case 5:_l(r,i,u);break;case 3:case 4:var f=ma;ma=Gd(r.stateNode.containerInfo),_l(r,i,u),ma=f;break;case 22:r.memoizedState===null&&(f=r.alternate,f!==null&&f.memoizedState!==null?(f=mu,mu=16777216,_l(r,i,u),mu=f):_l(r,i,u));break;default:_l(r,i,u)}}function nw(r){var i=r.alternate;if(i!==null&&(r=i.child,r!==null)){i.child=null;do i=r.sibling,r.sibling=null,r=i;while(r!==null)}}function pu(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var u=0;u<i.length;u++){var f=i[u];Dn=f,aw(f,r)}nw(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)rw(r),r=r.sibling}function rw(r){switch(r.tag){case 0:case 11:case 15:pu(r),r.flags&2048&&Ni(9,r,r.return);break;case 3:pu(r);break;case 12:pu(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,zd(r)):pu(r);break;default:pu(r)}}function zd(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var u=0;u<i.length;u++){var f=i[u];Dn=f,aw(f,r)}nw(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:Ni(8,i,i.return),zd(i);break;case 22:u=i.stateNode,u._visibility&2&&(u._visibility&=-3,zd(i));break;default:zd(i)}r=r.sibling}}function aw(r,i){for(;Dn!==null;){var u=Dn;switch(u.tag){case 0:case 11:case 15:Ni(8,u,i);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var f=u.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:Wo(u.memoizedState.cache)}if(f=u.child,f!==null)f.return=u,Dn=f;else e:for(u=r;Dn!==null;){f=Dn;var y=f.sibling,v=f.return;if(Q0(f),f===u){Dn=null;break e}if(y!==null){y.return=v,Dn=y;break e}Dn=v}}}var DA={getCacheForType:function(r){var i=Bn(yn),u=i.data.get(r);return u===void 0&&(u=r(),i.data.set(r,u)),u},cacheSignal:function(){return Bn(yn).controller.signal}},IA=typeof WeakMap=="function"?WeakMap:Map,jt=0,zt=null,at=null,ot=0,Nt=0,Or=null,_i=!1,Tl=!1,sp=!1,Xa=0,nn=0,Ti=0,Os=0,lp=0,zr=0,Al=0,gu=null,gr=null,op=!1,Md=0,iw=0,Dd=1/0,Id=null,Ai=null,Nn=0,Ri=null,Rl=null,Wa=0,up=0,cp=null,sw=null,yu=0,dp=null;function Mr(){return(jt&2)!==0&&ot!==0?ot&-ot:q.T!==null?yp():Io()}function lw(){if(zr===0)if((ot&536870912)===0||dt){var r=da;da<<=1,(da&3932160)===0&&(da=262144),zr=r}else zr=536870912;return r=Ar.current,r!==null&&(r.flags|=32),zr}function yr(r,i,u){(r===zt&&(Nt===2||Nt===9)||r.cancelPendingCommit!==null)&&(Ol(r,0),Oi(r,ot,zr,!1)),pn(r,u),((jt&2)===0||r!==zt)&&(r===zt&&((jt&2)===0&&(Os|=u),nn===4&&Oi(r,ot,zr,!1)),Ca(r))}function ow(r,i,u){if((jt&6)!==0)throw Error(a(327));var f=!u&&(i&127)===0&&(i&r.expiredLanes)===0||wa(r,i),y=f?UA(r,i):hp(r,i,!0),v=f;do{if(y===0){Tl&&!f&&Oi(r,i,0,!1);break}else{if(u=r.current.alternate,v&&!LA(u)){y=hp(r,i,!1),v=!1;continue}if(y===2){if(v=i,r.errorRecoveryDisabledLanes&v)var k=0;else k=r.pendingLanes&-536870913,k=k!==0?k:k&536870912?536870912:0;if(k!==0){i=k;e:{var A=r;y=gu;var H=A.current.memoizedState.isDehydrated;if(H&&(Ol(A,k).flags|=256),k=hp(A,k,!1),k!==2){if(sp&&!H){A.errorRecoveryDisabledLanes|=v,Os|=v,y=4;break e}v=gr,gr=y,v!==null&&(gr===null?gr=v:gr.push.apply(gr,v))}y=k}if(v=!1,y!==2)continue}}if(y===1){Ol(r,0),Oi(r,i,0,!0);break}e:{switch(f=r,v=y,v){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:Oi(f,i,zr,!_i);break e;case 2:gr=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(y=Md+300-ln(),10<y)){if(Oi(f,i,zr,!_i),Ma(f,0,!0)!==0)break e;Wa=i,f.timeoutHandle=Uw(uw.bind(null,f,u,gr,Id,op,i,zr,Os,Al,_i,v,"Throttled",-0,0),y);break e}uw(f,u,gr,Id,op,i,zr,Os,Al,_i,v,null,-0,0)}}break}while(!0);Ca(r)}function uw(r,i,u,f,y,v,k,A,H,ee,oe,fe,te,se){if(r.timeoutHandle=-1,fe=i.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:La},tw(i,v,fe);var _e=(v&62914560)===v?Md-ln():(v&4194048)===v?iw-ln():0;if(_e=w2(fe,_e),_e!==null){Wa=v,r.cancelPendingCommit=_e(yw.bind(null,r,i,v,u,f,y,k,A,H,oe,fe,null,te,se)),Oi(r,v,k,!ee);return}}yw(r,i,v,u,f,y,k,A,H)}function LA(r){for(var i=r;;){var u=i.tag;if((u===0||u===11||u===15)&&i.flags&16384&&(u=i.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var f=0;f<u.length;f++){var y=u[f],v=y.getSnapshot;y=y.value;try{if(!_r(v(),y))return!1}catch{return!1}}if(u=i.child,i.subtreeFlags&16384&&u!==null)u.return=i,i=u;else{if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Oi(r,i,u,f){i&=~lp,i&=~Os,r.suspendedLanes|=i,r.pingedLanes&=~i,f&&(r.warmLanes|=i),f=r.expirationTimes;for(var y=i;0<y;){var v=31-rt(y),k=1<<v;f[v]=-1,y&=~k}u!==0&&pi(r,u,i)}function Ld(){return(jt&6)===0?(vu(0),!1):!0}function fp(){if(at!==null){if(Nt===0)var r=at.return;else r=at,Fa=ks=null,_m(r),Sl=null,eu=0,r=at;for(;r!==null;)B0(r.alternate,r),r=r.return;at=null}}function Ol(r,i){var u=r.timeoutHandle;u!==-1&&(r.timeoutHandle=-1,r2(u)),u=r.cancelPendingCommit,u!==null&&(r.cancelPendingCommit=null,u()),Wa=0,fp(),zt=r,at=u=Ua(r.current,null),ot=i,Nt=0,Or=null,_i=!1,Tl=wa(r,i),sp=!1,Al=zr=lp=Os=Ti=nn=0,gr=gu=null,op=!1,(i&8)!==0&&(i|=i&32);var f=r.entangledLanes;if(f!==0)for(r=r.entanglements,f&=i;0<f;){var y=31-rt(f),v=1<<y;i|=r[y],f&=~v}return Xa=i,ad(),u}function cw(r,i){Qe=null,q.H=ou,i===wl||i===fd?(i=Ex(),Nt=3):i===gm?(i=Ex(),Nt=4):Nt=i===qm?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Or=i,at===null&&(nn=1,Ed(r,Zr(i,r.current)))}function dw(){var r=Ar.current;return r===null?!0:(ot&4194048)===ot?Kr===null:(ot&62914560)===ot||(ot&536870912)!==0?r===Kr:!1}function fw(){var r=q.H;return q.H=ou,r===null?ou:r}function hw(){var r=q.A;return q.A=DA,r}function Pd(){nn=4,_i||(ot&4194048)!==ot&&Ar.current!==null||(Tl=!0),(Ti&134217727)===0&&(Os&134217727)===0||zt===null||Oi(zt,ot,zr,!1)}function hp(r,i,u){var f=jt;jt|=2;var y=fw(),v=hw();(zt!==r||ot!==i)&&(Id=null,Ol(r,i)),i=!1;var k=nn;e:do try{if(Nt!==0&&at!==null){var A=at,H=Or;switch(Nt){case 8:fp(),k=6;break e;case 3:case 2:case 9:case 6:Ar.current===null&&(i=!0);var ee=Nt;if(Nt=0,Or=null,zl(r,A,H,ee),u&&Tl){k=0;break e}break;default:ee=Nt,Nt=0,Or=null,zl(r,A,H,ee)}}PA(),k=nn;break}catch(oe){cw(r,oe)}while(!0);return i&&r.shellSuspendCounter++,Fa=ks=null,jt=f,q.H=y,q.A=v,at===null&&(zt=null,ot=0,ad()),k}function PA(){for(;at!==null;)mw(at)}function UA(r,i){var u=jt;jt|=2;var f=fw(),y=hw();zt!==r||ot!==i?(Id=null,Dd=ln()+500,Ol(r,i)):Tl=wa(r,i);e:do try{if(Nt!==0&&at!==null){i=at;var v=Or;t:switch(Nt){case 1:Nt=0,Or=null,zl(r,i,v,1);break;case 2:case 9:if(jx(v)){Nt=0,Or=null,pw(i);break}i=function(){Nt!==2&&Nt!==9||zt!==r||(Nt=7),Ca(r)},v.then(i,i);break e;case 3:Nt=7;break e;case 4:Nt=5;break e;case 7:jx(v)?(Nt=0,Or=null,pw(i)):(Nt=0,Or=null,zl(r,i,v,7));break;case 5:var k=null;switch(at.tag){case 26:k=at.memoizedState;case 5:case 27:var A=at;if(k?eS(k):A.stateNode.complete){Nt=0,Or=null;var H=A.sibling;if(H!==null)at=H;else{var ee=A.return;ee!==null?(at=ee,Ud(ee)):at=null}break t}}Nt=0,Or=null,zl(r,i,v,5);break;case 6:Nt=0,Or=null,zl(r,i,v,6);break;case 8:fp(),nn=6;break e;default:throw Error(a(462))}}BA();break}catch(oe){cw(r,oe)}while(!0);return Fa=ks=null,q.H=f,q.A=y,jt=u,at!==null?0:(zt=null,ot=0,ad(),nn)}function BA(){for(;at!==null&&!hi();)mw(at)}function mw(r){var i=P0(r.alternate,r,Xa);r.memoizedProps=r.pendingProps,i===null?Ud(r):at=i}function pw(r){var i=r,u=i.alternate;switch(i.tag){case 15:case 0:i=O0(u,i,i.pendingProps,i.type,void 0,ot);break;case 11:i=O0(u,i,i.pendingProps,i.type.render,i.ref,ot);break;case 5:_m(i);default:B0(u,i),i=at=hx(i,Xa),i=P0(u,i,Xa)}r.memoizedProps=r.pendingProps,i===null?Ud(r):at=i}function zl(r,i,u,f){Fa=ks=null,_m(i),Sl=null,eu=0;var y=i.return;try{if(_A(r,y,i,u,ot)){nn=1,Ed(r,Zr(u,r.current)),at=null;return}}catch(v){if(y!==null)throw at=y,v;nn=1,Ed(r,Zr(u,r.current)),at=null;return}i.flags&32768?(dt||f===1?r=!0:Tl||(ot&536870912)!==0?r=!1:(_i=r=!0,(f===2||f===9||f===3||f===6)&&(f=Ar.current,f!==null&&f.tag===13&&(f.flags|=16384))),gw(i,r)):Ud(i)}function Ud(r){var i=r;do{if((i.flags&32768)!==0){gw(i,_i);return}r=i.return;var u=RA(i.alternate,i,Xa);if(u!==null){at=u;return}if(i=i.sibling,i!==null){at=i;return}at=i=r}while(i!==null);nn===0&&(nn=5)}function gw(r,i){do{var u=OA(r.alternate,r);if(u!==null){u.flags&=32767,at=u;return}if(u=r.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!i&&(r=r.sibling,r!==null)){at=r;return}at=r=u}while(r!==null);nn=6,at=null}function yw(r,i,u,f,y,v,k,A,H){r.cancelPendingCommit=null;do Bd();while(Nn!==0);if((jt&6)!==0)throw Error(a(327));if(i!==null){if(i===r.current)throw Error(a(177));if(v=i.lanes|i.childLanes,v|=tm,Nr(r,u,v,k,A,H),r===zt&&(at=zt=null,ot=0),Rl=i,Ri=r,Wa=u,up=v,cp=y,sw=f,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,qA(Ue,function(){return Sw(),null})):(r.callbackNode=null,r.callbackPriority=0),f=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||f){f=q.T,q.T=null,y=ne.p,ne.p=2,k=jt,jt|=4;try{zA(r,i,u)}finally{jt=k,ne.p=y,q.T=f}}Nn=1,vw(),bw(),xw()}}function vw(){if(Nn===1){Nn=0;var r=Ri,i=Rl,u=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||u){u=q.T,q.T=null;var f=ne.p;ne.p=2;var y=jt;jt|=4;try{W0(i,r);var v=Cp,k=ax(r.containerInfo),A=v.focusedElem,H=v.selectionRange;if(k!==A&&A&&A.ownerDocument&&rx(A.ownerDocument.documentElement,A)){if(H!==null&&Yh(A)){var ee=H.start,oe=H.end;if(oe===void 0&&(oe=ee),"selectionStart"in A)A.selectionStart=ee,A.selectionEnd=Math.min(oe,A.value.length);else{var fe=A.ownerDocument||document,te=fe&&fe.defaultView||window;if(te.getSelection){var se=te.getSelection(),_e=A.textContent.length,$e=Math.min(H.start,_e),Ot=H.end===void 0?$e:Math.min(H.end,_e);!se.extend&&$e>Ot&&(k=Ot,Ot=$e,$e=k);var K=nx(A,$e),G=nx(A,Ot);if(K&&G&&(se.rangeCount!==1||se.anchorNode!==K.node||se.anchorOffset!==K.offset||se.focusNode!==G.node||se.focusOffset!==G.offset)){var J=fe.createRange();J.setStart(K.node,K.offset),se.removeAllRanges(),$e>Ot?(se.addRange(J),se.extend(G.node,G.offset)):(J.setEnd(G.node,G.offset),se.addRange(J))}}}}for(fe=[],se=A;se=se.parentNode;)se.nodeType===1&&fe.push({element:se,left:se.scrollLeft,top:se.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<fe.length;A++){var de=fe[A];de.element.scrollLeft=de.left,de.element.scrollTop=de.top}}Wd=!!jp,Cp=jp=null}finally{jt=y,ne.p=f,q.T=u}}r.current=i,Nn=2}}function bw(){if(Nn===2){Nn=0;var r=Ri,i=Rl,u=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||u){u=q.T,q.T=null;var f=ne.p;ne.p=2;var y=jt;jt|=4;try{V0(r,i.alternate,i)}finally{jt=y,ne.p=f,q.T=u}}Nn=3}}function xw(){if(Nn===4||Nn===3){Nn=0,mi();var r=Ri,i=Rl,u=Wa,f=sw;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Nn=5:(Nn=0,Rl=Ri=null,ww(r,r.pendingLanes));var y=r.pendingLanes;if(y===0&&(Ai=null),fa(u),i=i.stateNode,It&&typeof It.onCommitFiberRoot=="function")try{It.onCommitFiberRoot($t,i,void 0,(i.current.flags&128)===128)}catch{}if(f!==null){i=q.T,y=ne.p,ne.p=2,q.T=null;try{for(var v=r.onRecoverableError,k=0;k<f.length;k++){var A=f[k];v(A.value,{componentStack:A.stack})}}finally{q.T=i,ne.p=y}}(Wa&3)!==0&&Bd(),Ca(r),y=r.pendingLanes,(u&261930)!==0&&(y&42)!==0?r===dp?yu++:(yu=0,dp=r):yu=0,vu(0)}}function ww(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,Wo(i)))}function Bd(){return vw(),bw(),xw(),Sw()}function Sw(){if(Nn!==5)return!1;var r=Ri,i=up;up=0;var u=fa(Wa),f=q.T,y=ne.p;try{ne.p=32>u?32:u,q.T=null,u=cp,cp=null;var v=Ri,k=Wa;if(Nn=0,Rl=Ri=null,Wa=0,(jt&6)!==0)throw Error(a(331));var A=jt;if(jt|=4,rw(v.current),ew(v,v.current,k,u),jt=A,vu(0,!1),It&&typeof It.onPostCommitFiberRoot=="function")try{It.onPostCommitFiberRoot($t,v)}catch{}return!0}finally{ne.p=y,q.T=f,ww(r,i)}}function kw(r,i,u){i=Zr(u,i),i=Hm(r.stateNode,i,2),r=ji(r,i,2),r!==null&&(pn(r,2),Ca(r))}function _t(r,i,u){if(r.tag===3)kw(r,r,u);else for(;i!==null;){if(i.tag===3){kw(i,r,u);break}else if(i.tag===1){var f=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Ai===null||!Ai.has(f))){r=Zr(u,r),u=j0(2),f=ji(i,u,2),f!==null&&(C0(u,f,i,r),pn(f,2),Ca(f));break}}i=i.return}}function mp(r,i,u){var f=r.pingCache;if(f===null){f=r.pingCache=new IA;var y=new Set;f.set(i,y)}else y=f.get(i),y===void 0&&(y=new Set,f.set(i,y));y.has(u)||(sp=!0,y.add(u),r=FA.bind(null,r,i,u),i.then(r,r))}function FA(r,i,u){var f=r.pingCache;f!==null&&f.delete(i),r.pingedLanes|=r.suspendedLanes&u,r.warmLanes&=~u,zt===r&&(ot&u)===u&&(nn===4||nn===3&&(ot&62914560)===ot&&300>ln()-Md?(jt&2)===0&&Ol(r,0):lp|=u,Al===ot&&(Al=0)),Ca(r)}function jw(r,i){i===0&&(i=ke()),r=xs(r,i),r!==null&&(pn(r,i),Ca(r))}function $A(r){var i=r.memoizedState,u=0;i!==null&&(u=i.retryLane),jw(r,u)}function HA(r,i){var u=0;switch(r.tag){case 31:case 13:var f=r.stateNode,y=r.memoizedState;y!==null&&(u=y.retryLane);break;case 19:f=r.stateNode;break;case 22:f=r.stateNode._retryCache;break;default:throw Error(a(314))}f!==null&&f.delete(i),jw(r,u)}function qA(r,i){return Er(r,i)}var Fd=null,Ml=null,pp=!1,$d=!1,gp=!1,zi=0;function Ca(r){r!==Ml&&r.next===null&&(Ml===null?Fd=Ml=r:Ml=Ml.next=r),$d=!0,pp||(pp=!0,GA())}function vu(r,i){if(!gp&&$d){gp=!0;do for(var u=!1,f=Fd;f!==null;){if(r!==0){var y=f.pendingLanes;if(y===0)var v=0;else{var k=f.suspendedLanes,A=f.pingedLanes;v=(1<<31-rt(42|r)+1)-1,v&=y&~(k&~A),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(u=!0,_w(f,v))}else v=ot,v=Ma(f,f===zt?v:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(v&3)===0||wa(f,v)||(u=!0,_w(f,v));f=f.next}while(u);gp=!1}}function ZA(){Cw()}function Cw(){$d=pp=!1;var r=0;zi!==0&&n2()&&(r=zi);for(var i=ln(),u=null,f=Fd;f!==null;){var y=f.next,v=Ew(f,i);v===0?(f.next=null,u===null?Fd=y:u.next=y,y===null&&(Ml=u)):(u=f,(r!==0||(v&3)!==0)&&($d=!0)),f=y}Nn!==0&&Nn!==5||vu(r),zi!==0&&(zi=0)}function Ew(r,i){for(var u=r.suspendedLanes,f=r.pingedLanes,y=r.expirationTimes,v=r.pendingLanes&-62914561;0<v;){var k=31-rt(v),A=1<<k,H=y[k];H===-1?((A&u)===0||(A&f)!==0)&&(y[k]=Ht(A,i)):H<=i&&(r.expiredLanes|=A),v&=~A}if(i=zt,u=ot,u=Ma(r,r===i?u:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),f=r.callbackNode,u===0||r===i&&(Nt===2||Nt===9)||r.cancelPendingCommit!==null)return f!==null&&f!==null&&Br(f),r.callbackNode=null,r.callbackPriority=0;if((u&3)===0||wa(r,u)){if(i=u&-u,i===r.callbackPriority)return i;switch(f!==null&&Br(f),fa(u)){case 2:case 8:u=ge;break;case 32:u=Ue;break;case 268435456:u=nt;break;default:u=Ue}return f=Nw.bind(null,r),u=Er(u,f),r.callbackPriority=i,r.callbackNode=u,i}return f!==null&&f!==null&&Br(f),r.callbackPriority=2,r.callbackNode=null,2}function Nw(r,i){if(Nn!==0&&Nn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var u=r.callbackNode;if(Bd()&&r.callbackNode!==u)return null;var f=ot;return f=Ma(r,r===zt?f:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),f===0?null:(ow(r,f,i),Ew(r,ln()),r.callbackNode!=null&&r.callbackNode===u?Nw.bind(null,r):null)}function _w(r,i){if(Bd())return null;ow(r,i,!0)}function GA(){a2(function(){(jt&6)!==0?Er(le,ZA):Cw()})}function yp(){if(zi===0){var r=bl;r===0&&(r=ca,ca<<=1,(ca&261888)===0&&(ca=256)),zi=r}return zi}function Tw(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Yc(""+r)}function Aw(r,i){var u=i.ownerDocument.createElement("input");return u.name=i.name,u.value=i.value,r.id&&u.setAttribute("form",r.id),i.parentNode.insertBefore(u,i),r=new FormData(r),u.parentNode.removeChild(u),r}function VA(r,i,u,f,y){if(i==="submit"&&u&&u.stateNode===y){var v=Tw((y[qt]||null).action),k=f.submitter;k&&(i=(i=k[qt]||null)?Tw(i.formAction):k.getAttribute("formAction"),i!==null&&(v=i,k=null));var A=new ed("action","action",null,f,y);r.push({event:A,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(zi!==0){var H=k?Aw(y,k):new FormData(y);Lm(u,{pending:!0,data:H,method:y.method,action:v},null,H)}}else typeof v=="function"&&(A.preventDefault(),H=k?Aw(y,k):new FormData(y),Lm(u,{pending:!0,data:H,method:y.method,action:v},v,H))},currentTarget:y}]})}}for(var vp=0;vp<em.length;vp++){var bp=em[vp],QA=bp.toLowerCase(),KA=bp[0].toUpperCase()+bp.slice(1);ha(QA,"on"+KA)}ha(lx,"onAnimationEnd"),ha(ox,"onAnimationIteration"),ha(ux,"onAnimationStart"),ha("dblclick","onDoubleClick"),ha("focusin","onFocus"),ha("focusout","onBlur"),ha(dA,"onTransitionRun"),ha(fA,"onTransitionStart"),ha(hA,"onTransitionCancel"),ha(cx,"onTransitionEnd"),Mn("onMouseEnter",["mouseout","mouseover"]),Mn("onMouseLeave",["mouseout","mouseover"]),Mn("onPointerEnter",["pointerout","pointerover"]),Mn("onPointerLeave",["pointerout","pointerover"]),gn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),gn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),gn("onBeforeInput",["compositionend","keypress","textInput","paste"]),gn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),gn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),gn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),YA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bu));function Rw(r,i){i=(i&4)!==0;for(var u=0;u<r.length;u++){var f=r[u],y=f.event;f=f.listeners;e:{var v=void 0;if(i)for(var k=f.length-1;0<=k;k--){var A=f[k],H=A.instance,ee=A.currentTarget;if(A=A.listener,H!==v&&y.isPropagationStopped())break e;v=A,y.currentTarget=ee;try{v(y)}catch(oe){rd(oe)}y.currentTarget=null,v=H}else for(k=0;k<f.length;k++){if(A=f[k],H=A.instance,ee=A.currentTarget,A=A.listener,H!==v&&y.isPropagationStopped())break e;v=A,y.currentTarget=ee;try{v(y)}catch(oe){rd(oe)}y.currentTarget=null,v=H}}}}function it(r,i){var u=i[il];u===void 0&&(u=i[il]=new Set);var f=r+"__bubble";u.has(f)||(Ow(i,r,2,!1),u.add(f))}function xp(r,i,u){var f=0;i&&(f|=4),Ow(u,r,f,i)}var Hd="_reactListening"+Math.random().toString(36).slice(2);function wp(r){if(!r[Hd]){r[Hd]=!0,Xt.forEach(function(u){u!=="selectionchange"&&(YA.has(u)||xp(u,!1,r),xp(u,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[Hd]||(i[Hd]=!0,xp("selectionchange",!1,i))}}function Ow(r,i,u,f){switch(lS(i)){case 2:var y=j2;break;case 8:y=C2;break;default:y=Ip}u=y.bind(null,i,u,r),y=void 0,!Fh||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(y=!0),f?y!==void 0?r.addEventListener(i,u,{capture:!0,passive:y}):r.addEventListener(i,u,!0):y!==void 0?r.addEventListener(i,u,{passive:y}):r.addEventListener(i,u,!1)}function Sp(r,i,u,f,y){var v=f;if((i&1)===0&&(i&2)===0&&f!==null)e:for(;;){if(f===null)return;var k=f.tag;if(k===3||k===4){var A=f.stateNode.containerInfo;if(A===y)break;if(k===4)for(k=f.return;k!==null;){var H=k.tag;if((H===3||H===4)&&k.stateNode.containerInfo===y)return;k=k.return}for(;A!==null;){if(k=$(A),k===null)return;if(H=k.tag,H===5||H===6||H===26||H===27){f=v=k;continue e}A=A.parentNode}}f=f.return}Lb(function(){var ee=v,oe=Uh(u),fe=[];e:{var te=dx.get(r);if(te!==void 0){var se=ed,_e=r;switch(r){case"keypress":if(Wc(u)===0)break e;case"keydown":case"keyup":se=HT;break;case"focusin":_e="focus",se=Zh;break;case"focusout":_e="blur",se=Zh;break;case"beforeblur":case"afterblur":se=Zh;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":se=Bb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=RT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=GT;break;case lx:case ox:case ux:se=MT;break;case cx:se=QT;break;case"scroll":case"scrollend":se=TT;break;case"wheel":se=YT;break;case"copy":case"cut":case"paste":se=IT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=$b;break;case"toggle":case"beforetoggle":se=WT}var $e=(i&4)!==0,Ot=!$e&&(r==="scroll"||r==="scrollend"),K=$e?te!==null?te+"Capture":null:te;$e=[];for(var G=ee,J;G!==null;){var de=G;if(J=de.stateNode,de=de.tag,de!==5&&de!==26&&de!==27||J===null||K===null||(de=Fo(G,K),de!=null&&$e.push(xu(G,de,J))),Ot)break;G=G.return}0<$e.length&&(te=new se(te,_e,null,u,oe),fe.push({event:te,listeners:$e}))}}if((i&7)===0){e:{if(te=r==="mouseover"||r==="pointerover",se=r==="mouseout"||r==="pointerout",te&&u!==Ph&&(_e=u.relatedTarget||u.fromElement)&&($(_e)||_e[Da]))break e;if((se||te)&&(te=oe.window===oe?oe:(te=oe.ownerDocument)?te.defaultView||te.parentWindow:window,se?(_e=u.relatedTarget||u.toElement,se=ee,_e=_e?$(_e):null,_e!==null&&(Ot=l(_e),$e=_e.tag,_e!==Ot||$e!==5&&$e!==27&&$e!==6)&&(_e=null)):(se=null,_e=ee),se!==_e)){if($e=Bb,de="onMouseLeave",K="onMouseEnter",G="mouse",(r==="pointerout"||r==="pointerover")&&($e=$b,de="onPointerLeave",K="onPointerEnter",G="pointer"),Ot=se==null?te:Ee(se),J=_e==null?te:Ee(_e),te=new $e(de,G+"leave",se,u,oe),te.target=Ot,te.relatedTarget=J,de=null,$(oe)===ee&&($e=new $e(K,G+"enter",_e,u,oe),$e.target=J,$e.relatedTarget=Ot,de=$e),Ot=de,se&&_e)t:{for($e=XA,K=se,G=_e,J=0,de=K;de;de=$e(de))J++;de=0;for(var Le=G;Le;Le=$e(Le))de++;for(;0<J-de;)K=$e(K),J--;for(;0<de-J;)G=$e(G),de--;for(;J--;){if(K===G||G!==null&&K===G.alternate){$e=K;break t}K=$e(K),G=$e(G)}$e=null}else $e=null;se!==null&&zw(fe,te,se,$e,!1),_e!==null&&Ot!==null&&zw(fe,Ot,_e,$e,!0)}}e:{if(te=ee?Ee(ee):window,se=te.nodeName&&te.nodeName.toLowerCase(),se==="select"||se==="input"&&te.type==="file")var wt=Yb;else if(Qb(te))if(Xb)wt=oA;else{wt=sA;var ze=iA}else se=te.nodeName,!se||se.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?ee&&Lh(ee.elementType)&&(wt=Yb):wt=lA;if(wt&&(wt=wt(r,ee))){Kb(fe,wt,u,oe);break e}ze&&ze(r,te,ee),r==="focusout"&&ee&&te.type==="number"&&ee.memoizedProps.value!=null&&Ih(te,"number",te.value)}switch(ze=ee?Ee(ee):window,r){case"focusin":(Qb(ze)||ze.contentEditable==="true")&&(dl=ze,Xh=ee,Ko=null);break;case"focusout":Ko=Xh=dl=null;break;case"mousedown":Wh=!0;break;case"contextmenu":case"mouseup":case"dragend":Wh=!1,ix(fe,u,oe);break;case"selectionchange":if(cA)break;case"keydown":case"keyup":ix(fe,u,oe)}var Xe;if(Vh)e:{switch(r){case"compositionstart":var ut="onCompositionStart";break e;case"compositionend":ut="onCompositionEnd";break e;case"compositionupdate":ut="onCompositionUpdate";break e}ut=void 0}else cl?Gb(r,u)&&(ut="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(ut="onCompositionStart");ut&&(Hb&&u.locale!=="ko"&&(cl||ut!=="onCompositionStart"?ut==="onCompositionEnd"&&cl&&(Xe=Pb()):(yi=oe,$h="value"in yi?yi.value:yi.textContent,cl=!0)),ze=qd(ee,ut),0<ze.length&&(ut=new Fb(ut,r,null,u,oe),fe.push({event:ut,listeners:ze}),Xe?ut.data=Xe:(Xe=Vb(u),Xe!==null&&(ut.data=Xe)))),(Xe=eA?tA(r,u):nA(r,u))&&(ut=qd(ee,"onBeforeInput"),0<ut.length&&(ze=new Fb("onBeforeInput","beforeinput",null,u,oe),fe.push({event:ze,listeners:ut}),ze.data=Xe)),VA(fe,r,ee,u,oe)}Rw(fe,i)})}function xu(r,i,u){return{instance:r,listener:i,currentTarget:u}}function qd(r,i){for(var u=i+"Capture",f=[];r!==null;){var y=r,v=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||v===null||(y=Fo(r,u),y!=null&&f.unshift(xu(r,y,v)),y=Fo(r,i),y!=null&&f.push(xu(r,y,v))),r.tag===3)return f;r=r.return}return[]}function XA(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function zw(r,i,u,f,y){for(var v=i._reactName,k=[];u!==null&&u!==f;){var A=u,H=A.alternate,ee=A.stateNode;if(A=A.tag,H!==null&&H===f)break;A!==5&&A!==26&&A!==27||ee===null||(H=ee,y?(ee=Fo(u,v),ee!=null&&k.unshift(xu(u,ee,H))):y||(ee=Fo(u,v),ee!=null&&k.push(xu(u,ee,H)))),u=u.return}k.length!==0&&r.push({event:i,listeners:k})}var WA=/\r\n?/g,JA=/\u0000|\uFFFD/g;function Mw(r){return(typeof r=="string"?r:""+r).replace(WA,`
|
|
49
|
+
`).replace(JA,"")}function Dw(r,i){return i=Mw(i),Mw(r)===i}function Rt(r,i,u,f,y,v){switch(u){case"children":typeof f=="string"?i==="body"||i==="textarea"&&f===""||ll(r,f):(typeof f=="number"||typeof f=="bigint")&&i!=="body"&&ll(r,""+f);break;case"className":Qc(r,"class",f);break;case"tabIndex":Qc(r,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":Qc(r,u,f);break;case"style":Db(r,f,v);break;case"data":if(i!=="object"){Qc(r,"data",f);break}case"src":case"href":if(f===""&&(i!=="a"||u!=="href")){r.removeAttribute(u);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){r.removeAttribute(u);break}f=Yc(""+f),r.setAttribute(u,f);break;case"action":case"formAction":if(typeof f=="function"){r.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(u==="formAction"?(i!=="input"&&Rt(r,i,"name",y.name,y,null),Rt(r,i,"formEncType",y.formEncType,y,null),Rt(r,i,"formMethod",y.formMethod,y,null),Rt(r,i,"formTarget",y.formTarget,y,null)):(Rt(r,i,"encType",y.encType,y,null),Rt(r,i,"method",y.method,y,null),Rt(r,i,"target",y.target,y,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){r.removeAttribute(u);break}f=Yc(""+f),r.setAttribute(u,f);break;case"onClick":f!=null&&(r.onclick=La);break;case"onScroll":f!=null&&it("scroll",r);break;case"onScrollEnd":f!=null&&it("scrollend",r);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(a(61));if(u=f.__html,u!=null){if(y.children!=null)throw Error(a(60));r.innerHTML=u}}break;case"multiple":r.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":r.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){r.removeAttribute("xlink:href");break}u=Yc(""+f),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?r.setAttribute(u,""+f):r.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?r.setAttribute(u,""):r.removeAttribute(u);break;case"capture":case"download":f===!0?r.setAttribute(u,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?r.setAttribute(u,f):r.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?r.setAttribute(u,f):r.removeAttribute(u);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?r.removeAttribute(u):r.setAttribute(u,f);break;case"popover":it("beforetoggle",r),it("toggle",r),Vc(r,"popover",f);break;case"xlinkActuate":Ia(r,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":Ia(r,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":Ia(r,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":Ia(r,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":Ia(r,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":Ia(r,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":Ia(r,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":Ia(r,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":Ia(r,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":Vc(r,"is",f);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=NT.get(u)||u,Vc(r,u,f))}}function kp(r,i,u,f,y,v){switch(u){case"style":Db(r,f,v);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(a(61));if(u=f.__html,u!=null){if(y.children!=null)throw Error(a(60));r.innerHTML=u}}break;case"children":typeof f=="string"?ll(r,f):(typeof f=="number"||typeof f=="bigint")&&ll(r,""+f);break;case"onScroll":f!=null&&it("scroll",r);break;case"onScrollEnd":f!=null&&it("scrollend",r);break;case"onClick":f!=null&&(r.onclick=La);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Pn.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(y=u.endsWith("Capture"),i=u.slice(2,y?u.length-7:void 0),v=r[qt]||null,v=v!=null?v[u]:null,typeof v=="function"&&r.removeEventListener(i,v,y),typeof f=="function")){typeof v!="function"&&v!==null&&(u in r?r[u]=null:r.hasAttribute(u)&&r.removeAttribute(u)),r.addEventListener(i,f,y);break e}u in r?r[u]=f:f===!0?r.setAttribute(u,""):Vc(r,u,f)}}}function $n(r,i,u){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":it("error",r),it("load",r);var f=!1,y=!1,v;for(v in u)if(u.hasOwnProperty(v)){var k=u[v];if(k!=null)switch(v){case"src":f=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Rt(r,i,v,k,u,null)}}y&&Rt(r,i,"srcSet",u.srcSet,u,null),f&&Rt(r,i,"src",u.src,u,null);return;case"input":it("invalid",r);var A=v=k=y=null,H=null,ee=null;for(f in u)if(u.hasOwnProperty(f)){var oe=u[f];if(oe!=null)switch(f){case"name":y=oe;break;case"type":k=oe;break;case"checked":H=oe;break;case"defaultChecked":ee=oe;break;case"value":v=oe;break;case"defaultValue":A=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(a(137,i));break;default:Rt(r,i,f,oe,u,null)}}Rb(r,v,A,H,ee,k,y,!1);return;case"select":it("invalid",r),f=k=v=null;for(y in u)if(u.hasOwnProperty(y)&&(A=u[y],A!=null))switch(y){case"value":v=A;break;case"defaultValue":k=A;break;case"multiple":f=A;default:Rt(r,i,y,A,u,null)}i=v,u=k,r.multiple=!!f,i!=null?sl(r,!!f,i,!1):u!=null&&sl(r,!!f,u,!0);return;case"textarea":it("invalid",r),v=y=f=null;for(k in u)if(u.hasOwnProperty(k)&&(A=u[k],A!=null))switch(k){case"value":f=A;break;case"defaultValue":y=A;break;case"children":v=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(a(91));break;default:Rt(r,i,k,A,u,null)}zb(r,f,y,v);return;case"option":for(H in u)if(u.hasOwnProperty(H)&&(f=u[H],f!=null))switch(H){case"selected":r.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:Rt(r,i,H,f,u,null)}return;case"dialog":it("beforetoggle",r),it("toggle",r),it("cancel",r),it("close",r);break;case"iframe":case"object":it("load",r);break;case"video":case"audio":for(f=0;f<bu.length;f++)it(bu[f],r);break;case"image":it("error",r),it("load",r);break;case"details":it("toggle",r);break;case"embed":case"source":case"link":it("error",r),it("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in u)if(u.hasOwnProperty(ee)&&(f=u[ee],f!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Rt(r,i,ee,f,u,null)}return;default:if(Lh(i)){for(oe in u)u.hasOwnProperty(oe)&&(f=u[oe],f!==void 0&&kp(r,i,oe,f,u,void 0));return}}for(A in u)u.hasOwnProperty(A)&&(f=u[A],f!=null&&Rt(r,i,A,f,u,null))}function e2(r,i,u,f){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,v=null,k=null,A=null,H=null,ee=null,oe=null;for(se in u){var fe=u[se];if(u.hasOwnProperty(se)&&fe!=null)switch(se){case"checked":break;case"value":break;case"defaultValue":H=fe;default:f.hasOwnProperty(se)||Rt(r,i,se,null,f,fe)}}for(var te in f){var se=f[te];if(fe=u[te],f.hasOwnProperty(te)&&(se!=null||fe!=null))switch(te){case"type":v=se;break;case"name":y=se;break;case"checked":ee=se;break;case"defaultChecked":oe=se;break;case"value":k=se;break;case"defaultValue":A=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(a(137,i));break;default:se!==fe&&Rt(r,i,te,se,f,fe)}}Dh(r,k,A,H,ee,oe,v,y);return;case"select":se=k=A=te=null;for(v in u)if(H=u[v],u.hasOwnProperty(v)&&H!=null)switch(v){case"value":break;case"multiple":se=H;default:f.hasOwnProperty(v)||Rt(r,i,v,null,f,H)}for(y in f)if(v=f[y],H=u[y],f.hasOwnProperty(y)&&(v!=null||H!=null))switch(y){case"value":te=v;break;case"defaultValue":A=v;break;case"multiple":k=v;default:v!==H&&Rt(r,i,y,v,f,H)}i=A,u=k,f=se,te!=null?sl(r,!!u,te,!1):!!f!=!!u&&(i!=null?sl(r,!!u,i,!0):sl(r,!!u,u?[]:"",!1));return;case"textarea":se=te=null;for(A in u)if(y=u[A],u.hasOwnProperty(A)&&y!=null&&!f.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:Rt(r,i,A,null,f,y)}for(k in f)if(y=f[k],v=u[k],f.hasOwnProperty(k)&&(y!=null||v!=null))switch(k){case"value":te=y;break;case"defaultValue":se=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(a(91));break;default:y!==v&&Rt(r,i,k,y,f,v)}Ob(r,te,se);return;case"option":for(var _e in u)if(te=u[_e],u.hasOwnProperty(_e)&&te!=null&&!f.hasOwnProperty(_e))switch(_e){case"selected":r.selected=!1;break;default:Rt(r,i,_e,null,f,te)}for(H in f)if(te=f[H],se=u[H],f.hasOwnProperty(H)&&te!==se&&(te!=null||se!=null))switch(H){case"selected":r.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:Rt(r,i,H,te,f,se)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var $e in u)te=u[$e],u.hasOwnProperty($e)&&te!=null&&!f.hasOwnProperty($e)&&Rt(r,i,$e,null,f,te);for(ee in f)if(te=f[ee],se=u[ee],f.hasOwnProperty(ee)&&te!==se&&(te!=null||se!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(a(137,i));break;default:Rt(r,i,ee,te,f,se)}return;default:if(Lh(i)){for(var Ot in u)te=u[Ot],u.hasOwnProperty(Ot)&&te!==void 0&&!f.hasOwnProperty(Ot)&&kp(r,i,Ot,void 0,f,te);for(oe in f)te=f[oe],se=u[oe],!f.hasOwnProperty(oe)||te===se||te===void 0&&se===void 0||kp(r,i,oe,te,f,se);return}}for(var K in u)te=u[K],u.hasOwnProperty(K)&&te!=null&&!f.hasOwnProperty(K)&&Rt(r,i,K,null,f,te);for(fe in f)te=f[fe],se=u[fe],!f.hasOwnProperty(fe)||te===se||te==null&&se==null||Rt(r,i,fe,te,f,se)}function Iw(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function t2(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,u=performance.getEntriesByType("resource"),f=0;f<u.length;f++){var y=u[f],v=y.transferSize,k=y.initiatorType,A=y.duration;if(v&&A&&Iw(k)){for(k=0,A=y.responseEnd,f+=1;f<u.length;f++){var H=u[f],ee=H.startTime;if(ee>A)break;var oe=H.transferSize,fe=H.initiatorType;oe&&Iw(fe)&&(H=H.responseEnd,k+=oe*(H<A?1:(A-ee)/(H-ee)))}if(--f,i+=8*(v+k)/(y.duration/1e3),r++,10<r)break}}if(0<r)return i/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var jp=null,Cp=null;function Zd(r){return r.nodeType===9?r:r.ownerDocument}function Lw(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 Pw(r,i){if(r===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&i==="foreignObject"?0:r}function Ep(r,i){return r==="textarea"||r==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Np=null;function n2(){var r=window.event;return r&&r.type==="popstate"?r===Np?!1:(Np=r,!0):(Np=null,!1)}var Uw=typeof setTimeout=="function"?setTimeout:void 0,r2=typeof clearTimeout=="function"?clearTimeout:void 0,Bw=typeof Promise=="function"?Promise:void 0,a2=typeof queueMicrotask=="function"?queueMicrotask:typeof Bw<"u"?function(r){return Bw.resolve(null).then(r).catch(i2)}:Uw;function i2(r){setTimeout(function(){throw r})}function Mi(r){return r==="head"}function Fw(r,i){var u=i,f=0;do{var y=u.nextSibling;if(r.removeChild(u),y&&y.nodeType===8)if(u=y.data,u==="/$"||u==="/&"){if(f===0){r.removeChild(y),Pl(i);return}f--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")f++;else if(u==="html")wu(r.ownerDocument.documentElement);else if(u==="head"){u=r.ownerDocument.head,wu(u);for(var v=u.firstChild;v;){var k=v.nextSibling,A=v.nodeName;v[gi]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&v.rel.toLowerCase()==="stylesheet"||u.removeChild(v),v=k}}else u==="body"&&wu(r.ownerDocument.body);u=y}while(u);Pl(i)}function $w(r,i){var u=r;r=0;do{var f=u.nextSibling;if(u.nodeType===1?i?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(i?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),f&&f.nodeType===8)if(u=f.data,u==="/$"){if(r===0)break;r--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||r++;u=f}while(u)}function _p(r){var i=r.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var u=i;switch(i=i.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":_p(u),Ie(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}r.removeChild(u)}}function s2(r,i,u,f){for(;r.nodeType===1;){var y=u;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!f&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(f){if(!r[gi])switch(i){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(v=r.getAttribute("rel"),v==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(v!==y.rel||r.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||r.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||r.getAttribute("title")!==(y.title==null?null:y.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(v=r.getAttribute("src"),(v!==(y.src==null?null:y.src)||r.getAttribute("type")!==(y.type==null?null:y.type)||r.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&v&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(i==="input"&&r.type==="hidden"){var v=y.name==null?null:""+y.name;if(y.type==="hidden"&&r.getAttribute("name")===v)return r}else return r;if(r=Yr(r.nextSibling),r===null)break}return null}function l2(r,i,u){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!u||(r=Yr(r.nextSibling),r===null))return null;return r}function Hw(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=Yr(r.nextSibling),r===null))return null;return r}function Tp(r){return r.data==="$?"||r.data==="$~"}function Ap(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function o2(r,i){var u=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||u.readyState!=="loading")i();else{var f=function(){i(),u.removeEventListener("DOMContentLoaded",f)};u.addEventListener("DOMContentLoaded",f),r._reactRetry=f}}function Yr(r){for(;r!=null;r=r.nextSibling){var i=r.nodeType;if(i===1||i===3)break;if(i===8){if(i=r.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return r}var Rp=null;function qw(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var u=r.data;if(u==="/$"||u==="/&"){if(i===0)return Yr(r.nextSibling);i--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||i++}r=r.nextSibling}return null}function Zw(r){r=r.previousSibling;for(var i=0;r;){if(r.nodeType===8){var u=r.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(i===0)return r;i--}else u!=="/$"&&u!=="/&"||i++}r=r.previousSibling}return null}function Gw(r,i,u){switch(i=Zd(u),r){case"html":if(r=i.documentElement,!r)throw Error(a(452));return r;case"head":if(r=i.head,!r)throw Error(a(453));return r;case"body":if(r=i.body,!r)throw Error(a(454));return r;default:throw Error(a(451))}}function wu(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);Ie(r)}var Xr=new Map,Vw=new Set;function Gd(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Ja=ne.d;ne.d={f:u2,r:c2,D:d2,C:f2,L:h2,m:m2,X:g2,S:p2,M:y2};function u2(){var r=Ja.f(),i=Ld();return r||i}function c2(r){var i=he(r);i!==null&&i.tag===5&&i.type==="form"?c0(i):Ja.r(r)}var Dl=typeof document>"u"?null:document;function Qw(r,i,u){var f=Dl;if(f&&typeof i=="string"&&i){var y=Hr(i);y='link[rel="'+r+'"][href="'+y+'"]',typeof u=="string"&&(y+='[crossorigin="'+u+'"]'),Vw.has(y)||(Vw.add(y),r={rel:r,crossOrigin:u,href:i},f.querySelector(y)===null&&(i=f.createElement("link"),$n(i,"link",r),ct(i),f.head.appendChild(i)))}}function d2(r){Ja.D(r),Qw("dns-prefetch",r,null)}function f2(r,i){Ja.C(r,i),Qw("preconnect",r,i)}function h2(r,i,u){Ja.L(r,i,u);var f=Dl;if(f&&r&&i){var y='link[rel="preload"][as="'+Hr(i)+'"]';i==="image"&&u&&u.imageSrcSet?(y+='[imagesrcset="'+Hr(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(y+='[imagesizes="'+Hr(u.imageSizes)+'"]')):y+='[href="'+Hr(r)+'"]';var v=y;switch(i){case"style":v=Il(r);break;case"script":v=Ll(r)}Xr.has(v)||(r=p({rel:"preload",href:i==="image"&&u&&u.imageSrcSet?void 0:r,as:i},u),Xr.set(v,r),f.querySelector(y)!==null||i==="style"&&f.querySelector(Su(v))||i==="script"&&f.querySelector(ku(v))||(i=f.createElement("link"),$n(i,"link",r),ct(i),f.head.appendChild(i)))}}function m2(r,i){Ja.m(r,i);var u=Dl;if(u&&r){var f=i&&typeof i.as=="string"?i.as:"script",y='link[rel="modulepreload"][as="'+Hr(f)+'"][href="'+Hr(r)+'"]',v=y;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Ll(r)}if(!Xr.has(v)&&(r=p({rel:"modulepreload",href:r},i),Xr.set(v,r),u.querySelector(y)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(ku(v)))return}f=u.createElement("link"),$n(f,"link",r),ct(f),u.head.appendChild(f)}}}function p2(r,i,u){Ja.S(r,i,u);var f=Dl;if(f&&r){var y=bt(f).hoistableStyles,v=Il(r);i=i||"default";var k=y.get(v);if(!k){var A={loading:0,preload:null};if(k=f.querySelector(Su(v)))A.loading=5;else{r=p({rel:"stylesheet",href:r,"data-precedence":i},u),(u=Xr.get(v))&&Op(r,u);var H=k=f.createElement("link");ct(H),$n(H,"link",r),H._p=new Promise(function(ee,oe){H.onload=ee,H.onerror=oe}),H.addEventListener("load",function(){A.loading|=1}),H.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Vd(k,i,f)}k={type:"stylesheet",instance:k,count:1,state:A},y.set(v,k)}}}function g2(r,i){Ja.X(r,i);var u=Dl;if(u&&r){var f=bt(u).hoistableScripts,y=Ll(r),v=f.get(y);v||(v=u.querySelector(ku(y)),v||(r=p({src:r,async:!0},i),(i=Xr.get(y))&&zp(r,i),v=u.createElement("script"),ct(v),$n(v,"link",r),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},f.set(y,v))}}function y2(r,i){Ja.M(r,i);var u=Dl;if(u&&r){var f=bt(u).hoistableScripts,y=Ll(r),v=f.get(y);v||(v=u.querySelector(ku(y)),v||(r=p({src:r,async:!0,type:"module"},i),(i=Xr.get(y))&&zp(r,i),v=u.createElement("script"),ct(v),$n(v,"link",r),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},f.set(y,v))}}function Kw(r,i,u,f){var y=(y=ue.current)?Gd(y):null;if(!y)throw Error(a(446));switch(r){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(i=Il(u.href),u=bt(y).hoistableStyles,f=u.get(i),f||(f={type:"style",instance:null,count:0,state:null},u.set(i,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){r=Il(u.href);var v=bt(y).hoistableStyles,k=v.get(r);if(k||(y=y.ownerDocument||y,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(r,k),(v=y.querySelector(Su(r)))&&!v._p&&(k.instance=v,k.state.loading=5),Xr.has(r)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Xr.set(r,u),v||v2(y,r,u,k.state))),i&&f===null)throw Error(a(528,""));return k}if(i&&f!==null)throw Error(a(529,""));return null;case"script":return i=u.async,u=u.src,typeof u=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Ll(u),u=bt(y).hoistableScripts,f=u.get(i),f||(f={type:"script",instance:null,count:0,state:null},u.set(i,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,r))}}function Il(r){return'href="'+Hr(r)+'"'}function Su(r){return'link[rel="stylesheet"]['+r+"]"}function Yw(r){return p({},r,{"data-precedence":r.precedence,precedence:null})}function v2(r,i,u,f){r.querySelector('link[rel="preload"][as="style"]['+i+"]")?f.loading=1:(i=r.createElement("link"),f.preload=i,i.addEventListener("load",function(){return f.loading|=1}),i.addEventListener("error",function(){return f.loading|=2}),$n(i,"link",u),ct(i),r.head.appendChild(i))}function Ll(r){return'[src="'+Hr(r)+'"]'}function ku(r){return"script[async]"+r}function Xw(r,i,u){if(i.count++,i.instance===null)switch(i.type){case"style":var f=r.querySelector('style[data-href~="'+Hr(u.href)+'"]');if(f)return i.instance=f,ct(f),f;var y=p({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return f=(r.ownerDocument||r).createElement("style"),ct(f),$n(f,"style",y),Vd(f,u.precedence,r),i.instance=f;case"stylesheet":y=Il(u.href);var v=r.querySelector(Su(y));if(v)return i.state.loading|=4,i.instance=v,ct(v),v;f=Yw(u),(y=Xr.get(y))&&Op(f,y),v=(r.ownerDocument||r).createElement("link"),ct(v);var k=v;return k._p=new Promise(function(A,H){k.onload=A,k.onerror=H}),$n(v,"link",f),i.state.loading|=4,Vd(v,u.precedence,r),i.instance=v;case"script":return v=Ll(u.src),(y=r.querySelector(ku(v)))?(i.instance=y,ct(y),y):(f=u,(y=Xr.get(v))&&(f=p({},u),zp(f,y)),r=r.ownerDocument||r,y=r.createElement("script"),ct(y),$n(y,"link",f),r.head.appendChild(y),i.instance=y);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(f=i.instance,i.state.loading|=4,Vd(f,u.precedence,r));return i.instance}function Vd(r,i,u){for(var f=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=f.length?f[f.length-1]:null,v=y,k=0;k<f.length;k++){var A=f[k];if(A.dataset.precedence===i)v=A;else if(v!==y)break}v?v.parentNode.insertBefore(r,v.nextSibling):(i=u.nodeType===9?u.head:u,i.insertBefore(r,i.firstChild))}function Op(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function zp(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var Qd=null;function Ww(r,i,u){if(Qd===null){var f=new Map,y=Qd=new Map;y.set(u,f)}else y=Qd,f=y.get(u),f||(f=new Map,y.set(u,f));if(f.has(r))return f;for(f.set(r,null),u=u.getElementsByTagName(r),y=0;y<u.length;y++){var v=u[y];if(!(v[gi]||v[un]||r==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var k=v.getAttribute(i)||"";k=r+k;var A=f.get(k);A?A.push(v):f.set(k,[v])}}return f}function Jw(r,i,u){r=r.ownerDocument||r,r.head.insertBefore(u,i==="title"?r.querySelector("head > title"):null)}function b2(r,i,u){if(u===1||i.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return r=i.disabled,typeof i.precedence=="string"&&r==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function eS(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function x2(r,i,u,f){if(u.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var y=Il(f.href),v=i.querySelector(Su(y));if(v){i=v._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=Kd.bind(r),i.then(r,r)),u.state.loading|=4,u.instance=v,ct(v);return}v=i.ownerDocument||i,f=Yw(f),(y=Xr.get(y))&&Op(f,y),v=v.createElement("link"),ct(v);var k=v;k._p=new Promise(function(A,H){k.onload=A,k.onerror=H}),$n(v,"link",f),u.instance=v}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(u,i),(i=u.state.preload)&&(u.state.loading&3)===0&&(r.count++,u=Kd.bind(r),i.addEventListener("load",u),i.addEventListener("error",u))}}var Mp=0;function w2(r,i){return r.stylesheets&&r.count===0&&Xd(r,r.stylesheets),0<r.count||0<r.imgCount?function(u){var f=setTimeout(function(){if(r.stylesheets&&Xd(r,r.stylesheets),r.unsuspend){var v=r.unsuspend;r.unsuspend=null,v()}},6e4+i);0<r.imgBytes&&Mp===0&&(Mp=62500*t2());var y=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Xd(r,r.stylesheets),r.unsuspend)){var v=r.unsuspend;r.unsuspend=null,v()}},(r.imgBytes>Mp?50:800)+i);return r.unsuspend=u,function(){r.unsuspend=null,clearTimeout(f),clearTimeout(y)}}:null}function Kd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xd(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Yd=null;function Xd(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Yd=new Map,i.forEach(S2,r),Yd=null,Kd.call(r))}function S2(r,i){if(!(i.state.loading&4)){var u=Yd.get(r);if(u)var f=u.get(null);else{u=new Map,Yd.set(r,u);for(var y=r.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<y.length;v++){var k=y[v];(k.nodeName==="LINK"||k.getAttribute("media")!=="not all")&&(u.set(k.dataset.precedence,k),f=k)}f&&u.set(null,f)}y=i.instance,k=y.getAttribute("data-precedence"),v=u.get(k)||f,v===f&&u.set(null,y),u.set(k,y),this.count++,f=Kd.bind(this),y.addEventListener("load",f),y.addEventListener("error",f),v?v.parentNode.insertBefore(y,v.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(y,r.firstChild)),i.state.loading|=4}}var ju={$$typeof:z,Provider:null,Consumer:null,_currentValue:we,_currentValue2:we,_threadCount:0};function k2(r,i,u,f,y,v,k,A,H){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=et(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=et(0),this.hiddenUpdates=et(null),this.identifierPrefix=f,this.onUncaughtError=y,this.onCaughtError=v,this.onRecoverableError=k,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function tS(r,i,u,f,y,v,k,A,H,ee,oe,fe){return r=new k2(r,i,u,k,H,ee,oe,fe,A),i=1,v===!0&&(i|=24),v=Tr(3,null,null,i),r.current=v,v.stateNode=r,i=hm(),i.refCount++,r.pooledCache=i,i.refCount++,v.memoizedState={element:f,isDehydrated:u,cache:i},ym(v),r}function nS(r){return r?(r=ml,r):ml}function rS(r,i,u,f,y,v){y=nS(y),f.context===null?f.context=y:f.pendingContext=y,f=ki(i),f.payload={element:u},v=v===void 0?null:v,v!==null&&(f.callback=v),u=ji(r,f,i),u!==null&&(yr(u,r,i),nu(u,r,i))}function aS(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<i?u:i}}function Dp(r,i){aS(r,i),(r=r.alternate)&&aS(r,i)}function iS(r){if(r.tag===13||r.tag===31){var i=xs(r,67108864);i!==null&&yr(i,r,67108864),Dp(r,67108864)}}function sS(r){if(r.tag===13||r.tag===31){var i=Mr();i=nr(i);var u=xs(r,i);u!==null&&yr(u,r,i),Dp(r,i)}}var Wd=!0;function j2(r,i,u,f){var y=q.T;q.T=null;var v=ne.p;try{ne.p=2,Ip(r,i,u,f)}finally{ne.p=v,q.T=y}}function C2(r,i,u,f){var y=q.T;q.T=null;var v=ne.p;try{ne.p=8,Ip(r,i,u,f)}finally{ne.p=v,q.T=y}}function Ip(r,i,u,f){if(Wd){var y=Lp(f);if(y===null)Sp(r,i,f,Jd,u),oS(r,f);else if(N2(y,r,i,u,f))f.stopPropagation();else if(oS(r,f),i&4&&-1<E2.indexOf(r)){for(;y!==null;){var v=he(y);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var k=Zn(v.pendingLanes);if(k!==0){var A=v;for(A.pendingLanes|=2,A.entangledLanes|=2;k;){var H=1<<31-rt(k);A.entanglements[1]|=H,k&=~H}Ca(v),(jt&6)===0&&(Dd=ln()+500,vu(0))}}break;case 31:case 13:A=xs(v,2),A!==null&&yr(A,v,2),Ld(),Dp(v,2)}if(v=Lp(f),v===null&&Sp(r,i,f,Jd,u),v===y)break;y=v}y!==null&&f.stopPropagation()}else Sp(r,i,f,null,u)}}function Lp(r){return r=Uh(r),Pp(r)}var Jd=null;function Pp(r){if(Jd=null,r=$(r),r!==null){var i=l(r);if(i===null)r=null;else{var u=i.tag;if(u===13){if(r=c(i),r!==null)return r;r=null}else if(u===31){if(r=d(i),r!==null)return r;r=null}else if(u===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return Jd=r,null}function lS(r){switch(r){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ua()){case le:return 2;case ge:return 8;case Ue:case Ze:return 32;case nt:return 268435456;default:return 32}default:return 32}}var Up=!1,Di=null,Ii=null,Li=null,Cu=new Map,Eu=new Map,Pi=[],E2="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 oS(r,i){switch(r){case"focusin":case"focusout":Di=null;break;case"dragenter":case"dragleave":Ii=null;break;case"mouseover":case"mouseout":Li=null;break;case"pointerover":case"pointerout":Cu.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Eu.delete(i.pointerId)}}function Nu(r,i,u,f,y,v){return r===null||r.nativeEvent!==v?(r={blockedOn:i,domEventName:u,eventSystemFlags:f,nativeEvent:v,targetContainers:[y]},i!==null&&(i=he(i),i!==null&&iS(i)),r):(r.eventSystemFlags|=f,i=r.targetContainers,y!==null&&i.indexOf(y)===-1&&i.push(y),r)}function N2(r,i,u,f,y){switch(i){case"focusin":return Di=Nu(Di,r,i,u,f,y),!0;case"dragenter":return Ii=Nu(Ii,r,i,u,f,y),!0;case"mouseover":return Li=Nu(Li,r,i,u,f,y),!0;case"pointerover":var v=y.pointerId;return Cu.set(v,Nu(Cu.get(v)||null,r,i,u,f,y)),!0;case"gotpointercapture":return v=y.pointerId,Eu.set(v,Nu(Eu.get(v)||null,r,i,u,f,y)),!0}return!1}function uS(r){var i=$(r.target);if(i!==null){var u=l(i);if(u!==null){if(i=u.tag,i===13){if(i=c(u),i!==null){r.blockedOn=i,Lo(r.priority,function(){sS(u)});return}}else if(i===31){if(i=d(u),i!==null){r.blockedOn=i,Lo(r.priority,function(){sS(u)});return}}else if(i===3&&u.stateNode.current.memoizedState.isDehydrated){r.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}r.blockedOn=null}function ef(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var u=Lp(r.nativeEvent);if(u===null){u=r.nativeEvent;var f=new u.constructor(u.type,u);Ph=f,u.target.dispatchEvent(f),Ph=null}else return i=he(u),i!==null&&iS(i),r.blockedOn=u,!1;i.shift()}return!0}function cS(r,i,u){ef(r)&&u.delete(i)}function _2(){Up=!1,Di!==null&&ef(Di)&&(Di=null),Ii!==null&&ef(Ii)&&(Ii=null),Li!==null&&ef(Li)&&(Li=null),Cu.forEach(cS),Eu.forEach(cS)}function tf(r,i){r.blockedOn===i&&(r.blockedOn=null,Up||(Up=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,_2)))}var nf=null;function dS(r){nf!==r&&(nf=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){nf===r&&(nf=null);for(var i=0;i<r.length;i+=3){var u=r[i],f=r[i+1],y=r[i+2];if(typeof f!="function"){if(Pp(f||u)===null)continue;break}var v=he(u);v!==null&&(r.splice(i,3),i-=3,Lm(v,{pending:!0,data:y,method:u.method,action:f},f,y))}}))}function Pl(r){function i(H){return tf(H,r)}Di!==null&&tf(Di,r),Ii!==null&&tf(Ii,r),Li!==null&&tf(Li,r),Cu.forEach(i),Eu.forEach(i);for(var u=0;u<Pi.length;u++){var f=Pi[u];f.blockedOn===r&&(f.blockedOn=null)}for(;0<Pi.length&&(u=Pi[0],u.blockedOn===null);)uS(u),u.blockedOn===null&&Pi.shift();if(u=(r.ownerDocument||r).$$reactFormReplay,u!=null)for(f=0;f<u.length;f+=3){var y=u[f],v=u[f+1],k=y[qt]||null;if(typeof v=="function")k||dS(u);else if(k){var A=null;if(v&&v.hasAttribute("formAction")){if(y=v,k=v[qt]||null)A=k.formAction;else if(Pp(y)!==null)continue}else A=k.action;typeof A=="function"?u[f+1]=A:(u.splice(f,3),f-=3),dS(u)}}}function fS(){function r(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(k){return y=k})},focusReset:"manual",scroll:"manual"})}function i(){y!==null&&(y(),y=null),f||setTimeout(u,20)}function u(){if(!f&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,y=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(u,100),function(){f=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),y!==null&&(y(),y=null)}}}function Bp(r){this._internalRoot=r}rf.prototype.render=Bp.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(a(409));var u=i.current,f=Mr();rS(u,f,r,i,null,null)},rf.prototype.unmount=Bp.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;rS(r.current,2,null,r,null,null),Ld(),i[Da]=null}};function rf(r){this._internalRoot=r}rf.prototype.unstable_scheduleHydration=function(r){if(r){var i=Io();r={blockedOn:null,target:r,priority:i};for(var u=0;u<Pi.length&&i!==0&&i<Pi[u].priority;u++);Pi.splice(u,0,r),u===0&&uS(r)}};var hS=t.version;if(hS!=="19.2.4")throw Error(a(527,hS,"19.2.4"));ne.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(a(188)):(r=Object.keys(r).join(","),Error(a(268,r)));return r=h(i),r=r!==null?g(r):null,r=r===null?null:r.stateNode,r};var T2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var af=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!af.isDisabled&&af.supportsFiber)try{$t=af.inject(T2),It=af}catch{}}return Tu.createRoot=function(r,i){if(!s(r))throw Error(a(299));var u=!1,f="",y=x0,v=w0,k=S0;return i!=null&&(i.unstable_strictMode===!0&&(u=!0),i.identifierPrefix!==void 0&&(f=i.identifierPrefix),i.onUncaughtError!==void 0&&(y=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(k=i.onRecoverableError)),i=tS(r,1,!1,null,null,u,f,null,y,v,k,fS),r[Da]=i.current,wp(r),new Bp(i)},Tu.hydrateRoot=function(r,i,u){if(!s(r))throw Error(a(299));var f=!1,y="",v=x0,k=w0,A=S0,H=null;return u!=null&&(u.unstable_strictMode===!0&&(f=!0),u.identifierPrefix!==void 0&&(y=u.identifierPrefix),u.onUncaughtError!==void 0&&(v=u.onUncaughtError),u.onCaughtError!==void 0&&(k=u.onCaughtError),u.onRecoverableError!==void 0&&(A=u.onRecoverableError),u.formState!==void 0&&(H=u.formState)),i=tS(r,1,!0,i,u??null,f,y,H,v,k,A,fS),i.context=nS(null),u=i.current,f=Mr(),f=nr(f),y=ki(f),y.callback=null,ji(u,y,f),u=f,i.current.lanes=u,pn(i,u),Ca(i),r[Da]=i.current,wp(r),new rf(i)},Tu.version="19.2.4",Tu}var jS;function B2(){if(jS)return qp.exports;jS=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),qp.exports=U2(),qp.exports}var F2=B2(),Xs=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ps,Vi,ro,sj,$2=(sj=class extends Xs{constructor(){super();Ne(this,Ps);Ne(this,Vi);Ne(this,ro);xe(this,ro,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){B(this,Vi)||this.setEventListener(B(this,ro))}onUnsubscribe(){var t;this.hasListeners()||((t=B(this,Vi))==null||t.call(this),xe(this,Vi,void 0))}setEventListener(t){var n;xe(this,ro,t),(n=B(this,Vi))==null||n.call(this),xe(this,Vi,t(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(t){B(this,Ps)!==t&&(xe(this,Ps,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof B(this,Ps)=="boolean"?B(this,Ps):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Ps=new WeakMap,Vi=new WeakMap,ro=new WeakMap,sj),tv=new $2,H2={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Qi,Wy,lj,q2=(lj=class{constructor(){Ne(this,Qi,H2);Ne(this,Wy,!1)}setTimeoutProvider(e){xe(this,Qi,e)}setTimeout(e,t){return B(this,Qi).setTimeout(e,t)}clearTimeout(e){B(this,Qi).clearTimeout(e)}setInterval(e,t){return B(this,Qi).setInterval(e,t)}clearInterval(e){B(this,Qi).clearInterval(e)}},Qi=new WeakMap,Wy=new WeakMap,lj),Ds=new q2;function Z2(e){setTimeout(e,0)}var G2=typeof window>"u"||"Deno"in globalThis;function Kn(){}function V2(e,t){return typeof e=="function"?e(t):e}function Zg(e){return typeof e=="number"&&e>=0&&e!==1/0}function bj(e,t){return Math.max(e+(t||0)-Date.now(),0)}function rs(e,t){return typeof e=="function"?e(t):e}function ea(e,t){return typeof e=="function"?e(t):e}function CS(e,t){const{type:n="all",exact:a,fetchStatus:s,predicate:l,queryKey:c,stale:d}=e;if(c){if(a){if(t.queryHash!==nv(c,t.options))return!1}else if(!nc(t.queryKey,c))return!1}if(n!=="all"){const m=t.isActive();if(n==="active"&&!m||n==="inactive"&&m)return!1}return!(typeof d=="boolean"&&t.isStale()!==d||s&&s!==t.state.fetchStatus||l&&!l(t))}function ES(e,t){const{exact:n,status:a,predicate:s,mutationKey:l}=e;if(l){if(!t.options.mutationKey)return!1;if(n){if(Vs(t.options.mutationKey)!==Vs(l))return!1}else if(!nc(t.options.mutationKey,l))return!1}return!(a&&t.state.status!==a||s&&!s(t))}function nv(e,t){return((t==null?void 0:t.queryKeyHashFn)||Vs)(e)}function Vs(e){return JSON.stringify(e,(t,n)=>Gg(n)?Object.keys(n).sort().reduce((a,s)=>(a[s]=n[s],a),{}):n)}function nc(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>nc(e[n],t[n])):!1}var Q2=Object.prototype.hasOwnProperty;function rv(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=NS(e)&&NS(t);if(!a&&!(Gg(e)&&Gg(t)))return t;const l=(a?e:Object.keys(e)).length,c=a?t:Object.keys(t),d=c.length,m=a?new Array(d):{};let h=0;for(let g=0;g<d;g++){const p=a?g:c[g],b=e[p],w=t[p];if(b===w){m[p]=b,(a?g<l:Q2.call(e,p))&&h++;continue}if(b===null||w===null||typeof b!="object"||typeof w!="object"){m[p]=w;continue}const S=rv(b,w,n+1);m[p]=S,S===b&&h++}return l===d&&h===l?e:m}function rc(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function NS(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Gg(e){if(!_S(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!_S(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function _S(e){return Object.prototype.toString.call(e)==="[object Object]"}function K2(e){return new Promise(t=>{Ds.setTimeout(t,e)})}function Vg(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?rv(e,t):t}function Y2(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function X2(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var av=Symbol();function xj(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===av?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function iv(e,t){return typeof e=="function"?e(...t):!!e}function W2(e,t,n){let a=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),a||(a=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var ac=(()=>{let e=()=>G2;return{isServer(){return e()},setIsServer(t){e=t}}})();function Qg(){let e,t;const n=new Promise((s,l)=>{e=s,t=l});n.status="pending",n.catch(()=>{});function a(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{a({status:"fulfilled",value:s}),e(s)},n.reject=s=>{a({status:"rejected",reason:s}),t(s)},n}var J2=Z2;function eR(){let e=[],t=0,n=d=>{d()},a=d=>{d()},s=J2;const l=d=>{t?e.push(d):s(()=>{n(d)})},c=()=>{const d=e;e=[],d.length&&s(()=>{a(()=>{d.forEach(m=>{n(m)})})})};return{batch:d=>{let m;t++;try{m=d()}finally{t--,t||c()}return m},batchCalls:d=>(...m)=>{l(()=>{d(...m)})},schedule:l,setNotifyFunction:d=>{n=d},setBatchNotifyFunction:d=>{a=d},setScheduler:d=>{s=d}}}var sn=eR(),ao,Ki,io,oj,tR=(oj=class extends Xs{constructor(){super();Ne(this,ao,!0);Ne(this,Ki);Ne(this,io);xe(this,io,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),a=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",a)}}})}onSubscribe(){B(this,Ki)||this.setEventListener(B(this,io))}onUnsubscribe(){var t;this.hasListeners()||((t=B(this,Ki))==null||t.call(this),xe(this,Ki,void 0))}setEventListener(t){var n;xe(this,io,t),(n=B(this,Ki))==null||n.call(this),xe(this,Ki,t(this.setOnline.bind(this)))}setOnline(t){B(this,ao)!==t&&(xe(this,ao,t),this.listeners.forEach(a=>{a(t)}))}isOnline(){return B(this,ao)}},ao=new WeakMap,Ki=new WeakMap,io=new WeakMap,oj),Pf=new tR;function nR(e){return Math.min(1e3*2**e,3e4)}function wj(e){return(e??"online")==="online"?Pf.isOnline():!0}var Kg=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Sj(e){let t=!1,n=0,a;const s=Qg(),l=()=>s.status!=="pending",c=j=>{var E;if(!l()){const C=new Kg(j);b(C),(E=e.onCancel)==null||E.call(e,C)}},d=()=>{t=!0},m=()=>{t=!1},h=()=>tv.isFocused()&&(e.networkMode==="always"||Pf.isOnline())&&e.canRun(),g=()=>wj(e.networkMode)&&e.canRun(),p=j=>{l()||(a==null||a(),s.resolve(j))},b=j=>{l()||(a==null||a(),s.reject(j))},w=()=>new Promise(j=>{var E;a=C=>{(l()||h())&&j(C)},(E=e.onPause)==null||E.call(e)}).then(()=>{var j;a=void 0,l()||(j=e.onContinue)==null||j.call(e)}),S=()=>{if(l())return;let j;const E=n===0?e.initialPromise:void 0;try{j=E??e.fn()}catch(C){j=Promise.reject(C)}Promise.resolve(j).then(p).catch(C=>{var O;if(l())return;const _=e.retry??(ac.isServer()?0:3),z=e.retryDelay??nR,M=typeof z=="function"?z(n,C):z,L=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,C);if(t||!L){b(C);return}n++,(O=e.onFail)==null||O.call(e,n,C),K2(M).then(()=>h()?void 0:w()).then(()=>{t?b(C):S()})})};return{promise:s,status:()=>s.status,cancel:c,continue:()=>(a==null||a(),s),cancelRetry:d,continueRetry:m,canStart:g,start:()=>(g()?S():w().then(S),s)}}var Us,uj,kj=(uj=class{constructor(){Ne(this,Us)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Zg(this.gcTime)&&xe(this,Us,Ds.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ac.isServer()?1/0:300*1e3))}clearGcTimeout(){B(this,Us)&&(Ds.clearTimeout(B(this,Us)),xe(this,Us,void 0))}},Us=new WeakMap,uj),Bs,so,Wr,Fs,In,xc,$s,Lr,jj,ti,cj,rR=(cj=class extends kj{constructor(t){super();Ne(this,Lr);Ne(this,Bs);Ne(this,so);Ne(this,Wr);Ne(this,Fs);Ne(this,In);Ne(this,xc);Ne(this,$s);xe(this,$s,!1),xe(this,xc,t.defaultOptions),this.setOptions(t.options),this.observers=[],xe(this,Fs,t.client),xe(this,Wr,B(this,Fs).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,xe(this,Bs,AS(this.options)),this.state=t.state??B(this,Bs),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=B(this,In))==null?void 0:t.promise}setOptions(t){if(this.options={...B(this,xc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=AS(this.options);n.data!==void 0&&(this.setState(TS(n.data,n.dataUpdatedAt)),xe(this,Bs,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&B(this,Wr).remove(this)}setData(t,n){const a=Vg(this.state.data,t,this.options);return He(this,Lr,ti).call(this,{data:a,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),a}setState(t,n){He(this,Lr,ti).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var a,s;const n=(a=B(this,In))==null?void 0:a.promise;return(s=B(this,In))==null||s.cancel(t),n?n.then(Kn).catch(Kn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return B(this,Bs)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>ea(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===av||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>rs(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!bj(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(a=>a.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=B(this,In))==null||n.continue()}onOnline(){var n;const t=this.observers.find(a=>a.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=B(this,In))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),B(this,Wr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(B(this,In)&&(B(this,$s)||He(this,Lr,jj).call(this)?B(this,In).cancel({revert:!0}):B(this,In).cancelRetry()),this.scheduleGc()),B(this,Wr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||He(this,Lr,ti).call(this,{type:"invalidate"})}async fetch(t,n){var m,h,g,p,b,w,S,j,E,C,_,z;if(this.state.fetchStatus!=="idle"&&((m=B(this,In))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(B(this,In))return B(this,In).continueRetry(),B(this,In).promise}if(t&&this.setOptions(t),!this.options.queryFn){const M=this.observers.find(L=>L.options.queryFn);M&&this.setOptions(M.options)}const a=new AbortController,s=M=>{Object.defineProperty(M,"signal",{enumerable:!0,get:()=>(xe(this,$s,!0),a.signal)})},l=()=>{const M=xj(this.options,n),O=(()=>{const F={client:B(this,Fs),queryKey:this.queryKey,meta:this.meta};return s(F),F})();return xe(this,$s,!1),this.options.persister?this.options.persister(M,O,this):M(O)},d=(()=>{const M={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:B(this,Fs),state:this.state,fetchFn:l};return s(M),M})();(h=this.options.behavior)==null||h.onFetch(d,this),xe(this,so,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((g=d.fetchOptions)==null?void 0:g.meta))&&He(this,Lr,ti).call(this,{type:"fetch",meta:(p=d.fetchOptions)==null?void 0:p.meta}),xe(this,In,Sj({initialPromise:n==null?void 0:n.initialPromise,fn:d.fetchFn,onCancel:M=>{M instanceof Kg&&M.revert&&this.setState({...B(this,so),fetchStatus:"idle"}),a.abort()},onFail:(M,L)=>{He(this,Lr,ti).call(this,{type:"failed",failureCount:M,error:L})},onPause:()=>{He(this,Lr,ti).call(this,{type:"pause"})},onContinue:()=>{He(this,Lr,ti).call(this,{type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode,canRun:()=>!0}));try{const M=await B(this,In).start();if(M===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(M),(w=(b=B(this,Wr).config).onSuccess)==null||w.call(b,M,this),(j=(S=B(this,Wr).config).onSettled)==null||j.call(S,M,this.state.error,this),M}catch(M){if(M instanceof Kg){if(M.silent)return B(this,In).promise;if(M.revert){if(this.state.data===void 0)throw M;return this.state.data}}throw He(this,Lr,ti).call(this,{type:"error",error:M}),(C=(E=B(this,Wr).config).onError)==null||C.call(E,M,this),(z=(_=B(this,Wr).config).onSettled)==null||z.call(_,this.state.data,M,this),M}finally{this.scheduleGc()}}},Bs=new WeakMap,so=new WeakMap,Wr=new WeakMap,Fs=new WeakMap,In=new WeakMap,xc=new WeakMap,$s=new WeakMap,Lr=new WeakSet,jj=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ti=function(t){const n=a=>{switch(t.type){case"failed":return{...a,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...Cj(a.data,this.options),fetchMeta:t.meta??null};case"success":const s={...a,...TS(t.data,t.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return xe(this,so,t.manual?s:void 0),s;case"error":const l=t.error;return{...a,error:l,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:l,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...t.state}}};this.state=n(this.state),sn.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),B(this,Wr).notify({query:this,type:"updated",action:t})})},cj);function Cj(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:wj(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function TS(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function AS(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 xr,ft,wc,sr,Hs,lo,ni,Yi,Sc,oo,uo,qs,Zs,Xi,co,Et,Vu,Yg,Xg,Wg,Jg,ey,ty,ny,Ej,dj,sv=(dj=class extends Xs{constructor(t,n){super();Ne(this,Et);Ne(this,xr);Ne(this,ft);Ne(this,wc);Ne(this,sr);Ne(this,Hs);Ne(this,lo);Ne(this,ni);Ne(this,Yi);Ne(this,Sc);Ne(this,oo);Ne(this,uo);Ne(this,qs);Ne(this,Zs);Ne(this,Xi);Ne(this,co,new Set);this.options=n,xe(this,xr,t),xe(this,Yi,null),xe(this,ni,Qg()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(B(this,ft).addObserver(this),RS(B(this,ft),this.options)?He(this,Et,Vu).call(this):this.updateResult(),He(this,Et,Jg).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ry(B(this,ft),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ry(B(this,ft),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,He(this,Et,ey).call(this),He(this,Et,ty).call(this),B(this,ft).removeObserver(this)}setOptions(t){const n=this.options,a=B(this,ft);if(this.options=B(this,xr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ea(this.options.enabled,B(this,ft))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");He(this,Et,ny).call(this),B(this,ft).setOptions(this.options),n._defaulted&&!rc(this.options,n)&&B(this,xr).getQueryCache().notify({type:"observerOptionsUpdated",query:B(this,ft),observer:this});const s=this.hasListeners();s&&OS(B(this,ft),a,this.options,n)&&He(this,Et,Vu).call(this),this.updateResult(),s&&(B(this,ft)!==a||ea(this.options.enabled,B(this,ft))!==ea(n.enabled,B(this,ft))||rs(this.options.staleTime,B(this,ft))!==rs(n.staleTime,B(this,ft)))&&He(this,Et,Yg).call(this);const l=He(this,Et,Xg).call(this);s&&(B(this,ft)!==a||ea(this.options.enabled,B(this,ft))!==ea(n.enabled,B(this,ft))||l!==B(this,Xi))&&He(this,Et,Wg).call(this,l)}getOptimisticResult(t){const n=B(this,xr).getQueryCache().build(B(this,xr),t),a=this.createResult(n,t);return iR(this,a)&&(xe(this,sr,a),xe(this,lo,this.options),xe(this,Hs,B(this,ft).state)),a}getCurrentResult(){return B(this,sr)}trackResult(t,n){return new Proxy(t,{get:(a,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&B(this,ni).status==="pending"&&B(this,ni).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,s))})}trackProp(t){B(this,co).add(t)}getCurrentQuery(){return B(this,ft)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=B(this,xr).defaultQueryOptions(t),a=B(this,xr).getQueryCache().build(B(this,xr),n);return a.fetch().then(()=>this.createResult(a,n))}fetch(t){return He(this,Et,Vu).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),B(this,sr)))}createResult(t,n){var V;const a=B(this,ft),s=this.options,l=B(this,sr),c=B(this,Hs),d=B(this,lo),h=t!==a?t.state:B(this,wc),{state:g}=t;let p={...g},b=!1,w;if(n._optimisticResults){const I=this.hasListeners(),Q=!I&&RS(t,n),ie=I&&OS(t,a,n,s);(Q||ie)&&(p={...p,...Cj(g.data,t.options)}),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:S,errorUpdatedAt:j,status:E}=p;w=p.data;let C=!1;if(n.placeholderData!==void 0&&w===void 0&&E==="pending"){let I;l!=null&&l.isPlaceholderData&&n.placeholderData===(d==null?void 0:d.placeholderData)?(I=l.data,C=!0):I=typeof n.placeholderData=="function"?n.placeholderData((V=B(this,uo))==null?void 0:V.state.data,B(this,uo)):n.placeholderData,I!==void 0&&(E="success",w=Vg(l==null?void 0:l.data,I,n),b=!0)}if(n.select&&w!==void 0&&!C)if(l&&w===(c==null?void 0:c.data)&&n.select===B(this,Sc))w=B(this,oo);else try{xe(this,Sc,n.select),w=n.select(w),w=Vg(l==null?void 0:l.data,w,n),xe(this,oo,w),xe(this,Yi,null)}catch(I){xe(this,Yi,I)}B(this,Yi)&&(S=B(this,Yi),w=B(this,oo),j=Date.now(),E="error");const _=p.fetchStatus==="fetching",z=E==="pending",M=E==="error",L=z&&_,O=w!==void 0,P={status:E,fetchStatus:p.fetchStatus,isPending:z,isSuccess:E==="success",isError:M,isInitialLoading:L,isLoading:L,data:w,dataUpdatedAt:p.dataUpdatedAt,error:S,errorUpdatedAt:j,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:p.dataUpdateCount>h.dataUpdateCount||p.errorUpdateCount>h.errorUpdateCount,isFetching:_,isRefetching:_&&!z,isLoadingError:M&&!O,isPaused:p.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:M&&O,isStale:lv(t,n),refetch:this.refetch,promise:B(this,ni),isEnabled:ea(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const I=P.data!==void 0,Q=P.status==="error"&&!I,ie=W=>{Q?W.reject(P.error):I&&W.resolve(P.data)},be=()=>{const W=xe(this,ni,P.promise=Qg());ie(W)},X=B(this,ni);switch(X.status){case"pending":t.queryHash===a.queryHash&&ie(X);break;case"fulfilled":(Q||P.data!==X.value)&&be();break;case"rejected":(!Q||P.error!==X.reason)&&be();break}}return P}updateResult(){const t=B(this,sr),n=this.createResult(B(this,ft),this.options);if(xe(this,Hs,B(this,ft).state),xe(this,lo,this.options),B(this,Hs).data!==void 0&&xe(this,uo,B(this,ft)),rc(n,t))return;xe(this,sr,n);const a=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,l=typeof s=="function"?s():s;if(l==="all"||!l&&!B(this,co).size)return!0;const c=new Set(l??B(this,co));return this.options.throwOnError&&c.add("error"),Object.keys(B(this,sr)).some(d=>{const m=d;return B(this,sr)[m]!==t[m]&&c.has(m)})};He(this,Et,Ej).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&He(this,Et,Jg).call(this)}},xr=new WeakMap,ft=new WeakMap,wc=new WeakMap,sr=new WeakMap,Hs=new WeakMap,lo=new WeakMap,ni=new WeakMap,Yi=new WeakMap,Sc=new WeakMap,oo=new WeakMap,uo=new WeakMap,qs=new WeakMap,Zs=new WeakMap,Xi=new WeakMap,co=new WeakMap,Et=new WeakSet,Vu=function(t){He(this,Et,ny).call(this);let n=B(this,ft).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Kn)),n},Yg=function(){He(this,Et,ey).call(this);const t=rs(this.options.staleTime,B(this,ft));if(ac.isServer()||B(this,sr).isStale||!Zg(t))return;const a=bj(B(this,sr).dataUpdatedAt,t)+1;xe(this,qs,Ds.setTimeout(()=>{B(this,sr).isStale||this.updateResult()},a))},Xg=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(B(this,ft)):this.options.refetchInterval)??!1},Wg=function(t){He(this,Et,ty).call(this),xe(this,Xi,t),!(ac.isServer()||ea(this.options.enabled,B(this,ft))===!1||!Zg(B(this,Xi))||B(this,Xi)===0)&&xe(this,Zs,Ds.setInterval(()=>{(this.options.refetchIntervalInBackground||tv.isFocused())&&He(this,Et,Vu).call(this)},B(this,Xi)))},Jg=function(){He(this,Et,Yg).call(this),He(this,Et,Wg).call(this,He(this,Et,Xg).call(this))},ey=function(){B(this,qs)&&(Ds.clearTimeout(B(this,qs)),xe(this,qs,void 0))},ty=function(){B(this,Zs)&&(Ds.clearInterval(B(this,Zs)),xe(this,Zs,void 0))},ny=function(){const t=B(this,xr).getQueryCache().build(B(this,xr),this.options);if(t===B(this,ft))return;const n=B(this,ft);xe(this,ft,t),xe(this,wc,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Ej=function(t){sn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(B(this,sr))}),B(this,xr).getQueryCache().notify({query:B(this,ft),type:"observerResultsUpdated"})})},dj);function aR(e,t){return ea(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function RS(e,t){return aR(e,t)||e.state.data!==void 0&&ry(e,t,t.refetchOnMount)}function ry(e,t,n){if(ea(t.enabled,e)!==!1&&rs(t.staleTime,e)!=="static"){const a=typeof n=="function"?n(e):n;return a==="always"||a!==!1&&lv(e,t)}return!1}function OS(e,t,n,a){return(e!==t||ea(a.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&lv(e,n)}function lv(e,t){return ea(t.enabled,e)!==!1&&e.isStaleByTime(rs(t.staleTime,e))}function iR(e,t){return!rc(e.getCurrentResult(),t)}function zS(e){return{onFetch:(t,n)=>{var g,p,b,w,S;const a=t.options,s=(b=(p=(g=t.fetchOptions)==null?void 0:g.meta)==null?void 0:p.fetchMore)==null?void 0:b.direction,l=((w=t.state.data)==null?void 0:w.pages)||[],c=((S=t.state.data)==null?void 0:S.pageParams)||[];let d={pages:[],pageParams:[]},m=0;const h=async()=>{let j=!1;const E=z=>{W2(z,()=>t.signal,()=>j=!0)},C=xj(t.options,t.fetchOptions),_=async(z,M,L)=>{if(j)return Promise.reject();if(M==null&&z.pages.length)return Promise.resolve(z);const F=(()=>{const Q={client:t.client,queryKey:t.queryKey,pageParam:M,direction:L?"backward":"forward",meta:t.options.meta};return E(Q),Q})(),P=await C(F),{maxPages:V}=t.options,I=L?X2:Y2;return{pages:I(z.pages,P,V),pageParams:I(z.pageParams,M,V)}};if(s&&l.length){const z=s==="backward",M=z?sR:MS,L={pages:l,pageParams:c},O=M(a,L);d=await _(L,O,z)}else{const z=e??l.length;do{const M=m===0?c[0]??a.initialPageParam:MS(a,d);if(m>0&&M==null)break;d=await _(d,M),m++}while(m<z)}return d};t.options.persister?t.fetchFn=()=>{var j,E;return(E=(j=t.options).persister)==null?void 0:E.call(j,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=h}}}function MS(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 sR(e,{pages:t,pageParams:n}){var a;return t.length>0?(a=e.getPreviousPageParam)==null?void 0:a.call(e,t[0],t,n[0],n):void 0}var kc,Na,Vn,Gs,_a,Hi,fj,lR=(fj=class extends kj{constructor(t){super();Ne(this,_a);Ne(this,kc);Ne(this,Na);Ne(this,Vn);Ne(this,Gs);xe(this,kc,t.client),this.mutationId=t.mutationId,xe(this,Vn,t.mutationCache),xe(this,Na,[]),this.state=t.state||Nj(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){B(this,Na).includes(t)||(B(this,Na).push(t),this.clearGcTimeout(),B(this,Vn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){xe(this,Na,B(this,Na).filter(n=>n!==t)),this.scheduleGc(),B(this,Vn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){B(this,Na).length||(this.state.status==="pending"?this.scheduleGc():B(this,Vn).remove(this))}continue(){var t;return((t=B(this,Gs))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var c,d,m,h,g,p,b,w,S,j,E,C,_,z,M,L,O,F;const n=()=>{He(this,_a,Hi).call(this,{type:"continue"})},a={client:B(this,kc),meta:this.options.meta,mutationKey:this.options.mutationKey};xe(this,Gs,Sj({fn:()=>this.options.mutationFn?this.options.mutationFn(t,a):Promise.reject(new Error("No mutationFn found")),onFail:(P,V)=>{He(this,_a,Hi).call(this,{type:"failed",failureCount:P,error:V})},onPause:()=>{He(this,_a,Hi).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>B(this,Vn).canRun(this)}));const s=this.state.status==="pending",l=!B(this,Gs).canStart();try{if(s)n();else{He(this,_a,Hi).call(this,{type:"pending",variables:t,isPaused:l}),B(this,Vn).config.onMutate&&await B(this,Vn).config.onMutate(t,this,a);const V=await((d=(c=this.options).onMutate)==null?void 0:d.call(c,t,a));V!==this.state.context&&He(this,_a,Hi).call(this,{type:"pending",context:V,variables:t,isPaused:l})}const P=await B(this,Gs).start();return await((h=(m=B(this,Vn).config).onSuccess)==null?void 0:h.call(m,P,t,this.state.context,this,a)),await((p=(g=this.options).onSuccess)==null?void 0:p.call(g,P,t,this.state.context,a)),await((w=(b=B(this,Vn).config).onSettled)==null?void 0:w.call(b,P,null,this.state.variables,this.state.context,this,a)),await((j=(S=this.options).onSettled)==null?void 0:j.call(S,P,null,t,this.state.context,a)),He(this,_a,Hi).call(this,{type:"success",data:P}),P}catch(P){try{await((C=(E=B(this,Vn).config).onError)==null?void 0:C.call(E,P,t,this.state.context,this,a))}catch(V){Promise.reject(V)}try{await((z=(_=this.options).onError)==null?void 0:z.call(_,P,t,this.state.context,a))}catch(V){Promise.reject(V)}try{await((L=(M=B(this,Vn).config).onSettled)==null?void 0:L.call(M,void 0,P,this.state.variables,this.state.context,this,a))}catch(V){Promise.reject(V)}try{await((F=(O=this.options).onSettled)==null?void 0:F.call(O,void 0,P,t,this.state.context,a))}catch(V){Promise.reject(V)}throw He(this,_a,Hi).call(this,{type:"error",error:P}),P}finally{B(this,Vn).runNext(this)}}},kc=new WeakMap,Na=new WeakMap,Vn=new WeakMap,Gs=new WeakMap,_a=new WeakSet,Hi=function(t){const n=a=>{switch(t.type){case"failed":return{...a,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...a,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:t.error,failureCount:a.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),sn.batch(()=>{B(this,Na).forEach(a=>{a.onMutationUpdate(t)}),B(this,Vn).notify({mutation:this,type:"updated",action:t})})},fj);function Nj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ri,ga,jc,hj,oR=(hj=class extends Xs{constructor(t={}){super();Ne(this,ri);Ne(this,ga);Ne(this,jc);this.config=t,xe(this,ri,new Set),xe(this,ga,new Map),xe(this,jc,0)}build(t,n,a){const s=new lR({client:t,mutationCache:this,mutationId:++sf(this,jc)._,options:t.defaultMutationOptions(n),state:a});return this.add(s),s}add(t){B(this,ri).add(t);const n=lf(t);if(typeof n=="string"){const a=B(this,ga).get(n);a?a.push(t):B(this,ga).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(B(this,ri).delete(t)){const n=lf(t);if(typeof n=="string"){const a=B(this,ga).get(n);if(a)if(a.length>1){const s=a.indexOf(t);s!==-1&&a.splice(s,1)}else a[0]===t&&B(this,ga).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=lf(t);if(typeof n=="string"){const a=B(this,ga).get(n),s=a==null?void 0:a.find(l=>l.state.status==="pending");return!s||s===t}else return!0}runNext(t){var a;const n=lf(t);if(typeof n=="string"){const s=(a=B(this,ga).get(n))==null?void 0:a.find(l=>l!==t&&l.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){sn.batch(()=>{B(this,ri).forEach(t=>{this.notify({type:"removed",mutation:t})}),B(this,ri).clear(),B(this,ga).clear()})}getAll(){return Array.from(B(this,ri))}find(t){const n={exact:!0,...t};return this.getAll().find(a=>ES(n,a))}findAll(t={}){return this.getAll().filter(n=>ES(t,n))}notify(t){sn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return sn.batch(()=>Promise.all(t.map(n=>n.continue().catch(Kn))))}},ri=new WeakMap,ga=new WeakMap,jc=new WeakMap,hj);function lf(e){var t;return(t=e.options.scope)==null?void 0:t.id}var ai,Wi,wr,ii,li,Tf,ay,mj,uR=(mj=class extends Xs{constructor(n,a){super();Ne(this,li);Ne(this,ai);Ne(this,Wi);Ne(this,wr);Ne(this,ii);xe(this,ai,n),this.setOptions(a),this.bindMethods(),He(this,li,Tf).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const a=this.options;this.options=B(this,ai).defaultMutationOptions(n),rc(this.options,a)||B(this,ai).getMutationCache().notify({type:"observerOptionsUpdated",mutation:B(this,wr),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&Vs(a.mutationKey)!==Vs(this.options.mutationKey)?this.reset():((s=B(this,wr))==null?void 0:s.state.status)==="pending"&&B(this,wr).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=B(this,wr))==null||n.removeObserver(this)}onMutationUpdate(n){He(this,li,Tf).call(this),He(this,li,ay).call(this,n)}getCurrentResult(){return B(this,Wi)}reset(){var n;(n=B(this,wr))==null||n.removeObserver(this),xe(this,wr,void 0),He(this,li,Tf).call(this),He(this,li,ay).call(this)}mutate(n,a){var s;return xe(this,ii,a),(s=B(this,wr))==null||s.removeObserver(this),xe(this,wr,B(this,ai).getMutationCache().build(B(this,ai),this.options)),B(this,wr).addObserver(this),B(this,wr).execute(n)}},ai=new WeakMap,Wi=new WeakMap,wr=new WeakMap,ii=new WeakMap,li=new WeakSet,Tf=function(){var a;const n=((a=B(this,wr))==null?void 0:a.state)??Nj();xe(this,Wi,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},ay=function(n){sn.batch(()=>{var a,s,l,c,d,m,h,g;if(B(this,ii)&&this.hasListeners()){const p=B(this,Wi).variables,b=B(this,Wi).context,w={client:B(this,ai),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(a=B(this,ii)).onSuccess)==null||s.call(a,n.data,p,b,w)}catch(S){Promise.reject(S)}try{(c=(l=B(this,ii)).onSettled)==null||c.call(l,n.data,null,p,b,w)}catch(S){Promise.reject(S)}}else if((n==null?void 0:n.type)==="error"){try{(m=(d=B(this,ii)).onError)==null||m.call(d,n.error,p,b,w)}catch(S){Promise.reject(S)}try{(g=(h=B(this,ii)).onSettled)==null||g.call(h,void 0,n.error,p,b,w)}catch(S){Promise.reject(S)}}}this.listeners.forEach(p=>{p(B(this,Wi))})})},mj);function DS(e,t){const n=new Set(t);return e.filter(a=>!n.has(a))}function cR(e,t,n){const a=e.slice(0);return a[t]=n,a}var fo,Ir,ho,mo,Jr,Ji,Cc,Ec,Nc,_c,qn,iy,sy,ly,oy,uy,pj,dR=(pj=class extends Xs{constructor(t,n,a){super();Ne(this,qn);Ne(this,fo);Ne(this,Ir);Ne(this,ho);Ne(this,mo);Ne(this,Jr);Ne(this,Ji);Ne(this,Cc);Ne(this,Ec);Ne(this,Nc);Ne(this,_c,[]);xe(this,fo,t),xe(this,mo,a),xe(this,ho,[]),xe(this,Jr,[]),xe(this,Ir,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&B(this,Jr).forEach(t=>{t.subscribe(n=>{He(this,qn,oy).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,B(this,Jr).forEach(t=>{t.destroy()})}setQueries(t,n){xe(this,ho,t),xe(this,mo,n),sn.batch(()=>{const a=B(this,Jr),s=He(this,qn,ly).call(this,B(this,ho));s.forEach(p=>p.observer.setOptions(p.defaultedQueryOptions));const l=s.map(p=>p.observer),c=l.map(p=>p.getCurrentResult()),d=a.length!==l.length,m=l.some((p,b)=>p!==a[b]),h=d||m,g=h?!0:c.some((p,b)=>{const w=B(this,Ir)[b];return!w||!rc(p,w)});!h&&!g||(h&&(xe(this,_c,s),xe(this,Jr,l)),xe(this,Ir,c),this.hasListeners()&&(h&&(DS(a,l).forEach(p=>{p.destroy()}),DS(l,a).forEach(p=>{p.subscribe(b=>{He(this,qn,oy).call(this,p,b)})})),He(this,qn,uy).call(this)))})}getCurrentResult(){return B(this,Ir)}getQueries(){return B(this,Jr).map(t=>t.getCurrentQuery())}getObservers(){return B(this,Jr)}getOptimisticResult(t,n){const a=He(this,qn,ly).call(this,t),s=a.map(c=>c.observer.getOptimisticResult(c.defaultedQueryOptions)),l=a.map(c=>c.defaultedQueryOptions.queryHash);return[s,c=>He(this,qn,sy).call(this,c??s,n,l),()=>He(this,qn,iy).call(this,s,a)]}},fo=new WeakMap,Ir=new WeakMap,ho=new WeakMap,mo=new WeakMap,Jr=new WeakMap,Ji=new WeakMap,Cc=new WeakMap,Ec=new WeakMap,Nc=new WeakMap,_c=new WeakMap,qn=new WeakSet,iy=function(t,n){return n.map((a,s)=>{const l=t[s];return a.defaultedQueryOptions.notifyOnChangeProps?l:a.observer.trackResult(l,c=>{n.forEach(d=>{d.observer.trackProp(c)})})})},sy=function(t,n,a){if(n){const s=B(this,Nc),l=a!==void 0&&s!==void 0&&(s.length!==a.length||a.some((c,d)=>c!==s[d]));return(!B(this,Ji)||B(this,Ir)!==B(this,Ec)||l||n!==B(this,Cc))&&(xe(this,Cc,n),xe(this,Ec,B(this,Ir)),a!==void 0&&xe(this,Nc,a),xe(this,Ji,rv(B(this,Ji),n(t)))),B(this,Ji)}return t},ly=function(t){const n=new Map;B(this,Jr).forEach(s=>{const l=s.options.queryHash;if(!l)return;const c=n.get(l);c?c.push(s):n.set(l,[s])});const a=[];return t.forEach(s=>{var m;const l=B(this,fo).defaultQueryOptions(s),d=((m=n.get(l.queryHash))==null?void 0:m.shift())??new sv(B(this,fo),l);a.push({defaultedQueryOptions:l,observer:d})}),a},oy=function(t,n){const a=B(this,Jr).indexOf(t);a!==-1&&(xe(this,Ir,cR(B(this,Ir),a,n)),He(this,qn,uy).call(this))},uy=function(){var t;if(this.hasListeners()){const n=B(this,Ji),a=He(this,qn,iy).call(this,B(this,Ir),B(this,_c)),s=He(this,qn,sy).call(this,a,(t=B(this,mo))==null?void 0:t.combine);n!==s&&sn.batch(()=>{this.listeners.forEach(l=>{l(B(this,Ir))})})}},pj),Ta,gj,fR=(gj=class extends Xs{constructor(t={}){super();Ne(this,Ta);this.config=t,xe(this,Ta,new Map)}build(t,n,a){const s=n.queryKey,l=n.queryHash??nv(s,n);let c=this.get(l);return c||(c=new rR({client:t,queryKey:s,queryHash:l,options:t.defaultQueryOptions(n),state:a,defaultOptions:t.getQueryDefaults(s)}),this.add(c)),c}add(t){B(this,Ta).has(t.queryHash)||(B(this,Ta).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=B(this,Ta).get(t.queryHash);n&&(t.destroy(),n===t&&B(this,Ta).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){sn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return B(this,Ta).get(t)}getAll(){return[...B(this,Ta).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(a=>CS(n,a))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(a=>CS(t,a)):n}notify(t){sn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){sn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){sn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ta=new WeakMap,gj),an,es,ts,po,go,ns,yo,vo,yj,hR=(yj=class{constructor(e={}){Ne(this,an);Ne(this,es);Ne(this,ts);Ne(this,po);Ne(this,go);Ne(this,ns);Ne(this,yo);Ne(this,vo);xe(this,an,e.queryCache||new fR),xe(this,es,e.mutationCache||new oR),xe(this,ts,e.defaultOptions||{}),xe(this,po,new Map),xe(this,go,new Map),xe(this,ns,0)}mount(){sf(this,ns)._++,B(this,ns)===1&&(xe(this,yo,tv.subscribe(async e=>{e&&(await this.resumePausedMutations(),B(this,an).onFocus())})),xe(this,vo,Pf.subscribe(async e=>{e&&(await this.resumePausedMutations(),B(this,an).onOnline())})))}unmount(){var e,t;sf(this,ns)._--,B(this,ns)===0&&((e=B(this,yo))==null||e.call(this),xe(this,yo,void 0),(t=B(this,vo))==null||t.call(this),xe(this,vo,void 0))}isFetching(e){return B(this,an).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return B(this,es).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=B(this,an).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=B(this,an).build(this,t),a=n.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(rs(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return B(this,an).findAll(e).map(({queryKey:t,state:n})=>{const a=n.data;return[t,a]})}setQueryData(e,t,n){const a=this.defaultQueryOptions({queryKey:e}),s=B(this,an).get(a.queryHash),l=s==null?void 0:s.state.data,c=V2(t,l);if(c!==void 0)return B(this,an).build(this,a).setData(c,{...n,manual:!0})}setQueriesData(e,t,n){return sn.batch(()=>B(this,an).findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=B(this,an).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=B(this,an);sn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=B(this,an);return sn.batch(()=>(n.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},a=sn.batch(()=>B(this,an).findAll(e).map(s=>s.cancel(n)));return Promise.all(a).then(Kn).catch(Kn)}invalidateQueries(e,t={}){return sn.batch(()=>(B(this,an).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},a=sn.batch(()=>B(this,an).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let l=s.fetch(void 0,n);return n.throwOnError||(l=l.catch(Kn)),s.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(a).then(Kn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=B(this,an).build(this,t);return n.isStaleByTime(rs(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Kn).catch(Kn)}fetchInfiniteQuery(e){return e.behavior=zS(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Kn).catch(Kn)}ensureInfiniteQueryData(e){return e.behavior=zS(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Pf.isOnline()?B(this,es).resumePausedMutations():Promise.resolve()}getQueryCache(){return B(this,an)}getMutationCache(){return B(this,es)}getDefaultOptions(){return B(this,ts)}setDefaultOptions(e){xe(this,ts,e)}setQueryDefaults(e,t){B(this,po).set(Vs(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...B(this,po).values()],n={};return t.forEach(a=>{nc(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){B(this,go).set(Vs(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...B(this,go).values()],n={};return t.forEach(a=>{nc(e,a.mutationKey)&&Object.assign(n,a.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...B(this,ts).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=nv(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===av&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...B(this,ts).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){B(this,an).clear(),B(this,es).clear()}},an=new WeakMap,es=new WeakMap,ts=new WeakMap,po=new WeakMap,go=new WeakMap,ns=new WeakMap,yo=new WeakMap,vo=new WeakMap,yj),_j=x.createContext(void 0),hn=e=>{const t=x.useContext(_j);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},mR=({client:e,children:t})=>(x.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),o.jsx(_j.Provider,{value:e,children:t})),Tj=x.createContext(!1),Aj=()=>x.useContext(Tj);Tj.Provider;function pR(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var gR=x.createContext(pR()),Rj=()=>x.useContext(gR),Oj=(e,t,n)=>{const a=n!=null&&n.state.error&&typeof e.throwOnError=="function"?iv(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(t.isReset()||(e.retryOnMount=!1))},zj=e=>{x.useEffect(()=>{e.clearReset()},[e])},Mj=({result:e,errorResetBoundary:t,throwOnError:n,query:a,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&a&&(s&&e.data===void 0||iv(n,[e.error,a])),Dj=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),a=e.staleTime;e.staleTime=typeof a=="function"?(...s)=>n(a(...s)):n(a),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},yR=(e,t)=>e.isLoading&&e.isFetching&&!t,cy=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,dy=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function vR({queries:e,...t},n){const a=hn(),s=Aj(),l=Rj(),c=x.useMemo(()=>e.map(j=>{const E=a.defaultQueryOptions(j);return E._optimisticResults=s?"isRestoring":"optimistic",E}),[e,a,s]);c.forEach(j=>{Dj(j);const E=a.getQueryCache().get(j.queryHash);Oj(j,l,E)}),zj(l);const[d]=x.useState(()=>new dR(a,c,t)),[m,h,g]=d.getOptimisticResult(c,t.combine),p=!s&&t.subscribed!==!1;x.useSyncExternalStore(x.useCallback(j=>p?d.subscribe(sn.batchCalls(j)):Kn,[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),x.useEffect(()=>{d.setQueries(c,t)},[c,t,d]);const w=m.some((j,E)=>cy(c[E],j))?m.flatMap((j,E)=>{const C=c[E];if(C&&cy(C,j)){const _=new sv(a,C);return dy(C,_,l)}return[]}):[];if(w.length>0)throw Promise.all(w);const S=m.find((j,E)=>{const C=c[E];return C&&Mj({result:j,errorResetBoundary:l,throwOnError:C.throwOnError,query:a.getQueryCache().get(C.queryHash),suspense:C.suspense})});if(S!=null&&S.error)throw S.error;return h(g())}function bR(e,t,n){var b,w,S,j;const a=Aj(),s=Rj(),l=hn(),c=l.defaultQueryOptions(e);(w=(b=l.getDefaultOptions().queries)==null?void 0:b._experimental_beforeQuery)==null||w.call(b,c);const d=l.getQueryCache().get(c.queryHash);c._optimisticResults=a?"isRestoring":"optimistic",Dj(c),Oj(c,s,d),zj(s);const m=!l.getQueryCache().get(c.queryHash),[h]=x.useState(()=>new t(l,c)),g=h.getOptimisticResult(c),p=!a&&e.subscribed!==!1;if(x.useSyncExternalStore(x.useCallback(E=>{const C=p?h.subscribe(sn.batchCalls(E)):Kn;return h.updateResult(),C},[h,p]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),x.useEffect(()=>{h.setOptions(c)},[c,h]),cy(c,g))throw dy(c,h,s);if(Mj({result:g,errorResetBoundary:s,throwOnError:c.throwOnError,query:d,suspense:c.suspense}))throw g.error;if((j=(S=l.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||j.call(S,c,g),c.experimental_prefetchInRender&&!ac.isServer()&&yR(g,a)){const E=m?dy(c,h,s):d==null?void 0:d.promise;E==null||E.catch(Kn).finally(()=>{h.updateResult()})}return c.notifyOnChangeProps?g:h.trackResult(g)}function Ke(e,t){return bR(e,sv)}function xt(e,t){const n=hn(),[a]=x.useState(()=>new uR(n,e));x.useEffect(()=>{a.setOptions(e)},[a,e]);const s=x.useSyncExternalStore(x.useCallback(c=>a.subscribe(sn.batchCalls(c)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),l=x.useCallback((c,d)=>{a.mutate(c,d).catch(Kn)},[a]);if(s.error&&iv(a.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:l,mutateAsync:s.mutate}}/**
|
|
50
|
+
* react-router v7.13.1
|
|
51
|
+
*
|
|
52
|
+
* Copyright (c) Remix Software Inc.
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the MIT license found in the
|
|
55
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
56
|
+
*
|
|
57
|
+
* @license MIT
|
|
58
|
+
*/var IS="popstate";function LS(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function xR(e={}){function t(a,s){var h;let l=(h=s.state)==null?void 0:h.masked,{pathname:c,search:d,hash:m}=l||a.location;return fy("",{pathname:c,search:d,hash:m},s.state&&s.state.usr||null,s.state&&s.state.key||"default",l?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function n(a,s){return typeof s=="string"?s:ic(s)}return SR(t,n,null,e)}function Gt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ra(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function wR(){return Math.random().toString(36).substring(2,10)}function PS(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function fy(e,t,n=null,a,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Co(t):t,state:n,key:t&&t.key||a||wR(),unstable_mask:s}}function ic({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Co(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function SR(e,t,n,a={}){let{window:s=document.defaultView,v5Compat:l=!1}=a,c=s.history,d="POP",m=null,h=g();h==null&&(h=0,c.replaceState({...c.state,idx:h},""));function g(){return(c.state||{idx:null}).idx}function p(){d="POP";let E=g(),C=E==null?null:E-h;h=E,m&&m({action:d,location:j.location,delta:C})}function b(E,C){d="PUSH";let _=LS(E)?E:fy(j.location,E,C);h=g()+1;let z=PS(_,h),M=j.createHref(_.unstable_mask||_);try{c.pushState(z,"",M)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;s.location.assign(M)}l&&m&&m({action:d,location:j.location,delta:1})}function w(E,C){d="REPLACE";let _=LS(E)?E:fy(j.location,E,C);h=g();let z=PS(_,h),M=j.createHref(_.unstable_mask||_);c.replaceState(z,"",M),l&&m&&m({action:d,location:j.location,delta:0})}function S(E){return kR(E)}let j={get action(){return d},get location(){return e(s,c)},listen(E){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener(IS,p),m=E,()=>{s.removeEventListener(IS,p),m=null}},createHref(E){return t(s,E)},createURL:S,encodeLocation(E){let C=S(E);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:b,replace:w,go(E){return c.go(E)}};return j}function kR(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Gt(n,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:ic(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=n+a),new URL(a,n)}function Ij(e,t,n="/"){return jR(e,t,n,!1)}function jR(e,t,n,a){let s=typeof t=="string"?Co(t):t,l=oi(s.pathname||"/",n);if(l==null)return null;let c=Lj(e);CR(c);let d=null;for(let m=0;d==null&&m<c.length;++m){let h=IR(l);d=MR(c[m],h,a)}return d}function Lj(e,t=[],n=[],a="",s=!1){let l=(c,d,m=s,h)=>{let g={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(a)&&m)return;Gt(g.relativePath.startsWith(a),`Absolute route path "${g.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(a.length)}let p=Ra([a,g.relativePath]),b=n.concat(g);c.children&&c.children.length>0&&(Gt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),Lj(c.children,t,b,p,m)),!(c.path==null&&!c.index)&&t.push({path:p,score:OR(p,c.index),routesMeta:b})};return e.forEach((c,d)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))l(c,d);else for(let h of Pj(c.path))l(c,d,!0,h)}),t}function Pj(e){let t=e.split("/");if(t.length===0)return[];let[n,...a]=t,s=n.endsWith("?"),l=n.replace(/\?$/,"");if(a.length===0)return s?[l,""]:[l];let c=Pj(a.join("/")),d=[];return d.push(...c.map(m=>m===""?l:[l,m].join("/"))),s&&d.push(...c),d.map(m=>e.startsWith("/")&&m===""?"/":m)}function CR(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:zR(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var ER=/^:[\w-]+$/,NR=3,_R=2,TR=1,AR=10,RR=-2,US=e=>e==="*";function OR(e,t){let n=e.split("/"),a=n.length;return n.some(US)&&(a+=RR),t&&(a+=_R),n.filter(s=>!US(s)).reduce((s,l)=>s+(ER.test(l)?NR:l===""?TR:AR),a)}function zR(e,t){return e.length===t.length&&e.slice(0,-1).every((a,s)=>a===t[s])?e[e.length-1]-t[t.length-1]:0}function MR(e,t,n=!1){let{routesMeta:a}=e,s={},l="/",c=[];for(let d=0;d<a.length;++d){let m=a[d],h=d===a.length-1,g=l==="/"?t:t.slice(l.length)||"/",p=Uf({path:m.relativePath,caseSensitive:m.caseSensitive,end:h},g),b=m.route;if(!p&&h&&n&&!a[a.length-1].route.index&&(p=Uf({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},g)),!p)return null;Object.assign(s,p.params),c.push({params:s,pathname:Ra([l,p.pathname]),pathnameBase:BR(Ra([l,p.pathnameBase])),route:b}),p.pathnameBase!=="/"&&(l=Ra([l,p.pathnameBase]))}return c}function Uf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=DR(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let l=s[0],c=l.replace(/(.)\/+$/,"$1"),d=s.slice(1);return{params:a.reduce((h,{paramName:g,isOptional:p},b)=>{if(g==="*"){let S=d[b]||"";c=l.slice(0,l.length-S.length).replace(/(.)\/+$/,"$1")}const w=d[b];return p&&!w?h[g]=void 0:h[g]=(w||"").replace(/%2F/g,"/"),h},{}),pathname:l,pathnameBase:c,pattern:e}}function DR(e,t=!1,n=!0){ra(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,m,h,g)=>{if(a.push({paramName:d,isOptional:m!=null}),m){let p=g.charAt(h+c.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),a]}function IR(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ra(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function oi(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,a=e.charAt(n);return a&&a!=="/"?null:e.slice(n)||"/"}var LR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function PR(e,t="/"){let{pathname:n,search:a="",hash:s=""}=typeof e=="string"?Co(e):e,l;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?l=BS(n.substring(1),"/"):l=BS(n,t)):l=t,{pathname:l,search:FR(a),hash:$R(s)}}function BS(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Qp(e,t,n,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function UR(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function ov(e){let t=UR(e);return t.map((n,a)=>a===t.length-1?n.pathname:n.pathnameBase)}function ih(e,t,n,a=!1){let s;typeof e=="string"?s=Co(e):(s={...e},Gt(!s.pathname||!s.pathname.includes("?"),Qp("?","pathname","search",s)),Gt(!s.pathname||!s.pathname.includes("#"),Qp("#","pathname","hash",s)),Gt(!s.search||!s.search.includes("#"),Qp("#","search","hash",s)));let l=e===""||s.pathname==="",c=l?"/":s.pathname,d;if(c==null)d=n;else{let p=t.length-1;if(!a&&c.startsWith("..")){let b=c.split("/");for(;b[0]==="..";)b.shift(),p-=1;s.pathname=b.join("/")}d=p>=0?t[p]:"/"}let m=PR(s,d),h=c&&c!=="/"&&c.endsWith("/"),g=(l||c===".")&&n.endsWith("/");return!m.pathname.endsWith("/")&&(h||g)&&(m.pathname+="/"),m}var Ra=e=>e.join("/").replace(/\/\/+/g,"/"),BR=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),FR=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,$R=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,HR=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 qR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function ZR(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Uj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Bj(e,t){let n=e;if(typeof n!="string"||!LR.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,s=!1;if(Uj)try{let l=new URL(window.location.href),c=n.startsWith("//")?new URL(l.protocol+n):new URL(n),d=oi(c.pathname,t);c.origin===l.origin&&d!=null?n=d+c.search+c.hash:s=!0}catch{ra(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Fj=["POST","PUT","PATCH","DELETE"];new Set(Fj);var GR=["GET",...Fj];new Set(GR);var Eo=x.createContext(null);Eo.displayName="DataRouter";var sh=x.createContext(null);sh.displayName="DataRouterState";var VR=x.createContext(!1),$j=x.createContext({isTransitioning:!1});$j.displayName="ViewTransition";var QR=x.createContext(new Map);QR.displayName="Fetchers";var KR=x.createContext(null);KR.displayName="Await";var Ur=x.createContext(null);Ur.displayName="Navigation";var Tc=x.createContext(null);Tc.displayName="Location";var ia=x.createContext({outlet:null,matches:[],isDataRoute:!1});ia.displayName="Route";var uv=x.createContext(null);uv.displayName="RouteError";var Hj="REACT_ROUTER_ERROR",YR="REDIRECT",XR="ROUTE_ERROR_RESPONSE";function WR(e){if(e.startsWith(`${Hj}:${YR}:{`))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 JR(e){if(e.startsWith(`${Hj}:${XR}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new HR(t.status,t.statusText,t.data)}catch{}}function eO(e,{relative:t}={}){Gt(No(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=x.useContext(Ur),{hash:s,pathname:l,search:c}=Ac(e,{relative:t}),d=l;return n!=="/"&&(d=l==="/"?n:Ra([n,l])),a.createHref({pathname:d,search:c,hash:s})}function No(){return x.useContext(Tc)!=null}function Sr(){return Gt(No(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(Tc).location}var qj="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Zj(e){x.useContext(Ur).static||x.useLayoutEffect(e)}function Rn(){let{isDataRoute:e}=x.useContext(ia);return e?pO():tO()}function tO(){Gt(No(),"useNavigate() may be used only in the context of a <Router> component.");let e=x.useContext(Eo),{basename:t,navigator:n}=x.useContext(Ur),{matches:a}=x.useContext(ia),{pathname:s}=Sr(),l=JSON.stringify(ov(a)),c=x.useRef(!1);return Zj(()=>{c.current=!0}),x.useCallback((m,h={})=>{if(ra(c.current,qj),!c.current)return;if(typeof m=="number"){n.go(m);return}let g=ih(m,JSON.parse(l),s,h.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Ra([t,g.pathname])),(h.replace?n.replace:n.push)(g,h.state,h)},[t,n,l,s,e])}var nO=x.createContext(null);function rO(e){let t=x.useContext(ia).outlet;return x.useMemo(()=>t&&x.createElement(nO.Provider,{value:e},t),[t,e])}function Gj(){let{matches:e}=x.useContext(ia),t=e[e.length-1];return t?t.params:{}}function Ac(e,{relative:t}={}){let{matches:n}=x.useContext(ia),{pathname:a}=Sr(),s=JSON.stringify(ov(n));return x.useMemo(()=>ih(e,JSON.parse(s),a,t==="path"),[e,s,a,t])}function aO(e,t){return Vj(e,t)}function Vj(e,t,n){var E;Gt(No(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=x.useContext(Ur),{matches:s}=x.useContext(ia),l=s[s.length-1],c=l?l.params:{},d=l?l.pathname:"/",m=l?l.pathnameBase:"/",h=l&&l.route;{let C=h&&h.path||"";Kj(d,!h||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
59
|
+
|
|
60
|
+
Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let g=Sr(),p;if(t){let C=typeof t=="string"?Co(t):t;Gt(m==="/"||((E=C.pathname)==null?void 0:E.startsWith(m)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${C.pathname}" was given in the \`location\` prop.`),p=C}else p=g;let b=p.pathname||"/",w=b;if(m!=="/"){let C=m.replace(/^\//,"").split("/");w="/"+b.replace(/^\//,"").split("/").slice(C.length).join("/")}let S=Ij(e,{pathname:w});ra(h||S!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),ra(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=uO(S&&S.map(C=>Object.assign({},C,{params:Object.assign({},c,C.params),pathname:Ra([m,a.encodeLocation?a.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?m:Ra([m,a.encodeLocation?a.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),s,n);return t&&j?x.createElement(Tc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...p},navigationType:"POP"}},j):j}function iO(){let e=mO(),t=qR(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:a},l={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:l},"ErrorBoundary")," or"," ",x.createElement("code",{style:l},"errorElement")," prop on your route.")),x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),n?x.createElement("pre",{style:s},n):null,c)}var sO=x.createElement(iO,null),Qj=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=JR(e.digest);n&&(e=n)}let t=e!==void 0?x.createElement(ia.Provider,{value:this.props.routeContext},x.createElement(uv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?x.createElement(lO,{error:e},t):t}};Qj.contextType=VR;var Kp=new WeakMap;function lO({children:e,error:t}){let{basename:n}=x.useContext(Ur);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=WR(t.digest);if(a){let s=Kp.get(t);if(s)throw s;let l=Bj(a.location,n);if(Uj&&!Kp.get(t))if(l.isExternal||a.reloadDocument)window.location.href=l.absoluteURL||l.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:a.replace}));throw Kp.set(t,c),c}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function oO({routeContext:e,match:t,children:n}){let a=x.useContext(Eo);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),x.createElement(ia.Provider,{value:e},n)}function uO(e,t=[],n){let a=n==null?void 0:n.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let s=e,l=a==null?void 0:a.errors;if(l!=null){let g=s.findIndex(p=>p.route.id&&(l==null?void 0:l[p.route.id])!==void 0);Gt(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),s=s.slice(0,Math.min(s.length,g+1))}let c=!1,d=-1;if(n&&a){c=a.renderFallback;for(let g=0;g<s.length;g++){let p=s[g];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=g),p.route.id){let{loaderData:b,errors:w}=a,S=p.route.loader&&!b.hasOwnProperty(p.route.id)&&(!w||w[p.route.id]===void 0);if(p.route.lazy||S){n.isStatic&&(c=!0),d>=0?s=s.slice(0,d+1):s=[s[0]];break}}}}let m=n==null?void 0:n.onError,h=a&&m?(g,p)=>{var b,w;m(g,{location:a.location,params:((w=(b=a.matches)==null?void 0:b[0])==null?void 0:w.params)??{},unstable_pattern:ZR(a.matches),errorInfo:p})}:void 0;return s.reduceRight((g,p,b)=>{let w,S=!1,j=null,E=null;a&&(w=l&&p.route.id?l[p.route.id]:void 0,j=p.route.errorElement||sO,c&&(d<0&&b===0?(Kj("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,E=null):d===b&&(S=!0,E=p.route.hydrateFallbackElement||null)));let C=t.concat(s.slice(0,b+1)),_=()=>{let z;return w?z=j:S?z=E:p.route.Component?z=x.createElement(p.route.Component,null):p.route.element?z=p.route.element:z=g,x.createElement(oO,{match:p,routeContext:{outlet:g,matches:C,isDataRoute:a!=null},children:z})};return a&&(p.route.ErrorBoundary||p.route.errorElement||b===0)?x.createElement(Qj,{location:a.location,revalidation:a.revalidation,component:j,error:w,children:_(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:h}):_()},null)}function cv(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function cO(e){let t=x.useContext(Eo);return Gt(t,cv(e)),t}function dO(e){let t=x.useContext(sh);return Gt(t,cv(e)),t}function fO(e){let t=x.useContext(ia);return Gt(t,cv(e)),t}function dv(e){let t=fO(e),n=t.matches[t.matches.length-1];return Gt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function hO(){return dv("useRouteId")}function mO(){var a;let e=x.useContext(uv),t=dO("useRouteError"),n=dv("useRouteError");return e!==void 0?e:(a=t.errors)==null?void 0:a[n]}function pO(){let{router:e}=cO("useNavigate"),t=dv("useNavigate"),n=x.useRef(!1);return Zj(()=>{n.current=!0}),x.useCallback(async(s,l={})=>{ra(n.current,qj),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...l}))},[e,t])}var FS={};function Kj(e,t,n){!t&&!FS[e]&&(FS[e]=!0,ra(!1,n))}x.memo(gO);function gO({routes:e,future:t,state:n,isStatic:a,onError:s}){return Vj(e,void 0,{state:n,isStatic:a,onError:s})}function lr({to:e,replace:t,state:n,relative:a}){Gt(No(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=x.useContext(Ur);ra(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:l}=x.useContext(ia),{pathname:c}=Sr(),d=Rn(),m=ih(e,ov(l),c,a==="path"),h=JSON.stringify(m);return x.useEffect(()=>{d(JSON.parse(h),{replace:t,state:n,relative:a})},[d,h,a,t,n]),null}function Bf(e){return rO(e.context)}function Mt(e){Gt(!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 yO({basename:e="/",children:t=null,location:n,navigationType:a="POP",navigator:s,static:l=!1,unstable_useTransitions:c}){Gt(!No(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),m=x.useMemo(()=>({basename:d,navigator:s,static:l,unstable_useTransitions:c,future:{}}),[d,s,l,c]);typeof n=="string"&&(n=Co(n));let{pathname:h="/",search:g="",hash:p="",state:b=null,key:w="default",unstable_mask:S}=n,j=x.useMemo(()=>{let E=oi(h,d);return E==null?null:{location:{pathname:E,search:g,hash:p,state:b,key:w,unstable_mask:S},navigationType:a}},[d,h,g,p,b,w,a,S]);return ra(j!=null,`<Router basename="${d}"> is not able to match the URL "${h}${g}${p}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:x.createElement(Ur.Provider,{value:m},x.createElement(Tc.Provider,{children:t,value:j}))}function vO({children:e,location:t}){return aO(hy(e),t)}function hy(e,t=[]){let n=[];return x.Children.forEach(e,(a,s)=>{if(!x.isValidElement(a))return;let l=[...t,s];if(a.type===x.Fragment){n.push.apply(n,hy(a.props.children,l));return}Gt(a.type===Mt,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Gt(!a.props.index||!a.props.children,"An index route cannot have child routes.");let c={id:a.props.id||l.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(c.children=hy(a.props.children,l)),n.push(c)}),n}var Af="get",Rf="application/x-www-form-urlencoded";function lh(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function bO(e){return lh(e)&&e.tagName.toLowerCase()==="button"}function xO(e){return lh(e)&&e.tagName.toLowerCase()==="form"}function wO(e){return lh(e)&&e.tagName.toLowerCase()==="input"}function SO(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function kO(e,t){return e.button===0&&(!t||t==="_self")&&!SO(e)}function my(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let a=e[n];return t.concat(Array.isArray(a)?a.map(s=>[n,s]):[[n,a]])},[]))}function jO(e,t){let n=my(e);return t&&t.forEach((a,s)=>{n.has(s)||t.getAll(s).forEach(l=>{n.append(s,l)})}),n}var of=null;function CO(){if(of===null)try{new FormData(document.createElement("form"),0),of=!1}catch{of=!0}return of}var EO=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Yp(e){return e!=null&&!EO.has(e)?(ra(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Rf}"`),null):e}function NO(e,t){let n,a,s,l,c;if(xO(e)){let d=e.getAttribute("action");a=d?oi(d,t):null,n=e.getAttribute("method")||Af,s=Yp(e.getAttribute("enctype"))||Rf,l=new FormData(e)}else if(bO(e)||wO(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||d.getAttribute("action");if(a=m?oi(m,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||Af,s=Yp(e.getAttribute("formenctype"))||Yp(d.getAttribute("enctype"))||Rf,l=new FormData(d,e),!CO()){let{name:h,type:g,value:p}=e;if(g==="image"){let b=h?`${h}.`:"";l.append(`${b}x`,"0"),l.append(`${b}y`,"0")}else h&&l.append(h,p)}}else{if(lh(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Af,a=null,s=Rf,c=e}return l&&s==="text/plain"&&(c=l,l=void 0),{action:a,method:n.toLowerCase(),encType:s,formData:l,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function fv(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function _O(e,t,n,a){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${a}`:s.pathname=`${s.pathname}.${a}`:s.pathname==="/"?s.pathname=`_root.${a}`:t&&oi(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${a}`,s}async function TO(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 AO(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 RO(e,t,n){let a=await Promise.all(e.map(async s=>{let l=t.routes[s.route.id];if(l){let c=await TO(l,n);return c.links?c.links():[]}return[]}));return DO(a.flat(1).filter(AO).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function $S(e,t,n,a,s,l){let c=(m,h)=>n[h]?m.route.id!==n[h].route.id:!0,d=(m,h)=>{var g;return n[h].pathname!==m.pathname||((g=n[h].route.path)==null?void 0:g.endsWith("*"))&&n[h].params["*"]!==m.params["*"]};return l==="assets"?t.filter((m,h)=>c(m,h)||d(m,h)):l==="data"?t.filter((m,h)=>{var p;let g=a.routes[m.route.id];if(!g||!g.hasLoader)return!1;if(c(m,h)||d(m,h))return!0;if(m.route.shouldRevalidate){let b=m.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((p=n[0])==null?void 0:p.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function OO(e,t,{includeHydrateFallback:n}={}){return zO(e.map(a=>{let s=t.routes[a.route.id];if(!s)return[];let l=[s.module];return s.clientActionModule&&(l=l.concat(s.clientActionModule)),s.clientLoaderModule&&(l=l.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(l=l.concat(s.hydrateFallbackModule)),s.imports&&(l=l.concat(s.imports)),l}).flat(1))}function zO(e){return[...new Set(e)]}function MO(e){let t={},n=Object.keys(e).sort();for(let a of n)t[a]=e[a];return t}function DO(e,t){let n=new Set;return new Set(t),e.reduce((a,s)=>{let l=JSON.stringify(MO(s));return n.has(l)||(n.add(l),a.push({key:l,link:s})),a},[])}function Yj(){let e=x.useContext(Eo);return fv(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function IO(){let e=x.useContext(sh);return fv(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var hv=x.createContext(void 0);hv.displayName="FrameworkContext";function Xj(){let e=x.useContext(hv);return fv(e,"You must render this element inside a <HydratedRouter> element"),e}function LO(e,t){let n=x.useContext(hv),[a,s]=x.useState(!1),[l,c]=x.useState(!1),{onFocus:d,onBlur:m,onMouseEnter:h,onMouseLeave:g,onTouchStart:p}=t,b=x.useRef(null);x.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=C=>{C.forEach(_=>{c(_.isIntersecting)})},E=new IntersectionObserver(j,{threshold:.5});return b.current&&E.observe(b.current),()=>{E.disconnect()}}},[e]),x.useEffect(()=>{if(a){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[a]);let w=()=>{s(!0)},S=()=>{s(!1),c(!1)};return n?e!=="intent"?[l,b,{}]:[l,b,{onFocus:Au(d,w),onBlur:Au(m,S),onMouseEnter:Au(h,w),onMouseLeave:Au(g,S),onTouchStart:Au(p,w)}]:[!1,b,{}]}function Au(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function PO({page:e,...t}){let{router:n}=Yj(),a=x.useMemo(()=>Ij(n.routes,e,n.basename),[n.routes,e,n.basename]);return a?x.createElement(BO,{page:e,matches:a,...t}):null}function UO(e){let{manifest:t,routeModules:n}=Xj(),[a,s]=x.useState([]);return x.useEffect(()=>{let l=!1;return RO(e,t,n).then(c=>{l||s(c)}),()=>{l=!0}},[e,t,n]),a}function BO({page:e,matches:t,...n}){let a=Sr(),{future:s,manifest:l,routeModules:c}=Xj(),{basename:d}=Yj(),{loaderData:m,matches:h}=IO(),g=x.useMemo(()=>$S(e,t,h,l,a,"data"),[e,t,h,l,a]),p=x.useMemo(()=>$S(e,t,h,l,a,"assets"),[e,t,h,l,a]),b=x.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let j=new Set,E=!1;if(t.forEach(_=>{var M;let z=l.routes[_.route.id];!z||!z.hasLoader||(!g.some(L=>L.route.id===_.route.id)&&_.route.id in m&&((M=c[_.route.id])!=null&&M.shouldRevalidate)||z.hasClientLoader?E=!0:j.add(_.route.id))}),j.size===0)return[];let C=_O(e,d,s.unstable_trailingSlashAwareDataRequests,"data");return E&&j.size>0&&C.searchParams.set("_routes",t.filter(_=>j.has(_.route.id)).map(_=>_.route.id).join(",")),[C.pathname+C.search]},[d,s.unstable_trailingSlashAwareDataRequests,m,a,l,g,t,e,c]),w=x.useMemo(()=>OO(p,l),[p,l]),S=UO(p);return x.createElement(x.Fragment,null,b.map(j=>x.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),w.map(j=>x.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),S.map(({key:j,link:E})=>x.createElement("link",{key:j,nonce:n.nonce,...E,crossOrigin:E.crossOrigin??n.crossOrigin})))}function FO(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var $O=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{$O&&(window.__reactRouterVersion="7.13.1")}catch{}function HO({basename:e,children:t,unstable_useTransitions:n,window:a}){let s=x.useRef();s.current==null&&(s.current=xR({window:a,v5Compat:!0}));let l=s.current,[c,d]=x.useState({action:l.action,location:l.location}),m=x.useCallback(h=>{n===!1?d(h):x.startTransition(()=>d(h))},[n]);return x.useLayoutEffect(()=>l.listen(m),[l,m]),x.createElement(yO,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:l,unstable_useTransitions:n})}var Wj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Rc=x.forwardRef(function({onClick:t,discover:n="render",prefetch:a="none",relative:s,reloadDocument:l,replace:c,unstable_mask:d,state:m,target:h,to:g,preventScrollReset:p,viewTransition:b,unstable_defaultShouldRevalidate:w,...S},j){let{basename:E,navigator:C,unstable_useTransitions:_}=x.useContext(Ur),z=typeof g=="string"&&Wj.test(g),M=Bj(g,E);g=M.to;let L=eO(g,{relative:s}),O=Sr(),F=null;if(d){let W=ih(d,[],O.unstable_mask?O.unstable_mask.pathname:"/",!0);E!=="/"&&(W.pathname=W.pathname==="/"?E:Ra([E,W.pathname])),F=C.createHref(W)}let[P,V,I]=LO(a,S),Q=GO(g,{replace:c,unstable_mask:d,state:m,target:h,preventScrollReset:p,relative:s,viewTransition:b,unstable_defaultShouldRevalidate:w,unstable_useTransitions:_});function ie(W){t&&t(W),W.defaultPrevented||Q(W)}let be=!(M.isExternal||l),X=x.createElement("a",{...S,...I,href:(be?F:void 0)||M.absoluteURL||L,onClick:be?ie:t,ref:FO(j,V),target:h,"data-discover":!z&&n==="render"?"true":void 0});return P&&!z?x.createElement(x.Fragment,null,X,x.createElement(PO,{page:L})):X});Rc.displayName="Link";var mv=x.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:s=!1,style:l,to:c,viewTransition:d,children:m,...h},g){let p=Ac(c,{relative:h.relative}),b=Sr(),w=x.useContext(sh),{navigator:S,basename:j}=x.useContext(Ur),E=w!=null&&XO(p)&&d===!0,C=S.encodeLocation?S.encodeLocation(p).pathname:p.pathname,_=b.pathname,z=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;n||(_=_.toLowerCase(),z=z?z.toLowerCase():null,C=C.toLowerCase()),z&&j&&(z=oi(z,j)||z);const M=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let L=_===C||!s&&_.startsWith(C)&&_.charAt(M)==="/",O=z!=null&&(z===C||!s&&z.startsWith(C)&&z.charAt(C.length)==="/"),F={isActive:L,isPending:O,isTransitioning:E},P=L?t:void 0,V;typeof a=="function"?V=a(F):V=[a,L?"active":null,O?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let I=typeof l=="function"?l(F):l;return x.createElement(Rc,{...h,"aria-current":P,className:V,ref:g,style:I,to:c,viewTransition:d},typeof m=="function"?m(F):m)});mv.displayName="NavLink";var qO=x.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:s,state:l,method:c=Af,action:d,onSubmit:m,relative:h,preventScrollReset:g,viewTransition:p,unstable_defaultShouldRevalidate:b,...w},S)=>{let{unstable_useTransitions:j}=x.useContext(Ur),E=KO(),C=YO(d,{relative:h}),_=c.toLowerCase()==="get"?"get":"post",z=typeof d=="string"&&Wj.test(d),M=L=>{if(m&&m(L),L.defaultPrevented)return;L.preventDefault();let O=L.nativeEvent.submitter,F=(O==null?void 0:O.getAttribute("formmethod"))||c,P=()=>E(O||L.currentTarget,{fetcherKey:t,method:F,navigate:n,replace:s,state:l,relative:h,preventScrollReset:g,viewTransition:p,unstable_defaultShouldRevalidate:b});j&&n!==!1?x.startTransition(()=>P()):P()};return x.createElement("form",{ref:S,method:_,action:C,onSubmit:a?m:M,...w,"data-discover":!z&&e==="render"?"true":void 0})});qO.displayName="Form";function ZO(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Jj(e){let t=x.useContext(Eo);return Gt(t,ZO(e)),t}function GO(e,{target:t,replace:n,unstable_mask:a,state:s,preventScrollReset:l,relative:c,viewTransition:d,unstable_defaultShouldRevalidate:m,unstable_useTransitions:h}={}){let g=Rn(),p=Sr(),b=Ac(e,{relative:c});return x.useCallback(w=>{if(kO(w,t)){w.preventDefault();let S=n!==void 0?n:ic(p)===ic(b),j=()=>g(e,{replace:S,unstable_mask:a,state:s,preventScrollReset:l,relative:c,viewTransition:d,unstable_defaultShouldRevalidate:m});h?x.startTransition(()=>j()):j()}},[p,g,b,n,a,s,t,e,l,c,d,m,h])}function oh(e){ra(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=x.useRef(my(e)),n=x.useRef(!1),a=Sr(),s=x.useMemo(()=>jO(a.search,n.current?null:t.current),[a.search]),l=Rn(),c=x.useCallback((d,m)=>{const h=my(typeof d=="function"?d(new URLSearchParams(s)):d);n.current=!0,l("?"+h,m)},[l,s]);return[s,c]}var VO=0,QO=()=>`__${String(++VO)}__`;function KO(){let{router:e}=Jj("useSubmit"),{basename:t}=x.useContext(Ur),n=hO(),a=e.fetch,s=e.navigate;return x.useCallback(async(l,c={})=>{let{action:d,method:m,encType:h,formData:g,body:p}=NO(l,t);if(c.navigate===!1){let b=c.fetcherKey||QO();await a(b,n,c.action||d,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:g,body:p,formMethod:c.method||m,formEncType:c.encType||h,flushSync:c.flushSync})}else await s(c.action||d,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:g,body:p,formMethod:c.method||m,formEncType:c.encType||h,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[a,s,t,n])}function YO(e,{relative:t}={}){let{basename:n}=x.useContext(Ur),a=x.useContext(ia);Gt(a,"useFormAction must be used inside a RouteContext");let[s]=a.matches.slice(-1),l={...Ac(e||".",{relative:t})},c=Sr();if(e==null){l.search=c.search;let d=new URLSearchParams(l.search),m=d.getAll("index");if(m.some(g=>g==="")){d.delete("index"),m.filter(p=>p).forEach(p=>d.append("index",p));let g=d.toString();l.search=g?`?${g}`:""}}return(!e||e===".")&&s.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(l.pathname=l.pathname==="/"?n:Ra([n,l.pathname])),ic(l)}function XO(e,{relative:t}={}){let n=x.useContext($j);Gt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Jj("useViewTransitionState"),s=Ac(e,{relative:t});if(!n.isTransitioning)return!1;let l=oi(n.currentLocation.pathname,a)||n.currentLocation.pathname,c=oi(n.nextLocation.pathname,a)||n.nextLocation.pathname;return Uf(s.pathname,c)!=null||Uf(s.pathname,l)!=null}const WO="/api/v1";async function JO(e,t){const n=await fetch(`${WO}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t})});if(!n.ok){const a=await n.text();let s;try{s=JSON.parse(a).error??a}catch{s=a}throw new Error(s)}return await n.json()}const eC="/api/v1",pv="first-tree-hub:tokens";let py=null;function Ru(e){py=e}function On(e){if(!py)throw new Error(`withOrg("${e}") called before an organization is selected`);return`/orgs/${encodeURIComponent(py)}${e}`}function gy(e,t){return`/orgs/${encodeURIComponent(e)}${t}`}function uh(){const e=localStorage.getItem(pv);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function yy(e){localStorage.setItem(pv,JSON.stringify(e))}function tC(){localStorage.removeItem(pv)}class Oc extends Error{constructor(t,n,a){super(n),this.status=t,this.issues=a,this.name="ApiError"}}let Ou=null;async function ez(){const e=uh();return e!=null&&e.refreshToken?nC(e.refreshToken):null}async function nC(e){return Ou||(Ou=(async()=>{try{const t=await fetch(`${eC}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e})});if(!t.ok)return null;const n=await t.json(),a={accessToken:n.accessToken,refreshToken:n.refreshToken??e};return yy(a),a}catch{return null}finally{Ou=null}})(),Ou)}async function zu(e,t){const{method:n="GET",body:a}=t??{},s=d=>{const m={};return d&&(m.Authorization=`Bearer ${d}`),a!==void 0&&(m["Content-Type"]="application/json"),fetch(`${eC}${e}`,{method:n,headers:m,body:a!==void 0?JSON.stringify(a):void 0})},l=uh();let c=await s(l==null?void 0:l.accessToken);if(c.status===401&&(l!=null&&l.refreshToken)){const d=await nC(l.refreshToken);d&&(c=await s(d.accessToken))}if(!c.ok){c.status===401&&(tC(),window.dispatchEvent(new CustomEvent("auth:logout")));const d=await c.text();let m,h;try{const g=JSON.parse(d);m=g.error??d,Array.isArray(g.details)&&(h=g.details.filter(p=>typeof p=="object"&&p!==null&&Array.isArray(p.path)))}catch{m=d}throw new Oc(c.status,m,h)}if(c.status!==204)return await c.json()}const Ce={get:e=>zu(e),post:(e,t)=>zu(e,{method:"POST",body:t}),patch:(e,t)=>zu(e,{method:"PATCH",body:t}),put:(e,t)=>zu(e,{method:"PUT",body:t}),delete:e=>zu(e,{method:"DELETE"})},gv="onboarding:joinPath",tz="onboarding:draft",vy="onboarding:step1Confirmed";function rC(){return typeof window>"u"?!1:window.sessionStorage.getItem(vy)==="1"}function nz(e){typeof window>"u"||(e?window.sessionStorage.setItem(vy,"1"):window.sessionStorage.removeItem(vy))}const by="onboarding:agentUuid";function rz(){return typeof window>"u"?null:window.sessionStorage.getItem(by)}function az(e){typeof window>"u"||(e?window.sessionStorage.setItem(by,e):window.sessionStorage.removeItem(by))}function aC(e){typeof window>"u"||window.sessionStorage.setItem(gv,e)}function iC(){if(typeof window>"u")return null;const e=window.sessionStorage.getItem(gv);return e==="solo"||e==="invite"?e:null}function iz(){typeof window>"u"||window.sessionStorage.removeItem(gv)}function sz(e,t){return`${e??"unknown-org"}:${t??"unknown-member"}`}function yv(e){return`${tz}:${e}`}function lz(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 oz(e){if(typeof window>"u")return null;const t=window.sessionStorage.getItem(yv(e));if(!t)return null;try{return lz(JSON.parse(t))}catch{return null}}function uz(e,t){typeof window>"u"||window.sessionStorage.setItem(yv(e),JSON.stringify(t))}function cz(e){typeof window>"u"||window.sessionStorage.removeItem(yv(e))}function dz(){if(typeof window>"u")return;const e=window.sessionStorage,t=[];for(let n=0;n<e.length;n++){const a=e.key(n);a!=null&&a.startsWith("onboarding:")&&t.push(a)}for(const n of t)e.removeItem(n)}const sC=x.createContext(null),xy="first-tree-hub:selectedOrganizationId";function fz(){try{return localStorage.getItem(xy)}catch{return null}}function Xp(e){try{e===null?localStorage.removeItem(xy):localStorage.setItem(xy,e)}catch{}}function hz({children:e}){const t=hn(),[n,a]=x.useState(()=>!!uh()),[s,l]=x.useState(null),[c,d]=x.useState([]),[m,h]=x.useState(()=>{const V=fz();return Ru(V),V}),[g,p]=x.useState(null),[b,w]=x.useState(null),[S,j]=x.useState(!1),E=x.useCallback(()=>{tC(),Xp(null),Ru(null),t.clear(),dz(),a(!1),l(null),d([]),h(null),p(null),w(null),j(!1)},[t]),C=x.useCallback(async()=>{var V,I;try{const Q=await Ce.get("/me");l(Q.user??null);const ie=Q.memberships??[];d(ie);const be=((V=Q.onboarding)==null?void 0:V.step)??null;p(be),w(((I=Q.onboarding)==null?void 0:I.dismissedAt)??null),be==="completed"&&iz(),h(X=>{var ne;const W=X&&ie.some(we=>we.organizationId===X)?X:null;if(W)return Ru(W),W;const q=Q.defaultOrganizationId??((ne=ie[0])==null?void 0:ne.organizationId)??null;return Xp(q),Ru(q),q})}catch{}finally{j(!0)}},[]),_=x.useCallback(async(V,I)=>{const Q=await JO(V,I);yy({accessToken:Q.accessToken,refreshToken:Q.refreshToken}),a(!0),await C()},[C]),z=x.useCallback(async V=>{yy(V),a(!0),await C()},[C]),M=x.useCallback(async V=>{Xp(V),Ru(V),t.clear(),h(V),await C()},[C,t]),L=x.useRef(null);x.useEffect(()=>{L.current=b},[b]);const O=x.useCallback(async()=>{const V=L.current;w(new Date().toISOString());try{const I=await Ce.patch("/me/onboarding",{dismissed:!0});I!=null&&I.dismissedAt&&w(I.dismissedAt)}catch{w(V)}},[]),F=x.useCallback(async()=>{const V=L.current;w(null);try{await Ce.patch("/me/onboarding",{dismissed:!1})}catch{w(V)}},[]);x.useEffect(()=>{n&&!s&&C()},[n,s,C]),x.useEffect(()=>{const V=()=>E();return window.addEventListener("auth:logout",V),()=>window.removeEventListener("auth:logout",V)},[E]);const P=x.useMemo(()=>c.length===0?null:c.find(I=>I.organizationId===m)??c[0]??null,[c,m]);return o.jsx(sC.Provider,{value:{isAuthenticated:n,meLoaded:S,user:s,memberships:c,currentMembership:P,organizationId:(P==null?void 0:P.organizationId)??null,memberId:(P==null?void 0:P.id)??null,role:(P==null?void 0:P.role)??null,agentId:(P==null?void 0:P.agentId)??null,onboardingStep:g,onboardingDismissedAt:b,dismissOnboarding:O,restoreOnboarding:F,login:_,adoptTokens:z,selectOrganization:M,refreshMe:C,logout:E},children:e})}function pt(){const e=x.useContext(sC);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const mz="modulepreload",pz=function(e){return"/"+e},HS={},gz=function(t,n,a){let s=Promise.resolve();if(n&&n.length>0){let c=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),m=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));s=c(n.map(h=>{if(h=pz(h),h in HS)return;HS[h]=!0;const g=h.endsWith(".css"),p=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":mz,g||(b.as="script"),b.crossOrigin="",b.href=h,m&&b.setAttribute("nonce",m),document.head.appendChild(b),g)return new Promise((w,S)=>{b.addEventListener("load",w),b.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function l(c){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=c,window.dispatchEvent(d),!d.defaultPrevented)throw c}return s.then(c=>{for(const d of c||[])d.status==="rejected"&&l(d.reason);return t().catch(l)})},yz=x.lazy(()=>gz(()=>import("./index-DcMORzyx.js"),[]).then(e=>({default:e.LandingPage}))),qS=()=>o.jsx("div",{className:"landing-marketing min-h-screen bg-background"});function vz(){const{isAuthenticated:e,meLoaded:t}=pt(),n=Sr();return e?t?o.jsx(Bf,{}):o.jsx(qS,{}):n.pathname==="/"?o.jsx(x.Suspense,{fallback:o.jsx(qS,{}),children:o.jsx(yz,{})}):o.jsx(lr,{to:"/login",replace:!0,state:{from:n}})}/**
|
|
61
|
+
* @license lucide-react v0.577.0 - ISC
|
|
62
|
+
*
|
|
63
|
+
* This source code is licensed under the ISC license.
|
|
64
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
65
|
+
*/const lC=(...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 bz=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 xz=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 ZS=e=>{const t=xz(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 wz={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 Sz=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 kz=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:s="",children:l,iconNode:c,...d},m)=>x.createElement("svg",{ref:m,...wz,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:lC("lucide",s),...!l&&!Sz(d)&&{"aria-hidden":"true"},...d},[...c.map(([h,g])=>x.createElement(h,g)),...Array.isArray(l)?l:[l]]));/**
|
|
96
|
+
* @license lucide-react v0.577.0 - ISC
|
|
97
|
+
*
|
|
98
|
+
* This source code is licensed under the ISC license.
|
|
99
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
+
*/const lt=(e,t)=>{const n=x.forwardRef(({className:a,...s},l)=>x.createElement(kz,{ref:l,iconNode:t,className:lC(`lucide-${bz(ZS(e))}`,`lucide-${e}`,a),...s}));return n.displayName=ZS(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 jz=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],vv=lt("arrow-left",jz);/**
|
|
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 Cz=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],oC=lt("arrow-right",Cz);/**
|
|
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 Ez=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],uC=lt("arrow-up",Ez);/**
|
|
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 Nz=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],_z=lt("at-sign",Nz);/**
|
|
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 Tz=[["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"}]],Az=lt("bell",Tz);/**
|
|
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 Rz=[["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"}]],cC=lt("bot",Rz);/**
|
|
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 Oz=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ur=lt("check",Oz);/**
|
|
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 zz=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],bv=lt("chevron-down",zz);/**
|
|
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 Mz=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Dz=lt("chevron-right",Mz);/**
|
|
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 Iz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Lz=lt("circle-check",Iz);/**
|
|
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 Pz=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],ch=lt("copy",Pz);/**
|
|
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 Uz=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Bz=lt("ellipsis",Uz);/**
|
|
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 Fz=[["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"}]],$z=lt("eye-off",Fz);/**
|
|
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 Hz=[["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"}]],dC=lt("eye",Hz);/**
|
|
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 qz=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],Zz=lt("folder-tree",qz);/**
|
|
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 Gz=[["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"}]],fC=lt("github",Gz);/**
|
|
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 Vz=[["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"}]],Qz=lt("layout-dashboard",Vz);/**
|
|
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 Kz=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],wy=lt("link-2",Kz);/**
|
|
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 Yz=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],hC=lt("loader-circle",Yz);/**
|
|
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 Xz=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],xv=lt("lock",Xz);/**
|
|
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 Wz=[["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"}]],Jz=lt("log-out",Wz);/**
|
|
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 eM=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],wv=lt("message-square",eM);/**
|
|
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 tM=[["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"}]],nM=lt("moon",tM);/**
|
|
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 rM=[["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"}]],aM=lt("paperclip",rM);/**
|
|
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 iM=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Sv=lt("pencil",iM);/**
|
|
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 sM=[["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"}]],mC=lt("play",sM);/**
|
|
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 lM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ba=lt("plus",lM);/**
|
|
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 oM=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],uM=lt("refresh-cw",oM);/**
|
|
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 cM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],dh=lt("search",cM);/**
|
|
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 dM=[["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"}]],fM=lt("sun",dM);/**
|
|
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 hM=[["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"}]],Ff=lt("trash-2",hM);/**
|
|
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 mM=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ws=lt("triangle-alert",mM);/**
|
|
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 pM=[["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"}]],gM=lt("undo-2",pM);/**
|
|
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 yM=[["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"}]],pC=lt("user-plus",yM);/**
|
|
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 vM=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],bM=lt("user",vM);/**
|
|
276
|
+
* @license lucide-react v0.577.0 - ISC
|
|
277
|
+
*
|
|
278
|
+
* This source code is licensed under the ISC license.
|
|
279
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
280
|
+
*/const xM=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ss=lt("x",xM);/**
|
|
281
|
+
* @license lucide-react v0.577.0 - ISC
|
|
282
|
+
*
|
|
283
|
+
* This source code is licensed under the ISC license.
|
|
284
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
285
|
+
*/const wM=[["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"}]],SM=lt("zap",wM);function gC(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=gC(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function yC(){for(var e,t,n=0,a="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=gC(e))&&(a&&(a+=" "),a+=t);return a}const kM=(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},jM=(e,t)=>({classGroupId:e,validator:t}),vC=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),$f="-",GS=[],CM="arbitrary..",EM=e=>{const t=_M(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return NM(c);const d=c.split($f),m=d[0]===""&&d.length>1?1:0;return bC(d,m,t)},getConflictingClassGroupIds:(c,d)=>{if(d){const m=a[c],h=n[c];return m?h?kM(h,m):m:h||GS}return n[c]||GS}}},bC=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],l=n.nextPart.get(s);if(l){const h=bC(e,t+1,l);if(h)return h}const c=n.validators;if(c===null)return;const d=t===0?e.join($f):e.slice(t).join($f),m=c.length;for(let h=0;h<m;h++){const g=c[h];if(g.validator(d))return g.classGroupId}},NM=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?CM+a:void 0})(),_M=e=>{const{theme:t,classGroups:n}=e;return TM(n,t)},TM=(e,t)=>{const n=vC();for(const a in e){const s=e[a];kv(s,n,a,t)}return n},kv=(e,t,n,a)=>{const s=e.length;for(let l=0;l<s;l++){const c=e[l];AM(c,t,n,a)}},AM=(e,t,n,a)=>{if(typeof e=="string"){RM(e,t,n);return}if(typeof e=="function"){OM(e,t,n,a);return}zM(e,t,n,a)},RM=(e,t,n)=>{const a=e===""?t:xC(t,e);a.classGroupId=n},OM=(e,t,n,a)=>{if(MM(e)){kv(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(jM(n,e))},zM=(e,t,n,a)=>{const s=Object.entries(e),l=s.length;for(let c=0;c<l;c++){const[d,m]=s[c];kv(m,xC(t,d),n,a)}},xC=(e,t)=>{let n=e;const a=t.split($f),s=a.length;for(let l=0;l<s;l++){const c=a[l];let d=n.nextPart.get(c);d||(d=vC(),n.nextPart.set(c,d)),n=d}return n},MM=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,DM=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),a=Object.create(null);const s=(l,c)=>{n[l]=c,t++,t>e&&(t=0,a=n,n=Object.create(null))};return{get(l){let c=n[l];if(c!==void 0)return c;if((c=a[l])!==void 0)return s(l,c),c},set(l,c){l in n?n[l]=c:s(l,c)}}},Sy="!",VS=":",IM=[],QS=(e,t,n,a,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:s}),LM=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=s=>{const l=[];let c=0,d=0,m=0,h;const g=s.length;for(let j=0;j<g;j++){const E=s[j];if(c===0&&d===0){if(E===VS){l.push(s.slice(m,j)),m=j+1;continue}if(E==="/"){h=j;continue}}E==="["?c++:E==="]"?c--:E==="("?d++:E===")"&&d--}const p=l.length===0?s:s.slice(m);let b=p,w=!1;p.endsWith(Sy)?(b=p.slice(0,-1),w=!0):p.startsWith(Sy)&&(b=p.slice(1),w=!0);const S=h&&h>m?h-m:void 0;return QS(l,w,b,S)};if(t){const s=t+VS,l=a;a=c=>c.startsWith(s)?l(c.slice(s.length)):QS(IM,!1,c,void 0,!0)}if(n){const s=a;a=l=>n({className:l,parseClassName:s})}return a},PM=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,a)=>{t.set(n,1e6+a)}),n=>{const a=[];let s=[];for(let l=0;l<n.length;l++){const c=n[l],d=c[0]==="[",m=t.has(c);d||m?(s.length>0&&(s.sort(),a.push(...s),s=[]),a.push(c)):s.push(c)}return s.length>0&&(s.sort(),a.push(...s)),a}},UM=e=>({cache:DM(e.cacheSize),parseClassName:LM(e),sortModifiers:PM(e),...EM(e)}),BM=/\s+/,FM=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:s,sortModifiers:l}=t,c=[],d=e.trim().split(BM);let m="";for(let h=d.length-1;h>=0;h-=1){const g=d[h],{isExternal:p,modifiers:b,hasImportantModifier:w,baseClassName:S,maybePostfixModifierPosition:j}=n(g);if(p){m=g+(m.length>0?" "+m:m);continue}let E=!!j,C=a(E?S.substring(0,j):S);if(!C){if(!E){m=g+(m.length>0?" "+m:m);continue}if(C=a(S),!C){m=g+(m.length>0?" "+m:m);continue}E=!1}const _=b.length===0?"":b.length===1?b[0]:l(b).join(":"),z=w?_+Sy:_,M=z+C;if(c.indexOf(M)>-1)continue;c.push(M);const L=s(C,E);for(let O=0;O<L.length;++O){const F=L[O];c.push(z+F)}m=g+(m.length>0?" "+m:m)}return m},$M=(...e)=>{let t=0,n,a,s="";for(;t<e.length;)(n=e[t++])&&(a=wC(n))&&(s&&(s+=" "),s+=a);return s},wC=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=wC(e[a]))&&(n&&(n+=" "),n+=t);return n},HM=(e,...t)=>{let n,a,s,l;const c=m=>{const h=t.reduce((g,p)=>p(g),e());return n=UM(h),a=n.cache.get,s=n.cache.set,l=d,d(m)},d=m=>{const h=a(m);if(h)return h;const g=FM(m,n);return s(m,g),g};return l=c,(...m)=>l($M(...m))},qM=[],_n=e=>{const t=n=>n[e]||qM;return t.isThemeGetter=!0,t},SC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,kC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ZM=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,GM=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,VM=/\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$/,QM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,KM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,YM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bi=e=>ZM.test(e),tt=e=>!!e&&!Number.isNaN(Number(e)),Fi=e=>!!e&&Number.isInteger(Number(e)),Wp=e=>e.endsWith("%")&&tt(e.slice(0,-1)),ei=e=>GM.test(e),jC=()=>!0,XM=e=>VM.test(e)&&!QM.test(e),jv=()=>!1,WM=e=>KM.test(e),JM=e=>YM.test(e),eD=e=>!Te(e)&&!Ae(e),tD=e=>fs(e,NC,jv),Te=e=>SC.test(e),zs=e=>fs(e,_C,XM),KS=e=>fs(e,uD,tt),nD=e=>fs(e,AC,jC),rD=e=>fs(e,TC,jv),YS=e=>fs(e,CC,jv),aD=e=>fs(e,EC,JM),uf=e=>fs(e,RC,WM),Ae=e=>kC.test(e),Mu=e=>Js(e,_C),iD=e=>Js(e,TC),XS=e=>Js(e,CC),sD=e=>Js(e,NC),lD=e=>Js(e,EC),cf=e=>Js(e,RC,!0),oD=e=>Js(e,AC,!0),fs=(e,t,n)=>{const a=SC.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},Js=(e,t,n=!1)=>{const a=kC.exec(e);return a?a[1]?t(a[1]):n:!1},CC=e=>e==="position"||e==="percentage",EC=e=>e==="image"||e==="url",NC=e=>e==="length"||e==="size"||e==="bg-size",_C=e=>e==="length",uD=e=>e==="number",TC=e=>e==="family-name",AC=e=>e==="number"||e==="weight",RC=e=>e==="shadow",cD=()=>{const e=_n("color"),t=_n("font"),n=_n("text"),a=_n("font-weight"),s=_n("tracking"),l=_n("leading"),c=_n("breakpoint"),d=_n("container"),m=_n("spacing"),h=_n("radius"),g=_n("shadow"),p=_n("inset-shadow"),b=_n("text-shadow"),w=_n("drop-shadow"),S=_n("blur"),j=_n("perspective"),E=_n("aspect"),C=_n("ease"),_=_n("animate"),z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...M(),Ae,Te],O=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],P=()=>[Ae,Te,m],V=()=>[Bi,"full","auto",...P()],I=()=>[Fi,"none","subgrid",Ae,Te],Q=()=>["auto",{span:["full",Fi,Ae,Te]},Fi,Ae,Te],ie=()=>[Fi,"auto",Ae,Te],be=()=>["auto","min","max","fr",Ae,Te],X=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...P()],ne=()=>[Bi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],we=()=>[Bi,"screen","full","dvw","lvw","svw","min","max","fit",...P()],Re=()=>[Bi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...P()],R=()=>[e,Ae,Te],D=()=>[...M(),XS,YS,{position:[Ae,Te]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],T=()=>["auto","cover","contain",sD,tD,{size:[Ae,Te]}],Z=()=>[Wp,Mu,zs],Y=()=>["","none","full",h,Ae,Te],ue=()=>["",tt,Mu,zs],Se=()=>["solid","dashed","dotted","double"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],me=()=>[tt,Wp,XS,YS],Ge=()=>["","none",S,Ae,Te],Be=()=>["none",tt,Ae,Te],vt=()=>["none",tt,Ae,Te],gt=()=>[tt,Ae,Te],ae=()=>[Bi,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ei],breakpoint:[ei],color:[jC],container:[ei],"drop-shadow":[ei],ease:["in","out","in-out"],font:[eD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ei],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ei],shadow:[ei],spacing:["px",tt],text:[ei],"text-shadow":[ei],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Bi,Te,Ae,E]}],container:["container"],columns:[{columns:[tt,Te,Ae,d]}],"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:L()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:V()}],"inset-x":[{"inset-x":V()}],"inset-y":[{"inset-y":V()}],start:[{"inset-s":V(),start:V()}],end:[{"inset-e":V(),end:V()}],"inset-bs":[{"inset-bs":V()}],"inset-be":[{"inset-be":V()}],top:[{top:V()}],right:[{right:V()}],bottom:[{bottom:V()}],left:[{left:V()}],visibility:["visible","invisible","collapse"],z:[{z:[Fi,"auto",Ae,Te]}],basis:[{basis:[Bi,"full","auto",d,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[tt,Bi,"auto","initial","none",Te]}],grow:[{grow:["",tt,Ae,Te]}],shrink:[{shrink:["",tt,Ae,Te]}],order:[{order:[Fi,"first","last","none",Ae,Te]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:Q()}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:Q()}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":be()}],"auto-rows":[{"auto-rows":be()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...X(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...X()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":X()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pbs:[{pbs:P()}],pbe:[{pbe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:ne()}],"inline-size":[{inline:["auto",...we()]}],"min-inline-size":[{"min-inline":["auto",...we()]}],"max-inline-size":[{"max-inline":["none",...we()]}],"block-size":[{block:["auto",...Re()]}],"min-block-size":[{"min-block":["auto",...Re()]}],"max-block-size":[{"max-block":["none",...Re()]}],w:[{w:[d,"screen",...ne()]}],"min-w":[{"min-w":[d,"screen","none",...ne()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[c]},...ne()]}],h:[{h:["screen","lh",...ne()]}],"min-h":[{"min-h":["screen","lh","none",...ne()]}],"max-h":[{"max-h":["screen","lh",...ne()]}],"font-size":[{text:["base",n,Mu,zs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,oD,nD]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Wp,Te]}],"font-family":[{font:[iD,rD,t]}],"font-features":[{"font-features":[Te]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Ae,Te]}],"line-clamp":[{"line-clamp":[tt,"none",Ae,KS]}],leading:[{leading:[l,...P()]}],"list-image":[{"list-image":["none",Ae,Te]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ae,Te]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Se(),"wavy"]}],"text-decoration-thickness":[{decoration:[tt,"from-font","auto",Ae,zs]}],"text-decoration-color":[{decoration:R()}],"underline-offset":[{"underline-offset":[tt,"auto",Ae,Te]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ae,Te]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ae,Te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:D()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Fi,Ae,Te],radial:["",Ae,Te],conic:[Fi,Ae,Te]},lD,aD]}],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:Z()}],"gradient-via-pos":[{via:Z()}],"gradient-to-pos":[{to:Z()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:Y()}],"rounded-s":[{"rounded-s":Y()}],"rounded-e":[{"rounded-e":Y()}],"rounded-t":[{"rounded-t":Y()}],"rounded-r":[{"rounded-r":Y()}],"rounded-b":[{"rounded-b":Y()}],"rounded-l":[{"rounded-l":Y()}],"rounded-ss":[{"rounded-ss":Y()}],"rounded-se":[{"rounded-se":Y()}],"rounded-ee":[{"rounded-ee":Y()}],"rounded-es":[{"rounded-es":Y()}],"rounded-tl":[{"rounded-tl":Y()}],"rounded-tr":[{"rounded-tr":Y()}],"rounded-br":[{"rounded-br":Y()}],"rounded-bl":[{"rounded-bl":Y()}],"border-w":[{border:ue()}],"border-w-x":[{"border-x":ue()}],"border-w-y":[{"border-y":ue()}],"border-w-s":[{"border-s":ue()}],"border-w-e":[{"border-e":ue()}],"border-w-bs":[{"border-bs":ue()}],"border-w-be":[{"border-be":ue()}],"border-w-t":[{"border-t":ue()}],"border-w-r":[{"border-r":ue()}],"border-w-b":[{"border-b":ue()}],"border-w-l":[{"border-l":ue()}],"divide-x":[{"divide-x":ue()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ue()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Se(),"hidden","none"]}],"divide-style":[{divide:[...Se(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-bs":[{"border-bs":R()}],"border-color-be":[{"border-be":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}],"divide-color":[{divide:R()}],"outline-style":[{outline:[...Se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[tt,Ae,Te]}],"outline-w":[{outline:["",tt,Mu,zs]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",g,cf,uf]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",p,cf,uf]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:ue()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[tt,zs]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":ue()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",b,cf,uf]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[tt,Ae,Te]}],"mix-blend":[{"mix-blend":[...ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ve()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[tt]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[Ae,Te]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":M()}],"mask-image-conic-pos":[{"mask-conic":[tt]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:D()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ae,Te]}],filter:[{filter:["","none",Ae,Te]}],blur:[{blur:Ge()}],brightness:[{brightness:[tt,Ae,Te]}],contrast:[{contrast:[tt,Ae,Te]}],"drop-shadow":[{"drop-shadow":["","none",w,cf,uf]}],"drop-shadow-color":[{"drop-shadow":R()}],grayscale:[{grayscale:["",tt,Ae,Te]}],"hue-rotate":[{"hue-rotate":[tt,Ae,Te]}],invert:[{invert:["",tt,Ae,Te]}],saturate:[{saturate:[tt,Ae,Te]}],sepia:[{sepia:["",tt,Ae,Te]}],"backdrop-filter":[{"backdrop-filter":["","none",Ae,Te]}],"backdrop-blur":[{"backdrop-blur":Ge()}],"backdrop-brightness":[{"backdrop-brightness":[tt,Ae,Te]}],"backdrop-contrast":[{"backdrop-contrast":[tt,Ae,Te]}],"backdrop-grayscale":[{"backdrop-grayscale":["",tt,Ae,Te]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[tt,Ae,Te]}],"backdrop-invert":[{"backdrop-invert":["",tt,Ae,Te]}],"backdrop-opacity":[{"backdrop-opacity":[tt,Ae,Te]}],"backdrop-saturate":[{"backdrop-saturate":[tt,Ae,Te]}],"backdrop-sepia":[{"backdrop-sepia":["",tt,Ae,Te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ae,Te]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[tt,"initial",Ae,Te]}],ease:[{ease:["linear","initial",C,Ae,Te]}],delay:[{delay:[tt,Ae,Te]}],animate:[{animate:["none",_,Ae,Te]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,Ae,Te]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Be()}],"rotate-x":[{"rotate-x":Be()}],"rotate-y":[{"rotate-y":Be()}],"rotate-z":[{"rotate-z":Be()}],scale:[{scale:vt()}],"scale-x":[{"scale-x":vt()}],"scale-y":[{"scale-y":vt()}],"scale-z":[{"scale-z":vt()}],"scale-3d":["scale-3d"],skew:[{skew:gt()}],"skew-x":[{"skew-x":gt()}],"skew-y":[{"skew-y":gt()}],transform:[{transform:[Ae,Te,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ae()}],"translate-x":[{"translate-x":ae()}],"translate-y":[{"translate-y":ae()}],"translate-z":[{"translate-z":ae()}],"translate-none":["translate-none"],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ae,Te]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mbs":[{"scroll-mbs":P()}],"scroll-mbe":[{"scroll-mbe":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pbs":[{"scroll-pbs":P()}],"scroll-pbe":[{"scroll-pbe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ae,Te]}],fill:[{fill:["none",...R()]}],"stroke-w":[{stroke:[tt,Mu,zs,KS]}],stroke:[{stroke:["none",...R()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},dD=HM(cD);function Oe(...e){return dD(yC(e))}function sc(e){return e?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(e)):"—"}function OC(e){return e?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(e)):"—"}function fD(e){return Ce.delete(`/clients/${encodeURIComponent(e)}`)}function zc(){return Ce.get(On("/activity"))}function ls(){return Ce.get("/me/clients")}function Cv(e){return Ce.get(`/clients/${e}`)}function hD(e){return Ce.post(`/clients/${e}/disconnect`)}function mD(){return Ce.post("/me/connect-tokens")}const WS=e=>["agent-sessions",e];function pD(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.toolUseId!="string"||typeof t.name!="string"||t.status!=="pending"&&t.status!=="ok"&&t.status!=="error"?null:{toolUseId:t.toolUseId,name:t.name,args:t.args,status:t.status,durationMs:typeof t.durationMs=="number"?t.durationMs:void 0,resultPreview:typeof t.resultPreview=="string"?t.resultPreview:void 0}}function gD(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 yD(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.text!="string"?null:{text:t.text}}function zC(e,t){const n=new URLSearchParams;t!=null&&t.state&&n.set("state",t.state),t!=null&&t.runtimeState&&n.set("runtimeState",t.runtimeState);const a=n.toString();return Ce.get(`/agents/${e}/sessions${a?`?${a}`:""}`)}function vD(e,t,n){const a=new URLSearchParams;a.set("limit",String(n.limit)),(n==null?void 0:n.cursor)!==void 0&&a.set("cursor",String(n.cursor)),n!=null&&n.direction&&a.set("direction",n.direction);const s=a.toString();return Ce.get(`/agents/${e}/sessions/${t}/events${s?`?${s}`:""}`)}var JS=1,bD=.9,xD=.8,wD=.17,Jp=.1,eg=.999,SD=.9999,kD=.99,jD=/[\\\/_+.#"@\[\(\{&]/,CD=/[\\\/_+.#"@\[\(\{&]/g,ED=/[\s-]/,MC=/[\s-]/g;function ky(e,t,n,a,s,l,c){if(l===t.length)return s===e.length?JS:kD;var d=`${s},${l}`;if(c[d]!==void 0)return c[d];for(var m=a.charAt(l),h=n.indexOf(m,s),g=0,p,b,w,S;h>=0;)p=ky(e,t,n,a,h+1,l+1,c),p>g&&(h===s?p*=JS:jD.test(e.charAt(h-1))?(p*=xD,w=e.slice(s,h-1).match(CD),w&&s>0&&(p*=Math.pow(eg,w.length))):ED.test(e.charAt(h-1))?(p*=bD,S=e.slice(s,h-1).match(MC),S&&s>0&&(p*=Math.pow(eg,S.length))):(p*=wD,s>0&&(p*=Math.pow(eg,h-s))),e.charAt(h)!==t.charAt(l)&&(p*=SD)),(p<Jp&&n.charAt(h-1)===a.charAt(l+1)||a.charAt(l+1)===a.charAt(l)&&n.charAt(h-1)!==a.charAt(l))&&(b=ky(e,t,n,a,h+1,l+2,c),b*Jp>p&&(p=b*Jp)),p>g&&(g=p),h=n.indexOf(m,h+1);return c[d]=g,g}function e1(e){return e.toLowerCase().replace(MC," ")}function ND(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,ky(e,t,e1(e),e1(t),0,0,{})}function as(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function t1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function os(...e){return t=>{let n=!1;const a=e.map(s=>{const l=t1(s,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let s=0;s<a.length;s++){const l=a[s];typeof l=="function"?l():t1(e[s],null)}}}}function el(...e){return x.useCallback(os(...e),e)}function _D(e,t){const n=x.createContext(t),a=l=>{const{children:c,...d}=l,m=x.useMemo(()=>d,Object.values(d));return o.jsx(n.Provider,{value:m,children:c})};a.displayName=e+"Provider";function s(l){const c=x.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[a,s]}function TD(e,t=[]){let n=[];function a(l,c){const d=x.createContext(c),m=n.length;n=[...n,c];const h=p=>{var C;const{scope:b,children:w,...S}=p,j=((C=b==null?void 0:b[e])==null?void 0:C[m])||d,E=x.useMemo(()=>S,Object.values(S));return o.jsx(j.Provider,{value:E,children:w})};h.displayName=l+"Provider";function g(p,b){var j;const w=((j=b==null?void 0:b[e])==null?void 0:j[m])||d,S=x.useContext(w);if(S)return S;if(c!==void 0)return c;throw new Error(`\`${p}\` must be used within \`${l}\``)}return[h,g]}const s=()=>{const l=n.map(c=>x.createContext(c));return function(d){const m=(d==null?void 0:d[e])||l;return x.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])}};return s.scopeName=e,[a,AD(s,...t)]}function AD(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(l){const c=a.reduce((d,{useScope:m,scopeName:h})=>{const p=m(l)[`__scope${h}`];return{...d,...p}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var lc=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},RD=ev[" useId ".trim().toString()]||(()=>{}),OD=0;function si(e){const[t,n]=x.useState(RD());return lc(()=>{n(a=>a??String(OD++))},[e]),t?`radix-${t}`:""}var zD=ev[" useInsertionEffect ".trim().toString()]||lc;function MD({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[s,l,c]=DD({defaultProp:t,onChange:n}),d=e!==void 0,m=d?e:s;{const g=x.useRef(e!==void 0);x.useEffect(()=>{const p=g.current;p!==d&&console.warn(`${a} is changing from ${p?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),g.current=d},[d,a])}const h=x.useCallback(g=>{var p;if(d){const b=ID(g)?g(e):g;b!==e&&((p=c.current)==null||p.call(c,b))}else l(g)},[d,e,l,c]);return[m,h]}function DD({defaultProp:e,onChange:t}){const[n,a]=x.useState(e),s=x.useRef(n),l=x.useRef(t);return zD(()=>{l.current=t},[t]),x.useEffect(()=>{var c;s.current!==n&&((c=l.current)==null||c.call(l,n),s.current=n)},[n,s]),[n,a,l]}function ID(e){return typeof e=="function"}var Ev=vj();const LD=ah(Ev);function DC(e){const t=PD(e),n=x.forwardRef((a,s)=>{const{children:l,...c}=a,d=x.Children.toArray(l),m=d.find(BD);if(m){const h=m.props.children,g=d.map(p=>p===m?x.Children.count(h)>1?x.Children.only(null):x.isValidElement(h)?h.props.children:null:p);return o.jsx(t,{...c,ref:s,children:x.isValidElement(h)?x.cloneElement(h,void 0,g):null})}return o.jsx(t,{...c,ref:s,children:l})});return n.displayName=`${e}.Slot`,n}function PD(e){const t=x.forwardRef((n,a)=>{const{children:s,...l}=n;if(x.isValidElement(s)){const c=$D(s),d=FD(l,s.props);return s.type!==x.Fragment&&(d.ref=a?os(a,c):c),x.cloneElement(s,d)}return x.Children.count(s)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var UD=Symbol("radix.slottable");function BD(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===UD}function FD(e,t){const n={...t};for(const a in t){const s=e[a],l=t[a];/^on[A-Z]/.test(a)?s&&l?n[a]=(...d)=>{const m=l(...d);return s(...d),m}:s&&(n[a]=s):a==="style"?n[a]={...s,...l}:a==="className"&&(n[a]=[s,l].filter(Boolean).join(" "))}return{...e,...n}}function $D(e){var a,s;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var HD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ci=HD.reduce((e,t)=>{const n=DC(`Primitive.${t}`),a=x.forwardRef((s,l)=>{const{asChild:c,...d}=s,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(m,{...d,ref:l})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function qD(e,t){e&&Ev.flushSync(()=>e.dispatchEvent(t))}function oc(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...n)=>{var a;return(a=t.current)==null?void 0:a.call(t,...n)},[])}function ZD(e,t=globalThis==null?void 0:globalThis.document){const n=oc(e);x.useEffect(()=>{const a=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[n,t])}var GD="DismissableLayer",jy="dismissableLayer.update",VD="dismissableLayer.pointerDownOutside",QD="dismissableLayer.focusOutside",n1,IC=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),LC=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:l,onInteractOutside:c,onDismiss:d,...m}=e,h=x.useContext(IC),[g,p]=x.useState(null),b=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=x.useState({}),S=el(t,F=>p(F)),j=Array.from(h.layers),[E]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),C=j.indexOf(E),_=g?j.indexOf(g):-1,z=h.layersWithOutsidePointerEventsDisabled.size>0,M=_>=C,L=XD(F=>{const P=F.target,V=[...h.branches].some(I=>I.contains(P));!M||V||(s==null||s(F),c==null||c(F),F.defaultPrevented||d==null||d())},b),O=WD(F=>{const P=F.target;[...h.branches].some(I=>I.contains(P))||(l==null||l(F),c==null||c(F),F.defaultPrevented||d==null||d())},b);return ZD(F=>{_===h.layers.size-1&&(a==null||a(F),!F.defaultPrevented&&d&&(F.preventDefault(),d()))},b),x.useEffect(()=>{if(g)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(n1=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(g)),h.layers.add(g),r1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=n1)}},[g,b,n,h]),x.useEffect(()=>()=>{g&&(h.layers.delete(g),h.layersWithOutsidePointerEventsDisabled.delete(g),r1())},[g,h]),x.useEffect(()=>{const F=()=>w({});return document.addEventListener(jy,F),()=>document.removeEventListener(jy,F)},[]),o.jsx(ci.div,{...m,ref:S,style:{pointerEvents:z?M?"auto":"none":void 0,...e.style},onFocusCapture:as(e.onFocusCapture,O.onFocusCapture),onBlurCapture:as(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:as(e.onPointerDownCapture,L.onPointerDownCapture)})});LC.displayName=GD;var KD="DismissableLayerBranch",YD=x.forwardRef((e,t)=>{const n=x.useContext(IC),a=x.useRef(null),s=el(t,a);return x.useEffect(()=>{const l=a.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),o.jsx(ci.div,{...e,ref:s})});YD.displayName=KD;function XD(e,t=globalThis==null?void 0:globalThis.document){const n=oc(e),a=x.useRef(!1),s=x.useRef(()=>{});return x.useEffect(()=>{const l=d=>{if(d.target&&!a.current){let m=function(){PC(VD,n,h,{discrete:!0})};const h={originalEvent:d};d.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=m,t.addEventListener("click",s.current,{once:!0})):m()}else t.removeEventListener("click",s.current);a.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",l),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>a.current=!0}}function WD(e,t=globalThis==null?void 0:globalThis.document){const n=oc(e),a=x.useRef(!1);return x.useEffect(()=>{const s=l=>{l.target&&!a.current&&PC(QD,n,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function r1(){const e=new CustomEvent(jy);document.dispatchEvent(e)}function PC(e,t,n,{discrete:a}){const s=n.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),a?qD(s,l):s.dispatchEvent(l)}var tg="focusScope.autoFocusOnMount",ng="focusScope.autoFocusOnUnmount",a1={bubbles:!1,cancelable:!0},JD="FocusScope",UC=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:s,onUnmountAutoFocus:l,...c}=e,[d,m]=x.useState(null),h=oc(s),g=oc(l),p=x.useRef(null),b=el(t,j=>m(j)),w=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(a){let j=function(z){if(w.paused||!d)return;const M=z.target;d.contains(M)?p.current=M:qi(p.current,{select:!0})},E=function(z){if(w.paused||!d)return;const M=z.relatedTarget;M!==null&&(d.contains(M)||qi(p.current,{select:!0}))},C=function(z){if(document.activeElement===document.body)for(const L of z)L.removedNodes.length>0&&qi(d)};document.addEventListener("focusin",j),document.addEventListener("focusout",E);const _=new MutationObserver(C);return d&&_.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",E),_.disconnect()}}},[a,d,w.paused]),x.useEffect(()=>{if(d){s1.add(w);const j=document.activeElement;if(!d.contains(j)){const C=new CustomEvent(tg,a1);d.addEventListener(tg,h),d.dispatchEvent(C),C.defaultPrevented||(e3(i3(BC(d)),{select:!0}),document.activeElement===j&&qi(d))}return()=>{d.removeEventListener(tg,h),setTimeout(()=>{const C=new CustomEvent(ng,a1);d.addEventListener(ng,g),d.dispatchEvent(C),C.defaultPrevented||qi(j??document.body,{select:!0}),d.removeEventListener(ng,g),s1.remove(w)},0)}}},[d,h,g,w]);const S=x.useCallback(j=>{if(!n&&!a||w.paused)return;const E=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,C=document.activeElement;if(E&&C){const _=j.currentTarget,[z,M]=t3(_);z&&M?!j.shiftKey&&C===M?(j.preventDefault(),n&&qi(z,{select:!0})):j.shiftKey&&C===z&&(j.preventDefault(),n&&qi(M,{select:!0})):C===_&&j.preventDefault()}},[n,a,w.paused]);return o.jsx(ci.div,{tabIndex:-1,...c,ref:b,onKeyDown:S})});UC.displayName=JD;function e3(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(qi(a,{select:t}),document.activeElement!==n)return}function t3(e){const t=BC(e),n=i1(t,e),a=i1(t.reverse(),e);return[n,a]}function BC(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const s=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||s?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function i1(e,t){for(const n of e)if(!n3(n,{upTo:t}))return n}function n3(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 r3(e){return e instanceof HTMLInputElement&&"select"in e}function qi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&r3(e)&&t&&e.select()}}var s1=a3();function a3(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=l1(e,t),e.unshift(t)},remove(t){var n;e=l1(e,t),(n=e[0])==null||n.resume()}}}function l1(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function i3(e){return e.filter(t=>t.tagName!=="A")}var s3="Portal",FC=x.forwardRef((e,t)=>{var d;const{container:n,...a}=e,[s,l]=x.useState(!1);lc(()=>l(!0),[]);const c=n||s&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return c?LD.createPortal(o.jsx(ci.div,{...a,ref:t}),c):null});FC.displayName=s3;function l3(e,t){return x.useReducer((n,a)=>t[n][a]??n,e)}var fh=e=>{const{present:t,children:n}=e,a=o3(t),s=typeof n=="function"?n({present:a.isPresent}):x.Children.only(n),l=el(a.ref,u3(s));return typeof n=="function"||a.isPresent?x.cloneElement(s,{ref:l}):null};fh.displayName="Presence";function o3(e){const[t,n]=x.useState(),a=x.useRef(null),s=x.useRef(e),l=x.useRef("none"),c=e?"mounted":"unmounted",[d,m]=l3(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const h=df(a.current);l.current=d==="mounted"?h:"none"},[d]),lc(()=>{const h=a.current,g=s.current;if(g!==e){const b=l.current,w=df(h);e?m("MOUNT"):w==="none"||(h==null?void 0:h.display)==="none"?m("UNMOUNT"):m(g&&b!==w?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,m]),lc(()=>{if(t){let h;const g=t.ownerDocument.defaultView??window,p=w=>{const j=df(a.current).includes(CSS.escape(w.animationName));if(w.target===t&&j&&(m("ANIMATION_END"),!s.current)){const E=t.style.animationFillMode;t.style.animationFillMode="forwards",h=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=E)})}},b=w=>{w.target===t&&(l.current=df(a.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{g.clearTimeout(h),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:x.useCallback(h=>{a.current=h?getComputedStyle(h):null,n(h)},[])}}function df(e){return(e==null?void 0:e.animationName)||"none"}function u3(e){var a,s;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var rg=0;function c3(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??o1()),document.body.insertAdjacentElement("beforeend",e[1]??o1()),rg++,()=>{rg===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),rg--}},[])}function o1(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Aa=function(){return Aa=Object.assign||function(t){for(var n,a=1,s=arguments.length;a<s;a++){n=arguments[a];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},Aa.apply(this,arguments)};function $C(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,a=Object.getOwnPropertySymbols(e);s<a.length;s++)t.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(e,a[s])&&(n[a[s]]=e[a[s]]);return n}function d3(e,t,n){if(n||arguments.length===2)for(var a=0,s=t.length,l;a<s;a++)(l||!(a in t))&&(l||(l=Array.prototype.slice.call(t,0,a)),l[a]=t[a]);return e.concat(l||Array.prototype.slice.call(t))}var Of="right-scroll-bar-position",zf="width-before-scroll-bar",f3="with-scroll-bars-hidden",h3="--removed-body-scroll-bar-size";function ag(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function m3(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(a){var s=n.value;s!==a&&(n.value=a,n.callback(a,s))}}}})[0];return n.callback=t,n.facade}var p3=typeof window<"u"?x.useLayoutEffect:x.useEffect,u1=new WeakMap;function g3(e,t){var n=m3(null,function(a){return e.forEach(function(s){return ag(s,a)})});return p3(function(){var a=u1.get(n);if(a){var s=new Set(a),l=new Set(e),c=n.current;s.forEach(function(d){l.has(d)||ag(d,null)}),l.forEach(function(d){s.has(d)||ag(d,c)})}u1.set(n,e)},[e]),n}function y3(e){return e}function v3(e,t){t===void 0&&(t=y3);var n=[],a=!1,s={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(l){var c=t(l,a);return n.push(c),function(){n=n.filter(function(d){return d!==c})}},assignSyncMedium:function(l){for(a=!0;n.length;){var c=n;n=[],c.forEach(l)}n={push:function(d){return l(d)},filter:function(){return n}}},assignMedium:function(l){a=!0;var c=[];if(n.length){var d=n;n=[],d.forEach(l),c=n}var m=function(){var g=c;c=[],g.forEach(l)},h=function(){return Promise.resolve().then(m)};h(),n={push:function(g){c.push(g),h()},filter:function(g){return c=c.filter(g),n}}}};return s}function b3(e){e===void 0&&(e={});var t=v3(null);return t.options=Aa({async:!0,ssr:!1},e),t}var HC=function(e){var t=e.sideCar,n=$C(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return x.createElement(a,Aa({},n))};HC.isSideCarExport=!0;function x3(e,t){return e.useMedium(t),HC}var qC=b3(),ig=function(){},hh=x.forwardRef(function(e,t){var n=x.useRef(null),a=x.useState({onScrollCapture:ig,onWheelCapture:ig,onTouchMoveCapture:ig}),s=a[0],l=a[1],c=e.forwardProps,d=e.children,m=e.className,h=e.removeScrollBar,g=e.enabled,p=e.shards,b=e.sideCar,w=e.noRelative,S=e.noIsolation,j=e.inert,E=e.allowPinchZoom,C=e.as,_=C===void 0?"div":C,z=e.gapMode,M=$C(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=b,O=g3([n,t]),F=Aa(Aa({},M),s);return x.createElement(x.Fragment,null,g&&x.createElement(L,{sideCar:qC,removeScrollBar:h,shards:p,noRelative:w,noIsolation:S,inert:j,setCallbacks:l,allowPinchZoom:!!E,lockRef:n,gapMode:z}),c?x.cloneElement(x.Children.only(d),Aa(Aa({},F),{ref:O})):x.createElement(_,Aa({},F,{className:m,ref:O}),d))});hh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};hh.classNames={fullWidth:zf,zeroRight:Of};var w3=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function S3(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=w3();return t&&e.setAttribute("nonce",t),e}function k3(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function j3(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var C3=function(){var e=0,t=null;return{add:function(n){e==0&&(t=S3())&&(k3(t,n),j3(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},E3=function(){var e=C3();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ZC=function(){var e=E3(),t=function(n){var a=n.styles,s=n.dynamic;return e(a,s),null};return t},N3={left:0,top:0,right:0,gap:0},sg=function(e){return parseInt(e||"",10)||0},_3=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[sg(n),sg(a),sg(s)]},T3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return N3;var t=_3(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])}},A3=ZC(),eo="data-scroll-locked",R3=function(e,t,n,a){var s=e.left,l=e.top,c=e.right,d=e.gap;return n===void 0&&(n="margin"),`
|
|
286
|
+
.`.concat(f3,` {
|
|
287
|
+
overflow: hidden `).concat(a,`;
|
|
288
|
+
padding-right: `).concat(d,"px ").concat(a,`;
|
|
289
|
+
}
|
|
290
|
+
body[`).concat(eo,`] {
|
|
291
|
+
overflow: hidden `).concat(a,`;
|
|
292
|
+
overscroll-behavior: contain;
|
|
293
|
+
`).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
|
|
294
|
+
padding-left: `.concat(s,`px;
|
|
295
|
+
padding-top: `).concat(l,`px;
|
|
296
|
+
padding-right: `).concat(c,`px;
|
|
297
|
+
margin-left:0;
|
|
298
|
+
margin-top:0;
|
|
299
|
+
margin-right: `).concat(d,"px ").concat(a,`;
|
|
300
|
+
`),n==="padding"&&"padding-right: ".concat(d,"px ").concat(a,";")].filter(Boolean).join(""),`
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.`).concat(Of,` {
|
|
304
|
+
right: `).concat(d,"px ").concat(a,`;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.`).concat(zf,` {
|
|
308
|
+
margin-right: `).concat(d,"px ").concat(a,`;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.`).concat(Of," .").concat(Of,` {
|
|
312
|
+
right: 0 `).concat(a,`;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.`).concat(zf," .").concat(zf,` {
|
|
316
|
+
margin-right: 0 `).concat(a,`;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
body[`).concat(eo,`] {
|
|
320
|
+
`).concat(h3,": ").concat(d,`px;
|
|
321
|
+
}
|
|
322
|
+
`)},c1=function(){var e=parseInt(document.body.getAttribute(eo)||"0",10);return isFinite(e)?e:0},O3=function(){x.useEffect(function(){return document.body.setAttribute(eo,(c1()+1).toString()),function(){var e=c1()-1;e<=0?document.body.removeAttribute(eo):document.body.setAttribute(eo,e.toString())}},[])},z3=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,s=a===void 0?"margin":a;O3();var l=x.useMemo(function(){return T3(s)},[s]);return x.createElement(A3,{styles:R3(l,!t,s,n?"":"!important")})},Cy=!1;if(typeof window<"u")try{var ff=Object.defineProperty({},"passive",{get:function(){return Cy=!0,!0}});window.addEventListener("test",ff,ff),window.removeEventListener("test",ff,ff)}catch{Cy=!1}var Ul=Cy?{passive:!1}:!1,M3=function(e){return e.tagName==="TEXTAREA"},GC=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!M3(e)&&n[t]==="visible")},D3=function(e){return GC(e,"overflowY")},I3=function(e){return GC(e,"overflowX")},d1=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var s=VC(e,a);if(s){var l=QC(e,a),c=l[1],d=l[2];if(c>d)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},L3=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},P3=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},VC=function(e,t){return e==="v"?D3(t):I3(t)},QC=function(e,t){return e==="v"?L3(t):P3(t)},U3=function(e,t){return e==="h"&&t==="rtl"?-1:1},B3=function(e,t,n,a,s){var l=U3(e,window.getComputedStyle(t).direction),c=l*a,d=n.target,m=t.contains(d),h=!1,g=c>0,p=0,b=0;do{if(!d)break;var w=QC(e,d),S=w[0],j=w[1],E=w[2],C=j-E-l*S;(S||C)&&VC(e,d)&&(p+=C,b+=S);var _=d.parentNode;d=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!m&&d!==document.body||m&&(t.contains(d)||t===d));return(g&&Math.abs(p)<1||!g&&Math.abs(b)<1)&&(h=!0),h},hf=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},f1=function(e){return[e.deltaX,e.deltaY]},h1=function(e){return e&&"current"in e?e.current:e},F3=function(e,t){return e[0]===t[0]&&e[1]===t[1]},$3=function(e){return`
|
|
323
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
324
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
325
|
+
`)},H3=0,Bl=[];function q3(e){var t=x.useRef([]),n=x.useRef([0,0]),a=x.useRef(),s=x.useState(H3++)[0],l=x.useState(ZC)[0],c=x.useRef(e);x.useEffect(function(){c.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var j=d3([e.lockRef.current],(e.shards||[]).map(h1),!0).filter(Boolean);return j.forEach(function(E){return E.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),j.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var d=x.useCallback(function(j,E){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!c.current.allowPinchZoom;var C=hf(j),_=n.current,z="deltaX"in j?j.deltaX:_[0]-C[0],M="deltaY"in j?j.deltaY:_[1]-C[1],L,O=j.target,F=Math.abs(z)>Math.abs(M)?"h":"v";if("touches"in j&&F==="h"&&O.type==="range")return!1;var P=window.getSelection(),V=P&&P.anchorNode,I=V?V===O||V.contains(O):!1;if(I)return!1;var Q=d1(F,O);if(!Q)return!0;if(Q?L=F:(L=F==="v"?"h":"v",Q=d1(F,O)),!Q)return!1;if(!a.current&&"changedTouches"in j&&(z||M)&&(a.current=L),!L)return!0;var ie=a.current||L;return B3(ie,E,j,ie==="h"?z:M)},[]),m=x.useCallback(function(j){var E=j;if(!(!Bl.length||Bl[Bl.length-1]!==l)){var C="deltaY"in E?f1(E):hf(E),_=t.current.filter(function(L){return L.name===E.type&&(L.target===E.target||E.target===L.shadowParent)&&F3(L.delta,C)})[0];if(_&&_.should){E.cancelable&&E.preventDefault();return}if(!_){var z=(c.current.shards||[]).map(h1).filter(Boolean).filter(function(L){return L.contains(E.target)}),M=z.length>0?d(E,z[0]):!c.current.noIsolation;M&&E.cancelable&&E.preventDefault()}}},[]),h=x.useCallback(function(j,E,C,_){var z={name:j,delta:E,target:C,should:_,shadowParent:Z3(C)};t.current.push(z),setTimeout(function(){t.current=t.current.filter(function(M){return M!==z})},1)},[]),g=x.useCallback(function(j){n.current=hf(j),a.current=void 0},[]),p=x.useCallback(function(j){h(j.type,f1(j),j.target,d(j,e.lockRef.current))},[]),b=x.useCallback(function(j){h(j.type,hf(j),j.target,d(j,e.lockRef.current))},[]);x.useEffect(function(){return Bl.push(l),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:b}),document.addEventListener("wheel",m,Ul),document.addEventListener("touchmove",m,Ul),document.addEventListener("touchstart",g,Ul),function(){Bl=Bl.filter(function(j){return j!==l}),document.removeEventListener("wheel",m,Ul),document.removeEventListener("touchmove",m,Ul),document.removeEventListener("touchstart",g,Ul)}},[]);var w=e.removeScrollBar,S=e.inert;return x.createElement(x.Fragment,null,S?x.createElement(l,{styles:$3(s)}):null,w?x.createElement(z3,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Z3(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const G3=x3(qC,q3);var KC=x.forwardRef(function(e,t){return x.createElement(hh,Aa({},e,{ref:t,sideCar:G3}))});KC.classNames=hh.classNames;var V3=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Fl=new WeakMap,mf=new WeakMap,pf={},lg=0,YC=function(e){return e&&(e.host||YC(e.parentNode))},Q3=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=YC(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})},K3=function(e,t,n,a){var s=Q3(t,Array.isArray(e)?e:[e]);pf[n]||(pf[n]=new WeakMap);var l=pf[n],c=[],d=new Set,m=new Set(s),h=function(p){!p||d.has(p)||(d.add(p),h(p.parentNode))};s.forEach(h);var g=function(p){!p||m.has(p)||Array.prototype.forEach.call(p.children,function(b){if(d.has(b))g(b);else try{var w=b.getAttribute(a),S=w!==null&&w!=="false",j=(Fl.get(b)||0)+1,E=(l.get(b)||0)+1;Fl.set(b,j),l.set(b,E),c.push(b),j===1&&S&&mf.set(b,!0),E===1&&b.setAttribute(n,"true"),S||b.setAttribute(a,"true")}catch(C){console.error("aria-hidden: cannot operate on ",b,C)}})};return g(t),d.clear(),lg++,function(){c.forEach(function(p){var b=Fl.get(p)-1,w=l.get(p)-1;Fl.set(p,b),l.set(p,w),b||(mf.has(p)||p.removeAttribute(a),mf.delete(p)),w||p.removeAttribute(n)}),lg--,lg||(Fl=new WeakMap,Fl=new WeakMap,mf=new WeakMap,pf={})}},Y3=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),s=V3(e);return s?(a.push.apply(a,Array.from(s.querySelectorAll("[aria-live], script"))),K3(a,s,n,"aria-hidden")):function(){return null}},mh="Dialog",[XC]=TD(mh),[X3,xa]=XC(mh),WC=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:s,onOpenChange:l,modal:c=!0}=e,d=x.useRef(null),m=x.useRef(null),[h,g]=MD({prop:a,defaultProp:s??!1,onChange:l,caller:mh});return o.jsx(X3,{scope:t,triggerRef:d,contentRef:m,contentId:si(),titleId:si(),descriptionId:si(),open:h,onOpenChange:g,onOpenToggle:x.useCallback(()=>g(p=>!p),[g]),modal:c,children:n})};WC.displayName=mh;var JC="DialogTrigger",W3=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(JC,n),l=el(t,s.triggerRef);return o.jsx(ci.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Tv(s.open),...a,ref:l,onClick:as(e.onClick,s.onOpenToggle)})});W3.displayName=JC;var Nv="DialogPortal",[J3,eE]=XC(Nv,{forceMount:void 0}),tE=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:s}=e,l=xa(Nv,t);return o.jsx(J3,{scope:t,forceMount:n,children:x.Children.map(a,c=>o.jsx(fh,{present:n||l.open,children:o.jsx(FC,{asChild:!0,container:s,children:c})}))})};tE.displayName=Nv;var Hf="DialogOverlay",nE=x.forwardRef((e,t)=>{const n=eE(Hf,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,l=xa(Hf,e.__scopeDialog);return l.modal?o.jsx(fh,{present:a||l.open,children:o.jsx(tI,{...s,ref:t})}):null});nE.displayName=Hf;var eI=DC("DialogOverlay.RemoveScroll"),tI=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(Hf,n);return o.jsx(KC,{as:eI,allowPinchZoom:!0,shards:[s.contentRef],children:o.jsx(ci.div,{"data-state":Tv(s.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),Qs="DialogContent",rE=x.forwardRef((e,t)=>{const n=eE(Qs,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,l=xa(Qs,e.__scopeDialog);return o.jsx(fh,{present:a||l.open,children:l.modal?o.jsx(nI,{...s,ref:t}):o.jsx(rI,{...s,ref:t})})});rE.displayName=Qs;var nI=x.forwardRef((e,t)=>{const n=xa(Qs,e.__scopeDialog),a=x.useRef(null),s=el(t,n.contentRef,a);return x.useEffect(()=>{const l=a.current;if(l)return Y3(l)},[]),o.jsx(aE,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:as(e.onCloseAutoFocus,l=>{var c;l.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:as(e.onPointerDownOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0;(c.button===2||d)&&l.preventDefault()}),onFocusOutside:as(e.onFocusOutside,l=>l.preventDefault())})}),rI=x.forwardRef((e,t)=>{const n=xa(Qs,e.__scopeDialog),a=x.useRef(!1),s=x.useRef(!1);return o.jsx(aE,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var c,d;(c=e.onCloseAutoFocus)==null||c.call(e,l),l.defaultPrevented||(a.current||(d=n.triggerRef.current)==null||d.focus(),l.preventDefault()),a.current=!1,s.current=!1},onInteractOutside:l=>{var m,h;(m=e.onInteractOutside)==null||m.call(e,l),l.defaultPrevented||(a.current=!0,l.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const c=l.target;((h=n.triggerRef.current)==null?void 0:h.contains(c))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&s.current&&l.preventDefault()}})}),aE=x.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:l,...c}=e,d=xa(Qs,n),m=x.useRef(null),h=el(t,m);return c3(),o.jsxs(o.Fragment,{children:[o.jsx(UC,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:l,children:o.jsx(LC,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":Tv(d.open),...c,ref:h,onDismiss:()=>d.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(aI,{titleId:d.titleId}),o.jsx(sI,{contentRef:m,descriptionId:d.descriptionId})]})]})}),_v="DialogTitle",iE=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(_v,n);return o.jsx(ci.h2,{id:s.titleId,...a,ref:t})});iE.displayName=_v;var sE="DialogDescription",lE=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(sE,n);return o.jsx(ci.p,{id:s.descriptionId,...a,ref:t})});lE.displayName=sE;var oE="DialogClose",uE=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=xa(oE,n);return o.jsx(ci.button,{type:"button",...a,ref:t,onClick:as(e.onClick,()=>s.onOpenChange(!1))})});uE.displayName=oE;function Tv(e){return e?"open":"closed"}var cE="DialogTitleWarning",[sY,dE]=_D(cE,{contentName:Qs,titleName:_v,docsSlug:"dialog"}),aI=({titleId:e})=>{const t=dE(cE),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
326
|
+
|
|
327
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
328
|
+
|
|
329
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},iI="DialogDescriptionWarning",sI=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${dE(iI).contentName}}.`;return x.useEffect(()=>{var l;const s=(l=e.current)==null?void 0:l.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},fE=WC,hE=tE,mE=nE,pE=rE,lI=iE,oI=lE,uI=uE,cI=Symbol.for("react.lazy"),qf=ev[" use ".trim().toString()];function dI(e){return typeof e=="object"&&e!==null&&"then"in e}function gE(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===cI&&"_payload"in e&&dI(e._payload)}function yE(e){const t=hI(e),n=x.forwardRef((a,s)=>{let{children:l,...c}=a;gE(l)&&typeof qf=="function"&&(l=qf(l._payload));const d=x.Children.toArray(l),m=d.find(pI);if(m){const h=m.props.children,g=d.map(p=>p===m?x.Children.count(h)>1?x.Children.only(null):x.isValidElement(h)?h.props.children:null:p);return o.jsx(t,{...c,ref:s,children:x.isValidElement(h)?x.cloneElement(h,void 0,g):null})}return o.jsx(t,{...c,ref:s,children:l})});return n.displayName=`${e}.Slot`,n}var fI=yE("Slot");function hI(e){const t=x.forwardRef((n,a)=>{let{children:s,...l}=n;if(gE(s)&&typeof qf=="function"&&(s=qf(s._payload)),x.isValidElement(s)){const c=yI(s),d=gI(l,s.props);return s.type!==x.Fragment&&(d.ref=a?os(a,c):c),x.cloneElement(s,d)}return x.Children.count(s)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var mI=Symbol("radix.slottable");function pI(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===mI}function gI(e,t){const n={...t};for(const a in t){const s=e[a],l=t[a];/^on[A-Z]/.test(a)?s&&l?n[a]=(...d)=>{const m=l(...d);return s(...d),m}:s&&(n[a]=s):a==="style"?n[a]={...s,...l}:a==="className"&&(n[a]=[s,l].filter(Boolean).join(" "))}return{...e,...n}}function yI(e){var a,s;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var vI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],di=vI.reduce((e,t)=>{const n=yE(`Primitive.${t}`),a=x.forwardRef((s,l)=>{const{asChild:c,...d}=s,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(m,{...d,ref:l})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),Du='[cmdk-group=""]',og='[cmdk-group-items=""]',bI='[cmdk-group-heading=""]',vE='[cmdk-item=""]',m1=`${vE}:not([aria-disabled="true"])`,Ey="cmdk-item-select",Zl="data-value",xI=(e,t,n)=>ND(e,t,n),bE=x.createContext(void 0),Mc=()=>x.useContext(bE),xE=x.createContext(void 0),Av=()=>x.useContext(xE),wE=x.createContext(void 0),SE=x.forwardRef((e,t)=>{let n=Gl(()=>{var U,T;return{search:"",value:(T=(U=e.value)!=null?U:e.defaultValue)!=null?T:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=Gl(()=>new Set),s=Gl(()=>new Map),l=Gl(()=>new Map),c=Gl(()=>new Set),d=kE(e),{label:m,children:h,value:g,onValueChange:p,filter:b,shouldFilter:w,loop:S,disablePointerSelection:j=!1,vimBindings:E=!0,...C}=e,_=si(),z=si(),M=si(),L=x.useRef(null),O=RI();Ks(()=>{if(g!==void 0){let U=g.trim();n.current.value=U,F.emit()}},[g]),Ks(()=>{O(6,be)},[]);let F=x.useMemo(()=>({subscribe:U=>(c.current.add(U),()=>c.current.delete(U)),snapshot:()=>n.current,setState:(U,T,Z)=>{var Y,ue,Se,ve;if(!Object.is(n.current[U],T)){if(n.current[U]=T,U==="search")ie(),I(),O(1,Q);else if(U==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let me=document.getElementById(M);me?me.focus():(Y=document.getElementById(_))==null||Y.focus()}if(O(7,()=>{var me;n.current.selectedItemId=(me=X())==null?void 0:me.id,F.emit()}),Z||O(5,be),((ue=d.current)==null?void 0:ue.value)!==void 0){let me=T??"";(ve=(Se=d.current).onValueChange)==null||ve.call(Se,me);return}}F.emit()}},emit:()=>{c.current.forEach(U=>U())}}),[]),P=x.useMemo(()=>({value:(U,T,Z)=>{var Y;T!==((Y=l.current.get(U))==null?void 0:Y.value)&&(l.current.set(U,{value:T,keywords:Z}),n.current.filtered.items.set(U,V(T,Z)),O(2,()=>{I(),F.emit()}))},item:(U,T)=>(a.current.add(U),T&&(s.current.has(T)?s.current.get(T).add(U):s.current.set(T,new Set([U]))),O(3,()=>{ie(),I(),n.current.value||Q(),F.emit()}),()=>{l.current.delete(U),a.current.delete(U),n.current.filtered.items.delete(U);let Z=X();O(4,()=>{ie(),(Z==null?void 0:Z.getAttribute("id"))===U&&Q(),F.emit()})}),group:U=>(s.current.has(U)||s.current.set(U,new Set),()=>{l.current.delete(U),s.current.delete(U)}),filter:()=>d.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:_,inputId:M,labelId:z,listInnerRef:L}),[]);function V(U,T){var Z,Y;let ue=(Y=(Z=d.current)==null?void 0:Z.filter)!=null?Y:xI;return U?ue(U,n.current.search,T):0}function I(){if(!n.current.search||d.current.shouldFilter===!1)return;let U=n.current.filtered.items,T=[];n.current.filtered.groups.forEach(Y=>{let ue=s.current.get(Y),Se=0;ue.forEach(ve=>{let me=U.get(ve);Se=Math.max(me,Se)}),T.push([Y,Se])});let Z=L.current;W().sort((Y,ue)=>{var Se,ve;let me=Y.getAttribute("id"),Ge=ue.getAttribute("id");return((Se=U.get(Ge))!=null?Se:0)-((ve=U.get(me))!=null?ve:0)}).forEach(Y=>{let ue=Y.closest(og);ue?ue.appendChild(Y.parentElement===ue?Y:Y.closest(`${og} > *`)):Z.appendChild(Y.parentElement===Z?Y:Y.closest(`${og} > *`))}),T.sort((Y,ue)=>ue[1]-Y[1]).forEach(Y=>{var ue;let Se=(ue=L.current)==null?void 0:ue.querySelector(`${Du}[${Zl}="${encodeURIComponent(Y[0])}"]`);Se==null||Se.parentElement.appendChild(Se)})}function Q(){let U=W().find(Z=>Z.getAttribute("aria-disabled")!=="true"),T=U==null?void 0:U.getAttribute(Zl);F.setState("value",T||void 0)}function ie(){var U,T,Z,Y;if(!n.current.search||d.current.shouldFilter===!1){n.current.filtered.count=a.current.size;return}n.current.filtered.groups=new Set;let ue=0;for(let Se of a.current){let ve=(T=(U=l.current.get(Se))==null?void 0:U.value)!=null?T:"",me=(Y=(Z=l.current.get(Se))==null?void 0:Z.keywords)!=null?Y:[],Ge=V(ve,me);n.current.filtered.items.set(Se,Ge),Ge>0&&ue++}for(let[Se,ve]of s.current)for(let me of ve)if(n.current.filtered.items.get(me)>0){n.current.filtered.groups.add(Se);break}n.current.filtered.count=ue}function be(){var U,T,Z;let Y=X();Y&&(((U=Y.parentElement)==null?void 0:U.firstChild)===Y&&((Z=(T=Y.closest(Du))==null?void 0:T.querySelector(bI))==null||Z.scrollIntoView({block:"nearest"})),Y.scrollIntoView({block:"nearest"}))}function X(){var U;return(U=L.current)==null?void 0:U.querySelector(`${vE}[aria-selected="true"]`)}function W(){var U;return Array.from(((U=L.current)==null?void 0:U.querySelectorAll(m1))||[])}function q(U){let T=W()[U];T&&F.setState("value",T.getAttribute(Zl))}function ne(U){var T;let Z=X(),Y=W(),ue=Y.findIndex(ve=>ve===Z),Se=Y[ue+U];(T=d.current)!=null&&T.loop&&(Se=ue+U<0?Y[Y.length-1]:ue+U===Y.length?Y[0]:Y[ue+U]),Se&&F.setState("value",Se.getAttribute(Zl))}function we(U){let T=X(),Z=T==null?void 0:T.closest(Du),Y;for(;Z&&!Y;)Z=U>0?TI(Z,Du):AI(Z,Du),Y=Z==null?void 0:Z.querySelector(m1);Y?F.setState("value",Y.getAttribute(Zl)):ne(U)}let Re=()=>q(W().length-1),R=U=>{U.preventDefault(),U.metaKey?Re():U.altKey?we(1):ne(1)},D=U=>{U.preventDefault(),U.metaKey?q(0):U.altKey?we(-1):ne(-1)};return x.createElement(di.div,{ref:t,tabIndex:-1,...C,"cmdk-root":"",onKeyDown:U=>{var T;(T=C.onKeyDown)==null||T.call(C,U);let Z=U.nativeEvent.isComposing||U.keyCode===229;if(!(U.defaultPrevented||Z))switch(U.key){case"n":case"j":{E&&U.ctrlKey&&R(U);break}case"ArrowDown":{R(U);break}case"p":case"k":{E&&U.ctrlKey&&D(U);break}case"ArrowUp":{D(U);break}case"Home":{U.preventDefault(),q(0);break}case"End":{U.preventDefault(),Re();break}case"Enter":{U.preventDefault();let Y=X();if(Y){let ue=new Event(Ey);Y.dispatchEvent(ue)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:P.inputId,id:P.labelId,style:zI},m),ph(e,U=>x.createElement(xE.Provider,{value:F},x.createElement(bE.Provider,{value:P},U))))}),wI=x.forwardRef((e,t)=>{var n,a;let s=si(),l=x.useRef(null),c=x.useContext(wE),d=Mc(),m=kE(e),h=(a=(n=m.current)==null?void 0:n.forceMount)!=null?a:c==null?void 0:c.forceMount;Ks(()=>{if(!h)return d.item(s,c==null?void 0:c.id)},[h]);let g=jE(s,l,[e.value,e.children,l],e.keywords),p=Av(),b=us(O=>O.value&&O.value===g.current),w=us(O=>h||d.filter()===!1?!0:O.search?O.filtered.items.get(s)>0:!0);x.useEffect(()=>{let O=l.current;if(!(!O||e.disabled))return O.addEventListener(Ey,S),()=>O.removeEventListener(Ey,S)},[w,e.onSelect,e.disabled]);function S(){var O,F;j(),(F=(O=m.current).onSelect)==null||F.call(O,g.current)}function j(){p.setState("value",g.current,!0)}if(!w)return null;let{disabled:E,value:C,onSelect:_,forceMount:z,keywords:M,...L}=e;return x.createElement(di.div,{ref:os(l,t),...L,id:s,"cmdk-item":"",role:"option","aria-disabled":!!E,"aria-selected":!!b,"data-disabled":!!E,"data-selected":!!b,onPointerMove:E||d.getDisablePointerSelection()?void 0:j,onClick:E?void 0:S},e.children)}),SI=x.forwardRef((e,t)=>{let{heading:n,children:a,forceMount:s,...l}=e,c=si(),d=x.useRef(null),m=x.useRef(null),h=si(),g=Mc(),p=us(w=>s||g.filter()===!1?!0:w.search?w.filtered.groups.has(c):!0);Ks(()=>g.group(c),[]),jE(c,d,[e.value,e.heading,m]);let b=x.useMemo(()=>({id:c,forceMount:s}),[s]);return x.createElement(di.div,{ref:os(d,t),...l,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},n&&x.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),ph(e,w=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},x.createElement(wE.Provider,{value:b},w))))}),kI=x.forwardRef((e,t)=>{let{alwaysRender:n,...a}=e,s=x.useRef(null),l=us(c=>!c.search);return!n&&!l?null:x.createElement(di.div,{ref:os(s,t),...a,"cmdk-separator":"",role:"separator"})}),jI=x.forwardRef((e,t)=>{let{onValueChange:n,...a}=e,s=e.value!=null,l=Av(),c=us(h=>h.search),d=us(h=>h.selectedItemId),m=Mc();return x.useEffect(()=>{e.value!=null&&l.setState("search",e.value)},[e.value]),x.createElement(di.input,{ref:t,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":d,id:m.inputId,type:"text",value:s?e.value:c,onChange:h=>{s||l.setState("search",h.target.value),n==null||n(h.target.value)}})}),CI=x.forwardRef((e,t)=>{let{children:n,label:a="Suggestions",...s}=e,l=x.useRef(null),c=x.useRef(null),d=us(h=>h.selectedItemId),m=Mc();return x.useEffect(()=>{if(c.current&&l.current){let h=c.current,g=l.current,p,b=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let w=h.offsetHeight;g.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return b.observe(h),()=>{cancelAnimationFrame(p),b.unobserve(h)}}},[]),x.createElement(di.div,{ref:os(l,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":a,id:m.listId},ph(e,h=>x.createElement("div",{ref:os(c,m.listInnerRef),"cmdk-list-sizer":""},h)))}),EI=x.forwardRef((e,t)=>{let{open:n,onOpenChange:a,overlayClassName:s,contentClassName:l,container:c,...d}=e;return x.createElement(fE,{open:n,onOpenChange:a},x.createElement(hE,{container:c},x.createElement(mE,{"cmdk-overlay":"",className:s}),x.createElement(pE,{"aria-label":e.label,"cmdk-dialog":"",className:l},x.createElement(SE,{ref:t,...d}))))}),NI=x.forwardRef((e,t)=>us(n=>n.filtered.count===0)?x.createElement(di.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),_I=x.forwardRef((e,t)=>{let{progress:n,children:a,label:s="Loading...",...l}=e;return x.createElement(di.div,{ref:t,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},ph(e,c=>x.createElement("div",{"aria-hidden":!0},c)))}),kr=Object.assign(SE,{List:CI,Item:wI,Input:jI,Group:SI,Separator:kI,Dialog:EI,Empty:NI,Loading:_I});function TI(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function AI(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function kE(e){let t=x.useRef(e);return Ks(()=>{t.current=e}),t}var Ks=typeof window>"u"?x.useEffect:x.useLayoutEffect;function Gl(e){let t=x.useRef();return t.current===void 0&&(t.current=e()),t}function us(e){let t=Av(),n=()=>e(t.snapshot());return x.useSyncExternalStore(t.subscribe,n,n)}function jE(e,t,n,a=[]){let s=x.useRef(),l=Mc();return Ks(()=>{var c;let d=(()=>{var h;for(let g of n){if(typeof g=="string")return g.trim();if(typeof g=="object"&&"current"in g)return g.current?(h=g.current.textContent)==null?void 0:h.trim():s.current}})(),m=a.map(h=>h.trim());l.value(e,d,m),(c=t.current)==null||c.setAttribute(Zl,d),s.current=d}),s}var RI=()=>{let[e,t]=x.useState(),n=Gl(()=>new Map);return Ks(()=>{n.current.forEach(a=>a()),n.current=new Map},[e]),(a,s)=>{n.current.set(a,s),t({})}};function OI(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function ph({asChild:e,children:t},n){return e&&x.isValidElement(t)?x.cloneElement(OI(t),{ref:t.ref},n(t.props.children)):n(t)}var zI={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Tn=fE,MI=hE,CE=x.forwardRef(({className:e,...t},n)=>o.jsx(mE,{ref:n,className:Oe("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}));CE.displayName="DialogOverlay";const jn=x.forwardRef(({className:e,children:t,...n},a)=>o.jsxs(MI,{children:[o.jsx(CE,{}),o.jsxs(pE,{ref:a,className:Oe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",e),...n,children:[t,o.jsxs(uI,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[o.jsx(ss,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));jn.displayName="DialogContent";function Ln({className:e,...t}){return o.jsx("div",{className:Oe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function cr({className:e,...t}){return o.jsx("div",{className:Oe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t})}const An=x.forwardRef(({className:e,...t},n)=>o.jsx(lI,{ref:n,className:Oe("text-subtitle leading-none tracking-tight",e),...t}));An.displayName="DialogTitle";const Rv=x.forwardRef(({className:e,...t},n)=>o.jsx(oI,{ref:n,className:Oe("text-body text-muted-foreground",e),...t}));Rv.displayName="DialogDescription";const EE=x.forwardRef(({className:e,...t},n)=>o.jsx(kr,{ref:n,className:Oe("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));EE.displayName=kr.displayName;function DI({open:e,onOpenChange:t,children:n}){return o.jsx(Tn,{open:e,onOpenChange:t,children:o.jsx(jn,{className:"overflow-hidden p-0 shadow-lg",children:o.jsx(EE,{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 NE=x.forwardRef(({className:e,...t},n)=>o.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[o.jsx(dh,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),o.jsx(kr.Input,{ref:n,className:Oe("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})]}));NE.displayName=kr.Input.displayName;const _E=x.forwardRef(({className:e,...t},n)=>o.jsx(kr.List,{ref:n,className:Oe("max-h-[var(--sp-75)] overflow-y-auto overflow-x-hidden",e),...t}));_E.displayName=kr.List.displayName;const TE=x.forwardRef((e,t)=>o.jsx(kr.Empty,{ref:t,className:"py-6 text-center text-body",...e}));TE.displayName=kr.Empty.displayName;const Mf=x.forwardRef(({className:e,...t},n)=>o.jsx(kr.Group,{ref:n,className:Oe("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-caption [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));Mf.displayName=kr.Group.displayName;const Ny=x.forwardRef(({className:e,...t},n)=>o.jsx(kr.Separator,{ref:n,className:Oe("-mx-1 h-px bg-border",e),...t}));Ny.displayName=kr.Separator.displayName;const Df=x.forwardRef(({className:e,...t},n)=>o.jsx(kr.Item,{ref:n,className:Oe("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}));Df.displayName=kr.Item.displayName;function Dc(e){const t=new URLSearchParams;e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.type&&t.set("type",e.type);const n=t.toString();return Ce.get(On(`/agents${n?`?${n}`:""}`))}function II(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 Ce.get(On(`/agents/all${n?`?${n}`:""}`))}function Ov(){return Ce.get("/me/managed-agents")}function LI(e){return Ce.get(`/agents/${encodeURIComponent(e)}`)}function PI(e){return Ce.post(On("/agents"),e)}function UI(e){return Ce.get(On(`/agents/names/${encodeURIComponent(e)}/availability`))}function p1(e,t){return Ce.patch(`/agents/${encodeURIComponent(e)}`,t)}function BI(e,t){return Ce.patch(`/agents/${encodeURIComponent(e)}/rebind`,t)}function AE(e){return Ce.delete(`/agents/${encodeURIComponent(e)}`)}function RE(e){return Ce.post(`/agents/${encodeURIComponent(e)}/suspend`,{})}function OE(e){return Ce.post(`/agents/${encodeURIComponent(e)}/reactivate`,{})}function FI(e){return Ce.post(`/agents/${encodeURIComponent(e)}/test`,{})}function gh(){const{data:e}=Ke({queryKey:["agents","name-map"],queryFn:()=>Dc({limit:100}),staleTime:3e4}),{data:t}=Ke({queryKey:["managed-agents","name-map"],queryFn:Ov,staleTime:3e4});return x.useMemo(()=>{const n=new Map;if(t)for(const a of t)n.set(a.uuid,a.displayName);if(e!=null&&e.items)for(const a of e.items)n.set(a.uuid,a.displayName);return a=>a?n.get(a)??a:"—"},[e,t])}function zv(){const{data:e}=Ke({queryKey:["agents","name-map"],queryFn:()=>Dc({limit:100}),staleTime:3e4}),{data:t}=Ke({queryKey:["managed-agents","name-map"],queryFn:Ov,staleTime:3e4});return x.useMemo(()=>{const n=new Map;if(t)for(const a of t)n.set(a.uuid,{name:a.name,displayName:a.displayName});if(e!=null&&e.items)for(const a of e.items)n.set(a.uuid,{name:a.name,displayName:a.displayName});return a=>a?n.get(a)??null:null},[e,t])}const $I=[{path:"/",label:"Workspace"},{path:"/context",label:"Context"},{path:"/team",label:"Team"},{path:"/settings",label:"Settings"}];function HI({open:e,onOpenChange:t}){const n=Rn(),a=gh(),{data:s}=Ke({queryKey:["activity"],queryFn:zc,enabled:e,staleTime:3e4}),l=(s==null?void 0:s.agents)??[],d=Ke({queryKey:["palette-sessions",l.map(h=>h.agentId).join(",")],queryFn:async()=>{const h=[];for(const g of l)try{const p=await zC(g.agentId);for(const b of p)h.push({agentId:g.agentId,session:b})}catch{}return h},enabled:e&&l.length>0,staleTime:3e4}).data??[],m=h=>{t(!1),n(h)};return o.jsxs(DI,{open:e,onOpenChange:t,children:[o.jsx(NE,{placeholder:"Jump to agent, chat, or page…"}),o.jsxs(_E,{children:[o.jsx(TE,{children:"No results"}),l.length>0&&o.jsx(Mf,{heading:"Agents",children:l.map(h=>{const g=a(h.agentId);return o.jsxs(Df,{value:`agent ${g} ${h.agentId}`,onSelect:()=>m(`/?a=${h.agentId}`),children:[o.jsx(cC,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),o.jsx("span",{className:"flex-1 truncate",children:g}),o.jsx("span",{className:"text-caption text-muted-foreground font-mono ml-2",children:h.agentId.slice(0,8)})]},h.agentId)})}),d.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Ny,{}),o.jsx(Mf,{heading:"Chats",children:d.map(({agentId:h,session:g})=>{const p=a(h);return o.jsxs(Df,{value:`chat ${p} ${g.chatId}`,onSelect:()=>m(`/?a=${h}&c=${g.chatId}`),children:[o.jsx(wv,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),o.jsx("span",{className:"flex-1 truncate",children:p}),o.jsx("span",{className:"text-caption text-muted-foreground font-mono ml-2",children:g.chatId.slice(0,8)})]},`${h}-${g.chatId}`)})})]}),o.jsx(Ny,{}),o.jsx(Mf,{heading:"Pages",children:$I.map(h=>o.jsxs(Df,{value:`page ${h.label}`,onSelect:()=>m(h.path),children:[o.jsx(Qz,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),o.jsx("span",{children:h.label})]},h.path))})]})]})}function qI(e,t){return t?e.filter(n=>n.userId===t&&n.status==="disconnected"&&n.agentCount>0):[]}function ZI(){var a;const{user:e}=pt(),{data:t}=Ke({queryKey:["clients"],queryFn:ls,refetchInterval:1e4,enabled:!!e});if(!t||!e)return{rows:[],firstHostname:null};const n=qI(t,e.id);return{rows:n,firstHostname:((a=n[0])==null?void 0:a.hostname)??null}}const GI=160;function VI(){const e=Rn(),{rows:t,firstHostname:n}=ZI();if(t.length===0)return null;const a=t.length>1,s=a?`${t.length} computers disconnected. Click to manage.`:`${n??"Your computer"} is disconnected. Click to manage.`;return o.jsxs("button",{type:"button",onClick:()=>e("/settings/computers"),title:s,"aria-label":s,className:"inline-flex items-center cursor-pointer text-body font-medium",style:{gap:8,height:26,padding:"0 var(--sp-2_5) 0 var(--sp-2_25)",borderRadius:999,border:0,outline:"var(--hairline) solid color-mix(in oklch, var(--state-error) 38%, transparent)",outlineOffset:-1,background:"color-mix(in oklch, var(--state-error) 14%, transparent)",color:"color-mix(in oklch, var(--state-error) 80%, var(--fg))",minWidth:0},children:[o.jsx(QI,{}),a?o.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[o.jsx("span",{className:"font-semibold",children:t.length})," computers disconnected"]}):o.jsxs("span",{className:"inline-flex items-center",style:{gap:5,minWidth:0},children:[o.jsx("span",{className:"mono text-label font-medium",style:{maxWidth:GI,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"color-mix(in oklch, var(--state-error) 60%, var(--fg))"},children:n??"computer"}),o.jsx("span",{style:{flexShrink:0},children:"disconnected"})]})]})}function QI(){return o.jsxs("span",{"aria-hidden":"true",style:{position:"relative",width:8,height:8,flexShrink:0,display:"inline-block"},children:[o.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--state-error)"}}),o.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--state-error)",animation:"ring-pulse 1.8s infinite",opacity:.6}})]})}function Ic(e){return o.jsxs("svg",{viewBox:"0 0 9 10",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",shapeRendering:"crispEdges","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"4",y:"0",width:"1",height:"1"}),o.jsx("rect",{x:"3",y:"1",width:"3",height:"1"}),o.jsx("rect",{x:"2",y:"2",width:"5",height:"1"}),o.jsx("rect",{x:"3",y:"3",width:"3",height:"1"}),o.jsx("rect",{x:"2",y:"4",width:"5",height:"1"}),o.jsx("rect",{x:"1",y:"5",width:"7",height:"1"}),o.jsx("rect",{x:"2",y:"6",width:"5",height:"1"}),o.jsx("rect",{x:"1",y:"7",width:"7",height:"1"}),o.jsx("rect",{x:"0",y:"8",width:"9",height:"1"}),o.jsx("rect",{x:"3",y:"9",width:"3",height:"1"})]})}function g1(e){const t=new URLSearchParams;e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.severity&&t.set("severity",e.severity),(e==null?void 0:e.read)!==void 0&&t.set("read",String(e.read)),e!=null&&e.agentId&&t.set("agentId",e.agentId);const n=t.toString();return Ce.get(On(`/notifications${n?`?${n}`:""}`))}function KI(e){return Ce.post(On(`/notifications/${e}/read`))}function YI(){return Ce.post(On("/notifications/read-all"))}const XI={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 WI(e){switch(e){case"high":return"var(--state-error)";case"medium":return"var(--state-blocked)";default:return"var(--accent-dim)"}}function JI({notification:e,onClick:t,clickable:n}){const a=(XI[e.type]??e.type).toString(),s=WI(e.severity),l=n??!0;return o.jsxs("button",{type:"button",onClick:t,className:Oe("w-full text-left transition-colors text-body",l?"cursor-pointer":"cursor-default"),style:{padding:"var(--sp-1_5) var(--sp-2)",background:e.read?"transparent":"var(--bg-sunken)",borderLeft:`var(--hairline-bold) solid ${s}`,borderRadius:"0 var(--sp-0_75) var(--sp-0_75) 0"},onMouseEnter:c=>{l&&(c.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:c=>{c.currentTarget.style.background=e.read?"transparent":"var(--bg-sunken)"},children:[o.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:8},children:[o.jsx("span",{className:"mono uppercase text-label",style:{color:e.severity==="high"?"var(--state-error)":"var(--fg-3)"},children:a.replace("_"," ")}),o.jsx("span",{className:"mono text-label",style:{color:"var(--fg-4)",whiteSpace:"nowrap"},children:sc(e.createdAt)})]}),o.jsx("div",{style:{color:"var(--fg-2)",marginTop:1,wordBreak:"break-word"},children:e.message})]})}function e4(){var w;const[e,t]=x.useState(!1),[n,a]=x.useState(null),s=x.useRef(null),l=Rn(),c=hn(),{data:d}=Ke({queryKey:["notifications","bell"],queryFn:()=>g1({limit:8}),refetchInterval:1e4}),{data:m}=Ke({queryKey:["notifications","unread-count"],queryFn:()=>g1({read:!1,limit:100}),refetchInterval:1e4}),h=((w=m==null?void 0:m.items)==null?void 0:w.length)??0,g=h>0,p=x.useCallback(async S=>{S.read||(KI(S.id).catch(()=>{}),c.invalidateQueries({queryKey:["notifications"]})),t(!1),S.agentId&&S.chatId?l(`/?a=${S.agentId}&c=${S.chatId}`):S.agentId&&l(`/?a=${S.agentId}`)},[l,c]),b=x.useCallback(async()=>{a(null);try{await YI(),await c.invalidateQueries({queryKey:["notifications"]})}catch(S){a(S instanceof Error?S.message:"Failed to mark all as read")}},[c]);return o.jsxs("div",{className:"relative",children:[o.jsxs("button",{type:"button",onClick:()=>t(!e),className:"relative flex items-center justify-center rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",children:[o.jsx(Az,{className:"h-4 w-4"}),g&&o.jsx("span",{className:"absolute -top-0.5 -right-0.5 flex items-center justify-center rounded-full px-1 font-medium text-label",style:{height:16,minWidth:16,background:"var(--state-error)",color:"var(--bg)"},children:h>99?"99+":h})]}),e&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"fixed inset-0 z-40 cursor-default",onClick:()=>t(!1)}),o.jsxs("div",{ref:s,className:"absolute right-0 top-full mt-1 z-50",style:{width:320,background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:6,boxShadow:"var(--shadow-md)"},children:[o.jsxs("div",{className:"flex items-center justify-between",style:{padding:"var(--sp-2) var(--sp-3)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[o.jsx("span",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:"Notifications"}),g&&o.jsx("button",{type:"button",onClick:b,className:"hover:underline text-body",style:{color:"var(--accent)"},children:"Mark all read"})]}),n&&o.jsx("div",{className:"text-body",style:{padding:"var(--sp-1_5) var(--sp-3)",color:"var(--state-error)",background:"var(--bg-sunken)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:n}),o.jsx("div",{className:"flex flex-col overflow-y-auto",style:{maxHeight:360,padding:8,gap:4},children:!(d!=null&&d.items)||d.items.length===0?o.jsx("div",{className:"text-center text-body",style:{color:"var(--fg-3)",padding:"var(--sp-4_5) 0"},children:"No notifications"}):d.items.map(S=>o.jsx(JI,{notification:S,clickable:!!S.agentId,onClick:()=>p(S)},S.id))})]})]})]})}function t4(){if(typeof window>"u")return"light";const e=window.localStorage.getItem("theme");return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function n4(){const[e,t]=x.useState(t4);return x.useEffect(()=>{document.documentElement.classList.toggle("dark",e==="dark"),window.localStorage.setItem("theme",e)},[e]),o.jsx("button",{type:"button",onClick:()=>t(e==="dark"?"light":"dark"),"aria-label":e==="dark"?"Switch to light theme":"Switch to dark theme",className:"flex items-center gap-1.5 rounded-md px-2 py-1.5 text-body text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:e==="dark"?o.jsx(fM,{className:"h-4 w-4"}):o.jsx(nM,{className:"h-4 w-4"})})}function r4(e){var n;const t=e.trim();return t?((n=t[0])==null?void 0:n.toUpperCase())??"?":"?"}function y1({src:e,name:t,size:n=28,className:a}){const s=`${n}px`;return e?o.jsx("img",{src:e,alt:t,width:n,height:n,className:a,style:{width:s,height:s,borderRadius:"50%",objectFit:"cover",display:"block"}}):o.jsx("span",{className:a,role:"img","aria-label":t,style:{width:s,height:s,borderRadius:"50%",background:"var(--accent)",color:"var(--bg-raised)",display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1,userSelect:"none"},children:o.jsx("span",{className:"text-subtitle font-semibold",children:r4(t)})})}const v1=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,b1=yC,a4=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return b1(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:l}=t,c=Object.keys(s).map(h=>{const g=n==null?void 0:n[h],p=l==null?void 0:l[h];if(g===null)return null;const b=v1(g)||v1(p);return s[h][b]}),d=n&&Object.entries(n).reduce((h,g)=>{let[p,b]=g;return b===void 0||(h[p]=b),h},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((h,g)=>{let{class:p,className:b,...w}=g;return Object.entries(w).every(S=>{let[j,E]=S;return Array.isArray(E)?E.includes({...l,...d}[j]):{...l,...d}[j]===E})?[...h,p,b]:h},[]);return b1(e,c,m,n==null?void 0:n.class,n==null?void 0:n.className)},i4=a4("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[var(--radius-input)] text-body font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 px-3 text-label",xs:"h-7 rounded-[var(--radius-chip)] px-2.5 text-label gap-1.5",lg:"h-10 px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),pe=x.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...s},l)=>{const c=a?fI:"button";return o.jsx(c,{className:Oe(i4({variant:t,size:n,className:e})),ref:l,...s})});pe.displayName="Button";const Pt=x.forwardRef(({className:e,type:t,...n},a)=>o.jsx("input",{type:t,className:Oe("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}));Pt.displayName="Input";function s4({action:e,onClose:t}){const n=e!==null;return o.jsx(Tn,{open:n,onOpenChange:a=>!a&&t(),children:o.jsxs(jn,{children:[o.jsxs(Ln,{children:[o.jsx(An,{children:e==="join"?"Join a team":"Create a new team"}),o.jsx(Rv,{children:e==="join"?"Paste the invite token shared with you.":"You'll be the admin. You can rename or invite teammates afterward."})]}),e==="create"&&o.jsx(o4,{onDone:t}),e==="join"&&o.jsx(u4,{onDone:t})]})})}function l4(e){return e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"team"}function o4({onDone:e}){const{adoptTokens:t}=pt(),n=Rn(),[a,s]=x.useState(""),[l,c]=x.useState(null),[d,m]=x.useState(!1);x.useEffect(()=>{s(""),c(null),m(!1)},[]);const h=async g=>{g.preventDefault();const p=a.trim();if(p){m(!0),c(null);try{const b=await Ce.post("/me/organizations",{name:l4(p),displayName:p});await t(b.tokens),e(),n("/",{replace:!0})}catch(b){c(b instanceof Error?b.message:"Failed to create team")}finally{m(!1)}}};return o.jsxs("form",{className:"space-y-3",onSubmit:h,children:[l&&o.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:l}),o.jsx(Pt,{id:"team-display-name","aria-label":"Team name",value:a,onChange:g=>s(g.target.value),placeholder:"Acme Robotics",autoFocus:!0}),o.jsx(pe,{type:"submit",className:"w-full",disabled:d||!a.trim(),children:d?"Creating…":"Create team"})]})}function u4({onDone:e}){const{adoptTokens:t}=pt(),n=Rn(),[a,s]=x.useState(""),[l,c]=x.useState(null),[d,m]=x.useState(!1);x.useEffect(()=>{s(""),c(null),m(!1)},[]);const h=async g=>{if(g.preventDefault(),!!a.trim()){m(!0),c(null);try{const p=a.trim(),b=/\/invite\/([^/?#]+)/.exec(p),w=(b==null?void 0:b[1])??p,S=await Ce.post("/me/organizations/join",{token:w});await t(S.tokens),e(),n("/",{replace:!0})}catch(p){c(p instanceof Error?p.message:"Failed to join team")}finally{m(!1)}}};return o.jsxs("form",{className:"space-y-3",onSubmit:h,children:[l&&o.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:l}),o.jsx(Pt,{id:"join-token","aria-label":"Invite token or full URL",value:a,onChange:g=>s(g.target.value),placeholder:"abc123… or https://hub/invite/abc123",autoFocus:!0}),o.jsx(pe,{type:"submit",className:"w-full",disabled:d||!a.trim(),children:d?"Joining…":"Join team"})]})}function c4(){var L,O;const{organizationId:e,role:t,user:n,selectOrganization:a,logout:s}=pt(),l=Rn(),[c,d]=x.useState([]),[m,h]=x.useState(!1),[g,p]=x.useState(null),b=x.useRef(null);x.useEffect(()=>{(async()=>{try{const F=await Ce.get("/me/organizations");d(F)}catch{}})()},[]),x.useEffect(()=>{const F=V=>{m&&b.current&&!b.current.contains(V.target)&&h(!1)},P=V=>{m&&V.key==="Escape"&&h(!1)};return window.addEventListener("mousedown",F),window.addEventListener("keydown",P),()=>{window.removeEventListener("mousedown",F),window.removeEventListener("keydown",P)}},[m]);const w=(n==null?void 0:n.displayName)??"User",S=(n==null?void 0:n.username)??"",j=(n==null?void 0:n.avatarUrl)??null,E=c.find(F=>F.id===e)??null,C=(E==null?void 0:E.role)??(t==="admin"||t==="member"?t:null),_=async F=>{if(F===e){h(!1);return}try{await a(F),h(!1),l("/",{replace:!0})}catch{}},z=()=>{h(!1),p("create")},M=()=>{h(!1),p("join")};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{ref:b,className:"relative","data-testid":"user-menu",children:[o.jsx("button",{type:"button","aria-label":`User menu, ${w}`,"aria-haspopup":"menu","aria-expanded":m,onClick:()=>h(F=>!F),className:"inline-flex items-center justify-center rounded-full focus:outline-none focus:ring-2 focus:ring-ring transition-shadow",style:{background:"transparent",border:m?"var(--hairline) solid var(--border)":"var(--hairline) solid transparent",padding:1,cursor:"pointer"},children:o.jsx(y1,{src:j,name:w,size:28})}),m&&o.jsxs("div",{role:"menu",className:"absolute right-0 z-30 mt-2 rounded-md border bg-popover shadow-md",style:{width:280},children:[o.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3",style:{borderColor:"var(--border)"},children:[o.jsx(y1,{src:j,name:w,size:32}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"text-subtitle font-medium truncate",style:{color:"var(--fg)"},children:w}),S&&S!==w&&o.jsxs("div",{className:"text-label text-muted-foreground truncate",children:["@",S]})]})]}),c.length>0&&o.jsxs("div",{className:"border-b py-1",style:{borderColor:"var(--border)"},children:[o.jsx("div",{className:"px-4 py-1 text-eyebrow text-muted-foreground",children:"Current team"}),c.length===1?o.jsxs("div",{className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body",style:{color:"var(--fg)"},children:[o.jsx("span",{style:{width:14,display:"inline-flex"},children:o.jsx(ur,{className:"h-3.5 w-3.5"})}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:(L=c[0])==null?void 0:L.displayName}),o.jsx(x1,{role:((O=c[0])==null?void 0:O.role)??C})]}):o.jsx("div",{children:c.map(F=>o.jsxs("button",{type:"button",role:"menuitem",onClick:()=>void _(F.id),className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[o.jsx("span",{style:{width:14,display:"inline-flex"},children:F.id===e?o.jsx(ur,{className:"h-3.5 w-3.5"}):null}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:F.displayName}),o.jsx(x1,{role:F.role})]},F.id))})]}),o.jsxs("div",{className:"border-b py-1",style:{borderColor:"var(--border)"},children:[o.jsxs("button",{type:"button",role:"menuitem",onClick:z,className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[o.jsx(ba,{className:"h-3.5 w-3.5"}),o.jsx("span",{children:"Create new team"})]}),o.jsxs("button",{type:"button",role:"menuitem",onClick:M,className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[o.jsx(pC,{className:"h-3.5 w-3.5"}),o.jsx("span",{children:"Join with invite link"})]})]}),o.jsx("div",{className:"py-1",children:o.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{h(!1),s()},className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[o.jsx(Jz,{className:"h-3.5 w-3.5"}),o.jsx("span",{children:"Sign out"})]})})]})]}),o.jsx(s4,{action:g,onClose:()=>p(null)})]})}function x1({role:e}){return e!=="admin"&&e!=="member"?null:o.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",color:e==="admin"?"var(--accent-dim)":"var(--fg-3)",border:"var(--hairline) solid var(--border)",background:e==="admin"?"var(--accent-bg)":"var(--bg-sunken)"},children:e})}const d4=[{to:"/",label:"Workspace",end:!0,kbd:"⌘1"},{to:"/context",label:"Context",end:!1,kbd:"⌘2"},{to:"/team",label:"Team",end:!1,kbd:"⌘3"},{to:"/settings",label:"Settings",end:!1,kbd:"⌘4"}];function f4(){const[e,t]=x.useState(!1),n=Sr(),a=n.pathname==="/"||n.search.includes("a=");return x.useEffect(()=>{const s=l=>{(l.metaKey||l.ctrlKey)&&l.key.toLowerCase()==="k"&&(l.preventDefault(),t(c=>!c))};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[]),o.jsxs("div",{className:"flex flex-col overflow-hidden",style:{height:"100vh",background:"var(--bg)"},children:[o.jsxs("header",{className:"relative shrink-0 grid items-center",style:{height:48,gridTemplateColumns:"1fr auto 1fr",gap:"var(--sp-3)",padding:"0 var(--sp-3)",borderBottom:"var(--hairline) solid var(--border)",background:"var(--bg-raised)"},children:[o.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-3_5)",justifySelf:"start",minWidth:0},children:[o.jsxs("span",{className:"flex items-center",style:{gap:10,flexShrink:0},children:[o.jsx(Ic,{width:16,height:18,style:{color:"var(--fg)"}}),o.jsx("span",{className:"text-title",style:{color:"var(--fg)"},children:"First Tree"})]}),o.jsx(VI,{})]}),o.jsx("nav",{className:"flex",style:{gap:2,pointerEvents:"none",justifySelf:"center"},children:d4.map(s=>o.jsx(mv,{to:s.to,end:s.end,style:{pointerEvents:"auto"},className:({isActive:l})=>Oe("inline-flex items-center transition-colors",l?"":"hover:text-[var(--fg)]"),children:({isActive:l})=>o.jsxs("span",{className:"inline-flex items-center text-subtitle font-medium",style:{padding:"var(--sp-1_5) var(--sp-3)",gap:6,borderRadius:5,color:l?"var(--fg)":"var(--fg-3)",background:l?"var(--bg-hover)":"transparent"},children:[s.label,l&&o.jsx("span",{className:"kbd",children:s.kbd})]})},s.to))}),o.jsxs("div",{className:"flex items-center",style:{gap:6,justifySelf:"end"},children:[o.jsxs("button",{type:"button",onClick:()=>t(!0),"aria-label":"Open command palette",className:"inline-flex items-center transition-colors text-body",style:{gap:8,padding:"var(--sp-1) var(--sp-2)",color:"var(--fg-3)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)"},onMouseEnter:s=>{s.currentTarget.style.color="var(--fg)"},onMouseLeave:s=>{s.currentTarget.style.color="var(--fg-3)"},children:[o.jsx(dh,{className:"h-4 w-4"}),o.jsx("span",{children:"Jump to…"}),o.jsx("span",{className:"kbd",children:"⌘K"})]}),o.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),o.jsx(e4,{}),o.jsx(n4,{}),o.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),o.jsx(c4,{})]})]}),o.jsx(HI,{open:e,onOpenChange:t}),a?o.jsx(Bf,{}):o.jsx("main",{className:"flex-1 overflow-auto",children:o.jsx("div",{className:"p-6 mx-auto",style:{maxWidth:1280},children:o.jsx(Bf,{})})})]})}const zE=x.createContext(null),h4=5e3;function m4({children:e}){const[t,n]=x.useState([]),a=x.useCallback(c=>{n(d=>d.filter(m=>m.id!==c))},[]),l={addToast:x.useCallback(c=>{const d=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;n(m=>[...m,{...c,id:d}])},[])};return o.jsxs(zE.Provider,{value:l,children:[e,o.jsx(p4,{toasts:t,onDismiss:a})]})}function Lc(){const e=x.useContext(zE);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function p4({toasts:e,onDismiss:t}){return e.length===0?null:o.jsx("div",{style:{position:"fixed",bottom:"var(--sp-4)",right:"var(--sp-4)",zIndex:100,display:"flex",flexDirection:"column",gap:"var(--sp-2)",pointerEvents:"none",maxWidth:380},"aria-live":"polite","aria-atomic":"false",children:e.map(n=>o.jsx(g4,{toast:n,onDismiss:()=>t(n.id)},n.id))})}function g4({toast:e,onDismiss:t}){const n=x.useRef(t);return n.current=t,x.useEffect(()=>{if(e.durationMs===null)return;const a=e.durationMs??h4,s=setTimeout(()=>n.current(),a);return()=>clearTimeout(s)},[e.durationMs]),o.jsxs("div",{role:"status",style:{pointerEvents:"auto",display:"flex",alignItems:"flex-start",gap:"var(--sp-2)",padding:"var(--sp-3) var(--sp-3_5)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",boxShadow:"var(--shadow-md)",animation:"toast-slide-in 180ms ease-out"},children:[o.jsxs("div",{className:"flex-1 min-w-0",style:{display:"flex",flexDirection:"column",gap:"var(--sp-1)"},children:[o.jsx("p",{className:"text-body font-medium",style:{margin:0,color:"var(--fg)"},children:e.title}),e.description?o.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-3)"},children:e.description}):null,e.action?o.jsx("button",{type:"button",onClick:()=>{var a;(a=e.action)==null||a.onClick(),t()},className:"text-label font-medium hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{alignSelf:"flex-start",marginTop:"var(--sp-1)",padding:0,background:"transparent",border:"none",color:"var(--accent)",cursor:"pointer"},children:e.action.label}):null]}),o.jsx("button",{type:"button",onClick:t,"aria-label":"Dismiss",className:"hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{padding:"var(--sp-1)",background:"transparent",border:"none",borderRadius:"var(--radius-input)",cursor:"pointer",color:"var(--fg-4)",flexShrink:0},children:o.jsx(ss,{className:"h-4 w-4"})})]})}function ce(e,t,n){function a(d,m){if(d._zod||Object.defineProperty(d,"_zod",{value:{def:m,constr:c,traits:new Set},enumerable:!1}),d._zod.traits.has(e))return;d._zod.traits.add(e),t(d,m);const h=c.prototype,g=Object.keys(h);for(let p=0;p<g.length;p++){const b=g[p];b in d||(d[b]=h[b].bind(d))}}const s=(n==null?void 0:n.Parent)??Object;class l extends s{}Object.defineProperty(l,"name",{value:e});function c(d){var m;const h=n!=null&&n.Parent?new l:this;a(h,d),(m=h._zod).deferred??(m.deferred=[]);for(const g of h._zod.deferred)g();return h}return Object.defineProperty(c,"init",{value:a}),Object.defineProperty(c,Symbol.hasInstance,{value:d=>{var m,h;return n!=null&&n.Parent&&d instanceof n.Parent?!0:(h=(m=d==null?void 0:d._zod)==null?void 0:m.traits)==null?void 0:h.has(e)}}),Object.defineProperty(c,"name",{value:e}),c}class to extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ME extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const DE={};function cs(e){return DE}function IE(e){const t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,s])=>t.indexOf(+a)===-1).map(([a,s])=>s)}function _y(e,t){return typeof t=="bigint"?t.toString():t}function yh(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Mv(e){return e==null}function Dv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function y4(e,t){const n=(e.toString().split(".")[1]||"").length,a=t.toString();let s=(a.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(a)){const m=a.match(/\d?e-(\d?)/);m!=null&&m[1]&&(s=Number.parseInt(m[1]))}const l=n>s?n:s,c=Number.parseInt(e.toFixed(l).replace(".","")),d=Number.parseInt(t.toFixed(l).replace(".",""));return c%d/10**l}const w1=Symbol("evaluating");function Ct(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==w1)return a===void 0&&(a=w1,a=n()),a},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function tl(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function hs(...e){const t={};for(const n of e){const a=Object.getOwnPropertyDescriptors(n);Object.assign(t,a)}return Object.defineProperties({},t)}function S1(e){return JSON.stringify(e)}function v4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const LE="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function uc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const b4=yh(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function bo(e){if(uc(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(uc(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function PE(e){return bo(e)?{...e}:Array.isArray(e)?[...e]:e}const x4=new Set(["string","number","symbol"]);function xo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ms(e,t,n){const a=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(a._zod.parent=e),a}function Me(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 w4(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const S4={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 k4(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 l=hs(e._zod.def,{get shape(){const c={};for(const d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&(c[d]=n.shape[d])}return tl(this,"shape",c),c},checks:[]});return ms(e,l)}function j4(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 l=hs(e._zod.def,{get shape(){const c={...e._zod.def.shape};for(const d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&delete c[d]}return tl(this,"shape",c),c},checks:[]});return ms(e,l)}function C4(e,t){if(!bo(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const l=e._zod.def.shape;for(const c in t)if(Object.getOwnPropertyDescriptor(l,c)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=hs(e._zod.def,{get shape(){const l={...e._zod.def.shape,...t};return tl(this,"shape",l),l}});return ms(e,s)}function E4(e,t){if(!bo(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=hs(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return tl(this,"shape",a),a}});return ms(e,n)}function N4(e,t){const n=hs(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return tl(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:[]});return ms(e,n)}function _4(e,t,n){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const c=hs(t._zod.def,{get shape(){const d=t._zod.def.shape,m={...d};if(n)for(const h in n){if(!(h in d))throw new Error(`Unrecognized key: "${h}"`);n[h]&&(m[h]=e?new e({type:"optional",innerType:d[h]}):d[h])}else for(const h in d)m[h]=e?new e({type:"optional",innerType:d[h]}):d[h];return tl(this,"shape",m),m},checks:[]});return ms(t,c)}function T4(e,t,n){const a=hs(t._zod.def,{get shape(){const s=t._zod.def.shape,l={...s};if(n)for(const c in n){if(!(c in l))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(l[c]=new e({type:"nonoptional",innerType:s[c]}))}else for(const c in s)l[c]=new e({type:"nonoptional",innerType:s[c]});return tl(this,"shape",l),l}});return ms(t,a)}function Yl(e,t=0){var n;if(e.aborted===!0)return!0;for(let a=t;a<e.issues.length;a++)if(((n=e.issues[a])==null?void 0:n.continue)!==!0)return!0;return!1}function Xl(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function gf(e){return typeof e=="string"?e:e==null?void 0:e.message}function ds(e,t,n){var s,l,c,d,m,h;const a={...e,path:e.path??[]};if(!e.message){const g=gf((c=(l=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:l.error)==null?void 0:c.call(l,e))??gf((d=t==null?void 0:t.error)==null?void 0:d.call(t,e))??gf((m=n.customError)==null?void 0:m.call(n,e))??gf((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";a.message=g}return delete a.inst,delete a.continue,t!=null&&t.reportInput||delete a.input,a}function Iv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function cc(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}const UE=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,_y,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},BE=ce("$ZodError",UE),FE=ce("$ZodError",UE,{Parent:Error});function A4(e,t=n=>n.message){const n={},a=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):a.push(t(s));return{formErrors:a,fieldErrors:n}}function R4(e,t=n=>n.message){const n={_errors:[]},a=s=>{for(const l of s.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(c=>a({issues:c}));else if(l.code==="invalid_key")a({issues:l.issues});else if(l.code==="invalid_element")a({issues:l.issues});else if(l.path.length===0)n._errors.push(t(l));else{let c=n,d=0;for(;d<l.path.length;){const m=l.path[d];d===l.path.length-1?(c[m]=c[m]||{_errors:[]},c[m]._errors.push(t(l))):c[m]=c[m]||{_errors:[]},c=c[m],d++}}};return a(e),n}const Lv=e=>(t,n,a,s)=>{const l=a?Object.assign(a,{async:!1}):{async:!1},c=t._zod.run({value:n,issues:[]},l);if(c instanceof Promise)throw new to;if(c.issues.length){const d=new((s==null?void 0:s.Err)??e)(c.issues.map(m=>ds(m,l,cs())));throw LE(d,s==null?void 0:s.callee),d}return c.value},Pv=e=>async(t,n,a,s)=>{const l=a?Object.assign(a,{async:!0}):{async:!0};let c=t._zod.run({value:n,issues:[]},l);if(c instanceof Promise&&(c=await c),c.issues.length){const d=new((s==null?void 0:s.Err)??e)(c.issues.map(m=>ds(m,l,cs())));throw LE(d,s==null?void 0:s.callee),d}return c.value},vh=e=>(t,n,a)=>{const s=a?{...a,async:!1}:{async:!1},l=t._zod.run({value:n,issues:[]},s);if(l instanceof Promise)throw new to;return l.issues.length?{success:!1,error:new(e??BE)(l.issues.map(c=>ds(c,s,cs())))}:{success:!0,data:l.value}},O4=vh(FE),bh=e=>async(t,n,a)=>{const s=a?Object.assign(a,{async:!0}):{async:!0};let l=t._zod.run({value:n,issues:[]},s);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(c=>ds(c,s,cs())))}:{success:!0,data:l.value}},z4=bh(FE),M4=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Lv(e)(t,n,s)},D4=e=>(t,n,a)=>Lv(e)(t,n,a),I4=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Pv(e)(t,n,s)},L4=e=>async(t,n,a)=>Pv(e)(t,n,a),P4=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return vh(e)(t,n,s)},U4=e=>(t,n,a)=>vh(e)(t,n,a),B4=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return bh(e)(t,n,s)},F4=e=>async(t,n,a)=>bh(e)(t,n,a),$4=/^[cC][^\s-]{8,}$/,H4=/^[0-9a-z]+$/,q4=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Z4=/^[0-9a-vA-V]{20}$/,G4=/^[A-Za-z0-9]{27}$/,V4=/^[a-zA-Z0-9_-]{21}$/,Q4=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,K4=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,k1=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Y4=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,X4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function W4(){return new RegExp(X4,"u")}const J4=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,e5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,t5=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,n5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,r5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$E=/^[A-Za-z0-9_-]*$/,a5=/^\+[1-9]\d{6,14}$/,HE="(?:(?:\\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])))",i5=new RegExp(`^${HE}$`);function qE(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 s5(e){return new RegExp(`^${qE(e)}$`)}function l5(e){const t=qE({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(`^${HE}T(?:${a})$`)}const o5=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}$`)},u5=/^-?\d+$/,ZE=/^-?\d+(?:\.\d+)?$/,c5=/^(?:true|false)$/i,d5=/^null$/i,f5=/^[^A-Z]*$/,h5=/^[^a-z]*$/,jr=ce("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),GE={number:"number",bigint:"bigint",object:"date"},VE=ce("$ZodCheckLessThan",(e,t)=>{jr.init(e,t);const n=GE[typeof t.value];e._zod.onattach.push(a=>{const s=a._zod.bag,l=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<l&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),QE=ce("$ZodCheckGreaterThan",(e,t)=>{jr.init(e,t);const n=GE[typeof t.value];e._zod.onattach.push(a=>{const s=a._zod.bag,l=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>l&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),m5=ce("$ZodCheckMultipleOf",(e,t)=>{jr.init(e,t),e._zod.onattach.push(n=>{var a;(a=n._zod.bag).multipleOf??(a.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):y4(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})}}),p5=ce("$ZodCheckNumberFormat",(e,t)=>{var c;jr.init(e,t),t.format=t.format||"float64";const n=(c=t.format)==null?void 0:c.includes("int"),a=n?"int":"number",[s,l]=S4[t.format];e._zod.onattach.push(d=>{const m=d._zod.bag;m.format=t.format,m.minimum=s,m.maximum=l,n&&(m.pattern=u5)}),e._zod.check=d=>{const m=d.value;if(n){if(!Number.isInteger(m)){d.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:m,inst:e});return}if(!Number.isSafeInteger(m)){m>0?d.issues.push({input:m,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}):d.issues.push({input:m,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort});return}}m<s&&d.issues.push({origin:"number",input:m,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),m>l&&d.issues.push({origin:"number",input:m,code:"too_big",maximum:l,inclusive:!0,inst:e,continue:!t.abort})}}),g5=ce("$ZodCheckMaxLength",(e,t)=>{var n;jr.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Mv(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const s=a.value;if(s.length<=t.maximum)return;const c=Iv(s);a.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),y5=ce("$ZodCheckMinLength",(e,t)=>{var n;jr.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Mv(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const s=a.value;if(s.length>=t.minimum)return;const c=Iv(s);a.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),v5=ce("$ZodCheckLengthEquals",(e,t)=>{var n;jr.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Mv(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=a=>{const s=a.value,l=s.length;if(l===t.length)return;const c=Iv(s),d=l>t.length;a.issues.push({origin:c,...d?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),xh=ce("$ZodCheckStringFormat",(e,t)=>{var n,a;jr.init(e,t),e._zod.onattach.push(s=>{const l=s._zod.bag;l.format=t.format,t.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),b5=ce("$ZodCheckRegex",(e,t)=>{xh.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),x5=ce("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=f5),xh.init(e,t)}),w5=ce("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=h5),xh.init(e,t)}),S5=ce("$ZodCheckIncludes",(e,t)=>{jr.init(e,t);const n=xo(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=a,e._zod.onattach.push(s=>{const l=s._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(a)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),k5=ce("$ZodCheckStartsWith",(e,t)=>{jr.init(e,t);const n=new RegExp(`^${xo(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:e,continue:!t.abort})}}),j5=ce("$ZodCheckEndsWith",(e,t)=>{jr.init(e,t);const n=new RegExp(`.*${xo(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:e,continue:!t.abort})}}),C5=ce("$ZodCheckOverwrite",(e,t)=>{jr.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class E5{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const a=t.split(`
|
|
330
|
+
`).filter(c=>c),s=Math.min(...a.map(c=>c.length-c.trimStart().length)),l=a.map(c=>c.slice(s)).map(c=>" ".repeat(this.indent*2)+c);for(const c of l)this.content.push(c)}compile(){const t=Function,n=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(l=>` ${l}`)];return new t(...n,s.join(`
|
|
331
|
+
`))}}const N5={major:4,minor:3,patch:6},Vt=ce("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=N5;const a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const l of a)for(const c of l._zod.onattach)c(e);if(a.length===0)(n=e._zod).deferred??(n.deferred=[]),(s=e._zod.deferred)==null||s.push(()=>{e._zod.run=e._zod.parse});else{const l=(d,m,h)=>{let g=Yl(d),p;for(const b of m){if(b._zod.def.when){if(!b._zod.def.when(d))continue}else if(g)continue;const w=d.issues.length,S=b._zod.check(d);if(S instanceof Promise&&(h==null?void 0:h.async)===!1)throw new to;if(p||S instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await S,d.issues.length!==w&&(g||(g=Yl(d,w)))});else{if(d.issues.length===w)continue;g||(g=Yl(d,w))}}return p?p.then(()=>d):d},c=(d,m,h)=>{if(Yl(d))return d.aborted=!0,d;const g=l(m,a,h);if(g instanceof Promise){if(h.async===!1)throw new to;return g.then(p=>e._zod.parse(p,h))}return e._zod.parse(g,h)};e._zod.run=(d,m)=>{if(m.skipChecks)return e._zod.parse(d,m);if(m.direction==="backward"){const g=e._zod.parse({value:d.value,issues:[]},{...m,skipChecks:!0});return g instanceof Promise?g.then(p=>c(p,d,m)):c(g,d,m)}const h=e._zod.parse(d,m);if(h instanceof Promise){if(m.async===!1)throw new to;return h.then(g=>l(g,a,m))}return l(h,a,m)}}Ct(e,"~standard",()=>({validate:l=>{var c;try{const d=O4(e,l);return d.success?{value:d.data}:{issues:(c=d.error)==null?void 0:c.issues}}catch{return z4(e,l).then(m=>{var h;return m.success?{value:m.data}:{issues:(h=m.error)==null?void 0:h.issues}})}},vendor:"zod",version:1}))}),Uv=ce("$ZodString",(e,t)=>{var n;Vt.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??o5(e._zod.bag),e._zod.parse=(a,s)=>{if(t.coerce)try{a.value=String(a.value)}catch{}return typeof a.value=="string"||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:e}),a}}),Qt=ce("$ZodStringFormat",(e,t)=>{xh.init(e,t),Uv.init(e,t)}),_5=ce("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=K4),Qt.init(e,t)}),T5=ce("$ZodUUID",(e,t)=>{if(t.version){const a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(a===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=k1(a))}else t.pattern??(t.pattern=k1());Qt.init(e,t)}),A5=ce("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Y4),Qt.init(e,t)}),R5=ce("$ZodURL",(e,t)=>{Qt.init(e,t),e._zod.check=n=>{try{const a=n.value.trim(),s=new URL(a);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=s.href:n.value=a;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),O5=ce("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=W4()),Qt.init(e,t)}),z5=ce("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=V4),Qt.init(e,t)}),M5=ce("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=$4),Qt.init(e,t)}),D5=ce("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=H4),Qt.init(e,t)}),I5=ce("$ZodULID",(e,t)=>{t.pattern??(t.pattern=q4),Qt.init(e,t)}),L5=ce("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Z4),Qt.init(e,t)}),P5=ce("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=G4),Qt.init(e,t)}),U5=ce("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=l5(t)),Qt.init(e,t)}),B5=ce("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=i5),Qt.init(e,t)}),F5=ce("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=s5(t)),Qt.init(e,t)}),$5=ce("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Q4),Qt.init(e,t)}),H5=ce("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=J4),Qt.init(e,t),e._zod.bag.format="ipv4"}),q5=ce("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=e5),Qt.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Z5=ce("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=t5),Qt.init(e,t)}),G5=ce("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=n5),Qt.init(e,t),e._zod.check=n=>{const a=n.value.split("/");try{if(a.length!==2)throw new Error;const[s,l]=a;if(!l)throw new Error;const c=Number(l);if(`${c}`!==l)throw new Error;if(c<0||c>128)throw new Error;new URL(`http://[${s}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function KE(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const V5=ce("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=r5),Qt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{KE(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Q5(e){if(!$E.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return KE(n)}const K5=ce("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=$E),Qt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Q5(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Y5=ce("$ZodE164",(e,t)=>{t.pattern??(t.pattern=a5),Qt.init(e,t)});function X5(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[a]=n;if(!a)return!1;const s=JSON.parse(atob(a));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const W5=ce("$ZodJWT",(e,t)=>{Qt.init(e,t),e._zod.check=n=>{X5(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),YE=ce("$ZodNumber",(e,t)=>{Vt.init(e,t),e._zod.pattern=e._zod.bag.pattern??ZE,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const l=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...l?{received:l}:{}}),n}}),J5=ce("$ZodNumberFormat",(e,t)=>{p5.init(e,t),YE.init(e,t)}),eL=ce("$ZodBoolean",(e,t)=>{Vt.init(e,t),e._zod.pattern=c5,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=!!n.value}catch{}const s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),n}}),tL=ce("$ZodNull",(e,t)=>{Vt.init(e,t),e._zod.pattern=d5,e._zod.values=new Set([null]),e._zod.parse=(n,a)=>{const s=n.value;return s===null||n.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),n}}),nL=ce("$ZodUnknown",(e,t)=>{Vt.init(e,t),e._zod.parse=n=>n}),rL=ce("$ZodNever",(e,t)=>{Vt.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function j1(e,t,n){e.issues.length&&t.issues.push(...Xl(n,e.issues)),t.value[n]=e.value}const aL=ce("$ZodArray",(e,t)=>{Vt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const l=[];for(let c=0;c<s.length;c++){const d=s[c],m=t.element._zod.run({value:d,issues:[]},a);m instanceof Promise?l.push(m.then(h=>j1(h,n,c))):j1(m,n,c)}return l.length?Promise.all(l).then(()=>n):n}});function Zf(e,t,n,a,s){if(e.issues.length){if(s&&!(n in a))return;t.issues.push(...Xl(n,e.issues))}e.value===void 0?n in a&&(t.value[n]=void 0):t.value[n]=e.value}function XE(e){var a,s,l,c;const t=Object.keys(e.shape);for(const d of t)if(!((c=(l=(s=(a=e.shape)==null?void 0:a[d])==null?void 0:s._zod)==null?void 0:l.traits)!=null&&c.has("$ZodType")))throw new Error(`Invalid element at key "${d}": expected a Zod schema`);const n=w4(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function WE(e,t,n,a,s,l){const c=[],d=s.keySet,m=s.catchall._zod,h=m.def.type,g=m.optout==="optional";for(const p in t){if(d.has(p))continue;if(h==="never"){c.push(p);continue}const b=m.run({value:t[p],issues:[]},a);b instanceof Promise?e.push(b.then(w=>Zf(w,n,p,t,g))):Zf(b,n,p,t,g)}return c.length&&n.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:l}),e.length?Promise.all(e).then(()=>n):n}const iL=ce("$ZodObject",(e,t)=>{Vt.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const d=t.shape;Object.defineProperty(t,"shape",{get:()=>{const m={...d};return Object.defineProperty(t,"shape",{value:m}),m}})}const a=yh(()=>XE(t));Ct(e._zod,"propValues",()=>{const d=t.shape,m={};for(const h in d){const g=d[h]._zod;if(g.values){m[h]??(m[h]=new Set);for(const p of g.values)m[h].add(p)}}return m});const s=uc,l=t.catchall;let c;e._zod.parse=(d,m)=>{c??(c=a.value);const h=d.value;if(!s(h))return d.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),d;d.value={};const g=[],p=c.shape;for(const b of c.keys){const w=p[b],S=w._zod.optout==="optional",j=w._zod.run({value:h[b],issues:[]},m);j instanceof Promise?g.push(j.then(E=>Zf(E,d,b,h,S))):Zf(j,d,b,h,S)}return l?WE(g,h,d,m,a.value,e):g.length?Promise.all(g).then(()=>d):d}}),sL=ce("$ZodObjectJIT",(e,t)=>{iL.init(e,t);const n=e._zod.parse,a=yh(()=>XE(t)),s=b=>{var z;const w=new E5(["shape","payload","ctx"]),S=a.value,j=M=>{const L=S1(M);return`shape[${L}]._zod.run({ value: input[${L}], issues: [] }, ctx)`};w.write("const input = payload.value;");const E=Object.create(null);let C=0;for(const M of S.keys)E[M]=`key_${C++}`;w.write("const newResult = {};");for(const M of S.keys){const L=E[M],O=S1(M),F=b[M],P=((z=F==null?void 0:F._zod)==null?void 0:z.optout)==="optional";w.write(`const ${L} = ${j(M)};`),P?w.write(`
|
|
332
|
+
if (${L}.issues.length) {
|
|
333
|
+
if (${O} in input) {
|
|
334
|
+
payload.issues = payload.issues.concat(${L}.issues.map(iss => ({
|
|
335
|
+
...iss,
|
|
336
|
+
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
337
|
+
})));
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (${L}.value === undefined) {
|
|
342
|
+
if (${O} in input) {
|
|
343
|
+
newResult[${O}] = undefined;
|
|
344
|
+
}
|
|
345
|
+
} else {
|
|
346
|
+
newResult[${O}] = ${L}.value;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
`):w.write(`
|
|
350
|
+
if (${L}.issues.length) {
|
|
351
|
+
payload.issues = payload.issues.concat(${L}.issues.map(iss => ({
|
|
352
|
+
...iss,
|
|
353
|
+
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
354
|
+
})));
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (${L}.value === undefined) {
|
|
358
|
+
if (${O} in input) {
|
|
359
|
+
newResult[${O}] = undefined;
|
|
360
|
+
}
|
|
361
|
+
} else {
|
|
362
|
+
newResult[${O}] = ${L}.value;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
`)}w.write("payload.value = newResult;"),w.write("return payload;");const _=w.compile();return(M,L)=>_(b,M,L)};let l;const c=uc,d=!DE.jitless,h=d&&b4.value,g=t.catchall;let p;e._zod.parse=(b,w)=>{p??(p=a.value);const S=b.value;return c(S)?d&&h&&(w==null?void 0:w.async)===!1&&w.jitless!==!0?(l||(l=s(t.shape)),b=l(b,w),g?WE([],S,b,w,p,e):b):n(b,w):(b.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),b)}});function C1(e,t,n,a){for(const l of e)if(l.issues.length===0)return t.value=l.value,t;const s=e.filter(l=>!Yl(l));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(l=>l.issues.map(c=>ds(c,a,cs())))}),t)}const JE=ce("$ZodUnion",(e,t)=>{Vt.init(e,t),Ct(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),Ct(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),Ct(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),Ct(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(l=>l._zod.pattern);return new RegExp(`^(${s.map(l=>Dv(l.source)).join("|")})$`)}});const n=t.options.length===1,a=t.options[0]._zod.run;e._zod.parse=(s,l)=>{if(n)return a(s,l);let c=!1;const d=[];for(const m of t.options){const h=m._zod.run({value:s.value,issues:[]},l);if(h instanceof Promise)d.push(h),c=!0;else{if(h.issues.length===0)return h;d.push(h)}}return c?Promise.all(d).then(m=>C1(m,s,e,l)):C1(d,s,e,l)}}),lL=ce("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,JE.init(e,t);const n=e._zod.parse;Ct(e._zod,"propValues",()=>{const s={};for(const l of t.options){const c=l._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(l)}"`);for(const[d,m]of Object.entries(c)){s[d]||(s[d]=new Set);for(const h of m)s[d].add(h)}}return s});const a=yh(()=>{var c;const s=t.options,l=new Map;for(const d of s){const m=(c=d._zod.propValues)==null?void 0:c[t.discriminator];if(!m||m.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(d)}"`);for(const h of m){if(l.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);l.set(h,d)}}return l});e._zod.parse=(s,l)=>{const c=s.value;if(!uc(c))return s.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),s;const d=a.value.get(c==null?void 0:c[t.discriminator]);return d?d._zod.run(s,l):t.unionFallback?n(s,l):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:c,path:[t.discriminator],inst:e}),s)}}),oL=ce("$ZodIntersection",(e,t)=>{Vt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value,l=t.left._zod.run({value:s,issues:[]},a),c=t.right._zod.run({value:s,issues:[]},a);return l instanceof Promise||c instanceof Promise?Promise.all([l,c]).then(([m,h])=>E1(n,m,h)):E1(n,l,c)}});function Ty(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(bo(e)&&bo(t)){const n=Object.keys(t),a=Object.keys(e).filter(l=>n.indexOf(l)!==-1),s={...e,...t};for(const l of a){const c=Ty(e[l],t[l]);if(!c.valid)return{valid:!1,mergeErrorPath:[l,...c.mergeErrorPath]};s[l]=c.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let a=0;a<e.length;a++){const s=e[a],l=t[a],c=Ty(s,l);if(!c.valid)return{valid:!1,mergeErrorPath:[a,...c.mergeErrorPath]};n.push(c.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function E1(e,t,n){const a=new Map;let s;for(const d of t.issues)if(d.code==="unrecognized_keys"){s??(s=d);for(const m of d.keys)a.has(m)||a.set(m,{}),a.get(m).l=!0}else e.issues.push(d);for(const d of n.issues)if(d.code==="unrecognized_keys")for(const m of d.keys)a.has(m)||a.set(m,{}),a.get(m).r=!0;else e.issues.push(d);const l=[...a].filter(([,d])=>d.l&&d.r).map(([d])=>d);if(l.length&&s&&e.issues.push({...s,keys:l}),Yl(e))return e;const c=Ty(t.value,n.value);if(!c.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`);return e.value=c.data,e}const uL=ce("$ZodRecord",(e,t)=>{Vt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value;if(!bo(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;const l=[],c=t.keyType._zod.values;if(c){n.value={};const d=new Set;for(const h of c)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){d.add(typeof h=="number"?h.toString():h);const g=t.valueType._zod.run({value:s[h],issues:[]},a);g instanceof Promise?l.push(g.then(p=>{p.issues.length&&n.issues.push(...Xl(h,p.issues)),n.value[h]=p.value})):(g.issues.length&&n.issues.push(...Xl(h,g.issues)),n.value[h]=g.value)}let m;for(const h in s)d.has(h)||(m=m??[],m.push(h));m&&m.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:m})}else{n.value={};for(const d of Reflect.ownKeys(s)){if(d==="__proto__")continue;let m=t.keyType._zod.run({value:d,issues:[]},a);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof d=="string"&&ZE.test(d)&&m.issues.length){const p=t.keyType._zod.run({value:Number(d),issues:[]},a);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(m=p)}if(m.issues.length){t.mode==="loose"?n.value[d]=s[d]:n.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map(p=>ds(p,a,cs())),input:d,path:[d],inst:e});continue}const g=t.valueType._zod.run({value:s[d],issues:[]},a);g instanceof Promise?l.push(g.then(p=>{p.issues.length&&n.issues.push(...Xl(d,p.issues)),n.value[m.value]=p.value})):(g.issues.length&&n.issues.push(...Xl(d,g.issues)),n.value[m.value]=g.value)}}return l.length?Promise.all(l).then(()=>n):n}}),cL=ce("$ZodEnum",(e,t)=>{Vt.init(e,t);const n=IE(t.entries),a=new Set(n);e._zod.values=a,e._zod.pattern=new RegExp(`^(${n.filter(s=>x4.has(typeof s)).map(s=>typeof s=="string"?xo(s):s.toString()).join("|")})$`),e._zod.parse=(s,l)=>{const c=s.value;return a.has(c)||s.issues.push({code:"invalid_value",values:n,input:c,inst:e}),s}}),dL=ce("$ZodLiteral",(e,t)=>{if(Vt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(a=>typeof a=="string"?xo(a):a?xo(a.toString()):String(a)).join("|")})$`),e._zod.parse=(a,s)=>{const l=a.value;return n.has(l)||a.issues.push({code:"invalid_value",values:t.values,input:l,inst:e}),a}}),fL=ce("$ZodTransform",(e,t)=>{Vt.init(e,t),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new ME(e.constructor.name);const s=t.transform(n.value,n);if(a.async)return(s instanceof Promise?s:Promise.resolve(s)).then(c=>(n.value=c,n));if(s instanceof Promise)throw new to;return n.value=s,n}});function N1(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const eN=ce("$ZodOptional",(e,t)=>{Vt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ct(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ct(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Dv(n.source)})?$`):void 0}),e._zod.parse=(n,a)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(l=>N1(l,n.value)):N1(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,a)}}),hL=ce("$ZodExactOptional",(e,t)=>{eN.init(e,t),Ct(e._zod,"values",()=>t.innerType._zod.values),Ct(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,a)=>t.innerType._zod.run(n,a)}),mL=ce("$ZodNullable",(e,t)=>{Vt.init(e,t),Ct(e._zod,"optin",()=>t.innerType._zod.optin),Ct(e._zod,"optout",()=>t.innerType._zod.optout),Ct(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Dv(n.source)}|null)$`):void 0}),Ct(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,a)=>n.value===null?n:t.innerType._zod.run(n,a)}),pL=ce("$ZodDefault",(e,t)=>{Vt.init(e,t),e._zod.optin="optional",Ct(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(l=>_1(l,t)):_1(s,t)}});function _1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const gL=ce("$ZodPrefault",(e,t)=>{Vt.init(e,t),e._zod.optin="optional",Ct(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>(a.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,a))}),yL=ce("$ZodNonOptional",(e,t)=>{Vt.init(e,t),Ct(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(a=>a!==void 0)):void 0}),e._zod.parse=(n,a)=>{const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(l=>T1(l,e)):T1(s,e)}});function T1(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const vL=ce("$ZodCatch",(e,t)=>{Vt.init(e,t),Ct(e._zod,"optin",()=>t.innerType._zod.optin),Ct(e._zod,"optout",()=>t.innerType._zod.optout),Ct(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(l=>(n.value=l.value,l.issues.length&&(n.value=t.catchValue({...n,error:{issues:l.issues.map(c=>ds(c,a,cs()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(l=>ds(l,a,cs()))},input:n.value}),n.issues=[]),n)}}),bL=ce("$ZodPipe",(e,t)=>{Vt.init(e,t),Ct(e._zod,"values",()=>t.in._zod.values),Ct(e._zod,"optin",()=>t.in._zod.optin),Ct(e._zod,"optout",()=>t.out._zod.optout),Ct(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,a)=>{if(a.direction==="backward"){const l=t.out._zod.run(n,a);return l instanceof Promise?l.then(c=>yf(c,t.in,a)):yf(l,t.in,a)}const s=t.in._zod.run(n,a);return s instanceof Promise?s.then(l=>yf(l,t.out,a)):yf(s,t.out,a)}});function yf(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const xL=ce("$ZodReadonly",(e,t)=>{Vt.init(e,t),Ct(e._zod,"propValues",()=>t.innerType._zod.propValues),Ct(e._zod,"values",()=>t.innerType._zod.values),Ct(e._zod,"optin",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optin}),Ct(e._zod,"optout",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optout}),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(A1):A1(s)}});function A1(e){return e.value=Object.freeze(e.value),e}const wL=ce("$ZodCustom",(e,t)=>{jr.init(e,t),Vt.init(e,t),e._zod.parse=(n,a)=>n,e._zod.check=n=>{const a=n.value,s=t.fn(a);if(s instanceof Promise)return s.then(l=>R1(l,n,a,e));R1(s,n,a,e)}});function R1(e,t,n,a){if(!e){const s={code:"custom",input:n,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(s.params=a._zod.def.params),t.issues.push(cc(s))}}var O1;class SL{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const a=n[0];return this._map.set(t,a),a&&typeof a=="object"&&"id"in a&&this._idmap.set(a.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const a={...this.get(n)??{}};delete a.id;const s={...a,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function kL(){return new SL}(O1=globalThis).__zod_globalRegistry??(O1.__zod_globalRegistry=kL());const Qu=globalThis.__zod_globalRegistry;function jL(e,t){return new e({type:"string",...Me(t)})}function CL(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Me(t)})}function z1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Me(t)})}function EL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Me(t)})}function NL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Me(t)})}function _L(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Me(t)})}function TL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Me(t)})}function AL(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Me(t)})}function RL(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Me(t)})}function OL(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Me(t)})}function zL(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Me(t)})}function ML(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Me(t)})}function DL(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Me(t)})}function IL(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Me(t)})}function LL(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Me(t)})}function PL(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Me(t)})}function UL(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Me(t)})}function BL(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Me(t)})}function FL(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Me(t)})}function $L(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Me(t)})}function HL(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Me(t)})}function qL(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Me(t)})}function ZL(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Me(t)})}function GL(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Me(t)})}function VL(e,t){return new e({type:"string",format:"date",check:"string_format",...Me(t)})}function QL(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Me(t)})}function KL(e,t){return new e({type:"string",format:"duration",check:"string_format",...Me(t)})}function YL(e,t){return new e({type:"number",checks:[],...Me(t)})}function XL(e,t){return new e({type:"number",coerce:!0,checks:[],...Me(t)})}function WL(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Me(t)})}function JL(e,t){return new e({type:"boolean",...Me(t)})}function eP(e,t){return new e({type:"null",...Me(t)})}function tP(e){return new e({type:"unknown"})}function nP(e,t){return new e({type:"never",...Me(t)})}function M1(e,t){return new VE({check:"less_than",...Me(t),value:e,inclusive:!1})}function ug(e,t){return new VE({check:"less_than",...Me(t),value:e,inclusive:!0})}function D1(e,t){return new QE({check:"greater_than",...Me(t),value:e,inclusive:!1})}function cg(e,t){return new QE({check:"greater_than",...Me(t),value:e,inclusive:!0})}function I1(e,t){return new m5({check:"multiple_of",...Me(t),value:e})}function tN(e,t){return new g5({check:"max_length",...Me(t),maximum:e})}function Gf(e,t){return new y5({check:"min_length",...Me(t),minimum:e})}function nN(e,t){return new v5({check:"length_equals",...Me(t),length:e})}function rP(e,t){return new b5({check:"string_format",format:"regex",...Me(t),pattern:e})}function aP(e){return new x5({check:"string_format",format:"lowercase",...Me(e)})}function iP(e){return new w5({check:"string_format",format:"uppercase",...Me(e)})}function sP(e,t){return new S5({check:"string_format",format:"includes",...Me(t),includes:e})}function lP(e,t){return new k5({check:"string_format",format:"starts_with",...Me(t),prefix:e})}function oP(e,t){return new j5({check:"string_format",format:"ends_with",...Me(t),suffix:e})}function _o(e){return new C5({check:"overwrite",tx:e})}function uP(e){return _o(t=>t.normalize(e))}function cP(){return _o(e=>e.trim())}function dP(){return _o(e=>e.toLowerCase())}function fP(){return _o(e=>e.toUpperCase())}function hP(){return _o(e=>v4(e))}function mP(e,t,n){return new e({type:"array",element:t,...Me(n)})}function pP(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Me(n)})}function gP(e){const t=yP(n=>(n.addIssue=a=>{if(typeof a=="string")n.issues.push(cc(a,n.value,t._zod.def));else{const s=a;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),n.issues.push(cc(s))}},e(n.value,n)));return t}function yP(e,t){const n=new jr({check:"custom",...Me(t)});return n._zod.check=e,n}function rN(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Qu,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function kn(e,t,n={path:[],schemaPath:[]}){var g,p;var a;const s=e._zod.def,l=t.seen.get(e);if(l)return l.count++,n.schemaPath.includes(e)&&(l.cycle=n.path),l.schema;const c={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,c);const d=(p=(g=e._zod).toJSONSchema)==null?void 0:p.call(g);if(d)c.schema=d;else{const b={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,b);else{const S=c.schema,j=t.processors[s.type];if(!j)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);j(e,t,S,b)}const w=e._zod.parent;w&&(c.ref||(c.ref=w),kn(w,t,b),t.seen.get(w).isParent=!0)}const m=t.metadataRegistry.get(e);return m&&Object.assign(c.schema,m),t.io==="input"&&ar(e)&&(delete c.schema.examples,delete c.schema.default),t.io==="input"&&c.schema._prefault&&((a=c.schema).default??(a.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}function aN(e,t){var c,d,m,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=new Map;for(const g of e.seen.entries()){const p=(c=e.metadataRegistry.get(g[0]))==null?void 0:c.id;if(p){const b=a.get(p);if(b&&b!==g[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(p,g[0])}}const s=g=>{var j;const p=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const E=(j=e.external.registry.get(g[0]))==null?void 0:j.id,C=e.external.uri??(z=>z);if(E)return{ref:C(E)};const _=g[1].defId??g[1].schema.id??`schema${e.counter++}`;return g[1].defId=_,{defId:_,ref:`${C("__shared")}#/${p}/${_}`}}if(g[1]===n)return{ref:"#"};const w=`#/${p}/`,S=g[1].schema.id??`__schema${e.counter++}`;return{defId:S,ref:w+S}},l=g=>{if(g[1].schema.$ref)return;const p=g[1],{ref:b,defId:w}=s(g);p.def={...p.schema},w&&(p.defId=w);const S=p.schema;for(const j in S)delete S[j];S.$ref=b};if(e.cycles==="throw")for(const g of e.seen.entries()){const p=g[1];if(p.cycle)throw new Error(`Cycle detected: #/${(d=p.cycle)==null?void 0:d.join("/")}/<root>
|
|
366
|
+
|
|
367
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const g of e.seen.entries()){const p=g[1];if(t===g[0]){l(g);continue}if(e.external){const w=(m=e.external.registry.get(g[0]))==null?void 0:m.id;if(t!==g[0]&&w){l(g);continue}}if((h=e.metadataRegistry.get(g[0]))==null?void 0:h.id){l(g);continue}if(p.cycle){l(g);continue}if(p.count>1&&e.reused==="ref"){l(g);continue}}}function iN(e,t){var c,d,m;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=h=>{const g=e.seen.get(h);if(g.ref===null)return;const p=g.def??g.schema,b={...p},w=g.ref;if(g.ref=null,w){a(w);const j=e.seen.get(w),E=j.schema;if(E.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(E)):Object.assign(p,E),Object.assign(p,b),h._zod.parent===w)for(const _ in p)_==="$ref"||_==="allOf"||_ in b||delete p[_];if(E.$ref&&j.def)for(const _ in p)_==="$ref"||_==="allOf"||_ in j.def&&JSON.stringify(p[_])===JSON.stringify(j.def[_])&&delete p[_]}const S=h._zod.parent;if(S&&S!==w){a(S);const j=e.seen.get(S);if(j!=null&&j.schema.$ref&&(p.$ref=j.schema.$ref,j.def))for(const E in p)E==="$ref"||E==="allOf"||E in j.def&&JSON.stringify(p[E])===JSON.stringify(j.def[E])&&delete p[E]}e.override({zodSchema:h,jsonSchema:p,path:g.path??[]})};for(const h of[...e.seen.entries()].reverse())a(h[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,(c=e.external)!=null&&c.uri){const h=(d=e.external.registry.get(t))==null?void 0:d.id;if(!h)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(h)}Object.assign(s,n.def??n.schema);const l=((m=e.external)==null?void 0:m.defs)??{};for(const h of e.seen.entries()){const g=h[1];g.def&&g.defId&&(l[g.defId]=g.def)}e.external||Object.keys(l).length>0&&(e.target==="draft-2020-12"?s.$defs=l:s.definitions=l);try{const h=JSON.parse(JSON.stringify(s));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input:Vf(t,"input",e.processors),output:Vf(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function ar(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return ar(a.element,n);if(a.type==="set")return ar(a.valueType,n);if(a.type==="lazy")return ar(a.getter(),n);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault")return ar(a.innerType,n);if(a.type==="intersection")return ar(a.left,n)||ar(a.right,n);if(a.type==="record"||a.type==="map")return ar(a.keyType,n)||ar(a.valueType,n);if(a.type==="pipe")return ar(a.in,n)||ar(a.out,n);if(a.type==="object"){for(const s in a.shape)if(ar(a.shape[s],n))return!0;return!1}if(a.type==="union"){for(const s of a.options)if(ar(s,n))return!0;return!1}if(a.type==="tuple"){for(const s of a.items)if(ar(s,n))return!0;return!!(a.rest&&ar(a.rest,n))}return!1}const vP=(e,t={})=>n=>{const a=rN({...n,processors:t});return kn(e,a),aN(a,e),iN(a,e)},Vf=(e,t,n={})=>a=>{const{libraryOptions:s,target:l}=a??{},c=rN({...s??{},target:l,io:t,processors:n});return kn(e,c),aN(c,e),iN(c,e)},bP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},xP=(e,t,n,a)=>{const s=n;s.type="string";const{minimum:l,maximum:c,format:d,patterns:m,contentEncoding:h}=e._zod.bag;if(typeof l=="number"&&(s.minLength=l),typeof c=="number"&&(s.maxLength=c),d&&(s.format=bP[d]??d,s.format===""&&delete s.format,d==="time"&&delete s.format),h&&(s.contentEncoding=h),m&&m.size>0){const g=[...m];g.length===1?s.pattern=g[0].source:g.length>1&&(s.allOf=[...g.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},wP=(e,t,n,a)=>{const s=n,{minimum:l,maximum:c,format:d,multipleOf:m,exclusiveMaximum:h,exclusiveMinimum:g}=e._zod.bag;typeof d=="string"&&d.includes("int")?s.type="integer":s.type="number",typeof g=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.minimum=g,s.exclusiveMinimum=!0):s.exclusiveMinimum=g),typeof l=="number"&&(s.minimum=l,typeof g=="number"&&t.target!=="draft-04"&&(g>=l?delete s.minimum:delete s.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.maximum=h,s.exclusiveMaximum=!0):s.exclusiveMaximum=h),typeof c=="number"&&(s.maximum=c,typeof h=="number"&&t.target!=="draft-04"&&(h<=c?delete s.maximum:delete s.exclusiveMaximum)),typeof m=="number"&&(s.multipleOf=m)},SP=(e,t,n,a)=>{n.type="boolean"},kP=(e,t,n,a)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},jP=(e,t,n,a)=>{n.not={}},CP=(e,t,n,a)=>{},EP=(e,t,n,a)=>{const s=e._zod.def,l=IE(s.entries);l.every(c=>typeof c=="number")&&(n.type="number"),l.every(c=>typeof c=="string")&&(n.type="string"),n.enum=l},NP=(e,t,n,a)=>{const s=e._zod.def,l=[];for(const c of s.values)if(c===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof c=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");l.push(Number(c))}else l.push(c);if(l.length!==0)if(l.length===1){const c=l[0];n.type=c===null?"null":typeof c,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[c]:n.const=c}else l.every(c=>typeof c=="number")&&(n.type="number"),l.every(c=>typeof c=="string")&&(n.type="string"),l.every(c=>typeof c=="boolean")&&(n.type="boolean"),l.every(c=>c===null)&&(n.type="null"),n.enum=l},_P=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},TP=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},AP=(e,t,n,a)=>{const s=n,l=e._zod.def,{minimum:c,maximum:d}=e._zod.bag;typeof c=="number"&&(s.minItems=c),typeof d=="number"&&(s.maxItems=d),s.type="array",s.items=kn(l.element,t,{...a,path:[...a.path,"items"]})},RP=(e,t,n,a)=>{var h;const s=n,l=e._zod.def;s.type="object",s.properties={};const c=l.shape;for(const g in c)s.properties[g]=kn(c[g],t,{...a,path:[...a.path,"properties",g]});const d=new Set(Object.keys(c)),m=new Set([...d].filter(g=>{const p=l.shape[g]._zod;return t.io==="input"?p.optin===void 0:p.optout===void 0}));m.size>0&&(s.required=Array.from(m)),((h=l.catchall)==null?void 0:h._zod.def.type)==="never"?s.additionalProperties=!1:l.catchall?l.catchall&&(s.additionalProperties=kn(l.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},OP=(e,t,n,a)=>{const s=e._zod.def,l=s.inclusive===!1,c=s.options.map((d,m)=>kn(d,t,{...a,path:[...a.path,l?"oneOf":"anyOf",m]}));l?n.oneOf=c:n.anyOf=c},zP=(e,t,n,a)=>{const s=e._zod.def,l=kn(s.left,t,{...a,path:[...a.path,"allOf",0]}),c=kn(s.right,t,{...a,path:[...a.path,"allOf",1]}),d=h=>"allOf"in h&&Object.keys(h).length===1,m=[...d(l)?l.allOf:[l],...d(c)?c.allOf:[c]];n.allOf=m},MP=(e,t,n,a)=>{const s=n,l=e._zod.def;s.type="object";const c=l.keyType,d=c._zod.bag,m=d==null?void 0:d.patterns;if(l.mode==="loose"&&m&&m.size>0){const g=kn(l.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});s.patternProperties={};for(const p of m)s.patternProperties[p.source]=g}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(s.propertyNames=kn(l.keyType,t,{...a,path:[...a.path,"propertyNames"]})),s.additionalProperties=kn(l.valueType,t,{...a,path:[...a.path,"additionalProperties"]});const h=c._zod.values;if(h){const g=[...h].filter(p=>typeof p=="string"||typeof p=="number");g.length>0&&(s.required=g)}},DP=(e,t,n,a)=>{const s=e._zod.def,l=kn(s.innerType,t,a),c=t.seen.get(e);t.target==="openapi-3.0"?(c.ref=s.innerType,n.nullable=!0):n.anyOf=[l,{type:"null"}]},IP=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const l=t.seen.get(e);l.ref=s.innerType},LP=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const l=t.seen.get(e);l.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},PP=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const l=t.seen.get(e);l.ref=s.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},UP=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const l=t.seen.get(e);l.ref=s.innerType;let c;try{c=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=c},BP=(e,t,n,a)=>{const s=e._zod.def,l=t.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;kn(l,t,a);const c=t.seen.get(e);c.ref=l},FP=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const l=t.seen.get(e);l.ref=s.innerType,n.readOnly=!0},sN=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const l=t.seen.get(e);l.ref=s.innerType},$P=ce("ZodISODateTime",(e,t)=>{U5.init(e,t),Jt.init(e,t)});function HP(e){return GL($P,e)}const qP=ce("ZodISODate",(e,t)=>{B5.init(e,t),Jt.init(e,t)});function ZP(e){return VL(qP,e)}const GP=ce("ZodISOTime",(e,t)=>{F5.init(e,t),Jt.init(e,t)});function VP(e){return QL(GP,e)}const QP=ce("ZodISODuration",(e,t)=>{$5.init(e,t),Jt.init(e,t)});function KP(e){return KL(QP,e)}const YP=(e,t)=>{BE.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>R4(e,n)},flatten:{value:n=>A4(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,_y,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,_y,2)}},isEmpty:{get(){return e.issues.length===0}}})},sa=ce("ZodError",YP,{Parent:Error}),XP=Lv(sa),WP=Pv(sa),JP=vh(sa),eU=bh(sa),tU=M4(sa),nU=D4(sa),rU=I4(sa),aU=L4(sa),iU=P4(sa),sU=U4(sa),lU=B4(sa),oU=F4(sa),Kt=ce("ZodType",(e,t)=>(Vt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Vf(e,"input"),output:Vf(e,"output")}}),e.toJSONSchema=vP(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(hs(t,{checks:[...t.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0}),e.with=e.check,e.clone=(n,a)=>ms(e,n,a),e.brand=()=>e,e.register=((n,a)=>(n.add(e,a),e)),e.parse=(n,a)=>XP(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>JP(e,n,a),e.parseAsync=async(n,a)=>WP(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>eU(e,n,a),e.spa=e.safeParseAsync,e.encode=(n,a)=>tU(e,n,a),e.decode=(n,a)=>nU(e,n,a),e.encodeAsync=async(n,a)=>rU(e,n,a),e.decodeAsync=async(n,a)=>aU(e,n,a),e.safeEncode=(n,a)=>iU(e,n,a),e.safeDecode=(n,a)=>sU(e,n,a),e.safeEncodeAsync=async(n,a)=>lU(e,n,a),e.safeDecodeAsync=async(n,a)=>oU(e,n,a),e.refine=(n,a)=>e.check(n6(n,a)),e.superRefine=n=>e.check(r6(n)),e.overwrite=n=>e.check(_o(n)),e.optional=()=>U1(e),e.exactOptional=()=>HU(e),e.nullable=()=>B1(e),e.nullish=()=>U1(B1(e)),e.nonoptional=n=>KU(e,n),e.array=()=>mt(e),e.or=n=>Fv([e,n]),e.and=n=>PU(e,n),e.transform=n=>Ry(e,uN(n)),e.default=n=>GU(e,n),e.prefault=n=>QU(e,n),e.catch=n=>XU(e,n),e.pipe=n=>Ry(e,n),e.readonly=()=>e6(e),e.describe=n=>{const a=e.clone();return Qu.add(a,{description:n}),a},Object.defineProperty(e,"description",{get(){var n;return(n=Qu.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Qu.get(e);const a=e.clone();return Qu.add(a,n[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),lN=ce("_ZodString",(e,t)=>{Uv.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(a,s,l)=>xP(e,a,s);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...a)=>e.check(rP(...a)),e.includes=(...a)=>e.check(sP(...a)),e.startsWith=(...a)=>e.check(lP(...a)),e.endsWith=(...a)=>e.check(oP(...a)),e.min=(...a)=>e.check(Gf(...a)),e.max=(...a)=>e.check(tN(...a)),e.length=(...a)=>e.check(nN(...a)),e.nonempty=(...a)=>e.check(Gf(1,...a)),e.lowercase=a=>e.check(aP(a)),e.uppercase=a=>e.check(iP(a)),e.trim=()=>e.check(cP()),e.normalize=(...a)=>e.check(uP(...a)),e.toLowerCase=()=>e.check(dP()),e.toUpperCase=()=>e.check(fP()),e.slugify=()=>e.check(hP())}),uU=ce("ZodString",(e,t)=>{Uv.init(e,t),lN.init(e,t),e.email=n=>e.check(CL(cU,n)),e.url=n=>e.check(AL(dU,n)),e.jwt=n=>e.check(ZL(EU,n)),e.emoji=n=>e.check(RL(fU,n)),e.guid=n=>e.check(z1(L1,n)),e.uuid=n=>e.check(EL(vf,n)),e.uuidv4=n=>e.check(NL(vf,n)),e.uuidv6=n=>e.check(_L(vf,n)),e.uuidv7=n=>e.check(TL(vf,n)),e.nanoid=n=>e.check(OL(hU,n)),e.guid=n=>e.check(z1(L1,n)),e.cuid=n=>e.check(zL(mU,n)),e.cuid2=n=>e.check(ML(pU,n)),e.ulid=n=>e.check(DL(gU,n)),e.base64=n=>e.check($L(kU,n)),e.base64url=n=>e.check(HL(jU,n)),e.xid=n=>e.check(IL(yU,n)),e.ksuid=n=>e.check(LL(vU,n)),e.ipv4=n=>e.check(PL(bU,n)),e.ipv6=n=>e.check(UL(xU,n)),e.cidrv4=n=>e.check(BL(wU,n)),e.cidrv6=n=>e.check(FL(SU,n)),e.e164=n=>e.check(qL(CU,n)),e.datetime=n=>e.check(HP(n)),e.date=n=>e.check(ZP(n)),e.time=n=>e.check(VP(n)),e.duration=n=>e.check(KP(n))});function N(e){return jL(uU,e)}const Jt=ce("ZodStringFormat",(e,t)=>{Qt.init(e,t),lN.init(e,t)}),cU=ce("ZodEmail",(e,t)=>{A5.init(e,t),Jt.init(e,t)}),L1=ce("ZodGUID",(e,t)=>{_5.init(e,t),Jt.init(e,t)}),vf=ce("ZodUUID",(e,t)=>{T5.init(e,t),Jt.init(e,t)}),dU=ce("ZodURL",(e,t)=>{R5.init(e,t),Jt.init(e,t)}),fU=ce("ZodEmoji",(e,t)=>{O5.init(e,t),Jt.init(e,t)}),hU=ce("ZodNanoID",(e,t)=>{z5.init(e,t),Jt.init(e,t)}),mU=ce("ZodCUID",(e,t)=>{M5.init(e,t),Jt.init(e,t)}),pU=ce("ZodCUID2",(e,t)=>{D5.init(e,t),Jt.init(e,t)}),gU=ce("ZodULID",(e,t)=>{I5.init(e,t),Jt.init(e,t)}),yU=ce("ZodXID",(e,t)=>{L5.init(e,t),Jt.init(e,t)}),vU=ce("ZodKSUID",(e,t)=>{P5.init(e,t),Jt.init(e,t)}),bU=ce("ZodIPv4",(e,t)=>{H5.init(e,t),Jt.init(e,t)}),xU=ce("ZodIPv6",(e,t)=>{q5.init(e,t),Jt.init(e,t)}),wU=ce("ZodCIDRv4",(e,t)=>{Z5.init(e,t),Jt.init(e,t)}),SU=ce("ZodCIDRv6",(e,t)=>{G5.init(e,t),Jt.init(e,t)}),kU=ce("ZodBase64",(e,t)=>{V5.init(e,t),Jt.init(e,t)}),jU=ce("ZodBase64URL",(e,t)=>{K5.init(e,t),Jt.init(e,t)}),CU=ce("ZodE164",(e,t)=>{Y5.init(e,t),Jt.init(e,t)}),EU=ce("ZodJWT",(e,t)=>{W5.init(e,t),Jt.init(e,t)}),Bv=ce("ZodNumber",(e,t)=>{YE.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(a,s,l)=>wP(e,a,s),e.gt=(a,s)=>e.check(D1(a,s)),e.gte=(a,s)=>e.check(cg(a,s)),e.min=(a,s)=>e.check(cg(a,s)),e.lt=(a,s)=>e.check(M1(a,s)),e.lte=(a,s)=>e.check(ug(a,s)),e.max=(a,s)=>e.check(ug(a,s)),e.int=a=>e.check(P1(a)),e.safe=a=>e.check(P1(a)),e.positive=a=>e.check(D1(0,a)),e.nonnegative=a=>e.check(cg(0,a)),e.negative=a=>e.check(M1(0,a)),e.nonpositive=a=>e.check(ug(0,a)),e.multipleOf=(a,s)=>e.check(I1(a,s)),e.step=(a,s)=>e.check(I1(a,s)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function qe(e){return YL(Bv,e)}const NU=ce("ZodNumberFormat",(e,t)=>{J5.init(e,t),Bv.init(e,t)});function P1(e){return WL(NU,e)}const _U=ce("ZodBoolean",(e,t)=>{eL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>SP(e,n,a)});function Xn(e){return JL(_U,e)}const TU=ce("ZodNull",(e,t)=>{tL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>kP(e,n,a)});function AU(e){return eP(TU,e)}const RU=ce("ZodUnknown",(e,t)=>{nL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>CP()});function Ut(){return tP(RU)}const OU=ce("ZodNever",(e,t)=>{rL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>jP(e,n,a)});function zU(e){return nP(OU,e)}const MU=ce("ZodArray",(e,t)=>{aL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>AP(e,n,a,s),e.element=t.element,e.min=(n,a)=>e.check(Gf(n,a)),e.nonempty=n=>e.check(Gf(1,n)),e.max=(n,a)=>e.check(tN(n,a)),e.length=(n,a)=>e.check(nN(n,a)),e.unwrap=()=>e.element});function mt(e,t){return mP(MU,e,t)}const DU=ce("ZodObject",(e,t)=>{sL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>RP(e,n,a,s),Ct(e,"shape",()=>t.shape),e.keyof=()=>Pe(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ut()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ut()}),e.strict=()=>e.clone({...e._zod.def,catchall:zU()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>C4(e,n),e.safeExtend=n=>E4(e,n),e.merge=n=>N4(e,n),e.pick=n=>k4(e,n),e.omit=n=>j4(e,n),e.partial=(...n)=>_4(cN,e,n[0]),e.required=(...n)=>T4(dN,e,n[0])});function re(e,t){const n={type:"object",shape:e??{},...Me(t)};return new DU(n)}const oN=ce("ZodUnion",(e,t)=>{JE.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>OP(e,n,a,s),e.options=t.options});function Fv(e,t){return new oN({type:"union",options:e,...Me(t)})}const IU=ce("ZodDiscriminatedUnion",(e,t)=>{oN.init(e,t),lL.init(e,t)});function $v(e,t,n){return new IU({type:"union",options:t,discriminator:e,...Me(n)})}const LU=ce("ZodIntersection",(e,t)=>{oL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>zP(e,n,a,s)});function PU(e,t){return new LU({type:"intersection",left:e,right:t})}const UU=ce("ZodRecord",(e,t)=>{uL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>MP(e,n,a,s),e.keyType=t.keyType,e.valueType=t.valueType});function Yt(e,t,n){return new UU({type:"record",keyType:e,valueType:t,...Me(n)})}const Ay=ce("ZodEnum",(e,t)=>{cL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(a,s,l)=>EP(e,a,s),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(a,s)=>{const l={};for(const c of a)if(n.has(c))l[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new Ay({...t,checks:[],...Me(s),entries:l})},e.exclude=(a,s)=>{const l={...t.entries};for(const c of a)if(n.has(c))delete l[c];else throw new Error(`Key ${c} not found in enum`);return new Ay({...t,checks:[],...Me(s),entries:l})}});function Pe(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new Ay({type:"enum",entries:n,...Me(t)})}const BU=ce("ZodLiteral",(e,t)=>{dL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>NP(e,n,a),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Sn(e,t){return new BU({type:"literal",values:Array.isArray(e)?e:[e],...Me(t)})}const FU=ce("ZodTransform",(e,t)=>{fL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>TP(e,n),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new ME(e.constructor.name);n.addIssue=l=>{if(typeof l=="string")n.issues.push(cc(l,n.value,t));else{const c=l;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=n.value),c.inst??(c.inst=e),n.issues.push(cc(c))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(l=>(n.value=l,n)):(n.value=s,n)}});function uN(e){return new FU({type:"transform",transform:e})}const cN=ce("ZodOptional",(e,t)=>{eN.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>sN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function U1(e){return new cN({type:"optional",innerType:e})}const $U=ce("ZodExactOptional",(e,t)=>{hL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>sN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function HU(e){return new $U({type:"optional",innerType:e})}const qU=ce("ZodNullable",(e,t)=>{mL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>DP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function B1(e){return new qU({type:"nullable",innerType:e})}const ZU=ce("ZodDefault",(e,t)=>{pL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>LP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function GU(e,t){return new ZU({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():PE(t)}})}const VU=ce("ZodPrefault",(e,t)=>{gL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>PP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function QU(e,t){return new VU({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():PE(t)}})}const dN=ce("ZodNonOptional",(e,t)=>{yL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>IP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function KU(e,t){return new dN({type:"nonoptional",innerType:e,...Me(t)})}const YU=ce("ZodCatch",(e,t)=>{vL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>UP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function XU(e,t){return new YU({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const WU=ce("ZodPipe",(e,t)=>{bL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>BP(e,n,a,s),e.in=t.in,e.out=t.out});function Ry(e,t){return new WU({type:"pipe",in:e,out:t})}const JU=ce("ZodReadonly",(e,t)=>{xL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>FP(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function e6(e){return new JU({type:"readonly",innerType:e})}const t6=ce("ZodCustom",(e,t)=>{wL.init(e,t),Kt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>_P(e,n)});function n6(e,t={}){return pP(t6,e,t)}function r6(e){return gP(e)}function a6(e,t){return Ry(uN(e),t)}const Is={custom:"custom"};function Pc(e){return XL(Bv,e)}const i6=new RegExp("(?<![A-Za-z0-9_.@-])@([A-Za-z0-9][A-Za-z0-9_-]{0,63})\\b","g");function s6(e){return e.replace(/```[\s\S]*?```/g,"").replace(/~~~[\s\S]*?~~~/g,"").replace(/`[^`\n]+`/g,"")}function fN(e,t){const n=s6(e),a=new Map;for(const l of t)l.name&&a.set(l.name.toLowerCase(),l.agentId);if(a.size===0)return[];const s=new Set;for(const l of n.matchAll(i6)){const c=l[1];if(!c)continue;const d=a.get(c.toLowerCase());d&&s.add(d)}return[...s]}const l6=/^\/(?![/\\])[A-Za-z0-9_\-./?=&%#]*$/,F1="/";function hN(e){return!e||typeof e!="string"||e.length>256||!l6.test(e)?"/":e}const o6={FEISHU:"feishu",SLACK:"slack",KAEL:"kael"},mN=Pe(["feishu","slack","kael"]),pN=Pe(["active","inactive"]);re({platform:mN,agentId:N().min(1),credentials:Yt(N(),Ut()),status:pN.default("active")});re({agentId:N().min(1).optional(),credentials:Yt(N(),Ut()).optional(),status:pN.optional()});re({id:qe(),platform:N(),agentId:N(),hasCredentials:Xn(),status:N(),createdAt:N(),updatedAt:N()});const u6=Pe(["code","reverse_token","oauth","manual"]);re({appId:N().min(1),appSecret:N().min(1)});re({platform:mN,externalUserId:N().min(1),agentId:N().min(1),boundVia:u6.default("manual"),displayName:N().max(200).optional()});re({id:qe(),platform:N(),externalUserId:N(),agentId:N(),boundVia:N().nullable(),displayName:N().nullable(),createdAt:N()});re({feishuUserId:N().min(1),displayName:N().max(200).optional()});re({configId:qe(),platform:N(),agentId:N(),appId:N(),connected:Xn(),lastActiveAt:N().nullable()});const c6=32e3,Hv=/^[a-z0-9][a-z0-9_-]{0,63}$/i,d6=/^[A-Z][A-Z0-9_]*$/,gN=re({append:N().max(c6).default("")}),f6=re({name:N().regex(Hv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Sn("stdio"),command:N().min(1),args:mt(N()).optional()}),h6=re({name:N().regex(Hv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Sn("http"),url:N().url(),headers:Yt(N(),N()).optional()}),m6=re({name:N().regex(Hv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Sn("sse"),url:N().url(),headers:Yt(N(),N()).optional()}),yN=$v("transport",[f6,h6,m6]),vN=re({key:N().regex(d6,"Env key must match /^[A-Z][A-Z0-9_]*$/"),value:N(),sensitive:Xn().default(!1)}),qv=re({url:N().min(1),ref:N().min(1).optional(),localPath:N().min(1).optional()}),bN=re({prompt:gN.default({append:""}),model:N().default("opus"),mcpServers:mt(yN).default([]),env:mt(vN).default([]),gitRepos:mt(qv).default([])}),p6=bN.extend({kind:Sn("claude-code")}),g6=bN.extend({kind:Sn("codex")}),y6=$v("kind",[p6,g6]),v6=(e,t)=>{const n=new Set;e.mcpServers.forEach((l,c)=>{const d=l.name.toLowerCase();n.has(d)&&t.addIssue({code:Is.custom,path:["mcpServers",c,"name"],message:`Duplicate MCP server name "${l.name}"`}),n.add(d)});const a=new Set;e.env.forEach((l,c)=>{a.has(l.key)&&t.addIssue({code:Is.custom,path:["env",c,"key"],message:`Duplicate env key "${l.key}"`}),a.add(l.key)});const s=new Set;e.gitRepos.forEach((l,c)=>{const d=l.localPath??Kf(l.url);d&&(s.has(d)&&t.addIssue({code:Is.custom,path:["gitRepos",c,"localPath"],message:`Duplicate git repo local path "${d}"`}),s.add(d))})},xN=a6(e=>e&&typeof e=="object"&&!Array.isArray(e)&&!("kind"in e)?{...e,kind:"claude-code"}:e,y6).superRefine((e,t)=>{v6(e,t)}),b6=re({agentId:N(),version:qe().int().positive(),payload:xN,updatedAt:N(),updatedBy:N()}),wN=re({prompt:gN,model:N(),mcpServers:mt(yN),env:mt(vN),gitRepos:mt(qv)}).partial();re({expectedVersion:qe().int().positive(),payload:wN});re({payload:wN});re({current:b6,next:xN,diff:mt(re({path:N(),op:Pe(["add","remove","replace"]),before:Ut().optional(),after:Ut().optional()}))});const Qf="***";function Kf(e){const t=e.trim();return t?((t.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,""):""}const SN=Pe(["online","offline"]),kN=Pe(["idle","working","blocked","error"]);Pe(["active","suspended","evicted"]);const x6=Pe(["active","suspended"]);re({chatId:N().min(1),state:x6});re({runtimeState:kN});re({agentId:N().min(1),runtimeType:N().max(50),runtimeVersion:N().max(50).optional()});Pe(["wrong_client","not_owned","agent_suspended","wrong_org","unknown_agent","runtime_provider_mismatch"]);re({agentId:N(),status:SN,connectedAt:N().nullable(),lastSeenAt:N(),clientId:N().nullable().optional(),runtimeType:N().nullable().optional(),runtimeVersion:N().nullable().optional(),runtimeState:kN.nullable().optional(),activeSessions:qe().int().nullable().optional(),totalSessions:qe().int().nullable().optional(),runtimeUpdatedAt:N().nullable().optional()});re({total:qe().int(),running:qe().int(),byState:re({idle:qe().int(),working:qe().int(),blocked:qe().int(),error:qe().int()}),clients:qe().int()});const Yf={CLAUDE_CODE:"claude-code",CODEX:"codex"},wh=Pe(["claude-code","codex"]),Sh=Pe(["human","personal_assistant","autonomous_agent"]),$1={PRIVATE:"private",ORGANIZATION:"organization"},Zv=Pe(["private","organization"]),w6=Pe(["admin-api","portal"]);Pe(["active","suspended"]);const Oy=/^[a-z0-9][a-z0-9_-]{0,63}$/,Wl=64,S6=["admin","agent","first-tree","hub","me","null","system","undefined"],k6=new Set(S6);function zy(e){return k6.has(e)}re({name:N().min(1).max(64).regex(Oy,"Must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_). Max 64 chars.").refine(e=>!zy(e),{message:"That agent name is reserved — pick a different one."}).optional(),type:Sh,displayName:N().min(1).max(200).optional(),delegateMention:N().max(100).optional(),organizationId:N().min(1).max(100).optional(),source:w6.optional(),visibility:Zv.optional(),metadata:Yt(N(),Ut()).optional(),managerId:N().optional(),clientId:N().min(1).max(100).optional(),runtimeProvider:wh.optional(),gitRepos:mt(qv).optional()});re({type:Sh.optional(),displayName:N().min(1).max(200).optional(),delegateMention:N().max(100).nullable().optional(),visibility:Zv.optional(),metadata:Yt(N(),Ut()).optional(),managerId:N().nullable().optional(),clientId:N().min(1).max(100).nullable().optional()});re({clientId:N().min(1).max(100),runtimeProvider:wh,force:Xn().optional()});re({uuid:N(),name:N().nullable(),organizationId:N(),type:Sh,displayName:N(),delegateMention:N().nullable(),inboxId:N(),status:N(),source:N().nullable().optional(),visibility:Zv,metadata:Yt(N(),Ut()),managerId:N().nullable(),clientId:N().nullable(),runtimeProvider:wh,presenceStatus:SN.optional(),createdAt:N(),updatedAt:N()});re({repo:N().nullable(),branch:N().nullable()});re({type:Sn("agent:pinned"),agentId:N(),name:N().nullable(),displayName:N(),agentType:Sh,runtimeProvider:wh});re({username:N().min(1),password:N().min(1)});re({accessToken:N(),refreshToken:N()});re({refreshToken:N().min(1)});re({token:N().min(1)});re({token:N(),expiresIn:qe(),command:N()});const j6=Pe(["direct","group","thread"]);re({type:j6,topic:N().max(500).optional(),participantIds:mt(N()).min(1),metadata:Yt(N(),Ut()).optional()});const jN=re({agentId:N(),role:N(),mode:N(),joinedAt:N()});jN.extend({name:N().nullable(),displayName:N(),type:N()});const C6=re({id:N(),organizationId:N(),type:N(),topic:N().nullable(),lifecyclePolicy:N().nullable().optional(),metadata:Yt(N(),Ut()),createdAt:N(),updatedAt:N()});C6.extend({participants:mt(jN),title:N(),firstMessagePreview:N().nullable()});re({topic:N().trim().max(500).nullable()});re({agentId:N().min(1),mode:Pe(["full","mention_only"]).default("full")});re({agentId:N().min(1)});const E6=Pe(["connected","disconnected"]),N6=Pe(["ok","expired"]);re({id:N(),userId:N().nullable(),status:E6,authState:N6,sdkVersion:N().max(50).nullable(),hostname:N().max(100).nullable(),os:N().max(50).nullable(),agentCount:qe().int().min(0),connectedAt:N().nullable(),lastSeenAt:N(),metadata:Yt(N(),Ut()).nullable()});const _6=re({wsInboxDeliver:Xn().default(!1)}).partial();re({clientId:N().min(1).max(100),hostname:N().max(100).optional(),os:N().max(50).optional(),sdkVersion:N().max(50).optional(),wireCapabilities:_6.optional()});re({clientId:N(),previousUserId:N().nullable(),unpinnedAgentCount:qe().int().nonnegative()});const T6=Pe(["ok","missing","unauthenticated","error"]),A6=Pe(["api_key","oauth","auth_json","none"]),R6=re({state:T6,available:Xn(),authenticated:Xn(),sdkVersion:N().nullable().optional(),authMethod:A6,error:N().nullable().optional(),detectedAt:N()}),O6=Yt(N(),R6);re({capabilities:O6});re({limit:Pc().int().min(1).max(100).default(20),cursor:N().optional()});const z6=Pe(["active","stale","unavailable"]),M6=Pe(["ok","warning","error"]),D6=re({label:N(),detail:N().nullable(),severity:M6}),I6=Pe(["root","domain","subdomain","leaf"]),Gv=Pe(["added","edited","removed"]),L6=Pe(["parent","soft_link","markdown_link"]),P6=Pe(["low","medium","high"]),U6=re({id:N(),path:N(),sourcePath:N().nullable(),title:N(),kind:I6,owners:mt(N()),parentId:N().nullable(),preview:N().nullable(),relatedNodeIds:mt(N()),affectedContextArea:N(),changeType:Gv.nullable(),changedAtCommit:N().nullable()}),B6=re({source:N(),target:N(),kind:L6}),F6=re({path:N(),nodeId:N().nullable(),type:Gv,commit:N().nullable(),changedAt:N().nullable(),changedBy:N().nullable(),summary:N().nullable()}),$6=re({id:N(),nodeId:N().nullable(),path:N(),title:N(),changeType:Gv,affectedContextArea:N(),reason:N(),summary:N(),changedBy:N().nullable(),owners:mt(N()),relatedNodeIds:mt(N()),sourceCommit:N().nullable(),riskLevel:P6}),H6=re({addedCount:qe().int().nonnegative(),editedCount:qe().int().nonnegative(),removedCount:qe().int().nonnegative(),changedNodeCount:qe().int().nonnegative()});re({repo:N().nullable(),branch:N().nullable(),headCommit:N().nullable(),syncedAt:N().nullable(),snapshotStatus:z6,contextStatus:D6,summary:H6,updates:mt($6),nodes:mt(U6),edges:mt(B6),changes:mt(F6)});const q6=["image/png","image/jpeg","image/gif","image/webp"],Vv=Pe(q6);re({data:N().min(1),mimeType:Vv,filename:N().min(1),size:qe().int().nonnegative().optional(),imageId:N().uuid().optional()});re({imageId:N().uuid(),mimeType:Vv,filename:N().min(1),size:qe().int().nonnegative().optional()});re({type:Sn("image_payload"),imageId:N().uuid(),chatId:N(),base64:N().min(1),mimeType:Vv,filename:N().min(1),size:qe().int().nonnegative().optional()});const Qv=Pe(["hub_ui","cli","feishu","github","api"]),CN=Pe(["text","markdown","card","reference","file","task","question","question_answer"]);re({format:CN.default("text"),content:Ut(),metadata:Yt(N(),Ut()).optional(),inReplyTo:N().optional(),replyToInbox:N().optional(),replyToChat:N().optional(),source:Qv.optional()});re({format:CN.default("text"),content:Ut(),metadata:Yt(N(),Ut()).optional(),replyToInbox:N().optional(),replyToChat:N().optional(),source:Qv.optional()});const Z6=re({id:N(),chatId:N(),senderId:N(),format:N(),content:Ut(),metadata:Yt(N(),Ut()),replyToInbox:N().nullable(),replyToChat:N().nullable(),inReplyTo:N().nullable(),source:Qv.nullable(),createdAt:N()}),G6=re({senderId:N(),chatId:N(),replyToChat:N().nullable()}).nullable(),V6=Pe(["full","mention_only"]),Q6=re({id:N(),senderId:N(),format:N(),content:Ut(),metadata:Yt(N(),Ut()).default({}),createdAt:N()}),EN=Z6.extend({configVersion:qe().int().positive(),recipientMode:V6.default("full"),inReplyToSnapshot:G6.default(null),precedingMessages:mt(Q6).default([])});Pe(["pending","delivered","acked","failed"]);const K6=re({id:qe(),inboxId:N(),messageId:N(),chatId:N().nullable(),status:N(),retryCount:qe(),createdAt:N(),deliveredAt:N().nullable(),ackedAt:N().nullable()});K6.extend({message:EN});re({limit:Pc().int().min(1).max(50).default(10)});re({type:Sn("inbox:deliver"),entryId:qe().int().nonnegative(),inboxId:N().min(1),chatId:N().nullable(),message:EN}).passthrough();re({type:Sn("inbox:ack"),entryId:qe().int().nonnegative()});const Y6=7;re({organizationId:N(),organizationName:N(),organizationDisplayName:N(),role:N(),expiresAt:N().nullable()});re({id:N(),organizationId:N(),token:N(),inviteUrl:N(),role:N(),createdAt:N(),expiresAt:N().nullable()});re({token:N().min(1)});re({}).optional();const X6=["all","unread","watching"],W6=Pe(X6),NN=Pe(["participant","watching"]);re({cursor:N().optional(),limit:Pc().int().min(1).max(200).default(50),filter:W6.default("all")});const J6=re({agentId:N(),displayName:N(),type:N()}),eB=re({chatId:N(),type:N(),membershipKind:NN,title:N(),topic:N().nullable(),participants:mt(J6),participantCount:qe().int(),lastMessageAt:N().nullable(),lastMessagePreview:N().nullable(),unreadMentionCount:qe().int(),canReply:Xn(),taskId:N().nullable(),taskStatus:N().nullable()});re({rows:mt(eB),nextCursor:N().nullable()});re({participantIds:mt(N().min(1)).min(1),topic:N().trim().max(500).optional().nullable()});re({participantIds:mt(N().min(1)).min(1)});re({chatId:N(),lastReadAt:N(),unreadMentionCount:qe().int()});re({chatId:N(),membershipKind:NN.nullable()});re({type:Sn("chat:message"),chatId:N()});Pe(["connect","create_agent","completed"]);re({id:N(),name:N(),displayName:N(),role:Pe(["admin","member"])});re({name:N().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/),displayName:N().min(1).max(200)});re({dismissed:Xn().optional()});const tB=Pe(["team_renamed","agent_created","tree_chat_started","tree_intro_dismissed"]);re({event:tB,attrs:Yt(N(),Fv([N(),qe(),Xn(),AU()])).optional()});re({id:N(),organizationId:N(),organizationName:N(),role:Pe(["admin","member"]),agentId:N()});const nB={ADMIN:"admin",MEMBER:"member"},Kv=Pe(["admin","member"]),rB=re({id:N(),userId:N(),organizationId:N(),agentId:N(),role:Kv,createdAt:N()});re({username:N().min(1).max(100),displayName:N().min(1).max(200),role:Kv.default("member")});re({role:Kv.optional(),displayName:N().min(1).max(200).optional()});rB.extend({username:N(),displayName:N(),password:N()});const aB=Pe(["agent_error","session_error","agent_needs_decision","agent_blocked","agent_stale","agent_disconnected","agent_connected","session_completed"]),_N=Pe(["high","medium","low"]);re({id:N(),organizationId:N(),type:aB,severity:_N,agentId:N().nullable(),chatId:N().nullable(),message:N(),read:Xn(),createdAt:N()});re({limit:Pc().int().min(1).max(100).default(20),cursor:N().optional(),severity:_N.optional(),read:Pe(["true","false"]).transform(e=>e==="true").optional(),agentId:N().optional()});re({next:N().max(256).optional()});re({code:N().min(1),state:N().min(1)});re({githubId:N().min(1),login:N().min(1),email:N().email().optional(),displayName:N().optional(),next:N().max(256).optional()});const iB=/^(?:[A-Za-z0-9_.-]+@)?[A-Za-z0-9.-]+:(?!\d+(?:\/|$))[^/:@\s][^:@\s]*$/;function sB(e){return e.includes("://")?!1:iB.test(e)}const kh=N().min(1).superRefine((e,t)=>{if(sB(e))return;let n;try{n=new URL(e)}catch{t.addIssue({code:Is.custom,message:"Repo URL must be HTTPS, SSH (ssh://...), or scp-like (git@host:path)."});return}if(n.protocol!=="https:"&&n.protocol!=="ssh:"){t.addIssue({code:Is.custom,message:"Repo URL must use HTTPS or SSH."});return}if(n.password.length>0){t.addIssue({code:Is.custom,message:"Repo URL must not include credentials."});return}if(n.protocol==="https:"&&n.username.length>0){t.addIssue({code:Is.custom,message:"Repo URL must not include credentials."});return}}),lB=re({repo:kh.optional(),branch:N().default("main")}),oB=re({repo:kh.nullish(),branch:N().min(1).nullish()}),uB=re({repo:N().optional(),branch:N().optional()}),cB=re({webhookSecretCipher:N().optional()}),dB=re({webhookSecret:N().min(1).nullish()}),fB=re({webhookSecretConfigured:Xn(),webhookUrl:N()}),hB=re({repos:mt(re({url:kh,defaultBranch:N().optional()})).default([])}),mB=re({repos:mt(re({url:kh,defaultBranch:N().min(1).optional()})).optional()}),pB=re({repos:mt(re({url:N(),defaultBranch:N().optional()}))}),gB={context_tree:{storage:lB,input:oB,output:uB,readPolicy:"member"},github_integration:{storage:cB,input:dB,output:fB,readPolicy:"admin"},source_repos:{storage:hB,input:mB,output:pB,readPolicy:"member"}},yB=Object.keys(gB);Pe(yB);const TN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;re({name:N().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/,"Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine(e=>!TN.test(e),"Name must not be a UUID format"),displayName:N().min(1).max(200),maxAgents:qe().int().min(0).default(0),maxMessagesPerMinute:qe().int().min(0).default(0),features:Yt(N(),Ut()).default({})});re({name:N().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/,"Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine(e=>!TN.test(e),"Name must not be a UUID format").optional(),displayName:N().min(1).max(200).optional(),maxAgents:qe().int().min(0).optional(),maxMessagesPerMinute:qe().int().min(0).optional(),features:Yt(N(),Ut()).optional()});re({id:N(),name:N(),displayName:N(),maxAgents:qe(),maxMessagesPerMinute:qe(),features:Yt(N(),Ut()),createdAt:N(),updatedAt:N()});const vB=re({workingCount:qe().int().nonnegative(),errorMask:Xn()}),bB=re({type:Sn("pulse:tick"),organizationId:N(),agents:Yt(N(),mt(vB).length(32))}),xB=re({label:N().min(1),description:N(),preview:N().nullable().optional()}),wB=re({question:N().min(1),header:N().min(1).max(24),options:mt(xB).min(2).max(4),multiSelect:Xn()}),SB=Pe(["html","markdown"]).nullable(),kB=re({correlationId:N().min(1),questions:mt(wB).min(1).max(4),previewFormat:SB,allowFreeText:Xn()}),jB=re({correlationId:N().min(1),answers:Yt(N().min(1),N())});re({answers:Yt(N().min(1),N())});Pe(["pending","answered","superseded"]);const CB=Pe(["tool_call","error","assistant_text","thinking","turn_end"]),AN=re({toolUseId:N(),name:N(),args:Ut(),status:Pe(["pending","ok","error"]),durationMs:qe().int().nonnegative().optional(),resultPreview:N().max(400).optional()}),RN=re({source:Pe(["sdk","runtime","tool"]),message:N().max(2e3)}),ON=re({text:N().max(8e3)}),zN=re({}),MN=re({status:Pe(["success","error"])}),EB=$v("kind",[re({kind:Sn("tool_call"),payload:AN}),re({kind:Sn("error"),payload:RN}),re({kind:Sn("assistant_text"),payload:ON}),re({kind:Sn("thinking"),payload:zN}),re({kind:Sn("turn_end"),payload:MN})]);re({id:N(),agentId:N(),chatId:N(),seq:qe().int().positive(),kind:CB,payload:Fv([AN,RN,ON,zN,MN]),createdAt:N()});re({agentId:N(),chatId:N(),event:EB});re({agentId:N(),chatId:N()});re({type:Sn("session:reconcile"),agentId:N().min(1),chatIds:mt(N().min(1)).max(500)});re({type:Sn("session:reconcile:result"),agentId:N().min(1),staleChatIds:mt(N().min(1))});const NB=re({organizationId:N(),agentCount:qe(),chatCount:qe(),messageCount:qe()});re({totalAgents:qe(),totalChats:qe(),totalMessages:qe(),byOrganization:mt(NB)});const dc=Pe(["pending","assigned","working","completed","failed","cancelled"]),H1=Pe(["agent","admin"]),_B=Pe(["assigned","status_changed","cancelled"]);re({taskId:N(),event:_B,title:N(),body:N().default(""),status:dc,fromStatus:dc.optional(),originRef:N().nullable().optional()});const TB=re({title:N().min(1).max(500),body:N().optional(),assigneeAgentId:N().optional(),originRef:N().max(500).optional(),metadata:Yt(N(),Ut()).optional()});TB.extend({organizationId:N().optional()});re({status:Pe(["working","completed","failed"]),result:N().optional()});re({assigneeAgentId:N().nullable().optional(),status:dc.optional(),result:N().optional()});re({chatId:N().min(1)});const AB=re({id:N(),organizationId:N(),title:N(),body:N(),status:dc,assigneeAgentId:N().nullable(),createdByType:H1,createdById:N(),originRef:N().nullable(),result:N().nullable(),metadata:Yt(N(),Ut()),createdAt:N(),updatedAt:N(),cancelledAt:N().nullable(),cancelledByType:H1.nullable(),cancelledById:N().nullable()}),RB=re({taskId:N(),chatId:N(),linkedByAgentId:N().nullable(),linkedAt:N()});AB.extend({chats:mt(RB)});re({status:dc.optional(),assigneeAgentId:N().optional(),originRef:N().optional(),limit:Pc().int().min(1).max(100).default(20),cursor:N().optional()});const OB=Pe(["normal","idle_island","awaiting_reply","no_chat","not_applicable"]);re({taskId:N(),signal:OB,reason:N()});const zB=Pe(["active","suspended"]);re({id:N(),username:N(),displayName:N(),avatarUrl:N().nullable(),status:zB,createdAt:N(),updatedAt:N()});re({username:N().min(1).max(100),displayName:N().min(1).max(200),password:N().min(8).max(200)});re({displayName:N().min(1).max(200).optional(),password:N().min(8).max(200).optional()});re({type:Sn("auth"),token:N().min(1)});const MB=re({wsInboxDeliver:Xn().default(!1)}).partial();re({type:Sn("server:welcome"),serverCommandVersion:N().min(1),serverTimeMs:qe().int().nonnegative(),capabilities:MB.optional()}).passthrough();const DN=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));function DB(e){const t=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));for(const n of Object.values(e))for(let a=0;a<32&&a<n.length;a++){const s=n[a],l=t[a];!s||!l||(l.workingCount+=s.workingCount,l.errorMask=l.errorMask||s.errorMask)}return t}const IB=2e3,LB=3e4;let Gi=null,fc=!1,Xf=0,Yu=null;const My=new Set;let Zi=null,Ls=0;function PB(e){for(const t of My)try{t(e)}catch{}if(Zi){if(e.type==="notification")Zi.invalidateQueries({queryKey:["notifications"]});else if(e.type==="session:state")Zi.invalidateQueries({queryKey:["activity"]}),Zi.invalidateQueries({queryKey:["sessions"]});else if(e.type==="chat:message"){const t=typeof e.chatId=="string"?e.chatId:null;Zi.invalidateQueries({queryKey:["me","chats"]}),t&&(Zi.invalidateQueries({queryKey:["chat-messages",t]}),Zi.invalidateQueries({queryKey:["chat-detail",t]}))}}}function Yv(){const e=uh();if(!(e!=null&&e.accessToken))return;let t=null;try{t=localStorage.getItem("first-tree-hub:selectedOrganizationId")}catch{t=null}if(!t)return;const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/orgs/${encodeURIComponent(t)}/ws/?token=${e.accessToken}`,s=new WebSocket(a);Gi=s,s.onmessage=l=>{if(s===Gi)try{const c=JSON.parse(l.data);PB(c)}catch{}},s.onopen=()=>{s===Gi&&(Xf=0)},s.onclose=l=>{if(s===Gi&&(Gi=null,!(fc||Ls===0))){if(l.code===4001){ez().then(c=>{fc||Ls===0||(c?(Xf=0,Yv()):q1())});return}q1()}}}function q1(){Xf++;const e=Math.min(IB*2**(Xf-1),LB);Yu=setTimeout(()=>{Yu=null,!fc&&Ls>0&&Yv()},e)}function UB(){fc=!0,Yu&&(clearTimeout(Yu),Yu=null),Gi&&(Gi.close(1e3,"unmount"),Gi=null)}function IN(e){const{onMessage:t,enabled:n=!0}=e??{},a=hn(),s=x.useRef(t);s.current=t,x.useEffect(()=>{Zi=a},[a]),x.useEffect(()=>{if(!n)return;const l=c=>{var d;return(d=s.current)==null?void 0:d.call(s,c)};return My.add(l),Ls++,Ls===1&&(fc=!1,Yv()),()=>{My.delete(l),Ls--,Ls===0&&UB()}},[n])}const BB=x.createContext({aggregated:DN,agents:{},receivedAtMs:null,stale:!0});function FB({children:e}){const[t,n]=x.useState({aggregated:DN,agents:{},receivedAtMs:null}),[a,s]=x.useState(()=>Date.now());IN({onMessage:c=>{const d=bB.safeParse(c);d.success&&n({aggregated:DB(d.data.agents),agents:d.data.agents,receivedAtMs:Date.now()})}}),x.useEffect(()=>{const c=setInterval(()=>s(Date.now()),1e4);return()=>clearInterval(c)},[]);const l=x.useMemo(()=>({...t,stale:t.receivedAtMs===null||a-t.receivedAtMs>3e4}),[t,a]);return o.jsx(BB.Provider,{value:l,children:e})}function jh(e){return Ce.get(`/agents/${e}/config`)}function Ch(e,t){return Ce.patch(`/agents/${e}/config`,t)}function $B(e,t){return Ce.post(`/agents/${e}/config/dry-run`,{payload:t})}function HB(e){return Ce.get(`/agents/${e}/client-status`)}function qB({className:e,style:t,...n}){return o.jsx("div",{className:Oe("flex items-center text-body",e),style:{gap:6,color:"var(--fg-3)",...t},...n})}function ZB({onClick:e,children:t}){return o.jsx("button",{type:"button",onClick:e,className:"bg-transparent border-0 p-0 cursor-pointer",style:{color:"var(--fg-3)",textDecoration:"none",font:"inherit"},onMouseEnter:n=>{n.currentTarget.style.color="var(--fg)"},onMouseLeave:n=>{n.currentTarget.style.color="var(--fg-3)"},children:t})}function GB(){return o.jsx("span",{style:{color:"var(--fg-4)"},children:"/"})}function VB({children:e,mono:t}){return o.jsx("span",{className:Oe("font-medium",t&&"mono"),style:{color:"var(--fg)"},children:e})}const QB={neutral:{bg:"var(--bg-sunken)",fg:"var(--fg-2)",bd:"var(--border)"},accent:{bg:"var(--accent-bg)",fg:"var(--accent-dim)",bd:"color-mix(in oklch, var(--accent) 30%, transparent)"},warn:{bg:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",fg:"color-mix(in oklch, var(--state-blocked) 50%, var(--fg))",bd:"color-mix(in oklch, var(--state-blocked) 30%, transparent)"},error:{bg:"color-mix(in oklch, var(--state-error) 14%, transparent)",fg:"var(--state-error)",bd:"color-mix(in oklch, var(--state-error) 30%, transparent)"},outline:{bg:"transparent",fg:"var(--fg-3)",bd:"var(--border)"},idle:{bg:"color-mix(in oklch, var(--state-idle) 14%, transparent)",fg:"var(--state-idle)",bd:"color-mix(in oklch, var(--state-idle) 30%, transparent)"},working:{bg:"color-mix(in oklch, var(--state-working) 14%, transparent)",fg:"var(--state-working)",bd:"color-mix(in oklch, var(--state-working) 30%, transparent)"},blocked:{bg:"color-mix(in oklch, var(--state-blocked) 14%, transparent)",fg:"color-mix(in oklch, var(--state-blocked) 50%, var(--fg))",bd:"color-mix(in oklch, var(--state-blocked) 30%, transparent)"},offline:{bg:"color-mix(in oklch, var(--state-offline) 14%, transparent)",fg:"var(--state-offline)",bd:"color-mix(in oklch, var(--state-offline) 30%, transparent)"}};function ya({tone:e="neutral",className:t,style:n,...a}){const s=QB[e],l={background:s.bg,color:s.fg,border:`var(--hairline) solid ${s.bd}`,...n};return o.jsx("span",{className:Oe("mono inline-flex items-center uppercase text-caption leading-[1.6]",t),style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",...l},...a})}function Dy({children:e,right:t,className:n,style:a,...s}){return o.jsxs("div",{className:Oe("mono flex items-center justify-between uppercase text-eyebrow",n),style:{padding:"var(--sp-1_75) var(--sp-3_5)",color:"var(--fg-4)",background:"var(--bg-raised)",borderBottom:"var(--hairline) solid var(--border-faint)",...a},...s,children:[o.jsx("span",{children:e}),t]})}function Xv({className:e,style:t,...n}){return o.jsx("span",{className:Oe("mono uppercase text-caption",e),style:{color:"var(--fg-3)",...t},...n})}function Xu({state:e,size:t=8,className:n}){const a={width:t,height:t,display:"inline-block",position:"relative",flexShrink:0};return e==="working"?o.jsxs("span",{className:Oe("shrink-0",n),style:a,role:"img","aria-label":"working",children:[o.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--state-working)"}}),o.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--state-working)",animation:"ring-pulse 1.8s infinite",opacity:.6}})]}):e==="blocked"?o.jsx("span",{className:Oe("shrink-0",n),style:{...a,border:"var(--hairline-bold) dashed var(--state-blocked)",borderRadius:"50%",animation:"dash-spin 4s linear infinite"},role:"img","aria-label":"blocked",children:o.jsx("span",{style:{position:"absolute",inset:2,borderRadius:"50%",background:"var(--state-blocked)"}})}):e==="error"?o.jsx("span",{className:Oe("shrink-0",n),style:{...a,background:"var(--state-error)",clipPath:"polygon(50% 0%, 100% 100%, 0% 100%)",borderRadius:1},role:"img","aria-label":"error"}):e==="idle"?o.jsx("span",{className:Oe("shrink-0",n),style:{...a,borderRadius:"50%",background:"var(--state-idle)"},role:"img","aria-label":"idle"}):o.jsx("span",{className:Oe("shrink-0",n),style:{...a,borderRadius:"50%",border:"var(--hairline) solid var(--state-offline)",background:"transparent"},role:"img","aria-label":"offline"})}function KB(e){return e==="idle"||e==="working"||e==="blocked"||e==="error"||e==="offline"}function hc({state:e,className:t}){const n=e!==null&&KB(e)?e:"offline",a=n==="offline"?"var(--fg-3)":`var(--state-${n})`;return o.jsxs("span",{className:Oe("mono inline-flex items-center gap-1.5 uppercase text-caption",t),style:{color:a},children:[o.jsx(Xu,{state:n,size:7}),n]})}function bf({label:e,value:t,accent:n}){return o.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",cursor:"default"},children:[o.jsx("div",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:e}),o.jsx("div",{className:"mono text-subtitle font-semibold",style:{color:n??"var(--fg)",marginTop:"var(--sp-px)"},children:t})]})}function YB({runtimeLabel:e,computerLabel:t,visible:n=!0}){return n?o.jsx("div",{className:"sticky z-20 flex items-center justify-between gap-3 backdrop-blur",style:{top:0,padding:"var(--sp-1_75) var(--sp-5)",background:"color-mix(in oklch, var(--bg-raised) 94%, transparent)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:o.jsxs("div",{className:"mono text-caption flex items-center gap-2",style:{color:"var(--fg-3)"},children:[o.jsxs("span",{children:["Runs on ",o.jsx("span",{style:{color:"var(--fg-2)"},children:e})]}),t&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"var(--fg-4)"},"aria-hidden":!0,children:"@"}),o.jsx("span",{style:{color:"var(--fg-2)"},children:t})]})]})}):null}function XB(e){const{agent:t}=e,[n,a]=x.useState(!1),[s,l]=x.useState(!1),c=t.displayName||t.name||t.uuid;return o.jsxs("section",{id:"ad-danger",style:{background:"color-mix(in oklch, var(--state-error) 6%, var(--bg-raised))",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-panel)"},children:[o.jsxs("header",{className:"flex items-center gap-2",style:{padding:"var(--sp-2_5) var(--sp-3_5)"},children:[o.jsx(Ws,{className:"h-3.5 w-3.5",style:{color:"var(--state-error)"}}),o.jsx("h3",{className:"text-body font-semibold",style:{color:"var(--state-error)"},children:"Danger zone"})]}),o.jsxs("div",{children:[t.status==="active"?o.jsx(dg,{title:"Suspend agent",body:"Pause all active sessions. You can reactivate later; tokens stay revoked until then.",action:o.jsx(pe,{variant:"outline",size:"xs",onClick:()=>l(!0),disabled:e.suspendPending,children:e.suspendPending?"Suspending…":"Suspend"})}):o.jsx(dg,{title:"Reactivate agent",body:"Resume sessions. Tokens must be recreated — they are not restored.",action:o.jsx(pe,{variant:"outline",size:"xs",onClick:e.onReactivate,disabled:e.reactivatePending,children:e.reactivatePending?"Reactivating…":"Reactivate"})}),o.jsx(dg,{title:"Delete agent",body:"Permanent. Configuration, bindings, tokens, and session history are all dropped.",action:o.jsxs(pe,{variant:"destructive",size:"xs",onClick:()=>a(!0),disabled:e.deletePending,children:[o.jsx(Ff,{className:"h-3 w-3"}),"Delete"]})})]}),o.jsx(WB,{open:s,onOpenChange:l,label:c,onConfirm:()=>{l(!1),e.onSuspend()},pending:e.suspendPending}),o.jsx(JB,{open:n,onOpenChange:a,expected:c,onDelete:()=>{a(!1),e.onDelete()},deleting:e.deletePending})]})}function dg(e){return o.jsxs("div",{className:"flex items-start justify-between gap-4 text-body",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderTop:"var(--hairline) solid color-mix(in oklch, var(--state-error) 14%, transparent)"},children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",style:{color:"var(--fg)"},children:e.title}),o.jsx("p",{className:"text-label font-normal",style:{color:"var(--fg-3)"},children:e.body})]}),o.jsx("div",{children:e.action})]})}function WB({open:e,onOpenChange:t,label:n,onConfirm:a,pending:s}){return o.jsx(Tn,{open:e,onOpenChange:t,children:o.jsxs(jn,{children:[o.jsx(Ln,{children:o.jsxs(An,{children:['Suspend "',n,'"?']})}),o.jsx("div",{className:"space-y-3",children:o.jsx("p",{className:"text-body",style:{color:"var(--fg-2)"},children:"Runtime binds and HTTP calls will be refused while the agent is suspended. Active sessions end on their next message. You can reactivate later from this same page."})}),o.jsxs(cr,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),o.jsx(pe,{type:"button",variant:"destructive",onClick:a,disabled:s,children:s?"Suspending…":"Suspend"})]})]})})}function JB({open:e,onOpenChange:t,expected:n,onDelete:a,deleting:s}){const[l,c]=x.useState("");function d(m){m.preventDefault(),l===n&&a()}return o.jsx(Tn,{open:e,onOpenChange:m=>{t(m),m||c("")},children:o.jsxs(jn,{children:[o.jsx(Ln,{children:o.jsxs(An,{children:['Delete "',n,'"?']})}),o.jsxs("form",{onSubmit:d,className:"space-y-4",children:[o.jsxs("p",{className:"text-body text-muted-foreground",children:["This action cannot be undone. Type ",o.jsx("span",{className:"font-mono font-medium text-foreground",children:n})," ","to confirm."]}),o.jsx(Pt,{value:l,onChange:m=>c(m.target.value),autoFocus:!0,placeholder:n,className:"font-mono"}),o.jsxs(cr,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),o.jsx(pe,{type:"submit",variant:"destructive",disabled:l!==n||s,children:s?"Deleting…":"Delete"})]})]})]})})}var e9="Label",LN=x.forwardRef((e,t)=>o.jsx(di.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));LN.displayName=e9;var t9=LN;const kt=x.forwardRef(({className:e,...t},n)=>o.jsx(t9,{ref:n,className:Oe("text-label leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));kt.displayName="Label";const Cn=x.forwardRef(({className:e,style:t,...n},a)=>o.jsx("div",{ref:a,className:Oe("overflow-hidden",e),style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",...t},...n}));Cn.displayName="Panel";const la=x.forwardRef(({className:e,style:t,...n},a)=>o.jsx("div",{ref:a,className:Oe("flex items-center justify-between gap-3",e),style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));la.displayName="PanelHeader";const oa=x.forwardRef(({className:e,style:t,...n},a)=>o.jsx("div",{ref:a,className:Oe("inline-flex items-center gap-2 text-body font-semibold",e),style:{color:"var(--fg)",...t},...n}));oa.displayName="PanelTitle";const Wn=x.forwardRef(({className:e,style:t,...n},a)=>o.jsx("div",{ref:a,className:Oe(e),style:{padding:"var(--sp-3) var(--sp-3_5)",...t},...n}));Wn.displayName="PanelBody";const n9={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 Wv({status:e,onEdit:t,onDelete:n,onUndo:a,children:s,disabled:l}){const c=n9[e],d=e==="deleted";return o.jsxs("div",{className:Oe("flex items-center gap-2 rounded border px-3 py-2 text-body",d?"bg-error-soft border-error text-error line-through decoration-error":"bg-card"),children:[o.jsx("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:s}),c.label&&o.jsx("span",{className:Oe("text-caption rounded px-1.5 py-0.5 whitespace-nowrap",c.tone),children:c.label}),!l&&(d?o.jsxs(pe,{size:"sm",variant:"ghost",onClick:a,children:[o.jsx(gM,{className:"h-3.5 w-3.5 mr-1"}),"Undo"]}):o.jsxs("div",{className:"flex gap-1 shrink-0",children:[o.jsxs(pe,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:t,title:"Edit",children:[o.jsx(Sv,{className:"h-3.5 w-3.5"}),o.jsx("span",{className:"sr-only",children:"Edit"})]}),o.jsxs(pe,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:n,title:"Delete",children:[o.jsx(Ff,{className:"h-3.5 w-3.5"}),o.jsx("span",{className:"sr-only",children:"Delete"})]})]}))]})}function r9(e){const[t,n]=x.useState(null),[a,s]=x.useState(()=>new Set),l=d=>s(m=>{const h=new Set(m);return h.has(d)?h.delete(d):h.add(d),h}),c=e.items.filter(d=>d.status!=="deleted").length;return o.jsxs(Cn,{children:[o.jsxs(la,{children:[o.jsxs(oa,{children:["Environment variables (",c,")"]}),!e.disabled&&o.jsxs(pe,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[o.jsx(ba,{className:"h-3 w-3"})," Add"]})]}),o.jsx(Wn,{className:"space-y-2",children:e.items.length===0?o.jsx("p",{className:"text-body text-muted-foreground",children:"No environment variables."}):e.items.map(d=>{const m=d.value.sensitive,h=d.value.value===Qf,g=m&&!h&&!!d.value.value,p=a.has(d.key);let b;return m?g&&p?b=d.value.value:b="••••••":b=d.value.value||o.jsx("em",{children:"(empty)"}),o.jsxs(Wv,{status:d.status,onEdit:()=>n({mode:"edit",key:d.key,initial:d.value}),onDelete:()=>e.onDelete(d.key),onUndo:()=>e.onUndoDelete(d.key),disabled:e.disabled,children:[o.jsx("span",{className:"font-mono font-medium",children:d.value.key}),o.jsx("span",{className:"font-mono text-caption text-muted-foreground truncate max-w-xs",children:b}),m&&o.jsx(xv,{className:"h-3 w-3 text-muted-foreground","aria-hidden":!0}),m&&o.jsx("button",{type:"button",onClick:()=>g&&l(d.key),className:"bg-transparent border-0 cursor-pointer inline-flex items-center text-muted-foreground",title:g?p?"Hide value":"Reveal value":"Saved sensitive values can't be revealed. Edit to set a new value.","aria-label":p?"Hide value":"Reveal value",disabled:!g,style:{padding:0,opacity:g?1:.4},children:p?o.jsx($z,{className:"h-3.5 w-3.5"}):o.jsx(dC,{className:"h-3.5 w-3.5"})})]},d.key)})}),t&&o.jsx(a9,{open:!!t,onOpenChange:d=>!d&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenKeys:e.otherKeys(t.mode==="edit"?t.key:null),onSubmit:d=>{t.mode==="edit"?e.onUpdate(t.key,d):e.onAdd(d),n(null)}})]})}function a9({open:e,onOpenChange:t,initial:n,forbiddenKeys:a,onSubmit:s}){const[l,c]=x.useState((n==null?void 0:n.key)??""),[d,m]=x.useState(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),[h,g]=x.useState((n==null?void 0:n.sensitive)??!1),[p,b]=x.useState(null);x.useEffect(()=>{e&&(c((n==null?void 0:n.key)??""),m(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),g((n==null?void 0:n.sensitive)??!1),b(null))},[e,n]);function w(S){if(S.preventDefault(),!l.match(/^[A-Z][A-Z0-9_]*$/)){b("Key must match /^[A-Z][A-Z0-9_]*$/.");return}if(a.has(l)){b(`Another entry already uses key "${l}".`);return}let j=d;if(h&&(n!=null&&n.sensitive)&&!d&&(j=Qf),!h&&!n&&!d){b("Value is required for non-sensitive entries.");return}s({key:l,value:j,sensitive:h})}return o.jsx(Tn,{open:e,onOpenChange:t,children:o.jsxs(jn,{children:[o.jsx(Ln,{children:o.jsx(An,{children:n?"Edit environment variable":"Add environment variable"})}),o.jsxs("form",{onSubmit:w,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"env-key",children:"Key"}),o.jsx(Pt,{id:"env-key",value:l,onChange:S=>c(S.target.value.toUpperCase()),placeholder:"OPENAI_API_KEY",className:"font-mono",disabled:!!n}),n&&o.jsx("p",{className:"text-caption text-muted-foreground",children:"Key can't be renamed — delete and re-add."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"env-value",children:"Value"}),o.jsx(Pt,{id:"env-value",type:h?"password":"text",autoComplete:"new-password",value:d,onChange:S=>m(S.target.value),placeholder:n!=null&&n.sensitive?"Leave empty to keep existing value":h?"new secret":"value",className:"font-mono"})]}),o.jsxs("label",{className:"flex items-center gap-2 text-body",children:[o.jsx("input",{type:"checkbox",checked:h,onChange:S=>g(S.target.checked),className:"h-4 w-4",disabled:!!n&&n.sensitive}),"Mark as sensitive (encrypted at rest, never displayed again)"]}),o.jsx("p",{className:"text-caption text-muted-foreground",children:"Sensitive values cannot be viewed after saving. If you need to verify, save a new value."}),p&&o.jsx("p",{className:"text-body text-destructive",children:p}),o.jsxs(cr,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),o.jsx(pe,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function i9(e){const[t,n]=x.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return o.jsxs(Cn,{children:[o.jsxs(la,{children:[o.jsxs(oa,{children:["Git repositories (",a,")"]}),!e.disabled&&o.jsxs(pe,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[o.jsx(ba,{className:"h-3 w-3"})," Add"]})]}),o.jsx(Wn,{className:"space-y-2",children:e.items.length===0?o.jsx("p",{className:"text-body text-muted-foreground",children:"No Git repositories."}):e.items.map(s=>{const l=s.value.localPath??Kf(s.value.url);return o.jsxs(Wv,{status:s.status,onEdit:()=>n({mode:"edit",key:s.key,initial:s.value}),onDelete:()=>e.onDelete(s.key),onUndo:()=>e.onUndoDelete(s.key),disabled:e.disabled,children:[o.jsx("span",{className:"font-mono text-caption",children:s.value.url}),s.value.ref&&o.jsxs("span",{className:"text-caption text-muted-foreground",children:["@ ",s.value.ref]}),o.jsxs("span",{className:"text-caption text-muted-foreground",children:["→ ",l||"./"]})]},s.key)})}),t&&o.jsx(s9,{open:!!t,onOpenChange:s=>!s&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenPaths:e.otherPaths(t.mode==="edit"?t.key:null),onSubmit:s=>{t.mode==="edit"?e.onUpdate(t.key,s):e.onAdd(s),n(null)}})]})}function s9({open:e,onOpenChange:t,initial:n,forbiddenPaths:a,onSubmit:s}){const[l,c]=x.useState((n==null?void 0:n.url)??""),[d,m]=x.useState((n==null?void 0:n.ref)??""),[h,g]=x.useState((n==null?void 0:n.localPath)??""),[p,b]=x.useState(null);x.useEffect(()=>{e&&(c((n==null?void 0:n.url)??""),m((n==null?void 0:n.ref)??""),g((n==null?void 0:n.localPath)??""),b(null))},[e,n]);function w(S){S.preventDefault();const j=l.trim();if(!j){b("URL is required.");return}const E=h.trim()||Kf(j);if(E&&a.has(E)){b(`Another repo already occupies local path "${E}".`);return}const C={url:j,...d.trim()?{ref:d.trim()}:{},...h.trim()?{localPath:h.trim()}:{}};s(C)}return o.jsx(Tn,{open:e,onOpenChange:t,children:o.jsxs(jn,{children:[o.jsx(Ln,{children:o.jsx(An,{children:n?"Edit Git repository":"Add Git repository"})}),o.jsxs("form",{onSubmit:w,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"git-url",children:"URL"}),o.jsx(Pt,{id:"git-url",value:l,onChange:S=>c(S.target.value),placeholder:"git@github.com:org/repo.git",className:"font-mono"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"git-ref",children:"Ref (branch / tag / sha, optional)"}),o.jsx(Pt,{id:"git-ref",value:d,onChange:S=>m(S.target.value),placeholder:"main",className:"font-mono"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"git-path",children:"Local path (optional)"}),o.jsx(Pt,{id:"git-path",value:h,onChange:S=>g(S.target.value),placeholder:Kf(l)||"repo-name",className:"font-mono"}),o.jsx("p",{className:"text-caption text-muted-foreground",children:"Relative to the session working directory. Leave empty to derive from the URL."})]}),p&&o.jsx("p",{className:"text-body text-destructive",children:p}),o.jsxs(cr,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),o.jsx(pe,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function l9({name:e,displayName:t,variant:n="inline",tone:a="neutral",emptyLabel:s="—",className:l,style:c,title:d}){const m=typeof e=="string"&&e.length>0,h=typeof t=="string"&&t.length>0;if(!m&&!h)return o.jsx("span",{className:Oe("mono text-label",l),style:{color:"var(--fg-4)",...c},title:d,children:s});const g=d??(m&&h?`${t} (@${e})`:h?t:`@${e}`),p=a==="accent"?"var(--accent-dim)":void 0,b=a==="accent"?"var(--accent-dim)":"var(--fg-3)";return n==="stacked"?o.jsxs("span",{className:Oe("inline-flex flex-col leading-tight",l),style:{gap:1,...c},title:g??void 0,children:[h&&o.jsx("span",{className:"text-body",style:{color:p},children:t}),m&&o.jsxs("span",{className:"mono text-caption",style:{color:b},children:["@",e]})]}):o.jsxs("span",{className:Oe("inline-flex items-baseline gap-1.5",l),style:c,title:g??void 0,children:[h&&o.jsx("span",{style:{color:p},children:t}),m&&o.jsxs("span",{className:"mono text-caption",style:{color:b},children:["@",e]})]})}function PN(){return Ce.get(On("/members"))}function o9(e,t){return Ce.patch(On(`/members/${encodeURIComponent(e)}`),t)}function u9(e){return Ce.delete(On(`/members/${encodeURIComponent(e)}`))}function UN(){const{data:e}=Ke({queryKey:["members","name-map"],queryFn:PN,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 c9({agent:e,onSave:t}){const[n,a]=x.useState(!1),s=zv(),l=UN(),c=e.metadata,d=c==null?void 0:c.tree,m=typeof(d==null?void 0:d.role)=="string"?d.role:null,h=Array.isArray(d==null?void 0:d.domains)?(d==null?void 0:d.domains).filter(b=>typeof b=="string"):[],g=e.managerId?l(e.managerId):null,p=e.delegateMention?s(e.delegateMention):null;return o.jsxs(Cn,{children:[o.jsxs(la,{children:[o.jsx(oa,{children:"Profile"}),e.status==="active"&&o.jsxs(pe,{size:"xs",variant:"outline",onClick:()=>a(!0),children:[o.jsx(Sv,{className:"h-3 w-3"})," Edit"]})]}),o.jsxs(Wn,{className:"text-body space-y-1",children:[o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold",children:e.displayName}),e.name&&o.jsxs("span",{className:"ml-2 font-mono text-caption text-muted-foreground",children:["@",e.name]}),p&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"mx-2 text-muted-foreground",children:"·"}),o.jsxs("span",{className:"text-muted-foreground",children:["delegate ",o.jsx(l9,{name:p.name,displayName:p.displayName})]})]})]}),o.jsxs("div",{className:"text-caption text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1",children:[o.jsxs("span",{children:["owner ",o.jsx("span",{className:"text-foreground",children:g??"—"})]}),m&&o.jsxs("span",{children:["role ",o.jsx("span",{className:"text-foreground",children:m})]}),o.jsxs("span",{children:["type ",o.jsx(ya,{tone:e.type==="autonomous_agent"?"accent":"neutral",children:e.type})]}),o.jsxs("span",{children:["visibility"," ",o.jsx(ya,{tone:e.visibility==="organization"?"accent":"outline",children:e.visibility})]}),h.length>0&&o.jsxs("span",{children:["domains"," ",o.jsx("span",{className:"inline-flex flex-wrap gap-1 align-middle",children:h.map(b=>o.jsx(ya,{tone:"outline",children:b},b))})]})]})]}),o.jsx(d9,{agent:e,open:n,onOpenChange:a,onSave:t})]})}function d9({agent:e,open:t,onOpenChange:n,onSave:a}){var M;const{memberId:s,role:l}=pt(),[c,d]=x.useState(e.displayName),[m,h]=x.useState(e.delegateMention??""),[g,p]=x.useState(e.visibility),[b,w]=x.useState(!1),[S,j]=x.useState(null);x.useEffect(()=>{t&&(d(e.displayName),h(e.delegateMention??""),p(e.visibility),j(null))},[t,e]);const E=e.type==="human",C=l==="admin"||e.managerId===s,_=Ke({queryKey:["agents-for-delegate"],queryFn:async()=>(await Dc({limit:100})).items.filter(O=>O.type==="personal_assistant"&&O.status==="active"),enabled:t&&E});async function z(L){L.preventDefault(),j(null);const O=c.trim();if(!O){j("Display name is required.");return}w(!0);try{const F={displayName:O,delegateMention:m||null};g!==e.visibility&&(F.visibility=g),await a(F),n(!1)}catch(F){j(F instanceof Error?F.message:String(F))}finally{w(!1)}}return o.jsx(Tn,{open:t,onOpenChange:n,children:o.jsxs(jn,{children:[o.jsx(Ln,{children:o.jsx(An,{children:"Edit Identity"})}),o.jsxs("form",{onSubmit:z,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{children:"Agent name"}),o.jsx(Pt,{value:e.name?`@${e.name}`:"",disabled:!0,className:"font-mono"}),o.jsx("p",{className:"text-caption text-muted-foreground",children:"Agent name is permanent after creation — used in @mentions and CLI commands."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"id-display",children:"Display Name"}),o.jsx(Pt,{id:"id-display",value:c,onChange:L=>d(L.target.value),placeholder:"How teammates see this agent",maxLength:200})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"id-visibility",children:"Visibility"}),o.jsxs("select",{id:"id-visibility",value:g,onChange:L=>p(L.target.value),disabled:!C,className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[o.jsx("option",{value:$1.PRIVATE,children:"Private — only the manager"}),o.jsx("option",{value:$1.ORGANIZATION,children:"Organization — all members"})]}),o.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&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"id-delegate",children:"Delegate Mention"}),o.jsxs("select",{id:"id-delegate",value:m,onChange:L=>h(L.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[o.jsx("option",{value:"",children:"None"}),(M=_.data)==null?void 0:M.map(L=>o.jsx("option",{value:L.uuid,children:L.displayName?`${L.displayName} (@${L.name??L.uuid})`:L.name?`@${L.name}`:L.uuid},L.uuid))]}),o.jsx("p",{className:"text-caption text-muted-foreground",children:"Assistant that acts on behalf of this agent."})]}),S&&o.jsx("p",{className:"text-body text-destructive",children:S}),o.jsxs(cr,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:()=>n(!1),disabled:b,children:"Cancel"}),o.jsx(pe,{type:"submit",disabled:b,children:b?"Saving…":"Save"})]})]})]})})}function f9(e){return e==="working"?"accent":e==="error"?"error":"outline"}function h9(e){const[t,n]=x.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return o.jsxs(Cn,{children:[o.jsxs(la,{children:[o.jsxs(oa,{children:["MCP servers (",a,")"]}),!e.disabled&&o.jsxs(pe,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[o.jsx(ba,{className:"h-3 w-3"})," Add"]})]}),o.jsx(Wn,{className:"space-y-2",children:e.items.length===0?o.jsx("p",{className:"text-body text-muted-foreground",children:"No MCP servers. Add one to extend the agent's tools."}):e.items.map(s=>{const l=s.status==="deleted"||!e.toolHealth?"unknown":e.toolHealth(s.value.name);return o.jsxs(Wv,{status:s.status,onEdit:()=>n({mode:"edit",key:s.key,initial:s.value}),onDelete:()=>e.onDelete(s.key),onUndo:()=>e.onUndoDelete(s.key),disabled:e.disabled,children:[o.jsx("span",{className:"text-caption rounded bg-muted px-1.5 py-0.5 font-mono",children:s.value.transport}),o.jsx("span",{className:"font-medium font-mono",children:s.value.name}),o.jsx(ya,{tone:f9(l),children:l}),o.jsx("span",{className:"text-caption text-muted-foreground truncate",children:m9(s.value)})]},s.key)})}),t&&o.jsx(p9,{open:!!t,onOpenChange:s=>!s&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenNames:e.otherNames(t.mode==="edit"?t.key:null),onSubmit:s=>{t.mode==="edit"?e.onUpdate(t.key,s):e.onAdd(s),n(null)}})]})}function m9(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 p9({open:e,onOpenChange:t,initial:n,forbiddenNames:a,onSubmit:s}){const[l,c]=x.useState((n==null?void 0:n.transport)??"stdio"),[d,m]=x.useState((n==null?void 0:n.name)??""),[h,g]=x.useState((n==null?void 0:n.transport)==="stdio"?n.command:""),[p,b]=x.useState((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),[w,S]=x.useState(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),[j,E]=x.useState(null);x.useEffect(()=>{e&&(c((n==null?void 0:n.transport)??"stdio"),m((n==null?void 0:n.name)??""),g((n==null?void 0:n.transport)==="stdio"?n.command:""),b((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),S(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),E(null))},[e,n]);function C(_){if(_.preventDefault(),!d.match(/^[a-z0-9][a-z0-9_-]{0,63}$/i)){E("Name must start alphanumeric and contain only a-z0-9_-.");return}if(a.has(d.toLowerCase())){E(`Another MCP server is already named "${d}".`);return}let z;if(l==="stdio"){if(!h.trim()){E("stdio transport requires a command.");return}const M=p.trim().split(/\s+/).filter(L=>L.length>0);z={name:d,transport:"stdio",command:h.trim(),...M.length?{args:M}:{}}}else{const M=w.trim();try{new URL(M)}catch{E("URL is not valid.");return}z={name:d,transport:l,url:M}}s(z)}return o.jsx(Tn,{open:e,onOpenChange:t,children:o.jsxs(jn,{children:[o.jsx(Ln,{children:o.jsx(An,{children:n?"Edit MCP server":"Add MCP server"})}),o.jsxs("form",{onSubmit:C,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"mcp-transport",children:"Transport"}),o.jsxs("select",{id:"mcp-transport",value:l,onChange:_=>c(_.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[o.jsx("option",{value:"stdio",children:"stdio (local subprocess)"}),o.jsx("option",{value:"http",children:"http"}),o.jsx("option",{value:"sse",children:"sse"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"mcp-name",children:"Name"}),o.jsx(Pt,{id:"mcp-name",value:d,onChange:_=>m(_.target.value),placeholder:"playwright",className:"font-mono"})]}),l==="stdio"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"mcp-command",children:"Command"}),o.jsx(Pt,{id:"mcp-command",value:h,onChange:_=>g(_.target.value),placeholder:"/usr/local/bin/playwright-mcp",className:"font-mono"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"mcp-args",children:"Args (space-separated, optional)"}),o.jsx(Pt,{id:"mcp-args",value:p,onChange:_=>b(_.target.value),placeholder:"--port 3000",className:"font-mono"})]})]}):o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"mcp-url",children:"URL"}),o.jsx(Pt,{id:"mcp-url",value:w,onChange:_=>S(_.target.value),placeholder:"https://internal.api/mcp",className:"font-mono"})]}),j&&o.jsx("p",{className:"text-body text-destructive",children:j}),o.jsxs(cr,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),o.jsx(pe,{type:"submit",children:n?"Done":"Add"})]})]})]})})}const g9=[{value:"opus",label:"opus",hint:"most capable"},{value:"sonnet",label:"sonnet",hint:"balanced"},{value:"haiku",label:"haiku",hint:"fastest"}],y9=[{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"}],v9={"claude-code":g9,codex:y9},b9={"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."},x9={value:"",label:"(unset — inherits local)"};function w9({value:e,baseline:t,onChange:n,onRevert:a,disabled:s,provider:l="claude-code"}){const c=e!==t,d=v9[l],m=x.useMemo(()=>{const h=[x9,...d];return e!==""&&!d.some(g=>g.value===e)&&h.push({value:e,label:e,hint:"custom"}),h},[d,e]);return o.jsxs(Cn,{style:{borderColor:c?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[o.jsxs(la,{children:[o.jsxs(oa,{children:["Model",c&&o.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",color:"color-mix(in oklch, var(--state-blocked) 60%, var(--fg))"},children:"changed"})]}),c&&o.jsx(pe,{size:"xs",variant:"ghost",onClick:a,disabled:s,children:"Revert"})]}),o.jsxs(Wn,{className:"space-y-2",children:[o.jsx(S9,{items:m,value:e,onChange:n,disabled:s}),o.jsx("p",{className:"text-caption text-muted-foreground",children:b9[l]})]})]})}function S9({items:e,value:t,onChange:n,disabled:a}){const[s,l]=x.useState(!1),[c,d]=x.useState(null),m=x.useRef(null),h=x.useRef(null),g=e.find(b=>b.value===t)??e[0],p=x.useCallback(()=>{const b=m.current;if(!b)return;const w=b.getBoundingClientRect();d({top:w.bottom+4,left:w.left,width:w.width})},[]);return x.useLayoutEffect(()=>{s&&p()},[s,p]),x.useEffect(()=>{if(!s)return;const b=j=>{var C,_;const E=j.target;(C=m.current)!=null&&C.contains(E)||(_=h.current)!=null&&_.contains(E)||l(!1)},w=j=>{var E;j.key==="Escape"&&(l(!1),(E=m.current)==null||E.focus())},S=()=>p();return document.addEventListener("pointerdown",b),document.addEventListener("keydown",w),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{document.removeEventListener("pointerdown",b),document.removeEventListener("keydown",w),window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[s,p]),o.jsxs("div",{className:"max-w-md",children:[o.jsxs("button",{ref:m,type:"button",disabled:a,onClick:()=>l(b=>!b),className:"mono flex h-9 w-full items-center justify-between rounded-[var(--radius-input)] border border-input bg-transparent pl-3 pr-2 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 hover:border-ring transition-colors cursor-pointer","aria-haspopup":"listbox","aria-expanded":s,children:[o.jsx("span",{className:"truncate",style:{color:(g==null?void 0:g.value)===""?"var(--fg-3)":void 0},children:(g==null?void 0:g.label)??t}),o.jsx(bv,{className:"ml-2 h-3.5 w-3.5 transition-transform",style:{color:"var(--fg-3)",transform:s?"rotate(180deg)":void 0}})]}),s&&c&&Ev.createPortal(o.jsx("div",{ref:h,className:"fixed z-50 overflow-hidden rounded-[var(--radius-input)] py-1",style:{top:c.top,left:c.left,width:c.width,background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",boxShadow:"var(--shadow-md)",maxHeight:280,overflowY:"auto"},children:e.map(b=>{const w=b.value===t;return o.jsxs("button",{type:"button",onClick:()=>{n(b.value),l(!1)},className:"mono flex w-full items-center gap-2 cursor-pointer px-3 py-1.5 text-body text-left hover:bg-accent/40 transition-colors focus-visible:outline-none focus-visible:bg-accent/40",style:{background:w?"var(--bg-hover)":void 0,color:b.value===""?"var(--fg-3)":void 0},children:[o.jsx(ur,{className:"h-3.5 w-3.5 flex-shrink-0",style:{visibility:w?"visible":"hidden",color:"var(--state-idle)"}}),o.jsx("span",{className:"flex-1 truncate",children:b.label}),b.hint&&o.jsx("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:b.hint})]},b.value||"__unset")})}),document.body)]})}function k9(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const j9=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,C9=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,E9={};function Z1(e,t){return(E9.jsx?C9:j9).test(e)}const N9=/[ \t\n\f\r]/g;function _9(e){return typeof e=="object"?e.type==="text"?G1(e.value):!1:G1(e)}function G1(e){return e.replace(N9,"")===""}class Uc{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}}Uc.prototype.normal={};Uc.prototype.property={};Uc.prototype.space=void 0;function BN(e,t){const n={},a={};for(const s of e)Object.assign(n,s.property),Object.assign(a,s.normal);return new Uc(n,a,t)}function Iy(e){return e.toLowerCase()}class Cr{constructor(t,n){this.attribute=n,this.property=t}}Cr.prototype.attribute="";Cr.prototype.booleanish=!1;Cr.prototype.boolean=!1;Cr.prototype.commaOrSpaceSeparated=!1;Cr.prototype.commaSeparated=!1;Cr.prototype.defined=!1;Cr.prototype.mustUseProperty=!1;Cr.prototype.number=!1;Cr.prototype.overloadedBoolean=!1;Cr.prototype.property="";Cr.prototype.spaceSeparated=!1;Cr.prototype.space=void 0;let T9=0;const Je=nl(),wn=nl(),Ly=nl(),ye=nl(),Lt=nl(),no=nl(),Dr=nl();function nl(){return 2**++T9}const Py=Object.freeze(Object.defineProperty({__proto__:null,boolean:Je,booleanish:wn,commaOrSpaceSeparated:Dr,commaSeparated:no,number:ye,overloadedBoolean:Ly,spaceSeparated:Lt},Symbol.toStringTag,{value:"Module"})),fg=Object.keys(Py);class Jv extends Cr{constructor(t,n,a,s){let l=-1;if(super(t,n),V1(this,"space",s),typeof a=="number")for(;++l<fg.length;){const c=fg[l];V1(this,fg[l],(a&Py[c])===Py[c])}}}Jv.prototype.defined=!0;function V1(e,t,n){n&&(e[t]=n)}function To(e){const t={},n={};for(const[a,s]of Object.entries(e.properties)){const l=new Jv(a,e.transform(e.attributes||{},a),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(l.mustUseProperty=!0),t[a]=l,n[Iy(a)]=a,n[Iy(l.attribute)]=a}return new Uc(t,n,e.space)}const FN=To({properties:{ariaActiveDescendant:null,ariaAtomic:wn,ariaAutoComplete:null,ariaBusy:wn,ariaChecked:wn,ariaColCount:ye,ariaColIndex:ye,ariaColSpan:ye,ariaControls:Lt,ariaCurrent:null,ariaDescribedBy:Lt,ariaDetails:null,ariaDisabled:wn,ariaDropEffect:Lt,ariaErrorMessage:null,ariaExpanded:wn,ariaFlowTo:Lt,ariaGrabbed:wn,ariaHasPopup:null,ariaHidden:wn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Lt,ariaLevel:ye,ariaLive:null,ariaModal:wn,ariaMultiLine:wn,ariaMultiSelectable:wn,ariaOrientation:null,ariaOwns:Lt,ariaPlaceholder:null,ariaPosInSet:ye,ariaPressed:wn,ariaReadOnly:wn,ariaRelevant:null,ariaRequired:wn,ariaRoleDescription:Lt,ariaRowCount:ye,ariaRowIndex:ye,ariaRowSpan:ye,ariaSelected:wn,ariaSetSize:ye,ariaSort:null,ariaValueMax:ye,ariaValueMin:ye,ariaValueNow:ye,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function $N(e,t){return t in e?e[t]:t}function HN(e,t){return $N(e,t.toLowerCase())}const A9=To({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:no,acceptCharset:Lt,accessKey:Lt,action:null,allow:null,allowFullScreen:Je,allowPaymentRequest:Je,allowUserMedia:Je,alt:null,as:null,async:Je,autoCapitalize:null,autoComplete:Lt,autoFocus:Je,autoPlay:Je,blocking:Lt,capture:null,charSet:null,checked:Je,cite:null,className:Lt,cols:ye,colSpan:null,content:null,contentEditable:wn,controls:Je,controlsList:Lt,coords:ye|no,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Je,defer:Je,dir:null,dirName:null,disabled:Je,download:Ly,draggable:wn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Je,formTarget:null,headers:Lt,height:ye,hidden:Ly,high:ye,href:null,hrefLang:null,htmlFor:Lt,httpEquiv:Lt,id:null,imageSizes:null,imageSrcSet:null,inert:Je,inputMode:null,integrity:null,is:null,isMap:Je,itemId:null,itemProp:Lt,itemRef:Lt,itemScope:Je,itemType:Lt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Je,low:ye,manifest:null,max:null,maxLength:ye,media:null,method:null,min:null,minLength:ye,multiple:Je,muted:Je,name:null,nonce:null,noModule:Je,noValidate:Je,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Je,optimum:ye,pattern:null,ping:Lt,placeholder:null,playsInline:Je,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Je,referrerPolicy:null,rel:Lt,required:Je,reversed:Je,rows:ye,rowSpan:ye,sandbox:Lt,scope:null,scoped:Je,seamless:Je,selected:Je,shadowRootClonable:Je,shadowRootDelegatesFocus:Je,shadowRootMode:null,shape:null,size:ye,sizes:null,slot:null,span:ye,spellCheck:wn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ye,step:null,style:null,tabIndex:ye,target:null,title:null,translate:null,type:null,typeMustMatch:Je,useMap:null,value:wn,width:ye,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Lt,axis:null,background:null,bgColor:null,border:ye,borderColor:null,bottomMargin:ye,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Je,declare:Je,event:null,face:null,frame:null,frameBorder:null,hSpace:ye,leftMargin:ye,link:null,longDesc:null,lowSrc:null,marginHeight:ye,marginWidth:ye,noResize:Je,noHref:Je,noShade:Je,noWrap:Je,object:null,profile:null,prompt:null,rev:null,rightMargin:ye,rules:null,scheme:null,scrolling:wn,standby:null,summary:null,text:null,topMargin:ye,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ye,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Je,disableRemotePlayback:Je,prefix:null,property:null,results:ye,security:null,unselectable:null},space:"html",transform:HN}),R9=To({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Dr,accentHeight:ye,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ye,amplitude:ye,arabicForm:null,ascent:ye,attributeName:null,attributeType:null,azimuth:ye,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ye,by:null,calcMode:null,capHeight:ye,className:Lt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ye,diffuseConstant:ye,direction:null,display:null,dur:null,divisor:ye,dominantBaseline:null,download:Je,dx:null,dy:null,edgeMode:null,editable:null,elevation:ye,enableBackground:null,end:null,event:null,exponent:ye,externalResourcesRequired:null,fill:null,fillOpacity:ye,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:no,g2:no,glyphName:no,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ye,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ye,horizOriginX:ye,horizOriginY:ye,id:null,ideographic:ye,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ye,k:ye,k1:ye,k2:ye,k3:ye,k4:ye,kernelMatrix:Dr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ye,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ye,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ye,overlineThickness:ye,paintOrder:null,panose1:null,path:null,pathLength:ye,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Lt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ye,pointsAtY:ye,pointsAtZ:ye,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Dr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Dr,rev:Dr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Dr,requiredFeatures:Dr,requiredFonts:Dr,requiredFormats:Dr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ye,specularExponent:ye,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ye,strikethroughThickness:ye,string:null,stroke:null,strokeDashArray:Dr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ye,strokeOpacity:ye,strokeWidth:null,style:null,surfaceScale:ye,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Dr,tabIndex:ye,tableValues:null,target:null,targetX:ye,targetY:ye,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Dr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ye,underlineThickness:ye,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ye,values:null,vAlphabetic:ye,vMathematical:ye,vectorEffect:null,vHanging:ye,vIdeographic:ye,version:null,vertAdvY:ye,vertOriginX:ye,vertOriginY:ye,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ye,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:$N}),qN=To({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),ZN=To({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:HN}),GN=To({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),O9={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"},z9=/[A-Z]/g,Q1=/-[a-z]/g,M9=/^data[-\w.:]+$/i;function D9(e,t){const n=Iy(t);let a=t,s=Cr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&M9.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(Q1,L9);a="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!Q1.test(l)){let c=l.replace(z9,I9);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}s=Jv}return new s(a,t)}function I9(e){return"-"+e.toLowerCase()}function L9(e){return e.charAt(1).toUpperCase()}const P9=BN([FN,A9,qN,ZN,GN],"html"),eb=BN([FN,R9,qN,ZN,GN],"svg");function U9(e){return e.join(" ").trim()}var $l={},hg,K1;function B9(){if(K1)return hg;K1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,d=/^\s+|\s+$/g,m=`
|
|
368
|
+
`,h="/",g="*",p="",b="comment",w="declaration";function S(E,C){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];C=C||{};var _=1,z=1;function M(X){var W=X.match(t);W&&(_+=W.length);var q=X.lastIndexOf(m);z=~q?X.length-q:z+X.length}function L(){var X={line:_,column:z};return function(W){return W.position=new O(X),V(),W}}function O(X){this.start=X,this.end={line:_,column:z},this.source=C.source}O.prototype.content=E;function F(X){var W=new Error(C.source+":"+_+":"+z+": "+X);if(W.reason=X,W.filename=C.source,W.line=_,W.column=z,W.source=E,!C.silent)throw W}function P(X){var W=X.exec(E);if(W){var q=W[0];return M(q),E=E.slice(q.length),W}}function V(){P(n)}function I(X){var W;for(X=X||[];W=Q();)W!==!1&&X.push(W);return X}function Q(){var X=L();if(!(h!=E.charAt(0)||g!=E.charAt(1))){for(var W=2;p!=E.charAt(W)&&(g!=E.charAt(W)||h!=E.charAt(W+1));)++W;if(W+=2,p===E.charAt(W-1))return F("End of comment missing");var q=E.slice(2,W-2);return z+=2,M(q),E=E.slice(W),z+=2,X({type:b,comment:q})}}function ie(){var X=L(),W=P(a);if(W){if(Q(),!P(s))return F("property missing ':'");var q=P(l),ne=X({type:w,property:j(W[0].replace(e,p)),value:q?j(q[0].replace(e,p)):p});return P(c),ne}}function be(){var X=[];I(X);for(var W;W=ie();)W!==!1&&(X.push(W),I(X));return X}return V(),be()}function j(E){return E?E.replace(d,p):p}return hg=S,hg}var Y1;function F9(){if(Y1)return $l;Y1=1;var e=$l&&$l.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty($l,"__esModule",{value:!0}),$l.default=n;const t=e(B9());function n(a,s){let l=null;if(!a||typeof a!="string")return l;const c=(0,t.default)(a),d=typeof s=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:g}=m;d?s(h,g,m):g&&(l=l||{},l[h]=g)}),l}return $l}var Iu={},X1;function $9(){if(X1)return Iu;X1=1,Object.defineProperty(Iu,"__esModule",{value:!0}),Iu.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,l=function(h){return!h||n.test(h)||e.test(h)},c=function(h,g){return g.toUpperCase()},d=function(h,g){return"".concat(g,"-")},m=function(h,g){return g===void 0&&(g={}),l(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(s,d):h=h.replace(a,d),h.replace(t,c))};return Iu.camelCase=m,Iu}var Lu,W1;function H9(){if(W1)return Lu;W1=1;var e=Lu&&Lu.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(F9()),n=$9();function a(s,l){var c={};return!s||typeof s!="string"||(0,t.default)(s,function(d,m){d&&m&&(c[(0,n.camelCase)(d,l)]=m)}),c}return a.default=a,Lu=a,Lu}var q9=H9();const Z9=ah(q9),VN=QN("end"),tb=QN("start");function QN(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 G9(e){const t=tb(e),n=VN(e);if(t&&n)return{start:t,end:n}}function Wu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?J1(e.position):"start"in e||"end"in e?J1(e):"line"in e||"column"in e?Uy(e):""}function Uy(e){return ek(e&&e.line)+":"+ek(e&&e.column)}function J1(e){return Uy(e&&e.start)+"-"+Uy(e&&e.end)}function ek(e){return e&&typeof e=="number"?e:1}class Jn extends Error{constructor(t,n,a){super(),typeof n=="string"&&(a=n,n=void 0);let s="",l={},c=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?s=t:!l.cause&&t&&(c=!0,s=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof a=="string"){const m=a.indexOf(":");m===-1?l.ruleId=a:(l.source=a.slice(0,m),l.ruleId=a.slice(m+1))}if(!l.place&&l.ancestors&&l.ancestors){const m=l.ancestors[l.ancestors.length-1];m&&(l.place=m.position)}const d=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=d?d.line:void 0,this.name=Wu(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=c&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Jn.prototype.file="";Jn.prototype.name="";Jn.prototype.reason="";Jn.prototype.message="";Jn.prototype.stack="";Jn.prototype.column=void 0;Jn.prototype.line=void 0;Jn.prototype.ancestors=void 0;Jn.prototype.cause=void 0;Jn.prototype.fatal=void 0;Jn.prototype.place=void 0;Jn.prototype.ruleId=void 0;Jn.prototype.source=void 0;const nb={}.hasOwnProperty,V9=new Map,Q9=/[A-Z]/g,K9=new Set(["table","tbody","thead","tfoot","tr"]),Y9=new Set(["td","th"]),KN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function X9(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=iF(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=aF(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?eb:P9,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=YN(s,e,void 0);return l&&typeof l!="string"?l:s.create(e,s.Fragment,{children:l||void 0},void 0)}function YN(e,t,n){if(t.type==="element")return W9(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return J9(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return tF(e,t,n);if(t.type==="mdxjsEsm")return eF(e,t);if(t.type==="root")return nF(e,t,n);if(t.type==="text")return rF(e,t)}function W9(e,t,n){const a=e.schema;let s=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(s=eb,e.schema=s),e.ancestors.push(t);const l=WN(e,t.tagName,!1),c=sF(e,t);let d=ab(e,t);return K9.has(t.tagName)&&(d=d.filter(function(m){return typeof m=="string"?!_9(m):!0})),XN(e,c,l,t),rb(c,d),e.ancestors.pop(),e.schema=a,e.create(t,l,c,n)}function J9(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)}mc(e,t.position)}function eF(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);mc(e,t.position)}function tF(e,t,n){const a=e.schema;let s=a;t.name==="svg"&&a.space==="html"&&(s=eb,e.schema=s),e.ancestors.push(t);const l=t.name===null?e.Fragment:WN(e,t.name,!0),c=lF(e,t),d=ab(e,t);return XN(e,c,l,t),rb(c,d),e.ancestors.pop(),e.schema=a,e.create(t,l,c,n)}function nF(e,t,n){const a={};return rb(a,ab(e,t)),e.create(t,e.Fragment,a,n)}function rF(e,t){return t.value}function XN(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function rb(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function aF(e,t,n){return a;function a(s,l,c,d){const h=Array.isArray(c.children)?n:t;return d?h(l,c,d):h(l,c)}}function iF(e,t){return n;function n(a,s,l,c){const d=Array.isArray(l.children),m=tb(a);return t(s,l,c,d,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function sF(e,t){const n={};let a,s;for(s in t.properties)if(s!=="children"&&nb.call(t.properties,s)){const l=oF(e,s,t.properties[s]);if(l){const[c,d]=l;e.tableCellAlignToStyle&&c==="align"&&typeof d=="string"&&Y9.has(t.tagName)?a=d:n[c]=d}}if(a){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return n}function lF(e,t){const n={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const l=a.data.estree.body[0];l.type;const c=l.expression;c.type;const d=c.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else mc(e,t.position);else{const s=a.name;let l;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const d=a.value.data.estree.body[0];d.type,l=e.evaluater.evaluateExpression(d.expression)}else mc(e,t.position);else l=a.value===null?!0:a.value;n[s]=l}return n}function ab(e,t){const n=[];let a=-1;const s=e.passKeys?new Map:V9;for(;++a<t.children.length;){const l=t.children[a];let c;if(e.passKeys){const m=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(m){const h=s.get(m)||0;c=m+"-"+h,s.set(m,h+1)}}const d=YN(e,l,c);d!==void 0&&n.push(d)}return n}function oF(e,t,n){const a=D9(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=a.commaSeparated?k9(n):U9(n)),a.property==="style"){let s=typeof n=="object"?n:uF(e,String(n));return e.stylePropertyNameCase==="css"&&(s=cF(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&a.space?O9[a.property]||a.property:a.attribute,n]}}function uF(e,t){try{return Z9(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const a=n,s=new Jn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=KN+"#cannot-parse-style-attribute",s}}function WN(e,t,n){let a;if(!n)a={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let l=-1,c;for(;++l<s.length;){const d=Z1(s[l])?{type:"Identifier",name:s[l]}:{type:"Literal",value:s[l]};c=c?{type:"MemberExpression",object:c,property:d,computed:!!(l&&d.type==="Literal"),optional:!1}:d}a=c}else a=Z1(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const s=a.value;return nb.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(a);mc(e)}function mc(e,t){const n=new Jn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=KN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function cF(e){const t={};let n;for(n in e)nb.call(e,n)&&(t[dF(n)]=e[n]);return t}function dF(e){let t=e.replace(Q9,fF);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function fF(e){return"-"+e.toLowerCase()}const mg={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},hF={};function ib(e,t){const n=hF,a=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return JN(e,a,s)}function JN(e,t,n){if(mF(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 tk(e.children,t,n)}return Array.isArray(e)?tk(e,t,n):""}function tk(e,t,n){const a=[];let s=-1;for(;++s<e.length;)a[s]=JN(e[s],t,n);return a.join("")}function mF(e){return!!(e&&typeof e=="object")}const nk=document.createElement("i");function sb(e){const t="&"+e+";";nk.innerHTML=t;const n=nk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Pr(e,t,n,a){const s=e.length;let l=0,c;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,a.length<1e4)c=Array.from(a),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);l<a.length;)c=a.slice(l,l+1e4),c.unshift(t,0),e.splice(...c),l+=1e4,t+=1e4}function ta(e,t){return e.length>0?(Pr(e,e.length,0,t),e):t}const rk={}.hasOwnProperty;function e_(e){const t={};let n=-1;for(;++n<e.length;)pF(t,e[n]);return t}function pF(e,t){let n;for(n in t){const s=(rk.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let c;if(l)for(c in l){rk.call(s,c)||(s[c]=[]);const d=l[c];gF(s[c],Array.isArray(d)?d:d?[d]:[])}}}function gF(e,t){let n=-1;const a=[];for(;++n<t.length;)(t[n].add==="after"?e:a).push(t[n]);Pr(e,0,0,a)}function t_(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function va(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const or=ps(/[A-Za-z]/),Yn=ps(/[\dA-Za-z]/),yF=ps(/[#-'*+\--9=?A-Z^-~]/);function Wf(e){return e!==null&&(e<32||e===127)}const By=ps(/\d/),vF=ps(/[\dA-Fa-f]/),bF=ps(/[!-/:-@[-`{-~]/);function Fe(e){return e!==null&&e<-2}function Dt(e){return e!==null&&(e<0||e===32)}function st(e){return e===-2||e===-1||e===32}const Eh=ps(new RegExp("\\p{P}|\\p{S}","u")),Ys=ps(/\s/);function ps(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ao(e){const t=[];let n=-1,a=0,s=0;for(;++n<e.length;){const l=e.charCodeAt(n);let c="";if(l===37&&Yn(e.charCodeAt(n+1))&&Yn(e.charCodeAt(n+2)))s=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(c=String.fromCharCode(l));else if(l>55295&&l<57344){const d=e.charCodeAt(n+1);l<56320&&d>56319&&d<57344?(c=String.fromCharCode(l,d),s=1):c="�"}else c=String.fromCharCode(l);c&&(t.push(e.slice(a,n),encodeURIComponent(c)),a=n+s+1,c=""),s&&(n+=s,s=0)}return t.join("")+e.slice(a)}function yt(e,t,n,a){const s=a?a-1:Number.POSITIVE_INFINITY;let l=0;return c;function c(m){return st(m)?(e.enter(n),d(m)):t(m)}function d(m){return st(m)&&l++<s?(e.consume(m),d):(e.exit(n),t(m))}}const xF={tokenize:wF};function wF(e){const t=e.attempt(this.parser.constructs.contentInitial,a,s);let n;return t;function a(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),yt(e,t,"linePrefix")}function s(d){return e.enter("paragraph"),l(d)}function l(d){const m=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=m),n=m,c(d)}function c(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return Fe(d)?(e.consume(d),e.exit("chunkText"),l):(e.consume(d),c)}}const SF={tokenize:kF},ak={tokenize:jF};function kF(e){const t=this,n=[];let a=0,s,l,c;return d;function d(z){if(a<n.length){const M=n[a];return t.containerState=M[1],e.attempt(M[0].continuation,m,h)(z)}return h(z)}function m(z){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&_();const M=t.events.length;let L=M,O;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){O=t.events[L][1].end;break}C(a);let F=M;for(;F<t.events.length;)t.events[F][1].end={...O},F++;return Pr(t.events,L+1,0,t.events.slice(M)),t.events.length=F,h(z)}return d(z)}function h(z){if(a===n.length){if(!s)return b(z);if(s.currentConstruct&&s.currentConstruct.concrete)return S(z);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ak,g,p)(z)}function g(z){return s&&_(),C(a),b(z)}function p(z){return t.parser.lazy[t.now().line]=a!==n.length,c=t.now().offset,S(z)}function b(z){return t.containerState={},e.attempt(ak,w,S)(z)}function w(z){return a++,n.push([t.currentConstruct,t.containerState]),b(z)}function S(z){if(z===null){s&&_(),C(0),e.consume(z);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:l}),j(z)}function j(z){if(z===null){E(e.exit("chunkFlow"),!0),C(0),e.consume(z);return}return Fe(z)?(e.consume(z),E(e.exit("chunkFlow")),a=0,t.interrupt=void 0,d):(e.consume(z),j)}function E(z,M){const L=t.sliceStream(z);if(M&&L.push(null),z.previous=l,l&&(l.next=z),l=z,s.defineSkip(z.start),s.write(L),t.parser.lazy[z.start.line]){let O=s.events.length;for(;O--;)if(s.events[O][1].start.offset<c&&(!s.events[O][1].end||s.events[O][1].end.offset>c))return;const F=t.events.length;let P=F,V,I;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){if(V){I=t.events[P][1].end;break}V=!0}for(C(a),O=F;O<t.events.length;)t.events[O][1].end={...I},O++;Pr(t.events,P+1,0,t.events.slice(F)),t.events.length=O}}function C(z){let M=n.length;for(;M-- >z;){const L=n[M];t.containerState=L[1],L[0].exit.call(t,e)}n.length=z}function _(){s.write([null]),l=void 0,s=void 0,t.containerState._closeFlow=void 0}}function jF(e,t,n){return yt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function wo(e){if(e===null||Dt(e)||Ys(e))return 1;if(Eh(e))return 2}function Nh(e,t,n){const a=[];let s=-1;for(;++s<e.length;){const l=e[s].resolveAll;l&&!a.includes(l)&&(t=l(t,n),a.push(l))}return t}const Fy={name:"attention",resolveAll:CF,tokenize:EF};function CF(e,t){let n=-1,a,s,l,c,d,m,h,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(a=n;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;m=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[a][1].end},b={...e[n][1].start};ik(p,-m),ik(b,m),c={type:m>1?"strongSequence":"emphasisSequence",start:p,end:{...e[a][1].end}},d={type:m>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},l={type:m>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},s={type:m>1?"strong":"emphasis",start:{...c.start},end:{...d.end}},e[a][1].end={...c.start},e[n][1].start={...d.end},h=[],e[a][1].end.offset-e[a][1].start.offset&&(h=ta(h,[["enter",e[a][1],t],["exit",e[a][1],t]])),h=ta(h,[["enter",s,t],["enter",c,t],["exit",c,t],["enter",l,t]]),h=ta(h,Nh(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),h=ta(h,[["exit",l,t],["enter",d,t],["exit",d,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,h=ta(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,Pr(e,a-1,n-a+3,h),n=a+h.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function EF(e,t){const n=this.parser.constructs.attentionMarkers.null,a=this.previous,s=wo(a);let l;return c;function c(m){return l=m,e.enter("attentionSequence"),d(m)}function d(m){if(m===l)return e.consume(m),d;const h=e.exit("attentionSequence"),g=wo(m),p=!g||g===2&&s||n.includes(m),b=!s||s===2&&g||n.includes(a);return h._open=!!(l===42?p:p&&(s||!b)),h._close=!!(l===42?b:b&&(g||!p)),t(m)}}function ik(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const NF={name:"autolink",tokenize:_F};function _F(e,t,n){let a=0;return s;function s(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(w){return or(w)?(e.consume(w),c):w===64?n(w):h(w)}function c(w){return w===43||w===45||w===46||Yn(w)?(a=1,d(w)):h(w)}function d(w){return w===58?(e.consume(w),a=0,m):(w===43||w===45||w===46||Yn(w))&&a++<32?(e.consume(w),d):(a=0,h(w))}function m(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):w===null||w===32||w===60||Wf(w)?n(w):(e.consume(w),m)}function h(w){return w===64?(e.consume(w),g):yF(w)?(e.consume(w),h):n(w)}function g(w){return Yn(w)?p(w):n(w)}function p(w){return w===46?(e.consume(w),a=0,g):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):b(w)}function b(w){if((w===45||Yn(w))&&a++<63){const S=w===45?b:p;return e.consume(w),S}return n(w)}}const Bc={partial:!0,tokenize:TF};function TF(e,t,n){return a;function a(l){return st(l)?yt(e,s,"linePrefix")(l):s(l)}function s(l){return l===null||Fe(l)?t(l):n(l)}}const n_={continuation:{tokenize:RF},exit:OF,name:"blockQuote",tokenize:AF};function AF(e,t,n){const a=this;return s;function s(c){if(c===62){const d=a.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),l}return n(c)}function l(c){return st(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function RF(e,t,n){const a=this;return s;function s(c){return st(c)?yt(e,l,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):l(c)}function l(c){return e.attempt(n_,t,n)(c)}}function OF(e){e.exit("blockQuote")}const r_={name:"characterEscape",tokenize:zF};function zF(e,t,n){return a;function a(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),s}function s(l){return bF(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const a_={name:"characterReference",tokenize:MF};function MF(e,t,n){const a=this;let s=0,l,c;return d;function d(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),m}function m(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),l=31,c=Yn,g(p))}function h(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,c=vF,g):(e.enter("characterReferenceValue"),l=7,c=By,g(p))}function g(p){if(p===59&&s){const b=e.exit("characterReferenceValue");return c===Yn&&!sb(a.sliceSerialize(b))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(p)&&s++<l?(e.consume(p),g):n(p)}}const sk={partial:!0,tokenize:IF},lk={concrete:!0,name:"codeFenced",tokenize:DF};function DF(e,t,n){const a=this,s={partial:!0,tokenize:L};let l=0,c=0,d;return m;function m(O){return h(O)}function h(O){const F=a.events[a.events.length-1];return l=F&&F[1].type==="linePrefix"?F[2].sliceSerialize(F[1],!0).length:0,d=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(O)}function g(O){return O===d?(c++,e.consume(O),g):c<3?n(O):(e.exit("codeFencedFenceSequence"),st(O)?yt(e,p,"whitespace")(O):p(O))}function p(O){return O===null||Fe(O)?(e.exit("codeFencedFence"),a.interrupt?t(O):e.check(sk,j,M)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(O))}function b(O){return O===null||Fe(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(O)):st(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),yt(e,w,"whitespace")(O)):O===96&&O===d?n(O):(e.consume(O),b)}function w(O){return O===null||Fe(O)?p(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(O))}function S(O){return O===null||Fe(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(O)):O===96&&O===d?n(O):(e.consume(O),S)}function j(O){return e.attempt(s,M,E)(O)}function E(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),C}function C(O){return l>0&&st(O)?yt(e,_,"linePrefix",l+1)(O):_(O)}function _(O){return O===null||Fe(O)?e.check(sk,j,M)(O):(e.enter("codeFlowValue"),z(O))}function z(O){return O===null||Fe(O)?(e.exit("codeFlowValue"),_(O)):(e.consume(O),z)}function M(O){return e.exit("codeFenced"),t(O)}function L(O,F,P){let V=0;return I;function I(W){return O.enter("lineEnding"),O.consume(W),O.exit("lineEnding"),Q}function Q(W){return O.enter("codeFencedFence"),st(W)?yt(O,ie,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):ie(W)}function ie(W){return W===d?(O.enter("codeFencedFenceSequence"),be(W)):P(W)}function be(W){return W===d?(V++,O.consume(W),be):V>=c?(O.exit("codeFencedFenceSequence"),st(W)?yt(O,X,"whitespace")(W):X(W)):P(W)}function X(W){return W===null||Fe(W)?(O.exit("codeFencedFence"),F(W)):P(W)}}}function IF(e,t,n){const a=this;return s;function s(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l)}function l(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}const pg={name:"codeIndented",tokenize:PF},LF={partial:!0,tokenize:UF};function PF(e,t,n){const a=this;return s;function s(h){return e.enter("codeIndented"),yt(e,l,"linePrefix",5)(h)}function l(h){const g=a.events[a.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?c(h):n(h)}function c(h){return h===null?m(h):Fe(h)?e.attempt(LF,c,m)(h):(e.enter("codeFlowValue"),d(h))}function d(h){return h===null||Fe(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),d)}function m(h){return e.exit("codeIndented"),t(h)}}function UF(e,t,n){const a=this;return s;function s(c){return a.parser.lazy[a.now().line]?n(c):Fe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),s):yt(e,l,"linePrefix",5)(c)}function l(c){const d=a.events[a.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(c):Fe(c)?s(c):n(c)}}const BF={name:"codeText",previous:$F,resolve:FF,tokenize:HF};function FF(e){let t=e.length-4,n=3,a,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(a=n;++a<t;)if(e[a][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(a=n-1,t++;++a<=t;)s===void 0?a!==t&&e[a][1].type!=="lineEnding"&&(s=a):(a===t||e[a][1].type==="lineEnding")&&(e[s][1].type="codeTextData",a!==s+2&&(e[s][1].end=e[a-1][1].end,e.splice(s+2,a-s-2),t-=a-s-2,a=s+2),s=void 0);return e}function $F(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function HF(e,t,n){let a=0,s,l;return c;function c(p){return e.enter("codeText"),e.enter("codeTextSequence"),d(p)}function d(p){return p===96?(e.consume(p),a++,d):(e.exit("codeTextSequence"),m(p))}function m(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),m):p===96?(l=e.enter("codeTextSequence"),s=0,g(p)):Fe(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(p))}function h(p){return p===null||p===32||p===96||Fe(p)?(e.exit("codeTextData"),m(p)):(e.consume(p),h)}function g(p){return p===96?(e.consume(p),s++,g):s===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(l.type="codeTextData",h(p))}}class qF{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const a=n??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(t,a):t>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,n,a){const s=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return a&&Pu(this.left,a),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Pu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Pu(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Pu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Pu(this.left,n.reverse())}}}function Pu(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function i_(e){const t={};let n=-1,a,s,l,c,d,m,h;const g=new qF(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(a=g.get(n),n&&a[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(m=a[1]._tokenizer.events,l=0,l<m.length&&m[l][1].type==="lineEndingBlank"&&(l+=2),l<m.length&&m[l][1].type==="content"))for(;++l<m.length&&m[l][1].type!=="content";)m[l][1].type==="chunkText"&&(m[l][1]._isInFirstContentOfListItem=!0,l++);if(a[0]==="enter")a[1].contentType&&(Object.assign(t,ZF(g,n)),n=t[n],h=!0);else if(a[1]._container){for(l=n,s=void 0;l--;)if(c=g.get(l),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(s&&(g.get(s)[1].type="lineEndingBlank"),c[1].type="lineEnding",s=l);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;s&&(a[1].end={...g.get(s)[1].start},d=g.slice(s,n),d.unshift(a),g.splice(s,n-s+1,d))}}return Pr(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function ZF(e,t){const n=e.get(t)[1],a=e.get(t)[2];let s=t-1;const l=[];let c=n._tokenizer;c||(c=a.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const d=c.events,m=[],h={};let g,p,b=-1,w=n,S=0,j=0;const E=[j];for(;w;){for(;e.get(++s)[1]!==w;);l.push(s),w._tokenizer||(g=a.sliceStream(w),w.next||g.push(null),p&&c.defineSkip(w.start),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(g),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),p=w,w=w.next}for(w=n;++b<d.length;)d[b][0]==="exit"&&d[b-1][0]==="enter"&&d[b][1].type===d[b-1][1].type&&d[b][1].start.line!==d[b][1].end.line&&(j=b+1,E.push(j),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(c.events=[],w?(w._tokenizer=void 0,w.previous=void 0):E.pop(),b=E.length;b--;){const C=d.slice(E[b],E[b+1]),_=l.pop();m.push([_,_+C.length-1]),e.splice(_,2,C)}for(m.reverse(),b=-1;++b<m.length;)h[S+m[b][0]]=S+m[b][1],S+=m[b][1]-m[b][0]-1;return h}const GF={resolve:QF,tokenize:KF},VF={partial:!0,tokenize:YF};function QF(e){return i_(e),e}function KF(e,t){let n;return a;function a(d){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(d)}function s(d){return d===null?l(d):Fe(d)?e.check(VF,c,l)(d):(e.consume(d),s)}function l(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function c(d){return e.consume(d),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function YF(e,t,n){const a=this;return s;function s(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),yt(e,l,"linePrefix")}function l(c){if(c===null||Fe(c))return n(c);const d=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(c):e.interrupt(a.parser.constructs.flow,n,t)(c)}}function s_(e,t,n,a,s,l,c,d,m){const h=m||Number.POSITIVE_INFINITY;let g=0;return p;function p(C){return C===60?(e.enter(a),e.enter(s),e.enter(l),e.consume(C),e.exit(l),b):C===null||C===32||C===41||Wf(C)?n(C):(e.enter(a),e.enter(c),e.enter(d),e.enter("chunkString",{contentType:"string"}),j(C))}function b(C){return C===62?(e.enter(l),e.consume(C),e.exit(l),e.exit(s),e.exit(a),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),w(C))}function w(C){return C===62?(e.exit("chunkString"),e.exit(d),b(C)):C===null||C===60||Fe(C)?n(C):(e.consume(C),C===92?S:w)}function S(C){return C===60||C===62||C===92?(e.consume(C),w):w(C)}function j(C){return!g&&(C===null||C===41||Dt(C))?(e.exit("chunkString"),e.exit(d),e.exit(c),e.exit(a),t(C)):g<h&&C===40?(e.consume(C),g++,j):C===41?(e.consume(C),g--,j):C===null||C===32||C===40||Wf(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 l_(e,t,n,a,s,l){const c=this;let d=0,m;return h;function h(w){return e.enter(a),e.enter(s),e.consume(w),e.exit(s),e.enter(l),g}function g(w){return d>999||w===null||w===91||w===93&&!m||w===94&&!d&&"_hiddenFootnoteSupport"in c.parser.constructs?n(w):w===93?(e.exit(l),e.enter(s),e.consume(w),e.exit(s),e.exit(a),t):Fe(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===null||w===91||w===93||Fe(w)||d++>999?(e.exit("chunkString"),g(w)):(e.consume(w),m||(m=!st(w)),w===92?b:p)}function b(w){return w===91||w===92||w===93?(e.consume(w),d++,p):p(w)}}function o_(e,t,n,a,s,l){let c;return d;function d(b){return b===34||b===39||b===40?(e.enter(a),e.enter(s),e.consume(b),e.exit(s),c=b===40?41:b,m):n(b)}function m(b){return b===c?(e.enter(s),e.consume(b),e.exit(s),e.exit(a),t):(e.enter(l),h(b))}function h(b){return b===c?(e.exit(l),m(c)):b===null?n(b):Fe(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),yt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===c||b===null||Fe(b)?(e.exit("chunkString"),h(b)):(e.consume(b),b===92?p:g)}function p(b){return b===c||b===92?(e.consume(b),g):g(b)}}function Ju(e,t){let n;return a;function a(s){return Fe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,a):st(s)?yt(e,a,n?"linePrefix":"lineSuffix")(s):t(s)}}const XF={name:"definition",tokenize:JF},WF={partial:!0,tokenize:e$};function JF(e,t,n){const a=this;let s;return l;function l(w){return e.enter("definition"),c(w)}function c(w){return l_.call(a,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function d(w){return s=va(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),m):n(w)}function m(w){return Dt(w)?Ju(e,h)(w):h(w)}function h(w){return s_(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function g(w){return e.attempt(WF,p,p)(w)}function p(w){return st(w)?yt(e,b,"whitespace")(w):b(w)}function b(w){return w===null||Fe(w)?(e.exit("definition"),a.parser.defined.push(s),t(w)):n(w)}}function e$(e,t,n){return a;function a(d){return Dt(d)?Ju(e,s)(d):n(d)}function s(d){return o_(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function l(d){return st(d)?yt(e,c,"whitespace")(d):c(d)}function c(d){return d===null||Fe(d)?t(d):n(d)}}const t$={name:"hardBreakEscape",tokenize:n$};function n$(e,t,n){return a;function a(l){return e.enter("hardBreakEscape"),e.consume(l),s}function s(l){return Fe(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const r$={name:"headingAtx",resolve:a$,tokenize:i$};function a$(e,t){let n=e.length-2,a=3,s,l;return e[a][1].type==="whitespace"&&(a+=2),n-2>a&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(a===n-1||n-4>a&&e[n-2][1].type==="whitespace")&&(n-=a+1===n?2:4),n>a&&(s={type:"atxHeadingText",start:e[a][1].start,end:e[n][1].end},l={type:"chunkText",start:e[a][1].start,end:e[n][1].end,contentType:"text"},Pr(e,a,n-a+1,[["enter",s,t],["enter",l,t],["exit",l,t],["exit",s,t]])),e}function i$(e,t,n){let a=0;return s;function s(g){return e.enter("atxHeading"),l(g)}function l(g){return e.enter("atxHeadingSequence"),c(g)}function c(g){return g===35&&a++<6?(e.consume(g),c):g===null||Dt(g)?(e.exit("atxHeadingSequence"),d(g)):n(g)}function d(g){return g===35?(e.enter("atxHeadingSequence"),m(g)):g===null||Fe(g)?(e.exit("atxHeading"),t(g)):st(g)?yt(e,d,"whitespace")(g):(e.enter("atxHeadingText"),h(g))}function m(g){return g===35?(e.consume(g),m):(e.exit("atxHeadingSequence"),d(g))}function h(g){return g===null||g===35||Dt(g)?(e.exit("atxHeadingText"),d(g)):(e.consume(g),h)}}const s$=["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"],ok=["pre","script","style","textarea"],l$={concrete:!0,name:"htmlFlow",resolveTo:c$,tokenize:d$},o$={partial:!0,tokenize:h$},u$={partial:!0,tokenize:f$};function c$(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 d$(e,t,n){const a=this;let s,l,c,d,m;return h;function h(T){return g(T)}function g(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),p}function p(T){return T===33?(e.consume(T),b):T===47?(e.consume(T),l=!0,j):T===63?(e.consume(T),s=3,a.interrupt?t:R):or(T)?(e.consume(T),c=String.fromCharCode(T),E):n(T)}function b(T){return T===45?(e.consume(T),s=2,w):T===91?(e.consume(T),s=5,d=0,S):or(T)?(e.consume(T),s=4,a.interrupt?t:R):n(T)}function w(T){return T===45?(e.consume(T),a.interrupt?t:R):n(T)}function S(T){const Z="CDATA[";return T===Z.charCodeAt(d++)?(e.consume(T),d===Z.length?a.interrupt?t:ie:S):n(T)}function j(T){return or(T)?(e.consume(T),c=String.fromCharCode(T),E):n(T)}function E(T){if(T===null||T===47||T===62||Dt(T)){const Z=T===47,Y=c.toLowerCase();return!Z&&!l&&ok.includes(Y)?(s=1,a.interrupt?t(T):ie(T)):s$.includes(c.toLowerCase())?(s=6,Z?(e.consume(T),C):a.interrupt?t(T):ie(T)):(s=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(T):l?_(T):z(T))}return T===45||Yn(T)?(e.consume(T),c+=String.fromCharCode(T),E):n(T)}function C(T){return T===62?(e.consume(T),a.interrupt?t:ie):n(T)}function _(T){return st(T)?(e.consume(T),_):I(T)}function z(T){return T===47?(e.consume(T),I):T===58||T===95||or(T)?(e.consume(T),M):st(T)?(e.consume(T),z):I(T)}function M(T){return T===45||T===46||T===58||T===95||Yn(T)?(e.consume(T),M):L(T)}function L(T){return T===61?(e.consume(T),O):st(T)?(e.consume(T),L):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,F):st(T)?(e.consume(T),O):P(T)}function F(T){return T===m?(e.consume(T),m=null,V):T===null||Fe(T)?n(T):(e.consume(T),F)}function P(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||Dt(T)?L(T):(e.consume(T),P)}function V(T){return T===47||T===62||st(T)?z(T):n(T)}function I(T){return T===62?(e.consume(T),Q):n(T)}function Q(T){return T===null||Fe(T)?ie(T):st(T)?(e.consume(T),Q):n(T)}function ie(T){return T===45&&s===2?(e.consume(T),q):T===60&&s===1?(e.consume(T),ne):T===62&&s===4?(e.consume(T),D):T===63&&s===3?(e.consume(T),R):T===93&&s===5?(e.consume(T),Re):Fe(T)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(o$,U,be)(T)):T===null||Fe(T)?(e.exit("htmlFlowData"),be(T)):(e.consume(T),ie)}function be(T){return e.check(u$,X,U)(T)}function X(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),W}function W(T){return T===null||Fe(T)?be(T):(e.enter("htmlFlowData"),ie(T))}function q(T){return T===45?(e.consume(T),R):ie(T)}function ne(T){return T===47?(e.consume(T),c="",we):ie(T)}function we(T){if(T===62){const Z=c.toLowerCase();return ok.includes(Z)?(e.consume(T),D):ie(T)}return or(T)&&c.length<8?(e.consume(T),c+=String.fromCharCode(T),we):ie(T)}function Re(T){return T===93?(e.consume(T),R):ie(T)}function R(T){return T===62?(e.consume(T),D):T===45&&s===2?(e.consume(T),R):ie(T)}function D(T){return T===null||Fe(T)?(e.exit("htmlFlowData"),U(T)):(e.consume(T),D)}function U(T){return e.exit("htmlFlow"),t(T)}}function f$(e,t,n){const a=this;return s;function s(c){return Fe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):n(c)}function l(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}function h$(e,t,n){return a;function a(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Bc,t,n)}}const m$={name:"htmlText",tokenize:p$};function p$(e,t,n){const a=this;let s,l,c;return d;function d(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),m}function m(R){return R===33?(e.consume(R),h):R===47?(e.consume(R),L):R===63?(e.consume(R),z):or(R)?(e.consume(R),P):n(R)}function h(R){return R===45?(e.consume(R),g):R===91?(e.consume(R),l=0,S):or(R)?(e.consume(R),_):n(R)}function g(R){return R===45?(e.consume(R),w):n(R)}function p(R){return R===null?n(R):R===45?(e.consume(R),b):Fe(R)?(c=p,ne(R)):(e.consume(R),p)}function b(R){return R===45?(e.consume(R),w):p(R)}function w(R){return R===62?q(R):R===45?b(R):p(R)}function S(R){const D="CDATA[";return R===D.charCodeAt(l++)?(e.consume(R),l===D.length?j:S):n(R)}function j(R){return R===null?n(R):R===93?(e.consume(R),E):Fe(R)?(c=j,ne(R)):(e.consume(R),j)}function E(R){return R===93?(e.consume(R),C):j(R)}function C(R){return R===62?q(R):R===93?(e.consume(R),C):j(R)}function _(R){return R===null||R===62?q(R):Fe(R)?(c=_,ne(R)):(e.consume(R),_)}function z(R){return R===null?n(R):R===63?(e.consume(R),M):Fe(R)?(c=z,ne(R)):(e.consume(R),z)}function M(R){return R===62?q(R):z(R)}function L(R){return or(R)?(e.consume(R),O):n(R)}function O(R){return R===45||Yn(R)?(e.consume(R),O):F(R)}function F(R){return Fe(R)?(c=F,ne(R)):st(R)?(e.consume(R),F):q(R)}function P(R){return R===45||Yn(R)?(e.consume(R),P):R===47||R===62||Dt(R)?V(R):n(R)}function V(R){return R===47?(e.consume(R),q):R===58||R===95||or(R)?(e.consume(R),I):Fe(R)?(c=V,ne(R)):st(R)?(e.consume(R),V):q(R)}function I(R){return R===45||R===46||R===58||R===95||Yn(R)?(e.consume(R),I):Q(R)}function Q(R){return R===61?(e.consume(R),ie):Fe(R)?(c=Q,ne(R)):st(R)?(e.consume(R),Q):V(R)}function ie(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),s=R,be):Fe(R)?(c=ie,ne(R)):st(R)?(e.consume(R),ie):(e.consume(R),X)}function be(R){return R===s?(e.consume(R),s=void 0,W):R===null?n(R):Fe(R)?(c=be,ne(R)):(e.consume(R),be)}function X(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Dt(R)?V(R):(e.consume(R),X)}function W(R){return R===47||R===62||Dt(R)?V(R):n(R)}function q(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function ne(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),we}function we(R){return st(R)?yt(e,Re,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):Re(R)}function Re(R){return e.enter("htmlTextData"),c(R)}}const lb={name:"labelEnd",resolveAll:b$,resolveTo:x$,tokenize:w$},g$={tokenize:S$},y$={tokenize:k$},v$={tokenize:j$};function b$(e){let t=-1;const n=[];for(;++t<e.length;){const a=e[t][1];if(n.push(e[t]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const s=a.type==="labelImage"?4:2;a.type="data",t+=s}}return e.length!==n.length&&Pr(e,0,e.length,n),e}function x$(e,t){let n=e.length,a=0,s,l,c,d;for(;n--;)if(s=e[n][1],l){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(l=n,s.type!=="labelLink")){a=2;break}}else s.type==="labelEnd"&&(c=n);const m={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[l][1].start},end:{...e[c][1].end}},g={type:"labelText",start:{...e[l+a+2][1].end},end:{...e[c-2][1].start}};return d=[["enter",m,t],["enter",h,t]],d=ta(d,e.slice(l+1,l+a+3)),d=ta(d,[["enter",g,t]]),d=ta(d,Nh(t.parser.constructs.insideSpan.null,e.slice(l+a+4,c-3),t)),d=ta(d,[["exit",g,t],e[c-2],e[c-1],["exit",h,t]]),d=ta(d,e.slice(c+1)),d=ta(d,[["exit",m,t]]),Pr(e,l,e.length,d),e}function w$(e,t,n){const a=this;let s=a.events.length,l,c;for(;s--;)if((a.events[s][1].type==="labelImage"||a.events[s][1].type==="labelLink")&&!a.events[s][1]._balanced){l=a.events[s][1];break}return d;function d(b){return l?l._inactive?p(b):(c=a.parser.defined.includes(va(a.sliceSerialize({start:l.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(g$,g,c?g:p)(b):b===91?e.attempt(y$,g,c?h:p)(b):c?g(b):p(b)}function h(b){return e.attempt(v$,g,p)(b)}function g(b){return t(b)}function p(b){return l._balanced=!0,n(b)}}function S$(e,t,n){return a;function a(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),s}function s(p){return Dt(p)?Ju(e,l)(p):l(p)}function l(p){return p===41?g(p):s_(e,c,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function c(p){return Dt(p)?Ju(e,m)(p):g(p)}function d(p){return n(p)}function m(p){return p===34||p===39||p===40?o_(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):g(p)}function h(p){return Dt(p)?Ju(e,g)(p):g(p)}function g(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function k$(e,t,n){const a=this;return s;function s(d){return l_.call(a,e,l,c,"reference","referenceMarker","referenceString")(d)}function l(d){return a.parser.defined.includes(va(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function c(d){return n(d)}}function j$(e,t,n){return a;function a(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),s}function s(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const C$={name:"labelStartImage",resolveAll:lb.resolveAll,tokenize:E$};function E$(e,t,n){const a=this;return s;function s(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),l}function l(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),c):n(d)}function c(d){return d===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(d):t(d)}}const N$={name:"labelStartLink",resolveAll:lb.resolveAll,tokenize:_$};function _$(e,t,n){const a=this;return s;function s(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),l}function l(c){return c===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(c):t(c)}}const gg={name:"lineEnding",tokenize:T$};function T$(e,t){return n;function n(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),yt(e,t,"linePrefix")}}const If={name:"thematicBreak",tokenize:A$};function A$(e,t,n){let a=0,s;return l;function l(h){return e.enter("thematicBreak"),c(h)}function c(h){return s=h,d(h)}function d(h){return h===s?(e.enter("thematicBreakSequence"),m(h)):a>=3&&(h===null||Fe(h))?(e.exit("thematicBreak"),t(h)):n(h)}function m(h){return h===s?(e.consume(h),a++,m):(e.exit("thematicBreakSequence"),st(h)?yt(e,d,"whitespace")(h):d(h))}}const vr={continuation:{tokenize:M$},exit:I$,name:"list",tokenize:z$},R$={partial:!0,tokenize:L$},O$={partial:!0,tokenize:D$};function z$(e,t,n){const a=this,s=a.events[a.events.length-1];let l=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,c=0;return d;function d(w){const S=a.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!a.containerState.marker||w===a.containerState.marker:By(w)){if(a.containerState.type||(a.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(If,n,h)(w):h(w);if(!a.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(w)}return n(w)}function m(w){return By(w)&&++c<10?(e.consume(w),m):(!a.interrupt||c<2)&&(a.containerState.marker?w===a.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),h(w)):n(w)}function h(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||w,e.check(Bc,a.interrupt?n:g,e.attempt(R$,b,p))}function g(w){return a.containerState.initialBlankLine=!0,l++,b(w)}function p(w){return st(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),b):n(w)}function b(w){return a.containerState.size=l+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(w)}}function M$(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(Bc,s,l);function s(d){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,yt(e,t,"listItemIndent",a.containerState.size+1)(d)}function l(d){return a.containerState.furtherBlankLines||!st(d)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,c(d)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(O$,t,c)(d))}function c(d){return a.containerState._closeFlow=!0,a.interrupt=void 0,yt(e,e.attempt(vr,t,n),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function D$(e,t,n){const a=this;return yt(e,s,"listItemIndent",a.containerState.size+1);function s(l){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(l):n(l)}}function I$(e){e.exit(this.containerState.type)}function L$(e,t,n){const a=this;return yt(e,s,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(l){const c=a.events[a.events.length-1];return!st(l)&&c&&c[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const uk={name:"setextUnderline",resolveTo:P$,tokenize:U$};function P$(e,t){let n=e.length,a,s,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){a=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const c={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",l?(e.splice(s,0,["enter",c,t]),e.splice(l+1,0,["exit",e[a][1],t]),e[a][1].end={...e[l][1].end}):e[a][1]=c,e.push(["exit",c,t]),e}function U$(e,t,n){const a=this;let s;return l;function l(h){let g=a.events.length,p;for(;g--;)if(a.events[g][1].type!=="lineEnding"&&a.events[g][1].type!=="linePrefix"&&a.events[g][1].type!=="content"){p=a.events[g][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||p)?(e.enter("setextHeadingLine"),s=h,c(h)):n(h)}function c(h){return e.enter("setextHeadingLineSequence"),d(h)}function d(h){return h===s?(e.consume(h),d):(e.exit("setextHeadingLineSequence"),st(h)?yt(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Fe(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const B$={tokenize:F$};function F$(e){const t=this,n=e.attempt(Bc,a,e.attempt(this.parser.constructs.flowInitial,s,yt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(GF,s)),"linePrefix")));return n;function a(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const $$={resolveAll:c_()},H$=u_("string"),q$=u_("text");function u_(e){return{resolveAll:c_(e==="text"?Z$:void 0),tokenize:t};function t(n){const a=this,s=this.parser.constructs[e],l=n.attempt(s,c,d);return c;function c(g){return h(g)?l(g):d(g)}function d(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),m}function m(g){return h(g)?(n.exit("data"),l(g)):(n.consume(g),m)}function h(g){if(g===null)return!0;const p=s[g];let b=-1;if(p)for(;++b<p.length;){const w=p[b];if(!w.previous||w.previous.call(a,a.previous))return!0}return!1}}}function c_(e){return t;function t(n,a){let s=-1,l;for(;++s<=n.length;)l===void 0?n[s]&&n[s][1].type==="data"&&(l=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==l+2&&(n[l][1].end=n[s-1][1].end,n.splice(l+2,s-l-2),s=l+2),l=void 0);return e?e(n,a):n}}function Z$(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const a=e[n-1][1],s=t.sliceStream(a);let l=s.length,c=-1,d=0,m;for(;l--;){const h=s[l];if(typeof h=="string"){for(c=h.length;h.charCodeAt(c-1)===32;)d++,c--;if(c)break;c=-1}else if(h===-2)m=!0,d++;else if(h!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(d=0),d){const h={type:n===e.length||m||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?c:a.start._bufferIndex+c,_index:a.start._index+l,line:a.end.line,column:a.end.column-d,offset:a.end.offset-d},end:{...a.end}};a.end={...h.start},a.start.offset===a.end.offset?Object.assign(a,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const G$={42:vr,43:vr,45:vr,48:vr,49:vr,50:vr,51:vr,52:vr,53:vr,54:vr,55:vr,56:vr,57:vr,62:n_},V$={91:XF},Q$={[-2]:pg,[-1]:pg,32:pg},K$={35:r$,42:If,45:[uk,If],60:l$,61:uk,95:If,96:lk,126:lk},Y$={38:a_,92:r_},X$={[-5]:gg,[-4]:gg,[-3]:gg,33:C$,38:a_,42:Fy,60:[NF,m$],91:N$,92:[t$,r_],93:lb,95:Fy,96:BF},W$={null:[Fy,$$]},J$={null:[42,95]},e8={null:[]},t8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:J$,contentInitial:V$,disable:e8,document:G$,flow:K$,flowInitial:Q$,insideSpan:W$,string:Y$,text:X$},Symbol.toStringTag,{value:"Module"}));function n8(e,t,n){let a={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},l=[];let c=[],d=[];const m={attempt:F(L),check:F(O),consume:_,enter:z,exit:M,interrupt:F(O,{interrupt:!0})},h={code:null,containerState:{},defineSkip:j,events:[],now:S,parser:e,previous:null,sliceSerialize:b,sliceStream:w,write:p};let g=t.tokenize.call(h,m);return t.resolveAll&&l.push(t),h;function p(Q){return c=ta(c,Q),E(),c[c.length-1]!==null?[]:(P(t,0),h.events=Nh(l,h.events,h),h.events)}function b(Q,ie){return a8(w(Q),ie)}function w(Q){return r8(c,Q)}function S(){const{_bufferIndex:Q,_index:ie,line:be,column:X,offset:W}=a;return{_bufferIndex:Q,_index:ie,line:be,column:X,offset:W}}function j(Q){s[Q.line]=Q.column,I()}function E(){let Q;for(;a._index<c.length;){const ie=c[a._index];if(typeof ie=="string")for(Q=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===Q&&a._bufferIndex<ie.length;)C(ie.charCodeAt(a._bufferIndex));else C(ie)}}function C(Q){g=g(Q)}function _(Q){Fe(Q)?(a.line++,a.column=1,a.offset+=Q===-3?2:1,I()):Q!==-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=Q}function z(Q,ie){const be=ie||{};return be.type=Q,be.start=S(),h.events.push(["enter",be,h]),d.push(be),be}function M(Q){const ie=d.pop();return ie.end=S(),h.events.push(["exit",ie,h]),ie}function L(Q,ie){P(Q,ie.from)}function O(Q,ie){ie.restore()}function F(Q,ie){return be;function be(X,W,q){let ne,we,Re,R;return Array.isArray(X)?U(X):"tokenize"in X?U([X]):D(X);function D(ue){return Se;function Se(ve){const me=ve!==null&&ue[ve],Ge=ve!==null&&ue.null,Be=[...Array.isArray(me)?me:me?[me]:[],...Array.isArray(Ge)?Ge:Ge?[Ge]:[]];return U(Be)(ve)}}function U(ue){return ne=ue,we=0,ue.length===0?q:T(ue[we])}function T(ue){return Se;function Se(ve){return R=V(),Re=ue,ue.partial||(h.currentConstruct=ue),ue.name&&h.parser.constructs.disable.null.includes(ue.name)?Y():ue.tokenize.call(ie?Object.assign(Object.create(h),ie):h,m,Z,Y)(ve)}}function Z(ue){return Q(Re,R),W}function Y(ue){return R.restore(),++we<ne.length?T(ne[we]):q}}}function P(Q,ie){Q.resolveAll&&!l.includes(Q)&&l.push(Q),Q.resolve&&Pr(h.events,ie,h.events.length-ie,Q.resolve(h.events.slice(ie),h)),Q.resolveTo&&(h.events=Q.resolveTo(h.events,h))}function V(){const Q=S(),ie=h.previous,be=h.currentConstruct,X=h.events.length,W=Array.from(d);return{from:X,restore:q};function q(){a=Q,h.previous=ie,h.currentConstruct=be,h.events.length=X,d=W,I()}}function I(){a.line in s&&a.column<2&&(a.column=s[a.line],a.offset+=s[a.line]-1)}}function r8(e,t){const n=t.start._index,a=t.start._bufferIndex,s=t.end._index,l=t.end._bufferIndex;let c;if(n===s)c=[e[n].slice(a,l)];else{if(c=e.slice(n,s),a>-1){const d=c[0];typeof d=="string"?c[0]=d.slice(a):c.shift()}l>0&&c.push(e[s].slice(0,l))}return c}function a8(e,t){let n=-1;const a=[];let s;for(;++n<e.length;){const l=e[n];let c;if(typeof l=="string")c=l;else switch(l){case-5:{c="\r";break}case-4:{c=`
|
|
369
|
+
`;break}case-3:{c=`\r
|
|
370
|
+
`;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&s)continue;c=" ";break}default:c=String.fromCharCode(l)}s=l===-2,a.push(c)}return a.join("")}function i8(e){const a={constructs:e_([t8,...(e||{}).extensions||[]]),content:s(xF),defined:[],document:s(SF),flow:s(B$),lazy:{},string:s(H$),text:s(q$)};return a;function s(l){return c;function c(d){return n8(a,l,d)}}}function s8(e){for(;!i_(e););return e}const ck=/[\0\t\n\r]/g;function l8(){let e=1,t="",n=!0,a;return s;function s(l,c,d){const m=[];let h,g,p,b,w;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(c||void 0).decode(l)),p=0,t="",n&&(l.charCodeAt(0)===65279&&p++,n=void 0);p<l.length;){if(ck.lastIndex=p,h=ck.exec(l),b=h&&h.index!==void 0?h.index:l.length,w=l.charCodeAt(b),!h){t=l.slice(p);break}if(w===10&&p===b&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),p<b&&(m.push(l.slice(p,b)),e+=b-p),w){case 0:{m.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,m.push(-2);e++<g;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:a=!0,e=1}p=b+1}return d&&(a&&m.push(-5),t&&m.push(t),m.push(null)),m}}const o8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function u8(e){return e.replace(o8,c8)}function c8(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),l=s===120||s===88;return t_(n.slice(l?2:1),l?16:10)}return sb(n)||e}const d_={}.hasOwnProperty;function d8(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),f8(n)(s8(i8(n).document().write(l8()(e,t,!0))))}function f8(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(en),autolinkProtocol:V,autolinkEmail:V,atxHeading:l(je),blockQuote:l(Ge),characterEscape:V,characterReference:V,codeFenced:l(Be),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:l(Be,c),codeText:l(vt,c),codeTextData:V,data:V,codeFlowValue:V,definition:l(gt),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:l(ae),hardBreakEscape:l(De),hardBreakTrailing:l(De),htmlFlow:l(Ye,c),htmlFlowData:V,htmlText:l(Ye,c),htmlTextData:V,image:l(mn),label:c,link:l(en),listItem:l(Br),listItemValue:b,listOrdered:l(Er,p),listUnordered:l(Er),paragraph:l(hi),reference:T,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:l(je),strong:l(mi),thematicBreak:l(ua)},exit:{atxHeading:m(),atxHeadingSequence:L,autolink:m(),autolinkEmail:me,autolinkProtocol:ve,blockQuote:m(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:Y,characterReferenceMarkerNumeric:Y,characterReferenceValue:ue,characterReference:Se,codeFenced:m(E),codeFencedFence:j,codeFencedFenceInfo:w,codeFencedFenceMeta:S,codeFlowValue:I,codeIndented:m(C),codeText:m(W),codeTextData:I,data:I,definition:m(),definitionDestinationString:M,definitionLabelString:_,definitionTitleString:z,emphasis:m(),hardBreakEscape:m(ie),hardBreakTrailing:m(ie),htmlFlow:m(be),htmlFlowData:I,htmlText:m(X),htmlTextData:I,image:m(ne),label:Re,labelText:we,lineEnding:Q,link:m(q),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:Z,resourceDestinationString:R,resourceTitleString:D,resource:U,setextHeading:m(P),setextHeadingLineSequence:F,setextHeadingText:O,strong:m(),thematicBreak:m()}};f_(t,(e||{}).mdastExtensions||[]);const n={};return a;function a(le){let ge={type:"root",children:[]};const Ue={stack:[ge],tokenStack:[],config:t,enter:d,exit:h,buffer:c,resume:g,data:n},Ze=[];let nt=-1;for(;++nt<le.length;)if(le[nt][1].type==="listOrdered"||le[nt][1].type==="listUnordered")if(le[nt][0]==="enter")Ze.push(nt);else{const on=Ze.pop();nt=s(le,on,nt)}for(nt=-1;++nt<le.length;){const on=t[le[nt][0]];d_.call(on,le[nt][1].type)&&on[le[nt][1].type].call(Object.assign({sliceSerialize:le[nt][2].sliceSerialize},Ue),le[nt][1])}if(Ue.tokenStack.length>0){const on=Ue.tokenStack[Ue.tokenStack.length-1];(on[1]||dk).call(Ue,void 0,on[0])}for(ge.position={start:$i(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:$i(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},nt=-1;++nt<t.transforms.length;)ge=t.transforms[nt](ge)||ge;return ge}function s(le,ge,Ue){let Ze=ge-1,nt=-1,on=!1,er,$t,It,Tt;for(;++Ze<=Ue;){const rt=le[Ze];switch(rt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{rt[0]==="enter"?nt++:nt--,Tt=void 0;break}case"lineEndingBlank":{rt[0]==="enter"&&(er&&!Tt&&!nt&&!It&&(It=Ze),Tt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Tt=void 0}if(!nt&&rt[0]==="enter"&&rt[1].type==="listItemPrefix"||nt===-1&&rt[0]==="exit"&&(rt[1].type==="listUnordered"||rt[1].type==="listOrdered")){if(er){let tr=Ze;for($t=void 0;tr--;){const zn=le[tr];if(zn[1].type==="lineEnding"||zn[1].type==="lineEndingBlank"){if(zn[0]==="exit")continue;$t&&(le[$t][1].type="lineEndingBlank",on=!0),zn[1].type="lineEnding",$t=tr}else if(!(zn[1].type==="linePrefix"||zn[1].type==="blockQuotePrefix"||zn[1].type==="blockQuotePrefixWhitespace"||zn[1].type==="blockQuoteMarker"||zn[1].type==="listItemIndent"))break}It&&(!$t||It<$t)&&(er._spread=!0),er.end=Object.assign({},$t?le[$t][1].start:rt[1].end),le.splice($t||Ze,0,["exit",er,rt[2]]),Ze++,Ue++}if(rt[1].type==="listItemPrefix"){const tr={type:"listItem",_spread:!1,start:Object.assign({},rt[1].start),end:void 0};er=tr,le.splice(Ze,0,["enter",tr,rt[2]]),Ze++,Ue++,It=void 0,Tt=!0}}}return le[ge][1]._spread=on,Ue}function l(le,ge){return Ue;function Ue(Ze){d.call(this,le(Ze),Ze),ge&&ge.call(this,Ze)}}function c(){this.stack.push({type:"fragment",children:[]})}function d(le,ge,Ue){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([ge,Ue||void 0]),le.position={start:$i(ge.start),end:void 0}}function m(le){return ge;function ge(Ue){le&&le.call(this,Ue),h.call(this,Ue)}}function h(le,ge){const Ue=this.stack.pop(),Ze=this.tokenStack.pop();if(Ze)Ze[0].type!==le.type&&(ge?ge.call(this,le,Ze[0]):(Ze[1]||dk).call(this,le,Ze[0]));else throw new Error("Cannot close `"+le.type+"` ("+Wu({start:le.start,end:le.end})+"): it’s not open");Ue.position.end=$i(le.end)}function g(){return ib(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function b(le){if(this.data.expectingFirstListItemValue){const ge=this.stack[this.stack.length-2];ge.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function w(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.lang=le}function S(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.meta=le}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.value=le.replace(/(\r?\n|\r)$/g,"")}function _(le){const ge=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=ge,Ue.identifier=va(this.sliceSerialize(le)).toLowerCase()}function z(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.title=le}function M(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.url=le}function L(le){const ge=this.stack[this.stack.length-1];if(!ge.depth){const Ue=this.sliceSerialize(le).length;ge.depth=Ue}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function F(le){const ge=this.stack[this.stack.length-1];ge.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function P(){this.data.setextHeadingSlurpLineEnding=void 0}function V(le){const Ue=this.stack[this.stack.length-1].children;let Ze=Ue[Ue.length-1];(!Ze||Ze.type!=="text")&&(Ze=ln(),Ze.position={start:$i(le.start),end:void 0},Ue.push(Ze)),this.stack.push(Ze)}function I(le){const ge=this.stack.pop();ge.value+=this.sliceSerialize(le),ge.position.end=$i(le.end)}function Q(le){const ge=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ue=ge.children[ge.children.length-1];Ue.position.end=$i(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ge.type)&&(V.call(this,le),I.call(this,le))}function ie(){this.data.atHardBreak=!0}function be(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.value=le}function X(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.value=le}function W(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.value=le}function q(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=ge,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function ne(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=ge,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function we(le){const ge=this.sliceSerialize(le),Ue=this.stack[this.stack.length-2];Ue.label=u8(ge),Ue.identifier=va(ge).toLowerCase()}function Re(){const le=this.stack[this.stack.length-1],ge=this.resume(),Ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ue.type==="link"){const Ze=le.children;Ue.children=Ze}else Ue.alt=ge}function R(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.url=le}function D(){const le=this.resume(),ge=this.stack[this.stack.length-1];ge.title=le}function U(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function Z(le){const ge=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=ge,Ue.identifier=va(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function Y(le){this.data.characterReferenceType=le.type}function ue(le){const ge=this.sliceSerialize(le),Ue=this.data.characterReferenceType;let Ze;Ue?(Ze=t_(ge,Ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ze=sb(ge);const nt=this.stack[this.stack.length-1];nt.value+=Ze}function Se(le){const ge=this.stack.pop();ge.position.end=$i(le.end)}function ve(le){I.call(this,le);const ge=this.stack[this.stack.length-1];ge.url=this.sliceSerialize(le)}function me(le){I.call(this,le);const ge=this.stack[this.stack.length-1];ge.url="mailto:"+this.sliceSerialize(le)}function Ge(){return{type:"blockquote",children:[]}}function Be(){return{type:"code",lang:null,meta:null,value:""}}function vt(){return{type:"inlineCode",value:""}}function gt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ae(){return{type:"emphasis",children:[]}}function je(){return{type:"heading",depth:0,children:[]}}function De(){return{type:"break"}}function Ye(){return{type:"html",value:""}}function mn(){return{type:"image",title:null,url:"",alt:null}}function en(){return{type:"link",title:null,url:"",children:[]}}function Er(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function Br(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function hi(){return{type:"paragraph",children:[]}}function mi(){return{type:"strong",children:[]}}function ln(){return{type:"text",value:""}}function ua(){return{type:"thematicBreak"}}}function $i(e){return{line:e.line,column:e.column,offset:e.offset}}function f_(e,t){let n=-1;for(;++n<t.length;){const a=t[n];Array.isArray(a)?f_(e,a):h8(e,a)}}function h8(e,t){let n;for(n in t)if(d_.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 dk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Wu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Wu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Wu({start:t.start,end:t.end})+") is still open")}function m8(e){const t=this;t.parser=n;function n(a){return d8(a,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function p8(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 g8(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
371
|
+
`}]}function y8(e,t){const n=t.value?t.value+`
|
|
372
|
+
`:"",a={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(a.className=["language-"+s[0]]);let l={type:"element",tagName:"code",properties:a,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function v8(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function b8(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function x8(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),s=Ao(a.toLowerCase()),l=e.footnoteOrder.indexOf(a);let c,d=e.footnoteCounts.get(a);d===void 0?(d=0,e.footnoteOrder.push(a),c=e.footnoteOrder.length):c=l+1,d+=1,e.footnoteCounts.set(a,d);const m={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,m);const h={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(t,h),e.applyData(t,h)}function w8(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 S8(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function h_(e,t){const n=t.referenceType;let a="]";if(n==="collapsed"?a+="[]":n==="full"&&(a+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+a}];const s=e.all(t),l=s[0];l&&l.type==="text"?l.value="["+l.value:s.unshift({type:"text",value:"["});const c=s[s.length-1];return c&&c.type==="text"?c.value+=a:s.push({type:"text",value:a}),s}function k8(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return h_(e,t);const s={src:Ao(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(s.title=a.title);const l={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,l),e.applyData(t,l)}function j8(e,t){const n={src:Ao(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,a),e.applyData(t,a)}function C8(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 E8(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return h_(e,t);const s={href:Ao(a.url||"")};a.title!==null&&a.title!==void 0&&(s.title=a.title);const l={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function N8(e,t){const n={href:Ao(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function _8(e,t,n){const a=e.all(t),s=n?T8(n):m_(t),l={},c=[];if(typeof t.checked=="boolean"){const g=a[0];let p;g&&g.type==="element"&&g.tagName==="p"?p=g:(p={type:"element",tagName:"p",properties:{},children:[]},a.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let d=-1;for(;++d<a.length;){const g=a[d];(s||d!==0||g.type!=="element"||g.tagName!=="p")&&c.push({type:"text",value:`
|
|
373
|
+
`}),g.type==="element"&&g.tagName==="p"&&!s?c.push(...g.children):c.push(g)}const m=a[a.length-1];m&&(s||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
|
|
374
|
+
`});const h={type:"element",tagName:"li",properties:l,children:c};return e.patch(t,h),e.applyData(t,h)}function T8(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=m_(n[a])}return t}function m_(e){const t=e.spread;return t??e.children.length>1}function A8(e,t){const n={},a=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<a.length;){const c=a[s];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const l={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(a,!0)};return e.patch(t,l),e.applyData(t,l)}function R8(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function O8(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function z8(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function M8(e,t){const n=e.all(t),a=n.shift(),s=[];if(a){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!0)};e.patch(t.children[0],c),s.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},d=tb(t.children[1]),m=VN(t.children[t.children.length-1]);d&&m&&(c.position={start:d,end:m}),s.push(c)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,l),e.applyData(t,l)}function D8(e,t,n){const a=n?n.children:void 0,l=(a?a.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,d=c?c.length:t.children.length;let m=-1;const h=[];for(;++m<d;){const p=t.children[m],b={},w=c?c[m]:void 0;w&&(b.align=w);let S={type:"element",tagName:l,properties:b,children:[]};p&&(S.children=e.all(p),e.patch(p,S),S=e.applyData(p,S)),h.push(S)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,g),e.applyData(t,g)}function I8(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const fk=9,hk=32;function L8(e){const t=String(e),n=/\r?\n|\r/g;let a=n.exec(t),s=0;const l=[];for(;a;)l.push(mk(t.slice(s,a.index),s>0,!0),a[0]),s=a.index+a[0].length,a=n.exec(t);return l.push(mk(t.slice(s),s>0,!1)),l.join("")}function mk(e,t,n){let a=0,s=e.length;if(t){let l=e.codePointAt(a);for(;l===fk||l===hk;)a++,l=e.codePointAt(a)}if(n){let l=e.codePointAt(s-1);for(;l===fk||l===hk;)s--,l=e.codePointAt(s-1)}return s>a?e.slice(a,s):""}function P8(e,t){const n={type:"text",value:L8(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function U8(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const B8={blockquote:p8,break:g8,code:y8,delete:v8,emphasis:b8,footnoteReference:x8,heading:w8,html:S8,imageReference:k8,image:j8,inlineCode:C8,linkReference:E8,link:N8,listItem:_8,list:A8,paragraph:R8,root:O8,strong:z8,table:M8,tableCell:I8,tableRow:D8,text:P8,thematicBreak:U8,toml:xf,yaml:xf,definition:xf,footnoteDefinition:xf};function xf(){}const p_=-1,_h=0,ec=1,Jf=2,ob=3,ub=4,cb=5,db=6,g_=7,y_=8,pk=typeof self=="object"?self:globalThis,F8=(e,t)=>{const n=(s,l)=>(e.set(l,s),s),a=s=>{if(e.has(s))return e.get(s);const[l,c]=t[s];switch(l){case _h:case p_:return n(c,s);case ec:{const d=n([],s);for(const m of c)d.push(a(m));return d}case Jf:{const d=n({},s);for(const[m,h]of c)d[a(m)]=a(h);return d}case ob:return n(new Date(c),s);case ub:{const{source:d,flags:m}=c;return n(new RegExp(d,m),s)}case cb:{const d=n(new Map,s);for(const[m,h]of c)d.set(a(m),a(h));return d}case db:{const d=n(new Set,s);for(const m of c)d.add(a(m));return d}case g_:{const{name:d,message:m}=c;return n(new pk[d](m),s)}case y_:return n(BigInt(c),s);case"BigInt":return n(Object(BigInt(c)),s);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:d}=new Uint8Array(c);return n(new DataView(d),c)}}return n(new pk[l](c),s)};return a},gk=e=>F8(new Map,e)(0),Hl="",{toString:$8}={},{keys:H8}=Object,Uu=e=>{const t=typeof e;if(t!=="object"||!e)return[_h,t];const n=$8.call(e).slice(8,-1);switch(n){case"Array":return[ec,Hl];case"Object":return[Jf,Hl];case"Date":return[ob,Hl];case"RegExp":return[ub,Hl];case"Map":return[cb,Hl];case"Set":return[db,Hl];case"DataView":return[ec,n]}return n.includes("Array")?[ec,n]:n.includes("Error")?[g_,n]:[Jf,n]},wf=([e,t])=>e===_h&&(t==="function"||t==="symbol"),q8=(e,t,n,a)=>{const s=(c,d)=>{const m=a.push(c)-1;return n.set(d,m),m},l=c=>{if(n.has(c))return n.get(c);let[d,m]=Uu(c);switch(d){case _h:{let g=c;switch(m){case"bigint":d=y_,g=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);g=null;break;case"undefined":return s([p_],c)}return s([d,g],c)}case ec:{if(m){let b=c;return m==="DataView"?b=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(b=new Uint8Array(c)),s([m,[...b]],c)}const g=[],p=s([d,g],c);for(const b of c)g.push(l(b));return p}case Jf:{if(m)switch(m){case"BigInt":return s([m,c.toString()],c);case"Boolean":case"Number":case"String":return s([m,c.valueOf()],c)}if(t&&"toJSON"in c)return l(c.toJSON());const g=[],p=s([d,g],c);for(const b of H8(c))(e||!wf(Uu(c[b])))&&g.push([l(b),l(c[b])]);return p}case ob:return s([d,c.toISOString()],c);case ub:{const{source:g,flags:p}=c;return s([d,{source:g,flags:p}],c)}case cb:{const g=[],p=s([d,g],c);for(const[b,w]of c)(e||!(wf(Uu(b))||wf(Uu(w))))&&g.push([l(b),l(w)]);return p}case db:{const g=[],p=s([d,g],c);for(const b of c)(e||!wf(Uu(b)))&&g.push(l(b));return p}}const{message:h}=c;return s([d,{name:m,message:h}],c)};return l},yk=(e,{json:t,lossy:n}={})=>{const a=[];return q8(!(t||n),!!t,new Map,a)(e),a},eh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?gk(yk(e,t)):structuredClone(e):(e,t)=>gk(yk(e,t));function Z8(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function G8(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function V8(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Z8,a=e.options.footnoteBackLabel||G8,s=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let m=-1;for(;++m<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[m]);if(!h)continue;const g=e.all(h),p=String(h.identifier).toUpperCase(),b=Ao(p.toLowerCase());let w=0;const S=[],j=e.footnoteCounts.get(p);for(;j!==void 0&&++w<=j;){S.length>0&&S.push({type:"text",value:" "});let _=typeof n=="string"?n:n(m,w);typeof _=="string"&&(_={type:"text",value:_}),S.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+b+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,w),className:["data-footnote-backref"]},children:Array.isArray(_)?_:[_]})}const E=g[g.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const _=E.children[E.children.length-1];_&&_.type==="text"?_.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...S)}else g.push(...S);const C={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(g,!0)};e.patch(h,C),d.push(C)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...eh(c),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
|
|
375
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:`
|
|
376
|
+
`}]}}const Th=(function(e){if(e==null)return X8;if(typeof e=="function")return Ah(e);if(typeof e=="object")return Array.isArray(e)?Q8(e):K8(e);if(typeof e=="string")return Y8(e);throw new Error("Expected function, string, or object as test")});function Q8(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Th(e[n]);return Ah(a);function a(...s){let l=-1;for(;++l<t.length;)if(t[l].apply(this,s))return!0;return!1}}function K8(e){const t=e;return Ah(n);function n(a){const s=a;let l;for(l in e)if(s[l]!==t[l])return!1;return!0}}function Y8(e){return Ah(t);function t(n){return n&&n.type===e}}function Ah(e){return t;function t(n,a,s){return!!(W8(n)&&e.call(this,n,typeof a=="number"?a:void 0,s||void 0))}}function X8(){return!0}function W8(e){return e!==null&&typeof e=="object"&&"type"in e}const v_=[],J8=!0,$y=!1,eH="skip";function b_(e,t,n,a){let s;typeof t=="function"&&typeof n!="function"?(a=n,n=t):s=t;const l=Th(s),c=a?-1:1;d(e,void 0,[])();function d(m,h,g){const p=m&&typeof m=="object"?m:{};if(typeof p.type=="string"){const w=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return b;function b(){let w=v_,S,j,E;if((!t||l(m,h,g[g.length-1]||void 0))&&(w=tH(n(m,g)),w[0]===$y))return w;if("children"in m&&m.children){const C=m;if(C.children&&w[0]!==eH)for(j=(a?C.children.length:-1)+c,E=g.concat(C);j>-1&&j<C.children.length;){const _=C.children[j];if(S=d(_,j,E)(),S[0]===$y)return S;j=typeof S[1]=="number"?S[1]:j+c}}return w}}}function tH(e){return Array.isArray(e)?e:typeof e=="number"?[J8,e]:e==null?v_:[e]}function fb(e,t,n,a){let s,l,c;typeof t=="function"&&typeof n!="function"?(l=void 0,c=t,s=n):(l=t,c=n,s=a),b_(e,l,d,s);function d(m,h){const g=h[h.length-1],p=g?g.children.indexOf(m):void 0;return c(m,p,g)}}const Hy={}.hasOwnProperty,nH={};function rH(e,t){const n=t||nH,a=new Map,s=new Map,l=new Map,c={...B8,...n.handlers},d={all:h,applyData:iH,definitionById:a,footnoteById:s,footnoteCounts:l,footnoteOrder:[],handlers:c,one:m,options:n,patch:aH,wrap:lH};return fb(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const p=g.type==="definition"?a:s,b=String(g.identifier).toUpperCase();p.has(b)||p.set(b,g)}}),d;function m(g,p){const b=g.type,w=d.handlers[b];if(Hy.call(d.handlers,b)&&w)return w(d,g,p);if(d.options.passThrough&&d.options.passThrough.includes(b)){if("children"in g){const{children:j,...E}=g,C=eh(E);return C.children=d.all(g),C}return eh(g)}return(d.options.unknownHandler||sH)(d,g,p)}function h(g){const p=[];if("children"in g){const b=g.children;let w=-1;for(;++w<b.length;){const S=d.one(b[w],g);if(S){if(w&&b[w-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=vk(S.value)),!Array.isArray(S)&&S.type==="element")){const j=S.children[0];j&&j.type==="text"&&(j.value=vk(j.value))}Array.isArray(S)?p.push(...S):p.push(S)}}}return p}}function aH(e,t){e.position&&(t.position=G9(e))}function iH(e,t){let n=t;if(e&&e.data){const a=e.data.hName,s=e.data.hChildren,l=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"&&l&&Object.assign(n.properties,eh(l)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function sH(e,t){const n=t.data||{},a="value"in t&&!(Hy.call(n,"hProperties")||Hy.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function lH(e,t){const n=[];let a=-1;for(t&&n.push({type:"text",value:`
|
|
377
|
+
`});++a<e.length;)a&&n.push({type:"text",value:`
|
|
378
|
+
`}),n.push(e[a]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
379
|
+
`}),n}function vk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function bk(e,t){const n=rH(e,t),a=n.one(e,void 0),s=V8(n),l=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return s&&l.children.push({type:"text",value:`
|
|
380
|
+
`},s),l}function oH(e,t){return e&&"run"in e?async function(n,a){const s=bk(n,{file:a,...t});await e.run(s,a)}:function(n,a){return bk(n,{file:a,...e||t})}}function xk(e){if(e)throw e}var yg,wk;function uH(){if(wk)return yg;wk=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},l=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var g=e.call(h,"constructor"),p=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!p)return!1;var b;for(b in h);return typeof b>"u"||e.call(h,b)},c=function(h,g){n&&g.name==="__proto__"?n(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},d=function(h,g){if(g==="__proto__")if(e.call(h,g)){if(a)return a(h,g).value}else return;return h[g]};return yg=function m(){var h,g,p,b,w,S,j=arguments[0],E=1,C=arguments.length,_=!1;for(typeof j=="boolean"&&(_=j,j=arguments[1]||{},E=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});E<C;++E)if(h=arguments[E],h!=null)for(g in h)p=d(j,g),b=d(h,g),j!==b&&(_&&b&&(l(b)||(w=s(b)))?(w?(w=!1,S=p&&s(p)?p:[]):S=p&&l(p)?p:{},c(j,{name:g,newValue:m(_,S,b)})):typeof b<"u"&&c(j,{name:g,newValue:b}));return j},yg}var cH=uH();const vg=ah(cH);function qy(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function dH(){const e=[],t={run:n,use:a};return t;function n(...s){let l=-1;const c=s.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);d(null,...s);function d(m,...h){const g=e[++l];let p=-1;if(m){c(m);return}for(;++p<s.length;)(h[p]===null||h[p]===void 0)&&(h[p]=s[p]);s=h,g?fH(g,d)(...h):c(null,...h)}}function a(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function fH(e,t){let n;return a;function a(...c){const d=e.length>c.length;let m;d&&c.push(s);try{m=e.apply(this,c)}catch(h){const g=h;if(d&&n)throw g;return s(g)}d||(m&&m.then&&typeof m.then=="function"?m.then(l,s):m instanceof Error?s(m):l(m))}function s(c,...d){n||(n=!0,t(c,...d))}function l(c){s(null,c)}}const Ea={basename:hH,dirname:mH,extname:pH,join:gH,sep:"/"};function hH(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Fc(e);let n=0,a=-1,s=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(l){n=s+1;break}}else a<0&&(l=!0,a=s+1);return a<0?"":e.slice(n,a)}if(t===e)return"";let c=-1,d=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(l){n=s+1;break}}else c<0&&(l=!0,c=s+1),d>-1&&(e.codePointAt(s)===t.codePointAt(d--)?d<0&&(a=s):(d=-1,a=c));return n===a?a=c:a<0&&(a=e.length),e.slice(n,a)}function mH(e){if(Fc(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 pH(e){Fc(e);let t=e.length,n=-1,a=0,s=-1,l=0,c;for(;t--;){const d=e.codePointAt(t);if(d===47){if(c){a=t+1;break}continue}n<0&&(c=!0,n=t+1),d===46?s<0?s=t:l!==1&&(l=1):s>-1&&(l=-1)}return s<0||n<0||l===0||l===1&&s===n-1&&s===a+1?"":e.slice(s,n)}function gH(...e){let t=-1,n;for(;++t<e.length;)Fc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":yH(n)}function yH(e){Fc(e);const t=e.codePointAt(0)===47;let n=vH(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function vH(e,t){let n="",a=0,s=-1,l=0,c=-1,d,m;for(;++c<=e.length;){if(c<e.length)d=e.codePointAt(c);else{if(d===47)break;d=47}if(d===47){if(!(s===c-1||l===1))if(s!==c-1&&l===2){if(n.length<2||a!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(m=n.lastIndexOf("/"),m!==n.length-1){m<0?(n="",a=0):(n=n.slice(0,m),a=n.length-1-n.lastIndexOf("/")),s=c,l=0;continue}}else if(n.length>0){n="",a=0,s=c,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",a=2)}else n.length>0?n+="/"+e.slice(s+1,c):n=e.slice(s+1,c),a=c-s-1;s=c,l=0}else d===46&&l>-1?l++:l=-1}return n}function Fc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const bH={cwd:xH};function xH(){return"/"}function Zy(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function wH(e){if(typeof e=="string")e=new URL(e);else if(!Zy(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return SH(e)}function SH(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const a=t.codePointAt(n+2);if(a===70||a===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const bg=["history","path","basename","stem","extname","dirname"];class x_{constructor(t){let n;t?Zy(t)?n={path:t}:typeof t=="string"||kH(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":bH.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<bg.length;){const l=bg[a];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let s;for(s in n)bg.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Ea.basename(this.path):void 0}set basename(t){wg(t,"basename"),xg(t,"basename"),this.path=Ea.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ea.dirname(this.path):void 0}set dirname(t){Sk(this.basename,"dirname"),this.path=Ea.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ea.extname(this.path):void 0}set extname(t){if(xg(t,"extname"),Sk(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ea.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Zy(t)&&(t=wH(t)),wg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ea.basename(this.path,this.extname):void 0}set stem(t){wg(t,"stem"),xg(t,"stem"),this.path=Ea.join(this.dirname||"",t+(this.extname||""))}fail(t,n,a){const s=this.message(t,n,a);throw s.fatal=!0,s}info(t,n,a){const s=this.message(t,n,a);return s.fatal=void 0,s}message(t,n,a){const s=new Jn(t,n,a);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function xg(e,t){if(e&&e.includes(Ea.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ea.sep+"`")}function wg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Sk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function kH(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const jH=(function(e){const a=this.constructor.prototype,s=a[e],l=function(){return s.apply(l,arguments)};return Object.setPrototypeOf(l,a),l}),CH={}.hasOwnProperty;class hb extends jH{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=dH()}copy(){const t=new hb;let n=-1;for(;++n<this.attachers.length;){const a=this.attachers[n];t.use(...a)}return t.data(vg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(jg("data",this.frozen),this.namespace[t]=n,this):CH.call(this.namespace,t)&&this.namespace[t]||void 0:t?(jg("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const s=n.call(t,...a);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Sf(t),a=this.parser||this.Parser;return Sg("parse",a),a(String(n),n)}process(t,n){const a=this;return this.freeze(),Sg("process",this.parser||this.Parser),kg("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(l,c){const d=Sf(t),m=a.parse(d);a.run(m,d,function(g,p,b){if(g||!p||!b)return h(g);const w=p,S=a.stringify(w,b);_H(S)?b.value=S:b.result=S,h(g,b)});function h(g,p){g||!p?c(g):l?l(p):n(void 0,p)}}}processSync(t){let n=!1,a;return this.freeze(),Sg("processSync",this.parser||this.Parser),kg("processSync",this.compiler||this.Compiler),this.process(t,s),jk("processSync","process",n),a;function s(l,c){n=!0,xk(l),a=c}}run(t,n,a){kk(t),this.freeze();const s=this.transformers;return!a&&typeof n=="function"&&(a=n,n=void 0),a?l(void 0,a):new Promise(l);function l(c,d){const m=Sf(n);s.run(t,m,h);function h(g,p,b){const w=p||t;g?d(g):c?c(w):a(void 0,w,b)}}}runSync(t,n){let a=!1,s;return this.run(t,n,l),jk("runSync","run",a),s;function l(c,d){xk(c),s=d,a=!0}}stringify(t,n){this.freeze();const a=Sf(n),s=this.compiler||this.Compiler;return kg("stringify",s),kk(t),s(t,a)}use(t,...n){const a=this.attachers,s=this.namespace;if(jg("use",this.frozen),t!=null)if(typeof t=="function")m(t,n);else if(typeof t=="object")Array.isArray(t)?d(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function l(h){if(typeof h=="function")m(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...p]=h;m(g,p)}else c(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function c(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");d(h.plugins),h.settings&&(s.settings=vg(!0,s.settings,h.settings))}function d(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const p=h[g];l(p)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function m(h,g){let p=-1,b=-1;for(;++p<a.length;)if(a[p][0]===h){b=p;break}if(b===-1)a.push([h,...g]);else if(g.length>0){let[w,...S]=g;const j=a[b][1];qy(j)&&qy(w)&&(w=vg(!0,j,w)),a[b]=[h,w,...S]}}}}const EH=new hb().freeze();function Sg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function kg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function jg(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function kk(e){if(!qy(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function jk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Sf(e){return NH(e)?e:new x_(e)}function NH(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function _H(e){return typeof e=="string"||TH(e)}function TH(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const AH="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ck=[],Ek={allowDangerousHtml:!0},RH=/^(https?|ircs?|mailto|xmpp)$/i,OH=[{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 zH(e){const t=MH(e),n=DH(e);return IH(t.runSync(t.parse(n),n),e)}function MH(e){const t=e.rehypePlugins||Ck,n=e.remarkPlugins||Ck,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ek}:Ek;return EH().use(m8).use(n).use(oH,a).use(t)}function DH(e){const t=e.children||"",n=new x_;return typeof t=="string"&&(n.value=t),n}function IH(e,t){const n=t.allowedElements,a=t.allowElement,s=t.components,l=t.disallowedElements,c=t.skipHtml,d=t.unwrapDisallowed,m=t.urlTransform||LH;for(const g of OH)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+AH+g.id,void 0);return fb(e,h),X9(e,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function h(g,p,b){if(g.type==="raw"&&b&&typeof p=="number")return c?b.children.splice(p,1):b.children[p]={type:"text",value:g.value},p;if(g.type==="element"){let w;for(w in mg)if(Object.hasOwn(mg,w)&&Object.hasOwn(g.properties,w)){const S=g.properties[w],j=mg[w];(j===null||j.includes(g.tagName))&&(g.properties[w]=m(String(S||""),w,g))}}if(g.type==="element"){let w=n?!n.includes(g.tagName):l?l.includes(g.tagName):!1;if(!w&&a&&typeof p=="number"&&(w=!a(g,p,b)),w&&b&&typeof p=="number")return d&&g.children?b.children.splice(p,1,...g.children):b.children.splice(p,1),p}}}function LH(e){const t=e.indexOf(":"),n=e.indexOf("?"),a=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||a!==-1&&t>a||RH.test(e.slice(0,t))?e:""}function PH(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function w_(e,t,n){const s=Th((n||{}).ignore||[]),l=UH(t);let c=-1;for(;++c<l.length;)b_(e,"text",d);function d(h,g){let p=-1,b;for(;++p<g.length;){const w=g[p],S=b?b.children:void 0;if(s(w,S?S.indexOf(w):void 0,b))return;b=w}if(b)return m(h,g)}function m(h,g){const p=g[g.length-1],b=l[c][0],w=l[c][1];let S=0;const E=p.children.indexOf(h);let C=!1,_=[];b.lastIndex=0;let z=b.exec(h.value);for(;z;){const M=z.index,L={index:z.index,input:z.input,stack:[...g,h]};let O=w(...z,L);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?b.lastIndex=M+1:(S!==M&&_.push({type:"text",value:h.value.slice(S,M)}),Array.isArray(O)?_.push(...O):O&&_.push(O),S=M+z[0].length,C=!0),!b.global)break;z=b.exec(h.value)}return C?(S<h.value.length&&_.push({type:"text",value:h.value.slice(S)}),p.children.splice(E,1,..._)):_=[h],E+_.length}}function UH(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let a=-1;for(;++a<n.length;){const s=n[a];t.push([BH(s[0]),FH(s[1])])}return t}function BH(e){return typeof e=="string"?new RegExp(PH(e),"g"):e}function FH(e){return typeof e=="function"?e:function(){return e}}function $H(e){w_(e,[/\r?\n|\r/g,HH])}function HH(){return{type:"break"}}function qH(){return function(e){$H(e)}}function Nk(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,s=n.indexOf(t);for(;s!==-1;)a++,s=n.indexOf(t,s+t.length);return a}const Cg="phrasing",Eg=["autolink","link","image","label"];function ZH(){return{transforms:[WH],enter:{literalAutolink:VH,literalAutolinkEmail:Ng,literalAutolinkHttp:Ng,literalAutolinkWww:Ng},exit:{literalAutolink:XH,literalAutolinkEmail:YH,literalAutolinkHttp:QH,literalAutolinkWww:KH}}}function GH(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Cg,notInConstruct:Eg},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Cg,notInConstruct:Eg},{character:":",before:"[ps]",after:"\\/",inConstruct:Cg,notInConstruct:Eg}]}}function VH(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ng(e){this.config.enter.autolinkProtocol.call(this,e)}function QH(e){this.config.exit.autolinkProtocol.call(this,e)}function KH(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 YH(e){this.config.exit.autolinkEmail.call(this,e)}function XH(e){this.exit(e)}function WH(e){w_(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,JH],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),eq]],{ignore:["link","linkReference"]})}function JH(e,t,n,a,s){let l="";if(!S_(s)||(/^w/i.test(t)&&(n=t+n,t="",l="http://"),!tq(n)))return!1;const c=nq(n+a);if(!c[0])return!1;const d={type:"link",title:null,url:l+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[d,{type:"text",value:c[1]}]:d}function eq(e,t,n,a){return!S_(a,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function tq(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 nq(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],a=n.indexOf(")");const s=Nk(e,"(");let l=Nk(e,")");for(;a!==-1&&s>l;)e+=n.slice(0,a+1),n=n.slice(a+1),a=n.indexOf(")"),l++;return[e,n]}function S_(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ys(n)||Eh(n))&&(!t||n!==47)}k_.peek=dq;function rq(){this.buffer()}function aq(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function iq(){this.buffer()}function sq(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function lq(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=va(this.sliceSerialize(e)).toLowerCase(),n.label=t}function oq(e){this.exit(e)}function uq(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=va(this.sliceSerialize(e)).toLowerCase(),n.label=t}function cq(e){this.exit(e)}function dq(){return"["}function k_(e,t,n,a){const s=n.createTracker(a);let l=s.move("[^");const c=n.enter("footnoteReference"),d=n.enter("reference");return l+=s.move(n.safe(n.associationId(e),{after:"]",before:l})),d(),c(),l+=s.move("]"),l}function fq(){return{enter:{gfmFootnoteCallString:rq,gfmFootnoteCall:aq,gfmFootnoteDefinitionLabelString:iq,gfmFootnoteDefinition:sq},exit:{gfmFootnoteCallString:lq,gfmFootnoteCall:oq,gfmFootnoteDefinitionLabelString:uq,gfmFootnoteDefinition:cq}}}function hq(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:k_},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(a,s,l,c){const d=l.createTracker(c);let m=d.move("[^");const h=l.enter("footnoteDefinition"),g=l.enter("label");return m+=d.move(l.safe(l.associationId(a),{before:m,after:"]"})),g(),m+=d.move("]:"),a.children&&a.children.length>0&&(d.shift(4),m+=d.move((t?`
|
|
381
|
+
`:" ")+l.indentLines(l.containerFlow(a,d.current()),t?j_:mq))),h(),m}}function mq(e,t,n){return t===0?e:j_(e,t,n)}function j_(e,t,n){return(n?"":" ")+e}const pq=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];C_.peek=xq;function gq(){return{canContainEols:["delete"],enter:{strikethrough:vq},exit:{strikethrough:bq}}}function yq(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:pq}],handlers:{delete:C_}}}function vq(e){this.enter({type:"delete",children:[]},e)}function bq(e){this.exit(e)}function C_(e,t,n,a){const s=n.createTracker(a),l=n.enter("strikethrough");let c=s.move("~~");return c+=n.containerPhrasing(e,{...s.current(),before:c,after:"~"}),c+=s.move("~~"),l(),c}function xq(){return"~"}function wq(e){return e.length}function Sq(e,t){const n=t||{},a=(n.align||[]).concat(),s=n.stringLength||wq,l=[],c=[],d=[],m=[];let h=0,g=-1;for(;++g<e.length;){const j=[],E=[];let C=-1;for(e[g].length>h&&(h=e[g].length);++C<e[g].length;){const _=kq(e[g][C]);if(n.alignDelimiters!==!1){const z=s(_);E[C]=z,(m[C]===void 0||z>m[C])&&(m[C]=z)}j.push(_)}c[g]=j,d[g]=E}let p=-1;if(typeof a=="object"&&"length"in a)for(;++p<h;)l[p]=_k(a[p]);else{const j=_k(a);for(;++p<h;)l[p]=j}p=-1;const b=[],w=[];for(;++p<h;){const j=l[p];let E="",C="";j===99?(E=":",C=":"):j===108?E=":":j===114&&(C=":");let _=n.alignDelimiters===!1?1:Math.max(1,m[p]-E.length-C.length);const z=E+"-".repeat(_)+C;n.alignDelimiters!==!1&&(_=E.length+_+C.length,_>m[p]&&(m[p]=_),w[p]=_),b[p]=z}c.splice(1,0,b),d.splice(1,0,w),g=-1;const S=[];for(;++g<c.length;){const j=c[g],E=d[g];p=-1;const C=[];for(;++p<h;){const _=j[p]||"";let z="",M="";if(n.alignDelimiters!==!1){const L=m[p]-(E[p]||0),O=l[p];O===114?z=" ".repeat(L):O===99?L%2?(z=" ".repeat(L/2+.5),M=" ".repeat(L/2-.5)):(z=" ".repeat(L/2),M=z):M=" ".repeat(L)}n.delimiterStart!==!1&&!p&&C.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&_==="")&&(n.delimiterStart!==!1||p)&&C.push(" "),n.alignDelimiters!==!1&&C.push(z),C.push(_),n.alignDelimiters!==!1&&C.push(M),n.padding!==!1&&C.push(" "),(n.delimiterEnd!==!1||p!==h-1)&&C.push("|")}S.push(n.delimiterEnd===!1?C.join("").replace(/ +$/,""):C.join(""))}return S.join(`
|
|
382
|
+
`)}function kq(e){return e==null?"":String(e)}function _k(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 jq(e,t,n,a){const s=n.enter("blockquote"),l=n.createTracker(a);l.move("> "),l.shift(2);const c=n.indentLines(n.containerFlow(e,l.current()),Cq);return s(),c}function Cq(e,t,n){return">"+(n?"":" ")+e}function Eq(e,t){return Tk(e,t.inConstruct,!0)&&!Tk(e,t.notInConstruct,!1)}function Tk(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 Ak(e,t,n,a){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
|
|
383
|
+
`&&Eq(n.stack,n.unsafe[s]))return/[ \t]/.test(a.before)?"":" ";return`\\
|
|
384
|
+
`}function Nq(e,t){const n=String(e);let a=n.indexOf(t),s=a,l=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===s?++l>c&&(c=l):l=1,s=a+t.length,a=n.indexOf(t,s);return c}function _q(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Tq(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 Aq(e,t,n,a){const s=Tq(n),l=e.value||"",c=s==="`"?"GraveAccent":"Tilde";if(_q(e,n)){const p=n.enter("codeIndented"),b=n.indentLines(l,Rq);return p(),b}const d=n.createTracker(a),m=s.repeat(Math.max(Nq(l,s)+1,3)),h=n.enter("codeFenced");let g=d.move(m);if(e.lang){const p=n.enter(`codeFencedLang${c}`);g+=d.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...d.current()})),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${c}`);g+=d.move(" "),g+=d.move(n.safe(e.meta,{before:g,after:`
|
|
385
|
+
`,encode:["`"],...d.current()})),p()}return g+=d.move(`
|
|
386
|
+
`),l&&(g+=d.move(l+`
|
|
387
|
+
`)),g+=d.move(m),h(),g}function Rq(e,t,n){return(n?"":" ")+e}function mb(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 Oq(e,t,n,a){const s=mb(n),l=s==='"'?"Quote":"Apostrophe",c=n.enter("definition");let d=n.enter("label");const m=n.createTracker(a);let h=m.move("[");return h+=m.move(n.safe(n.associationId(e),{before:h,after:"]",...m.current()})),h+=m.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(n.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(d=n.enter("destinationRaw"),h+=m.move(n.safe(e.url,{before:h,after:e.title?" ":`
|
|
388
|
+
`,...m.current()}))),d(),e.title&&(d=n.enter(`title${l}`),h+=m.move(" "+s),h+=m.move(n.safe(e.title,{before:h,after:s,...m.current()})),h+=m.move(s),d()),c(),h}function zq(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 pc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function th(e,t,n){const a=wo(e),s=wo(t);return a===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}E_.peek=Mq;function E_(e,t,n,a){const s=zq(n),l=n.enter("emphasis"),c=n.createTracker(a),d=c.move(s);let m=c.move(n.containerPhrasing(e,{after:s,before:d,...c.current()}));const h=m.charCodeAt(0),g=th(a.before.charCodeAt(a.before.length-1),h,s);g.inside&&(m=pc(h)+m.slice(1));const p=m.charCodeAt(m.length-1),b=th(a.after.charCodeAt(0),p,s);b.inside&&(m=m.slice(0,-1)+pc(p));const w=c.move(s);return l(),n.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},d+m+w}function Mq(e,t,n){return n.options.emphasis||"*"}function Dq(e,t){let n=!1;return fb(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,$y}),!!((!e.depth||e.depth<3)&&ib(e)&&(t.options.setext||n))}function Iq(e,t,n,a){const s=Math.max(Math.min(6,e.depth||1),1),l=n.createTracker(a);if(Dq(e,n)){const g=n.enter("headingSetext"),p=n.enter("phrasing"),b=n.containerPhrasing(e,{...l.current(),before:`
|
|
389
|
+
`,after:`
|
|
390
|
+
`});return p(),g(),b+`
|
|
391
|
+
`+(s===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
392
|
+
`))+1))}const c="#".repeat(s),d=n.enter("headingAtx"),m=n.enter("phrasing");l.move(c+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
|
|
393
|
+
`,...l.current()});return/^[\t ]/.test(h)&&(h=pc(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,n.options.closeAtx&&(h+=" "+c),m(),d(),h}N_.peek=Lq;function N_(e){return e.value||""}function Lq(){return"<"}__.peek=Pq;function __(e,t,n,a){const s=mb(n),l=s==='"'?"Quote":"Apostrophe",c=n.enter("image");let d=n.enter("label");const m=n.createTracker(a);let h=m.move("![");return h+=m.move(n.safe(e.alt,{before:h,after:"]",...m.current()})),h+=m.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(n.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(d=n.enter("destinationRaw"),h+=m.move(n.safe(e.url,{before:h,after:e.title?" ":")",...m.current()}))),d(),e.title&&(d=n.enter(`title${l}`),h+=m.move(" "+s),h+=m.move(n.safe(e.title,{before:h,after:s,...m.current()})),h+=m.move(s),d()),h+=m.move(")"),c(),h}function Pq(){return"!"}T_.peek=Uq;function T_(e,t,n,a){const s=e.referenceType,l=n.enter("imageReference");let c=n.enter("label");const d=n.createTracker(a);let m=d.move("![");const h=n.safe(e.alt,{before:m,after:"]",...d.current()});m+=d.move(h+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const p=n.safe(n.associationId(e),{before:m,after:"]",...d.current()});return c(),n.stack=g,l(),s==="full"||!h||h!==p?m+=d.move(p+"]"):s==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function Uq(){return"!"}A_.peek=Bq;function A_(e,t,n){let a=e.value||"",s="`",l=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(a);)s+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++l<n.unsafe.length;){const c=n.unsafe[l],d=n.compilePattern(c);let m;if(c.atBreak)for(;m=d.exec(a);){let h=m.index;a.charCodeAt(h)===10&&a.charCodeAt(h-1)===13&&h--,a=a.slice(0,h)+" "+a.slice(m.index+1)}}return s+a+s}function Bq(){return"`"}function R_(e,t){const n=ib(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))}O_.peek=Fq;function O_(e,t,n,a){const s=mb(n),l=s==='"'?"Quote":"Apostrophe",c=n.createTracker(a);let d,m;if(R_(e,n)){const g=n.stack;n.stack=[],d=n.enter("autolink");let p=c.move("<");return p+=c.move(n.containerPhrasing(e,{before:p,after:">",...c.current()})),p+=c.move(">"),d(),n.stack=g,p}d=n.enter("link"),m=n.enter("label");let h=c.move("[");return h+=c.move(n.containerPhrasing(e,{before:h,after:"](",...c.current()})),h+=c.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(e.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(m=n.enter("destinationRaw"),h+=c.move(n.safe(e.url,{before:h,after:e.title?" ":")",...c.current()}))),m(),e.title&&(m=n.enter(`title${l}`),h+=c.move(" "+s),h+=c.move(n.safe(e.title,{before:h,after:s,...c.current()})),h+=c.move(s),m()),h+=c.move(")"),d(),h}function Fq(e,t,n){return R_(e,n)?"<":"["}z_.peek=$q;function z_(e,t,n,a){const s=e.referenceType,l=n.enter("linkReference");let c=n.enter("label");const d=n.createTracker(a);let m=d.move("[");const h=n.containerPhrasing(e,{before:m,after:"]",...d.current()});m+=d.move(h+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const p=n.safe(n.associationId(e),{before:m,after:"]",...d.current()});return c(),n.stack=g,l(),s==="full"||!h||h!==p?m+=d.move(p+"]"):s==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function $q(){return"["}function pb(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 Hq(e){const t=pb(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 qq(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 M_(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 Zq(e,t,n,a){const s=n.enter("list"),l=n.bulletCurrent;let c=e.ordered?qq(n):pb(n);const d=e.ordered?c==="."?")":".":Hq(n);let m=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(m=!0),M_(n)===c&&g){let p=-1;for(;++p<e.children.length;){const b=e.children[p];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=d),n.bulletCurrent=c;const h=n.containerFlow(e,a);return n.bulletLastUsed=c,n.bulletCurrent=l,s(),h}function Gq(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 Vq(e,t,n,a){const s=Gq(n);let l=n.bulletCurrent||pb(n);t&&t.type==="list"&&t.ordered&&(l=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let c=l.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const d=n.createTracker(a);d.move(l+" ".repeat(c-l.length)),d.shift(c);const m=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,d.current()),g);return m(),h;function g(p,b,w){return b?(w?"":" ".repeat(c))+p:(w?l:l+" ".repeat(c-l.length))+p}}function Qq(e,t,n,a){const s=n.enter("paragraph"),l=n.enter("phrasing"),c=n.containerPhrasing(e,a);return l(),s(),c}const Kq=Th(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Yq(e,t,n,a){return(e.children.some(function(c){return Kq(c)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function Xq(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}D_.peek=Wq;function D_(e,t,n,a){const s=Xq(n),l=n.enter("strong"),c=n.createTracker(a),d=c.move(s+s);let m=c.move(n.containerPhrasing(e,{after:s,before:d,...c.current()}));const h=m.charCodeAt(0),g=th(a.before.charCodeAt(a.before.length-1),h,s);g.inside&&(m=pc(h)+m.slice(1));const p=m.charCodeAt(m.length-1),b=th(a.after.charCodeAt(0),p,s);b.inside&&(m=m.slice(0,-1)+pc(p));const w=c.move(s+s);return l(),n.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},d+m+w}function Wq(e,t,n){return n.options.strong||"*"}function Jq(e,t,n,a){return n.safe(e.value,a)}function e7(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 t7(e,t,n){const a=(M_(n)+(n.options.ruleSpaces?" ":"")).repeat(e7(n));return n.options.ruleSpaces?a.slice(0,-1):a}const I_={blockquote:jq,break:Ak,code:Aq,definition:Oq,emphasis:E_,hardBreak:Ak,heading:Iq,html:N_,image:__,imageReference:T_,inlineCode:A_,link:O_,linkReference:z_,list:Zq,listItem:Vq,paragraph:Qq,root:Yq,strong:D_,text:Jq,thematicBreak:t7};function n7(){return{enter:{table:r7,tableData:Rk,tableHeader:Rk,tableRow:i7},exit:{codeText:s7,table:a7,tableData:_g,tableHeader:_g,tableRow:_g}}}function r7(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 a7(e){this.exit(e),this.data.inTable=void 0}function i7(e){this.enter({type:"tableRow",children:[]},e)}function _g(e){this.exit(e)}function Rk(e){this.enter({type:"tableCell",children:[]},e)}function s7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,l7));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function l7(e,t){return t==="|"?t:e}function o7(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,s=t.stringLength,l=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
394
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:c,tableCell:m,tableRow:d}};function c(w,S,j,E){return h(g(w,j,E),w.align)}function d(w,S,j,E){const C=p(w,j,E),_=h([C]);return _.slice(0,_.indexOf(`
|
|
395
|
+
`))}function m(w,S,j,E){const C=j.enter("tableCell"),_=j.enter("phrasing"),z=j.containerPhrasing(w,{...E,before:l,after:l});return _(),C(),z}function h(w,S){return Sq(w,{align:S,alignDelimiters:a,padding:n,stringLength:s})}function g(w,S,j){const E=w.children;let C=-1;const _=[],z=S.enter("table");for(;++C<E.length;)_[C]=p(E[C],S,j);return z(),_}function p(w,S,j){const E=w.children;let C=-1;const _=[],z=S.enter("tableRow");for(;++C<E.length;)_[C]=m(E[C],w,S,j);return z(),_}function b(w,S,j){let E=I_.inlineCode(w,S,j);return j.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function u7(){return{exit:{taskListCheckValueChecked:Ok,taskListCheckValueUnchecked:Ok,paragraph:d7}}}function c7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:f7}}}function Ok(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function d7(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const a=n.children[0];if(a&&a.type==="text"){const s=t.children;let l=-1,c;for(;++l<s.length;){const d=s[l];if(d.type==="paragraph"){c=d;break}}c===n&&(a.value=a.value.slice(1),a.value.length===0?n.children.shift():n.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,n.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function f7(e,t,n,a){const s=e.children[0],l=typeof e.checked=="boolean"&&s&&s.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",d=n.createTracker(a);l&&d.move(c);let m=I_.listItem(e,t,n,{...a,...d.current()});return l&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(g){return g+c}}function h7(){return[ZH(),fq(),gq(),n7(),u7()]}function m7(e){return{extensions:[GH(),hq(e),yq(),o7(e),c7()]}}const p7={tokenize:w7,partial:!0},L_={tokenize:S7,partial:!0},P_={tokenize:k7,partial:!0},U_={tokenize:j7,partial:!0},g7={tokenize:C7,partial:!0},B_={name:"wwwAutolink",tokenize:b7,previous:$_},F_={name:"protocolAutolink",tokenize:x7,previous:H_},fi={name:"emailAutolink",tokenize:v7,previous:q_},Oa={};function y7(){return{text:Oa}}let Ms=48;for(;Ms<123;)Oa[Ms]=fi,Ms++,Ms===58?Ms=65:Ms===91&&(Ms=97);Oa[43]=fi;Oa[45]=fi;Oa[46]=fi;Oa[95]=fi;Oa[72]=[fi,F_];Oa[104]=[fi,F_];Oa[87]=[fi,B_];Oa[119]=[fi,B_];function v7(e,t,n){const a=this;let s,l;return c;function c(p){return!Gy(p)||!q_.call(a,a.previous)||gb(a.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(p))}function d(p){return Gy(p)?(e.consume(p),d):p===64?(e.consume(p),m):n(p)}function m(p){return p===46?e.check(g7,g,h)(p):p===45||p===95||Yn(p)?(l=!0,e.consume(p),m):g(p)}function h(p){return e.consume(p),s=!0,m}function g(p){return l&&s&&or(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function b7(e,t,n){const a=this;return s;function s(c){return c!==87&&c!==119||!$_.call(a,a.previous)||gb(a.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(p7,e.attempt(L_,e.attempt(P_,l),n),n)(c))}function l(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function x7(e,t,n){const a=this;let s="",l=!1;return c;function c(p){return(p===72||p===104)&&H_.call(a,a.previous)&&!gb(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(p),e.consume(p),d):n(p)}function d(p){if(or(p)&&s.length<5)return s+=String.fromCodePoint(p),e.consume(p),d;if(p===58){const b=s.toLowerCase();if(b==="http"||b==="https")return e.consume(p),m}return n(p)}function m(p){return p===47?(e.consume(p),l?h:(l=!0,m)):n(p)}function h(p){return p===null||Wf(p)||Dt(p)||Ys(p)||Eh(p)?n(p):e.attempt(L_,e.attempt(P_,g),n)(p)}function g(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function w7(e,t,n){let a=0;return s;function s(c){return(c===87||c===119)&&a<3?(a++,e.consume(c),s):c===46&&a===3?(e.consume(c),l):n(c)}function l(c){return c===null?n(c):t(c)}}function S7(e,t,n){let a,s,l;return c;function c(h){return h===46||h===95?e.check(U_,m,d)(h):h===null||Dt(h)||Ys(h)||h!==45&&Eh(h)?m(h):(l=!0,e.consume(h),c)}function d(h){return h===95?a=!0:(s=a,a=void 0),e.consume(h),c}function m(h){return s||a||!l?n(h):t(h)}}function k7(e,t){let n=0,a=0;return s;function s(c){return c===40?(n++,e.consume(c),s):c===41&&a<n?l(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(U_,t,l)(c):c===null||Dt(c)||Ys(c)?t(c):(e.consume(c),s)}function l(c){return c===41&&a++,e.consume(c),s}}function j7(e,t,n){return a;function a(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(e.consume(d),a):d===38?(e.consume(d),l):d===93?(e.consume(d),s):d===60||d===null||Dt(d)||Ys(d)?t(d):n(d)}function s(d){return d===null||d===40||d===91||Dt(d)||Ys(d)?t(d):a(d)}function l(d){return or(d)?c(d):n(d)}function c(d){return d===59?(e.consume(d),a):or(d)?(e.consume(d),c):n(d)}}function C7(e,t,n){return a;function a(l){return e.consume(l),s}function s(l){return Yn(l)?n(l):t(l)}}function $_(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Dt(e)}function H_(e){return!or(e)}function q_(e){return!(e===47||Gy(e))}function Gy(e){return e===43||e===45||e===46||e===95||Yn(e)}function gb(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 E7={tokenize:M7,partial:!0};function N7(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:R7,continuation:{tokenize:O7},exit:z7}},text:{91:{name:"gfmFootnoteCall",tokenize:A7},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:_7,resolveTo:T7}}}}function _7(e,t,n){const a=this;let s=a.events.length;const l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c;for(;s--;){const m=a.events[s][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return d;function d(m){if(!c||!c._balanced)return n(m);const h=va(a.sliceSerialize({start:c.end,end:a.now()}));return h.codePointAt(0)!==94||!l.includes(h.slice(1))?n(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),t(m))}}function T7(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},d=[e[n+1],e[n+2],["enter",a,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",l,t],["enter",c,t],["exit",c,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(n,e.length-n+1,...d),e}function A7(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let l=0,c;return d;function d(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),m}function m(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(p){if(l>999||p===93&&!c||p===null||p===91||Dt(p))return n(p);if(p===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return s.includes(va(a.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return Dt(p)||(c=!0),l++,e.consume(p),p===92?g:h}function g(p){return p===91||p===92||p===93?(e.consume(p),l++,h):h(p)}}function R7(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let l,c=0,d;return m;function m(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(S)}function g(S){if(c>999||S===93&&!d||S===null||S===91||Dt(S))return n(S);if(S===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return l=va(a.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Dt(S)||(d=!0),c++,e.consume(S),S===92?p:g}function p(S){return S===91||S===92||S===93?(e.consume(S),c++,g):g(S)}function b(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),s.includes(l)||s.push(l),yt(e,w,"gfmFootnoteDefinitionWhitespace")):n(S)}function w(S){return t(S)}}function O7(e,t,n){return e.check(Bc,t,e.attempt(E7,t,n))}function z7(e){e.exit("gfmFootnoteDefinition")}function M7(e,t,n){const a=this;return yt(e,s,"gfmFootnoteDefinitionIndent",5);function s(l){const c=a.events[a.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(l):n(l)}}function D7(e){let n=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:l,resolveAll:s};return n==null&&(n=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function s(c,d){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let h=m;for(;h--;)if(c[h][0]==="exit"&&c[h][1].type==="strikethroughSequenceTemporary"&&c[h][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[h][1].end.offset-c[h][1].start.offset){c[m][1].type="strikethroughSequence",c[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[m][1].end)},p={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[m][1].start)},b=[["enter",g,d],["enter",c[h][1],d],["exit",c[h][1],d],["enter",p,d]],w=d.parser.constructs.insideSpan.null;w&&Pr(b,b.length,0,Nh(w,c.slice(h+1,m),d)),Pr(b,b.length,0,[["exit",p,d],["enter",c[m][1],d],["exit",c[m][1],d],["exit",g,d]]),Pr(c,h-1,m-h+3,b),m=h+b.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function l(c,d,m){const h=this.previous,g=this.events;let p=0;return b;function b(S){return h===126&&g[g.length-1][1].type!=="characterEscape"?m(S):(c.enter("strikethroughSequenceTemporary"),w(S))}function w(S){const j=wo(h);if(S===126)return p>1?m(S):(c.consume(S),p++,w);if(p<2&&!n)return m(S);const E=c.exit("strikethroughSequenceTemporary"),C=wo(S);return E._open=!C||C===2&&!!j,E._close=!j||j===2&&!!C,d(S)}}}class I7{constructor(){this.map=[]}add(t,n,a){L7(this,t,n,a)}consume(t){if(this.map.sort(function(l,c){return l[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const a=[];for(;n>0;)n-=1,a.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];a.push(t.slice()),t.length=0;let s=a.pop();for(;s;){for(const l of s)t.push(l);s=a.pop()}this.map.length=0}}function L7(e,t,n,a){let s=0;if(!(n===0&&a.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...a);return}s+=1}e.map.push([t,n,a])}}function P7(e,t){let n=!1;const a=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&a.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const l=a.length-1;a[l]=a[l]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return a}function U7(){return{flow:{null:{name:"table",tokenize:B7,resolveAll:F7}}}}function B7(e,t,n){const a=this;let s=0,l=0,c;return d;function d(I){let Q=a.events.length-1;for(;Q>-1;){const X=a.events[Q][1].type;if(X==="lineEnding"||X==="linePrefix")Q--;else break}const ie=Q>-1?a.events[Q][1].type:null,be=ie==="tableHead"||ie==="tableRow"?O:m;return be===O&&a.parser.lazy[a.now().line]?n(I):be(I)}function m(I){return e.enter("tableHead"),e.enter("tableRow"),h(I)}function h(I){return I===124||(c=!0,l+=1),g(I)}function g(I){return I===null?n(I):Fe(I)?l>1?(l=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),w):n(I):st(I)?yt(e,g,"whitespace")(I):(l+=1,c&&(c=!1,s+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),c=!0,g):(e.enter("data"),p(I)))}function p(I){return I===null||I===124||Dt(I)?(e.exit("data"),g(I)):(e.consume(I),I===92?b:p)}function b(I){return I===92||I===124?(e.consume(I),p):p(I)}function w(I){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(I):(e.enter("tableDelimiterRow"),c=!1,st(I)?yt(e,S,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):S(I))}function S(I){return I===45||I===58?E(I):I===124?(c=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),j):L(I)}function j(I){return st(I)?yt(e,E,"whitespace")(I):E(I)}function E(I){return I===58?(l+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),C):I===45?(l+=1,C(I)):I===null||Fe(I)?M(I):L(I)}function C(I){return I===45?(e.enter("tableDelimiterFiller"),_(I)):L(I)}function _(I){return I===45?(e.consume(I),_):I===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),z):(e.exit("tableDelimiterFiller"),z(I))}function z(I){return st(I)?yt(e,M,"whitespace")(I):M(I)}function M(I){return I===124?S(I):I===null||Fe(I)?!c||s!==l?L(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):L(I)}function L(I){return n(I)}function O(I){return e.enter("tableRow"),F(I)}function F(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),F):I===null||Fe(I)?(e.exit("tableRow"),t(I)):st(I)?yt(e,F,"whitespace")(I):(e.enter("data"),P(I))}function P(I){return I===null||I===124||Dt(I)?(e.exit("data"),F(I)):(e.consume(I),I===92?V:P)}function V(I){return I===92||I===124?(e.consume(I),P):P(I)}}function F7(e,t){let n=-1,a=!0,s=0,l=[0,0,0,0],c=[0,0,0,0],d=!1,m=0,h,g,p;const b=new I7;for(;++n<e.length;){const w=e[n],S=w[1];w[0]==="enter"?S.type==="tableHead"?(d=!1,m!==0&&(zk(b,t,m,h,g),g=void 0,m=0),h={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},b.add(n,0,[["enter",h,t]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(a=!0,p=void 0,l=[0,0,0,0],c=[0,n+1,0,0],d&&(d=!1,g={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},b.add(n,0,[["enter",g,t]])),s=S.type==="tableDelimiterRow"?2:g?3:1):s&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(a=!1,c[2]===0&&(l[1]!==0&&(c[0]=c[1],p=kf(b,t,l,s,void 0,p),l=[0,0,0,0]),c[2]=n)):S.type==="tableCellDivider"&&(a?a=!1:(l[1]!==0&&(c[0]=c[1],p=kf(b,t,l,s,void 0,p)),l=c,c=[l[1],n,0,0])):S.type==="tableHead"?(d=!0,m=n):S.type==="tableRow"||S.type==="tableDelimiterRow"?(m=n,l[1]!==0?(c[0]=c[1],p=kf(b,t,l,s,n,p)):c[1]!==0&&(p=kf(b,t,c,s,n,p)),s=0):s&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(c[3]=n)}for(m!==0&&zk(b,t,m,h,g),b.consume(t.events),n=-1;++n<t.events.length;){const w=t.events[n];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=P7(t.events,n))}return e}function kf(e,t,n,a,s,l){const c=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",d="tableContent";n[0]!==0&&(l.end=Object.assign({},Vl(t.events,n[0])),e.add(n[0],0,[["exit",l,t]]));const m=Vl(t.events,n[1]);if(l={type:c,start:Object.assign({},m),end:Object.assign({},m)},e.add(n[1],0,[["enter",l,t]]),n[2]!==0){const h=Vl(t.events,n[2]),g=Vl(t.events,n[3]),p={type:d,start:Object.assign({},h),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",p,t]]),a!==2){const b=t.events[n[2]],w=t.events[n[3]];if(b[1].end=Object.assign({},w[1].end),b[1].type="chunkText",b[1].contentType="text",n[3]>n[2]+1){const S=n[2]+1,j=n[3]-n[2]-1;e.add(S,j,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return s!==void 0&&(l.end=Object.assign({},Vl(t.events,s)),e.add(s,0,[["exit",l,t]]),l=void 0),l}function zk(e,t,n,a,s){const l=[],c=Vl(t.events,n);s&&(s.end=Object.assign({},c),l.push(["exit",s,t])),a.end=Object.assign({},c),l.push(["exit",a,t]),e.add(n+1,0,l)}function Vl(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const $7={name:"tasklistCheck",tokenize:q7};function H7(){return{text:{91:$7}}}function q7(e,t,n){const a=this;return s;function s(m){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?n(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),l)}function l(m){return Dt(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):n(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):n(m)}function d(m){return Fe(m)?t(m):st(m)?e.check({tokenize:Z7},t,n)(m):n(m)}}function Z7(e,t,n){return yt(e,a,"whitespace");function a(s){return s===null?n(s):t(s)}}function G7(e){return e_([y7(),N7(),D7(e),U7(),H7()])}const V7={};function Q7(e){const t=this,n=e||V7,a=t.data(),s=a.micromarkExtensions||(a.micromarkExtensions=[]),l=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);s.push(G7(n)),l.push(h7()),c.push(m7(n))}function Rh({children:e,className:t}){return o.jsx("div",{className:Oe("prose prose-sm max-w-none leading-[1.55] text-[color:inherit]","prose-headings:text-current prose-p:text-current prose-li:text-current prose-strong:text-current prose-em:text-current prose-blockquote:text-current","prose-p:my-2 prose-headings:mt-3 prose-headings:mb-1.5 prose-ul:my-2 prose-ol:my-2 prose-li:my-0.5 prose-pre:my-2 prose-blockquote:my-2 prose-hr:my-3","prose-a:text-[color:var(--accent)] prose-a:no-underline hover:prose-a:underline","prose-code:text-current prose-code:bg-[color:var(--bg-sunken)] prose-code:rounded prose-code:px-1 prose-code:py-0.5 prose-code:text-[0.9em] prose-code:before:content-none prose-code:after:content-none","prose-pre:bg-[color:var(--bg-sunken)] prose-pre:text-current prose-pre:border prose-pre:border-[color:var(--border)]","prose-hr:border-[color:var(--border)]","prose-blockquote:border-l-[color:var(--border-strong)] prose-blockquote:text-[color:var(--fg-2)]","prose-th:border-[color:var(--border)] prose-td:border-[color:var(--border)]",t),children:o.jsx(zH,{remarkPlugins:[Q7,qH],children:e})})}function K7({value:e,baseline:t,onChange:n,onRevert:a,disabled:s}){const[l,c]=x.useState(!1),d=x.useRef(null),m=e!==t;return x.useEffect(()=>{var h;l&&((h=d.current)==null||h.focus())},[l]),o.jsxs(Cn,{style:{borderColor:m?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[o.jsxs(la,{children:[o.jsxs(oa,{children:["System prompt append",m&&o.jsx(Y7,{})]}),!l&&!s&&o.jsxs(pe,{size:"xs",variant:"outline",onClick:()=>c(!0),children:[o.jsx(Sv,{className:"h-3 w-3"})," Edit"]})]}),o.jsx(Wn,{children:l?o.jsxs("div",{className:"space-y-2",children:[o.jsx("textarea",{ref:d,value:e,onChange:h=>n(h.target.value),onKeyDown:h=>{h.key==="Escape"&&(h.preventDefault(),c(!1))},rows:10,className:"w-full rounded border bg-transparent p-2 font-mono text-body shadow-sm focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Appended to Claude Code's default system prompt.",maxLength:32e3,spellCheck:!1}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(pe,{size:"xs",variant:"ghost",onClick:()=>{a(),c(!1)},disabled:!m,children:"Revert"}),o.jsx(pe,{size:"xs",onClick:()=>c(!1),children:"Done"})]}),o.jsx("p",{className:"text-caption text-muted-foreground",children:"`Done` collapses this editor. The change is saved only when you click Save in the bar at the bottom of the page."})]}):o.jsx("div",{className:"rounded bg-muted p-3 text-body max-h-64 overflow-auto min-h-8",children:e?o.jsx(Rh,{children:e}):o.jsx("span",{className:"text-muted-foreground italic",children:"No prompt append."})})})]})}function Y7(){return o.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",color:"color-mix(in oklch, var(--state-blocked) 60%, var(--fg))"},children:"changed"})}const Z_={"claude-code":"Claude Code",codex:"Codex"},X7=[Yf.CLAUDE_CODE,Yf.CODEX];function W7({open:e,onOpenChange:t,agent:n}){const a=hn(),s=n.clientId,l=n.runtimeProvider,[c,d]=x.useState(s),[m,h]=x.useState(l),[g,p]=x.useState(!1),w=Ke({queryKey:["clients-rebind"],queryFn:ls,enabled:e}).data??[],S=vR({queries:w.map(P=>({queryKey:["client-capabilities",P.id],queryFn:()=>Cv(P.id),enabled:e}))}),j=x.useMemo(()=>{const P=new Map;return S.forEach((V,I)=>{const Q=w[I];if(!Q)return;const ie=V.data;ie!=null&&ie.capabilities&&P.set(Q.id,ie.capabilities)}),P},[S,w]);x.useEffect(()=>{e||(d(s),h(l),p(!1))},[e,s,l]);const E=c?j.get(c)??null:null,C=(E==null?void 0:E[m])??null,_=!C||C.state==="missing"||C.state==="error",z=!!c&&(c!==s||m!==l)&&(!_||g),M=m!==l,L=c!==s,O=xt({mutationFn:()=>{if(!c)throw new Error("clientId required");return BI(n.uuid,{clientId:c,runtimeProvider:m,force:_&&g?!0:void 0})},onSuccess:()=>{a.invalidateQueries({queryKey:["agent",n.uuid]}),a.invalidateQueries({queryKey:["agents"]}),t(!1)}}),F=O.error instanceof Oc||O.error instanceof Error?O.error.message:null;return o.jsx(Tn,{open:e,onOpenChange:t,children:o.jsxs(jn,{className:"max-w-lg",children:[o.jsx(Ln,{children:o.jsx(An,{children:"Re-bind agent"})}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:["Currently:"," ",o.jsx("span",{className:"mono",children:eZ(s,w,l)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{children:"Computer"}),o.jsx("select",{value:c??"",onChange:P=>d(P.target.value||null),className:"w-full rounded-[var(--radius-input)] border border-input bg-background px-3 py-2 text-body",children:w.map(P=>o.jsx("option",{value:P.id,children:J7(P)},P.id))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{children:"Runtime"}),o.jsx("div",{className:"space-y-2",children:X7.map(P=>{const V=(E==null?void 0:E[P])??null,I=!!V&&V.state!=="missing",Q=m===P;return o.jsxs("label",{className:Q?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":I?"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30":"flex items-start gap-3 rounded-md border border-border p-3 opacity-60",children:[o.jsx("input",{type:"radio",name:"rebind-runtime",checked:Q,onChange:()=>h(P),className:"mt-1"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-body font-medium",children:Z_[P]}),o.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:nZ(V,P)})]})]},P)})})]}),(L||M)&&o.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-caption space-y-1",children:[o.jsxs("p",{children:[o.jsx("span",{className:"font-medium",children:"Heads up:"})," active sessions on the previous computer are suspended at re-bind. Chat history is preserved."]}),M&&o.jsx("p",{children:"Some configuration fields don't transfer between providers (e.g. claude permission_mode is dropped; codex sandboxMode resets to default)."})]}),_&&o.jsxs("label",{className:"flex items-start gap-2 text-caption",style:{color:"var(--fg-2)"},children:[o.jsx("input",{type:"checkbox",checked:g,onChange:P=>p(P.target.checked),className:"mt-0.5"}),o.jsx("span",{children:"Override capability check — pick this if the destination computer is offline or the SDK was just installed and capabilities haven't refreshed yet."})]}),F&&o.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:F})]}),o.jsxs(cr,{children:[o.jsx(pe,{variant:"outline",onClick:()=>t(!1),disabled:O.isPending,children:"Cancel"}),o.jsx(pe,{onClick:()=>O.mutate(),disabled:!z||O.isPending,children:O.isPending?"Re-binding…":"Re-bind"})]})]})})}function J7(e){return`${e.hostname??e.id} · ${e.status}`}function eZ(e,t,n){const a=e?t.find(l=>l.id===e):null;return`${(a==null?void 0:a.hostname)??e??"(unbound)"} · ${Z_[n]}`}const tZ={"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 nZ(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. ${tZ[t]}`;case"missing":return"SDK not installed on this computer.";case"error":return e.error?`Probe error: ${e.error}`:"Probe error."}}const rZ={prompt:"Prompt",model:"Model",mcp:"MCP",env:"Env",git:"Git"};function aZ(e){if(!e.summary.anyDirty&&!e.conflictMessage&&!e.errorMessage&&!e.justSaved)return null;const t=e.summary.dirtySections.length;return o.jsx("div",{className:"sticky bottom-0 z-30 -mx-6 backdrop-blur",style:{padding:"var(--sp-3) var(--sp-6)",background:"color-mix(in oklch, var(--bg-raised) 94%, transparent)",borderTop:"var(--hairline) solid var(--border)"},children:o.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[o.jsxs("div",{className:"flex flex-col gap-1 text-body min-w-0",children:[e.summary.anyDirty&&o.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[o.jsx(Xu,{state:"blocked",size:8}),o.jsxs("span",{className:"font-medium",children:[t," section",t===1?"":"s"," with unsaved changes"]}),o.jsx("span",{style:{color:"var(--fg-4)"},"aria-hidden":!0,children:"·"}),o.jsx("span",{className:"flex flex-wrap gap-1",children:e.summary.dirtySections.map(n=>o.jsx("button",{type:"button",onClick:()=>e.onJumpTo(n),className:"text-caption transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{padding:"var(--sp-0_5) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",color:"var(--fg-2)",cursor:"pointer"},children:rZ[n]},n))})]}),e.justSaved&&!e.summary.anyDirty&&!e.errorMessage&&!e.conflictMessage&&o.jsxs("div",{className:"inline-flex items-center gap-1.5 text-body font-medium",style:{color:"var(--state-idle)"},children:[o.jsx(ur,{className:"h-3.5 w-3.5"}),"Saved"]}),e.saveHint&&o.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:e.saveHint}),e.conflictMessage&&o.jsx("p",{className:"text-caption font-medium",style:{color:"var(--state-blocked)"},children:e.conflictMessage}),e.errorMessage&&o.jsx("p",{className:"text-caption font-medium",style:{color:"var(--state-error)"},children:e.errorMessage})]}),o.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.conflictMessage&&o.jsx(pe,{variant:"outline",size:"sm",onClick:e.onReloadRemote,children:"Discard mine, load latest"}),o.jsx(pe,{variant:"ghost",size:"sm",onClick:e.onDiscard,disabled:e.saving,children:"Discard changes"}),o.jsx(pe,{size:"sm",onClick:e.onSave,disabled:e.saving||!e.summary.anyDirty,children:e.saving?o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx(hC,{className:"h-3 w-3 animate-spin","aria-hidden":!0}),"Saving…"]}):"Save"})]})]})})}function tc(e){return`agent-cfg-${e}`}function Bu({anchorId:e,title:t,caption:n,right:a,children:s,className:l,sectionProps:c}){return o.jsxs("section",{id:e,className:Oe("space-y-3",l),...c,children:[o.jsxs("div",{className:"flex items-end justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-subtitle",style:{color:"var(--fg)"},children:t}),n&&o.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:n})]}),a]}),o.jsx("div",{className:"space-y-3",children:s})]})}function iZ(){return o.jsx("hr",{"aria-hidden":!0,style:{border:0,borderTop:"var(--hairline) solid var(--border)",margin:"var(--sp-2) 0"}})}const sZ={"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 lZ(e){const t=sZ[e.runtimeProvider];return o.jsxs("div",{className:"space-y-3",children:[o.jsx(oZ,{name:t.name,caption:t.caption,locked:!0}),o.jsx(uZ,{computerLabel:e.computerLabel,canBindComputer:e.canBindComputer,bindPending:e.bindComputerPending??!1,onBindComputer:e.onBindComputer,onRebind:e.onRebind}),e.modelSlot]})}function oZ({name:e,caption:t,locked:n}){return o.jsxs(Cn,{children:[o.jsx(la,{children:o.jsxs(oa,{children:["Where it runs",n&&o.jsxs("span",{className:"mono uppercase text-caption inline-flex items-center gap-1",style:{color:"var(--fg-4)"},children:[o.jsx(xv,{className:"h-3 w-3","aria-hidden":!0})," locked"]})]})}),o.jsxs(Wn,{className:"space-y-1 text-body",children:[o.jsxs("div",{className:"inline-flex items-center gap-2",children:[o.jsx(mC,{className:"h-3.5 w-3.5","aria-hidden":!0,style:{color:"var(--accent)"}}),o.jsx("span",{className:"font-medium",children:e})]}),o.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:t})]})]})}function uZ(e){const t=!!e.computerLabel;return o.jsxs(Cn,{children:[o.jsxs(la,{children:[o.jsx(oa,{children:"Bound computer"}),e.canBindComputer&&e.onBindComputer&&!t&&o.jsxs(pe,{size:"xs",variant:"outline",onClick:e.onBindComputer,disabled:e.bindPending,children:[o.jsx(wy,{className:"h-3 w-3"}),e.bindPending?"Binding…":"Bind computer"]}),t&&e.onRebind&&o.jsxs(pe,{size:"xs",variant:"outline",onClick:e.onRebind,children:[o.jsx(wy,{className:"h-3 w-3"}),"Re-bind"]})]}),o.jsx(Wn,{className:"text-body",children:t?o.jsx("div",{className:"mono",style:{color:"var(--fg-2)"},children:e.computerLabel}):o.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"No computer bound. A computer claims this agent on its first WebSocket connect, or you can pick one manually via the button above."})})]})}function cZ(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 dZ(e,t){let n=t.size+1;for(;t.has(`${e}-${n}`);)n++;return`${e}-${n}`}function fZ(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Tg(e,t){return e.map((n,a)=>({key:`${t}-${a+1}`,value:n,baseline:n,status:"unchanged"}))}function Mk(e){return e.map(t=>t.status==="deleted"?t:t.baseline==null?{...t,status:"added"}:fZ(t.value,t.baseline)?{...t,status:"unchanged"}:{...t,status:"modified"})}function Ag(e,t){const n=e;return{add:a=>t(s=>{const l=s[e],c=new Set(l.map(h=>h.key)),d=dZ(n,c),m=[...l,{key:d,value:a,baseline:null,status:"added"}];return{...s,[e]:Mk(m)}}),update:(a,s)=>t(l=>{const d=l[e].map(m=>m.key===a?{...m,value:s}:m);return{...l,[e]:Mk(d)}}),remove:a=>t(s=>{const c=s[e].map(d=>d.key!==a?d:d.baseline==null?null:{...d,status:"deleted"}).filter(d=>d!==null);return{...s,[e]:c}}),undo:a=>t(s=>{const c=s[e].map(d=>d.key!==a||d.baseline==null?d:{...d,value:d.baseline,status:"unchanged"});return{...s,[e]:c}})}}function hZ(e){return{promptAppend:e.payload.prompt.append,model:e.payload.model,mcp:Tg(e.payload.mcpServers,"mcp"),env:Tg(e.payload.env,"env"),git:Tg(e.payload.gitRepos,"git")}}function mZ(e){const[t,n]=x.useState(null);x.useEffect(()=>{e&&t===null&&n(hZ(e))},[e,t]);const a=t??{promptAppend:"",model:"",mcp:[],env:[],git:[]},s=(e==null?void 0:e.payload.prompt.append)??"",l=(e==null?void 0:e.payload.model)??"",c=a.promptAppend!==s,d=a.model!==l,m=x.useMemo(()=>{const z=[],M=P=>P.reduce((V,I)=>I.status==="unchanged"?V:V+1,0),L=M(a.mcp),O=M(a.env),F=M(a.git);return c&&z.push("prompt"),d&&z.push("model"),L>0&&z.push("mcp"),O>0&&z.push("env"),F>0&&z.push("git"),{anyDirty:z.length>0,dirtySections:z,counts:{prompt:c?1:0,model:d?1:0,mcp:L,env:O,git:F}}},[a,c,d]),h=x.useCallback(z=>{n(M=>M&&z(M))},[]),g=x.useCallback(z=>h(M=>({...M,promptAppend:z})),[h]),p=x.useCallback(()=>h(z=>({...z,promptAppend:s})),[h,s]),b=x.useCallback(z=>h(M=>({...M,model:z})),[h]),w=x.useCallback(()=>h(z=>({...z,model:l})),[h,l]),S=x.useMemo(()=>Ag("mcp",h),[h]),j=x.useMemo(()=>Ag("env",h),[h]),E=x.useMemo(()=>Ag("git",h),[h]),C=x.useCallback(()=>{n(null)},[]),_=x.useCallback(()=>{if(!t||!e)return{};const z={};c&&(z.prompt={append:t.promptAppend}),d&&(z.model=t.model);const M=m.counts.mcp>0,L=m.counts.env>0,O=m.counts.git>0;return M&&(z.mcpServers=t.mcp.filter(F=>F.status!=="deleted").map(F=>F.value)),L&&(z.env=t.env.filter(F=>F.status!=="deleted").map(F=>{const P=F.value;return P.sensitive&&P.value===Qf?{key:P.key,value:Qf,sensitive:!0}:P})),O&&(z.gitRepos=t.git.filter(F=>F.status!=="deleted").map(F=>F.value)),z},[t,e,c,d,m]);return{draft:a,summary:m,promptDirty:c,modelDirty:d,setPromptAppend:g,revertPrompt:p,setModel:b,revertModel:w,addMcp:S.add,updateMcp:S.update,deleteMcp:S.remove,undoDeleteMcp:S.undo,addEnv:j.add,updateEnv:j.update,deleteEnv:j.remove,undoDeleteEnv:j.undo,addGit:E.add,updateGit:E.update,deleteGit:E.remove,undoDeleteGit:E.undo,resetAll:C,buildPayloadPatch:_}}const Qn={overview:"ad-overview",setup:"ad-setup",prompt:tc("prompt"),tools:tc("mcp"),advanced:"ad-advanced",danger:"ad-danger"};function pZ(e){const t=[{key:"overview",label:"Profile",anchor:Qn.overview}];return e||t.push({key:"setup",label:"Setup",anchor:Qn.setup},{key:"prompt",label:"Prompt",anchor:Qn.prompt},{key:"tools",label:"Tools",anchor:Qn.tools},{key:"advanced",label:"Advanced",anchor:Qn.advanced}),t.push({key:"danger",label:"Danger zone",anchor:Qn.danger,divider:!0,danger:!0}),t}function gZ(){var Tt,rt,tr,zn,al,ca,da,za,Zn,Ma,wa,Ht;const t=Gj().uuid??"",n=Rn(),a=hn(),s=Ke({queryKey:["agent",t],queryFn:()=>LI(t),enabled:!!t}),l=Ke({queryKey:["agent-config",t],queryFn:()=>jh(t),enabled:!!t&&((Tt=s.data)==null?void 0:Tt.type)!=="human"}),c=Ke({queryKey:["agent-client-status",t],queryFn:()=>HB(t),enabled:!!t&&((rt=s.data)==null?void 0:rt.type)!=="human"}),d=Ke({queryKey:["agent-sessions-active",t],queryFn:()=>zC(t,{state:"active"}),enabled:!!t&&((tr=s.data)==null?void 0:tr.type)!=="human"}),m=Ke({queryKey:["clients"],queryFn:ls,enabled:!!t&&((zn=s.data)==null?void 0:zn.type)!=="human",refetchInterval:3e4}),h=mZ(l.data),[g,p]=x.useState(null),[b,w]=x.useState(null),[S,j]=x.useState(!1),E=xt({mutationFn:async()=>{if(!l.data)throw new Error("config not loaded");const ke=h.buildPayloadPatch();return Ch(t,{expectedVersion:l.data.version,payload:ke})},onSuccess:ke=>{a.setQueryData(["agent-config",t],ke),p(null),w(null),j(!0)},onError:ke=>{if(j(!1),ke instanceof Oc&&ke.status===409){w("Someone else saved a newer version while you were editing."),p(null);return}p(ke instanceof Error?ke.message:String(ke))}});x.useEffect(()=>{if(!S)return;const ke=setTimeout(()=>j(!1),2500);return()=>clearTimeout(ke)},[S]),x.useEffect(()=>{h.summary.anyDirty&&j(!1)},[h.summary.anyDirty]);const C=x.useCallback(()=>{w(null),p(null),a.invalidateQueries({queryKey:["agent-config",t]}),h.resetAll()},[a,t,h]),_=x.useCallback(ke=>{const et=document.getElementById(ke);et&&et.scrollIntoView({behavior:"smooth",block:"start"})},[]),z=xt({mutationFn:ke=>p1(t,ke),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agents"]})}}),M=xt({mutationFn:()=>RE(t),onSuccess:()=>a.invalidateQueries({queryKey:["agent",t]})}),L=xt({mutationFn:()=>OE(t),onSuccess:()=>a.invalidateQueries({queryKey:["agent",t]})}),O=xt({mutationFn:()=>AE(t),onSuccess:()=>n("/team")}),F=xt({mutationFn:()=>FI(t)}),[P,V]=x.useState(!1),[I,Q]=x.useState(""),[ie,be]=x.useState(null),[X,W]=x.useState(!1),q=Ke({queryKey:["clients"],queryFn:ls,enabled:P}),ne=xt({mutationFn:ke=>p1(t,{clientId:ke}),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agent-client-status",t]}),a.invalidateQueries({queryKey:["agents"]}),V(!1),Q(""),be(null)},onError:ke=>be(ke instanceof Error?ke.message:String(ke))}),[we,Re]=x.useState(!1),[R,D]=x.useState(null),U=xt({mutationFn:()=>$B(t,h.buildPayloadPatch()),onSuccess:ke=>{const et=ke.diff.length?ke.diff.map(pn=>`${pn.op} ${pn.path}`).join(`
|
|
396
|
+
`):"(no changes)";D(et)},onError:ke=>D(`Dry run failed: ${ke instanceof Error?ke.message:String(ke)}`)});x.useEffect(()=>{if(!h.summary.anyDirty)return;const ke=et=>{et.preventDefault(),et.returnValue=""};return window.addEventListener("beforeunload",ke),()=>window.removeEventListener("beforeunload",ke)},[h.summary.anyDirty]);const T=((al=s.data)==null?void 0:al.type)==="human",Z=x.useMemo(()=>pZ(T),[T]),Y=x.useRef(null),[ue,Se]=x.useState(!1);x.useEffect(()=>{if(T)return;const ke=Y.current;if(!ke||typeof IntersectionObserver>"u")return;const et=new IntersectionObserver(pn=>{const Nr=pn[0];Nr&&Se(!Nr.isIntersecting&&Nr.boundingClientRect.top<0)},{threshold:0});return et.observe(ke),()=>et.disconnect()},[T]);const[ve,me]=x.useState(Qn.overview);x.useEffect(()=>{if(typeof IntersectionObserver>"u")return;const ke=[];for(const et of Z){const pn=document.getElementById(et.anchor);if(!pn)continue;const Nr=new IntersectionObserver(pi=>{for(const gs of pi)gs.isIntersecting&&me(et.anchor)},{rootMargin:"0% 0% -70% 0%",threshold:0});Nr.observe(pn),ke.push(Nr)}return()=>{for(const et of ke)et.disconnect()}},[Z]);const Ge=x.useMemo(()=>{const ke=new Set;for(const et of h.summary.dirtySections)et==="prompt"&&ke.add(Qn.prompt),et==="model"&&ke.add(Qn.setup),et==="mcp"&&ke.add(Qn.tools),(et==="env"||et==="git")&&ke.add(Qn.advanced);return ke},[h.summary.dirtySections]);if(s.isLoading)return o.jsx("div",{className:"-m-6 flex",style:{minHeight:"100%"},children:o.jsx("div",{className:"p-6 text-body",style:{color:"var(--fg-3)"},children:"Loading…"})});if(s.error)return o.jsxs("div",{className:"-m-6 p-6 text-body",style:{color:"var(--state-error)"},children:["Failed to load agent: ",s.error instanceof Error?s.error.message:"Unknown error"]});const Be=s.data;if(!Be)return o.jsx("div",{className:"-m-6 p-6 text-body",style:{color:"var(--fg-3)"},children:"Agent not found"});const vt=Be.type==="human",gt=c.data,ae=((ca=d.data)==null?void 0:ca.length)??0,je=!vt&&!(gt!=null&>.clientId),De=!vt&>?!gt.online&&!!gt.clientId:!1,Ye=Be,mn=Ye.runtimeState??null,en=Ye.runtimeType??null,Er=Ye.totalSessions??null,Br=Be.uuid.slice(0,8),hi=cZ({activeSessions:ae,isUnclaimed:je,isOffline:De}),mi=h.draft.mcp.filter(ke=>ke.status!=="deleted"),ln=h.draft.env.filter(ke=>ke.status!=="deleted"),ua=h.draft.git.filter(ke=>ke.status!=="deleted"),le=ke=>new Set(mi.filter(et=>et.key!==ke).map(et=>et.value.name.toLowerCase())),ge=ke=>new Set(ln.filter(et=>et.key!==ke).map(et=>et.value.key)),Ue=ke=>new Set(ua.filter(et=>et.key!==ke).map(et=>{const{value:pn}=et;return pn.localPath?pn.localPath:((pn.url.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,"")}).filter(Boolean)),Ze={sessions:Er??"—",active:ae,runtime:en??(vt?"human":"—"),model:((za=(da=l.data)==null?void 0:da.payload.model)==null?void 0:za.trim())||"—"},nt=(gt==null?void 0:gt.clientId)??null,on=nt?((Zn=m.data)==null?void 0:Zn.find(ke=>ke.id===nt))??null:null,er=nt?(on==null?void 0:on.hostname)??nt:null,$t=Be.runtimeProvider??"claude-code",It=$t==="codex"?"Codex":"Claude Code";return o.jsxs("div",{className:"-m-6 flex",style:{minHeight:"calc(100vh - var(--sp-10))"},children:[o.jsxs("aside",{className:"shrink-0 overflow-auto",style:{width:220,borderRight:"var(--hairline) solid var(--border)",background:"var(--bg-raised)",padding:"var(--sp-3) 0"},children:[o.jsx(Xv,{style:{display:"block",padding:"var(--sp-1) var(--sp-4) var(--sp-2)"},children:"Agent"}),Z.map(ke=>o.jsxs("div",{children:[ke.divider&&o.jsx("div",{"aria-hidden":!0,style:{margin:"var(--sp-2) var(--sp-3_5)",borderTop:"var(--hairline) solid var(--border)"}}),o.jsx(yZ,{label:ke.label,active:ve===ke.anchor,danger:ke.danger??!1,dirty:Ge.has(ke.anchor),onClick:()=>_(ke.anchor)})]},ke.key))]}),o.jsxs("div",{className:"flex-1 min-w-0 overflow-auto",style:{background:"var(--bg)"},children:[o.jsxs("div",{style:{padding:"var(--sp-3_5) var(--sp-5)",borderBottom:"var(--hairline) solid var(--border-faint)",background:"var(--bg-raised)"},children:[o.jsxs(qB,{style:{marginBottom:"var(--sp-2)"},children:[o.jsx(ZB,{onClick:()=>n("/team"),children:"Agents"}),o.jsx(GB,{}),o.jsx(VB,{mono:!0,children:Be.name??Br})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"inline-flex items-center justify-center",style:{width:36,height:36,borderRadius:"var(--radius-panel)",background:"var(--bg-active)",border:"var(--hairline) solid var(--border-strong)"},children:o.jsx(Ic,{width:18,height:20,style:{color:"var(--accent)"}})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("span",{className:"text-title",title:`agt_${Br}`,children:Be.displayName}),o.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:["@",Be.name??Br]})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-caption",style:{color:"var(--fg-4)"},children:[o.jsx(ya,{tone:Be.type==="autonomous_agent"?"accent":"neutral",children:Be.type}),Be.visibility&&o.jsx(ya,{tone:Be.visibility==="organization"?"accent":"outline",children:Be.visibility}),(gt==null?void 0:gt.offlineSince)&&o.jsxs("span",{className:"mono",children:["offline since ",sc(gt.offlineSince)]})]})]}),o.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[o.jsx(hc,{state:mn}),o.jsxs(pe,{variant:"ghost",size:"xs",onClick:()=>n(`/?a=${Be.uuid}`),children:[o.jsx(wv,{className:"h-3 w-3"})," Open chat"]}),!vt&&Be.status==="active"&&o.jsxs(pe,{variant:"outline",size:"xs",onClick:()=>{F.reset(),F.mutate()},disabled:F.isPending,children:[o.jsx(mC,{className:"h-3 w-3"}),F.isPending?"Testing…":"Test"]})]})]}),o.jsxs("div",{className:"grid gap-1.5 mt-3",style:{gridTemplateColumns:"repeat(4, 1fr)"},children:[o.jsx(bf,{label:"sessions",value:Ze.sessions}),o.jsx(bf,{label:"active",value:Ze.active,accent:typeof Ze.active=="number"&&Ze.active>0?"var(--accent)":void 0}),o.jsx(bf,{label:"runtime",value:Ze.runtime}),o.jsx(bf,{label:"model",value:Ze.model})]})]}),o.jsx("div",{ref:Y,"aria-hidden":!0,style:{height:0}}),!vt&&o.jsx(YB,{runtimeLabel:It,computerLabel:er,visible:ue}),o.jsxs("div",{className:"mx-auto",style:{padding:"var(--sp-3_5) var(--sp-5) var(--sp-7)",maxWidth:960,display:"flex",flexDirection:"column",gap:20},children:[(F.data||F.error)&&o.jsx(kZ,{result:F.data??{status:"error",message:"Failed to reach server"},onDismiss:()=>F.reset()}),o.jsx(Bu,{anchorId:Qn.overview,title:"Profile",right:o.jsxs(pe,{variant:"outline",size:"xs",onClick:()=>n(`/settings/integrations?agent=${Be.uuid}`),title:"Manage platform bindings in Integrations",children:[o.jsx(wy,{className:"h-3 w-3"}),"Manage bindings"]}),children:o.jsx(c9,{agent:Be,onSave:async ke=>{await z.mutateAsync(ke)}})}),!vt&&o.jsxs(o.Fragment,{children:[o.jsxs(Bu,{anchorId:Qn.setup,title:"Setup",caption:((Ma=l.data)==null?void 0:Ma.version)!=null?o.jsxs("span",{className:"mono",children:["config v",l.data.version,h.summary.anyDirty&&o.jsxs(o.Fragment,{children:[" · ",o.jsx("span",{style:{color:"var(--state-blocked)"},children:"draft"})]})]}):null,children:[l.isLoading&&o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading configuration…"}),l.error&&o.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load configuration: ",String(l.error)]}),l.data&&o.jsx(lZ,{runtimeProvider:$t,computerLabel:er,canBindComputer:je&&Be.status==="active",bindComputerPending:ne.isPending,onBindComputer:()=>V(!0),onRebind:Be.clientId?()=>W(!0):void 0,modelSlot:o.jsx(w9,{value:h.draft.model,baseline:((wa=l.data)==null?void 0:wa.payload.model)??"",onChange:h.setModel,onRevert:h.revertModel,disabled:Be.status!=="active",provider:$t})})]}),o.jsx(Bu,{anchorId:Qn.prompt,title:"Prompt",children:l.data?o.jsx(K7,{value:h.draft.promptAppend,baseline:((Ht=l.data)==null?void 0:Ht.payload.prompt.append)??"",onChange:h.setPromptAppend,onRevert:h.revertPrompt,disabled:Be.status!=="active"}):null}),o.jsx(Bu,{anchorId:Qn.tools,title:"Tools",caption:"MCP servers available to this agent",children:l.data?o.jsx(h9,{items:h.draft.mcp,otherNames:le,onAdd:h.addMcp,onUpdate:h.updateMcp,onDelete:h.deleteMcp,onUndoDelete:h.undoDeleteMcp,disabled:Be.status!=="active"}):null}),o.jsx(Bu,{anchorId:Qn.advanced,title:"Advanced",caption:"Environment variables and git repositories the runtime clones into each session.",children:l.data&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{id:tc("env"),children:o.jsx(r9,{items:h.draft.env,otherKeys:ge,onAdd:h.addEnv,onUpdate:h.updateEnv,onDelete:h.deleteEnv,onUndoDelete:h.undoDeleteEnv,disabled:Be.status!=="active"})}),o.jsx("div",{id:tc("git"),children:o.jsx(i9,{items:h.draft.git,otherPaths:Ue,onAdd:h.addGit,onUpdate:h.updateGit,onDelete:h.deleteGit,onUndoDelete:h.undoDeleteGit,disabled:Be.status!=="active"})}),R&&o.jsx("pre",{className:"whitespace-pre-wrap mono text-label",style:{padding:"var(--sp-2)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",color:"var(--fg-2)"},children:R}),h.summary.anyDirty&&o.jsx("div",{className:"text-label",style:{color:"var(--fg-3)"},children:o.jsx("button",{type:"button",onClick:()=>U.mutate(),className:"underline bg-transparent border-0 cursor-pointer",style:{color:"var(--fg-3)"},disabled:U.isPending,children:U.isPending?"Computing dry-run…":"Preview server-side diff"})})]})})]}),o.jsx(iZ,{}),o.jsx(XB,{agent:Be,suspendPending:M.isPending,reactivatePending:L.isPending,deletePending:O.isPending,onSuspend:()=>M.mutate(),onReactivate:()=>L.mutate(),onDelete:()=>O.mutate()})]}),!vt&&o.jsx(aZ,{summary:h.summary,saveHint:hi,conflictMessage:b,errorMessage:g,saving:E.isPending,justSaved:S,onSave:()=>E.mutate(),onDiscard:()=>{h.summary.anyDirty&&Re(!0)},onReloadRemote:C,onJumpTo:ke=>_(tc(ke))})]}),o.jsx(vZ,{open:we,onOpenChange:Re,title:"Discard unsaved changes?",description:"Your edits to Prompt / Model / Tools / Advanced will be reverted to the last saved baseline.",confirmLabel:"Discard changes",destructive:!0,onConfirm:()=>{h.resetAll(),p(null),w(null),Re(!1)}}),o.jsx(Tn,{open:P,onOpenChange:ke=>{V(ke),ke||(Q(""),be(null),ne.reset())},children:o.jsxs(jn,{children:[o.jsx(Ln,{children:o.jsx(An,{children:"Bind computer"})}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Pick a computer you own to pin this agent to. The bind is one-shot — once set, moving the agent requires deleting and re-creating it on the target computer."}),q.isLoading?o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading computers…"}):q.error?o.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load computers: ",q.error instanceof Error?q.error.message:"Unknown"]}):o.jsx(bZ,{clients:q.data??[],selected:I,onSelect:Q}),ie&&o.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:ie})]}),o.jsxs(cr,{children:[o.jsx(pe,{variant:"outline",onClick:()=>V(!1),children:"Cancel"}),o.jsx(pe,{disabled:!I||ne.isPending,onClick:()=>{be(null),ne.mutate(I)},children:ne.isPending?"Binding…":"Bind"})]})]})}),o.jsx(W7,{open:X,onOpenChange:W,agent:Be})]})}function yZ({label:e,active:t,danger:n,dirty:a,onClick:s}){return o.jsx("button",{type:"button",onClick:s,className:Oe("block w-full text-left bg-transparent text-body transition-colors cursor-pointer","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",t?"":"hover:bg-accent"),style:{padding:"var(--sp-1_25) var(--sp-4) var(--sp-1_25) var(--sp-3_5)",border:"none",borderLeft:`var(--hairline-bold) solid ${t?"var(--accent)":"transparent"}`,background:t?"var(--bg-active)":"transparent",color:t?"var(--fg)":"var(--fg-3)",fontWeight:t?500:400},children:o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"flex-1 truncate",children:e}),a&&o.jsx("span",{role:"img","aria-label":"unsaved changes",style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--state-blocked)",flexShrink:0}}),n&&!a&&o.jsx("span",{"aria-hidden":!0,style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--state-error)",flexShrink:0}})]})})}function vZ(e){return o.jsx(Tn,{open:e.open,onOpenChange:e.onOpenChange,children:o.jsxs(jn,{children:[o.jsx(Ln,{children:o.jsx(An,{children:e.title})}),o.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),o.jsxs(cr,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),o.jsx(pe,{type:"button",variant:e.destructive?"destructive":"default",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function bZ({clients:e,selected:t,onSelect:n}){const a=e.filter(s=>s.status==="connected");return a.length===0?o.jsxs("div",{className:"text-body",style:{background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",padding:"var(--sp-2_5) var(--sp-3)",color:"var(--fg-3)"},children:["No connected computers available. Run"," ",o.jsx("code",{className:"mono text-label",children:"first-tree-hub client connect <url>"})," on the computer that should run this agent, then reopen this dialog."]}):o.jsx("ul",{className:"max-h-64 overflow-y-auto",style:{border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",margin:0,padding:0,listStyle:"none"},children:a.map(s=>{const l=s.id===t,c=s.status==="online"||s.status==="active";return o.jsx("li",{style:{borderTop:"var(--hairline) solid var(--border-faint)"},children:o.jsxs("button",{type:"button",onClick:()=>n(s.id),className:Oe("w-full text-left flex items-center gap-3"),style:{padding:"var(--sp-2) var(--sp-3)",background:l?"var(--accent-bg)":"transparent",border:"none",cursor:"pointer"},children:[o.jsx("span",{className:Oe("inline-block h-2 w-2 rounded-full shrink-0"),style:{background:c?"var(--state-idle)":"var(--fg-4)"},"aria-hidden":!0}),o.jsxs("span",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"block text-body truncate font-medium",children:s.hostname??s.id}),o.jsxs("span",{className:"block mono truncate text-caption",style:{color:"var(--fg-4)"},children:[s.id,s.os?` · ${s.os}`:"",s.sdkVersion?` · SDK ${s.sdkVersion}`:""]})]}),o.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:s.status})]})},s.id)})})}const xZ={success:"Connected",timeout:"Timed out",offline:"Offline",stale:"Stale",error:"Error"},wZ={success:"var(--state-idle)",timeout:"var(--state-blocked)",offline:"var(--state-offline)",stale:"var(--state-blocked)",error:"var(--state-error)"},SZ={success:"accent",timeout:"warn",stale:"warn",error:"error",offline:"neutral"};function kZ({result:e,onDismiss:t}){const n=wZ[e.status],a=SZ[e.status],s=e.connection;return o.jsx("div",{style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderLeft:`var(--sp-0_75) solid ${n}`,borderRadius:"var(--radius-panel)",padding:"var(--sp-3) var(--sp-3_5)"},children:o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ya,{tone:a,children:xZ[e.status]}),e.responseTime!=null&&o.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:[(e.responseTime/1e3).toFixed(1),"s"]})]}),e.message&&o.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:e.message}),s&&o.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:6,marginTop:2},children:[o.jsx("div",{children:s.runtimeState&&o.jsxs("span",{className:"mono",children:["runtime: ",s.runtimeState]})}),s.client?o.jsxs("div",{children:["Computer: ",s.client.hostname??s.client.id,s.client.os&&` (${s.client.os})`,s.client.sdkVersion&&` · SDK ${s.client.sdkVersion}`]}):o.jsx("div",{children:"No computer bound"}),s.lastSeenAt&&o.jsxs("div",{children:["Last seen: ",new Date(s.lastSeenAt).toLocaleString()]})]}),e.responseContent&&o.jsx("p",{className:"mono whitespace-pre-wrap text-label",style:{background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",padding:8,maxHeight:160,overflow:"auto"},children:e.responseContent})]}),o.jsx(pe,{variant:"ghost",size:"sm",onClick:t,children:"Dismiss"})]})})}function jZ(e){var t=0,n=e.children,a=n&&n.length;if(!a)t=1;else for(;--a>=0;)t+=n[a].value;e.value=t}function CZ(){return this.eachAfter(jZ)}function EZ(e,t){let n=-1;for(const a of this)e.call(t,a,++n,this);return this}function NZ(e,t){for(var n=this,a=[n],s,l,c=-1;n=a.pop();)if(e.call(t,n,++c,this),s=n.children)for(l=s.length-1;l>=0;--l)a.push(s[l]);return this}function _Z(e,t){for(var n=this,a=[n],s=[],l,c,d,m=-1;n=a.pop();)if(s.push(n),l=n.children)for(c=0,d=l.length;c<d;++c)a.push(l[c]);for(;n=s.pop();)e.call(t,n,++m,this);return this}function TZ(e,t){let n=-1;for(const a of this)if(e.call(t,a,++n,this))return a}function AZ(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,a=t.children,s=a&&a.length;--s>=0;)n+=a[s].value;t.value=n})}function RZ(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function OZ(e){for(var t=this,n=zZ(t,e),a=[t];t!==n;)t=t.parent,a.push(t);for(var s=a.length;e!==n;)a.splice(s,0,e),e=e.parent;return a}function zZ(e,t){if(e===t)return e;var n=e.ancestors(),a=t.ancestors(),s=null;for(e=n.pop(),t=a.pop();e===t;)s=e,e=n.pop(),t=a.pop();return s}function MZ(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function DZ(){return Array.from(this)}function IZ(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function LZ(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*PZ(){var e=this,t,n=[e],a,s,l;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,a=e.children)for(s=0,l=a.length;s<l;++s)n.push(a[s]);while(n.length)}function G_(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=FZ)):t===void 0&&(t=BZ);for(var n=new So(e),a,s=[n],l,c,d,m;a=s.pop();)if((c=t(a.data))&&(m=(c=Array.from(c)).length))for(a.children=c,d=m-1;d>=0;--d)s.push(l=c[d]=new So(c[d])),l.parent=a,l.depth=a.depth+1;return n.eachBefore(V_)}function UZ(){return G_(this).eachBefore($Z)}function BZ(e){return e.children}function FZ(e){return Array.isArray(e)?e[1]:null}function $Z(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function V_(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function So(e){this.data=e,this.depth=this.height=0,this.parent=null}So.prototype=G_.prototype={constructor:So,count:CZ,each:EZ,eachAfter:_Z,eachBefore:NZ,find:TZ,sum:AZ,sort:RZ,path:OZ,ancestors:MZ,descendants:DZ,leaves:IZ,links:LZ,copy:UZ,[Symbol.iterator]:PZ};function Rg(e){return e==null?null:HZ(e)}function HZ(e){if(typeof e!="function")throw new Error;return e}var qZ={depth:-1},Dk={},Og={};function ZZ(e){return e.id}function GZ(e){return e.parentId}function VZ(){var e=ZZ,t=GZ,n;function a(s){var l=Array.from(s),c=e,d=t,m,h,g,p,b,w,S,j,E=new Map;if(n!=null){const C=l.map((M,L)=>QZ(n(M,L,s))),_=C.map(Ik),z=new Set(C).add("");for(const M of _)z.has(M)||(z.add(M),C.push(M),_.push(Ik(M)),l.push(Og));c=(M,L)=>C[L],d=(M,L)=>_[L]}for(g=0,m=l.length;g<m;++g)h=l[g],w=l[g]=new So(h),(S=c(h,g,s))!=null&&(S+="")&&(j=w.id=S,E.set(j,E.has(j)?Dk:w)),(S=d(h,g,s))!=null&&(S+="")&&(w.parent=S);for(g=0;g<m;++g)if(w=l[g],S=w.parent){if(b=E.get(S),!b)throw new Error("missing: "+S);if(b===Dk)throw new Error("ambiguous: "+S);b.children?b.children.push(w):b.children=[w],w.parent=b}else{if(p)throw new Error("multiple roots");p=w}if(!p)throw new Error("no root");if(n!=null){for(;p.data===Og&&p.children.length===1;)p=p.children[0],--m;for(let C=l.length-1;C>=0&&(w=l[C],w.data===Og);--C)w.data=null}if(p.parent=qZ,p.eachBefore(function(C){C.depth=C.parent.depth+1,--m}).eachBefore(V_),p.parent=null,m>0)throw new Error("cycle");return p}return a.id=function(s){return arguments.length?(e=Rg(s),a):e},a.parentId=function(s){return arguments.length?(t=Rg(s),a):t},a.path=function(s){return arguments.length?(n=Rg(s),a):n},a}function QZ(e){e=`${e}`;let t=e.length;return Vy(e,t-1)&&!Vy(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function Ik(e){let t=e.length;if(t<2)return"";for(;--t>1&&!Vy(e,t););return e.slice(0,t)}function Vy(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if((n&1)===0)return!0}return!1}function KZ(e,t){return e.parent===t.parent?1:2}function zg(e){var t=e.children;return t?t[0]:e.t}function Mg(e){var t=e.children;return t?t[t.length-1]:e.t}function YZ(e,t,n){var a=n/(t.i-e.i);t.c-=a,t.s+=n,e.c+=a,t.z+=n,t.m+=n}function XZ(e){for(var t=0,n=0,a=e.children,s=a.length,l;--s>=0;)l=a[s],l.z+=t,l.m+=t,t+=l.s+(n+=l.c)}function WZ(e,t,n){return e.a.parent===t.parent?e.a:n}function Lf(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}Lf.prototype=Object.create(So.prototype);function JZ(e){for(var t=new Lf(e,0),n,a=[t],s,l,c,d;n=a.pop();)if(l=n._.children)for(n.children=new Array(d=l.length),c=d-1;c>=0;--c)a.push(s=n.children[c]=new Lf(l[c],c)),s.parent=n;return(t.parent=new Lf(null,0)).children=[t],t}function eG(){var e=KZ,t=1,n=1,a=null;function s(h){var g=JZ(h);if(g.eachAfter(l),g.parent.m=-g.z,g.eachBefore(c),a)h.eachBefore(m);else{var p=h,b=h,w=h;h.eachBefore(function(_){_.x<p.x&&(p=_),_.x>b.x&&(b=_),_.depth>w.depth&&(w=_)});var S=p===b?1:e(p,b)/2,j=S-p.x,E=t/(b.x+S+j),C=n/(w.depth||1);h.eachBefore(function(_){_.x=(_.x+j)*E,_.y=_.depth*C})}return h}function l(h){var g=h.children,p=h.parent.children,b=h.i?p[h.i-1]:null;if(g){XZ(h);var w=(g[0].z+g[g.length-1].z)/2;b?(h.z=b.z+e(h._,b._),h.m=h.z-w):h.z=w}else b&&(h.z=b.z+e(h._,b._));h.parent.A=d(h,b,h.parent.A||p[0])}function c(h){h._.x=h.z+h.parent.m,h.m+=h.parent.m}function d(h,g,p){if(g){for(var b=h,w=h,S=g,j=b.parent.children[0],E=b.m,C=w.m,_=S.m,z=j.m,M;S=Mg(S),b=zg(b),S&&b;)j=zg(j),w=Mg(w),w.a=h,M=S.z+_-b.z-E+e(S._,b._),M>0&&(YZ(WZ(S,h,p),h,M),E+=M,C+=M),_+=S.m,E+=b.m,z+=j.m,C+=w.m;S&&!Mg(w)&&(w.t=S,w.m+=_-C),b&&!zg(j)&&(j.t=b,j.m+=E-z,p=h)}return p}function m(h){h.x*=t,h.y=h.depth*n}return s.separation=function(h){return arguments.length?(e=h,s):e},s.size=function(h){return arguments.length?(a=!1,t=+h[0],n=+h[1],s):a?null:[t,n]},s.nodeSize=function(h){return arguments.length?(a=!0,t=+h[0],n=+h[1],s):a?[t,n]:null},s}function tG(e,t){const n=`?window=${encodeURIComponent(t)}`;return Ce.get(gy(e,`/context-tree/snapshot${n}`))}function rl({title:e,subtitle:t,right:n,className:a,style:s,...l}){return o.jsxs("div",{className:Oe("flex items-baseline gap-3 shrink-0",a),style:{padding:"var(--sp-4) var(--sp-5) var(--sp-3)",...s},...l,children:[o.jsx("h1",{className:"m-0 text-subtitle",style:{color:"var(--fg)"},children:e}),t&&o.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:t}),o.jsx("div",{style:{flex:1}}),n]})}const Q_=[{value:"1d",label:"1 day",summary:"last 1 day"},{value:"7d",label:"7 days",summary:"last 7 days"},{value:"30d",label:"30 days",summary:"last 30 days"}];function nG(){const{organizationId:e}=pt(),[t,n]=x.useState("7d"),[a,s]=x.useState(null),[l,c]=x.useState(null),d=Ke({queryKey:["context-tree-snapshot",e,t],queryFn:()=>{if(!e)throw new Error("No organization selected");return tG(e,t)},enabled:!!e}),m=d.data,h=x.useMemo(()=>m?m.updates.find(b=>b.id===a)??m.updates[0]??null:null,[a,m]),g=x.useMemo(()=>m&&h!=null&&h.nodeId?m.nodes.find(b=>b.id===h.nodeId)??null:null,[h,m]),p=l??(h==null?void 0:h.nodeId)??(g==null?void 0:g.id)??null;return x.useEffect(()=>{var b;m&&(a&&m.updates.some(w=>w.id===a)||s(((b=m.updates[0])==null?void 0:b.id)??null))},[a,m]),o.jsxs("div",{className:"-m-6",children:[o.jsx(rl,{title:"Context",subtitle:"Team context available to agents, and how it is changing"}),o.jsxs("div",{style:{padding:"var(--sp-4) var(--sp-5) var(--sp-7)"},children:[d.isLoading?o.jsx(dG,{}):null,d.error?o.jsx(fG,{message:d.error instanceof Error?d.error.message:"Failed to load"}):null,m&&!d.isLoading?o.jsx("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:m.snapshotStatus==="unavailable"?o.jsx(Y_,{snapshot:m}):o.jsxs(o.Fragment,{children:[o.jsx(rG,{snapshot:m,window:t,onWindowChange:n}),o.jsx(aG,{snapshot:m,selectedUpdate:h,selectedUpdateNode:g,selectedOverviewNodeId:p,onSelectUpdate:b=>{s(b.id),c(b.nodeId)},onSelectOverviewNode:c})]})}):null]})]})}function rG({snapshot:e,window:t,onWindowChange:n}){const a=e.contextStatus.severity==="ok"?o.jsx(Lz,{size:18}):o.jsx(Ws,{size:18}),s=jG(t),l=e.contextStatus.label,c=EG(e);return o.jsx(Cn,{children:o.jsx(Wn,{style:{padding:"var(--sp-2_5) var(--sp-3_5)"},children:o.jsxs("div",{className:"flex flex-wrap items-center justify-between",style:{gap:"var(--sp-3)"},children:[o.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)",minWidth:0},children:[o.jsx("span",{style:{color:CG(e.contextStatus.severity),flex:"0 0 auto"},children:a}),o.jsxs("div",{style:{minWidth:0},children:[o.jsxs("div",{className:"flex flex-wrap items-baseline",style:{gap:"var(--sp-2)"},children:[o.jsx("div",{className:"text-subtitle font-semibold",style:{color:"var(--fg)"},children:l}),c?o.jsx("div",{className:"text-label font-medium",style:{color:"var(--fg-3)"},children:c}):null]}),o.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-0_5)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.contextStatus.detail??"Agents have a synced team context snapshot available."})]})]}),o.jsxs("div",{className:"flex flex-wrap items-center justify-end",style:{gap:"var(--sp-3)"},children:[o.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[o.jsx(jf,{value:e.summary.changedNodeCount,label:`updates in the ${s}`}),o.jsx(jf,{value:e.summary.addedCount,label:"added",tone:"added"}),o.jsx(jf,{value:e.summary.editedCount,label:"edited",tone:"edited"}),o.jsx(jf,{value:e.summary.removedCount,label:"removed",tone:"removed"})]}),o.jsxs("fieldset",{className:"flex flex-wrap",style:{gap:"var(--sp-1)"},children:[o.jsx("legend",{className:"sr-only",children:"Context update window"}),Q_.map(d=>o.jsx(pe,{variant:d.value===t?"default":"outline",size:"xs",onClick:()=>n(d.value),children:d.label},d.value))]})]})]})})})}function aG({snapshot:e,selectedUpdate:t,selectedUpdateNode:n,selectedOverviewNodeId:a,onSelectUpdate:s,onSelectOverviewNode:l}){const c=d=>{l(d);const m=e.updates.find(h=>h.nodeId===d);m&&s(m)};return o.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:[o.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-[minmax(26rem,1fr)_minmax(0,1fr)]",style:{gap:"var(--sp-4)",alignItems:"stretch"},children:[o.jsxs(Cn,{className:"flex h-full flex-col",children:[o.jsx(la,{children:o.jsxs("div",{className:"flex flex-col",children:[o.jsx(oa,{children:"Context Updates"}),o.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:[e.updates.length," team context changes agents may use"]})]})}),o.jsx(Wn,{className:"flex-1",children:e.updates.length===0?o.jsx(X_,{}):o.jsx("div",{className:"flex flex-col",style:{gap:"var(--sp-1_5)",height:"min(52vh, 30rem)",overflow:"auto",paddingRight:"var(--sp-0_5)"},children:e.updates.map(d=>o.jsx(iG,{update:d,selected:d.id===(t==null?void 0:t.id),onClick:()=>s(d)},d.id))})})]}),o.jsx(sG,{update:t,node:n,snapshot:e},(t==null?void 0:t.id)??"empty")]}),o.jsx(lG,{snapshot:e,selectedNodeId:a,onSelectNode:c})]})}function iG({update:e,selected:t,onClick:n}){return o.jsxs("button",{type:"button",onClick:n,className:"w-full text-left transition-colors",style:{border:"var(--hairline) solid var(--border)",borderColor:t?"var(--accent)":"var(--border)",borderRadius:"var(--radius-panel)",background:t?"var(--bg-sunken)":"var(--bg)",padding:"var(--sp-2_5)"},children:[o.jsx("div",{className:"flex items-start justify-between",style:{gap:"var(--sp-2)"},children:o.jsxs("div",{style:{minWidth:0},children:[o.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[o.jsx(K_,{type:e.changeType}),o.jsx("span",{className:"text-body font-semibold",style:{color:"var(--fg)",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden"},children:AG(e)})]}),o.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["In ",J_(e.path)]})]})}),o.jsxs("div",{className:"flex flex-wrap text-label",style:{color:"var(--fg-3)",gap:"var(--sp-2)",marginTop:"var(--sp-2)"},children:[o.jsx("span",{children:IG(e.owners)}),e.relatedNodeIds.length>0?o.jsx("span",{children:LG(e.relatedNodeIds.length)}):null]})]})}function sG({update:e,node:t,snapshot:n}){const[a,s]=x.useState(!1),l=t==null?void 0:t.relatedNodeIds.map(p=>n.nodes.find(b=>b.id===p)).filter(p=>!!p),c=(t==null?void 0:t.sourcePath)??(e==null?void 0:e.path)??null,d=e!=null&&e.sourceCommit?e.sourceCommit.slice(0,7):"no commit",m=e?DG(e.owners):"No owner",h=l&&l.length>0?l.map(p=>p.title||p.path||"root"):[],g=e?PG(e.path)||J_(e.path):"root";return o.jsxs(Cn,{className:"flex h-full flex-col",children:[o.jsxs(la,{children:[o.jsxs("div",{children:[o.jsx(oa,{children:"Selected Change"}),o.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"Summary and source context"})]}),e?o.jsx(K_,{type:e.changeType}):null]}),o.jsx(Wn,{className:"flex-1",children:e?o.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-3)"},children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-title font-semibold",style:{color:"var(--fg)"},children:e.title}),o.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[RG(e)," · ",_G(e.changeType)," · ",g]}),o.jsx("div",{className:"text-label font-mono",style:{color:"var(--fg-4)",marginTop:"var(--sp-0_5)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.path})]}),o.jsx("div",{style:{borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:"var(--sp-3)"},children:o.jsx(uG,{value:OG(e),impact:TG(e)})}),o.jsx("div",{style:{borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:"var(--sp-3)"},children:o.jsx(cG,{commit:d,linkedContextItems:h,owner:m,path:c??e.path,preview:(t==null?void 0:t.preview)??null,sourceExpanded:a,onTogglePreview:()=>{s(p=>!p)}})})]}):o.jsx(X_,{})})]})}function lG({snapshot:e,selectedNodeId:t,onSelectNode:n}){const a=x.useMemo(()=>kG(e.nodes),[e.nodes]),s=x.useMemo(()=>gG(e.nodes,t,a),[t,e.nodes,a]),l=Math.max(760,...s.map(p=>p.x+280)),c=Math.max(280,...s.map(p=>p.y+48)),d=Math.max(220,c+24),m=360,h=d>m,g=xG(e.nodes,t);return o.jsxs(Cn,{children:[o.jsx(la,{children:o.jsxs("div",{children:[o.jsxs(oa,{children:[o.jsx(Zz,{size:17}),"Where Context Changed"]}),o.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"Numbers = updated areas under each branch."})]})}),o.jsx(Wn,{children:s.length===0?o.jsx(Y_,{snapshot:e}):o.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-3)"},children:[o.jsxs("div",{className:"flex flex-wrap items-center",style:{columnGap:"var(--sp-4)",rowGap:"var(--sp-1_5)"},children:[o.jsxs("div",{className:"flex flex-wrap items-center text-label",style:{color:"var(--fg-3)",gap:"var(--sp-1_5)"},children:[o.jsx("span",{className:"font-semibold",style:{color:"var(--fg-2)"},children:"Selected"}),o.jsx("span",{children:g??"No update selected"})]}),o.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[o.jsx(Dg,{color:"var(--accent)",label:"Selected path"}),o.jsx(Dg,{color:"var(--accent-bg)",label:"Updated"}),o.jsx(Dg,{color:"var(--bg-raised)",label:"Quiet / hidden"})]})]}),o.jsx("div",{style:{overflow:h?"auto":"hidden",maxHeight:h?`${m}px`:void 0},children:o.jsxs("svg",{viewBox:`0 0 ${l} ${c}`,role:"img","aria-label":"Context Tree overview",preserveAspectRatio:"xMinYMin meet",style:{display:"block",width:"100%",height:`${d}px`},children:[s.map(p=>p.parent?o.jsx("line",{x1:p.parent.x,y1:p.parent.y,x2:p.x,y2:p.y,stroke:p.selectedPath&&p.parent.selectedPath?"var(--accent)":"var(--border)",strokeOpacity:p.muted?.34:p.selectedPath?.72:.56,strokeWidth:p.selectedPath&&p.parent.selectedPath?1.6:1},`edge:${p.id}`):null),s.map(p=>o.jsx("foreignObject",{x:p.x-10,y:p.y-15,width:l-p.x-8,height:30,children:o.jsxs("button",{type:"button",disabled:p.sourceNodeId===null,onClick:()=>{p.sourceNodeId&&n(p.sourceNodeId)},className:"flex w-full items-center text-left text-label",style:{color:p.muted?"var(--fg-3)":"var(--fg)",cursor:p.sourceNodeId?"pointer":"default",gap:"var(--sp-2)",opacity:p.muted?.66:1},children:[o.jsx("span",{"aria-hidden":"true",style:{width:p.selected?"var(--sp-4)":"var(--sp-3)",height:p.selected?"var(--sp-4)":"var(--sp-3)",borderRadius:"50%",background:UG(p),border:`${p.selected?"var(--hairline-bold)":"var(--hairline)"} solid ${p.selected?"var(--accent)":"var(--border-strong)"}`,flex:"0 0 auto"}}),o.jsx("span",{className:p.selectedPath?"font-semibold":"font-medium",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.title}),p.updateCount>0&&!p.isSummary?o.jsx("span",{className:"font-semibold",style:{background:"var(--accent-bg)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-chip)",color:"var(--fg-2)",flex:"0 0 auto",padding:"0 var(--sp-1)"},children:p.updateCount}):null]})},p.id))]})})]})})]})}function Dg({color:e,label:t}){return o.jsxs("span",{className:"inline-flex items-center text-label",style:{color:"var(--fg-3)",gap:"var(--sp-1)"},children:[o.jsx("span",{"aria-hidden":"true",style:{background:e,border:"var(--hairline) solid var(--border-strong)",borderRadius:"50%",height:"var(--sp-2)",width:"var(--sp-2)"}}),o.jsx("span",{children:t})]})}function jf({value:e,label:t,tone:n}){return o.jsxs("span",{className:"inline-flex items-baseline text-label",style:{color:"var(--fg-3)",gap:"var(--sp-1)"},children:[o.jsx("span",{className:"font-semibold",style:{color:n?tT(n):"var(--fg)"},children:e}),o.jsx("span",{children:t})]})}function oG({label:e,tone:t,strong:n}){return o.jsx("span",{className:`text-label ${n?"font-semibold":"font-medium"}`,style:{color:t?tT(t):"var(--fg)",background:t?"var(--accent-bg)":"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-chip)",padding:"var(--sp-0_5) var(--sp-1_5)"},children:e})}function K_({type:e}){return o.jsx(oG,{label:NG(e),tone:e})}function uG({value:e,impact:t}){return o.jsxs("div",{style:{color:"var(--fg-2)"},children:[o.jsx("div",{className:"text-label font-semibold",style:{color:"var(--fg)",marginBottom:"var(--sp-1)"},children:"Change summary"}),o.jsx("div",{className:"text-body",children:e}),o.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:["Impact: ",t]})]})}function cG({path:e,commit:t,linkedContextItems:n,owner:a,preview:s,sourceExpanded:l,onTogglePreview:c}){const d=[{label:"Owner",value:a},...n.length>0?[{label:"Linked",value:n.join(", ")}]:[],{label:"Source",value:e,mono:!0},{label:"Commit",value:t,mono:!0}];return o.jsxs("div",{children:[o.jsx("div",{className:"text-label font-semibold",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Reference"}),o.jsx("dl",{className:"grid grid-cols-1 md:grid-cols-2",style:{columnGap:"var(--sp-4)",rowGap:"var(--sp-2)"},children:d.map(m=>o.jsxs("div",{className:"grid",style:{gridTemplateColumns:"4rem minmax(0,1fr)",gap:"var(--sp-2)"},children:[o.jsx("dt",{className:"text-label font-semibold",style:{color:"var(--fg-3)"},children:m.label}),o.jsx("dd",{className:`text-label ${m.mono?"font-mono":"font-medium"}`,style:{color:"var(--fg-2)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.value})]},m.label))}),o.jsxs("div",{className:"flex flex-wrap",style:{gap:"var(--sp-1)",marginTop:"var(--sp-3)"},children:[o.jsx(pe,{variant:"outline",size:"xs",onClick:c,children:l?"Hide source":"Preview source"}),o.jsxs(pe,{variant:"ghost",size:"xs",onClick:()=>void navigator.clipboard.writeText(e),children:[o.jsx(ch,{size:14}),"Copy path"]})]}),l?o.jsx("div",{style:{borderTop:"var(--hairline) solid var(--border-faint)",marginTop:"var(--sp-3)",paddingTop:"var(--sp-3)"},children:s?o.jsx(Rh,{children:s}):o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No source preview available."})}):null]})}function dG(){return o.jsx(Cn,{children:o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-center text-body",style:{color:"var(--fg-2)",gap:"var(--sp-2)"},children:[o.jsx(uM,{size:17}),"Loading team context..."]})})})}function fG({message:e}){return o.jsx(Cn,{children:o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-center text-body",style:{color:"var(--danger)",gap:"var(--sp-2)"},children:[o.jsx(Ws,{size:17}),e]})})})}function Y_({snapshot:e}){const t=e.repo?"Context Tree sync unavailable":"Connect Context Tree",n=e.repo?"Hub cannot read the team Context Tree yet. Agents and users will see context here after the server can sync the configured repo.":"Connect a Context Tree repo to show the team knowledge agents can use.",a=e.contextStatus.detail,s=e.repo?hG(e.repo):null;return o.jsx(Cn,{children:o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-start text-body",style:{color:"var(--fg-2)",gap:"var(--sp-2)"},children:[o.jsx(Ws,{size:18,style:{color:"var(--warn)"}}),o.jsxs("div",{children:[o.jsx("div",{className:"font-semibold",style:{color:"var(--fg)"},children:t}),o.jsx("div",{style:{marginTop:"var(--sp-1)"},children:n}),a?o.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:a}):null,e.repo||e.branch?o.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:[s?`Repo: ${s}`:null,e.repo&&e.branch?" · ":null,e.branch?`Branch: ${e.branch}`:null]}):null]})]})})})}function hG(e){return e.replace(/(https?:\/\/)[^/@\s]+@/g,"$1[redacted]@")}function X_(){return o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No context updates in this time window."})}const mG=2,pG=3;function gG(e,t,n){const a=yG(e,t,n);if(a.length===0)return[];const s=VZ().id(h=>h.id).parentId(h=>h.parentId)(a).sort((h,g)=>h.data.isSummary!==g.data.isSummary?h.data.isSummary?1:-1:h.data.path.localeCompare(g.data.path)),c=eG().nodeSize([42,190])(s).descendants(),d=Math.min(...c.map(h=>h.x));return c.map(h=>({...h.data,x:28+h.y,y:28+h.x-d,parent:null})).map((h,g,p)=>({...h,parent:h.parentId?p.find(b=>b.id===h.parentId)??null:null}))}function yG(e,t,n){const a=new Map(e.map(b=>[b.id,b])),s=e.filter(b=>!b.parentId||a.has(b.parentId)).sort((b,w)=>b.path.localeCompare(w.path));if(s.length===0)return[];const l=vG(s),c=bG(t,a),d=new Set,m=new Map;for(const b of s){const w=W_(b,a,m),S=n.get(b.id)??0;(w<=mG||c.has(b.id)||S>0&&w<=pG&&b.kind!=="leaf")&&wG(b.id,a,d)}const h=c.size>0,g=s.filter(b=>d.has(b.id)).map(b=>{const w=n.get(b.id)??0,S=c.has(b.id);return{id:b.id,parentId:b.parentId&&d.has(b.parentId)?b.parentId:null,sourceNodeId:b.id,title:b.title,path:b.path,changeType:b.changeType,updateCount:w,isSummary:!1,selected:t===b.id,selectedPath:S,muted:h&&!S&&w===0}}),p=[];for(const b of s){if(!d.has(b.id))continue;const w=(l.get(b.id)??[]).filter(j=>!d.has(j.id));if(w.length===0)continue;const S=w.filter(j=>(n.get(j.id)??0)>0).length;p.push({id:`summary:${b.id}`,parentId:b.id,sourceNodeId:null,title:SG(w.length,S),path:`${b.path}/~summary`,changeType:null,updateCount:S,isSummary:!0,selected:!1,selectedPath:c.has(b.id),muted:h&&!c.has(b.id)})}return[...g,...p]}function vG(e){const t=new Map;for(const n of e){if(!n.parentId)continue;const a=t.get(n.parentId)??[];a.push(n),t.set(n.parentId,a)}for(const n of t.values())n.sort((a,s)=>a.path.localeCompare(s.path));return t}function bG(e,t){const n=new Set;let a=e?t.get(e):void 0;for(;a;)n.add(a.id),a=a.parentId?t.get(a.parentId):void 0;return n}function xG(e,t){const n=new Map(e.map(l=>[l.id,l])),a=[];let s=t?n.get(t):void 0;for(;s;)a.unshift(s.title),s=s.parentId?n.get(s.parentId):void 0;return a.length>0?a.join(" / "):null}function wG(e,t,n){let a=t.get(e);for(;a;)n.add(a.id),a=a.parentId?t.get(a.parentId):void 0}function W_(e,t,n){const a=n.get(e.id);if(a!==void 0)return a;const s=e.parentId?t.get(e.parentId):void 0,l=s?W_(s,t,n)+1:0;return n.set(e.id,l),l}function SG(e,t){return t>0?`${e} hidden · ${t} updated`:`${e} hidden quiet area${e===1?"":"s"}`}function kG(e){const t=new Map(e.map(a=>[a.id,a])),n=new Map;for(const a of e){if(!a.changeType)continue;let s=a;for(;s;)n.set(s.id,(n.get(s.id)??0)+1),s=s.parentId?t.get(s.parentId):void 0}return n}function jG(e){var t;return((t=Q_.find(n=>n.value===e))==null?void 0:t.summary)??"last 7 days"}function CG(e){return e==="ok"?"var(--ok)":e==="warning"?"var(--warn)":"var(--danger)"}function EG(e){var n;const t=((n=e.headCommit)==null?void 0:n.slice(0,7))??null;return e.branch&&t?`Source: ${e.branch} @ ${t}`:e.branch?`Branch: ${e.branch}`:t?`Commit: ${t}`:null}function NG(e){return e==="added"?"New":e==="removed"?"Removed":"Updated"}function _G(e){return e==="added"?"New knowledge":e==="removed"?"Removed knowledge":"Updated knowledge"}function TG(e){return e.changeType==="added"?`Agents can use new team knowledge when working on ${e.affectedContextArea}.`:e.changeType==="removed"?`Agents should stop using the old team knowledge for ${e.affectedContextArea}.`:`Agents can use updated team knowledge when working on ${e.affectedContextArea}.`}function AG(e){const t=e.changedBy??"Someone",n=e.changeType==="added"?"added":e.changeType==="removed"?"removed":"updated";return`${t} ${n} ${e.title}`}function RG(e){const t=e.changedBy??"Someone";return`${e.changeType==="added"?"Added":e.changeType==="removed"?"Removed":"Updated"} by ${t}`}function OG(e){const t=e.changedBy??"Someone",n=e.changeType==="added"?"added":e.changeType==="removed"?"removed":"updated",a=MG(e);return a?`${t} ${n} ${e.title}: ${a}`:`${t} ${n} ${e.title}.`}function zG(e){return e.summary.replace(/^updated:\s*/i,"")}function MG(e){const t=zG(e);return new Set(["updated this team knowledge","added this team knowledge","removed this team knowledge"]).has(t.toLowerCase())||t.length<12||/[,;:]$/.test(t)?null:t}function DG(e){return e.length===0?"No owner":e.length===1?e[0]??"No owner":e.join(", ")}function IG(e){return e.length===0?"Owner not set":e.length===1?`Owner: ${e[0]??"Unknown"}`:`Owners: ${e.join(", ")}`}function LG(e){return`${e} linked context${e===1?"":"s"}`}function PG(e){const t=e.split("/").filter(Boolean);return t.length<=1?null:t.slice(0,-1).map(eT).join(" / ")}function J_(e){return e.split("/").filter(Boolean).map(eT).join(" / ")||"root"}function eT(e){return e.replace(/[-_]+/g," ").replace(/\b\w/g,t=>t.toUpperCase()).trim()}function tT(e){return e==="added"?"var(--ok)":e==="edited"?"var(--warn)":"var(--danger)"}function UG(e){return e.isSummary?"var(--bg-sunken)":e.selected?"var(--accent)":e.changeType||e.updateCount>0?"var(--accent-bg)":"var(--bg-raised)"}const Ro=x.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:Oe("rounded-[var(--radius-panel)] border bg-card text-card-foreground shadow-sm",e),...t}));Ro.displayName="Card";const Oo=x.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:Oe("flex flex-col space-y-1.5 p-6",e),...t}));Oo.displayName="CardHeader";const $c=x.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:Oe("text-subtitle leading-none",e),...t}));$c.displayName="CardTitle";const nT=x.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:Oe("text-body text-muted-foreground",e),...t}));nT.displayName="CardDescription";const zo=x.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:Oe("p-6 pt-0",e),...t}));zo.displayName="CardContent";const BG=x.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:Oe("flex items-center p-6 pt-0",e),...t}));BG.displayName="CardFooter";function FG(){const{token:e}=Gj(),t=Rn(),{isAuthenticated:n,adoptTokens:a}=pt(),[s,l]=x.useState(null),[c,d]=x.useState(null),[m,h]=x.useState(!1),[g,p]=x.useState(null);if(x.useEffect(()=>{e&&(async()=>{try{const E=await fetch(`/api/v1/invitations/${encodeURIComponent(e)}/preview`);if(!E.ok){d("This invitation is no longer valid");return}l(await E.json())}catch{d("Network error while loading invitation")}})()},[e]),x.useEffect(()=>{n&&(async()=>{try{const E=await Ce.get("/me/organizations"),C=await Ce.get("/me"),_=E.find(z=>z.id===C.member.organizationId);p((_==null?void 0:_.displayName)??null)}catch{}})()},[n]),!e)return o.jsx(Lk,{message:"Bad invitation URL"});if(c)return o.jsx(Lk,{message:"This invitation is no longer valid"});if(!s)return o.jsx($G,{});const b=async()=>{h(!0);try{const E=await Ce.post("/me/organizations/join",{token:e});await a(E.tokens),aC("invite"),t("/",{replace:!0})}catch(E){d(E instanceof Error?E.message:"Failed to join team")}finally{h(!1)}},w=`/api/v1/auth/github/start?next=${encodeURIComponent(`/invite/${e}`)}`,S=n&&g&&g!==s.organizationDisplayName,j=HG(s.expiresAt);return o.jsx(yb,{children:o.jsxs(Ro,{className:"w-full max-w-sm",children:[o.jsx(Oo,{className:"text-center",children:o.jsxs($c,{className:"text-title",children:["You're invited to join",o.jsx("br",{}),s.organizationDisplayName]})}),o.jsxs(zo,{className:"space-y-4",children:[S&&o.jsxs("div",{className:"flex items-start gap-2 rounded-md p-3 text-label",style:{background:"var(--bg-sunken)",color:"var(--fg-2)"},children:[o.jsx(Ws,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),o.jsxs("span",{children:["You'll switch from ",o.jsx("span",{className:"font-medium",children:g})," to"," ",o.jsx("span",{className:"font-medium",children:s.organizationDisplayName}),"."]})]}),n?o.jsx(pe,{className:"w-full",disabled:m,onClick:b,children:m?"Joining…":`Join ${s.organizationDisplayName}`}):o.jsx(pe,{asChild:!0,className:"w-full",children:o.jsxs("a",{href:w,children:[o.jsx(fC,{className:"h-4 w-4"}),"Continue with GitHub to join"]})}),j&&o.jsx("p",{className:"text-center text-label",style:{color:j.urgent?"var(--destructive)":"var(--fg-3)"},children:j.text}),o.jsxs("p",{className:"text-center text-label text-muted-foreground",children:["By continuing you agree to our"," ",o.jsx("a",{href:"/terms",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Terms"})," ","·"," ",o.jsx("a",{href:"/privacy",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Privacy"})]})]})]})})}function yb({children:e}){return o.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[o.jsx("header",{className:"px-4 py-3",children:o.jsxs(Rc,{to:"/",className:"inline-flex items-center gap-1.5 rounded-[var(--radius-input)] px-2 py-1 text-body text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:[o.jsx(vv,{className:"h-3.5 w-3.5"}),"Back to home"]})}),o.jsx("div",{className:"flex flex-1 items-center justify-center px-4 pb-16",children:e})]})}function $G(){return o.jsx(yb,{children:o.jsxs(Ro,{className:"w-full max-w-sm",children:[o.jsxs(Oo,{className:"text-center",children:[o.jsx("div",{className:"mx-auto h-5 w-2/3 rounded-md",style:{background:"var(--bg-sunken)"}}),o.jsx("div",{className:"mx-auto mt-2 h-5 w-1/2 rounded-md",style:{background:"var(--bg-sunken)"}})]}),o.jsxs(zo,{className:"space-y-4",children:[o.jsx("div",{className:"h-9 w-full rounded-md",style:{background:"var(--bg-sunken)"}}),o.jsx("div",{className:"mx-auto h-3 w-1/3 rounded-md",style:{background:"var(--bg-sunken)"}})]})]})})}function Lk({message:e}){return o.jsx(yb,{children:o.jsxs(Ro,{className:"w-full max-w-sm",children:[o.jsxs(Oo,{className:"text-center",children:[o.jsx("div",{className:"mb-2 flex justify-center text-fg-3",children:o.jsx(Ws,{className:"h-6 w-6"})}),o.jsx($c,{className:"text-title",children:e})]}),o.jsxs(zo,{className:"space-y-4",children:[o.jsx("p",{className:"text-center text-body text-muted-foreground",children:"It may have expired or been revoked. Ask the team admin for a fresh link."}),o.jsx(pe,{asChild:!0,variant:"outline",className:"w-full",children:o.jsxs(Rc,{to:"/",children:[o.jsx(vv,{className:"h-3.5 w-3.5"}),"Back to home"]})})]})]})})}function HG(e){if(!e)return null;const t=new Date(e).getTime();if(!Number.isFinite(t))return null;const n=t-Date.now();if(n<=0)return null;const a=Math.floor(n/6e4),s=Math.floor(a/60),l=Math.floor(s/24);return l>7?null:l>=1?{text:`Expires in ${l} ${l===1?"day":"days"}`,urgent:!1}:s>=1?{text:`Expires in ${s} ${s===1?"hour":"hours"}`,urgent:!0}:{text:`Expires in ${Math.max(1,a)} ${a===1?"minute":"minutes"}`,urgent:!0}}function qG(e){if(typeof e!="object"||e===null||!("from"in e))return null;const t=e.from;if(typeof t!="object"||t===null||!("pathname"in t)||typeof t.pathname!="string"||t.pathname==="/login")return null;const n="search"in t&&typeof t.search=="string"?t.search:"",a="hash"in t&&typeof t.hash=="string"?t.hash:"",s=`${t.pathname}${n}${a}`,l=hN(s);return l===F1&&s!==F1?null:l}function ZG(){const{isAuthenticated:e}=pt(),t=Sr(),n=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),a=qG(t.state)??"/",s=a==="/"?"/api/v1/auth/github/start":`/api/v1/auth/github/start?next=${encodeURIComponent(a)}`,l="/api/v1/auth/github/dev-callback?githubId=1&login=devuser&displayName=Dev+User";return e?o.jsx(lr,{to:a,replace:!0}):o.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[o.jsx("header",{className:"px-4 py-3",children:o.jsxs(Rc,{to:"/",className:"inline-flex items-center gap-1.5 rounded-[var(--radius-input)] px-2 py-1 text-body text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:[o.jsx(vv,{className:"h-3.5 w-3.5"}),"Back to home"]})}),o.jsx("div",{className:"flex flex-1 items-center justify-center px-4 pb-16",children:o.jsxs(Ro,{className:"w-full max-w-sm",children:[o.jsxs(Oo,{className:"text-center",children:[o.jsx("div",{className:"mb-2 flex justify-center text-foreground",children:o.jsx(Ic,{width:28,height:32})}),o.jsxs($c,{className:"text-title",children:["First Tree ",o.jsx("span",{className:"font-normal text-muted-foreground",children:"Hub"})]})]}),o.jsxs(zo,{className:"space-y-4",children:[o.jsx(pe,{asChild:!0,className:"w-full",children:o.jsxs("a",{href:s,children:[o.jsx(fC,{className:"h-4 w-4"}),"Continue with GitHub"]})}),o.jsxs("p",{className:"text-center text-label text-muted-foreground",children:["By continuing you agree to our"," ",o.jsx("a",{href:"/terms",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Terms"})," ","·"," ",o.jsx("a",{href:"/privacy",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Privacy"})]}),n&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"relative my-2 text-center text-label text-muted-foreground",children:[o.jsx("span",{className:"relative z-10 bg-card px-2",children:"localhost only"}),o.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-border"})]}),o.jsx(pe,{asChild:!0,variant:"outline",className:"w-full",children:o.jsxs("a",{href:l,children:[o.jsx(SM,{className:"h-4 w-4"}),"Dev: skip GitHub"]})})]})]})]})})]})}function GG(){const e=Rn(),{adoptTokens:t}=pt(),[n,a]=x.useState(null);return x.useEffect(()=>{const s=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash,l=new URLSearchParams(s),c=l.get("access"),d=l.get("refresh"),m=hN(l.get("next")),h=l.get("joinPath");if(!c||!d){a("Sign-in did not complete. Please try again.");return}(h==="solo"||h==="invite")&&aC(h),window.history.replaceState(null,"",window.location.pathname),(async()=>(await t({accessToken:c,refreshToken:d}),e(m,{replace:!0})))()},[t,e]),o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-body text-muted-foreground",children:n??"Signing you in…"})}const gc=x.forwardRef(({className:e,style:t,...n},a)=>o.jsx("table",{ref:a,className:Oe("w-full",e),style:{borderCollapse:"separate",borderSpacing:0,...t},...n}));gc.displayName="DenseTable";const yc=x.forwardRef(({className:e,...t},n)=>o.jsx("thead",{ref:n,className:e,...t}));yc.displayName="DenseTableHeader";const vc=x.forwardRef(({className:e,...t},n)=>o.jsx("tbody",{ref:n,className:e,...t}));vc.displayName="DenseTableBody";const na=x.forwardRef(({className:e,interactive:t,selected:n,style:a,...s},l)=>o.jsx("tr",{ref:l,className:Oe("transition-colors",e),"data-interactive":t?"":void 0,"data-selected":n?"":void 0,style:{background:n?"var(--bg-active)":void 0,cursor:t?"pointer":void 0,...a},...s}));na.displayName="DenseTableRow";const Wt=x.forwardRef(({className:e,style:t,...n},a)=>o.jsx("th",{ref:a,className:Oe("text-left text-label whitespace-nowrap",e),style:{padding:"var(--sp-2) var(--sp-3_5)",color:"var(--fg-3)",fontWeight:500,borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));Wt.displayName="DenseTableHead";const ht=x.forwardRef(({className:e,style:t,...n},a)=>o.jsx("td",{ref:a,className:Oe("align-middle text-body",e),style:{padding:"var(--sp-2_25) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));ht.displayName="DenseTableCell";const VG=1500;function QG({command:e,expiresInSeconds:t,phase:n,copyLabel:a={idle:"Copy",done:"Copied"},waitingText:s="Waiting for your computer to connect…",successContent:l,errorContent:c,caption:d="Single-use · regenerates the previous one.",copyButtonPlacement:m="right"}){const[h,g]=x.useState(!1),p=async()=>{e&&(await navigator.clipboard.writeText(e),g(!0),setTimeout(()=>g(!1),VG))},b=t!==void 0?Math.max(1,Math.round(t/60)):null,w=o.jsx("pre",{className:"mono text-label",style:{margin:0,padding:"var(--sp-2_5) var(--sp-3)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",whiteSpace:"pre-wrap",wordBreak:"break-all",overflowWrap:"anywhere",minWidth:0,flex:m==="right"?1:void 0},title:e??"",children:e?o.jsxs(o.Fragment,{children:[e,b!==null&&o.jsxs("span",{style:{color:"var(--fg-4)"},children:[" # expires in ",b,"m"]})]}):"Generating token…"}),S=o.jsxs(pe,{type:"button",variant:"outline",size:"sm",onClick:p,disabled:!e,style:{alignSelf:"flex-start"},children:[h?o.jsx(ur,{className:"h-3.5 w-3.5"}):o.jsx(ch,{className:"h-3.5 w-3.5"}),h?a.done:a.idle]});return o.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[m==="right"?o.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[w,S]}):o.jsxs(o.Fragment,{children:[w,S]}),d&&o.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",margin:0},children:d}),n==="waiting"&&o.jsxs("div",{className:"flex items-center text-body",style:{gap:"var(--sp-2_5)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-blocked) 14%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-blocked) 35%, transparent)",borderRadius:"var(--radius-input)",color:"color-mix(in oklch, var(--state-blocked) 35%, var(--fg))"},children:[o.jsx(KG,{}),s]}),n==="success"&&l&&o.jsxs("div",{className:"flex items-center text-body",style:{gap:"var(--sp-2_5)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-idle) 14%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-idle) 35%, transparent)",borderRadius:"var(--radius-input)",color:"color-mix(in oklch, var(--state-idle) 45%, var(--fg))"},children:[o.jsx(ur,{className:"h-3.5 w-3.5",style:{flexShrink:0}}),o.jsx("span",{style:{minWidth:0},children:l})]}),n==="error"&&c&&o.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:c})]})}function KG(){return o.jsx("span",{"aria-hidden":"true",style:{width:12,height:12,flexShrink:0,borderRadius:"50%",border:"var(--hairline-bold) solid color-mix(in oklch, var(--state-blocked) 30%, transparent)",borderTopColor:"var(--state-blocked)",animation:"spin 0.85s linear infinite"}})}const YG=3e3,XG=1200;function WG({open:e,onOpenChange:t}){const n=hn(),{user:a}=pt(),[s,l]=x.useState("loading"),[c,d]=x.useState(null),[m,h]=x.useState(null),[g,p]=x.useState(null),b=x.useRef(new Set);return x.useEffect(()=>{if(!e){l("loading"),d(null),h(null),p(null),b.current=new Set;return}let w=!1;const S=(n.getQueryData(["clients"])??[]).map(j=>j.id);return b.current=new Set(S),(async()=>{try{const j=await mD();if(w)return;d(j),l("waiting")}catch(j){if(w)return;h(j instanceof Error?j.message:"Failed to generate connect token"),l("error")}})(),()=>{w=!0}},[e,n]),x.useEffect(()=>{if(!e||s!=="waiting"||!a)return;const S=setInterval(async()=>{try{const j=await n.fetchQuery({queryKey:["clients"],queryFn:ls}),E=b.current,C=j.find(_=>!E.has(_.id)&&_.status==="connected"&&_.userId===a.id);C&&(p(C.hostname??null),l("success"))}catch{}},YG);return()=>clearInterval(S)},[e,s,n,a]),x.useEffect(()=>{if(s!=="success")return;const w=setTimeout(()=>{n.invalidateQueries({queryKey:["clients"]}),t(!1)},XG);return()=>clearTimeout(w)},[s,t,n]),o.jsx(Tn,{open:e,onOpenChange:t,children:o.jsxs(jn,{children:[o.jsxs(Ln,{children:[o.jsx(An,{children:"Connect computer"}),o.jsx(Rv,{children:"Run this command on the machine you want to pair with this Hub."})]}),o.jsx(QG,{command:(c==null?void 0:c.command)??null,expiresInSeconds:c==null?void 0:c.expiresIn,phase:s,successContent:o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"font-semibold",children:g??"Computer"})," connected. Closing…"]}),errorContent:m}),o.jsx("div",{className:"flex justify-end",style:{gap:"var(--sp-2)"},children:o.jsx(pe,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"})})]})})}function JG({embedded:e=!1}={}){const t=hn(),n=gh(),[a,s]=x.useState(()=>new Set),[l,c]=x.useState(null),[d,m]=x.useState(null),[h,g]=x.useState(null),[p,b]=x.useState(!1),{data:w}=Ke({queryKey:["clients"],queryFn:ls,refetchInterval:1e4}),{data:S}=Ke({queryKey:["activity"],queryFn:zc,refetchInterval:1e4}),j=xt({mutationFn:hD,onSuccess:()=>{c(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})}}),E=xt({mutationFn:fD,onSuccess:()=>{m(null),g(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})},onError:O=>{O instanceof Oc?g(O.message):g(O instanceof Error?O.message:String(O))}}),C=x.useMemo(()=>{const O=new Map;for(const F of(S==null?void 0:S.agents)??[]){if(!F.clientId)continue;const P=O.get(F.clientId)??[];P.push(F),O.set(F.clientId,P)}return O},[S==null?void 0:S.agents]),_=O=>C.get(O)??[],z=(w??[]).filter(O=>O.status==="connected").length,M=(w??[]).reduce((O,F)=>O+F.agentCount,0),L=(w??[]).filter(O=>O.authState!=="ok").length;return o.jsxs("div",{className:e?"":"-m-6",children:[o.jsx(rl,{title:"Computers",subtitle:w&&w.length>0?o.jsxs(o.Fragment,{children:[w.length," total · ",z," connected · ",M," agents bound",L>0&&o.jsxs(o.Fragment,{children:[" · ",o.jsxs("span",{style:{color:"var(--state-error)"},children:[L," need re-auth"]})]})]}):null,right:o.jsx("div",{className:"flex items-center gap-1.5",children:o.jsxs(pe,{size:"xs",onClick:()=>b(!0),children:[o.jsx(ba,{className:"h-3 w-3"}),"Connect computer"]})})}),o.jsxs("div",{style:{padding:"var(--sp-3_5) var(--sp-5) var(--sp-7)"},children:[o.jsx(WG,{open:p,onOpenChange:b}),d&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:o.jsxs("div",{className:"max-w-md w-full",style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",padding:24,boxShadow:"var(--shadow-md)"},children:[o.jsx("h3",{className:"text-subtitle mb-2",children:"Retire Computer"}),o.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["Permanently remove"," ",o.jsx("span",{className:"font-medium",style:{color:"var(--fg)"},children:d.hostname??d.id.slice(0,8)}),". Retire refuses if any agent is still pinned to this computer — you must delete those agents first (reassign is not available in this milestone)."]}),_(d.id).length>0&&o.jsxs("div",{className:"mb-3 p-2 rounded",style:{background:"color-mix(in oklch, var(--state-blocked) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-blocked) 28%, transparent)"},children:[o.jsx("div",{className:"text-label mb-1",children:"Agents currently bound to this computer (delete them first):"}),o.jsx("ul",{className:"text-body space-y-0.5",children:_(d.id).map(O=>o.jsx("li",{className:"font-medium",children:n(O.agentId)},O.agentId))})]}),h&&o.jsx("div",{className:"mb-3 p-2 rounded text-body",style:{background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",color:"var(--state-error)"},children:h}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(pe,{variant:"outline",size:"sm",onClick:()=>{m(null),g(null)},children:"Cancel"}),o.jsx(pe,{variant:"destructive",size:"sm",onClick:()=>E.mutate(d.id),disabled:E.isPending,children:E.isPending?"Retiring…":"Retire"})]})]})}),l&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:o.jsxs("div",{className:"max-w-md w-full",style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",padding:24,boxShadow:"var(--shadow-md)"},children:[o.jsx("h3",{className:"text-subtitle mb-2",children:"Disconnect Computer"}),o.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["This will disconnect"," ",o.jsx("span",{className:"font-medium",style:{color:"var(--fg)"},children:l.hostname??l.id.slice(0,8)})," ","and affect all bound agents:"]}),o.jsx("ul",{className:"mb-4 space-y-1",children:_(l.id).length===0?o.jsx("li",{className:"text-body",style:{color:"var(--fg-3)"},children:"No bound agents"}):_(l.id).map(O=>o.jsxs("li",{className:"text-body flex items-center gap-2",children:[o.jsx("span",{className:"font-medium",children:n(O.agentId)}),o.jsx(hc,{state:O.runtimeState})]},O.agentId))}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(pe,{variant:"outline",size:"sm",onClick:()=>c(null),children:"Cancel"}),o.jsx(pe,{variant:"destructive",size:"sm",onClick:()=>j.mutate(l.id),disabled:j.isPending,children:j.isPending?"Disconnecting…":"Disconnect"})]})]})}),!w||w.length===0?o.jsx(Cn,{children:o.jsx("div",{className:"text-center py-10 text-body",style:{color:"var(--fg-3)"},children:"No computers connected. Use the button above to generate a connect command."})}):o.jsxs(Cn,{children:[o.jsxs(Dy,{children:["Registered · ",w.length]}),o.jsxs(gc,{children:[o.jsx(yc,{children:o.jsxs(na,{children:[o.jsx(Wt,{style:{width:16}}),o.jsx(Wt,{children:"Hostname"}),o.jsx(Wt,{children:"OS"}),o.jsx(Wt,{children:"SDK"}),o.jsx(Wt,{children:"Agents"}),o.jsx(Wt,{children:"Connected"}),o.jsx(Wt,{children:"Status"}),o.jsx(Wt,{"aria-hidden":!0})]})}),o.jsx(vc,{children:w.map(O=>{const F=!a.has(O.id),P=_(O.id);return o.jsx(sV,{client:O,boundAgents:P,isExpanded:F,agentName:n,onToggle:()=>s(V=>{const I=new Set(V);return I.has(O.id)?I.delete(O.id):I.add(O.id),I}),onDisconnect:()=>c(O),onRetire:()=>{g(null),m(O)},onReconnect:()=>b(!0)},O.id)})})]})]})]})]})}const eV={"claude-code":"Claude Code",codex:"Codex"},tV=[Yf.CLAUDE_CODE,Yf.CODEX],Pk={"claude-code":"Run `npm install -g @anthropic-ai/claude-code` on this computer.",codex:"Install the OpenAI Codex CLI on this computer."},nV={"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 rV({clientId:e,enabled:t}){const{data:n,isLoading:a}=Ke({queryKey:["client-capabilities",e],queryFn:()=>Cv(e),enabled:t}),s=(n==null?void 0:n.capabilities)??null;return o.jsxs(o.Fragment,{children:[o.jsx(Xv,{style:{display:"block",marginBottom:6},children:"Runtimes"}),a&&!s?o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):s&&Object.keys(s).length===0?o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Capabilities not yet reported. Reconnect this computer to refresh."}):o.jsx("div",{className:"flex flex-col gap-1",children:tV.map(l=>o.jsx(aV,{provider:l,entry:s?s[l]??null:null},l))})]})}function aV({provider:e,entry:t}){const n=eV[e];if(!t)return o.jsxs("div",{className:"flex items-center gap-2.5 text-body",style:{opacity:.7},children:[o.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),o.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:["not reported · ",Pk[e]]})]});switch(t.state){case"ok":return o.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[o.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),o.jsxs("span",{className:"text-caption",style:{color:"var(--state-idle)"},children:["✓ ",t.sdkVersion?`v${t.sdkVersion} · `:"","authenticated (",t.authMethod,")"]})]});case"unauthenticated":return o.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[o.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),o.jsxs("span",{className:"text-caption",style:{color:"var(--state-blocked)"},children:["⚠ installed",t.sdkVersion?` v${t.sdkVersion}`:"",", not authenticated ·"," ",nV[e]]})]});case"missing":return o.jsxs("div",{className:"flex items-center gap-2.5 text-body",style:{opacity:.7},children:[o.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),o.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:["✗ not installed · ",Pk[e]]})]});case"error":return o.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[o.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),o.jsxs("span",{className:"text-caption",style:{color:"var(--state-error)"},children:["error · ",t.error??"probe failed"]})]})}}function iV(){return o.jsxs("span",{className:"mono inline-flex items-center gap-1.5 uppercase text-caption",style:{color:"var(--state-error)"},children:[o.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"var(--state-error)",display:"inline-block"}}),"AUTH EXPIRED"]})}function sV({client:e,boundAgents:t,isExpanded:n,agentName:a,onToggle:s,onDisconnect:l,onRetire:c,onReconnect:d}){const h=e.status!=="connected",g=e.authState!=="ok",p=e.status==="connected"?"idle":"offline";return o.jsxs(o.Fragment,{children:[o.jsxs(na,{interactive:!0,selected:n,onClick:s,children:[o.jsx(ht,{style:{width:16},children:o.jsx("span",{style:{color:"var(--fg-4)",display:"inline-flex"},children:n?o.jsx(bv,{className:"h-3.5 w-3.5"}):o.jsx(Dz,{className:"h-3.5 w-3.5"})})}),o.jsx(ht,{className:"font-medium",children:e.hostname??"—"}),o.jsx(ht,{style:{color:"var(--fg-3)"},children:e.os??"—"}),o.jsx(ht,{className:"mono text-label",style:{color:"var(--fg-3)"},children:e.sdkVersion??"—"}),o.jsx(ht,{children:o.jsx("span",{className:"mono tnum text-label",children:e.agentCount})}),o.jsx(ht,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:e.connectedAt?sc(e.connectedAt):"—"}),o.jsx(ht,{children:g?o.jsx(iV,{}):o.jsx(hc,{state:p})}),o.jsx(ht,{style:{width:1,whiteSpace:"nowrap"},children:o.jsxs("div",{className:"flex items-center justify-end text-label",style:{gap:"var(--sp-3_5)"},children:[h&&o.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:g?"var(--state-error)":"var(--fg-2)"},onClick:b=>{b.stopPropagation(),d()},children:"Reconnect"}),o.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:"var(--fg-2)"},onClick:b=>{b.stopPropagation(),l()},children:"Disconnect"}),o.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:"var(--fg-4)"},onClick:b=>{b.stopPropagation(),c()},children:"Retire"})]})})]}),n&&o.jsxs("tr",{style:{background:"var(--bg-sunken)"},children:[o.jsx(ht,{}),o.jsxs(ht,{colSpan:7,style:{padding:"var(--sp-2_5) var(--sp-3) var(--sp-3_5)"},children:[o.jsx(rV,{clientId:e.id,enabled:n}),t.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs(Xv,{style:{display:"block",marginTop:"var(--sp-3)",marginBottom:6},children:["Bound agents · ",t.length]}),o.jsx("div",{className:"flex flex-col gap-1",children:t.map(b=>o.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[o.jsx("span",{className:"font-medium",style:{minWidth:140},children:a(b.agentId)}),o.jsx(hc,{state:b.runtimeState}),b.activeSessions!==null&&o.jsxs("span",{className:"mono tnum text-caption",style:{color:"var(--fg-3)"},children:[b.activeSessions," / ",b.totalSessions??0," sessions"]})]},b.agentId))})]})]})]})]})}function lV(){return o.jsx(JG,{embedded:!0})}function Mo(e,t){return`/orgs/${encodeURIComponent(e)}/settings/${encodeURIComponent(t)}`}function vb(e){return Ce.get(Mo(e,"context_tree"))}function rT(e,t){return Ce.put(Mo(e,"context_tree"),t)}function oV(e){return Ce.get(Mo(e,"github_integration"))}function uV(e,t){return Ce.put(Mo(e,"github_integration"),t)}function aT(e){return Ce.get(Mo(e,"source_repos"))}function iT(e,t){return Ce.put(Mo(e,"source_repos"),t)}function bc({label:e,hint:t,value:n,onChange:a,saved:s=!1,mono:l=!1,type:c="text",placeholder:d,rightSlot:m,readOnly:h=!1,pattern:g}){const p=x.useId(),b=`flex-1 min-w-0 outline-none text-body focus-visible:ring-1 focus-visible:ring-ring ${l?"mono":""}`,w={padding:"var(--sp-1_5) var(--sp-2_5)",background:"var(--bg-sunken)",border:"var(--hairline) solid transparent",borderRadius:"var(--radius-input)",color:"var(--fg)"};return o.jsxs("div",{style:{marginBottom:"var(--sp-4)"},children:[o.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:"var(--sp-2)"},children:[o.jsx("label",{htmlFor:p,className:"text-body font-medium",style:{color:"var(--fg)"},children:e}),s&&o.jsx(cV,{})]}),t&&o.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",margin:"var(--sp-0_5) 0 var(--sp-2)"},children:t}),o.jsxs("div",{className:"flex items-stretch",style:{gap:"var(--sp-2)"},children:[h?o.jsx("input",{id:p,value:n,readOnly:!0,className:b,style:{...w,color:"var(--fg-2)"}}):o.jsx("input",{id:p,value:n,onChange:S=>a==null?void 0:a(S.target.value),type:c,placeholder:d,pattern:g,className:b,style:w}),m]})]})}function cV(){return o.jsxs("span",{className:"text-label inline-flex items-center fade-in",style:{gap:"var(--sp-1)",color:"color-mix(in oklch, var(--accent) 35%, var(--fg))"},children:[o.jsx(ur,{className:"h-3 w-3"}),"Saved"]})}function bb({pending:e,disabled:t=!1}){const n=e||t;return o.jsx("button",{type:"submit",disabled:n,"aria-label":"Save",title:"Save",className:"settings-save-button",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,width:"var(--sp-8)",background:"transparent",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",padding:0,cursor:n?"default":"pointer",color:"var(--fg-3)",opacity:n?.5:1,transition:"color 0.15s, background 0.15s, border-color 0.15s"},children:e?o.jsx(hC,{className:"h-4 w-4 animate-spin"}):o.jsx(ur,{className:"h-4 w-4"})})}function Hc({title:e,description:t,right:n,children:a,isFirst:s=!1}){return o.jsxs("section",{style:{padding:"var(--sp-6) 0",borderTop:s?void 0:"var(--hairline) solid var(--border-faint)"},children:[o.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:"var(--sp-3)"},children:[o.jsxs("div",{style:{minWidth:0},children:[o.jsx("h2",{className:"text-subtitle font-medium m-0",style:{color:"var(--fg)"},children:e}),t&&o.jsx("p",{className:"text-label m-0",style:{color:"var(--fg-3)",marginTop:"var(--sp-0_5)"},children:t})]}),n]}),o.jsx("div",{style:{marginTop:"var(--sp-4)"},children:a})]})}function dV({isFirst:e=!1}){var C,_;const{organizationId:t}=pt(),n=hn(),a=Ke({queryKey:["org-setting",t,"github_integration"],queryFn:()=>t?oV(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,l]=x.useState(""),[c,d]=x.useState(!1),[m,h]=x.useState(!1),[g,p]=x.useState(!1),b=((C=a.data)==null?void 0:C.webhookUrl)??"",w=xt({mutationFn:()=>{if(!t)throw new Error("organization not loaded");const z=s.trim();return z.length===0&&!c?Promise.resolve(a.data):uV(t,{webhookSecret:z.length>0?z:null})},onSuccess:z=>{z&&(n.setQueryData(["org-setting",t,"github_integration"],z),l(""),d(!1),h(!0),setTimeout(()=>h(!1),2e3))}}),S=z=>{z.preventDefault(),w.mutate()},j=async()=>{b&&(await navigator.clipboard.writeText(b),p(!0),setTimeout(()=>p(!1),2e3))},E=((_=a.data)==null?void 0:_.webhookSecretConfigured)??!1;return o.jsx(Hc,{title:"GitHub webhook",description:"Routes GitHub issue and comment events to your team's agents.",isFirst:e,children:a.isLoading?o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):a.error?o.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:a.error instanceof Error?a.error.message:"Failed to load setting"}):o.jsxs("form",{onSubmit:S,children:[b?o.jsx(bc,{label:"Webhook URL",hint:"Configure this URL in GitHub repo / org Settings → Webhooks. Never changes.",value:b,readOnly:!0,mono:!0,rightSlot:o.jsxs(pe,{type:"button",size:"sm",variant:"outline",onClick:j,children:[o.jsx(ch,{className:"h-3 w-3"}),g?"Copied":"Copy"]})}):o.jsx(fV,{}),E&&!c?o.jsx(hV,{saved:m,onReplace:()=>{d(!0),l("")}}):o.jsx(bc,{label:"Webhook secret",hint:"Paste the value you used when configuring the GitHub webhook. Stored encrypted; never echoed back.",value:s,onChange:l,mono:!0,type:"password",placeholder:c?"Enter new secret":"(none)",saved:m,rightSlot:o.jsx(bb,{pending:w.isPending,disabled:!a.data})}),w.error instanceof Error&&o.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:w.error.message})]})})}function fV(){return o.jsxs("div",{style:{marginBottom:"var(--sp-4)"},children:[o.jsx("div",{className:"text-body font-medium",style:{color:"var(--fg)"},children:"Webhook URL"}),o.jsxs("div",{className:"flex items-start text-body",style:{gap:"var(--sp-2)",marginTop:"var(--sp-2)",padding:"var(--sp-2) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",color:"var(--state-warning, var(--fg-3))"},children:[o.jsx(Ws,{className:"h-4 w-4 shrink-0",style:{marginTop:"var(--sp-0_5)"}}),o.jsx("span",{children:"The Hub's public URL is not configured. Please contact your site administrator to enable the GitHub webhook."})]})]})}function hV({saved:e,onReplace:t}){return o.jsxs("div",{style:{marginBottom:"var(--sp-4)"},children:[o.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:"var(--sp-2)"},children:[o.jsx("span",{className:"text-body font-medium",style:{color:"var(--fg)"},children:"Webhook secret"}),e&&o.jsx("span",{className:"text-label inline-flex items-center fade-in",style:{gap:"var(--sp-1)",color:"color-mix(in oklch, var(--accent) 35%, var(--fg))"},children:"✓ Saved"})]}),o.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",margin:"var(--sp-0_5) 0 var(--sp-2)"},children:"Configured. Replace to rotate; webhook signature verification will fail until GitHub is also updated."}),o.jsxs("div",{className:"flex items-stretch",style:{gap:"var(--sp-2)"},children:[o.jsx("div",{className:"flex-1 mono text-body flex items-center",style:{padding:"var(--sp-1_5) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",color:"var(--fg-2)"},children:"••••••••"}),o.jsx(pe,{type:"button",size:"sm",variant:"outline",onClick:t,children:"Replace"})]})]})}function mV(){const{role:e}=pt();return e===null?o.jsx("div",{className:"text-body",style:{padding:"var(--sp-5)",color:"var(--fg-3)"},children:"Loading..."}):e!=="admin"?o.jsx(lr,{to:"/settings/computers",replace:!0}):o.jsxs(o.Fragment,{children:[o.jsx(rl,{title:"GitHub",subtitle:"Webhook URL + secret for routing GitHub events to your agents"}),o.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:o.jsx(dV,{isFirst:!0})})]})}function pV(){return Ce.get(On("/adapter-mappings"))}function gV(e){return Ce.post(On("/adapter-mappings"),e)}function yV(e){return Ce.delete(`/adapter-mappings/${e}`)}function vV(){return Ce.get(On("/adapters/status"))}function bV(){return Ce.get(On("/adapters"))}function xV(e){return Ce.post(On("/adapters"),e)}function wV(e,t){return Ce.patch(`/adapters/${e}`,t)}function SV(e){return Ce.delete(`/adapters/${e}`)}const kV=Object.values(o6),Uk={platform:"feishu",feishuAppId:"",feishuAppSecret:"",credentialsJson:"{}",status:"active",externalUserId:"",displayName:"",kaelUserId:"",kaelProjectId:""};function Bk(e){const[t,n]=x.useState(Uk),[a,s]=x.useState("");x.useEffect(()=>{e.open&&(n({...Uk,platform:e.initialPlatform??"feishu",status:e.initialStatus??"active"}),s(""))},[e.open,e.initialPlatform,e.initialStatus]);function l(d){if(d.preventDefault(),s(""),e.kind==="user"){if(!t.externalUserId)return;e.onSubmit({kind:"user-create",draft:{platform:t.platform,externalUserId:t.externalUserId,displayName:t.displayName||null}});return}if(t.platform==="feishu"){if(!e.editingId&&(!t.feishuAppId||!t.feishuAppSecret)){s("App ID and App Secret are required");return}}else if(t.platform==="kael"){if(!e.editingId&&(!t.kaelUserId||!t.kaelProjectId)){s("User ID and Project ID are required");return}}else{const h=t.credentialsJson.trim();if(!e.editingId&&!h){s("Credentials are required");return}if(h)try{JSON.parse(h)}catch{s("Invalid JSON");return}}const m=jV(t);if(!e.editingId&&!m){s("Credentials are required");return}if(e.editingId)e.onSubmit({kind:"bot-update",status:t.status,...m?{credentials:m}:{}});else{if(!m)return;e.onSubmit({kind:"bot-create",draft:{platform:t.platform,status:t.status,credentials:m}})}}const c=e.kind==="user"?`Bind external user → ${e.agentLabel}`:e.editingId?`Edit bot binding · ${e.agentLabel}`:`Bind bot → ${e.agentLabel}`;return o.jsx(Tn,{open:e.open,onOpenChange:e.onOpenChange,children:o.jsxs(jn,{children:[o.jsx(Ln,{children:o.jsx(An,{children:c})}),o.jsxs("form",{onSubmit:l,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"binding-platform",children:"Platform"}),o.jsx("select",{id:"binding-platform",value:t.platform,onChange:d=>n({...t,platform:d.target.value}),disabled:!!e.editingId,className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50",children:kV.map(d=>o.jsx("option",{value:d,children:d},d))})]}),e.kind==="user"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"binding-ext-id",children:"External user ID"}),o.jsx(Pt,{id:"binding-ext-id",value:t.externalUserId,onChange:d=>n({...t,externalUserId:d.target.value}),placeholder:"ou_xxxxxxxx...",className:"font-mono",required:!0})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"binding-name",children:"Display name (optional)"}),o.jsx(Pt,{id:"binding-name",value:t.displayName,onChange:d=>n({...t,displayName:d.target.value})})]})]}):o.jsxs(o.Fragment,{children:[t.platform==="feishu"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs(kt,{htmlFor:"feishu-app-id",children:["App ID",e.editingId?" — leave empty to keep existing":""]}),o.jsx(Pt,{id:"feishu-app-id",value:t.feishuAppId,onChange:d=>n({...t,feishuAppId:d.target.value}),placeholder:"cli_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(kt,{htmlFor:"feishu-app-secret",children:["App Secret",e.editingId?" — leave empty to keep existing":""]}),o.jsx(Pt,{id:"feishu-app-secret",type:"password",autoComplete:"new-password",value:t.feishuAppSecret,onChange:d=>n({...t,feishuAppSecret:d.target.value}),placeholder:"••••••••"})]})]}):t.platform==="kael"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs(kt,{htmlFor:"kael-user-id",children:["User ID",e.editingId?" — leave empty to keep existing":""]}),o.jsx(Pt,{id:"kael-user-id",value:t.kaelUserId,onChange:d=>n({...t,kaelUserId:d.target.value}),placeholder:"user_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(kt,{htmlFor:"kael-project-id",children:["Project ID",e.editingId?" — leave empty to keep existing":""]}),o.jsx(Pt,{id:"kael-project-id",value:t.kaelProjectId,onChange:d=>n({...t,kaelProjectId:d.target.value}),placeholder:"proj_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),!e.editingId&&o.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Agent Token will be created automatically when you save."})]}):o.jsxs("div",{className:"space-y-2",children:[o.jsxs(kt,{htmlFor:"binding-creds",children:["Credentials (JSON)",e.editingId?" — leave empty to keep existing":""]}),o.jsx("textarea",{id:"binding-creds",value:t.credentialsJson,onChange:d=>n({...t,credentialsJson:d.target.value}),rows:4,className:"flex w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-2 text-body shadow-sm font-mono focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",placeholder:'{"bot_token": "xoxb-...", "signing_secret": "..."}'})]}),a&&o.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:a}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"binding-status",children:"Status"}),o.jsxs("select",{id:"binding-status",value:t.status,onChange:d=>n({...t,status:d.target.value}),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[o.jsx("option",{value:"active",children:"active"}),o.jsx("option",{value:"inactive",children:"inactive"})]})]})]}),e.errorMessage&&o.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:e.errorMessage}),o.jsxs(cr,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),o.jsx(pe,{type:"submit",disabled:e.pending,children:e.pending?"Saving…":e.editingId?"Update":"Create"})]})]})]})})}function jV(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 CV(){var T;const e=Rn(),t=hn(),[n,a]=oh(),s=n.get("agent"),l=gh(),c=Ke({queryKey:["adapters"],queryFn:bV}),d=Ke({queryKey:["adapter-mappings"],queryFn:pV}),m=Ke({queryKey:["adapter-statuses"],queryFn:vV,refetchInterval:15e3}),g=((T=Ke({queryKey:["agents","name-map"],queryFn:()=>Dc({limit:100}),staleTime:3e4}).data)==null?void 0:T.items)??[],p=x.useMemo(()=>{const Z=new Map;for(const Y of m.data??[])Z.set(Y.configId,Y);return Z},[m.data]),b=x.useMemo(()=>{const Z=c.data??[];return s?Z.filter(Y=>Y.agentId===s):Z},[c.data,s]),w=x.useMemo(()=>{const Z=d.data??[];return s?Z.filter(Y=>Y.agentId===s):Z},[d.data,s]),S=b.reduce((Z,Y)=>{var ue;return Z+((ue=p.get(Y.id))!=null&&ue.connected?1:0)},0),j=b.length-S,E=c.isLoading||d.isLoading,[C,_]=x.useState(null),[z,M]=x.useState(""),[L,O]=x.useState(null),[F,P]=x.useState(null),[V,I]=x.useState(null),[Q,ie]=x.useState(null),be=xt({mutationFn:Z=>xV({platform:Z.platform,agentId:Z.agentId,credentials:Z.credentials,status:Z.status}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),O(null)}}),X=xt({mutationFn:Z=>{const Y={status:Z.status};return Z.credentials&&(Y.credentials=Z.credentials),wV(Z.id,Y)},onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),O(null)}}),W=xt({mutationFn:SV,onSuccess:()=>t.invalidateQueries({queryKey:["adapters"]})}),q=xt({mutationFn:Z=>gV({platform:Z.platform,externalUserId:Z.externalUserId,agentId:Z.agentId,boundVia:"manual",displayName:Z.displayName??void 0}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapter-mappings"]}),P(null)}}),ne=xt({mutationFn:yV,onSuccess:()=>t.invalidateQueries({queryKey:["adapter-mappings"]})});function we(Z){if(s){Z==="bot"?O({agentId:s,editingId:null}):P({agentId:s});return}M(""),_({kind:Z})}function Re(){!C||!z||(C.kind==="bot"?O({agentId:z,editingId:null}):P({agentId:z}),_(null))}function R(Z){if(L){if(Z.kind==="bot-create")be.mutate({agentId:L.agentId,platform:Z.draft.platform,status:Z.draft.status,credentials:Z.draft.credentials});else if(Z.kind==="bot-update"){if(!L.editingId)return;X.mutate({id:L.editingId,status:Z.status,credentials:Z.credentials})}}}function D(Z){!F||Z.kind!=="user-create"||q.mutate({agentId:F.agentId,platform:Z.draft.platform,externalUserId:Z.draft.externalUserId,displayName:Z.draft.displayName})}const U=s?g.find(Z=>Z.uuid===s):null;return o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",padding:"0 var(--sp-0_5) var(--sp-3)"},children:"Manage how external platforms (Feishu, Slack, Kael) reach your agents. Bot bindings hold encrypted credentials; user bindings map an external user to a human agent in this organization."}),s&&o.jsxs("div",{className:"flex items-center gap-2",style:{padding:"0 var(--sp-0_5) var(--sp-3)"},children:[o.jsx("span",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Filtered to"}),o.jsxs("span",{className:"inline-flex items-center gap-1.5 mono text-caption",style:{padding:"var(--sp-0_5) var(--sp-2)",borderRadius:"var(--radius-chip)",background:"var(--bg-active)",border:"var(--hairline) solid var(--border)"},children:[(U==null?void 0:U.displayName)??s,o.jsx("button",{type:"button",onClick:()=>{const Z=new URLSearchParams(n);Z.delete("agent"),a(Z,{replace:!0})},"aria-label":"Clear filter",className:"inline-flex items-center justify-center hover:bg-accent rounded-full",style:{width:14,height:14,border:"none",background:"transparent",cursor:"pointer"},children:o.jsx(ss,{className:"h-3 w-3"})})]})]}),o.jsxs(Cn,{className:"mb-3.5",children:[o.jsxs(Dy,{right:o.jsxs("span",{className:"inline-flex items-center gap-2",children:[o.jsxs("span",{className:"inline-flex items-center gap-3 text-caption",children:[o.jsxs("span",{className:"mono inline-flex items-center gap-1",style:{color:"var(--state-idle)"},children:[o.jsx(Xu,{state:"idle",size:6})," ",S," online"]}),o.jsxs("span",{className:"mono inline-flex items-center gap-1",style:{color:"var(--fg-4)"},children:[o.jsx(Xu,{state:"offline",size:6})," ",j," offline"]})]}),o.jsxs(pe,{size:"xs",variant:"outline",onClick:()=>we("bot"),children:[o.jsx(ba,{className:"h-3 w-3"})," Bot binding"]})]}),children:["Bot bindings · ",b.length]}),E?o.jsx(Cf,{children:"Loading…"}):b.length?o.jsxs(gc,{children:[o.jsx(yc,{children:o.jsxs(na,{children:[o.jsx(Wt,{children:"Agent"}),o.jsx(Wt,{children:"Platform"}),o.jsx(Wt,{children:"Status"}),o.jsx(Wt,{children:"Connection"}),o.jsx(Wt,{children:"Created"}),o.jsx(Wt,{style:{width:96,textAlign:"right"}})]})}),o.jsx(vc,{children:b.map(Z=>{var ue;const Y=((ue=p.get(Z.id))==null?void 0:ue.connected)??!1;return o.jsxs(na,{interactive:!0,onClick:()=>e(`/agents/${Z.agentId}`),children:[o.jsx(ht,{children:o.jsx("span",{className:"mono font-medium",children:l(Z.agentId)})}),o.jsx(ht,{children:o.jsx(ya,{children:Z.platform})}),o.jsx(ht,{children:o.jsx(ya,{tone:Z.status==="active"?"accent":"outline",children:Z.status})}),o.jsx(ht,{children:o.jsxs("span",{className:"inline-flex items-center gap-1.5 text-label",children:[o.jsx(Xu,{state:Y?"idle":"offline",size:7}),o.jsx("span",{style:{color:"var(--fg-3)"},children:Y?"Online":"Offline"})]})}),o.jsx(ht,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:sc(Z.createdAt)}),o.jsxs(ht,{style:{textAlign:"right",whiteSpace:"nowrap"},onClick:Se=>Se.stopPropagation(),children:[o.jsx(pe,{variant:"ghost",size:"xs",className:"text-label",onClick:()=>O({agentId:Z.agentId,editingId:Z.id,initialPlatform:EV(Z.platform),initialStatus:NV(Z.status)}),children:"Edit"}),o.jsx(pe,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>I(Z.id),disabled:W.isPending,title:"Delete",children:o.jsx(Ff,{className:"h-3.5 w-3.5"})})]})]},Z.id)})})]}):o.jsx(Cf,{children:s?"No bot bindings for this agent yet.":"No bot bindings"})]}),o.jsxs(Cn,{children:[o.jsxs(Dy,{right:o.jsxs(pe,{size:"xs",variant:"outline",onClick:()=>we("user"),children:[o.jsx(ba,{className:"h-3 w-3"})," User binding"]}),children:["User bindings · ",w.length]}),E?o.jsx(Cf,{children:"Loading…"}):w.length?o.jsxs(gc,{children:[o.jsx(yc,{children:o.jsxs(na,{children:[o.jsx(Wt,{children:"Agent"}),o.jsx(Wt,{children:"Platform"}),o.jsx(Wt,{children:"External user ID"}),o.jsx(Wt,{children:"Display name"}),o.jsx(Wt,{children:"Bound via"}),o.jsx(Wt,{children:"Created"}),o.jsx(Wt,{style:{width:32}})]})}),o.jsx(vc,{children:w.map(Z=>o.jsxs(na,{interactive:!0,onClick:()=>e(`/agents/${Z.agentId}`),children:[o.jsx(ht,{children:o.jsx("span",{className:"mono font-medium",style:{color:"var(--accent-dim)"},children:l(Z.agentId)})}),o.jsx(ht,{children:o.jsx(ya,{children:Z.platform})}),o.jsx(ht,{children:o.jsx("span",{className:"mono text-label",style:{color:"var(--fg-2)"},children:Z.externalUserId})}),o.jsx(ht,{style:{color:"var(--fg-2)"},children:Z.displayName??"—"}),o.jsx(ht,{children:o.jsx(ya,{tone:"outline",children:Z.boundVia??"—"})}),o.jsx(ht,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:sc(Z.createdAt)}),o.jsx(ht,{onClick:Y=>Y.stopPropagation(),children:o.jsx(pe,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>ie(Z.id),disabled:ne.isPending,title:"Delete",children:o.jsx(Ff,{className:"h-3.5 w-3.5"})})})]},Z.id))})]}):o.jsx(Cf,{children:s?"No user bindings for this agent yet.":"No user bindings"})]}),o.jsx(_V,{open:C!=null,kind:(C==null?void 0:C.kind)??"bot",agents:g,agentId:z,onAgentChange:M,onCancel:()=>_(null),onConfirm:Re}),o.jsx(Bk,{open:L!=null,kind:"bot",editingId:(L==null?void 0:L.editingId)??null,initialPlatform:L==null?void 0:L.initialPlatform,initialStatus:L==null?void 0:L.initialStatus,agentLabel:L?l(L.agentId):"",pending:be.isPending||X.isPending,errorMessage:(be.error??X.error)instanceof Error?(be.error??X.error).message:null,onOpenChange:Z=>{Z||(O(null),be.reset(),X.reset())},onSubmit:R}),o.jsx(Bk,{open:F!=null,kind:"user",editingId:null,agentLabel:F?l(F.agentId):"",pending:q.isPending,errorMessage:q.error instanceof Error?q.error.message:null,onOpenChange:Z=>{Z||(P(null),q.reset())},onSubmit:D}),o.jsx(Fk,{open:V!=null,onOpenChange:Z=>!Z&&I(null),title:"Remove this bot binding?",description:"The bot will stop routing to this agent and any platform credentials stored here will be dropped.",confirmLabel:"Remove binding",pending:W.isPending,onConfirm:()=>{V!=null&&(W.mutate(V),I(null))}}),o.jsx(Fk,{open:Q!=null,onOpenChange:Z=>!Z&&ie(null),title:"Remove this binding?",description:"The external user will stop routing to this agent. You can add the mapping again later.",confirmLabel:"Remove binding",pending:ne.isPending,onConfirm:()=>{Q!=null&&(ne.mutate(Q),ie(null))}})]})}function EV(e){return e==="feishu"||e==="slack"||e==="kael"?e:"feishu"}function NV(e){return e==="inactive"?"inactive":"active"}function Cf({children:e}){return o.jsx("div",{className:"text-center py-6 text-body",style:{color:"var(--fg-3)"},children:e})}function _V(e){const t=e.kind==="user"?e.agents.filter(n=>n.type==="human"&&n.status==="active"):e.agents.filter(n=>n.type!=="human"&&n.status==="active");return o.jsx(Tn,{open:e.open,onOpenChange:n=>!n&&e.onCancel(),children:o.jsxs(jn,{children:[o.jsx(Ln,{children:o.jsx(An,{children:e.kind==="bot"?"Bind a bot":"Bind an external user"})}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Pick the agent this binding routes to."}),o.jsxs("select",{value:e.agentId,onChange:n=>e.onAgentChange(n.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[o.jsx("option",{value:"",children:"Select an agent…"}),t.map(n=>o.jsxs("option",{value:n.uuid,children:[n.displayName," ",n.name?`(@${n.name})`:""]},n.uuid))]})]}),o.jsxs(cr,{children:[o.jsx(pe,{variant:"ghost",onClick:e.onCancel,children:"Cancel"}),o.jsx(pe,{onClick:e.onConfirm,disabled:!e.agentId,children:"Continue"})]})]})})}function Fk(e){return o.jsx(Tn,{open:e.open,onOpenChange:e.onOpenChange,children:o.jsxs(jn,{children:[o.jsx(Ln,{children:o.jsx(An,{children:e.title})}),o.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),o.jsxs(cr,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),o.jsx(pe,{type:"button",variant:"destructive",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function TV({embedded:e=!1}={}){return o.jsxs("div",{className:e?"":"-m-6",children:[o.jsx(rl,{title:"Messaging",subtitle:"Feishu / Slack bridges to your team's agents"}),o.jsx("div",{style:{padding:"var(--sp-4) var(--sp-5) var(--sp-7)"},children:o.jsx(CV,{})})]})}function AV(){return o.jsx(TV,{embedded:!0})}function RV(){const{onboardingStep:e,onboardingDismissedAt:t,dismissOnboarding:n,restoreOnboarding:a}=pt(),s=!!t,l=e==="completed";return o.jsxs(o.Fragment,{children:[o.jsx(rl,{title:"Onboarding",subtitle:"Guided setup controls"}),o.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:o.jsx(Hc,{title:"Onboarding guide",description:s?"The stepper is hidden. Bring it back if you want to walk through Step 3 (build your context-tree).":"The stepper is shown above your workspace. You can hide it any time once your agent is set up.",right:s?null:o.jsx(OV,{}),isFirst:!0,children:s?o.jsx(pe,{type:"button",size:"sm",onClick:()=>void a(),children:"Resume onboarding"}):o.jsx(pe,{type:"button",size:"sm",variant:"outline",onClick:()=>void n(),disabled:!l,title:l?void 0:"Finish setting up your agent first",children:"Hide onboarding guide"})})})]})}function OV(){return o.jsxs("span",{className:"text-label inline-flex items-center",style:{gap:"var(--sp-1)",color:"color-mix(in oklch, var(--accent) 35%, var(--fg))"},children:[o.jsx(ur,{className:"h-3 w-3"}),"Active"]})}function zV(){const{role:e}=pt(),t=e==="admin";return o.jsxs("div",{className:"-m-6 flex",style:{minHeight:"calc(100vh - var(--sp-10))"},children:[o.jsxs("aside",{className:"shrink-0 overflow-auto",style:{width:200,padding:"var(--sp-4) var(--sp-2)"},children:[o.jsx(Fu,{to:"/settings/team",label:"Team"}),o.jsx(Fu,{to:"/settings/computers",label:"Computers"}),t&&o.jsx(Fu,{to:"/settings/github",label:"GitHub"}),o.jsx(Fu,{to:"/settings/integrations",label:"Messaging"}),o.jsx(Fu,{to:"/settings/onboarding",label:"Onboarding"})]}),o.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:o.jsx(Bf,{})})]})}function Fu({to:e,label:t}){return o.jsx(mv,{to:e,className:({isActive:n})=>Oe("block w-full text-left bg-transparent text-body transition-colors","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",!n&&"hover:bg-accent"),style:{borderRadius:"var(--radius-input)"},children:({isActive:n})=>o.jsx("span",{className:"flex items-center",style:{padding:"var(--sp-1_25) var(--sp-2_5)",background:n?"var(--bg-active)":"transparent",color:n?"var(--fg)":"var(--fg-3)",fontWeight:n?500:400,borderRadius:"var(--radius-input)"},children:o.jsx("span",{className:"flex-1 truncate",children:t})})})}function Qy(e){return e.normalize("NFKD").replace(new RegExp("\\p{M}+","gu"),"").toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+|[-_]+$/g,"").slice(0,Wl)}const Ig=200;function MV(e){if(!e||e.length===0)return{};const t={},n=["name","displayName","clientId"];for(const a of e){const s=a.path[0];if(typeof s=="string"&&n.includes(s)){const l=s;t[l]||(t[l]=a.message)}else t._root=a.message}return t}function DV(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+/,"").slice(0,Wl)}function IV(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 LV({open:e,onOpenChange:t,onCreated:n}){const a=hn(),{refreshMe:s,organizationId:l}=pt(),[c,d]=x.useState(""),[m,h]=x.useState(""),[g,p]=x.useState(!1),[b,w]=x.useState("claude-code"),[S,j]=x.useState("form"),[E,C]=x.useState([]),[_,z]=x.useState(null),[M,L]=x.useState(!1),[O,F]=x.useState({}),[P,V]=x.useState({status:"idle"});x.useEffect(()=>{e&&(d(""),h(""),p(!1),w("claude-code"),j("form"),C([]),z(null),L(!1),F({}),V({status:"idle"}))},[e]),x.useEffect(()=>{g||h(Qy(c))},[c,g]);const I=x.useRef(0);x.useEffect(()=>{if(!e||!m){V({status:"idle"});return}if(!Oy.test(m)){V({status:"bad",reason:"invalid"});return}if(zy(m)){V({status:"bad",reason:"reserved"});return}const R=++I.current;V({status:"checking"});const D=window.setTimeout(()=>{UI(m).then(U=>{R===I.current&&(U.available?V({status:"ok"}):V({status:"bad",reason:U.reason}))}).catch(()=>{R===I.current&&V({status:"idle"})})},300);return()=>window.clearTimeout(D)},[m,e]);const Q=xt({mutationFn:async R=>{const D=c.trim()||m.trim()||"Untitled assistant";return PI({name:m||void 0,type:"personal_assistant",displayName:D,clientId:R.clientId,runtimeProvider:b,...l?{organizationId:l}:{}})},onSuccess:R=>{a.invalidateQueries({queryKey:["agents"]}),a.invalidateQueries({queryKey:["activity"]}),s(),n(R,b)}}),ie=x.useMemo(()=>{const R=Q.error;if(!R)return{};if(R instanceof Oc){const D=MV(R.issues);return Object.keys(D).length>0?D:R.status===409?{name:"That agent name is already in use in this organization. Pick a different one."}:{_root:R.message}}return R instanceof Error?{_root:R.message}:{}},[Q.error]),be=P.status==="bad"?IV(P.reason):void 0,X={...be?{name:be}:{},...ie,...O};function W(){const R={};return m?m.length>Wl?R.name=`Agent name must be at most ${Wl} characters (got ${m.length}).`:Oy.test(m)?zy(m)&&(R.name="That agent name is reserved — pick a different one."):R.name="Agent name must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_).":c.trim().length>0&&(R.name="Agent name must contain at least one letter or digit (e.g. a-z, 0-9)."),c.length>Ig&&(R.displayName=`Display name must be at most ${Ig} characters (got ${c.length}).`),R}async function q(R){var U,T;R.preventDefault();const D=W();if(F(D),!(Object.keys(D).length>0)&&P.status!=="bad"){L(!0);try{const Y=(await ls()).filter(Se=>Se.status==="connected");if(Y.length===0){Q.mutate({clientId:void 0});return}if(Y.length===1){Q.mutate({clientId:(U=Y[0])==null?void 0:U.id});return}const ue=[...Y].sort((Se,ve)=>ve.lastSeenAt.localeCompare(Se.lastSeenAt));C(ue),z(((T=ue[0])==null?void 0:T.id)??null),j("pick-computer")}catch{Q.mutate({clientId:void 0})}finally{L(!1)}}}function ne(){_&&Q.mutate({clientId:_})}const we=P.status==="bad",Re=c.trim().length>0&&!we&&!Q.isPending&&!M;return S==="pick-computer"?o.jsx(Tn,{open:e,onOpenChange:t,children:o.jsxs(jn,{className:"max-w-lg",children:[o.jsx(Ln,{children:o.jsx(An,{children:"Choose a computer"})}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("p",{className:"text-body text-muted-foreground",children:["Multiple computers are online. Pick where ",o.jsx("span",{className:"font-medium",children:c||m})," ","should run:"]}),o.jsx("div",{className:"space-y-2",children:E.map(R=>{const D=_===R.id;return o.jsxs("label",{className:D?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[o.jsx("input",{type:"radio",name:"target-computer",checked:D,onChange:()=>z(R.id),className:"mt-1"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-body font-medium truncate",children:R.hostname??R.id}),o.jsxs("div",{className:"text-caption text-muted-foreground",children:[R.os??"unknown OS"," · last seen ",new Date(R.lastSeenAt).toLocaleString()]})]})]},R.id)})}),X.clientId&&o.jsx("p",{className:"text-body text-destructive",children:X.clientId}),X._root&&o.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:X._root})]}),o.jsxs(cr,{children:[o.jsx(pe,{variant:"outline",onClick:()=>j("form"),disabled:Q.isPending,children:"Back"}),o.jsx(pe,{onClick:ne,disabled:!_||Q.isPending,children:Q.isPending?"Creating…":"Create"})]})]})}):o.jsx(Tn,{open:e,onOpenChange:t,children:o.jsxs(jn,{className:"max-w-lg",children:[o.jsx(Ln,{children:o.jsx(An,{children:"New Agent"})}),o.jsxs("form",{onSubmit:q,className:"space-y-5",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"new-agent-display-name",children:"Display name"}),o.jsx(Pt,{id:"new-agent-display-name",value:c,onChange:R=>{d(R.target.value),O.displayName&&F(D=>({...D,displayName:void 0}))},placeholder:"My Dev Assistant",autoFocus:!0,maxLength:Ig,"aria-invalid":X.displayName?!0:void 0,"aria-describedby":"new-agent-display-name-help new-agent-display-name-error"}),o.jsx("p",{id:"new-agent-display-name-help",className:"text-caption text-muted-foreground",children:"How teammates see this agent in chats and lists. Can be changed anytime."}),X.displayName&&o.jsx("p",{id:"new-agent-display-name-error",className:"text-caption text-destructive",children:X.displayName})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"new-agent-name",children:"Agent name"}),o.jsxs("div",{className:"flex items-stretch",children:[o.jsx("span",{"aria-hidden":!0,className:"inline-flex items-center px-2 font-mono text-body text-muted-foreground border border-r-0 border-input rounded-l-[var(--radius-input)] bg-muted/40",children:"@"}),o.jsx(Pt,{id:"new-agent-name",value:m,onChange:R=>{const D=DV(R.target.value);h(D),p(!0),O.name&&F(U=>({...U,name:void 0}))},onBlur:R=>{const D=Qy(R.target.value);D!==m&&h(D)},placeholder:"my-dev-assistant",className:"rounded-l-none font-mono",maxLength:Wl,"aria-invalid":X.name?!0:void 0,"aria-describedby":"new-agent-name-help new-agent-name-error new-agent-name-status"})]}),o.jsxs("p",{id:"new-agent-name-help",className:"text-caption text-muted-foreground",children:["Used in @mentions and CLI commands. Lowercase letters, digits, hyphens (-), and underscores (_). Up to"," ",Wl," characters. Permanent after creation."]}),m&&!X.name&&P.status!=="idle"&&o.jsxs("p",{id:"new-agent-name-status",className:"text-caption",style:{color:P.status==="ok"?"var(--state-idle)":P.status==="checking"?"var(--fg-3)":"var(--fg-4)"},children:[P.status==="checking"&&"Checking availability…",P.status==="ok"&&"Available."]}),X.name&&o.jsx("p",{id:"new-agent-name-error",className:"text-caption text-destructive",children:X.name})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{children:"Where it runs"}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("label",{className:b==="claude-code"?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[o.jsx("input",{type:"radio",name:"runtime",checked:b==="claude-code",onChange:()=>w("claude-code"),className:"mt-1"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-body font-medium",children:"Claude Code"}),o.jsx("div",{className:"text-caption text-muted-foreground",children:"Anthropic's Claude Code on the bound computer. (default)"})]})]}),o.jsxs("label",{className:b==="codex"?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[o.jsx("input",{type:"radio",name:"runtime",checked:b==="codex",onChange:()=>w("codex"),className:"mt-1"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-body font-medium",children:"Codex"}),o.jsxs("div",{className:"text-caption text-muted-foreground",children:["OpenAI Codex CLI on the bound computer. Run ",o.jsx("code",{children:"codex login"})," on the host once."]})]})]})]})]}),X._root&&o.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:X._root}),o.jsx(cr,{children:o.jsx(pe,{type:"submit",disabled:!Re,children:M?"Checking computers…":Q.isPending?"Creating…":"Create"})})]})]})})}function sT({active:e,count:t,warn:n,className:a,children:s,style:l,...c}){return o.jsxs("button",{type:"button",className:Oe("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",...l},...c,children:[s,t!==void 0&&o.jsx("span",{className:"mono",style:{color:n&&typeof t=="number"&&t>0?"var(--state-error)":"var(--fg-4)"},children:t})]})}function PV(e){const t=new Date(e),n=Date.now(),a=t.getTime()-n;if(a<=0)return`expired ${t.toLocaleDateString()}`;const s=Math.ceil(a/(1440*60*1e3));return`expires ${s===1?"in less than a day":`in ${s} days`} · ${t.toLocaleDateString()}`}function UV(){const{organizationId:e}=pt(),[t,n]=x.useState(null),[a,s]=x.useState(null),[l,c]=x.useState(!1),[d,m]=x.useState(!1);x.useEffect(()=>{e&&(async()=>{try{const g=await Ce.get(gy(e,"/invitations"));n(g)}catch(g){s(g instanceof Error?g.message:"Failed to load invite link")}})()},[e]);const h=async()=>{if(e){c(!0),s(null);try{const g=await Ce.post(gy(e,"/invitations/rotate"));n(g)}catch(g){s(g instanceof Error?g.message:"Failed to rotate invite link")}finally{c(!1)}}};return o.jsxs(Ro,{children:[o.jsxs(Oo,{children:[o.jsx($c,{children:"Invite link"}),o.jsxs(nT,{children:["Anyone with this link can join your team as a member. Links expire after ",Y6," days; rotating revokes the old link instantly and resets the timer."]})]}),o.jsxs(zo,{className:"space-y-3",children:[a&&o.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:a}),t?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{readOnly:!0,className:"flex-1 rounded-md border bg-muted px-2 py-1 text-label font-mono",value:t.inviteUrl}),o.jsx(pe,{size:"sm",variant:"outline",onClick:()=>{navigator.clipboard.writeText(t.inviteUrl),m(!0),setTimeout(()=>m(!1),1500)},children:d?"Copied!":"Copy"}),o.jsx(pe,{size:"sm",onClick:h,disabled:l,children:l?"Rotating…":"Rotate"})]}),o.jsxs("p",{className:"text-label text-muted-foreground",children:["Created ",new Date(t.createdAt).toLocaleString(),t.expiresAt?` · ${PV(t.expiresAt)}`:" · no expiry"]})]}):o.jsx("p",{className:"text-label text-muted-foreground",children:"Loading…"})]})]})}const xb=[{key:"name",label:"Name",width:260},{key:"manager",label:"Manager",width:140},{key:"runtime",label:"Runtime · Status",width:170},{key:"created",label:"Created",width:120},{key:"actions",label:"",width:44}];function BV({groups:e,runtimeMap:t,onAgentClick:n,getHumanActions:a,getAgentActions:s}){return o.jsxs(gc,{className:"table-fixed",children:[o.jsx(yc,{children:o.jsx(na,{children:xb.map(l=>o.jsx(Wt,{style:{width:l.width},"aria-hidden":l.key==="actions",children:l.label},l.key))})}),e.map(l=>o.jsx(FV,{group:l,runtimeMap:t,onAgentClick:n,getHumanActions:a,getAgentActions:s},l.key))]})}function FV({group:e,runtimeMap:t,onAgentClick:n,getHumanActions:a,getAgentActions:s}){const[l,c]=x.useState(!e.collapsible);return o.jsxs(vc,{children:[o.jsx($V,{group:e,open:l,onToggle:()=>c(d=>!d)}),l&&e.rows.length===0&&e.emptyMessage&&o.jsx(na,{children:o.jsx(ht,{colSpan:xb.length,style:{color:"var(--fg-4)",textAlign:"center",padding:"var(--sp-4)"},children:e.emptyMessage})}),l&&e.rows.map(d=>d.kind==="human"?o.jsx(HV,{row:d,actions:a(d)},`h:${d.id}`):o.jsx(qV,{row:d,runtime:t.get(d.agent.uuid)??null,actions:s(d),onClick:()=>n(d.agent.uuid)},`a:${d.agent.uuid}`))]})}function $V({group:e,open:t,onToggle:n}){return o.jsx(na,{children:o.jsx("td",{colSpan:xb.length,style:{padding:"var(--sp-3) var(--sp-3_5) var(--sp-1_5)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:e.collapsible?o.jsxs("button",{type:"button",onClick:n,"aria-expanded":t,className:"inline-flex items-baseline gap-2 text-eyebrow uppercase",style:{color:"var(--fg-3)",background:"transparent",border:0,padding:0,cursor:"pointer"},children:[o.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:10},children:t?"▾":"▸"}),o.jsx("span",{children:e.title}),o.jsxs("span",{style:{color:"var(--fg-4)"},children:["(",e.count,")"]})]}):o.jsxs("div",{className:"inline-flex items-baseline gap-2 text-eyebrow uppercase",style:{color:"var(--fg-3)"},children:[o.jsx("span",{children:e.title}),o.jsxs("span",{style:{color:"var(--fg-4)"},children:["(",e.count,")"]})]})})})}function HV({row:e,actions:t}){return o.jsxs(na,{children:[o.jsx(ht,{children:o.jsx(lT,{icon:o.jsx(bM,{className:"h-3.5 w-3.5","aria-hidden":!0,style:{color:"var(--fg-3)"}}),displayName:e.displayName,handle:`@${e.username}`,selfTag:e.isSelf})}),o.jsx(ht,{className:"text-label",style:{color:"var(--fg-4)"},children:"—"}),o.jsx(ht,{className:"text-label",style:{color:"var(--fg-4)"},children:"—"}),o.jsx(ht,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:OC(e.createdAt)}),o.jsx(ht,{style:{padding:0,textAlign:"right"},children:o.jsx(oT,{actions:t,ariaLabel:`Actions for ${e.displayName}`})})]})}function qV({row:e,runtime:t,actions:n,onClick:a}){const{agent:s,managerLabel:l,isOwnedBySelf:c}=e,m=s.visibility==="private"?o.jsx(xv,{className:"h-3.5 w-3.5","aria-hidden":!0,style:{color:"var(--fg-3)"}}):o.jsx(cC,{className:"h-3.5 w-3.5","aria-hidden":!0,style:{color:"var(--fg-3)"}});return o.jsxs(na,{interactive:!0,onClick:a,children:[o.jsx(ht,{children:o.jsx(lT,{icon:m,displayName:s.displayName,handle:s.name?`@${s.name}`:null})}),o.jsxs(ht,{className:"text-label",style:{color:"var(--fg-2)"},children:[l??"—",c&&o.jsx("span",{className:"text-label italic",style:{marginLeft:6,color:"var(--fg-3)"},children:"(you)"})]}),o.jsx(ht,{children:o.jsx(ZV,{runtimeState:(t==null?void 0:t.runtimeState)??null,runtimeProvider:s.runtimeProvider})}),o.jsx(ht,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:OC(s.createdAt)}),o.jsx(ht,{style:{padding:0,textAlign:"right"},onClick:h=>h.stopPropagation(),children:o.jsx(oT,{actions:n,ariaLabel:`Actions for ${s.displayName}`})})]})}function lT({icon:e,displayName:t,handle:n,selfTag:a}){return o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("span",{style:{marginTop:2},children:e}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"font-medium text-body truncate",style:{color:"var(--fg)"},title:t,children:[t,a&&o.jsx("span",{className:"text-label italic",style:{marginLeft:6,color:"var(--fg-3)"},children:"(you)"})]}),n&&o.jsx("div",{className:"mono text-caption truncate",style:{color:"var(--fg-4)"},title:n,children:n})]})]})}function ZV({runtimeState:e,runtimeProvider:t}){return o.jsxs("div",{className:"flex flex-col",style:{gap:2},children:[o.jsx(hc,{state:e}),o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:t})]})}function oT({actions:e,ariaLabel:t}){const[n,a]=x.useState(!1),[s,l]=x.useState("down"),c=x.useRef(null),d=x.useRef(null);return x.useEffect(()=>{if(!n)return;const m=g=>{c.current&&!c.current.contains(g.target)&&a(!1)},h=g=>{g.key==="Escape"&&a(!1)};return window.addEventListener("mousedown",m),window.addEventListener("keydown",h),()=>{window.removeEventListener("mousedown",m),window.removeEventListener("keydown",h)}},[n]),x.useEffect(()=>{if(!n||!d.current)return;const m=32,h=8,g=d.current.getBoundingClientRect(),p=window.innerHeight-g.bottom,b=e.length*m+h;l(p>=b?"down":"up")},[n,e.length]),e.length===0?null:o.jsxs("div",{ref:c,className:"relative inline-flex",children:[o.jsx("button",{ref:d,type:"button","aria-label":t,"aria-haspopup":"menu","aria-expanded":n,onClick:m=>{m.stopPropagation(),a(h=>!h)},className:"inline-flex items-center justify-center",style:{width:28,height:28,borderRadius:4,background:"transparent",color:"var(--fg-3)",cursor:"pointer",border:0},children:o.jsx(Bz,{className:"h-3.5 w-3.5"})}),n&&o.jsx("div",{role:"menu",className:"absolute right-0 z-30 rounded-md border bg-popover shadow-md",style:{minWidth:180,borderColor:"var(--border)",...s==="up"?{bottom:"100%",marginBottom:4}:{top:"100%",marginTop:4}},children:e.map(m=>o.jsx("button",{type:"button",role:"menuitem",disabled:m.disabled,onClick:h=>{h.stopPropagation(),a(!1),m.onSelect()},className:"flex w-full items-center px-3 py-1.5 text-left text-body hover:bg-accent transition-colors disabled:opacity-50 disabled:cursor-not-allowed",style:{color:m.destructive?"var(--state-error)":"var(--fg)",background:"transparent",border:0,cursor:m.disabled?"not-allowed":"pointer"},children:m.label},m.key))})]})}function GV(){var R;const{role:e,memberId:t}=pt(),n=e==="admin",a=Rn(),s=hn(),l=UN(),[c,d]=x.useState(!1),[m,h]=x.useState(!1),[g,p]=x.useState(null),[b,w]=x.useState("all"),[S,j]=x.useState(""),E=Ke({queryKey:["members"],queryFn:PN}),C=Ke({queryKey:["agents","team-page",n?"admin":"member"],queryFn:()=>n?II({limit:100}):Dc({limit:100})}),{data:_}=Ke({queryKey:["activity"],queryFn:zc,refetchInterval:1e4}),z=x.useMemo(()=>{const D=new Map;for(const U of(_==null?void 0:_.agents)??[])D.set(U.agentId,U);return D},[_==null?void 0:_.agents]),M=x.useMemo(()=>E.data??[],[E.data]),L=x.useMemo(()=>{var D;return(((D=C.data)==null?void 0:D.items)??[]).filter(U=>U.type!=="human")},[(R=C.data)==null?void 0:R.items]),O=x.useMemo(()=>M.filter(D=>D.role==="admin").length,[M]),F=x.useMemo(()=>L.filter(D=>D.visibility==="organization"),[L]),P=x.useMemo(()=>L.filter(D=>D.visibility==="private"&&D.managerId===t),[L,t]),V=x.useMemo(()=>L.filter(D=>D.visibility==="private"&&D.managerId!==t),[L,t]),I=[`${M.length} ${Lg(M.length,"human")} (${O} ${Lg(O,"admin")})`,`${F.length} shared ${Lg(F.length,"agent")}`,`${P.length} of your private`].join(" · "),Q=xt({mutationFn:async D=>o9(D.id,D.patch),onSuccess:()=>s.invalidateQueries({queryKey:["members"]})}),ie=xt({mutationFn:u9,onSuccess:()=>{s.invalidateQueries({queryKey:["members"]}),s.invalidateQueries({queryKey:["agents"]})}}),be=xt({mutationFn:AE,onSuccess:()=>{s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}}),X=xt({mutationFn:RE,onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),W=xt({mutationFn:OE,onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),q=S.trim().toLowerCase(),ne=x.useMemo(()=>KV({filter:b,search:q,isAdmin:n,selfMemberId:t,members:M,sharedAgents:F,yourPrivateAgents:P,otherPrivateAgents:V,resolveMember:l}),[b,q,n,t,M,F,P,V,l]);function we(D){const U=[];return n&&U.push({key:"edit",label:"Edit profile",onSelect:()=>p({id:D.id,username:D.username,displayName:D.displayName,role:D.role})}),n&&!D.isSelf&&U.push({key:"remove",label:"Remove from org",destructive:!0,onSelect:()=>{window.confirm(`Remove ${D.displayName} from the org? The human agent will be deactivated.`)&&ie.mutate(D.id)}}),U}function Re(D){const{agent:U,isOwnedBySelf:T}=D,Z=n||T,Y=[{key:"open",label:"Open",onSelect:()=>a(`/agents/${encodeURIComponent(U.uuid)}`)}];return Z&&(U.status==="suspended"?Y.push({key:"reactivate",label:"Reactivate",onSelect:()=>W.mutate(U.uuid)}):Y.push({key:"suspend",label:"Suspend",onSelect:()=>X.mutate(U.uuid)}),Y.push({key:"delete",label:"Delete",destructive:!0,onSelect:()=>{window.confirm(`Delete agent ${U.displayName}? This cannot be undone.`)&&be.mutate(U.uuid)}})),Y}return o.jsxs(o.Fragment,{children:[o.jsx(rl,{title:"Team",subtitle:I,right:o.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)"},children:[o.jsxs(pe,{size:"xs",onClick:()=>h(!0),children:[o.jsx(ba,{className:"h-3 w-3"}),"New agent"]}),n&&o.jsxs(pe,{size:"xs",variant:"ghost",onClick:()=>d(!0),children:[o.jsx(pC,{className:"h-3 w-3"}),"Invite link"]})]})}),o.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[o.jsx(QV,{filter:b,onFilter:w,query:S,onQuery:j,counts:{humans:M.length,shared:F.length,private:P.length,admins:O}}),C.isLoading||E.isLoading?o.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):C.error||E.error?o.jsxs("div",{className:"text-center py-8 text-body",style:{color:"var(--state-error)"},children:["Failed to load: ",VV(C.error??E.error)]}):o.jsx(BV,{groups:ne,runtimeMap:z,onAgentClick:D=>a(`/agents/${encodeURIComponent(D)}`),getHumanActions:we,getAgentActions:Re})]}),o.jsx(Tn,{open:c,onOpenChange:d,children:o.jsxs(jn,{children:[o.jsx(Ln,{children:o.jsx(An,{children:"Invite link"})}),o.jsx(UV,{})]})}),o.jsx(LV,{open:m,onOpenChange:h,onCreated:(D,U)=>{h(!1),s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}}),o.jsx(XV,{target:g,isAdmin:n,isSaving:Q.isPending,onClose:()=>p(null),onSave:async D=>{g&&(await Q.mutateAsync({id:g.id,patch:D}),p(null))}})]})}function Lg(e,t){return e===1?t:`${t}s`}function VV(e){return e instanceof Error?e.message:String(e)}function QV({filter:e,onFilter:t,query:n,onQuery:a,counts:s}){const l=[{key:"all",label:"All"},{key:"humans",label:"Humans",count:s.humans},{key:"shared",label:"Shared agents",count:s.shared},{key:"private",label:"Your private",count:s.private},{key:"admins",label:"Admins",count:s.admins}];return o.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[o.jsx("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-1)"},children:l.map(c=>o.jsx(sT,{active:e===c.key,count:c.count,onClick:()=>t(c.key),children:c.label},c.key))}),o.jsxs("div",{className:"flex-1 relative",style:{minWidth:180,maxWidth:320},children:[o.jsx(dh,{"aria-hidden":!0,className:"h-3.5 w-3.5",style:{position:"absolute",left:"var(--sp-2)",top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)"}}),o.jsx(Pt,{value:n,onChange:c=>a(c.target.value),placeholder:"Search name or @handle",style:{paddingLeft:"var(--sp-7)"},"aria-label":"Search team"})]})]})}function KV(e){const{filter:t,search:n,isAdmin:a,selfMemberId:s,members:l,sharedAgents:c,yourPrivateAgents:d,otherPrivateAgents:m}=e,h=O=>!n||O.displayName.toLowerCase().includes(n)||O.username.toLowerCase().includes(n),g=O=>!n||O.displayName.toLowerCase().includes(n)||(O.name??"").toLowerCase().includes(n),p=t==="admins",b=t==="all"||t==="humans"||t==="admins",w=t==="all"||t==="shared",S=t==="all"||t==="private",j=a&&t==="all",E=l.filter(h).filter(O=>!p||O.role==="admin").map(O=>({kind:"human",id:O.id,username:O.username,displayName:O.displayName,role:O.role,createdAt:O.createdAt,isSelf:s===O.id})),C=O=>({kind:"agent",agent:O,managerLabel:O.managerId?e.resolveMember(O.managerId):null,isOwnedBySelf:O.managerId===s}),_=c.filter(g).map(C),z=d.filter(g).map(C),M=m.filter(g).map(C),L=[];return b&&L.push({key:p?"admins":"humans",title:p?"Admins":"Humans",count:E.length,rows:E,emptyMessage:n?"No humans match this search.":void 0}),w&&L.push({key:"shared",title:"Shared agents",count:_.length,rows:_,emptyMessage:n?"No shared agents match this search.":"No shared agents yet."}),S&&L.push({key:"private",title:"Your private agents",count:z.length,rows:z,emptyMessage:n?"No private agents match this search.":"No private agents — pick Private in the create dialog to keep one to yourself."}),j&&M.length>0&&L.push({key:"other-private",title:"Other members' private agents",count:M.length,rows:M,collapsible:!0}),L}const YV=Object.values(nB);function XV({target:e,isAdmin:t,isSaving:n,onClose:a,onSave:s}){const[l,c]=x.useState(""),[d,m]=x.useState("member"),[h,g]=x.useState(null);x.useEffect(()=>{e&&(c(e.displayName),m(e.role),g(null))},[e]);async function p(w){if(w.preventDefault(),!e)return;const S={};if(l.trim()&&l!==e.displayName&&(S.displayName=l.trim()),t&&d!==e.role&&(S.role=d),Object.keys(S).length===0){a();return}try{await s(S)}catch(j){g(j instanceof Error?j.message:String(j))}}const b=e!==null;return o.jsx(Tn,{open:b,onOpenChange:w=>w?void 0:a(),children:o.jsxs(jn,{children:[o.jsx(Ln,{children:o.jsx(An,{children:"Edit profile"})}),e&&o.jsxs("form",{onSubmit:p,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{children:"Username"}),o.jsx(Pt,{value:e.username,disabled:!0,className:"font-mono"}),o.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Username is permanent after creation."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"edit-member-display",children:"Display name"}),o.jsx(Pt,{id:"edit-member-display",value:l,onChange:w=>c(w.target.value),required:!0,maxLength:200})]}),t&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(kt,{htmlFor:"edit-member-role",children:"Role"}),o.jsx("select",{id:"edit-member-role",value:d,onChange:w=>m(w.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:YV.map(w=>o.jsx("option",{value:w,children:w},w))}),o.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Demoting the last admin is blocked — every org needs at least one admin to manage members."})]}),h&&o.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:h}),o.jsxs(cr,{children:[o.jsx(pe,{type:"button",variant:"ghost",onClick:a,disabled:n,children:"Cancel"}),o.jsx(pe,{type:"submit",disabled:n,children:n?"Saving…":"Save"})]})]})]})})}function WV({isFirst:e=!1}){const{organizationId:t}=pt(),n=hn(),a=Ke({queryKey:["org-setting",t,"context_tree"],queryFn:()=>t?vb(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,l]=x.useState(""),[c,d]=x.useState(""),[m,h]=x.useState(!1);x.useEffect(()=>{a.data&&(l(a.data.repo??""),d(a.data.branch??"main"))},[a.data]);const g=xt({mutationFn:()=>{if(!t)throw new Error("organization not loaded");return rT(t,{repo:s.trim()?s.trim():null,branch:c.trim()?c.trim():null})},onSuccess:b=>{n.setQueryData(["org-setting",t,"context_tree"],b),h(!0),setTimeout(()=>h(!1),2e3)}}),p=b=>{b.preventDefault(),g.mutate()};return o.jsx(Hc,{title:"Context tree",description:"Changes apply to new agent sessions. Members should restart agents to pick up updated tree contents.",isFirst:e,children:a.isLoading?o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):a.error?o.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:a.error instanceof Error?a.error.message:"Failed to load setting"}):o.jsxs("form",{onSubmit:p,children:[o.jsx(bc,{label:"Repo URL",hint:"HTTPS URL of the Context Tree git repository for this team.",value:s,onChange:l,mono:!0,placeholder:"https://github.com/your-org/first-tree-context"}),o.jsx(bc,{label:"Branch",hint:"Branch checked out by client agents on startup.",value:c,onChange:d,mono:!0,placeholder:"main",saved:m,rightSlot:o.jsx(bb,{pending:g.isPending,disabled:!a.data})}),g.error instanceof Error&&o.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:g.error.message})]})})}function JV({isFirst:e=!1}){var h;const{organizationId:t,role:n}=pt(),a=n==="admin",s=hn(),l=Ke({queryKey:["org-setting",t,"source_repos"],queryFn:()=>t?aT(t):Promise.reject(new Error("no org")),enabled:!!t}),c=xt({mutationFn:async g=>{var w;if(!t)throw new Error("organization not loaded");const b=(((w=l.data)==null?void 0:w.repos)??[]).filter(S=>S.url!==g);return iT(t,{repos:b})},onSuccess:g=>{s.setQueryData(["org-setting",t,"source_repos"],g)}}),d=((h=l.data)==null?void 0:h.repos)??[],m=d.length>0?o.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:d.length}):null;return o.jsxs(Hc,{title:"Source repos",description:a?"Repos your team's agents are bound to. New repos are added during agent onboarding.":"Repos your team's agents are bound to. Read-only — only admins can edit.",right:m,isFirst:e,children:[l.isLoading?o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):l.error?o.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:l.error instanceof Error?l.error.message:"Failed to load setting"}):d.length===0?o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)",padding:"var(--sp-3) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)"},children:"No source repos bound yet."}):o.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:d.map(g=>o.jsx(eQ,{url:g.url,defaultBranch:g.defaultBranch,isAdmin:a,isRemoving:c.isPending,onRemove:()=>c.mutate(g.url)},g.url))}),c.error instanceof Error&&o.jsx("div",{className:"text-body",style:{color:"var(--state-error)",marginTop:"var(--sp-2)"},children:c.error.message})]})}function eQ({url:e,defaultBranch:t,isAdmin:n,isRemoving:a,onRemove:s}){return o.jsxs("li",{className:"group flex items-center",style:{gap:"var(--sp-3)",padding:"var(--sp-2) var(--sp-2_5)",borderRadius:"var(--radius-input)"},children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-body mono",style:{color:"var(--fg)",overflowWrap:"anywhere"},children:e}),t&&o.jsxs("div",{className:"text-label",style:{color:"var(--fg-4)",marginTop:"var(--sp-0_5)"},children:["branch: ",t]})]}),n&&o.jsx("button",{type:"button","aria-label":`Remove ${e}`,disabled:a,onClick:s,className:"opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,border:0,borderRadius:"var(--radius-input)",background:"transparent",color:"var(--fg-3)",cursor:a?"not-allowed":"pointer",flexShrink:0},onMouseEnter:l=>{l.currentTarget.style.background="var(--surface-2)",l.currentTarget.style.color="var(--fg)"},onMouseLeave:l=>{l.currentTarget.style.background="transparent",l.currentTarget.style.color="var(--fg-3)"},children:o.jsx(ss,{className:"h-3.5 w-3.5"})})]})}function tQ(e){return Ce.get(`/orgs/${encodeURIComponent(e)}`)}function nQ(e,t){return Ce.patch(`/orgs/${encodeURIComponent(e)}`,t)}function rQ({isFirst:e=!1}){const{organizationId:t}=pt(),n=hn(),a=Ke({queryKey:["organization",t],queryFn:()=>t?tQ(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,l]=x.useState(""),[c,d]=x.useState(!1);x.useEffect(()=>{a.data&&l(a.data.displayName)},[a.data]);const m=xt({mutationFn:()=>{if(!t||!a.data)throw new Error("organization not loaded");const g=s.trim();return!g||g===a.data.displayName?Promise.resolve(a.data):nQ(t,{displayName:g})},onSuccess:g=>{n.setQueryData(["organization",t],g),n.invalidateQueries({queryKey:["me-organizations"]}),d(!0),setTimeout(()=>d(!1),2e3)}}),h=g=>{g.preventDefault(),m.mutate()};return o.jsx(Hc,{title:"Identity",isFirst:e,children:a.isLoading?o.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):a.error?o.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:a.error instanceof Error?a.error.message:"Failed to load team"}):o.jsxs("form",{onSubmit:h,children:[o.jsx(bc,{label:"Team name",hint:"Shown in the team switcher and dashboard header.",value:s,onChange:l,saved:c,rightSlot:o.jsx(bb,{pending:m.isPending,disabled:!a.data})}),m.error instanceof Error&&o.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:m.error.message})]})})}function aQ(){const{role:e}=pt(),t=e==="admin";return o.jsxs("div",{children:[t&&o.jsx(rQ,{isFirst:!0}),t&&o.jsx(WV,{}),o.jsx(JV,{isFirst:!t})]})}function iQ(){const{role:e}=pt();if(e===null)return o.jsx("div",{className:"text-body",style:{padding:"var(--sp-5)",color:"var(--fg-3)"},children:"Loading..."});const t=e==="admin"?"Identity, Context Tree, source repos":"Repos your team's agents are bound to";return o.jsxs(o.Fragment,{children:[o.jsx(rl,{title:"Team settings",subtitle:t}),o.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:o.jsx(aQ,{})})]})}function nh(e){const t=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.filter&&t.set("filter",e.filter);const n=t.toString();return Ce.get(On(`/chats${n?`?${n}`:""}`))}function sQ(e){return Ce.post(On("/chats"),e)}function lQ(e){return Ce.post(`/chats/${encodeURIComponent(e)}/read`)}function uT(e,t){return Ce.post(`/chats/${encodeURIComponent(e)}/participants`,t)}function oQ(e){return Ce.post(`/chats/${encodeURIComponent(e)}/workspace-join`)}const rh="draft";function uQ(e){if(!e)return"";const t=new Date(e),a=Date.now()-t.getTime();if(a<6e4)return"now";if(a<60*6e4)return`${Math.round(a/6e4)}m`;if(a<1440*6e4)return`${Math.round(a/36e5)}h`;const s=new Intl.DateTimeFormat("en-GB",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(t),l=c=>{var d;return((d=s.find(m=>m.type===c))==null?void 0:d.value)??""};return`${l("month")}/${l("day")} ${l("hour")}:${l("minute")}`}function cQ(e){return e.membershipKind==="watching"?e.lastMessagePreview?`Watching · ${e.lastMessagePreview}`:"Watching":e.lastMessagePreview??""}function dQ({selectedChatId:e,onSelectChat:t,onNewChat:n}){const[a,s]=x.useState("all"),[l,c]=x.useState(""),[d,m]=x.useState([]),[h,g]=x.useState(!1),[p,b]=x.useState(null),{data:w,isLoading:S}=Ke({queryKey:["me","chats",a],queryFn:()=>nh({filter:a}),refetchInterval:15e3}),j=()=>{d.length>0&&m([]),b(null)},E=(w==null?void 0:w.rows)??[],C=x.useMemo(()=>[...E,...d],[E,d]),_=x.useMemo(()=>{const P=l.trim().toLowerCase();return P?C.filter(V=>V.title.toLowerCase().includes(P)||(V.lastMessagePreview??"").toLowerCase().includes(P)?!0:V.participants.map(be=>be.displayName.toLowerCase()).join(" ").includes(P)):C},[C,l]),z=async()=>{if(h)return;const P=w==null?void 0:w.nextCursor;if(P){g(!0),b(null);try{const V=await nh({filter:a,cursor:P});m(I=>[...I,...V.rows]),L(V.nextCursor)}catch(V){b(V instanceof Error?V.message:"Failed to load more")}finally{g(!1)}}},[M,L]=x.useState(null),O=(w==null?void 0:w.nextCursor)??null;x.useEffect(()=>{L(O)},[O]);const F=x.useMemo(()=>C.reduce((P,V)=>P+(V.unreadMentionCount>0?1:0),0),[C]);return o.jsxs("aside",{className:"shrink-0 flex flex-col overflow-hidden",style:{width:320,background:"var(--bg-raised)",borderRight:"var(--hairline) solid var(--border)"},children:[o.jsxs("div",{className:"shrink-0 flex flex-col",style:{gap:6,padding:"var(--sp-2_5) var(--sp-3) var(--sp-2)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[o.jsxs("button",{type:"button",onClick:n,className:"w-full inline-flex items-center transition-colors text-body hover:bg-[var(--bg-hover)]",style:{gap:6,padding:"var(--sp-1_25) var(--sp-2)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:e===rh?"var(--bg-active)":"transparent",color:e===rh?"var(--accent)":"var(--fg)",cursor:"pointer",fontWeight:500},title:"New chat",children:[o.jsx(ba,{className:"h-3.5 w-3.5",strokeWidth:2}),"New chat"]}),o.jsxs("div",{className:"flex items-center",style:{gap:8},children:[o.jsx("div",{className:"flex gap-1 shrink-0",children:F>0&&o.jsx(sT,{active:a==="unread",count:F,onClick:()=>{s(a==="unread"?"all":"unread"),j()},children:"unread"})}),o.jsxs("div",{className:"relative",style:{flex:1,minWidth:0},children:[o.jsx(dh,{className:"h-3 w-3 absolute pointer-events-none",style:{left:4,top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)"}}),o.jsx("input",{value:l,onChange:P=>c(P.target.value),placeholder:"Search…",className:"w-full outline-none text-caption",style:{padding:"var(--sp-0_5) var(--sp-1) var(--sp-0_5) var(--sp-5)",background:"transparent",border:"none",color:"var(--fg-2)"}})]})]})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto",children:[S&&_.length===0&&o.jsx("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:"Loading…"}),!S&&_.length===0&&o.jsx("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:l?"No matches":o.jsxs(o.Fragment,{children:[o.jsx("p",{style:{margin:0},children:"No conversations yet."}),o.jsx("p",{className:"text-label",style:{margin:"var(--sp-1) 0 0",color:"var(--fg-4)"},children:"Start with New chat."})]})}),_.map(P=>{const V=e===P.chatId,I=cQ(P),Q=I&&I!==P.title?I:"",ie=P.unreadMentionCount>0;return o.jsx("div",{style:{borderBottom:"var(--hairline) solid var(--border-faint)"},children:o.jsxs("button",{type:"button",onClick:()=>t(P.chatId),className:Oe("w-full text-left transition-colors flex flex-col","hover:bg-[var(--bg-hover)]"),style:{padding:"var(--sp-2) var(--sp-3)",background:V?"var(--bg-active)":"transparent",borderLeft:`var(--hairline-bold) solid ${V?"var(--accent)":"transparent"}`},children:[o.jsxs("div",{className:"flex items-baseline",style:{gap:6},children:[ie&&o.jsx("span",{"aria-label":`${P.unreadMentionCount} unread mentions`,role:"status",style:{width:6,height:6,borderRadius:"50%",background:"var(--state-error)",flexShrink:0,alignSelf:"center"}}),o.jsx("span",{className:"truncate text-subtitle",style:{color:ie?"var(--fg)":"var(--fg-2)",fontWeight:ie?700:500,flex:1,minWidth:0},children:P.title}),P.lastMessageAt&&o.jsx("span",{className:"mono text-caption shrink-0",style:{color:"var(--fg-4)"},children:uQ(P.lastMessageAt)})]}),o.jsx("div",{className:"truncate text-body",style:{color:ie?"var(--fg-2)":"var(--fg-3)",marginTop:2},children:Q||"—"})]})},P.chatId)}),M&&_.length>0&&o.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3)"},children:[o.jsx("button",{type:"button",onClick:z,disabled:h,className:"w-full text-body mono",style:{padding:"var(--sp-1_25) var(--sp-2)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)",color:"var(--fg-2)",cursor:h?"default":"pointer",opacity:h?.6:1},children:h?"Loading…":"Load more"}),p&&o.jsx("p",{className:"mono text-caption",style:{color:"var(--state-error)",marginTop:4},children:p})]})]})]})}function cT(e){return Ce.get(`/chats/${encodeURIComponent(e)}`)}function fQ(e,t){return Ce.patch(`/chats/${encodeURIComponent(e)}`,{topic:t})}function ko(e,t){return Ce.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"text",content:t})}function hQ(e,t){return Ce.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"file",content:t})}function mQ(e){return new Promise((t,n)=>{const a=new FileReader;a.onload=()=>{const s=a.result;if(typeof s!="string"){n(new Error("Unexpected FileReader result"));return}const l=s.indexOf(",");t(l>=0?s.slice(l+1):s)},a.onerror=()=>n(a.error??new Error("FileReader error")),a.readAsDataURL(e)})}function wb(e){return Ce.post(`/agents/${encodeURIComponent(e)}/chats`,{})}function pQ(e,t){const n=new URLSearchParams;n.set("limit",String(t.limit)),t!=null&&t.cursor&&n.set("cursor",t.cursor);const a=n.toString();return Ce.get(`/chats/${encodeURIComponent(e)}/messages${a?`?${a}`:""}`)}function Sb(e){const t=new Map;for(const a of e)a.displayName&&t.set(a.displayName,(t.get(a.displayName)??0)+1);const n=new Set;for(const[a,s]of t)s>1&&n.add(a);return n}function gQ(e,t){return!e.name||!e.displayName?!1:e.displayName!==e.name?!0:t.has(e.displayName)}function kb({candidate:e,ambiguous:t}){const n=e.name?`@${e.name}`:"—";return o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"font-medium",children:e.displayName??n}),gQ(e,t)&&o.jsxs("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:["@",e.name]})]})}function yQ(e,t){if(t<=0||t>e.length)return null;let n=t-1;for(;n>=0;){const s=e[n];if(s===void 0)return null;if(s==="@")break;if(!/[A-Za-z0-9_-]/.test(s))return null;n--}if(n<0||e[n]!=="@")return null;if(n>0){const s=e[n-1];if(s!==void 0&&/[A-Za-z0-9_.@-]/.test(s))return null}const a=e.slice(n+1,t).toLowerCase();return{triggerIndex:n,query:a}}function vQ(e,t){if(!t)return[...e].sort((a,s)=>(a.displayName??a.name??"").localeCompare(s.displayName??s.name??"")).slice(0,8);const n=[];for(const a of e){const s=(a.name??"").toLowerCase(),l=(a.displayName??"").toLowerCase();let c=1/0;s.startsWith(t)?c=0:l.startsWith(t)?c=1:l.includes(t)&&(c=2),c!==1/0&&n.push({c:a,score:c})}return n.sort((a,s)=>a.score-s.score||(a.c.displayName??"").localeCompare(s.c.displayName??"")),n.slice(0,8).map(a=>a.c)}function bQ(e,t,n,a){if(!a.name)return null;const s=e.slice(0,t.triggerIndex),l=e.slice(n),c=`@${a.name}`,d=l.length===0||!/\s/.test(l[0]??""),m=d?` ${l}`:l,h=`${s}${c}${m}`,g=s.length+c.length+(d?1:0);return{text:h,cursor:g}}function dT({value:e,cursor:t,candidates:n,onSelect:a,disabled:s}){const[l,c]=x.useState(0),[d,m]=x.useState(null),h=x.useMemo(()=>s?null:yQ(e,t),[e,t,s]),g=x.useMemo(()=>h?vQ(n,h.query):[],[h,n]),p=h?`${h.triggerIndex}:${h.query}`:"";x.useEffect(()=>{c(0)},[p]),x.useEffect(()=>{h===null&&d!==null&&m(null)},[h,d]);const b=d!==null&&h!==null&&d===h.triggerIndex,w=h!==null&&g.length>0&&!b;function S(){m((h==null?void 0:h.triggerIndex)??null)}function j(C){if(!h)return;const _=bQ(e,h,t,C);_&&a(_)}return{trigger:w?h:null,results:w?g:[],highlightIndex:l,handleKey:C=>{if(!w||!h)return!1;if(C.key==="ArrowDown")return C.preventDefault(),c(_=>g.length===0?0:(_+1)%g.length),!0;if(C.key==="ArrowUp")return C.preventDefault(),c(_=>g.length===0?0:(_-1+g.length)%g.length),!0;if(C.key==="Enter"||C.key==="Tab"){const _=g[l]??g[0];return _?(C.preventDefault(),j(_),!0):!1}return C.key==="Escape"?(C.preventDefault(),S(),!0):!1},pick:j,dismiss:S}}function fT({trigger:e,results:t,highlightIndex:n,onPick:a,anchorRef:s}){const l=x.useRef(null);return x.useEffect(()=>{var m;const d=(m=l.current)==null?void 0:m.querySelector(`[data-mention-index="${n}"]`);d==null||d.scrollIntoView({block:"nearest"})},[n]),!e||t.length===0||!s.current?null:o.jsx("div",{ref:l,role:"listbox","aria-label":"Mention suggestions",className:Oe("absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg"),style:{bottom:"calc(100% + var(--sp-1))",left:0,minWidth:240,maxWidth:360,background:"var(--bg-raised)",borderColor:"var(--border)"},children:(()=>{const d=Sb(t);return t.map((m,h)=>{const g=h===n;return o.jsx("button",{type:"button",role:"option","aria-selected":g,"data-mention-index":h,title:m.name?`@${m.name}`:void 0,onMouseDown:p=>{p.preventDefault(),a(m)},className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:g?"var(--bg-hover)":"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:o.jsx(kb,{candidate:m,ambiguous:d})},m.agentId)})})()})}function xQ({onCreated:e}){const t=hn(),{agentId:n}=pt(),a=zv(),[s,l]=x.useState([]),[c,d]=x.useState(""),[m,h]=x.useState(0),[g,p]=x.useState(null),[b,w]=x.useState(!1),[S,j]=x.useState(!1),E=x.useRef(null),C=x.useRef(!1),_=x.useRef(null),{data:z}=Ke({queryKey:["activity"],queryFn:zc,refetchInterval:15e3}),M=x.useMemo(()=>{const X=(z==null?void 0:z.agents)??[],W=[];for(const q of X){if(n&&q.agentId===n)continue;const ne=a(q.agentId);!ne||!ne.name||W.push({agentId:q.agentId,name:ne.name,displayName:ne.displayName})}return W},[z,a,n]);x.useEffect(()=>{if(C.current||s.length>0||M.length===0)return;const X=SQ(M,(z==null?void 0:z.agents)??[]);X&&(l([X]),C.current=!0)},[M,z,s.length]);const L=x.useMemo(()=>{const X=M.map(W=>({agentId:W.agentId,name:W.name}));return fN(c,X)},[c,M]),O=dT({value:c,cursor:m,candidates:M,disabled:b,onSelect:X=>{d(X.text),h(X.cursor),requestAnimationFrame(()=>{const W=E.current;W&&(W.focus(),W.setSelectionRange(X.cursor,X.cursor))})}});x.useEffect(()=>{L.length!==0&&l(X=>{const W=new Set(X);let q=!1;for(const ne of L)W.has(ne)||(W.add(ne),q=!0);return q?[...W]:X})},[L]),x.useEffect(()=>{if(!S)return;const X=W=>{_.current&&(_.current.contains(W.target)||j(!1))};return document.addEventListener("mousedown",X),()=>document.removeEventListener("mousedown",X)},[S]);const F=xt({mutationFn:async({participantIds:X,text:W})=>{const q=await sQ({participantIds:X}),ne=W.trim();return ne.length>0&&await ko(q.chatId,ne),q.chatId},onSuccess:X=>{d(""),l([]),C.current=!1,t.invalidateQueries({queryKey:["me","chats"]}),e(X)},onError:X=>{p(X instanceof Error?X.message:"Failed to create chat")}}),P=x.useMemo(()=>!(b||F.isPending||s.length===0||c.trim().length===0||s.length>=2&&L.length===0),[b,F.isPending,s.length,c,L.length]),V=x.useMemo(()=>s.length===0?"Add at least one participant":c.trim().length===0?null:s.length>=2&&L.length===0?"Group chats need an @ to wake at least one participant":null,[s.length,c,L.length]),I=async()=>{if(!P)return;const X=Array.from(new Set([...s,...L]));p(null),w(!0);try{await F.mutateAsync({participantIds:X,text:c})}finally{w(!1)}},Q=X=>{l(W=>W.filter(q=>q!==X))},ie=X=>{l(W=>W.includes(X)?W:[...W,X]),j(!1)},be=x.useMemo(()=>M.filter(X=>!s.includes(X.agentId)),[M,s]);return o.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",style:{background:"var(--bg-base)"},children:o.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",style:{padding:"var(--sp-6)"},children:o.jsxs("div",{style:{width:"100%",maxWidth:"clamp(55rem, 75%, 70rem)"},children:[o.jsx("p",{className:"text-title",style:{color:"var(--fg)",textAlign:"center",marginBottom:"var(--sp-5)"},children:"What's the task?"}),o.jsxs("div",{style:{borderRadius:10,background:"var(--bg-raised)",boxShadow:"var(--shadow-md)",overflow:"visible"},children:[o.jsx(wQ,{chips:s,candidates:M,chipCandidates:be,pickerOpen:S,setPickerOpen:j,pickerContainerRef:_,onAdd:ie,onRemove:Q}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx(fT,{trigger:O.trigger,results:O.results,highlightIndex:O.highlightIndex,anchorRef:E,onPick:O.pick}),o.jsx("textarea",{ref:E,value:c,onChange:X=>{d(X.target.value),h(X.target.selectionStart??X.target.value.length)},onSelect:X=>{h(X.currentTarget.selectionStart??c.length)},placeholder:s.length>=2?"Describe the task. Use @ to address one or more.":"Describe the task…",rows:1,onKeyDown:X=>{O.handleKey(X)||X.key==="Enter"&&!X.shiftKey&&(X.preventDefault(),I())},disabled:b||F.isPending,className:"w-full outline-none text-subtitle font-normal",style:{padding:"var(--sp-2) var(--sp-3)",background:"transparent",border:"none",resize:"none",color:"var(--fg)"}}),s.length>=2&&L.length===0&&c.trim().length>0&&o.jsxs("div",{"aria-hidden":"true",className:"text-subtitle font-normal",style:{position:"absolute",inset:0,padding:"var(--sp-2) var(--sp-3)",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",pointerEvents:"none",color:"transparent",overflow:"hidden"},children:[c,o.jsx("span",{style:{color:"var(--fg-4)"},children:" ← @ a group member to send"})]})]}),o.jsx("div",{className:"flex items-center justify-end",style:{padding:"var(--sp-1_5) var(--sp-2_5)"},children:o.jsx("button",{type:"button",onClick:()=>void I(),disabled:!P,title:V??"Send (Enter)","aria-label":"Send",className:Oe("inline-flex items-center justify-center transition-opacity",!P&&"opacity-40 cursor-not-allowed"),style:{width:28,height:28,borderRadius:"var(--radius-input)",background:"var(--fg)",color:"var(--bg-raised)",border:"none"},children:o.jsx(uC,{className:"h-3.5 w-3.5",strokeWidth:2.5})})})]}),g&&o.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)",marginTop:8},children:g})]})})})}function wQ({chips:e,candidates:t,chipCandidates:n,pickerOpen:a,setPickerOpen:s,pickerContainerRef:l,onAdd:c,onRemove:d}){return o.jsxs("div",{className:"flex items-center flex-wrap",style:{gap:6,padding:"var(--sp-1_5) var(--sp-2_5) var(--sp-1)"},children:[e.map(m=>{const h=t.find(p=>p.agentId===m),g=(h==null?void 0:h.displayName)??(h==null?void 0:h.name)??m;return o.jsxs("span",{className:"group inline-flex items-center text-label",style:{gap:2,padding:"var(--sp-0_5) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"var(--bg-sunken)",color:"var(--fg)"},children:[o.jsx("span",{children:g}),o.jsx("button",{type:"button",onClick:()=>d(m),title:"Remove participant",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{background:"none",border:"none",padding:0,marginLeft:2,cursor:"pointer",color:"var(--fg-3)",display:"inline-flex",alignItems:"center"},children:o.jsx(ss,{className:"h-3 w-3"})})]},m)}),o.jsxs("div",{ref:l,style:{position:"relative"},children:[o.jsx("button",{type:"button",onClick:()=>s(!a),title:"Add participant","aria-label":"Add participant",disabled:n.length===0,className:"inline-flex items-center transition-colors hover:bg-[var(--bg-sunken)]",style:{padding:"var(--sp-0_5) var(--sp-1)",borderRadius:"var(--radius-chip)",border:"var(--hairline) solid var(--border)",background:"transparent",color:n.length===0?"var(--fg-4)":"var(--fg-3)",cursor:n.length===0?"not-allowed":"pointer"},children:o.jsx(ba,{className:"h-3 w-3"})}),a&&n.length>0&&o.jsx("div",{role:"listbox","aria-label":"Add participant",className:"absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg",style:{top:"calc(100% + var(--sp-1))",left:0,minWidth:280,background:"var(--bg-raised)",borderColor:"var(--border)"},children:(()=>{const m=Sb(n);return n.map(h=>o.jsx("button",{type:"button",role:"option","aria-selected":"false",title:h.name?`@${h.name}`:void 0,onClick:()=>c(h.agentId),className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:o.jsx(kb,{candidate:h,ambiguous:m})},h.agentId))})()})]})]})}function SQ(e,t){var l;const n=new Set(e.map(c=>c.agentId)),a=[...t].filter(c=>n.has(c.agentId)&&c.runtimeUpdatedAt).sort((c,d)=>(d.runtimeUpdatedAt??"").localeCompare(c.runtimeUpdatedAt??""))[0];if(a)return a.agentId;const s=t.find(c=>n.has(c.agentId)&&c.type==="personal_assistant");return s?s.agentId:((l=e[0])==null?void 0:l.agentId)??null}const kQ="first-tree-hub-images",jQ=1,jo="images";let Ef=null;function hT(){return Ef||(Ef=new Promise(e=>{if(typeof indexedDB>"u"){e(null);return}const t=indexedDB.open(kQ,jQ);t.onupgradeneeded=()=>{const n=t.result;n.objectStoreNames.contains(jo)||n.createObjectStore(jo,{keyPath:"imageId"})},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null),t.onblocked=()=>e(null)}),Ef)}async function CQ(e){const t=await hT();if(!t)throw new Error("Image storage unavailable (IndexedDB disabled or blocked)");await new Promise((n,a)=>{const s=t.transaction(jo,"readwrite"),l=s.objectStore(jo),c={imageId:e.imageId,base64:e.base64,mimeType:e.mimeType,createdAt:Date.now()};l.put(c),s.oncomplete=()=>n(),s.onerror=()=>a(s.error??new Error("Image storage write failed")),s.onabort=()=>a(s.error??new Error("Image storage write aborted"))})}async function EQ(e){const t=await hT();return t?new Promise(n=>{const l=t.transaction(jo,"readonly").objectStore(jo).get(e);l.onsuccess=()=>{const c=l.result;if(!c){n(null);return}n({base64:c.base64,mimeType:c.mimeType})},l.onerror=()=>n(null)}):null}function NQ(e,t,n){return Ce.post(`/chats/${encodeURIComponent(e)}/questions/${encodeURIComponent(t)}/answer`,{answers:n})}/*! @license DOMPurify 3.4.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.2/LICENSE */const{entries:mT,setPrototypeOf:$k,isFrozen:_Q,getPrototypeOf:TQ,getOwnPropertyDescriptor:AQ}=Object;let{freeze:dr,seal:aa,create:Ql}=Object,{apply:Ky,construct:Yy}=typeof Reflect<"u"&&Reflect;dr||(dr=function(t){return t});aa||(aa=function(t){return t});Ky||(Ky=function(t,n){for(var a=arguments.length,s=new Array(a>2?a-2:0),l=2;l<a;l++)s[l-2]=arguments[l];return t.apply(n,s)});Yy||(Yy=function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];return new t(...a)});const $u=En(Array.prototype.forEach),RQ=En(Array.prototype.lastIndexOf),Hk=En(Array.prototype.pop),Hu=En(Array.prototype.push),OQ=En(Array.prototype.splice),ir=Array.isArray,Ku=En(String.prototype.toLowerCase),Pg=En(String.prototype.toString),qk=En(String.prototype.match),ql=En(String.prototype.replace),Zk=En(String.prototype.indexOf),zQ=En(String.prototype.trim),MQ=En(Number.prototype.toString),DQ=En(Boolean.prototype.toString),Gk=typeof BigInt>"u"?null:En(BigInt.prototype.toString),Vk=typeof Symbol>"u"?null:En(Symbol.prototype.toString),rn=En(Object.prototype.hasOwnProperty),qu=En(Object.prototype.toString),Hn=En(RegExp.prototype.test),Nf=IQ(TypeError);function En(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];return Ky(e,t,a)}}function IQ(e){return function(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return Yy(e,n)}}function We(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ku;if($k&&$k(e,null),!ir(t))return e;let a=t.length;for(;a--;){let s=t[a];if(typeof s=="string"){const l=n(s);l!==s&&(_Q(t)||(t[a]=l),s=l)}e[s]=!0}return e}function LQ(e){for(let t=0;t<e.length;t++)rn(e,t)||(e[t]=null);return e}function br(e){const t=Ql(null);for(const[n,a]of mT(e))rn(e,n)&&(ir(a)?t[n]=LQ(a):a&&typeof a=="object"&&a.constructor===Object?t[n]=br(a):t[n]=a);return t}function PQ(e){switch(typeof e){case"string":return e;case"number":return MQ(e);case"boolean":return DQ(e);case"bigint":return Gk?Gk(e):"0";case"symbol":return Vk?Vk(e):"Symbol()";case"undefined":return qu(e);case"function":case"object":{if(e===null)return qu(e);const t=e,n=Kl(t,"toString");if(typeof n=="function"){const a=n(t);return typeof a=="string"?a:qu(a)}return qu(e)}default:return qu(e)}}function Kl(e,t){for(;e!==null;){const a=AQ(e,t);if(a){if(a.get)return En(a.get);if(typeof a.value=="function")return En(a.value)}e=TQ(e)}function n(){return null}return n}function UQ(e){try{return Hn(e,""),!0}catch{return!1}}const Qk=dr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ug=dr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Bg=dr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),BQ=dr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Fg=dr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),FQ=dr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Kk=dr(["#text"]),Yk=dr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),$g=dr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Xk=dr(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),_f=dr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),$Q=aa(/\{\{[\w\W]*|[\w\W]*\}\}/gm),HQ=aa(/<%[\w\W]*|[\w\W]*%>/gm),qQ=aa(/\$\{[\w\W]*/gm),ZQ=aa(/^data-[\-\w.\u00B7-\uFFFF]+$/),GQ=aa(/^aria-[\-\w]+$/),pT=aa(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),VQ=aa(/^(?:\w+script|data):/i),QQ=aa(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),gT=aa(/^html$/i),KQ=aa(/^[a-z][.\w]*(-[.\w]+)+$/i);var Wk=Object.freeze({__proto__:null,ARIA_ATTR:GQ,ATTR_WHITESPACE:QQ,CUSTOM_ELEMENT:KQ,DATA_ATTR:ZQ,DOCTYPE_NAME:gT,ERB_EXPR:HQ,IS_ALLOWED_URI:pT,IS_SCRIPT_OR_DATA:VQ,MUSTACHE_EXPR:$Q,TMPLIT_EXPR:qQ});const Zu={element:1,text:3,progressingInstruction:7,comment:8,document:9},YQ=function(){return typeof window>"u"?null:window},XQ=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let a=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(a=n.getAttribute(s));const l="dompurify"+(a?"#"+a:"");try{return t.createPolicy(l,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+l+" could not be created."),null}},Jk=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function yT(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:YQ();const t=Ie=>yT(Ie);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Zu.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const a=n,s=a.currentScript,{DocumentFragment:l,HTMLTemplateElement:c,Node:d,Element:m,NodeFilter:h,NamedNodeMap:g=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:b,trustedTypes:w}=e,S=m.prototype,j=Kl(S,"cloneNode"),E=Kl(S,"remove"),C=Kl(S,"nextSibling"),_=Kl(S,"childNodes"),z=Kl(S,"parentNode");if(typeof c=="function"){const Ie=n.createElement("template");Ie.content&&Ie.content.ownerDocument&&(n=Ie.content.ownerDocument)}let M,L="";const{implementation:O,createNodeIterator:F,createDocumentFragment:P,getElementsByTagName:V}=n,{importNode:I}=a;let Q=Jk();t.isSupported=typeof mT=="function"&&typeof z=="function"&&O&&O.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ie,ERB_EXPR:be,TMPLIT_EXPR:X,DATA_ATTR:W,ARIA_ATTR:q,IS_SCRIPT_OR_DATA:ne,ATTR_WHITESPACE:we,CUSTOM_ELEMENT:Re}=Wk;let{IS_ALLOWED_URI:R}=Wk,D=null;const U=We({},[...Qk,...Ug,...Bg,...Fg,...Kk]);let T=null;const Z=We({},[...Yk,...$g,...Xk,..._f]);let Y=Object.seal(Ql(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ue=null,Se=null;const ve=Object.seal(Ql(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let me=!0,Ge=!0,Be=!1,vt=!0,gt=!1,ae=!0,je=!1,De=!1,Ye=!1,mn=!1,en=!1,Er=!1,Br=!0,hi=!1;const mi="user-content-";let ln=!0,ua=!1,le={},ge=null;const Ue=We({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ze=null;const nt=We({},["audio","video","img","source","image","track"]);let on=null;const er=We({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),$t="http://www.w3.org/1998/Math/MathML",It="http://www.w3.org/2000/svg",Tt="http://www.w3.org/1999/xhtml";let rt=Tt,tr=!1,zn=null;const al=We({},[$t,It,Tt],Pg);let ca=We({},["mi","mo","mn","ms","mtext"]),da=We({},["annotation-xml"]);const za=We({},["title","style","font","a","script"]);let Zn=null;const Ma=["application/xhtml+xml","text/html"],wa="text/html";let Ht=null,ke=null;const et=n.createElement("form"),pn=function($){return $ instanceof RegExp||$ instanceof Function},Nr=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ke&&ke===$)return;(!$||typeof $!="object")&&($={}),$=br($),Zn=Ma.indexOf($.PARSER_MEDIA_TYPE)===-1?wa:$.PARSER_MEDIA_TYPE,Ht=Zn==="application/xhtml+xml"?Pg:Ku,D=rn($,"ALLOWED_TAGS")&&ir($.ALLOWED_TAGS)?We({},$.ALLOWED_TAGS,Ht):U,T=rn($,"ALLOWED_ATTR")&&ir($.ALLOWED_ATTR)?We({},$.ALLOWED_ATTR,Ht):Z,zn=rn($,"ALLOWED_NAMESPACES")&&ir($.ALLOWED_NAMESPACES)?We({},$.ALLOWED_NAMESPACES,Pg):al,on=rn($,"ADD_URI_SAFE_ATTR")&&ir($.ADD_URI_SAFE_ATTR)?We(br(er),$.ADD_URI_SAFE_ATTR,Ht):er,Ze=rn($,"ADD_DATA_URI_TAGS")&&ir($.ADD_DATA_URI_TAGS)?We(br(nt),$.ADD_DATA_URI_TAGS,Ht):nt,ge=rn($,"FORBID_CONTENTS")&&ir($.FORBID_CONTENTS)?We({},$.FORBID_CONTENTS,Ht):Ue,ue=rn($,"FORBID_TAGS")&&ir($.FORBID_TAGS)?We({},$.FORBID_TAGS,Ht):br({}),Se=rn($,"FORBID_ATTR")&&ir($.FORBID_ATTR)?We({},$.FORBID_ATTR,Ht):br({}),le=rn($,"USE_PROFILES")?$.USE_PROFILES&&typeof $.USE_PROFILES=="object"?br($.USE_PROFILES):$.USE_PROFILES:!1,me=$.ALLOW_ARIA_ATTR!==!1,Ge=$.ALLOW_DATA_ATTR!==!1,Be=$.ALLOW_UNKNOWN_PROTOCOLS||!1,vt=$.ALLOW_SELF_CLOSE_IN_ATTR!==!1,gt=$.SAFE_FOR_TEMPLATES||!1,ae=$.SAFE_FOR_XML!==!1,je=$.WHOLE_DOCUMENT||!1,mn=$.RETURN_DOM||!1,en=$.RETURN_DOM_FRAGMENT||!1,Er=$.RETURN_TRUSTED_TYPE||!1,Ye=$.FORCE_BODY||!1,Br=$.SANITIZE_DOM!==!1,hi=$.SANITIZE_NAMED_PROPS||!1,ln=$.KEEP_CONTENT!==!1,ua=$.IN_PLACE||!1,R=UQ($.ALLOWED_URI_REGEXP)?$.ALLOWED_URI_REGEXP:pT,rt=typeof $.NAMESPACE=="string"?$.NAMESPACE:Tt,ca=rn($,"MATHML_TEXT_INTEGRATION_POINTS")&&$.MATHML_TEXT_INTEGRATION_POINTS&&typeof $.MATHML_TEXT_INTEGRATION_POINTS=="object"?br($.MATHML_TEXT_INTEGRATION_POINTS):We({},["mi","mo","mn","ms","mtext"]),da=rn($,"HTML_INTEGRATION_POINTS")&&$.HTML_INTEGRATION_POINTS&&typeof $.HTML_INTEGRATION_POINTS=="object"?br($.HTML_INTEGRATION_POINTS):We({},["annotation-xml"]);const he=rn($,"CUSTOM_ELEMENT_HANDLING")&&$.CUSTOM_ELEMENT_HANDLING&&typeof $.CUSTOM_ELEMENT_HANDLING=="object"?br($.CUSTOM_ELEMENT_HANDLING):Ql(null);if(Y=Ql(null),rn(he,"tagNameCheck")&&pn(he.tagNameCheck)&&(Y.tagNameCheck=he.tagNameCheck),rn(he,"attributeNameCheck")&&pn(he.attributeNameCheck)&&(Y.attributeNameCheck=he.attributeNameCheck),rn(he,"allowCustomizedBuiltInElements")&&typeof he.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=he.allowCustomizedBuiltInElements),gt&&(Ge=!1),en&&(mn=!0),le&&(D=We({},Kk),T=Ql(null),le.html===!0&&(We(D,Qk),We(T,Yk)),le.svg===!0&&(We(D,Ug),We(T,$g),We(T,_f)),le.svgFilters===!0&&(We(D,Bg),We(T,$g),We(T,_f)),le.mathMl===!0&&(We(D,Fg),We(T,Xk),We(T,_f))),ve.tagCheck=null,ve.attributeCheck=null,rn($,"ADD_TAGS")&&(typeof $.ADD_TAGS=="function"?ve.tagCheck=$.ADD_TAGS:ir($.ADD_TAGS)&&(D===U&&(D=br(D)),We(D,$.ADD_TAGS,Ht))),rn($,"ADD_ATTR")&&(typeof $.ADD_ATTR=="function"?ve.attributeCheck=$.ADD_ATTR:ir($.ADD_ATTR)&&(T===Z&&(T=br(T)),We(T,$.ADD_ATTR,Ht))),rn($,"ADD_URI_SAFE_ATTR")&&ir($.ADD_URI_SAFE_ATTR)&&We(on,$.ADD_URI_SAFE_ATTR,Ht),rn($,"FORBID_CONTENTS")&&ir($.FORBID_CONTENTS)&&(ge===Ue&&(ge=br(ge)),We(ge,$.FORBID_CONTENTS,Ht)),rn($,"ADD_FORBID_CONTENTS")&&ir($.ADD_FORBID_CONTENTS)&&(ge===Ue&&(ge=br(ge)),We(ge,$.ADD_FORBID_CONTENTS,Ht)),ln&&(D["#text"]=!0),je&&We(D,["html","head","body"]),D.table&&(We(D,["tbody"]),delete ue.tbody),$.TRUSTED_TYPES_POLICY){if(typeof $.TRUSTED_TYPES_POLICY.createHTML!="function")throw Nf('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof $.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Nf('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');M=$.TRUSTED_TYPES_POLICY,L=M.createHTML("")}else M===void 0&&(M=XQ(w,s)),M!==null&&typeof L=="string"&&(L=M.createHTML(""));dr&&dr($),ke=$},pi=We({},[...Ug,...Bg,...BQ]),gs=We({},[...Fg,...FQ]),qc=function($){let he=z($);(!he||!he.tagName)&&(he={namespaceURI:rt,tagName:"template"});const Ee=Ku($.tagName),bt=Ku(he.tagName);return zn[$.namespaceURI]?$.namespaceURI===It?he.namespaceURI===Tt?Ee==="svg":he.namespaceURI===$t?Ee==="svg"&&(bt==="annotation-xml"||ca[bt]):!!pi[Ee]:$.namespaceURI===$t?he.namespaceURI===Tt?Ee==="math":he.namespaceURI===It?Ee==="math"&&da[bt]:!!gs[Ee]:$.namespaceURI===Tt?he.namespaceURI===It&&!da[bt]||he.namespaceURI===$t&&!ca[bt]?!1:!gs[Ee]&&(za[Ee]||!pi[Ee]):!!(Zn==="application/xhtml+xml"&&zn[$.namespaceURI]):!1},nr=function($){Hu(t.removed,{element:$});try{z($).removeChild($)}catch{E($)}},fa=function($,he){try{Hu(t.removed,{attribute:he.getAttributeNode($),from:he})}catch{Hu(t.removed,{attribute:null,from:he})}if(he.removeAttribute($),$==="is")if(mn||en)try{nr(he)}catch{}else try{he.setAttribute($,"")}catch{}},Io=function($){let he=null,Ee=null;if(Ye)$="<remove></remove>"+$;else{const Xt=qk($,/^[\r\n\t ]+/);Ee=Xt&&Xt[0]}Zn==="application/xhtml+xml"&&rt===Tt&&($='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+$+"</body></html>");const bt=M?M.createHTML($):$;if(rt===Tt)try{he=new b().parseFromString(bt,Zn)}catch{}if(!he||!he.documentElement){he=O.createDocument(rt,"template",null);try{he.documentElement.innerHTML=tr?L:bt}catch{}}const ct=he.body||he.documentElement;return $&&Ee&&ct.insertBefore(n.createTextNode(Ee),ct.childNodes[0]||null),rt===Tt?V.call(he,je?"html":"body")[0]:je?he.documentElement:ct},Lo=function($){return F.call($.ownerDocument||$,$,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Fr=function($){return $ instanceof p&&(typeof $.nodeName!="string"||typeof $.textContent!="string"||typeof $.removeChild!="function"||!($.attributes instanceof g)||typeof $.removeAttribute!="function"||typeof $.setAttribute!="function"||typeof $.namespaceURI!="string"||typeof $.insertBefore!="function"||typeof $.hasChildNodes!="function")},un=function($){return typeof d=="function"&&$ instanceof d};function qt(Ie,$,he){$u(Ie,Ee=>{Ee.call(t,$,he,ke)})}const Da=function($){let he=null;if(qt(Q.beforeSanitizeElements,$,null),Fr($))return nr($),!0;const Ee=Ht($.nodeName);if(qt(Q.uponSanitizeElement,$,{tagName:Ee,allowedTags:D}),ae&&$.hasChildNodes()&&!un($.firstElementChild)&&Hn(/<[/\w!]/g,$.innerHTML)&&Hn(/<[/\w!]/g,$.textContent)||ae&&$.namespaceURI===Tt&&Ee==="style"&&un($.firstElementChild)||$.nodeType===Zu.progressingInstruction||ae&&$.nodeType===Zu.comment&&Hn(/<[/\w]/g,$.data))return nr($),!0;if(ue[Ee]||!(ve.tagCheck instanceof Function&&ve.tagCheck(Ee))&&!D[Ee]){if(!ue[Ee]&&Zc(Ee)&&(Y.tagNameCheck instanceof RegExp&&Hn(Y.tagNameCheck,Ee)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(Ee)))return!1;if(ln&&!ge[Ee]){const bt=z($)||$.parentNode,ct=_($)||$.childNodes;if(ct&&bt){const Xt=ct.length;for(let Pn=Xt-1;Pn>=0;--Pn){const gn=j(ct[Pn],!0);bt.insertBefore(gn,C($))}}}return nr($),!0}return $ instanceof m&&!qc($)||(Ee==="noscript"||Ee==="noembed"||Ee==="noframes")&&Hn(/<\/no(script|embed|frames)/i,$.innerHTML)?(nr($),!0):(gt&&$.nodeType===Zu.text&&(he=$.textContent,$u([ie,be,X],bt=>{he=ql(he,bt," ")}),$.textContent!==he&&(Hu(t.removed,{element:$.cloneNode()}),$.textContent=he)),qt(Q.afterSanitizeElements,$,null),!1)},il=function($,he,Ee){if(Se[he]||Br&&(he==="id"||he==="name")&&(Ee in n||Ee in et))return!1;const bt=T[he]||ve.attributeCheck instanceof Function&&ve.attributeCheck(he,$);if(!(Ge&&!Se[he]&&Hn(W,he))){if(!(me&&Hn(q,he))){if(!bt||Se[he]){if(!(Zc($)&&(Y.tagNameCheck instanceof RegExp&&Hn(Y.tagNameCheck,$)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck($))&&(Y.attributeNameCheck instanceof RegExp&&Hn(Y.attributeNameCheck,he)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(he,$))||he==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&Hn(Y.tagNameCheck,Ee)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(Ee))))return!1}else if(!on[he]){if(!Hn(R,ql(Ee,we,""))){if(!((he==="src"||he==="xlink:href"||he==="href")&&$!=="script"&&Zk(Ee,"data:")===0&&Ze[$])){if(!(Be&&!Hn(ne,ql(Ee,we,"")))){if(Ee)return!1}}}}}}return!0},zh=We({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Zc=function($){return!zh[Ku($)]&&Hn(Re,$)},Po=function($){qt(Q.beforeSanitizeAttributes,$,null);const{attributes:he}=$;if(!he||Fr($))return;const Ee={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:T,forceKeepAttr:void 0};let bt=he.length;for(;bt--;){const ct=he[bt],{name:Xt,namespaceURI:Pn,value:gn}=ct,Mn=Ht(Xt),Uo=gn;let cn=Xt==="value"?Uo:zQ(Uo);if(Ee.attrName=Mn,Ee.attrValue=cn,Ee.keepAttr=!0,Ee.forceKeepAttr=void 0,qt(Q.uponSanitizeAttribute,$,Ee),cn=Ee.attrValue,hi&&(Mn==="id"||Mn==="name")&&Zk(cn,mi)!==0&&(fa(Xt,$),cn=mi+cn),ae&&Hn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,cn)){fa(Xt,$);continue}if(Mn==="attributename"&&qk(cn,"href")){fa(Xt,$);continue}if(Ee.forceKeepAttr)continue;if(!Ee.keepAttr){fa(Xt,$);continue}if(!vt&&Hn(/\/>/i,cn)){fa(Xt,$);continue}gt&&$u([ie,be,X],Gc=>{cn=ql(cn,Gc," ")});const Bo=Ht($.nodeName);if(!il(Bo,Mn,cn)){fa(Xt,$);continue}if(M&&typeof w=="object"&&typeof w.getAttributeType=="function"&&!Pn)switch(w.getAttributeType(Bo,Mn)){case"TrustedHTML":{cn=M.createHTML(cn);break}case"TrustedScriptURL":{cn=M.createScriptURL(cn);break}}if(cn!==Uo)try{Pn?$.setAttributeNS(Pn,Xt,cn):$.setAttribute(Xt,cn),Fr($)?nr($):Hk(t.removed)}catch{fa(Xt,$)}}qt(Q.afterSanitizeAttributes,$,null)},gi=function($){let he=null;const Ee=Lo($);for(qt(Q.beforeSanitizeShadowDOM,$,null);he=Ee.nextNode();)qt(Q.uponSanitizeShadowNode,he,null),Da(he),Po(he),he.content instanceof l&&gi(he.content);qt(Q.afterSanitizeShadowDOM,$,null)};return t.sanitize=function(Ie){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},he=null,Ee=null,bt=null,ct=null;if(tr=!Ie,tr&&(Ie="<!-->"),typeof Ie!="string"&&!un(Ie)&&(Ie=PQ(Ie),typeof Ie!="string"))throw Nf("dirty is not a string, aborting");if(!t.isSupported)return Ie;if(De||Nr($),t.removed=[],typeof Ie=="string"&&(ua=!1),ua){const gn=Ie.nodeName;if(typeof gn=="string"){const Mn=Ht(gn);if(!D[Mn]||ue[Mn])throw Nf("root node is forbidden and cannot be sanitized in-place")}}else if(Ie instanceof d)he=Io("<!---->"),Ee=he.ownerDocument.importNode(Ie,!0),Ee.nodeType===Zu.element&&Ee.nodeName==="BODY"||Ee.nodeName==="HTML"?he=Ee:he.appendChild(Ee);else{if(!mn&&!gt&&!je&&Ie.indexOf("<")===-1)return M&&Er?M.createHTML(Ie):Ie;if(he=Io(Ie),!he)return mn?null:Er?L:""}he&&Ye&&nr(he.firstChild);const Xt=Lo(ua?Ie:he);for(;bt=Xt.nextNode();)Da(bt),Po(bt),bt.content instanceof l&&gi(bt.content);if(ua)return Ie;if(mn){if(gt){he.normalize();let gn=he.innerHTML;$u([ie,be,X],Mn=>{gn=ql(gn,Mn," ")}),he.innerHTML=gn}if(en)for(ct=P.call(he.ownerDocument);he.firstChild;)ct.appendChild(he.firstChild);else ct=he;return(T.shadowroot||T.shadowrootmode)&&(ct=I.call(a,ct,!0)),ct}let Pn=je?he.outerHTML:he.innerHTML;return je&&D["!doctype"]&&he.ownerDocument&&he.ownerDocument.doctype&&he.ownerDocument.doctype.name&&Hn(gT,he.ownerDocument.doctype.name)&&(Pn="<!DOCTYPE "+he.ownerDocument.doctype.name+`>
|
|
397
|
+
`+Pn),gt&&$u([ie,be,X],gn=>{Pn=ql(Pn,gn," ")}),M&&Er?M.createHTML(Pn):Pn},t.setConfig=function(){let Ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Nr(Ie),De=!0},t.clearConfig=function(){ke=null,De=!1},t.isValidAttribute=function(Ie,$,he){ke||Nr({});const Ee=Ht(Ie),bt=Ht($);return il(Ee,bt,he)},t.addHook=function(Ie,$){typeof $=="function"&&Hu(Q[Ie],$)},t.removeHook=function(Ie,$){if($!==void 0){const he=RQ(Q[Ie],$);return he===-1?void 0:OQ(Q[Ie],he,1)[0]}return Hk(Q[Ie])},t.removeHooks=function(Ie){Q[Ie]=[]},t.removeAllHooks=function(){Q=Jk()},t}var WQ=yT();function JQ({option:e,previewFormat:t,selected:n,disabled:a,showCheckmark:s,onToggle:l}){const c=x.useMemo(()=>!e.preview||t!=="html"?null:WQ.sanitize(e.preview,{USE_PROFILES:{html:!0}}),[e.preview,t]);return o.jsxs("button",{type:"button",disabled:a,onClick:a?void 0:l,className:Oe("w-full text-left rounded-[var(--radius-input)] border transition-colors","flex flex-col",a?"cursor-default opacity-70":"cursor-pointer hover:bg-[color:var(--bg-hover)]"),style:{padding:"var(--sp-2_5) var(--sp-3)",gap:"var(--sp-1_5)",borderColor:n?"var(--accent)":"var(--border)",background:n?"var(--bg-active)":"var(--bg-raised)"},children:[e.preview?t==="html"&&c?o.jsx("div",{dangerouslySetInnerHTML:{__html:c},className:"max-h-[20rem] overflow-auto rounded-[var(--radius-input)] border",style:{padding:"var(--sp-2)",borderColor:"var(--border)",background:"var(--bg-sunken)"}}):t==="markdown"?o.jsx("div",{className:"max-h-[20rem] overflow-auto rounded-[var(--radius-input)] border",style:{padding:"var(--sp-2)",borderColor:"var(--border)",background:"var(--bg-sunken)"},children:o.jsx(Rh,{children:e.preview})}):null:null,o.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[o.jsx("span",{className:"mono text-body font-semibold",style:{color:n?"var(--accent)":"var(--fg)"},children:e.label}),s&&n?o.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},title:"Selected",children:"✓"}):null]}),e.description?o.jsx("span",{className:"text-caption",style:{color:"var(--fg-3)"},children:e.description}):null]})}const Jl="__free_text__";function Gu(){return{picked:[],freeText:""}}function ej(e,t){if(t.picked.includes(Jl)){const n=t.freeText.trim();return n.length===0?null:n}return t.picked.length===0?null:e.multiSelect?t.picked.join(", "):t.picked[0]??null}function eK({chatId:e,questionMessageId:t,content:n,answer:a,status:s}){const l=s==="pending",c=s==="answered",d=s==="superseded",[m,h]=x.useState(()=>{const E={};for(const C of n.questions)E[C.question]=Gu();return E});x.useEffect(()=>{if(!a)return;const E={};for(const C of n.questions){const _=a.answers[C.question];if(!_){E[C.question]=Gu();continue}const z=new Set(C.options.map(O=>O.label)),M=C.multiSelect?_.split(/,\s*/u):[_],L=M.filter(O=>z.has(O));L.length===M.length&&L.length>0?E[C.question]={picked:L,freeText:""}:E[C.question]={picked:[Jl],freeText:_}}h(E)},[a,n.questions]);const g=hn(),[p,b]=x.useState(null),w=xt({mutationFn:async E=>NQ(e,n.correlationId,E),onSuccess:()=>{b(null),g.invalidateQueries({queryKey:["chat-messages",e]})},onError:E=>{b(E instanceof Error?E.message:String(E))}}),S=x.useCallback(()=>{b(null);const E={};for(const C of n.questions){const _=m[C.question]??Gu(),z=ej(C,_);if(z===null){b(`Please answer "${C.question}" before submitting.`);return}E[C.question]=z}w.mutate(E)},[n.questions,m,w]),j=x.useMemo(()=>n.questions.every(E=>{const C=m[E.question]??Gu();return ej(E,C)!==null}),[n.questions,m]);return o.jsxs("div",{className:Oe("rounded-[var(--radius-panel)] border flex flex-col",l?"":"opacity-80"),style:{padding:"var(--sp-3)",gap:"var(--sp-3)",borderColor:l?"var(--accent)":"var(--border)",background:"var(--bg-raised)"},children:[o.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[o.jsx("span",{className:"mono text-eyebrow font-semibold",style:{color:l?"var(--accent)":"var(--fg-3)"},children:"AGENT QUESTION"}),c?o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:"• Answered"}):null,d?o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"• Superseded"}):null]}),o.jsx("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:n.questions.map(E=>o.jsx(tK,{question:E,previewFormat:n.previewFormat,selection:m[E.question]??Gu(),allowFreeText:n.allowFreeText,disabled:!l,showAnsweredCheck:c||d,onChange:C=>h(_=>({..._,[E.question]:C}))},E.question))}),l?o.jsxs("div",{className:"flex items-center justify-end",style:{gap:"var(--sp-2)"},children:[p?o.jsx("span",{className:"text-caption",style:{color:"var(--state-danger)"},children:p}):null,o.jsx(pe,{type:"button",disabled:!j||w.isPending,onClick:S,children:w.isPending?"Submitting…":"Submit answer"})]}):null]})}function tK({question:e,previewFormat:t,selection:n,allowFreeText:a,disabled:s,showAnsweredCheck:l,onChange:c}){const d=x.useRef(null),m=n.picked.includes(Jl);x.useEffect(()=>{var g;m&&!s&&((g=d.current)==null||g.focus())},[m,s]);const h=x.useCallback(g=>{const p=n.picked.includes(g);let b;e.multiSelect?b=p?n.picked.filter(w=>w!==g):[...n.picked,g]:b=p?[]:[g],c({...n,picked:b})},[e.multiSelect,n,c]);return o.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[o.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[o.jsx("span",{className:"mono text-eyebrow font-semibold",style:{color:"var(--fg-2)"},children:e.header}),e.multiSelect?o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"(pick any)"}):null]}),o.jsx("div",{className:"text-body",style:{color:"var(--fg)"},children:e.question}),o.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1_5)"},children:[e.options.map(g=>o.jsx(JQ,{option:g,previewFormat:t,selected:n.picked.includes(g.label),disabled:s,showCheckmark:l,onToggle:()=>h(g.label)},g.label)),a?o.jsxs("button",{type:"button",disabled:s,onClick:s?void 0:()=>c({picked:e.multiSelect?m?n.picked.filter(g=>g!==Jl):[...n.picked,Jl]:m?[]:[Jl],freeText:n.freeText}),className:Oe("w-full text-left rounded-[var(--radius-input)] border transition-colors","flex flex-col",s?"cursor-default opacity-70":"cursor-pointer hover:bg-[color:var(--bg-hover)]"),style:{padding:"var(--sp-2_5) var(--sp-3)",gap:"var(--sp-1_5)",borderColor:m?"var(--accent)":"var(--border)",background:m?"var(--bg-active)":"var(--bg-raised)"},children:[o.jsx("span",{className:"mono text-body font-semibold",style:{color:m?"var(--accent)":"var(--fg-3)"},children:"Other…"}),o.jsx("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:"Type a free-text answer."}),m?o.jsx("textarea",{ref:d,value:n.freeText,disabled:s,onChange:g=>c({...n,freeText:g.target.value}),onClick:g=>g.stopPropagation(),onKeyDown:g=>{g.key==="Enter"&&!g.metaKey&&!g.ctrlKey&&g.stopPropagation()},rows:2,className:"rounded-[var(--radius-input)] border text-body",style:{padding:"var(--sp-2)",borderColor:"var(--border)",background:"var(--bg-sunken)",color:"var(--fg)",resize:"vertical"}}):null]}):null]})]})}function nK(e){return kB.safeParse(e).success}function vT(e){return jB.safeParse(e).success}function rK(e){let t=-1;for(const s of e)s.kind==="turn_end"&&s.seq>t&&(t=s.seq);const n=e.filter(s=>s.kind==="turn_end"?!1:s.kind==="error"?!0:s.seq>t),a=new Map;for(const s of n){if(s.kind!=="tool_call")continue;const l=tj(s.payload);if(!l)continue;const c=a.get(l)??-1;s.seq>c&&a.set(l,s.seq)}return n.filter(s=>{if(s.kind!=="tool_call")return!0;const l=tj(s.payload);return l?a.get(l)===s.seq:!0})}function tj(e){if(typeof e!="object"||e===null)return;const t=e.toolUseId;return typeof t=="string"?t:void 0}function Do(e){const t=new Date(e),n=new Intl.DateTimeFormat("en-GB",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(t),a=s=>{var l;return((l=n.find(c=>c.type===s))==null?void 0:l.value)??""};return`${a("month")}/${a("day")} ${a("hour")}:${a("minute")}`}function aK(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function nj(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return"…"}}function iK({msg:e,myAgentId:t}){if(!t||e.senderId!==t)return null;const n=e.deliveryStatus??"sent";return n==="acked"?o.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},title:"Agent has started processing",children:"✓✓ read"}):n==="delivered"?o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},title:"Delivered to agent inbox",children:"✓✓"}):o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},title:"Sent",children:"✓ sent"})}function sK({event:e}){const t=pD(e.payload);if(!t)return null;const n=t.status==="error",a=t.status==="pending",s=n?"var(--state-error)":a?"var(--state-blocked)":"var(--fg-3)",l=n?"failed":a?"using":"used";return o.jsxs("div",{className:"mono flex items-center text-label",style:{gap:8,padding:"var(--sp-0_5) var(--sp-2)",color:"var(--fg-3)"},children:[a?o.jsx("span",{"aria-hidden":!0,style:{width:6,height:6,borderRadius:"50%",background:s,animation:"heartbeat-pulse 1.2s ease-in-out infinite",flexShrink:0,marginTop:5}}):o.jsx("span",{"aria-hidden":!0,style:{color:s,flexShrink:0},children:n?"⚠":"↳"}),o.jsxs("span",{className:"flex items-baseline",style:{color:"var(--fg-3)",minWidth:0,flex:1},title:t.args!==void 0&&t.args!==null?nj(t.args):void 0,children:[o.jsxs("span",{style:{whiteSpace:"nowrap",flexShrink:0},children:[l," ",o.jsx("span",{style:{color:"var(--fg-2)"},children:t.name})]}),t.args!==void 0&&t.args!==null?o.jsxs("span",{className:"truncate",style:{color:"var(--fg-4)",minWidth:0,flex:1},children:["(",nj(t.args),")"]}):null,t.durationMs!==void 0&&!a?o.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)",marginLeft:6,whiteSpace:"nowrap",flexShrink:0},children:["· ",aK(t.durationMs)]}):null]})]})}function lK({event:e,agentNameFn:t,agentId:n}){const a=yD(e.payload);if(!a||a.text.length===0)return null;const s=t(n);return o.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1) 0",opacity:.85},children:[o.jsx(Oh,{name:s,isSelf:!1}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[o.jsx("span",{className:"mono text-label font-semibold",style:{color:"var(--accent)"},children:s}),o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Do(e.createdAt)}),o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"· streaming"})]}),o.jsx("div",{className:"text-body",style:{color:"var(--fg-2)",whiteSpace:"pre-wrap",marginTop:2},children:a.text})]})]})}function oK({event:e}){return o.jsxs("div",{className:"mono flex items-center text-label",style:{gap:8,padding:"var(--sp-0_5) var(--sp-2)",color:"var(--fg-3)"},children:[o.jsx("span",{"aria-hidden":!0,style:{width:6,height:6,borderRadius:"50%",background:"var(--accent)",animation:"heartbeat-pulse 1.2s ease-in-out infinite",flexShrink:0}}),o.jsx("span",{style:{color:"var(--fg-3)"},children:"thinking…"}),o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Do(e.createdAt)})]})}function uK({event:e}){const t=gD(e.payload),n=Do(e.createdAt);return o.jsxs("div",{style:{padding:"var(--sp-1_5) var(--sp-2_5)",borderLeft:"var(--hairline-bold) solid var(--state-error)",background:"color-mix(in oklch, var(--state-error) 6%, transparent)",borderRadius:"0 var(--radius-input) var(--radius-input) 0"},children:[o.jsxs("div",{className:"mono uppercase text-caption",style:{color:"var(--state-error)"},children:["error · ",(t==null?void 0:t.source)??"unknown"," · ",n]}),o.jsx("div",{className:"text-label",style:{marginTop:2,color:"var(--fg-2)",whiteSpace:"pre-wrap"},children:(t==null?void 0:t.message)??"(invalid error payload)"})]})}function Oh({name:e,isSelf:t}){const n=e.slice(0,2).toUpperCase();return o.jsx("div",{className:"mono text-eyebrow font-bold",style:{width:20,height:20,borderRadius:"var(--radius-input)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,background:t?"linear-gradient(135deg, var(--accent), oklch(0.58 0.14 170))":"var(--bg-active)",border:t?"none":"var(--hairline) solid var(--border-strong)",color:t?"oklch(0.14 0.01 150)":"var(--fg-2)"},children:t?n:o.jsx(Ic,{width:9,height:10,style:{color:"var(--accent)"}})})}function cK({msg:e,myAgentId:t,agentNameFn:n}){const a=n(e.senderId),s=t===e.senderId;return o.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[o.jsx(Oh,{name:a,isSelf:s}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[o.jsx("span",{className:"mono text-body font-semibold",style:{color:s?"var(--fg)":"var(--accent)"},children:a}),o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Do(e.createdAt)}),o.jsx("span",{style:{marginLeft:"auto"},children:o.jsx(iK,{msg:e,myAgentId:t})})]}),o.jsx("div",{className:"text-body",style:{color:"var(--fg)",marginTop:2},children:e.format==="file"&&dK(e.content)?o.jsx("img",{src:`data:${e.content.mimeType};base64,${e.content.data}`,alt:e.content.filename??"image",style:{maxWidth:320,borderRadius:"var(--radius-panel)",marginTop:4}}):e.format==="file"&&fK(e.content)?o.jsx(hK,{content:e.content}):e.format==="text"?o.jsx(Rh,{children:typeof e.content=="string"?e.content:JSON.stringify(e.content)}):o.jsx("pre",{className:"mono text-label",style:{background:"var(--bg-sunken)",padding:8,borderRadius:"var(--radius-input)",overflow:"auto",maxHeight:160},children:JSON.stringify(e.content,null,2)})})]})]})}function dK(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.data=="string"&&typeof t.mimeType=="string"&&t.mimeType.startsWith("image/")}function fK(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 hK({content:e}){const[t,n]=x.useState({kind:"loading"});return x.useEffect(()=>{let a=!1;return EQ(e.imageId).then(s=>{a||n(s?{kind:"hit",src:`data:${s.mimeType};base64,${s.base64}`}:{kind:"miss"})}),()=>{a=!0}},[e.imageId]),t.kind==="hit"?o.jsx("img",{src:t.src,alt:e.filename,style:{maxWidth:320,borderRadius:"var(--radius-panel)",marginTop:4}}):t.kind==="miss"?o.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)",fontStyle:"italic"},children:['[Image "',e.filename,'" not available on this device]']}):o.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:"…"})}function mK({msg:e,chatId:t,content:n,answer:a,status:s,agentNameFn:l}){const c=l(e.senderId);return o.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[o.jsx(Oh,{name:c,isSelf:!1}),o.jsxs("div",{className:"min-w-0 flex flex-col",style:{gap:"var(--sp-1)"},children:[o.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[o.jsx("span",{className:"mono text-body font-semibold",style:{color:"var(--accent)"},children:c}),o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Do(e.createdAt)})]}),o.jsx(eK,{chatId:t,questionMessageId:e.id,content:n,answer:a,status:s})]})]})}function pK({msg:e,agentNameFn:t}){const n=vT(e.content)?e.content:null,a=t(e.senderId),s=n?Object.entries(n.answers).map(([l,c])=>`${l.replace(/\s+\?$/u,"?")}: ${c}`).join(" · "):"(answer)";return o.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[o.jsx(Oh,{name:a,isSelf:!0}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[o.jsx("span",{className:"mono text-body font-semibold",style:{color:"var(--fg)"},children:a}),o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Do(e.createdAt)}),o.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:"answered question"})]}),o.jsx("div",{className:"text-body",style:{color:"var(--fg-2)",marginTop:2},children:s})]})]})}function rj({agentId:e,chatId:t,readOnly:n=!1,titleFallback:a,joinAction:s}){var gt;const l=hn(),c=gh(),d=zv(),{agentId:m}=pt(),[h,g]=x.useState(""),[p,b]=x.useState(0),[w,S]=x.useState([]),[j,E]=x.useState(!1),[C,_]=x.useState(null),z=x.useRef(null),M=x.useRef(null),L=x.useRef(null),O=x.useRef(!1),F=x.useRef(new Set);x.useEffect(()=>{O.current=!1},[t]);const{data:P}=Ke({queryKey:["chat-messages",t],queryFn:()=>pQ(t,{limit:50}),refetchInterval:5e3}),{data:V}=Ke({queryKey:["session-events",e,t],queryFn:()=>vD(e,t,{limit:200,direction:"desc"}),refetchInterval:5e3}),{data:I}=Ke({queryKey:["chat-detail",t],queryFn:()=>cT(t),enabled:!!t}),{data:Q}=Ke({queryKey:["activity"],queryFn:zc,refetchInterval:15e3}),ie=xt({mutationFn:ae=>ko(t,ae),onSuccess:()=>{g(""),l.invalidateQueries({queryKey:["chat-messages",t]}),l.invalidateQueries({queryKey:WS(e)})}}),be=x.useCallback(ae=>{const De=ae.filter(en=>en.type.startsWith("image/"));if(De.length===0)return;const Ye=De.find(en=>en.size>5242880);if(Ye){_(`Image too large (${(Ye.size/1024/1024).toFixed(1)}MB). Maximum ${5242880/1024/1024}MB per image.`);return}const mn=De.map(en=>({id:crypto.randomUUID(),file:en,previewUrl:URL.createObjectURL(en)}));S(en=>[...en,...mn]),_(null)},[]),X=x.useCallback(ae=>{S(je=>{const De=je.find(Ye=>Ye.id===ae);return De&&URL.revokeObjectURL(De.previewUrl),je.filter(Ye=>Ye.id!==ae)})},[]),W=async()=>{const ae=h.trim(),je=w;if(!(!ae&&je.length===0)&&!j&&!(me&&Ge.length===0)){if(Be.length>0)try{await uT(t,{participantIds:Be}),await l.invalidateQueries({queryKey:["chat-detail",t]})}catch(De){_(De instanceof Error?De.message:"Failed to add participants");return}if(je.length>0){E(!0),_(null);try{for(const De of je){const Ye=await mQ(De.file),mn=crypto.randomUUID();await CQ({imageId:mn,base64:Ye,mimeType:De.file.type}),await hQ(t,{data:Ye,mimeType:De.file.type,filename:De.file.name,size:De.file.size,imageId:mn}),URL.revokeObjectURL(De.previewUrl)}S([]),ae&&await ko(t,ae),g(""),l.invalidateQueries({queryKey:["chat-messages",t]}),l.invalidateQueries({queryKey:WS(e)})}catch(De){_(De instanceof Error?De.message:"Failed to send image")}finally{E(!1)}return}ie.mutate(ae)}},[q,ne]=x.useState(!1),[we,Re]=x.useState(""),R=x.useRef(null);x.useEffect(()=>{var ae;q&&((ae=R.current)==null||ae.focus())},[q]);const D=xt({mutationFn:ae=>fQ(t,ae),onSuccess:()=>{ne(!1),l.invalidateQueries({queryKey:["chat-detail",t]}),l.invalidateQueries({queryKey:["agent-sessions",e]}),l.invalidateQueries({queryKey:["session",e,t]})}}),U=()=>{const ae=we.trim();D.mutate(ae.length>0?ae:null)},T=x.useMemo(()=>{const ae=(P==null?void 0:P.items)??[],je=rK((V==null?void 0:V.items)??[]),De=[...ae.map(Ye=>({kind:"message",at:Ye.createdAt,key:`m-${Ye.id}`,data:Ye})),...je.map(Ye=>({kind:"event",at:Ye.createdAt,key:`e-${Ye.id}`,data:Ye}))];return De.sort((Ye,mn)=>Ye.at.localeCompare(mn.at)),De},[P,V]),Z=x.useMemo(()=>{const ae=new Map;for(const je of(P==null?void 0:P.items)??[])je.format==="question_answer"&&vT(je.content)&&ae.set(je.content.correlationId,je.content);return ae},[P]),Y=T.length;x.useEffect(()=>{var ae;Y>0&&((ae=L.current)==null||ae.scrollIntoView({behavior:"smooth"}))},[Y]);const ue=c(e),Se=x.useMemo(()=>{var ae;return new Set(((ae=I==null?void 0:I.participants)==null?void 0:ae.map(je=>je.agentId))??[])},[I==null?void 0:I.participants]),ve=x.useMemo(()=>{const ae=new Set;for(const De of(I==null?void 0:I.participants)??[])ae.add(De.agentId);for(const De of(Q==null?void 0:Q.agents)??[])ae.add(De.agentId);ae.size===0&&ae.add(e);const je=[];for(const De of ae){if(De===m)continue;const Ye=d(De);!Ye||!Ye.name||je.push({agentId:De,name:Ye.name,displayName:Ye.displayName})}return je},[I==null?void 0:I.participants,Q==null?void 0:Q.agents,e,d,m]),me=x.useMemo(()=>{if(!I)return!1;if(I.type==="group")return!0;const ae=I.participants.some(je=>je.agentId===m);return I.type==="direct"&&!ae&&I.participants.length>=2},[I,m]);x.useEffect(()=>{if(n||F.current.has(t)||!P||!V||!I||T.length>0||h.length>0||me||ue===e)return;const ae=`Hi ${ue}! What can you help with?`;g(ae),b(ae.length),F.current.add(t),requestAnimationFrame(()=>{const je=M.current;je&&(je.focus(),je.setSelectionRange(ae.length,ae.length))})},[t,e,P,V,I,T.length,h.length,ue,me,n]);const Ge=x.useMemo(()=>{const ae=ve.map(je=>({agentId:je.agentId,name:je.name}));return fN(h,ae)},[h,ve]),Be=x.useMemo(()=>Se.size===0?[]:Ge.filter(ae=>!Se.has(ae)),[Ge,Se]),vt=dT({value:h,cursor:p,candidates:ve,disabled:ie.isPending||j,onSelect:ae=>{g(ae.text),b(ae.cursor),requestAnimationFrame(()=>{const je=M.current;je&&(je.focus(),je.setSelectionRange(ae.cursor,ae.cursor))})}});return o.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[o.jsx("div",{className:"shrink-0",style:{padding:"var(--sp-2_5) var(--sp-6)",borderBottom:"var(--hairline) solid var(--border)"},children:o.jsxs("div",{className:"flex items-center",style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%",gap:10},children:[o.jsx("div",{className:"flex items-center min-w-0",style:{gap:8,flex:1},children:n?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"truncate text-subtitle min-w-0",style:{color:"var(--fg)"},children:(I==null?void 0:I.title)??a??"…"}),o.jsx("span",{className:"mono uppercase text-eyebrow shrink-0",style:{padding:"var(--hairline) var(--sp-1_25)",borderRadius:2,color:"var(--fg-3)",background:"var(--bg-sunken)"},children:"watching"})]}):q?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:R,value:we,onChange:ae=>Re(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"?(ae.preventDefault(),U()):ae.key==="Escape"&&(ae.preventDefault(),ne(!1))},disabled:D.isPending,maxLength:500,placeholder:(I==null?void 0:I.title)??"Chat name",className:"outline-none text-subtitle",style:{fieldSizing:"content",minWidth:200,maxWidth:480,color:"var(--fg)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",padding:"var(--sp-0_5) var(--sp-1_5)"}}),o.jsx("button",{type:"button",onClick:U,disabled:D.isPending,title:"Save",className:"inline-flex items-center",style:{color:"var(--accent)",padding:2},children:o.jsx(ur,{className:"h-3.5 w-3.5"})}),o.jsx("button",{type:"button",onClick:()=>ne(!1),disabled:D.isPending,title:"Cancel",className:"inline-flex items-center",style:{color:"var(--fg-3)",padding:2},children:o.jsx(ss,{className:"h-3.5 w-3.5"})})]}):o.jsx("button",{type:"button",onClick:()=>{Re((I==null?void 0:I.topic)??""),ne(!0)},title:"Click to rename",className:"truncate text-subtitle text-left min-w-0",style:{color:"var(--fg)",background:"transparent",border:"none",padding:0,cursor:"pointer"},children:(I==null?void 0:I.title)??"…"})}),o.jsx(gK,{chatId:t,participantIds:((gt=I==null?void 0:I.participants)==null?void 0:gt.map(ae=>ae.agentId))??[e],candidates:ve,agentIdentity:d,onAdded:()=>l.invalidateQueries({queryKey:["chat-detail",t]}),readOnly:n})]})}),o.jsx("div",{className:"flex-1 overflow-y-auto relative",style:{padding:"var(--sp-2_5) var(--sp-6)"},children:o.jsxs("div",{style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%"},children:[Y===0&&o.jsxs("div",{className:"flex flex-col items-center text-body",style:{color:"var(--fg-3)",padding:"var(--sp-8) 0",gap:6},children:[o.jsx(wv,{className:"h-8 w-8",style:{opacity:.3}}),n?"No messages yet":"Send a message to start the conversation"]}),o.jsx("div",{className:"flex flex-col",style:{gap:4},children:T.map(ae=>{if(ae.kind==="event"){const De=ae.data;switch(De.kind){case"tool_call":return o.jsx(sK,{event:De},ae.key);case"assistant_text":return o.jsx(lK,{event:De,agentId:e,agentNameFn:c},ae.key);case"thinking":return o.jsx(oK,{event:De},ae.key);case"error":return o.jsx(uK,{event:De},ae.key);default:return null}}const je=ae.data;if(je.format==="question"&&nK(je.content)){const De=Z.get(je.content.correlationId)??null,Ye=De?"answered":"pending";return o.jsx(mK,{msg:je,chatId:t,content:je.content,answer:De,status:Ye,agentNameFn:c},ae.key)}return je.format==="question_answer"?o.jsx(pK,{msg:je,agentNameFn:c},ae.key):o.jsx(cK,{msg:je,myAgentId:m,agentNameFn:c},ae.key)})}),o.jsx("div",{ref:L})]})}),o.jsx("div",{className:"shrink-0",style:{padding:"var(--sp-2_5) var(--sp-6) var(--sp-3)"},children:o.jsx("div",{style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%"},children:n?o.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-3)",padding:"var(--sp-2) var(--sp-3)",border:"var(--hairline) solid var(--border)",borderRadius:6,background:"var(--bg-sunken)"},children:[o.jsx(dC,{className:"h-4 w-4 shrink-0",style:{color:"var(--fg-3)"}}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-body",style:{color:"var(--fg-2)"},children:"You're watching this chat — read-only."}),(s==null?void 0:s.error)&&o.jsx("div",{className:"mono text-label",style:{color:"var(--state-error)",marginTop:2},children:s.error})]}),s&&o.jsx(pe,{type:"button",variant:"secondary",size:"sm",className:"shrink-0",onClick:s.onJoin,disabled:s.joining,children:s.joining?"Joining…":"Join to reply"})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{position:"relative",border:"var(--hairline) solid var(--border)",borderRadius:6,background:"var(--bg-sunken)"},onDragOver:ae=>ae.preventDefault(),onDrop:ae=>{ae.preventDefault(),be(Array.from(ae.dataTransfer.files))},children:[w.length>0&&o.jsx("div",{className:"flex items-center",style:{gap:6,padding:"var(--sp-1_5) var(--sp-2_5) 0",overflowX:"auto"},children:w.map(ae=>o.jsxs("div",{style:{position:"relative",flexShrink:0,borderRadius:4,border:"var(--hairline) solid var(--border)",overflow:"hidden"},children:[o.jsx("img",{src:ae.previewUrl,alt:ae.file.name,style:{height:32,width:"auto",display:"block",objectFit:"cover"}}),o.jsx("button",{type:"button",onClick:()=>X(ae.id),style:{position:"absolute",top:1,right:1,width:14,height:14,borderRadius:"50%",background:"var(--color-overlay-scrim)",border:"none",color:"var(--bg-raised)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0},children:o.jsx(ss,{className:"h-2 w-2"})})]},ae.id))}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx(fT,{trigger:vt.trigger,results:vt.results,highlightIndex:vt.highlightIndex,anchorRef:M,onPick:vt.pick}),o.jsx("textarea",{ref:M,value:h,onChange:ae=>{g(ae.target.value),b(ae.target.selectionStart??ae.target.value.length)},onSelect:ae=>{b(ae.currentTarget.selectionStart??h.length)},onFocus:()=>{me&&(O.current||h.length>0||ve.length===0||(O.current=!0,g("@"),b(1),requestAnimationFrame(()=>{const ae=M.current;ae&&ae.setSelectionRange(1,1)})))},onPaste:ae=>{const je=Array.from(ae.clipboardData.files);je.length>0&&(ae.preventDefault(),be(je))},placeholder:me?"Type @ to pick a recipient, then your message":`Message @${ue} · / for commands · @ to mention`,rows:2,onKeyDown:ae=>{vt.handleKey(ae)||ae.key==="Enter"&&!ae.shiftKey&&(ae.preventDefault(),W())},disabled:ie.isPending||j,className:"w-full outline-none text-subtitle font-normal",style:{padding:"var(--sp-2_25) var(--sp-3) var(--sp-7_5)",background:"transparent",border:"none",resize:"none",color:"var(--fg)"}})]}),o.jsxs("div",{className:"flex items-center justify-between text-caption",style:{position:"absolute",bottom:6,left:10,right:10,color:"var(--fg-4)"},children:[o.jsxs("span",{className:"mono flex items-center",style:{gap:10},children:[o.jsx("button",{type:"button",onClick:()=>{const ae=M.current;if(!ae)return;const je=ae.selectionStart??h.length,De=ae.selectionEnd??je,Ye=`${h.slice(0,je)}@${h.slice(De)}`;g(Ye),b(je+1),requestAnimationFrame(()=>{ae.focus(),ae.setSelectionRange(je+1,je+1)})},title:"Mention an agent (or type @)",style:{background:"none",border:"none",cursor:"pointer",color:"var(--fg-3)",padding:0,display:"inline-flex",alignItems:"center"},children:o.jsx(_z,{className:"h-3.5 w-3.5"})}),o.jsx("button",{type:"button",onClick:()=>{var ae;return(ae=z.current)==null?void 0:ae.click()},title:"Attach image",style:{background:"none",border:"none",cursor:"pointer",color:"var(--fg-3)",padding:0,display:"inline-flex",alignItems:"center"},children:o.jsx(aM,{className:"h-3.5 w-3.5"})}),o.jsx("input",{ref:z,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:ae=>{ae.target.files&&(be(Array.from(ae.target.files)),ae.target.value="")}})]}),o.jsxs("span",{className:"flex items-center",style:{gap:8},children:[j&&o.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},children:"uploading…"}),o.jsx("button",{type:"button",onClick:W,disabled:ie.isPending||j||!h.trim()&&w.length===0||me&&Ge.length===0,title:me&&Ge.length===0?"Pick at least one recipient with @ before sending in a group chat":"Send (Enter)","aria-label":"Send",className:Oe("inline-flex items-center justify-center transition-opacity",(ie.isPending||j||!h.trim()&&w.length===0||me&&Ge.length===0)&&"opacity-40 cursor-not-allowed"),style:{width:28,height:28,borderRadius:"var(--radius-input)",background:"var(--fg)",color:"var(--bg-raised)",border:"none"},children:o.jsx(uC,{className:"h-3.5 w-3.5",strokeWidth:2.5})})]})]})]}),(ie.isError||C)&&o.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)",padding:"var(--sp-1_5) var(--sp-0_5) 0"},children:C??(ie.error instanceof Error?ie.error.message:"Failed to send")})]})})})]})}function gK({chatId:e,participantIds:t,candidates:n,agentIdentity:a,onAdded:s,readOnly:l=!1}){const[c,d]=x.useState(!1),m=x.useRef(null);x.useEffect(()=>{if(!c)return;const p=b=>{m.current&&(m.current.contains(b.target)||d(!1))};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[c]);const h=xt({mutationFn:p=>uT(e,{participantIds:[p]}),onSuccess:()=>{d(!1),s()}}),g=x.useMemo(()=>n.filter(p=>!t.includes(p.agentId)),[n,t]);return o.jsxs("div",{className:"inline-flex items-center flex-wrap",style:{gap:4},children:[t.map(p=>{const b=a(p),w=(b==null?void 0:b.displayName)??(b==null?void 0:b.name)??p.slice(0,8);return o.jsx("span",{className:"inline-flex items-center text-label",style:{padding:"var(--sp-0_5) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"var(--bg-sunken)",color:"var(--fg-2)"},children:w},p)}),!l&&o.jsxs("div",{ref:m,style:{position:"relative"},children:[o.jsx("button",{type:"button",onClick:()=>d(!c),disabled:g.length===0||h.isPending,title:g.length===0?"All available agents are already in this chat":"Add participant","aria-label":"Add participant",className:"inline-flex items-center transition-colors hover:bg-[var(--bg-sunken)]",style:{padding:"var(--sp-0_5) var(--sp-1)",borderRadius:"var(--radius-chip)",border:"var(--hairline) solid var(--border)",background:"transparent",color:g.length===0?"var(--fg-4)":"var(--fg-3)",cursor:g.length===0?"not-allowed":"pointer"},children:o.jsx(ba,{className:"h-3 w-3"})}),c&&g.length>0&&o.jsx("div",{role:"listbox","aria-label":"Add participant",className:"absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg",style:{top:"calc(100% + var(--sp-1))",right:0,minWidth:280,background:"var(--bg-raised)",borderColor:"var(--border)"},children:(()=>{const p=Sb(g);return g.map(b=>o.jsx("button",{type:"button",role:"option","aria-selected":"false",title:b.name?`@${b.name}`:void 0,onClick:()=>h.mutate(b.agentId),disabled:h.isPending,className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:o.jsx(kb,{candidate:b,ambiguous:p})},b.agentId))})()})]})]})}function aj(e,t){return e?e.find(n=>n.chatId===t)??null:null}function yK(e,t){var s;const n=e.filter(l=>l.agentId!==t),a=n.find(l=>l.type!==void 0&&l.type!=="human");return a?a.agentId:((s=n[0])==null?void 0:s.agentId)??null}function vK({chatId:e}){const t=hn(),{agentId:n}=pt(),a=x.useRef(new Map),{data:s}=Ke({queryKey:["chat-detail",e],queryFn:()=>cT(e),enabled:!!e}),{data:l}=Ke({queryKey:["me","chats","all"],queryFn:()=>nh({filter:"all"}),refetchInterval:3e4}),{data:c}=Ke({queryKey:["me","chats","watching"],queryFn:()=>nh({filter:"watching"}),refetchInterval:3e4}),d=x.useMemo(()=>aj(l==null?void 0:l.rows,e)??aj(c==null?void 0:c.rows,e)??null,[l,c,e]),m=x.useMemo(()=>d?d.participants.map(j=>({agentId:j.agentId,type:j.type})):s?s.participants.map(j=>({agentId:j.agentId,type:void 0})):[],[d,s]),h=x.useMemo(()=>yK(m,n),[m,n]),p=xt({mutationFn:()=>lQ(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]})}}).mutate,b=(d==null?void 0:d.lastMessageAt)??"";x.useEffect(()=>{!d||a.current.get(e)===b||(a.current.set(e,b),p())},[e,d,b,p]);const w=xt({mutationFn:()=>oQ(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]}),t.invalidateQueries({queryKey:["chat-detail",e]})}}),S=(d==null?void 0:d.membershipKind)==="watching";return h?S?o.jsx(rj,{agentId:h,chatId:e,readOnly:!0,titleFallback:(d==null?void 0:d.title)??null,joinAction:{onJoin:()=>w.mutate(),joining:w.isPending,error:w.isError?w.error instanceof Error?w.error.message:"Failed to join":null}}):o.jsx(rj,{agentId:h,chatId:e}):o.jsx("div",{className:"flex-1 flex items-center justify-center",style:{padding:"var(--sp-8)"},children:o.jsxs("div",{className:"text-center",style:{color:"var(--fg-3)"},children:[o.jsx("div",{className:"text-subtitle",style:{color:"var(--fg-2)",marginBottom:6},children:"Loading chat…"}),o.jsx("div",{className:"text-body",children:"Resolving participants."})]})})}function bK(){return o.jsx("div",{className:"flex-1 flex items-center justify-center p-8",children:o.jsxs("div",{className:"text-center max-w-sm",children:[o.jsx(Ic,{width:36,height:40,className:"mx-auto mb-3 text-primary opacity-60"}),o.jsx("div",{className:"text-subtitle mb-1",children:"Select a chat"}),o.jsx("div",{className:"text-body text-muted-foreground",children:"Pick an agent from the roster to view its sessions, or open a chat to start collaborating."})]})})}async function ui(e,t){try{await Ce.post("/me/onboarding/events",{event:e,attrs:t})}catch{}}function xK({organizationId:e,onContinue:t}){const[n,a]=x.useState([]),[s,l]=x.useState(""),[c,d]=x.useState(""),[m,h]=x.useState(!1),[g,p]=x.useState(null),[b,w]=x.useState(!1),[S,j]=x.useState(null),E=x.useRef(null);x.useEffect(()=>{(async()=>{try{const M=await Ce.get("/me/organizations");a(M)}catch(M){j(M instanceof Error?M.message:"Failed to load your team")}finally{w(!0)}})()},[]),x.useEffect(()=>{var L;const M=((L=n.find(O=>O.id===e))==null?void 0:L.displayName)??"";l(M),d(M)},[n,e]),x.useEffect(()=>{const M=E.current;if(!M||!c)return;M.focus();const L=M.value.length;M.setSelectionRange(L,L)},[c]);const C=s.trim(),_=C.length>0&&!m&&b&&!S,z=x.useCallback(async M=>{if(M==null||M.preventDefault(),!(!_||!e)){p(null);try{C!==c.trim()&&(h(!0),await Ce.patch(`/orgs/${encodeURIComponent(e)}`,{displayName:C}),ui("team_renamed")),t()}catch(L){p(L instanceof Error?L.message:"Failed to rename team")}finally{h(!1)}}},[_,e,C,c,t]);return o.jsxs("form",{onSubmit:z,className:"flex flex-col",style:{gap:"var(--sp-5)"},children:[o.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)"},children:["Name your ",o.jsx("span",{style:{color:"var(--fg-2)"},children:"agent team"})," — where humans and AIs collaborate."]}),o.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[o.jsx("label",{htmlFor:"onboarding-team-name",className:"text-label",style:{color:"var(--fg-3)"},children:"Team name"}),o.jsx("input",{ref:E,id:"onboarding-team-name","aria-label":"Team display name",value:s,onChange:M=>l(M.target.value),maxLength:200,disabled:m,className:"text-body",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)",outline:"none",caretColor:"var(--accent)"},onFocus:M=>{M.currentTarget.style.borderColor="var(--accent)"},onBlur:M=>{M.currentTarget.style.borderColor="var(--border)"}})]}),g||S?o.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:g??`Couldn't load your team — ${S}. Refresh the page and try again.`}):null,o.jsx("div",{className:"flex justify-end",children:o.jsxs(pe,{type:"submit",disabled:!_,children:[o.jsx("span",{children:"Continue"}),o.jsx(oC,{className:"h-4 w-4"})]})})]})}function jb(){return o.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:"var(--sp-5)",bottom:"var(--sp-5)",left:"calc(var(--sp-2_5) - var(--hairline))",width:"var(--hairline)",background:"color-mix(in oklch, var(--border-faint) 56%, transparent)"}})}function is({number:e,state:t,children:n}){const a=t==="active",s=t==="complete";return o.jsxs("section",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:"var(--sp-3)",marginTop:e==="01"?0:"var(--sp-5)",position:"relative"},children:[o.jsx("div",{className:"mono text-caption flex items-center justify-center",style:{width:"var(--sp-5)",height:"var(--sp-5)",borderRadius:999,background:a||s?"color-mix(in oklch, var(--accent) 8%, var(--bg))":"var(--bg)",border:a||s?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-faint)",color:a||s?"var(--accent)":"var(--fg-4)",zIndex:1},children:s?o.jsx(ur,{className:"h-3 w-3"}):e}),o.jsx("div",{style:{minHeight:"var(--sp-6)",paddingBottom:"var(--sp-1)"},children:n})]})}const wK=3e4,SK=1e3,kK=3e3;function jK(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function CK({organizationId:e,memberId:t,joinPath:n,refreshMe:a}){var Se;const s=Rn(),l=sz(e,t),c=oz(l),d=c!=null&&c.connectToken&&c.connectTokenExpiresAt&&c.connectTokenExpiresAt>Date.now()?c.connectToken:null,m=d?(c==null?void 0:c.connectTokenExpiresAt)??null:null,[h,g]=x.useState(()=>(c==null?void 0:c.displayName)??"Assistant"),[p,b]=x.useState(()=>(c==null?void 0:c.selectedRuntime)??null),[w,S]=x.useState(null),[j,E]=x.useState(null),[C,_]=x.useState(null),[z,M]=x.useState(()=>d),[L,O]=x.useState(()=>m),[F,P]=x.useState([]),[V,I]=x.useState("form"),[Q,ie]=x.useState(null),be=x.useRef(null),X=x.useRef(null),W=x.useRef(null),q=x.useRef(0);x.useEffect(()=>()=>{X.current&&(X.current.cancelled=!0)},[]),x.useEffect(()=>{uz(l,{displayName:h,selectedRuntime:p,connectToken:z,connectTokenExpiresAt:L})},[l,h,p,z,L]),x.useEffect(()=>{(async()=>{try{const ve=await Ce.get("/me/organizations");P(ve)}catch{}})()},[]),x.useEffect(()=>{if(V!=="form")return;let ve=!1;const me=async()=>{const Be=++q.current;try{const vt=await ls();if(ve||Be!==q.current)return;const ae=vt.filter(je=>je.status==="connected").sort((je,De)=>De.lastSeenAt.localeCompare(je.lastSeenAt))[0]??null;if(S(je=>(je==null?void 0:je.id)===(ae==null?void 0:ae.id)?je:ae),ae){W.current!==ae.id&&(W.current=null,_(null),E(null));try{const je=await Cv(ae.id);if(ve||Be!==q.current)return;W.current=ae.id,_(ae.id),E(je.capabilities)}catch{}}else W.current=null,_(null),E(null)}catch{}};me();const Ge=setInterval(me,kK);return()=>{ve=!0,clearInterval(Ge)}},[V]),x.useEffect(()=>{if(w)return;if(z&&L&&L>Date.now()){const me=Math.max(L-Date.now(),0),Ge=window.setTimeout(()=>{M(null),O(null)},me);return()=>window.clearTimeout(Ge)}z&&(M(null),O(null));let ve=!1;return(async()=>{try{const me=await Ce.post("/me/connect-tokens",{});ve||(M(me.token),O(Date.now()+me.expiresIn*1e3))}catch(me){ve||ie(me instanceof Error?me.message:"Failed to generate connect token")}})(),()=>{ve=!0}},[w,z,L]);const ne=w&&C===w.id?j:null;x.useEffect(()=>{b(ve=>{var Ge;if(!ne)return ve;const me=EK(ne);return ve&&me&&Object.keys(ne).includes(ve)&&((Ge=ne[ve])==null?void 0:Ge.state)==="ok"?ve:me})},[ne]);const we=ne?Object.entries(ne).filter(([,ve])=>ve.state==="ok").map(([ve])=>ve):[],Re=((Se=F.find(ve=>ve.id===e))==null?void 0:Se.displayName)??"",R=h.trim(),D=R||"your agent",U=z?`npm install -g @agent-team-foundation/first-tree-hub
|
|
398
|
+
first-tree-hub connect ${z}`:null,T=x.useCallback(async ve=>{X.current&&(X.current.cancelled=!0);const me={cancelled:!1};X.current=me;const Ge=Date.now();for(;!me.cancelled;){let Be=!1;try{const vt=await Ce.get(`/agents/${encodeURIComponent(ve)}/client-status`);if(me.cancelled)return;Be=vt.online===!0}catch{if(me.cancelled)return}if(Be){cz(l);try{await a()}catch{}if(me.cancelled)return;s("/",{replace:!0});return}if(Date.now()-Ge>wK){me.cancelled||I("timeout");return}await new Promise(vt=>setTimeout(vt,SK))}},[l,a,s]),Z=!!(R&&w&&p&&we.includes(p)&&V==="form"),Y=x.useCallback(async()=>{if(!w||!p||!R)return;ie(null),I("creating");const ve=Qy(R);let me;try{me=(await Ce.post(On("/agents"),{type:"personal_assistant",displayName:R,...ve?{name:ve}:{},clientId:w.id,runtimeProvider:p,...e?{organizationId:e}:{}})).uuid,be.current=me,az(me),ui("agent_created",{runtimeProvider:p})}catch(Ge){ie(Ge instanceof Error?Ge.message:"Failed to create agent"),I("form");return}await T(me)},[R,w,p,T,e]),ue=x.useCallback(async()=>{const ve=be.current;ve&&(ie(null),I("creating"),await T(ve))},[T]);return V==="creating"?o.jsx(zK,{nameOrFallback:D}):V==="timeout"?o.jsx(MK,{nameOrFallback:D,hostname:(w==null?void 0:w.hostname)??null,error:Q,onRetry:ue}):o.jsx(NK,{joinPath:n,teamName:Re,displayName:h,setDisplayName:g,trimmedName:R,connectedClient:w,cliCommand:U,capabilitiesLoaded:ne!==null,okRuntimes:we,selectedRuntime:p,setSelectedRuntime:b,error:Q,canCreate:Z,onCreate:Y})}function EK(e){const t=a=>{var s;return((s=e[a])==null?void 0:s.state)==="ok"};if(t("claude-code"))return"claude-code";if(t("codex"))return"codex";const n=Object.entries(e).find(([,a])=>a.state==="ok");return n?n[0]:null}function NK({joinPath:e,teamName:t,displayName:n,setDisplayName:a,trimmedName:s,connectedClient:l,cliCommand:c,capabilitiesLoaded:d,okRuntimes:m,selectedRuntime:h,setSelectedRuntime:g,error:p,canCreate:b,onCreate:w}){const S=x.useRef(null),j=e==="invite"&&t,E=d&&m.length===0&&!!l,C=s?l?E?"Install Claude Code (or Codex) on that computer, then sign in.":h?"Ready to create.":"Detecting installed runtimes…":"Next: connect the computer where they'll work.":"Next: name your agent.";return x.useEffect(()=>{var _;s||(_=S.current)==null||_.focus()},[s]),o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:j?o.jsxs(o.Fragment,{children:["You've joined"," ",o.jsx("span",{className:"font-semibold",style:{color:"var(--fg-2)"},children:t}),". Set up your first agent — it'll run on a computer you connect."]}):o.jsx(o.Fragment,{children:"Set up your first agent — it'll run on a computer you connect."})}),o.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[o.jsx(jb,{}),o.jsx(is,{number:"01",state:s?"complete":"active",children:o.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)",flexWrap:"wrap"},children:[o.jsx("label",{htmlFor:"onboarding-name",className:"text-body font-normal",style:{color:"var(--fg-2)",whiteSpace:"nowrap"},children:"Name your agent"}),o.jsx("input",{ref:S,id:"onboarding-name","aria-label":"Agent display name",value:n,onChange:_=>a(_.target.value),placeholder:"e.g. Buddy, Helper",maxLength:200,className:"onboarding-name-input text-body font-medium",style:{flex:"0 1 28ch",minWidth:"22ch",maxWidth:"30ch",padding:"var(--sp-0_5) 0",background:"transparent",border:0,borderBottom:"var(--hairline) solid var(--border-faint)",borderRadius:0,boxShadow:"none",color:"var(--fg)",outline:"none",caretColor:"var(--accent)",transition:"border-color 160ms ease, color 160ms ease"},onFocus:_=>{_.currentTarget.style.borderBottomColor="var(--accent)"},onBlur:_=>{_.currentTarget.style.borderBottomColor="var(--border-faint)"}})]})}),o.jsx(is,{number:"02",state:b?"complete":s?"active":"idle",children:o.jsxs("div",{style:{animation:s?"subtle-fade 200ms ease-out":void 0},children:[o.jsx("h2",{className:"text-subtitle font-semibold",style:{color:s?"var(--fg)":"var(--fg-4)",fontWeight:s?600:500},children:"Connect a computer"}),s?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:l?`${s} will run on this computer and stay connected to Hub.`:`${s} needs a computer to run on. Connect one with the command below.`}),!l&&o.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",marginTop:"var(--sp-2)"},children:"Open Terminal on that computer and run this command."}),l?o.jsxs(o.Fragment,{children:[o.jsx(RK,{hostname:l.hostname??l.id}),o.jsx(AK,{runtimes:m,selected:h,onSelect:g,capabilitiesLoaded:d})]}):o.jsxs(o.Fragment,{children:[o.jsx(_K,{command:c}),o.jsx(TK,{})]})]}):null]})})]}),p&&o.jsx("div",{className:"text-body",style:{marginTop:"var(--sp-4)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:p}),s&&o.jsxs("div",{style:{marginTop:b?"var(--sp-4)":"var(--sp-5)",marginLeft:"calc(var(--sp-5) + var(--sp-3))",animation:"subtle-fade 180ms ease-out"},children:[!b&&o.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-4)"},children:C}),b&&o.jsxs(pe,{type:"button",size:"default",style:{marginTop:0,border:"var(--hairline) solid color-mix(in oklch, var(--accent) 32%, transparent)",background:"var(--accent)",boxShadow:"var(--shadow-md)",color:"var(--primary-foreground, var(--color-primary-foreground))",opacity:1,transform:"translateZ(0)",transition:"box-shadow 160ms ease, transform 160ms ease"},onClick:w,onMouseEnter:_=>{_.currentTarget.style.transform="scale(1.01)",_.currentTarget.style.boxShadow="var(--shadow-md)"},onMouseLeave:_=>{_.currentTarget.style.transform="scale(1)",_.currentTarget.style.boxShadow="var(--shadow-md)"},children:[o.jsxs("span",{children:["Create ",s]}),o.jsx(oC,{className:"h-4 w-4"})]}),o.jsx("p",{className:"text-caption",style:{margin:b?"var(--sp-2) 0 0":"var(--sp-0_5) 0 0",color:"var(--fg-4)"},children:"You can customize this agent after setup."})]})]})}function _K({command:e}){const[t,n]=x.useState(!1),s=(e?e.split(`
|
|
399
|
+
`):[]).find(m=>m.startsWith("first-tree-hub"))??"",l="first-tree-hub connect ",c=s.startsWith(l)?`${l}${s.slice(l.length,l.length+22)}…`:s.length>52?`${s.slice(0,52)}…`:s,d=async()=>{e&&(await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500))};return o.jsx("div",{style:{marginTop:"var(--sp-2)"},children:o.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[o.jsx("pre",{className:"mono text-label",title:s,style:{flex:1,minHeight:38,margin:0,padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--bg-sunken) 42%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--border-faint) 58%, transparent)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",whiteSpace:"nowrap",overflow:"hidden",minWidth:0},children:c||"Generating token…"}),o.jsxs(pe,{type:"button",variant:"outline",size:"sm",onClick:d,disabled:!e,style:{alignSelf:"stretch",background:"color-mix(in oklch, var(--bg-raised) 48%, transparent)",borderColor:"color-mix(in oklch, var(--border) 58%, transparent)",boxShadow:"none",height:"auto",minHeight:38},children:[t?o.jsx(ur,{className:"h-3.5 w-3.5"}):o.jsx(ch,{className:"h-3.5 w-3.5"}),t?"Copied":"Copy"]})]})})}function TK(){return o.jsxs("div",{className:"flex items-center text-body",style:{gap:"var(--sp-2)",marginTop:"var(--sp-2_5)",color:"color-mix(in oklch, var(--accent) 24%, var(--fg-3))"},children:[o.jsx(OK,{}),o.jsx("span",{children:"Waiting for your computer…"})]})}function AK({runtimes:e,selected:t,onSelect:n,capabilitiesLoaded:a}){return e.length===0?o.jsx("p",{className:"text-label",style:{marginTop:"var(--sp-3)",color:"var(--fg-3)"},children:a?"No runtime ready on this computer. Install Claude Code or Codex, then check back.":"Detecting installed runtimes…"}):o.jsxs("div",{style:{marginTop:"var(--sp-3)"},children:[o.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Powered by"}),o.jsxs("fieldset",{className:"flex",style:{gap:"var(--sp-4)",flexWrap:"wrap",margin:0,padding:0,border:0},children:[o.jsx("legend",{className:"sr-only",children:"Runtime provider"}),e.map((s,l)=>{const c=t===s;return o.jsxs("label",{className:"onboarding-runtime-option inline-flex items-center text-body",style:{gap:"var(--sp-1_5)",padding:"var(--sp-1) 0",cursor:"pointer",color:c?"color-mix(in oklch, var(--accent) 30%, var(--fg))":"var(--fg)",fontWeight:c?600:400,animation:`onboarding-rise 220ms ease-out ${l*80}ms both`,transition:"color 160ms ease, opacity 160ms ease, transform 160ms ease"},children:[o.jsx("input",{type:"radio",name:"onboarding-runtime",value:s,checked:c,onChange:()=>n(s),className:"sr-only"}),o.jsx("span",{"aria-hidden":"true",className:"inline-flex items-center justify-center",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",borderRadius:"50%",border:c?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-strong)",background:c?"color-mix(in oklch, var(--accent) 8%, transparent)":"transparent",boxShadow:c?"0 0 0 var(--sp-0_5) color-mix(in oklch, var(--accent) 10%, transparent)":"none",transition:"border-color 160ms ease, background 160ms ease, box-shadow 160ms ease"},children:c&&o.jsx("span",{style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--accent)"}})}),jK(s)]},s)})]})]})}function RK({hostname:e}){return o.jsxs("div",{className:"inline-flex items-center text-body",style:{gap:"var(--sp-2)",marginTop:"var(--sp-2_5)",padding:"var(--sp-1_5) var(--sp-2_5)",borderRadius:999,background:"color-mix(in oklch, var(--accent) 10%, transparent)",color:"color-mix(in oklch, var(--accent) 26%, var(--fg))",animation:"onboarding-pop 260ms cubic-bezier(0.2, 0.9, 0.2, 1.15)"},children:[o.jsx(ur,{className:"h-3.5 w-3.5"}),o.jsxs("span",{children:[o.jsx("span",{className:"mono font-semibold",children:e})," connected"]})]})}function OK(){return o.jsxs("span",{"aria-hidden":"true",style:{position:"relative",display:"inline-block",width:8,height:8,flexShrink:0},children:[o.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--accent)"}}),o.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--accent)",animation:"ring-pulse 1.8s infinite",opacity:.55}})]})}function zK({nameOrFallback:e}){return o.jsxs("div",{className:"flex flex-col items-center text-center",style:{paddingTop:"var(--sp-12)",gap:"var(--sp-4)"},children:[o.jsxs("p",{className:"text-title",style:{color:"var(--fg)"},children:["Creating ",e,"…"]}),o.jsx(DK,{}),o.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Usually takes ~10 seconds"})]})}function MK({nameOrFallback:e,hostname:t,error:n,onRetry:a}){const s=t??"your computer";return o.jsxs("div",{className:"flex flex-col",style:{paddingTop:"var(--sp-8)",gap:"var(--sp-4)"},children:[o.jsxs("p",{className:"text-title",style:{color:"var(--fg)"},children:[e," is taking longer than expected."]}),n?o.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 10%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 25%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:n}):o.jsxs("div",{className:"text-body",style:{color:"var(--fg-2)"},children:[o.jsx("p",{children:"This usually means:"}),o.jsxs("ul",{style:{paddingLeft:"var(--sp-4)",listStyle:"disc",marginTop:"var(--sp-1_5)"},children:[o.jsxs("li",{children:["The runtime can't start on ",s," (missing API key, etc.)"]}),o.jsxs("li",{children:["The connection to ",s," dropped"]})]}),o.jsxs("p",{style:{marginTop:"var(--sp-2)"},children:["Fix it on ",s,", then click ",o.jsx("span",{className:"font-semibold",children:"Try again"}),"."]})]}),o.jsx("div",{className:"flex",style:{gap:"var(--sp-2)"},children:o.jsx(pe,{onClick:a,children:"Try again"})})]})}function DK(){return o.jsxs("span",{className:"flex items-center",style:{gap:6},children:[o.jsx(Hg,{delayMs:0}),o.jsx(Hg,{delayMs:160}),o.jsx(Hg,{delayMs:320})]})}function Hg({delayMs:e}){return o.jsx("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:"50%",background:"var(--accent)",animation:"heartbeat-pulse 1.2s ease-in-out infinite",animationDelay:`${e}ms`,display:"inline-block"}})}async function bT(){return(await Ce.get("/me/github/repos")).repos}const xT="https://github.com/agent-team-foundation/first-tree";function wT(e){return e.length===1?[`Source repo: ${e[0]}`]:["Source repos:",...e.map(t=>`- ${t}`)]}function Cb(e,t){const n=wT(e),a=e.length===1?"Bind my source repo to an existing context-tree.":"Bind my source repos to an existing context-tree.",s=e.length===1?"Your workspace already has the source repo cloned in a subdirectory; the first-tree skill will locate it. Use the first-tree CLI to install the skill in the source repo and write the binding metadata pointing at the existing tree, then open a PR back to the source with those changes. Walk me through the PR when it's up.":"Your workspace already has each source repo cloned in its own subdirectory; the first-tree skill will locate them. For every source repo, use the first-tree CLI to install the skill and write the binding metadata pointing at the existing tree, then open a PR back to that source repo. Walk me through each PR as it goes up.";return[a,"",...n,`Existing tree: ${t}`,"",s,"",`Reference: ${xT}`].join(`
|
|
400
|
+
`)}function IK(e){const t=wT(e),n=e.length===1?"Create a brand-new context-tree for my source repo.":"Create a brand-new context-tree for my source repos.",a=e.length===1?"Your workspace already has the source repo cloned in a subdirectory; the first-tree skill will locate it. Use the first-tree CLI to install the skill in the source, scaffold a sibling tree directory, and write the binding metadata. Then push that new tree directory up to GitHub as a sibling repo under the same owner as the source, and open a PR back to the source with the skill + binding files.":"Your workspace already has each source repo cloned in its own subdirectory; the first-tree skill will locate them. Scaffold ONE shared tree directory that all the source repos bind to. For every source repo, install the first-tree skill and write the binding metadata pointing at that shared tree. Push the new tree directory up to GitHub as its own repo — if all the source repos share a single GitHub owner, host the tree under that owner; otherwise ask me which owner to use before pushing. Then open a PR back to each source repo with its skill + binding files.";return[n,"",...t,"",a,"","Once you know the URL of the new tree repo, use the first-tree-hub CLI's `org bind-tree` command to record it on the Hub so future agents in this team can find it.","","When everything is up, walk me through what was created — which directory, which repo, which PRs.","",`Reference: ${xT}`].join(`
|
|
401
|
+
`)}function LK(){const{role:e}=pt();return e==="admin"?o.jsx(qK,{}):o.jsx(PK,{})}function PK(){var d,m;const{organizationId:e}=pt(),[t,n]=x.useState({kind:"loading"}),[a,s]=x.useState(0);if(x.useEffect(()=>{if(!e){n({kind:"loaded",tree:null,repos:null});return}let h=!1;return n({kind:"loading"}),(async()=>{try{const[g,p]=await Promise.all([vb(e),aT(e)]);if(h)return;n({kind:"loaded",tree:g,repos:p})}catch(g){if(h)return;n({kind:"error",message:g instanceof Error?g.message:"Failed to load team setup"})}})(),()=>{h=!0}},[e,a]),t.kind==="loading")return o.jsx(BK,{});if(t.kind==="error")return o.jsx(UK,{message:t.message,onRetry:()=>s(h=>h+1)});const l=((d=t.tree)==null?void 0:d.repo)??"",c=((m=t.repos)==null?void 0:m.repos)??[];return l&&c.length>0?o.jsx(FK,{treeUrl:l,teamRepos:c}):l?o.jsx($K,{treeUrl:l}):o.jsx(HK,{})}function UK({message:e,onRetry:t}){return o.jsxs("div",{style:{padding:"var(--sp-5) var(--sp-4)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-card)"},children:[o.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:"var(--fg)"},children:"Couldn't load your team's setup"}),o.jsxs("p",{className:"text-body",style:{marginTop:"var(--sp-2)",color:"var(--fg-3)"},children:[e,". This is usually a transient network issue."]}),o.jsx("div",{style:{marginTop:"var(--sp-3)"},children:o.jsx(pe,{type:"button",onClick:t,children:"Try again"})})]})}function BK(){return o.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)"},children:"Checking your team's setup…"})}function FK({treeUrl:e,teamRepos:t}){var j;const n=Rn(),{dismissOnboarding:a}=pt(),{addToast:s}=Lc(),[l,c]=x.useState(!1),[d,m]=x.useState(null),[h,g]=x.useState(()=>t.map(E=>E.url)),p=h.length>0,b=x.useCallback(E=>{g(C=>C.includes(E)?C.filter(_=>_!==E):[...C,E])},[]),w=x.useCallback(async()=>{if(h.length!==0){c(!0),m(null);try{const E=await Eb(),C=await jh(E.uuid);await Ch(E.uuid,{expectedVersion:C.version,payload:{gitRepos:h.map(M=>({url:M}))}});const _=await wb(E.uuid),z=Cb(h,e);try{await ko(_.id,z)}catch{}ui("tree_chat_started",{agentUuid:E.uuid,chatId:_.id,treeMode:"existing",joinPath:"invite"}),a(),n(`/?c=${encodeURIComponent(_.id)}`,{replace:!1})}catch(E){m(E instanceof Error?E.message:"Failed to start the chat"),c(!1)}}},[h,e,n,a]),S=x.useCallback(()=>{ui("tree_intro_dismissed",{joinPath:"invite"}),a(),s(Nb(n))},[a,s,n]);return o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Your team has already set up its ",o.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"}),". Confirm to bind your agent."]}),o.jsxs("div",{style:{marginTop:"var(--sp-5)",display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[o.jsx(Xy,{label:"Tree",value:e}),t.length===1?o.jsx(Xy,{label:"Source repo",value:((j=t[0])==null?void 0:j.url)??""}):o.jsxs("fieldset",{disabled:l,style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)",margin:0,padding:0,border:0},children:[o.jsx("legend",{className:"text-label",style:{color:"var(--fg-3)",padding:0,marginBottom:"var(--sp-1)"},children:"Pick the source repos to bind your agent to"}),t.map(E=>{const C=h.includes(E.url);return o.jsxs("label",{className:"text-body",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",background:C?"color-mix(in oklch, var(--accent) 8%, var(--bg))":"var(--bg)",border:C?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",cursor:l?"not-allowed":"pointer",color:C?"var(--fg)":"var(--fg-2)",fontWeight:C?600:400},children:[o.jsx("input",{type:"checkbox",value:E.url,checked:C,onChange:()=>b(E.url),className:"sr-only"}),o.jsx("span",{"aria-hidden":"true",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:C?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border)",borderRadius:"var(--radius-chip)",background:C?"var(--accent)":"transparent",color:"var(--bg)",transition:"background 120ms ease, border-color 120ms ease"},children:C?o.jsx(ur,{className:"h-3 w-3",strokeWidth:3}):null}),o.jsx("span",{className:"mono truncate",style:{minWidth:0,flex:1},children:E.url})]},E.url)})]}),d?o.jsx(_b,{children:d}):null,o.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)"},children:[o.jsx(pe,{type:"button",disabled:!p||l,onClick:()=>void w(),children:l?"Starting…":"Confirm"}),o.jsx(pe,{type:"button",variant:"outline",onClick:S,disabled:l,children:"I'll do it later"})]})]})]})}function $K({treeUrl:e}){const t=Rn(),{dismissOnboarding:n}=pt(),{addToast:a}=Lc(),[s,l]=x.useState(!1),[c,d]=x.useState(null),[m,h]=x.useState(null),[g,p]=x.useState(null),[b,w]=x.useState([]),S=b.length>0,j=x.useCallback(_=>{w(z=>z.includes(_)?z.filter(M=>M!==_):[...z,_])},[]);x.useEffect(()=>{let _=!1;return(async()=>{try{const z=await bT();if(_)return;h(z)}catch(z){_||p(z instanceof Error?z.message:"Failed to list GitHub repositories")}})(),()=>{_=!0}},[]);const E=x.useCallback(async()=>{if(b.length!==0){l(!0),d(null);try{const _=await Eb(),z=await jh(_.uuid);await Ch(_.uuid,{expectedVersion:z.version,payload:{gitRepos:b.map(O=>({url:O}))}});const M=await wb(_.uuid),L=Cb(b,e);try{await ko(M.id,L)}catch{}ui("tree_chat_started",{agentUuid:_.uuid,chatId:M.id,treeMode:"existing",joinPath:"invite"}),n(),t(`/?c=${encodeURIComponent(M.id)}`,{replace:!1})}catch(_){d(_ instanceof Error?_.message:"Failed to start the chat"),l(!1)}}},[b,e,t,n]),C=x.useCallback(()=>{ui("tree_intro_dismissed",{joinPath:"invite"}),n(),a(Nb(t))},[n,a,t]);return o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Joining your team's ",o.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"}),". Pick the source repos you'll work with."]}),o.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[o.jsx(jb,{}),o.jsx(is,{number:"01",state:"complete",children:o.jsx(Xy,{label:"Tree",value:e})}),o.jsx(is,{number:"02",state:S?"complete":"active",children:o.jsx(ST,{disabled:s,repos:m,error:g,selectedRepoUrls:b,onToggle:j})}),o.jsxs(is,{number:"03",state:S?"active":"idle",children:[o.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:S?"var(--fg)":"var(--fg-4)",fontWeight:S?600:500},children:"Let your agent join the tree"}),S?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:["It'll install the skill and bind"," ",b.length>1?"each source repo":"your source repo"," to the existing team tree."]}),c?o.jsx(_b,{style:{marginTop:"var(--sp-3)"},children:c}):null,o.jsxs("div",{className:"flex",style:{marginTop:"var(--sp-3)",gap:"var(--sp-2)"},children:[o.jsx(pe,{type:"button",disabled:!S||s,onClick:()=>void E(),children:s?"Starting…":"Continue"}),o.jsx(pe,{type:"button",variant:"outline",onClick:C,disabled:s,children:"I'll do it later"})]})]}):null]})]})]})}function HK(){const{dismissOnboarding:e}=pt(),{addToast:t}=Lc(),n=x.useRef(!1);return x.useEffect(()=>{n.current||(n.current=!0,ui("tree_intro_dismissed",{joinPath:"invite",reason:"team_unconfigured"}),e(),t({title:"Your team admin hasn't finished setup",description:"Ask your admin to bind a context-tree and source repo. You can keep using your agent for general chat in the meantime."}))},[e,t]),o.jsxs("div",{style:{padding:"var(--sp-5) var(--sp-4)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-card)"},children:[o.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:"var(--fg)"},children:"Your team admin hasn't finished setup yet"}),o.jsx("p",{className:"text-body",style:{marginTop:"var(--sp-2)",color:"var(--fg-3)"},children:"Once they finish setup, this view will guide your agent to join. For now, your agent can help with anything that doesn't depend on your team's shared knowledge."})]})}function qK(){const e=Rn(),{dismissOnboarding:t,organizationId:n}=pt(),{addToast:a}=Lc(),[s,l]=x.useState(!1),[c,d]=x.useState(null),[m,h]=x.useState(null),[g,p]=x.useState(""),[b,w]=x.useState([]),[S,j]=x.useState(null),[E,C]=x.useState(null),_=x.useCallback(I=>{w(Q=>Q.includes(I)?Q.filter(ie=>ie!==I):[...Q,I])},[]);x.useEffect(()=>{let I=!1;return(async()=>{try{const Q=await bT();if(I)return;j(Q)}catch(Q){I||C(Q instanceof Error?Q.message:"Failed to list GitHub repositories")}})(),()=>{I=!0}},[]),x.useEffect(()=>{if(!n)return;let I=!1;return(async()=>{try{const Q=await vb(n);if(I)return;Q.repo&&(p(Q.repo),h(ie=>ie??"existing"))}catch{}})(),()=>{I=!0}},[n]);const z=g.trim(),M=(()=>{if(m!=="existing")return!0;if(!z)return!1;try{return new URL(z).protocol==="https:"}catch{return!1}})(),L=x.useCallback(()=>{ui("tree_intro_dismissed"),t(),a(Nb(e))},[t,a,e]),O=x.useCallback(async()=>{if(b.length!==0&&m&&!(m==="existing"&&!M)){d(null),l(!0);try{const I=await Eb(),Q=await jh(I.uuid),ie=b.map(W=>({url:W}));if(await Ch(I.uuid,{expectedVersion:Q.version,payload:{gitRepos:ie}}),n)try{await iT(n,{repos:ie})}catch(W){console.warn("Step 3: PUT source_repos failed; agent gitRepos already saved",W)}if(m==="existing"&&n)try{await rT(n,{repo:z})}catch(W){console.warn("Step 3: PUT context_tree settings failed; agent will still proceed",W),a({title:"Tree binding wasn't saved to Hub yet",description:"Your agent will still proceed. You can re-bind from Team Settings later."})}const be=await wb(I.uuid),X=m==="existing"?Cb(b,z):IK(b);try{await ko(be.id,X)}catch{}ui("tree_chat_started",{agentUuid:I.uuid,chatId:be.id,treeMode:m}),t(),e(`/?c=${encodeURIComponent(be.id)}`,{replace:!1})}catch(I){d(I instanceof Error?I.message:"Failed to start the tree-init chat"),l(!1)}}},[b,m,M,z,n,e,t,a]),F=b.length>0,P=F&&m!==null&&!s&&(m==="new"||M),V=!!m&&(m==="new"||M);return o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Build the ",o.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"})," — your team's shared knowledge that grows with your code."]}),o.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[o.jsx(jb,{}),o.jsx(is,{number:"01",state:F?"complete":"active",children:o.jsx(ST,{disabled:s,repos:S,error:E,selectedRepoUrls:b,onToggle:_})}),o.jsxs(is,{number:"02",state:V?"complete":F?"active":"idle",children:[o.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:F?"var(--fg)":"var(--fg-4)",fontWeight:F?600:500},children:"Bind or create the tree"}),F?o.jsxs("div",{style:{marginTop:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[o.jsxs("fieldset",{"aria-label":"Bind or create the tree",disabled:s,style:{display:"inline-flex",alignSelf:"flex-start",padding:"var(--sp-0_5)",margin:0,background:"var(--surface-2)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",gap:"var(--sp-0_5)"},children:[o.jsx("legend",{className:"sr-only",children:"Bind or create the tree"}),[{value:"existing",label:"Bind to an existing tree"},{value:"new",label:"Create a new tree"}].map(I=>{const Q=m===I.value;return o.jsxs("label",{className:"text-body transition-colors",style:{padding:"var(--sp-1_5) var(--sp-3)",background:Q?"var(--bg)":"transparent",borderRadius:"calc(var(--radius-input) - var(--sp-0_5))",color:Q?"var(--fg)":"var(--fg-3)",fontWeight:Q?600:400,boxShadow:Q?"var(--shadow-sm)":"none",cursor:s?"not-allowed":"pointer",userSelect:"none"},children:[o.jsx("input",{type:"radio",name:"tree-mode",value:I.value,checked:Q,onChange:()=>h(I.value),className:"sr-only"}),I.label]},I.value)})]}),m==="existing"?o.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1)"},children:[o.jsx("label",{htmlFor:"onboarding-existing-tree-url",className:"text-label",style:{color:"var(--fg-3)"},children:"Tree GitHub URL"}),o.jsx("input",{id:"onboarding-existing-tree-url",type:"url",value:g,onChange:I=>p(I.target.value),placeholder:"https://github.com/your-org/your-tree",disabled:s,className:"text-body",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)",outline:"none",fontFamily:"var(--font-mono)"}})]}):null,m==="new"?o.jsxs("p",{className:"text-label",style:{margin:0,color:"var(--fg-3)"},children:["Your agent will scaffold a new GitHub repo for the tree and bind"," ",b.length>1?"each selected source repo":"the source repo"," to it."]}):null]}):null]}),o.jsxs(is,{number:"03",state:V?"active":"idle",children:[o.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:V?"var(--fg)":"var(--fg-4)",fontWeight:V?600:500},children:"Let your agent build it"}),V?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:["It'll install the skill, set up the tree, and open a PR back to"," ",b.length>1?"each source repo":"your source repo","."]}),c?o.jsx(_b,{style:{marginTop:"var(--sp-3)"},children:c}):null,o.jsxs("div",{className:"flex",style:{marginTop:"var(--sp-3)",gap:"var(--sp-2)"},children:[o.jsx(pe,{type:"button",disabled:!P,onClick:()=>void O(),children:s?"Starting…":"Continue"}),o.jsx(pe,{type:"button",variant:"outline",onClick:L,disabled:s,children:"I'll do it later"})]})]}):null]})]})]})}async function Eb(){const e=rz(),t=await Ov(),n=t.filter(s=>s.type!=="human"),a=(e?t.find(s=>s.uuid===e):void 0)??n.slice().sort((s,l)=>l.uuid.localeCompare(s.uuid))[0]??t[0];if(!a)throw new Error("No agent available to chat with — finish Step 2 first.");return a}function Nb(e){return{title:"Setup hidden",description:"Resume any time in Settings → Onboarding. Your agent isn't bound to a source repo yet — add one in Agent settings when ready.",action:{label:"Open settings",onClick:()=>e("/settings/onboarding")}}}function Xy({label:e,value:t}){return o.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1)"},children:[o.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:e}),o.jsx("span",{className:"mono text-body truncate",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",minWidth:0},title:t,children:t})]})}function _b({children:e,style:t}){return o.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)",...t},children:e})}function ST({disabled:e,repos:t,error:n,selectedRepoUrls:a,onToggle:s}){const l=o.jsx("h2",{className:"text-subtitle font-semibold",style:{color:e?"var(--fg-4)":"var(--fg)",fontWeight:e?500:600},children:"Pick source repos"});return e?o.jsx("div",{children:l}):n?o.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[l,o.jsxs("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:[n,". Reconnect your GitHub account to grant repo access."]}),o.jsx("div",{style:{marginTop:"var(--sp-2)"},children:o.jsx(pe,{type:"button",variant:"outline",size:"sm",asChild:!0,children:o.jsx("a",{href:"/api/v1/auth/github/start?next=/",children:"Reconnect GitHub"})})})]}):t===null?o.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[l,o.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:"Loading your GitHub repositories…"})]}):t.length===0?o.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[l,o.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:"No repositories found on your GitHub account. Create one and refresh this page."})]}):o.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[l,o.jsx("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"The code your tree will organize knowledge about. Pick one or more."}),o.jsx(ZK,{repos:t,selectedRepoUrls:a,onToggle:s})]})}function ZK({repos:e,selectedRepoUrls:t,onToggle:n}){const[a,s]=x.useState(!1),l=x.useRef(null);x.useEffect(()=>{if(!a)return;const g=b=>{l.current&&!l.current.contains(b.target)&&s(!1)},p=b=>{b.key==="Escape"&&s(!1)};return window.addEventListener("mousedown",g),window.addEventListener("keydown",p),()=>{window.removeEventListener("mousedown",g),window.removeEventListener("keydown",p)}},[a]);const c=x.useMemo(()=>{const g=new Map;for(const p of e){const b=p.fullName.split("/")[0]??"",w=g.get(b);w?w.push(p):g.set(b,[p])}return[...g.entries()].sort(([p],[b])=>p.localeCompare(b))},[e]),d=x.useMemo(()=>new Set(t),[t]),m=x.useMemo(()=>e.filter(g=>d.has(g.cloneUrl)),[e,d]),h=m.length===0?"Select repositories…":"Add another repository";return o.jsxs("div",{ref:l,className:"relative",style:{marginTop:"var(--sp-2)"},children:[m.length>0&&o.jsx("div",{style:{marginBottom:"var(--sp-2)",display:"flex",flexWrap:"wrap",gap:"var(--sp-1_5)"},children:m.map(g=>o.jsx(GK,{fullName:g.fullName,onRemove:()=>n(g.cloneUrl)},g.cloneUrl))}),o.jsxs("button",{type:"button","aria-haspopup":"listbox","aria-expanded":a,onClick:()=>s(g=>!g),className:"text-body",style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg-3)",outline:"none",cursor:"pointer",textAlign:"left"},children:[o.jsx("span",{className:"truncate",style:{minWidth:0,flex:1},children:h}),o.jsx(bv,{className:"h-4 w-4",style:{color:"var(--fg-3)",transition:"transform 120ms ease",transform:a?"rotate(180deg)":"none",flexShrink:0}})]}),a&&o.jsx("div",{role:"listbox","aria-label":"GitHub repositories","aria-multiselectable":"true",className:"absolute z-30 rounded-md border bg-popover shadow-md",style:{top:"calc(100% + var(--sp-1))",left:0,right:0,maxHeight:"min(56vh, 30rem)",overflowY:"auto",padding:"var(--sp-1) 0"},children:c.map(([g,p],b)=>o.jsxs("div",{children:[o.jsx("div",{className:"text-eyebrow",style:{paddingTop:b>0?"var(--sp-3)":"var(--sp-1)",paddingBottom:"var(--sp-1)",paddingLeft:"calc(var(--sp-3) + var(--sp-3_5) + var(--sp-2))",paddingRight:"var(--sp-3)",color:"var(--fg-2)"},children:g}),p.map(w=>{const S=d.has(w.cloneUrl),j=w.fullName.slice(g.length+1);return o.jsxs("button",{type:"button",role:"option","aria-selected":S,onClick:()=>n(w.cloneUrl),className:"text-body transition-colors w-full",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-1) var(--sp-3)",background:S?"var(--accent-bg)":"transparent",color:S?"var(--accent)":"var(--fg)",border:"none",cursor:"pointer",textAlign:"left"},onMouseEnter:E=>{S||(E.currentTarget.style.background="var(--surface-1)")},onMouseLeave:E=>{S||(E.currentTarget.style.background="transparent")},children:[o.jsx("span",{"aria-hidden":"true",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:S?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border)",borderRadius:"var(--radius-chip)",background:S?"var(--accent)":"transparent",color:"var(--bg)",transition:"background 120ms ease, border-color 120ms ease"},children:S?o.jsx(ur,{className:"h-3 w-3",strokeWidth:3}):null}),o.jsx("span",{className:"truncate",style:{minWidth:0,flex:1},children:j}),w.private&&o.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",color:"var(--fg-4)",border:"var(--hairline) solid var(--border-faint)",background:"var(--bg-sunken)",flexShrink:0},children:"private"})]},w.cloneUrl)})]},g))})]})}function GK({fullName:e,onRemove:t}){return o.jsxs("span",{className:"text-label inline-flex items-center",style:{gap:"var(--sp-1)",paddingLeft:"var(--sp-2)",paddingRight:"var(--sp-0_5)",paddingTop:"var(--sp-0_5)",paddingBottom:"var(--sp-0_5)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-chip)",color:"var(--fg-2)",maxWidth:"20rem"},children:[o.jsx("span",{className:"mono truncate",style:{minWidth:0},children:e}),o.jsx("button",{type:"button","aria-label":`Remove ${e}`,onClick:t,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"var(--sp-4)",height:"var(--sp-4)",border:0,padding:0,background:"transparent",color:"var(--fg-3)",cursor:"pointer",borderRadius:"var(--radius-chip)",flexShrink:0,transition:"background 120ms ease, color 120ms ease"},onMouseEnter:n=>{n.currentTarget.style.background="var(--surface-2)",n.currentTarget.style.color="var(--fg)"},onMouseLeave:n=>{n.currentTarget.style.background="transparent",n.currentTarget.style.color="var(--fg-3)"},children:o.jsx(ss,{className:"h-3 w-3"})})]})}function VK(){const{onboardingStep:e,refreshMe:t,organizationId:n,memberId:a,role:s}=pt(),[l,c]=oh(),d=l.get("step"),[m]=x.useState(()=>iC()),[h,g]=x.useState(()=>rC()),p=x.useCallback(j=>{nz(j),g(j)},[]),b=s==="admin",w=x.useMemo(()=>d==="team"&&b?"step1":d==="agent"?"step2":d==="tree"||e==="completed"?"step3-intro":e==="connect"&&!h&&m!=="invite"&&b?"step1":"step2",[d,e,h,m,b]),S=x.useCallback(()=>{p(!0);const j=new URLSearchParams(l);j.delete("step"),c(j,{replace:!0})},[p,l,c]);return o.jsx("div",{className:"flex-1 overflow-auto",style:{display:"flex",justifyContent:"center",padding:"clamp(var(--sp-16), 12vh, var(--sp-45)) var(--sp-4) var(--sp-12)"},children:o.jsx("div",{style:{width:"100%",maxWidth:720},children:w==="step1"?o.jsx(xK,{organizationId:n,onContinue:S}):w==="step2"?o.jsx(CK,{organizationId:n,memberId:a,joinPath:m,refreshMe:t}):o.jsx(LK,{})})})}function QK({selectedChatId:e,onSelectChat:t}){const{onboardingStep:n,onboardingDismissedAt:a}=pt();return e===rh?o.jsx(xQ,{onCreated:t}):e?o.jsx(vK,{chatId:e}):n!==null&&!a?o.jsx(VK,{}):o.jsx(bK,{})}const KK={1:"Name your team",2:"Set up your agent",3:"Build your context-tree"};function YK(){const{onboardingStep:e,onboardingDismissedAt:t,dismissOnboarding:n}=pt(),{addToast:a}=Lc(),s=Rn(),[l,c]=oh(),d=l.get("c"),m=l.get("step"),h=rC(),p=iC()==="invite",b=x.useMemo(()=>m==="team"?1:m==="agent"?2:m==="tree"||d||e==="completed"?3:e==="create_agent"?2:e==="connect"&&!h&&!p?1:2,[m,d,e,h,p]);if(e===null||t)return null;const w=e==="completed",S=()=>{n(),a({title:"Setup hidden",description:"Resume any time in Settings → Onboarding.",action:{label:"Open settings",onClick:()=>s("/settings/onboarding")}})},j={1:qg(1,b,e),2:qg(2,b,e),3:qg(3,b,e)},E=C=>{if(C!==3)return;const _=new URLSearchParams(l);_.delete("c"),_.set("step","tree"),c(_,{replace:!1})};return o.jsxs("nav",{"aria-label":"Onboarding progress",className:"flex items-center",style:{gap:"var(--sp-3)",padding:"var(--sp-3) var(--sp-4)",borderBottom:"var(--hairline) solid var(--border)",background:"var(--bg)"},children:[o.jsx("ol",{className:"flex items-center justify-center flex-1 min-w-0",style:{gap:0,listStyle:"none",margin:0,padding:0},children:[1,2,3].map((C,_)=>{const z=j[C],M=[1,2,3][_+1],L=M?ij(z)&&ij(j[M]):!1;return o.jsxs("li",{className:"flex items-center",style:{minWidth:0},children:[o.jsx(XK,{index:C,state:z,label:KK[C],onClick:C===3&&z==="active"?()=>E(C):void 0}),M?o.jsx(JK,{solid:L}):null]},C)})}),o.jsx("button",{type:"button",onClick:S,disabled:!w,title:w?"Hide setup steps":"Finish setting up your agent first","aria-label":"Hide setup steps",className:w?"cursor-pointer":"cursor-not-allowed",style:{flexShrink:0,width:24,height:24,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:0,borderRadius:"var(--rd-1)",color:w?"var(--fg-2)":"var(--fg-4)",fontSize:14,lineHeight:1,opacity:w?1:.5},onMouseEnter:C=>{w&&(C.currentTarget.style.background="var(--surface-2)")},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},children:"✕"})]})}function qg(e,t,n){return e===t?"active":e===1||e===2&&n==="completed"?"completed":"pending"}function ij(e){return e==="active"||e==="completed"}function XK({index:e,state:t,label:n,onClick:a}){const s=!!a,l=WK(t,e);return o.jsxs("button",{type:"button",onClick:s?a:void 0,disabled:!s,"aria-current":t==="active"?"step":void 0,className:`flex items-center ${s?"cursor-pointer":"cursor-default"}`,style:{gap:"var(--sp-2)",background:"transparent",border:0,padding:0,font:"inherit",color:t==="active"?"var(--fg)":t==="completed"?"var(--fg-2)":"var(--fg-3)",fontWeight:t==="active"?600:500},children:[l,o.jsxs("span",{className:"text-label whitespace-nowrap",style:{textDecoration:s?"none":void 0},children:["Step ",e," · ",n]})]})}function WK(e,t){return e==="completed"?o.jsx("span",{"aria-hidden":"true",style:{width:22,height:22,borderRadius:"50%",background:"var(--accent)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:12,lineHeight:1,flexShrink:0},children:"✓"}):e==="active"?o.jsxs("span",{"aria-hidden":"true",style:{position:"relative",width:22,height:22,flexShrink:0,display:"inline-block"},children:[o.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--accent)",animation:"ring-pulse 1.8s infinite",opacity:.5}}),o.jsx("span",{className:"mono",style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--accent)",border:"var(--hairline-bold) solid var(--accent)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:12,fontWeight:600,lineHeight:1},children:t})]}):e==="error"?o.jsx("span",{"aria-hidden":"true",style:{width:22,height:22,borderRadius:"50%",background:"var(--state-error)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:13,lineHeight:1,flexShrink:0},children:"⊗"}):o.jsx("span",{"aria-hidden":"true",style:{width:22,height:22,borderRadius:"50%",background:"transparent",border:"var(--hairline) solid var(--fg-3)",flexShrink:0,display:"inline-block"}})}function JK({solid:e}){return o.jsx("span",{"aria-hidden":"true",style:{flex:"0 1 var(--sp-15)",minWidth:24,height:0,margin:"0 var(--sp-2)",borderTop:e?"var(--hairline-bold) solid var(--accent)":"var(--hairline) dashed var(--fg-3)"}})}function eY(){const[e,t]=oh(),n=e.get("c"),a=e.get("a");IN(),x.useEffect(()=>{if(a&&n){t({c:n},{replace:!0});return}a&&!n&&t({},{replace:!0})},[a,n,t]);const s=x.useCallback(c=>{t({c})},[t]),l=x.useCallback(()=>{t({c:rh})},[t]);return o.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[o.jsx(dQ,{selectedChatId:n,onSelectChat:s,onNewChat:l}),o.jsxs("main",{className:"flex-1 flex flex-col overflow-hidden min-w-0",style:{background:"var(--bg)"},children:[o.jsx(YK,{}),o.jsx(QK,{selectedChatId:n,onSelectChat:s})]})]})}const tY=new hR({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});function nY(){return o.jsx(mR,{client:tY,children:o.jsx(hz,{children:o.jsx(m4,{children:o.jsx(HO,{children:o.jsxs(vO,{children:[o.jsx(Mt,{path:"/login",element:o.jsx(ZG,{})}),o.jsx(Mt,{path:"/signup",element:o.jsx(lr,{to:"/login",replace:!0})}),o.jsx(Mt,{path:"/auth/github/complete",element:o.jsx(GG,{})}),o.jsx(Mt,{path:"/invite/:token",element:o.jsx(FG,{})}),o.jsx(Mt,{element:o.jsx(vz,{}),children:o.jsxs(Mt,{element:o.jsx(FB,{children:o.jsx(f4,{})}),children:[o.jsx(Mt,{index:!0,element:o.jsx(eY,{})}),o.jsx(Mt,{path:"context",element:o.jsx(nG,{})}),o.jsx(Mt,{path:"agents/:uuid",element:o.jsx(gZ,{})}),o.jsx(Mt,{path:"team",element:o.jsx(GV,{})}),o.jsxs(Mt,{path:"settings",element:o.jsx(zV,{}),children:[o.jsx(Mt,{index:!0,element:o.jsx(lr,{to:"computers",replace:!0})}),o.jsx(Mt,{path:"team",element:o.jsx(iQ,{})}),o.jsx(Mt,{path:"computers",element:o.jsx(lV,{})}),o.jsx(Mt,{path:"github",element:o.jsx(mV,{})}),o.jsx(Mt,{path:"integrations",element:o.jsx(AV,{})}),o.jsx(Mt,{path:"onboarding",element:o.jsx(RV,{})}),o.jsx(Mt,{path:"setup",element:o.jsx(lr,{to:"/settings/onboarding",replace:!0})})]}),o.jsx(Mt,{path:"agents",element:o.jsx(lr,{to:"/team",replace:!0})}),o.jsx(Mt,{path:"clients",element:o.jsx(lr,{to:"/settings/computers",replace:!0})}),o.jsx(Mt,{path:"integrations",element:o.jsx(lr,{to:"/settings/integrations",replace:!0})}),o.jsx(Mt,{path:"team/members",element:o.jsx(lr,{to:"/team",replace:!0})}),o.jsx(Mt,{path:"team/agents",element:o.jsx(lr,{to:"/team",replace:!0})}),o.jsx(Mt,{path:"team/invite",element:o.jsx(lr,{to:"/team",replace:!0})}),o.jsx(Mt,{path:"team/settings",element:o.jsx(lr,{to:"/settings/team",replace:!0})}),o.jsx(Mt,{path:"admin",element:o.jsx(rY,{})})]})})]})})})})})}function rY(){const e=Sr();return e.hash==="#bindings"?o.jsx(lr,{to:`/settings/integrations${e.search}`,replace:!0}):o.jsx(lr,{to:`/team${e.hash}`,replace:!0})}const kT=document.getElementById("root");if(!kT)throw new Error("Root element not found");F2.createRoot(kT).render(o.jsx(x.StrictMode,{children:o.jsx(nY,{})}));export{oC as A,Ic as F,Rc as L,lt as c,o as j,x as r};
|