@agent-team-foundation/first-tree-hub 0.12.7 → 0.12.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.mjs +39 -4
- package/dist/{client-93HZWg84-MIPzQD9A.mjs → client-DNEtPEBu-BtHkUya2.mjs} +2 -2
- package/dist/{client-h5l7mi0m-OEX7MOBg.mjs → client-bR8nwHaV-OxnjyKOk.mjs} +314 -276
- package/dist/{dist-CTkhS6p5.mjs → dist-CnjqakXS.mjs} +39 -10
- package/dist/drizzle/0038_chat_membership_user_state.sql +223 -0
- package/dist/drizzle/0039_drop_chat_participants_subscriptions.sql +26 -0
- package/dist/drizzle/0040_chat_user_state_engagement.sql +24 -0
- package/dist/drizzle/meta/_journal.json +21 -0
- package/dist/{feishu-DJm0EaZP.mjs → feishu-DrnBbl8T.mjs} +1 -1
- package/dist/index.mjs +4 -4
- package/dist/{invitation-C299fxkP-jQiGR5fl.mjs → invitation-C299fxkP-KKslbta2.mjs} +1 -1
- package/dist/{saas-connect-CY2NxeKx.mjs → saas-connect-CLcon-De.mjs} +192 -116
- package/dist/web/assets/{index-JGwkYWtM.js → index-BPMrSv_A.js} +1 -1
- package/dist/web/assets/index-DxAYxUpz.css +1 -0
- package/dist/web/assets/index-ntmzuk5X.js +421 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-BKbK8BhK.css +0 -1
- package/dist/web/assets/index-BNM-YSSu.js +0 -421
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
var xS=e=>{throw TypeError(e)};var Gp=(e,t,n)=>t.has(e)||xS("Cannot "+n);var U=(e,t,n)=>(Gp(e,t,"read from private field"),n?n.call(e):t.get(e)),Ne=(e,t,n)=>t.has(e)?xS("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Se=(e,t,n,a)=>(Gp(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n),Ge=(e,t,n)=>(Gp(e,t,"access private method"),n);var rf=(e,t,n,a)=>({set _(s){Se(e,t,s,n)},get _(){return U(e,t,a)}});function G2(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const s in a)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(a,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>a[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))a(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function rh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vp={exports:{}},Tu={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var wS;function V2(){if(wS)return Tu;wS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,s,o){var c=null;if(o!==void 0&&(c=""+o),s.key!==void 0&&(c=""+s.key),"key"in s){o={};for(var f in s)f!=="key"&&(o[f]=s[f])}else o=s;return s=o.ref,{$$typeof:e,type:a,key:c,ref:s!==void 0?s:null,props:o}}return Tu.Fragment=t,Tu.jsx=n,Tu.jsxs=n,Tu}var SS;function Q2(){return SS||(SS=1,Vp.exports=V2()),Vp.exports}var l=Q2(),Qp={exports:{}},Qe={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var kS;function K2(){if(kS)return Qe;kS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function w(P){return P===null||typeof P!="object"?null:(P=x&&P[x]||P["@@iterator"],typeof P=="function"?P:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,j={};function C(P,F,T){this.props=P,this.context=F,this.refs=j,this.updater=T||S}C.prototype.isReactComponent={},C.prototype.setState=function(P,F){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,F,"setState")},C.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function N(){}N.prototype=C.prototype;function R(P,F,T){this.props=P,this.context=F,this.refs=j,this.updater=T||S}var M=R.prototype=new N;M.constructor=R,k(M,C.prototype),M.isPureReactComponent=!0;var L=Array.isArray;function O(){}var B={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function Y(P,F,T){var G=T.ref;return{$$typeof:e,type:P,key:F,ref:G!==void 0?G:null,props:T}}function z(P,F){return Y(P.type,F,P.props)}function K(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function ie(P){var F={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(T){return F[T]})}var ve=/\/+/g;function J(P,F){return typeof P=="object"&&P!==null&&P.key!=null?ie(""+P.key):F.toString(36)}function W(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(O,O):(P.status="pending",P.then(function(F){P.status==="pending"&&(P.status="fulfilled",P.value=F)},function(F){P.status==="pending"&&(P.status="rejected",P.reason=F)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function Z(P,F,T,G,q){var ae=typeof P;(ae==="undefined"||ae==="boolean")&&(P=null);var be=!1;if(P===null)be=!0;else switch(ae){case"bigint":case"string":case"number":be=!0;break;case"object":switch(P.$$typeof){case e:case t:be=!0;break;case p:return be=P._init,Z(be(P._payload),F,T,G,q)}}if(be)return q=q(P),be=G===""?"."+J(P,0):G,L(q)?(T="",be!=null&&(T=be.replace(ve,"$&/")+"/"),Z(q,F,T,"",function(Me){return Me})):q!=null&&(K(q)&&(q=z(q,T+(q.key==null||P&&P.key===q.key?"":(""+q.key).replace(ve,"$&/")+"/")+be)),F.push(q)),1;be=0;var we=G===""?".":G+":";if(L(P))for(var me=0;me<P.length;me++)G=P[me],ae=we+J(G,me),be+=Z(G,F,T,ae,q);else if(me=w(P),typeof me=="function")for(P=me.call(P),me=0;!(G=P.next()).done;)G=G.value,ae=we+J(G,me++),be+=Z(G,F,T,ae,q);else if(ae==="object"){if(typeof P.then=="function")return Z(W(P),F,T,G,q);throw F=String(P),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return be}function ne(P,F,T){if(P==null)return P;var G=[],q=0;return Z(P,G,"","",function(ae){return F.call(T,ae,q++)}),G}function ke(P){if(P._status===-1){var F=P._result;F=F(),F.then(function(T){(P._status===0||P._status===-1)&&(P._status=1,P._result=T)},function(T){(P._status===0||P._status===-1)&&(P._status=2,P._result=T)}),P._status===-1&&(P._status=0,P._result=F)}if(P._status===1)return P._result.default;throw P._result}var Ae=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},D={map:ne,forEach:function(P,F,T){ne(P,function(){F.apply(this,arguments)},T)},count:function(P){var F=0;return ne(P,function(){F++}),F},toArray:function(P){return ne(P,function(F){return F})||[]},only:function(P){if(!K(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return Qe.Activity=g,Qe.Children=D,Qe.Component=C,Qe.Fragment=n,Qe.Profiler=s,Qe.PureComponent=R,Qe.StrictMode=a,Qe.Suspense=m,Qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=B,Qe.__COMPILER_RUNTIME={__proto__:null,c:function(P){return B.H.useMemoCache(P)}},Qe.cache=function(P){return function(){return P.apply(null,arguments)}},Qe.cacheSignal=function(){return null},Qe.cloneElement=function(P,F,T){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var G=k({},P.props),q=P.key;if(F!=null)for(ae in F.key!==void 0&&(q=""+F.key),F)!I.call(F,ae)||ae==="key"||ae==="__self"||ae==="__source"||ae==="ref"&&F.ref===void 0||(G[ae]=F[ae]);var ae=arguments.length-2;if(ae===1)G.children=T;else if(1<ae){for(var be=Array(ae),we=0;we<ae;we++)be[we]=arguments[we+2];G.children=be}return Y(P.type,q,G)},Qe.createContext=function(P){return P={$$typeof:c,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:o,_context:P},P},Qe.createElement=function(P,F,T){var G,q={},ae=null;if(F!=null)for(G in F.key!==void 0&&(ae=""+F.key),F)I.call(F,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(q[G]=F[G]);var be=arguments.length-2;if(be===1)q.children=T;else if(1<be){for(var we=Array(be),me=0;me<be;me++)we[me]=arguments[me+2];q.children=we}if(P&&P.defaultProps)for(G in be=P.defaultProps,be)q[G]===void 0&&(q[G]=be[G]);return Y(P,ae,q)},Qe.createRef=function(){return{current:null}},Qe.forwardRef=function(P){return{$$typeof:f,render:P}},Qe.isValidElement=K,Qe.lazy=function(P){return{$$typeof:p,_payload:{_status:-1,_result:P},_init:ke}},Qe.memo=function(P,F){return{$$typeof:h,type:P,compare:F===void 0?null:F}},Qe.startTransition=function(P){var F=B.T,T={};B.T=T;try{var G=P(),q=B.S;q!==null&&q(T,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(O,Ae)}catch(ae){Ae(ae)}finally{F!==null&&T.types!==null&&(F.types=T.types),B.T=F}},Qe.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},Qe.use=function(P){return B.H.use(P)},Qe.useActionState=function(P,F,T){return B.H.useActionState(P,F,T)},Qe.useCallback=function(P,F){return B.H.useCallback(P,F)},Qe.useContext=function(P){return B.H.useContext(P)},Qe.useDebugValue=function(){},Qe.useDeferredValue=function(P,F){return B.H.useDeferredValue(P,F)},Qe.useEffect=function(P,F){return B.H.useEffect(P,F)},Qe.useEffectEvent=function(P){return B.H.useEffectEvent(P)},Qe.useId=function(){return B.H.useId()},Qe.useImperativeHandle=function(P,F,T){return B.H.useImperativeHandle(P,F,T)},Qe.useInsertionEffect=function(P,F){return B.H.useInsertionEffect(P,F)},Qe.useLayoutEffect=function(P,F){return B.H.useLayoutEffect(P,F)},Qe.useMemo=function(P,F){return B.H.useMemo(P,F)},Qe.useOptimistic=function(P,F){return B.H.useOptimistic(P,F)},Qe.useReducer=function(P,F,T){return B.H.useReducer(P,F,T)},Qe.useRef=function(P){return B.H.useRef(P)},Qe.useState=function(P){return B.H.useState(P)},Qe.useSyncExternalStore=function(P,F,T){return B.H.useSyncExternalStore(P,F,T)},Qe.useTransition=function(){return B.H.useTransition()},Qe.version="19.2.4",Qe}var jS;function iv(){return jS||(jS=1,Qp.exports=K2()),Qp.exports}var b=iv();const Y2=rh(b),sv=G2({__proto__:null,default:Y2},[b]);var Kp={exports:{}},Au={},Yp={exports:{}},Xp={};/**
|
|
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 ES;function X2(){return ES||(ES=1,(function(e){function t(Z,ne){var ke=Z.length;Z.push(ne);e:for(;0<ke;){var Ae=ke-1>>>1,D=Z[Ae];if(0<s(D,ne))Z[Ae]=ne,Z[ke]=D,ke=Ae;else break e}}function n(Z){return Z.length===0?null:Z[0]}function a(Z){if(Z.length===0)return null;var ne=Z[0],ke=Z.pop();if(ke!==ne){Z[0]=ke;e:for(var Ae=0,D=Z.length,P=D>>>1;Ae<P;){var F=2*(Ae+1)-1,T=Z[F],G=F+1,q=Z[G];if(0>s(T,ke))G<D&&0>s(q,T)?(Z[Ae]=q,Z[G]=ke,Ae=G):(Z[Ae]=T,Z[F]=ke,Ae=F);else if(G<D&&0>s(q,ke))Z[Ae]=q,Z[G]=ke,Ae=G;else break e}}return ne}function s(Z,ne){var ke=Z.sortIndex-ne.sortIndex;return ke!==0?ke:Z.id-ne.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var m=[],h=[],p=1,g=null,x=3,w=!1,S=!1,k=!1,j=!1,C=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function M(Z){for(var ne=n(h);ne!==null;){if(ne.callback===null)a(h);else if(ne.startTime<=Z)a(h),ne.sortIndex=ne.expirationTime,t(m,ne);else break;ne=n(h)}}function L(Z){if(k=!1,M(Z),!S)if(n(m)!==null)S=!0,O||(O=!0,ie());else{var ne=n(h);ne!==null&&W(L,ne.startTime-Z)}}var O=!1,B=-1,I=5,Y=-1;function z(){return j?!0:!(e.unstable_now()-Y<I)}function K(){if(j=!1,O){var Z=e.unstable_now();Y=Z;var ne=!0;try{e:{S=!1,k&&(k=!1,N(B),B=-1),w=!0;var ke=x;try{t:{for(M(Z),g=n(m);g!==null&&!(g.expirationTime>Z&&z());){var Ae=g.callback;if(typeof Ae=="function"){g.callback=null,x=g.priorityLevel;var D=Ae(g.expirationTime<=Z);if(Z=e.unstable_now(),typeof D=="function"){g.callback=D,M(Z),ne=!0;break t}g===n(m)&&a(m),M(Z)}else a(m);g=n(m)}if(g!==null)ne=!0;else{var P=n(h);P!==null&&W(L,P.startTime-Z),ne=!1}}break e}finally{g=null,x=ke,w=!1}ne=void 0}}finally{ne?ie():O=!1}}}var ie;if(typeof R=="function")ie=function(){R(K)};else if(typeof MessageChannel<"u"){var ve=new MessageChannel,J=ve.port2;ve.port1.onmessage=K,ie=function(){J.postMessage(null)}}else ie=function(){C(K,0)};function W(Z,ne){B=C(function(){Z(e.unstable_now())},ne)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(Z){Z.callback=null},e.unstable_forceFrameRate=function(Z){0>Z||125<Z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<Z?Math.floor(1e3/Z):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(Z){switch(x){case 1:case 2:case 3:var ne=3;break;default:ne=x}var ke=x;x=ne;try{return Z()}finally{x=ke}},e.unstable_requestPaint=function(){j=!0},e.unstable_runWithPriority=function(Z,ne){switch(Z){case 1:case 2:case 3:case 4:case 5:break;default:Z=3}var ke=x;x=Z;try{return ne()}finally{x=ke}},e.unstable_scheduleCallback=function(Z,ne,ke){var Ae=e.unstable_now();switch(typeof ke=="object"&&ke!==null?(ke=ke.delay,ke=typeof ke=="number"&&0<ke?Ae+ke:Ae):ke=Ae,Z){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=ke+D,Z={id:p++,callback:ne,priorityLevel:Z,startTime:ke,expirationTime:D,sortIndex:-1},ke>Ae?(Z.sortIndex=ke,t(h,Z),n(m)===null&&Z===n(h)&&(k?(N(B),B=-1):k=!0,W(L,ke-Ae))):(Z.sortIndex=D,t(m,Z),S||w||(S=!0,O||(O=!0,ie()))),Z},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(Z){var ne=x;return function(){var ke=x;x=ne;try{return Z.apply(this,arguments)}finally{x=ke}}}})(Xp)),Xp}var CS;function W2(){return CS||(CS=1,Yp.exports=X2()),Yp.exports}var Wp={exports:{}},Qn={};/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var NS;function J2(){if(NS)return Qn;NS=1;var e=iv();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)h+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function o(m,h,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:g==null?null:""+g,children:m,containerInfo:h,implementation:p}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Qn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Qn.createPortal=function(m,h){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return o(m,h,null,p)},Qn.flushSync=function(m){var h=c.T,p=a.p;try{if(c.T=null,a.p=2,m)return m()}finally{c.T=h,a.p=p,a.d.f()}},Qn.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,a.d.C(m,h))},Qn.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Qn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var p=h.as,g=f(p,h.crossOrigin),x=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;p==="style"?a.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:w}):p==="script"&&a.d.X(m,{crossOrigin:g,integrity:x,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Qn.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var p=f(h.as,h.crossOrigin);a.d.M(m,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&a.d.M(m)},Qn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var p=h.as,g=f(p,h.crossOrigin);a.d.L(m,p,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Qn.preloadModule=function(m,h){if(typeof m=="string")if(h){var p=f(h.as,h.crossOrigin);a.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else a.d.m(m)},Qn.requestFormReset=function(m){a.d.r(m)},Qn.unstable_batchedUpdates=function(m,h){return m(h)},Qn.useFormState=function(m,h,p){return c.H.useFormState(m,h,p)},Qn.useFormStatus=function(){return c.H.useHostTransitionStatus()},Qn.version="19.2.4",Qn}var _S;function _j(){if(_S)return Wp.exports;_S=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(),Wp.exports=J2(),Wp.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 TS;function eR(){if(TS)return Au;TS=1;var e=W2(),t=iv(),n=_j();function a(r){var i="https://react.dev/errors/"+r;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)i+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+r+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function o(r){var i=r,u=r;if(r.alternate)for(;i.return;)i=i.return;else{r=i;do i=r,(i.flags&4098)!==0&&(u=i.return),r=i.return;while(r)}return i.tag===3?u:null}function c(r){if(r.tag===13){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function f(r){if(r.tag===31){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function m(r){if(o(r)!==r)throw Error(a(188))}function h(r){var i=r.alternate;if(!i){if(i=o(r),i===null)throw Error(a(188));return i!==r?null:r}for(var u=r,d=i;;){var y=u.return;if(y===null)break;var v=y.alternate;if(v===null){if(d=y.return,d!==null){u=d;continue}break}if(y.child===v.child){for(v=y.child;v;){if(v===u)return m(y),r;if(v===d)return m(y),i;v=v.sibling}throw Error(a(188))}if(u.return!==d.return)u=y,d=v;else{for(var E=!1,A=y.child;A;){if(A===u){E=!0,u=y,d=v;break}if(A===d){E=!0,d=y,u=v;break}A=A.sibling}if(!E){for(A=v.child;A;){if(A===u){E=!0,u=v,d=y;break}if(A===d){E=!0,d=v,u=y;break}A=A.sibling}if(!E)throw Error(a(189))}}if(u.alternate!==d)throw Error(a(190))}if(u.tag!==3)throw Error(a(188));return u.stateNode.current===u?r:i}function p(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=p(r),i!==null)return i;r=r.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),R=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),K=Symbol.iterator;function ie(r){return r===null||typeof r!="object"?null:(r=K&&r[K]||r["@@iterator"],typeof r=="function"?r:null)}var ve=Symbol.for("react.client.reference");function J(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===ve?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case k:return"Fragment";case C:return"Profiler";case j:return"StrictMode";case L:return"Suspense";case O:return"SuspenseList";case Y:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case S:return"Portal";case R:return r.displayName||"Context";case N:return(r._context.displayName||"Context")+".Consumer";case M:var i=r.render;return r=r.displayName,r||(r=i.displayName||i.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case B:return i=r.displayName||null,i!==null?i:J(r.type)||"Memo";case I:i=r._payload,r=r._init;try{return J(r(i))}catch{}}return null}var W=Array.isArray,Z=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ke={pending:!1,data:null,method:null,action:null},Ae=[],D=-1;function P(r){return{current:r}}function F(r){0>D||(r.current=Ae[D],Ae[D]=null,D--)}function T(r,i){D++,Ae[D]=r.current,r.current=i}var G=P(null),q=P(null),ae=P(null),be=P(null);function we(r,i){switch(T(ae,i),T(q,r),T(G,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?Hw(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=Hw(i),r=qw(i,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}F(G),T(G,r)}function me(){F(G),F(q),F(ae)}function Me(r){r.memoizedState!==null&&T(be,r);var i=G.current,u=qw(i,r.type);i!==u&&(T(q,r),T(G,u))}function Ie(r){q.current===r&&(F(G),F(q)),be.current===r&&(F(be),Eu._currentValue=ke)}var St,tt;function it(r){if(St===void 0)try{throw Error()}catch(u){var i=u.stack.trim().match(/\n( *(at )?)/);St=i&&i[1]||"",tt=-1<u.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+St+r+tt}var V=!1;function pe(r,i){if(!r||V)return"";V=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(i){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(le){var re=le}Reflect.construct(r,[],fe)}else{try{fe.call()}catch(le){re=le}r.call(fe.prototype)}}else{try{throw Error()}catch(le){re=le}(fe=r())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(le){if(le&&re&&typeof le.stack=="string")return[le.stack,re.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=d.DetermineComponentFrameRoot(),E=v[0],A=v[1];if(E&&A){var H=E.split(`
|
|
44
|
+
`),te=A.split(`
|
|
45
|
+
`);for(y=d=0;d<H.length&&!H[d].includes("DetermineComponentFrameRoot");)d++;for(;y<te.length&&!te[y].includes("DetermineComponentFrameRoot");)y++;if(d===H.length||y===te.length)for(d=H.length-1,y=te.length-1;1<=d&&0<=y&&H[d]!==te[y];)y--;for(;1<=d&&0<=y;d--,y--)if(H[d]!==te[y]){if(d!==1||y!==1)do if(d--,y--,0>y||H[d]!==te[y]){var ue=`
|
|
46
|
+
`+H[d].replace(" at new "," at ");return r.displayName&&ue.includes("<anonymous>")&&(ue=ue.replace("<anonymous>",r.displayName)),ue}while(1<=d&&0<=y);break}}}finally{V=!1,Error.prepareStackTrace=u}return(u=r?r.displayName||r.name:"")?it(u):""}function _e(r,i){switch(r.tag){case 26:case 27:case 5:return it(r.type);case 16:return it("Lazy");case 13:return r.child!==i&&i!==null?it("Suspense Fallback"):it("Suspense");case 19:return it("SuspenseList");case 0:case 15:return pe(r.type,!1);case 11:return pe(r.type.render,!1);case 1:return pe(r.type,!0);case 31:return it("Activity");default:return""}}function Pe(r){try{var i="",u=null;do i+=_e(r,u),u=r,r=r.return;while(r);return i}catch(d){return`
|
|
47
|
+
Error generating stack: `+d.message+`
|
|
48
|
+
`+d.stack}}var Mt=Object.prototype.hasOwnProperty,Pt=e.unstable_scheduleCallback,hr=e.unstable_cancelCallback,pi=e.unstable_shouldYield,gi=e.unstable_requestPaint,cn=e.unstable_now,da=e.unstable_getCurrentPriorityLevel,oe=e.unstable_ImmediatePriority,ge=e.unstable_UserBlockingPriority,$e=e.unstable_NormalPriority,Ve=e.unstable_LowPriority,st=e.unstable_IdlePriority,dn=e.log,tr=e.unstable_setDisableYieldValue,qt=null,Ut=null;function At(r){if(typeof dn=="function"&&tr(r),Ut&&typeof Ut.setStrictMode=="function")try{Ut.setStrictMode(qt,r)}catch{}}var lt=Math.clz32?Math.clz32:il,nr=Math.log,Mn=Math.LN2;function il(r){return r>>>=0,r===0?32:31-(nr(r)/Mn|0)|0}var fa=256,ha=262144,Ma=4194304;function Vn(r){var i=r&42;if(i!==0)return i;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function Da(r,i,u){var d=r.pendingLanes;if(d===0)return 0;var y=0,v=r.suspendedLanes,E=r.pingedLanes;r=r.warmLanes;var A=d&134217727;return A!==0?(d=A&~v,d!==0?y=Vn(d):(E&=A,E!==0?y=Vn(E):u||(u=A&~r,u!==0&&(y=Vn(u))))):(A=d&~v,A!==0?y=Vn(A):E!==0?y=Vn(E):u||(u=d&~r,u!==0&&(y=Vn(u)))),y===0?0:i!==0&&i!==y&&(i&v)===0&&(v=y&-y,u=i&-i,v>=u||v===32&&(u&4194048)!==0)?i:y}function Sa(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function Zt(r,i){switch(r){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function je(){var r=Ma;return Ma<<=1,(Ma&62914560)===0&&(Ma=4194304),r}function nt(r){for(var i=[],u=0;31>u;u++)i.push(r);return i}function yn(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Ar(r,i,u,d,y,v){var E=r.pendingLanes;r.pendingLanes=u,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=u,r.entangledLanes&=u,r.errorRecoveryDisabledLanes&=u,r.shellSuspendCounter=0;var A=r.entanglements,H=r.expirationTimes,te=r.hiddenUpdates;for(u=E&~u;0<u;){var ue=31-lt(u),fe=1<<ue;A[ue]=0,H[ue]=-1;var re=te[ue];if(re!==null)for(te[ue]=null,ue=0;ue<re.length;ue++){var le=re[ue];le!==null&&(le.lane&=-536870913)}u&=~fe}d!==0&&yi(r,d,0),v!==0&&y===0&&r.tag!==0&&(r.suspendedLanes|=v&~(E&~i))}function yi(r,i,u){r.pendingLanes|=i,r.suspendedLanes&=~i;var d=31-lt(i);r.entangledLanes|=i,r.entanglements[d]=r.entanglements[d]|1073741824|u&261930}function ys(r,i){var u=r.entangledLanes|=i;for(r=r.entanglements;u;){var d=31-lt(u),y=1<<d;y&i|r[d]&i&&(r[d]|=i),u&=~y}}function $c(r,i){var u=i&-i;return u=(u&42)!==0?1:rr(u),(u&(r.suspendedLanes|i))!==0?0:u}function rr(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function ma(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Lo(){var r=ne.p;return r!==0?r:(r=window.event,r===void 0?32:hS(r.type))}function Po(r,i){var u=ne.p;try{return ne.p=r,i()}finally{ne.p=u}}var Hr=Math.random().toString(36).slice(2),fn="__reactFiber$"+Hr,Gt="__reactProps$"+Hr,Ia="__reactContainer$"+Hr,sl="__reactEvents$"+Hr,Ph="__reactListeners$"+Hr,Hc="__reactHandles$"+Hr,Uo="__reactResources$"+Hr,vi="__reactMarker$"+Hr;function Ue(r){delete r[fn],delete r[Gt],delete r[sl],delete r[Ph],delete r[Hc]}function $(r){var i=r[fn];if(i)return i;for(var u=r.parentNode;u;){if(i=u[Ia]||u[fn]){if(u=i.alternate,i.child!==null||u!==null&&u.child!==null)for(r=Xw(r);r!==null;){if(u=r[fn])return u;r=Xw(r)}return i}r=u,u=r.parentNode}return null}function he(r){if(r=r[fn]||r[Ia]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function Ce(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(a(33))}function wt(r){var i=r[Uo];return i||(i=r[Uo]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function mt(r){r[vi]=!0}var Wt=new Set,Un={};function vn(r,i){Dn(r,i),Dn(r+"Capture",i)}function Dn(r,i){for(Un[r]=i,r=0;r<i.length;r++)Wt.add(i[r])}var Bo=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),hn={},Fo={};function qc(r){return Mt.call(Fo,r)?!0:Mt.call(hn,r)?!1:Bo.test(r)?Fo[r]=!0:(hn[r]=!0,!1)}function Zc(r,i,u){if(qc(i))if(u===null)r.removeAttribute(i);else{switch(typeof u){case"undefined":case"function":case"symbol":r.removeAttribute(i);return;case"boolean":var d=i.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(i);return}}r.setAttribute(i,""+u)}}function Gc(r,i,u){if(u===null)r.removeAttribute(i);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttribute(i,""+u)}}function La(r,i,u,d){if(d===null)r.removeAttribute(u);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(u);return}r.setAttributeNS(i,u,""+d)}}function qr(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Db(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function UT(r,i,u){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var y=d.get,v=d.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return y.call(this)},set:function(E){u=""+E,v.call(this,E)}}),Object.defineProperty(r,i,{enumerable:d.enumerable}),{getValue:function(){return u},setValue:function(E){u=""+E},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function Uh(r){if(!r._valueTracker){var i=Db(r)?"checked":"value";r._valueTracker=UT(r,i,""+r[i])}}function Ib(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var u=i.getValue(),d="";return r&&(d=Db(r)?r.checked?"true":"false":r.value),r=d,r!==u?(i.setValue(r),!0):!1}function Vc(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var BT=/[\n"\\]/g;function Zr(r){return r.replace(BT,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Bh(r,i,u,d,y,v,E,A){r.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?r.type=E:r.removeAttribute("type"),i!=null?E==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+qr(i)):r.value!==""+qr(i)&&(r.value=""+qr(i)):E!=="submit"&&E!=="reset"||r.removeAttribute("value"),i!=null?Fh(r,E,qr(i)):u!=null?Fh(r,E,qr(u)):d!=null&&r.removeAttribute("value"),y==null&&v!=null&&(r.defaultChecked=!!v),y!=null&&(r.checked=y&&typeof y!="function"&&typeof y!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?r.name=""+qr(A):r.removeAttribute("name")}function Lb(r,i,u,d,y,v,E,A){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(r.type=v),i!=null||u!=null){if(!(v!=="submit"&&v!=="reset"||i!=null)){Uh(r);return}u=u!=null?""+qr(u):"",i=i!=null?""+qr(i):u,A||i===r.value||(r.value=i),r.defaultValue=i}d=d??y,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=A?r.checked:!!d,r.defaultChecked=!!d,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(r.name=E),Uh(r)}function Fh(r,i,u){i==="number"&&Vc(r.ownerDocument)===r||r.defaultValue===""+u||(r.defaultValue=""+u)}function ll(r,i,u,d){if(r=r.options,i){i={};for(var y=0;y<u.length;y++)i["$"+u[y]]=!0;for(u=0;u<r.length;u++)y=i.hasOwnProperty("$"+r[u].value),r[u].selected!==y&&(r[u].selected=y),y&&d&&(r[u].defaultSelected=!0)}else{for(u=""+qr(u),i=null,y=0;y<r.length;y++){if(r[y].value===u){r[y].selected=!0,d&&(r[y].defaultSelected=!0);return}i!==null||r[y].disabled||(i=r[y])}i!==null&&(i.selected=!0)}}function Pb(r,i,u){if(i!=null&&(i=""+qr(i),i!==r.value&&(r.value=i),u==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=u!=null?""+qr(u):""}function Ub(r,i,u,d){if(i==null){if(d!=null){if(u!=null)throw Error(a(92));if(W(d)){if(1<d.length)throw Error(a(93));d=d[0]}u=d}u==null&&(u=""),i=u}u=qr(i),r.defaultValue=u,d=r.textContent,d===u&&d!==""&&d!==null&&(r.value=d),Uh(r)}function ol(r,i){if(i){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=i;return}}r.textContent=i}var FT=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 Bb(r,i,u){var d=i.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?d?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":d?r.setProperty(i,u):typeof u!="number"||u===0||FT.has(i)?i==="float"?r.cssFloat=u:r[i]=(""+u).trim():r[i]=u+"px"}function Fb(r,i,u){if(i!=null&&typeof i!="object")throw Error(a(62));if(r=r.style,u!=null){for(var d in u)!u.hasOwnProperty(d)||i!=null&&i.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var y in i)d=i[y],i.hasOwnProperty(y)&&u[y]!==d&&Bb(r,y,d)}else for(var v in i)i.hasOwnProperty(v)&&Bb(r,v,i[v])}function $h(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 $T=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"]]),HT=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Qc(r){return HT.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Pa(){}var Hh=null;function qh(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var ul=null,cl=null;function $b(r){var i=he(r);if(i&&(r=i.stateNode)){var u=r[Gt]||null;e:switch(r=i.stateNode,i.type){case"input":if(Bh(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="'+Zr(""+i)+'"][type="radio"]'),i=0;i<u.length;i++){var d=u[i];if(d!==r&&d.form===r.form){var y=d[Gt]||null;if(!y)throw Error(a(90));Bh(d,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(i=0;i<u.length;i++)d=u[i],d.form===r.form&&Ib(d)}break e;case"textarea":Pb(r,u.value,u.defaultValue);break e;case"select":i=u.value,i!=null&&ll(r,!!u.multiple,i,!1)}}}var Zh=!1;function Hb(r,i,u){if(Zh)return r(i,u);Zh=!0;try{var d=r(i);return d}finally{if(Zh=!1,(ul!==null||cl!==null)&&(Dd(),ul&&(i=ul,r=cl,cl=ul=null,$b(i),r)))for(i=0;i<r.length;i++)$b(r[i])}}function $o(r,i){var u=r.stateNode;if(u===null)return null;var d=u[Gt]||null;if(d===null)return null;u=d[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(u&&typeof u!="function")throw Error(a(231,i,typeof u));return u}var Ua=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Gh=!1;if(Ua)try{var Ho={};Object.defineProperty(Ho,"passive",{get:function(){Gh=!0}}),window.addEventListener("test",Ho,Ho),window.removeEventListener("test",Ho,Ho)}catch{Gh=!1}var bi=null,Vh=null,Kc=null;function qb(){if(Kc)return Kc;var r,i=Vh,u=i.length,d,y="value"in bi?bi.value:bi.textContent,v=y.length;for(r=0;r<u&&i[r]===y[r];r++);var E=u-r;for(d=1;d<=E&&i[u-d]===y[v-d];d++);return Kc=y.slice(r,1<d?1-d:void 0)}function Yc(r){var i=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&i===13&&(r=13)):r=i,r===10&&(r=13),32<=r||r===13?r:0}function Xc(){return!0}function Zb(){return!1}function mr(r){function i(u,d,y,v,E){this._reactName=u,this._targetInst=y,this.type=d,this.nativeEvent=v,this.target=E,this.currentTarget=null;for(var A in r)r.hasOwnProperty(A)&&(u=r[A],this[A]=u?u(v):v[A]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Xc:Zb,this.isPropagationStopped=Zb,this}return g(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=Xc)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Xc)},persist:function(){},isPersistent:Xc}),i}var vs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wc=mr(vs),qo=g({},vs,{view:0,detail:0}),qT=mr(qo),Qh,Kh,Zo,Jc=g({},qo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xh,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Zo&&(Zo&&r.type==="mousemove"?(Qh=r.screenX-Zo.screenX,Kh=r.screenY-Zo.screenY):Kh=Qh=0,Zo=r),Qh)},movementY:function(r){return"movementY"in r?r.movementY:Kh}}),Gb=mr(Jc),ZT=g({},Jc,{dataTransfer:0}),GT=mr(ZT),VT=g({},qo,{relatedTarget:0}),Yh=mr(VT),QT=g({},vs,{animationName:0,elapsedTime:0,pseudoElement:0}),KT=mr(QT),YT=g({},vs,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),XT=mr(YT),WT=g({},vs,{data:0}),Vb=mr(WT),JT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},eA={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"},tA={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function nA(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=tA[r])?!!i[r]:!1}function Xh(){return nA}var rA=g({},qo,{key:function(r){if(r.key){var i=JT[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=Yc(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?eA[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xh,charCode:function(r){return r.type==="keypress"?Yc(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Yc(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),aA=mr(rA),iA=g({},Jc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Qb=mr(iA),sA=g({},qo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xh}),lA=mr(sA),oA=g({},vs,{propertyName:0,elapsedTime:0,pseudoElement:0}),uA=mr(oA),cA=g({},Jc,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),dA=mr(cA),fA=g({},vs,{newState:0,oldState:0}),hA=mr(fA),mA=[9,13,27,32],Wh=Ua&&"CompositionEvent"in window,Go=null;Ua&&"documentMode"in document&&(Go=document.documentMode);var pA=Ua&&"TextEvent"in window&&!Go,Kb=Ua&&(!Wh||Go&&8<Go&&11>=Go),Yb=" ",Xb=!1;function Wb(r,i){switch(r){case"keyup":return mA.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jb(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var dl=!1;function gA(r,i){switch(r){case"compositionend":return Jb(i);case"keypress":return i.which!==32?null:(Xb=!0,Yb);case"textInput":return r=i.data,r===Yb&&Xb?null:r;default:return null}}function yA(r,i){if(dl)return r==="compositionend"||!Wh&&Wb(r,i)?(r=qb(),Kc=Vh=bi=null,dl=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Kb&&i.locale!=="ko"?null:i.data;default:return null}}var vA={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 ex(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!vA[r.type]:i==="textarea"}function tx(r,i,u,d){ul?cl?cl.push(d):cl=[d]:ul=d,i=$d(i,"onChange"),0<i.length&&(u=new Wc("onChange","change",null,u,d),r.push({event:u,listeners:i}))}var Vo=null,Qo=null;function bA(r){Lw(r,0)}function ed(r){var i=Ce(r);if(Ib(i))return r}function nx(r,i){if(r==="change")return i}var rx=!1;if(Ua){var Jh;if(Ua){var em="oninput"in document;if(!em){var ax=document.createElement("div");ax.setAttribute("oninput","return;"),em=typeof ax.oninput=="function"}Jh=em}else Jh=!1;rx=Jh&&(!document.documentMode||9<document.documentMode)}function ix(){Vo&&(Vo.detachEvent("onpropertychange",sx),Qo=Vo=null)}function sx(r){if(r.propertyName==="value"&&ed(Qo)){var i=[];tx(i,Qo,r,qh(r)),Hb(bA,i)}}function xA(r,i,u){r==="focusin"?(ix(),Vo=i,Qo=u,Vo.attachEvent("onpropertychange",sx)):r==="focusout"&&ix()}function wA(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return ed(Qo)}function SA(r,i){if(r==="click")return ed(i)}function kA(r,i){if(r==="input"||r==="change")return ed(i)}function jA(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var Rr=typeof Object.is=="function"?Object.is:jA;function Ko(r,i){if(Rr(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var u=Object.keys(r),d=Object.keys(i);if(u.length!==d.length)return!1;for(d=0;d<u.length;d++){var y=u[d];if(!Mt.call(i,y)||!Rr(r[y],i[y]))return!1}return!0}function lx(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function ox(r,i){var u=lx(r);r=0;for(var d;u;){if(u.nodeType===3){if(d=r+u.textContent.length,r<=i&&d>=i)return{node:u,offset:i-r};r=d}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=lx(u)}}function ux(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?ux(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function cx(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=Vc(r.document);i instanceof r.HTMLIFrameElement;){try{var u=typeof i.contentWindow.location.href=="string"}catch{u=!1}if(u)r=i.contentWindow;else break;i=Vc(r.document)}return i}function tm(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 EA=Ua&&"documentMode"in document&&11>=document.documentMode,fl=null,nm=null,Yo=null,rm=!1;function dx(r,i,u){var d=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;rm||fl==null||fl!==Vc(d)||(d=fl,"selectionStart"in d&&tm(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Yo&&Ko(Yo,d)||(Yo=d,d=$d(nm,"onSelect"),0<d.length&&(i=new Wc("onSelect","select",null,i,u),r.push({event:i,listeners:d}),i.target=fl)))}function bs(r,i){var u={};return u[r.toLowerCase()]=i.toLowerCase(),u["Webkit"+r]="webkit"+i,u["Moz"+r]="moz"+i,u}var hl={animationend:bs("Animation","AnimationEnd"),animationiteration:bs("Animation","AnimationIteration"),animationstart:bs("Animation","AnimationStart"),transitionrun:bs("Transition","TransitionRun"),transitionstart:bs("Transition","TransitionStart"),transitioncancel:bs("Transition","TransitionCancel"),transitionend:bs("Transition","TransitionEnd")},am={},fx={};Ua&&(fx=document.createElement("div").style,"AnimationEvent"in window||(delete hl.animationend.animation,delete hl.animationiteration.animation,delete hl.animationstart.animation),"TransitionEvent"in window||delete hl.transitionend.transition);function xs(r){if(am[r])return am[r];if(!hl[r])return r;var i=hl[r],u;for(u in i)if(i.hasOwnProperty(u)&&u in fx)return am[r]=i[u];return r}var hx=xs("animationend"),mx=xs("animationiteration"),px=xs("animationstart"),CA=xs("transitionrun"),NA=xs("transitionstart"),_A=xs("transitioncancel"),gx=xs("transitionend"),yx=new Map,im="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(" ");im.push("scrollEnd");function pa(r,i){yx.set(r,i),vn(i,[r])}var td=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},Gr=[],ml=0,sm=0;function nd(){for(var r=ml,i=sm=ml=0;i<r;){var u=Gr[i];Gr[i++]=null;var d=Gr[i];Gr[i++]=null;var y=Gr[i];Gr[i++]=null;var v=Gr[i];if(Gr[i++]=null,d!==null&&y!==null){var E=d.pending;E===null?y.next=y:(y.next=E.next,E.next=y),d.pending=y}v!==0&&vx(u,y,v)}}function rd(r,i,u,d){Gr[ml++]=r,Gr[ml++]=i,Gr[ml++]=u,Gr[ml++]=d,sm|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function lm(r,i,u,d){return rd(r,i,u,d),ad(r)}function ws(r,i){return rd(r,null,null,i),ad(r)}function vx(r,i,u){r.lanes|=u;var d=r.alternate;d!==null&&(d.lanes|=u);for(var y=!1,v=r.return;v!==null;)v.childLanes|=u,d=v.alternate,d!==null&&(d.childLanes|=u),v.tag===22&&(r=v.stateNode,r===null||r._visibility&1||(y=!0)),r=v,v=v.return;return r.tag===3?(v=r.stateNode,y&&i!==null&&(y=31-lt(u),r=v.hiddenUpdates,d=r[y],d===null?r[y]=[i]:d.push(i),i.lane=u|536870912),v):null}function ad(r){if(50<vu)throw vu=0,gp=null,Error(a(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var pl={};function TA(r,i,u,d){this.tag=r,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Or(r,i,u,d){return new TA(r,i,u,d)}function om(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Ba(r,i){var u=r.alternate;return u===null?(u=Or(r.tag,i,r.key,r.mode),u.elementType=r.elementType,u.type=r.type,u.stateNode=r.stateNode,u.alternate=r,r.alternate=u):(u.pendingProps=i,u.type=r.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=r.flags&65011712,u.childLanes=r.childLanes,u.lanes=r.lanes,u.child=r.child,u.memoizedProps=r.memoizedProps,u.memoizedState=r.memoizedState,u.updateQueue=r.updateQueue,i=r.dependencies,u.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},u.sibling=r.sibling,u.index=r.index,u.ref=r.ref,u.refCleanup=r.refCleanup,u}function bx(r,i){r.flags&=65011714;var u=r.alternate;return u===null?(r.childLanes=0,r.lanes=i,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=u.childLanes,r.lanes=u.lanes,r.child=u.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=u.memoizedProps,r.memoizedState=u.memoizedState,r.updateQueue=u.updateQueue,r.type=u.type,i=u.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r}function id(r,i,u,d,y,v){var E=0;if(d=r,typeof r=="function")om(r)&&(E=1);else if(typeof r=="string")E=M2(r,u,G.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case Y:return r=Or(31,u,i,y),r.elementType=Y,r.lanes=v,r;case k:return Ss(u.children,y,v,i);case j:E=8,y|=24;break;case C:return r=Or(12,u,i,y|2),r.elementType=C,r.lanes=v,r;case L:return r=Or(13,u,i,y),r.elementType=L,r.lanes=v,r;case O:return r=Or(19,u,i,y),r.elementType=O,r.lanes=v,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case R:E=10;break e;case N:E=9;break e;case M:E=11;break e;case B:E=14;break e;case I:E=16,d=null;break e}E=29,u=Error(a(130,r===null?"null":typeof r,"")),d=null}return i=Or(E,u,i,y),i.elementType=r,i.type=d,i.lanes=v,i}function Ss(r,i,u,d){return r=Or(7,r,d,i),r.lanes=u,r}function um(r,i,u){return r=Or(6,r,null,i),r.lanes=u,r}function xx(r){var i=Or(18,null,null,0);return i.stateNode=r,i}function cm(r,i,u){return i=Or(4,r.children!==null?r.children:[],r.key,i),i.lanes=u,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var wx=new WeakMap;function Vr(r,i){if(typeof r=="object"&&r!==null){var u=wx.get(r);return u!==void 0?u:(i={value:r,source:i,stack:Pe(i)},wx.set(r,i),i)}return{value:r,source:i,stack:Pe(i)}}var gl=[],yl=0,sd=null,Xo=0,Qr=[],Kr=0,xi=null,ka=1,ja="";function Fa(r,i){gl[yl++]=Xo,gl[yl++]=sd,sd=r,Xo=i}function Sx(r,i,u){Qr[Kr++]=ka,Qr[Kr++]=ja,Qr[Kr++]=xi,xi=r;var d=ka;r=ja;var y=32-lt(d)-1;d&=~(1<<y),u+=1;var v=32-lt(i)+y;if(30<v){var E=y-y%5;v=(d&(1<<E)-1).toString(32),d>>=E,y-=E,ka=1<<32-lt(i)+y|u<<y|d,ja=v+r}else ka=1<<v|u<<y|d,ja=r}function dm(r){r.return!==null&&(Fa(r,1),Sx(r,1,0))}function fm(r){for(;r===sd;)sd=gl[--yl],gl[yl]=null,Xo=gl[--yl],gl[yl]=null;for(;r===xi;)xi=Qr[--Kr],Qr[Kr]=null,ja=Qr[--Kr],Qr[Kr]=null,ka=Qr[--Kr],Qr[Kr]=null}function kx(r,i){Qr[Kr++]=ka,Qr[Kr++]=ja,Qr[Kr++]=xi,ka=i.id,ja=i.overflow,xi=r}var Bn=null,$t=null,pt=!1,wi=null,Yr=!1,hm=Error(a(519));function Si(r){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Wo(Vr(i,r)),hm}function jx(r){var i=r.stateNode,u=r.type,d=r.memoizedProps;switch(i[fn]=r,i[Gt]=d,u){case"dialog":ut("cancel",i),ut("close",i);break;case"iframe":case"object":case"embed":ut("load",i);break;case"video":case"audio":for(u=0;u<xu.length;u++)ut(xu[u],i);break;case"source":ut("error",i);break;case"img":case"image":case"link":ut("error",i),ut("load",i);break;case"details":ut("toggle",i);break;case"input":ut("invalid",i),Lb(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":ut("invalid",i);break;case"textarea":ut("invalid",i),Ub(i,d.value,d.defaultValue,d.children)}u=d.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||i.textContent===""+u||d.suppressHydrationWarning===!0||Fw(i.textContent,u)?(d.popover!=null&&(ut("beforetoggle",i),ut("toggle",i)),d.onScroll!=null&&ut("scroll",i),d.onScrollEnd!=null&&ut("scrollend",i),d.onClick!=null&&(i.onclick=Pa),i=!0):i=!1,i||Si(r,!0)}function Ex(r){for(Bn=r.return;Bn;)switch(Bn.tag){case 5:case 31:case 13:Yr=!1;return;case 27:case 3:Yr=!0;return;default:Bn=Bn.return}}function vl(r){if(r!==Bn)return!1;if(!pt)return Ex(r),pt=!0,!1;var i=r.tag,u;if((u=i!==3&&i!==27)&&((u=i===5)&&(u=r.type,u=!(u!=="form"&&u!=="button")||Rp(r.type,r.memoizedProps)),u=!u),u&&$t&&Si(r),Ex(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));$t=Yw(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));$t=Yw(r)}else i===27?(i=$t,Ii(r.type)?(r=Ip,Ip=null,$t=r):$t=i):$t=Bn?Wr(r.stateNode.nextSibling):null;return!0}function ks(){$t=Bn=null,pt=!1}function mm(){var r=wi;return r!==null&&(vr===null?vr=r:vr.push.apply(vr,r),wi=null),r}function Wo(r){wi===null?wi=[r]:wi.push(r)}var pm=P(null),js=null,$a=null;function ki(r,i,u){T(pm,i._currentValue),i._currentValue=u}function Ha(r){r._currentValue=pm.current,F(pm)}function gm(r,i,u){for(;r!==null;){var d=r.alternate;if((r.childLanes&i)!==i?(r.childLanes|=i,d!==null&&(d.childLanes|=i)):d!==null&&(d.childLanes&i)!==i&&(d.childLanes|=i),r===u)break;r=r.return}}function ym(r,i,u,d){var y=r.child;for(y!==null&&(y.return=r);y!==null;){var v=y.dependencies;if(v!==null){var E=y.child;v=v.firstContext;e:for(;v!==null;){var A=v;v=y;for(var H=0;H<i.length;H++)if(A.context===i[H]){v.lanes|=u,A=v.alternate,A!==null&&(A.lanes|=u),gm(v.return,u,r),d||(E=null);break e}v=A.next}}else if(y.tag===18){if(E=y.return,E===null)throw Error(a(341));E.lanes|=u,v=E.alternate,v!==null&&(v.lanes|=u),gm(E,u,r),E=null}else E=y.child;if(E!==null)E.return=y;else for(E=y;E!==null;){if(E===r){E=null;break}if(y=E.sibling,y!==null){y.return=E.return,E=y;break}E=E.return}y=E}}function bl(r,i,u,d){r=null;for(var y=i,v=!1;y!==null;){if(!v){if((y.flags&524288)!==0)v=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var E=y.alternate;if(E===null)throw Error(a(387));if(E=E.memoizedProps,E!==null){var A=y.type;Rr(y.pendingProps.value,E.value)||(r!==null?r.push(A):r=[A])}}else if(y===be.current){if(E=y.alternate,E===null)throw Error(a(387));E.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(r!==null?r.push(Eu):r=[Eu])}y=y.return}r!==null&&ym(i,r,u,d),i.flags|=262144}function ld(r){for(r=r.firstContext;r!==null;){if(!Rr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Es(r){js=r,$a=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Fn(r){return Cx(js,r)}function od(r,i){return js===null&&Es(r),Cx(r,i)}function Cx(r,i){var u=i._currentValue;if(i={context:i,memoizedValue:u,next:null},$a===null){if(r===null)throw Error(a(308));$a=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else $a=$a.next=i;return u}var AA=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(u,d){r.push(d)}};this.abort=function(){i.aborted=!0,r.forEach(function(u){return u()})}},RA=e.unstable_scheduleCallback,OA=e.unstable_NormalPriority,bn={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function vm(){return{controller:new AA,data:new Map,refCount:0}}function Jo(r){r.refCount--,r.refCount===0&&RA(OA,function(){r.controller.abort()})}var eu=null,bm=0,xl=0,wl=null;function zA(r,i){if(eu===null){var u=eu=[];bm=0,xl=Sp(),wl={status:"pending",value:void 0,then:function(d){u.push(d)}}}return bm++,i.then(Nx,Nx),i}function Nx(){if(--bm===0&&eu!==null){wl!==null&&(wl.status="fulfilled");var r=eu;eu=null,xl=0,wl=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function MA(r,i){var u=[],d={status:"pending",value:null,reason:null,then:function(y){u.push(y)}};return r.then(function(){d.status="fulfilled",d.value=i;for(var y=0;y<u.length;y++)(0,u[y])(i)},function(y){for(d.status="rejected",d.reason=y,y=0;y<u.length;y++)(0,u[y])(void 0)}),d}var _x=Z.S;Z.S=function(r,i){dw=cn(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&zA(r,i),_x!==null&&_x(r,i)};var Cs=P(null);function xm(){var r=Cs.current;return r!==null?r:Dt.pooledCache}function ud(r,i){i===null?T(Cs,Cs.current):T(Cs,i.pool)}function Tx(){var r=xm();return r===null?null:{parent:bn._currentValue,pool:r}}var Sl=Error(a(460)),wm=Error(a(474)),cd=Error(a(542)),dd={then:function(){}};function Ax(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Rx(r,i,u){switch(u=r[u],u===void 0?r.push(i):u!==i&&(i.then(Pa,Pa),i=u),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,zx(r),r;default:if(typeof i.status=="string")i.then(Pa,Pa);else{if(r=Dt,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=i,r.status="pending",r.then(function(d){if(i.status==="pending"){var y=i;y.status="fulfilled",y.value=d}},function(d){if(i.status==="pending"){var y=i;y.status="rejected",y.reason=d}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,zx(r),r}throw _s=i,Sl}}function Ns(r){try{var i=r._init;return i(r._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(_s=u,Sl):u}}var _s=null;function Ox(){if(_s===null)throw Error(a(459));var r=_s;return _s=null,r}function zx(r){if(r===Sl||r===cd)throw Error(a(483))}var kl=null,tu=0;function fd(r){var i=tu;return tu+=1,kl===null&&(kl=[]),Rx(kl,r,i)}function nu(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function hd(r,i){throw i.$$typeof===x?Error(a(525)):(r=Object.prototype.toString.call(i),Error(a(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function Mx(r){function i(X,Q){if(r){var ee=X.deletions;ee===null?(X.deletions=[Q],X.flags|=16):ee.push(Q)}}function u(X,Q){if(!r)return null;for(;Q!==null;)i(X,Q),Q=Q.sibling;return null}function d(X){for(var Q=new Map;X!==null;)X.key!==null?Q.set(X.key,X):Q.set(X.index,X),X=X.sibling;return Q}function y(X,Q){return X=Ba(X,Q),X.index=0,X.sibling=null,X}function v(X,Q,ee){return X.index=ee,r?(ee=X.alternate,ee!==null?(ee=ee.index,ee<Q?(X.flags|=67108866,Q):ee):(X.flags|=67108866,Q)):(X.flags|=1048576,Q)}function E(X){return r&&X.alternate===null&&(X.flags|=67108866),X}function A(X,Q,ee,de){return Q===null||Q.tag!==6?(Q=um(ee,X.mode,de),Q.return=X,Q):(Q=y(Q,ee),Q.return=X,Q)}function H(X,Q,ee,de){var Fe=ee.type;return Fe===k?ue(X,Q,ee.props.children,de,ee.key):Q!==null&&(Q.elementType===Fe||typeof Fe=="object"&&Fe!==null&&Fe.$$typeof===I&&Ns(Fe)===Q.type)?(Q=y(Q,ee.props),nu(Q,ee),Q.return=X,Q):(Q=id(ee.type,ee.key,ee.props,null,X.mode,de),nu(Q,ee),Q.return=X,Q)}function te(X,Q,ee,de){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==ee.containerInfo||Q.stateNode.implementation!==ee.implementation?(Q=cm(ee,X.mode,de),Q.return=X,Q):(Q=y(Q,ee.children||[]),Q.return=X,Q)}function ue(X,Q,ee,de,Fe){return Q===null||Q.tag!==7?(Q=Ss(ee,X.mode,de,Fe),Q.return=X,Q):(Q=y(Q,ee),Q.return=X,Q)}function fe(X,Q,ee){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Q=um(""+Q,X.mode,ee),Q.return=X,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case w:return ee=id(Q.type,Q.key,Q.props,null,X.mode,ee),nu(ee,Q),ee.return=X,ee;case S:return Q=cm(Q,X.mode,ee),Q.return=X,Q;case I:return Q=Ns(Q),fe(X,Q,ee)}if(W(Q)||ie(Q))return Q=Ss(Q,X.mode,ee,null),Q.return=X,Q;if(typeof Q.then=="function")return fe(X,fd(Q),ee);if(Q.$$typeof===R)return fe(X,od(X,Q),ee);hd(X,Q)}return null}function re(X,Q,ee,de){var Fe=Q!==null?Q.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return Fe!==null?null:A(X,Q,""+ee,de);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case w:return ee.key===Fe?H(X,Q,ee,de):null;case S:return ee.key===Fe?te(X,Q,ee,de):null;case I:return ee=Ns(ee),re(X,Q,ee,de)}if(W(ee)||ie(ee))return Fe!==null?null:ue(X,Q,ee,de,null);if(typeof ee.then=="function")return re(X,Q,fd(ee),de);if(ee.$$typeof===R)return re(X,Q,od(X,ee),de);hd(X,ee)}return null}function le(X,Q,ee,de,Fe){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return X=X.get(ee)||null,A(Q,X,""+de,Fe);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case w:return X=X.get(de.key===null?ee:de.key)||null,H(Q,X,de,Fe);case S:return X=X.get(de.key===null?ee:de.key)||null,te(Q,X,de,Fe);case I:return de=Ns(de),le(X,Q,ee,de,Fe)}if(W(de)||ie(de))return X=X.get(ee)||null,ue(Q,X,de,Fe,null);if(typeof de.then=="function")return le(X,Q,ee,fd(de),Fe);if(de.$$typeof===R)return le(X,Q,ee,od(Q,de),Fe);hd(Q,de)}return null}function Te(X,Q,ee,de){for(var Fe=null,kt=null,De=Q,Xe=Q=0,ft=null;De!==null&&Xe<ee.length;Xe++){De.index>Xe?(ft=De,De=null):ft=De.sibling;var jt=re(X,De,ee[Xe],de);if(jt===null){De===null&&(De=ft);break}r&&De&&jt.alternate===null&&i(X,De),Q=v(jt,Q,Xe),kt===null?Fe=jt:kt.sibling=jt,kt=jt,De=ft}if(Xe===ee.length)return u(X,De),pt&&Fa(X,Xe),Fe;if(De===null){for(;Xe<ee.length;Xe++)De=fe(X,ee[Xe],de),De!==null&&(Q=v(De,Q,Xe),kt===null?Fe=De:kt.sibling=De,kt=De);return pt&&Fa(X,Xe),Fe}for(De=d(De);Xe<ee.length;Xe++)ft=le(De,X,Xe,ee[Xe],de),ft!==null&&(r&&ft.alternate!==null&&De.delete(ft.key===null?Xe:ft.key),Q=v(ft,Q,Xe),kt===null?Fe=ft:kt.sibling=ft,kt=ft);return r&&De.forEach(function(Fi){return i(X,Fi)}),pt&&Fa(X,Xe),Fe}function Ze(X,Q,ee,de){if(ee==null)throw Error(a(151));for(var Fe=null,kt=null,De=Q,Xe=Q=0,ft=null,jt=ee.next();De!==null&&!jt.done;Xe++,jt=ee.next()){De.index>Xe?(ft=De,De=null):ft=De.sibling;var Fi=re(X,De,jt.value,de);if(Fi===null){De===null&&(De=ft);break}r&&De&&Fi.alternate===null&&i(X,De),Q=v(Fi,Q,Xe),kt===null?Fe=Fi:kt.sibling=Fi,kt=Fi,De=ft}if(jt.done)return u(X,De),pt&&Fa(X,Xe),Fe;if(De===null){for(;!jt.done;Xe++,jt=ee.next())jt=fe(X,jt.value,de),jt!==null&&(Q=v(jt,Q,Xe),kt===null?Fe=jt:kt.sibling=jt,kt=jt);return pt&&Fa(X,Xe),Fe}for(De=d(De);!jt.done;Xe++,jt=ee.next())jt=le(De,X,Xe,jt.value,de),jt!==null&&(r&&jt.alternate!==null&&De.delete(jt.key===null?Xe:jt.key),Q=v(jt,Q,Xe),kt===null?Fe=jt:kt.sibling=jt,kt=jt);return r&&De.forEach(function(Z2){return i(X,Z2)}),pt&&Fa(X,Xe),Fe}function zt(X,Q,ee,de){if(typeof ee=="object"&&ee!==null&&ee.type===k&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case w:e:{for(var Fe=ee.key;Q!==null;){if(Q.key===Fe){if(Fe=ee.type,Fe===k){if(Q.tag===7){u(X,Q.sibling),de=y(Q,ee.props.children),de.return=X,X=de;break e}}else if(Q.elementType===Fe||typeof Fe=="object"&&Fe!==null&&Fe.$$typeof===I&&Ns(Fe)===Q.type){u(X,Q.sibling),de=y(Q,ee.props),nu(de,ee),de.return=X,X=de;break e}u(X,Q);break}else i(X,Q);Q=Q.sibling}ee.type===k?(de=Ss(ee.props.children,X.mode,de,ee.key),de.return=X,X=de):(de=id(ee.type,ee.key,ee.props,null,X.mode,de),nu(de,ee),de.return=X,X=de)}return E(X);case S:e:{for(Fe=ee.key;Q!==null;){if(Q.key===Fe)if(Q.tag===4&&Q.stateNode.containerInfo===ee.containerInfo&&Q.stateNode.implementation===ee.implementation){u(X,Q.sibling),de=y(Q,ee.children||[]),de.return=X,X=de;break e}else{u(X,Q);break}else i(X,Q);Q=Q.sibling}de=cm(ee,X.mode,de),de.return=X,X=de}return E(X);case I:return ee=Ns(ee),zt(X,Q,ee,de)}if(W(ee))return Te(X,Q,ee,de);if(ie(ee)){if(Fe=ie(ee),typeof Fe!="function")throw Error(a(150));return ee=Fe.call(ee),Ze(X,Q,ee,de)}if(typeof ee.then=="function")return zt(X,Q,fd(ee),de);if(ee.$$typeof===R)return zt(X,Q,od(X,ee),de);hd(X,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,Q!==null&&Q.tag===6?(u(X,Q.sibling),de=y(Q,ee),de.return=X,X=de):(u(X,Q),de=um(ee,X.mode,de),de.return=X,X=de),E(X)):u(X,Q)}return function(X,Q,ee,de){try{tu=0;var Fe=zt(X,Q,ee,de);return kl=null,Fe}catch(De){if(De===Sl||De===cd)throw De;var kt=Or(29,De,null,X.mode);return kt.lanes=de,kt.return=X,kt}finally{}}}var Ts=Mx(!0),Dx=Mx(!1),ji=!1;function Sm(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function km(r,i){r=r.updateQueue,i.updateQueue===r&&(i.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Ei(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Ci(r,i,u){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(Et&2)!==0){var y=d.pending;return y===null?i.next=i:(i.next=y.next,y.next=i),d.pending=i,i=ad(r),vx(r,null,u),i}return rd(r,d,i,u),ad(r)}function ru(r,i,u){if(i=i.updateQueue,i!==null&&(i=i.shared,(u&4194048)!==0)){var d=i.lanes;d&=r.pendingLanes,u|=d,i.lanes=u,ys(r,u)}}function jm(r,i){var u=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,u===d)){var y=null,v=null;if(u=u.firstBaseUpdate,u!==null){do{var E={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};v===null?y=v=E:v=v.next=E,u=u.next}while(u!==null);v===null?y=v=i:v=v.next=i}else y=v=i;u={baseState:d.baseState,firstBaseUpdate:y,lastBaseUpdate:v,shared:d.shared,callbacks:d.callbacks},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=i:r.next=i,u.lastBaseUpdate=i}var Em=!1;function au(){if(Em){var r=wl;if(r!==null)throw r}}function iu(r,i,u,d){Em=!1;var y=r.updateQueue;ji=!1;var v=y.firstBaseUpdate,E=y.lastBaseUpdate,A=y.shared.pending;if(A!==null){y.shared.pending=null;var H=A,te=H.next;H.next=null,E===null?v=te:E.next=te,E=H;var ue=r.alternate;ue!==null&&(ue=ue.updateQueue,A=ue.lastBaseUpdate,A!==E&&(A===null?ue.firstBaseUpdate=te:A.next=te,ue.lastBaseUpdate=H))}if(v!==null){var fe=y.baseState;E=0,ue=te=H=null,A=v;do{var re=A.lane&-536870913,le=re!==A.lane;if(le?(dt&re)===re:(d&re)===re){re!==0&&re===xl&&(Em=!0),ue!==null&&(ue=ue.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Te=r,Ze=A;re=i;var zt=u;switch(Ze.tag){case 1:if(Te=Ze.payload,typeof Te=="function"){fe=Te.call(zt,fe,re);break e}fe=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Ze.payload,re=typeof Te=="function"?Te.call(zt,fe,re):Te,re==null)break e;fe=g({},fe,re);break e;case 2:ji=!0}}re=A.callback,re!==null&&(r.flags|=64,le&&(r.flags|=8192),le=y.callbacks,le===null?y.callbacks=[re]:le.push(re))}else le={lane:re,tag:A.tag,payload:A.payload,callback:A.callback,next:null},ue===null?(te=ue=le,H=fe):ue=ue.next=le,E|=re;if(A=A.next,A===null){if(A=y.shared.pending,A===null)break;le=A,A=le.next,le.next=null,y.lastBaseUpdate=le,y.shared.pending=null}}while(!0);ue===null&&(H=fe),y.baseState=H,y.firstBaseUpdate=te,y.lastBaseUpdate=ue,v===null&&(y.shared.lanes=0),Ri|=E,r.lanes=E,r.memoizedState=fe}}function Ix(r,i){if(typeof r!="function")throw Error(a(191,r));r.call(i)}function Lx(r,i){var u=r.callbacks;if(u!==null)for(r.callbacks=null,r=0;r<u.length;r++)Ix(u[r],i)}var jl=P(null),md=P(0);function Px(r,i){r=Wa,T(md,r),T(jl,i),Wa=r|i.baseLanes}function Cm(){T(md,Wa),T(jl,jl.current)}function Nm(){Wa=md.current,F(jl),F(md)}var zr=P(null),Xr=null;function Ni(r){var i=r.alternate;T(mn,mn.current&1),T(zr,r),Xr===null&&(i===null||jl.current!==null||i.memoizedState!==null)&&(Xr=r)}function _m(r){T(mn,mn.current),T(zr,r),Xr===null&&(Xr=r)}function Ux(r){r.tag===22?(T(mn,mn.current),T(zr,r),Xr===null&&(Xr=r)):_i()}function _i(){T(mn,mn.current),T(zr,zr.current)}function Mr(r){F(zr),Xr===r&&(Xr=null),F(mn)}var mn=P(0);function pd(r){for(var i=r;i!==null;){if(i.tag===13){var u=i.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||Mp(u)||Dp(u)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var qa=0,Ye=null,Rt=null,xn=null,gd=!1,El=!1,As=!1,yd=0,su=0,Cl=null,DA=0;function nn(){throw Error(a(321))}function Tm(r,i){if(i===null)return!1;for(var u=0;u<i.length&&u<r.length;u++)if(!Rr(r[u],i[u]))return!1;return!0}function Am(r,i,u,d,y,v){return qa=v,Ye=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,Z.H=r===null||r.memoizedState===null?S0:Zm,As=!1,v=u(d,y),As=!1,El&&(v=Fx(i,u,d,y)),Bx(r),v}function Bx(r){Z.H=uu;var i=Rt!==null&&Rt.next!==null;if(qa=0,xn=Rt=Ye=null,gd=!1,su=0,Cl=null,i)throw Error(a(300));r===null||wn||(r=r.dependencies,r!==null&&ld(r)&&(wn=!0))}function Fx(r,i,u,d){Ye=r;var y=0;do{if(El&&(Cl=null),su=0,El=!1,25<=y)throw Error(a(301));if(y+=1,xn=Rt=null,r.updateQueue!=null){var v=r.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}Z.H=k0,v=i(u,d)}while(El);return v}function IA(){var r=Z.H,i=r.useState()[0];return i=typeof i.then=="function"?lu(i):i,r=r.useState()[0],(Rt!==null?Rt.memoizedState:null)!==r&&(Ye.flags|=1024),i}function Rm(){var r=yd!==0;return yd=0,r}function Om(r,i,u){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~u}function zm(r){if(gd){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}gd=!1}qa=0,xn=Rt=Ye=null,El=!1,su=yd=0,Cl=null}function ar(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xn===null?Ye.memoizedState=xn=r:xn=xn.next=r,xn}function pn(){if(Rt===null){var r=Ye.alternate;r=r!==null?r.memoizedState:null}else r=Rt.next;var i=xn===null?Ye.memoizedState:xn.next;if(i!==null)xn=i,Rt=r;else{if(r===null)throw Ye.alternate===null?Error(a(467)):Error(a(310));Rt=r,r={memoizedState:Rt.memoizedState,baseState:Rt.baseState,baseQueue:Rt.baseQueue,queue:Rt.queue,next:null},xn===null?Ye.memoizedState=xn=r:xn=xn.next=r}return xn}function vd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function lu(r){var i=su;return su+=1,Cl===null&&(Cl=[]),r=Rx(Cl,r,i),i=Ye,(xn===null?i.memoizedState:xn.next)===null&&(i=i.alternate,Z.H=i===null||i.memoizedState===null?S0:Zm),r}function bd(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return lu(r);if(r.$$typeof===R)return Fn(r)}throw Error(a(438,String(r)))}function Mm(r){var i=null,u=Ye.updateQueue;if(u!==null&&(i=u.memoCache),i==null){var d=Ye.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(i={data:d.data.map(function(y){return y.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),u===null&&(u=vd(),Ye.updateQueue=u),u.memoCache=i,u=i.data[i.index],u===void 0)for(u=i.data[i.index]=Array(r),d=0;d<r;d++)u[d]=z;return i.index++,u}function Za(r,i){return typeof i=="function"?i(r):i}function xd(r){var i=pn();return Dm(i,Rt,r)}function Dm(r,i,u){var d=r.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=u;var y=r.baseQueue,v=d.pending;if(v!==null){if(y!==null){var E=y.next;y.next=v.next,v.next=E}i.baseQueue=y=v,d.pending=null}if(v=r.baseState,y===null)r.memoizedState=v;else{i=y.next;var A=E=null,H=null,te=i,ue=!1;do{var fe=te.lane&-536870913;if(fe!==te.lane?(dt&fe)===fe:(qa&fe)===fe){var re=te.revertLane;if(re===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),fe===xl&&(ue=!0);else if((qa&re)===re){te=te.next,re===xl&&(ue=!0);continue}else fe={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},H===null?(A=H=fe,E=v):H=H.next=fe,Ye.lanes|=re,Ri|=re;fe=te.action,As&&u(v,fe),v=te.hasEagerState?te.eagerState:u(v,fe)}else re={lane:fe,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},H===null?(A=H=re,E=v):H=H.next=re,Ye.lanes|=fe,Ri|=fe;te=te.next}while(te!==null&&te!==i);if(H===null?E=v:H.next=A,!Rr(v,r.memoizedState)&&(wn=!0,ue&&(u=wl,u!==null)))throw u;r.memoizedState=v,r.baseState=E,r.baseQueue=H,d.lastRenderedState=v}return y===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function Im(r){var i=pn(),u=i.queue;if(u===null)throw Error(a(311));u.lastRenderedReducer=r;var d=u.dispatch,y=u.pending,v=i.memoizedState;if(y!==null){u.pending=null;var E=y=y.next;do v=r(v,E.action),E=E.next;while(E!==y);Rr(v,i.memoizedState)||(wn=!0),i.memoizedState=v,i.baseQueue===null&&(i.baseState=v),u.lastRenderedState=v}return[v,d]}function $x(r,i,u){var d=Ye,y=pn(),v=pt;if(v){if(u===void 0)throw Error(a(407));u=u()}else u=i();var E=!Rr((Rt||y).memoizedState,u);if(E&&(y.memoizedState=u,wn=!0),y=y.queue,Um(Zx.bind(null,d,y,r),[r]),y.getSnapshot!==i||E||xn!==null&&xn.memoizedState.tag&1){if(d.flags|=2048,Nl(9,{destroy:void 0},qx.bind(null,d,y,u,i),null),Dt===null)throw Error(a(349));v||(qa&127)!==0||Hx(d,i,u)}return u}function Hx(r,i,u){r.flags|=16384,r={getSnapshot:i,value:u},i=Ye.updateQueue,i===null?(i=vd(),Ye.updateQueue=i,i.stores=[r]):(u=i.stores,u===null?i.stores=[r]:u.push(r))}function qx(r,i,u,d){i.value=u,i.getSnapshot=d,Gx(i)&&Vx(r)}function Zx(r,i,u){return u(function(){Gx(i)&&Vx(r)})}function Gx(r){var i=r.getSnapshot;r=r.value;try{var u=i();return!Rr(r,u)}catch{return!0}}function Vx(r){var i=ws(r,2);i!==null&&br(i,r,2)}function Lm(r){var i=ar();if(typeof r=="function"){var u=r;if(r=u(),As){At(!0);try{u()}finally{At(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Za,lastRenderedState:r},i}function Qx(r,i,u,d){return r.baseState=u,Dm(r,Rt,typeof d=="function"?d:Za)}function LA(r,i,u,d,y){if(kd(r))throw Error(a(485));if(r=i.action,r!==null){var v={payload:y,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){v.listeners.push(E)}};Z.T!==null?u(!0):v.isTransition=!1,d(v),u=i.pending,u===null?(v.next=i.pending=v,Kx(i,v)):(v.next=u.next,i.pending=u.next=v)}}function Kx(r,i){var u=i.action,d=i.payload,y=r.state;if(i.isTransition){var v=Z.T,E={};Z.T=E;try{var A=u(y,d),H=Z.S;H!==null&&H(E,A),Yx(r,i,A)}catch(te){Pm(r,i,te)}finally{v!==null&&E.types!==null&&(v.types=E.types),Z.T=v}}else try{v=u(y,d),Yx(r,i,v)}catch(te){Pm(r,i,te)}}function Yx(r,i,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(d){Xx(r,i,d)},function(d){return Pm(r,i,d)}):Xx(r,i,u)}function Xx(r,i,u){i.status="fulfilled",i.value=u,Wx(i),r.state=u,i=r.pending,i!==null&&(u=i.next,u===i?r.pending=null:(u=u.next,i.next=u,Kx(r,u)))}function Pm(r,i,u){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=u,Wx(i),i=i.next;while(i!==d)}r.action=null}function Wx(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function Jx(r,i){return i}function e0(r,i){if(pt){var u=Dt.formState;if(u!==null){e:{var d=Ye;if(pt){if($t){t:{for(var y=$t,v=Yr;y.nodeType!==8;){if(!v){y=null;break t}if(y=Wr(y.nextSibling),y===null){y=null;break t}}v=y.data,y=v==="F!"||v==="F"?y:null}if(y){$t=Wr(y.nextSibling),d=y.data==="F!";break e}}Si(d)}d=!1}d&&(i=u[0])}}return u=ar(),u.memoizedState=u.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jx,lastRenderedState:i},u.queue=d,u=b0.bind(null,Ye,d),d.dispatch=u,d=Lm(!1),v=qm.bind(null,Ye,!1,d.queue),d=ar(),y={state:i,dispatch:null,action:r,pending:null},d.queue=y,u=LA.bind(null,Ye,y,v,u),y.dispatch=u,d.memoizedState=r,[i,u,!1]}function t0(r){var i=pn();return n0(i,Rt,r)}function n0(r,i,u){if(i=Dm(r,i,Jx)[0],r=xd(Za)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=lu(i)}catch(E){throw E===Sl?cd:E}else d=i;i=pn();var y=i.queue,v=y.dispatch;return u!==i.memoizedState&&(Ye.flags|=2048,Nl(9,{destroy:void 0},PA.bind(null,y,u),null)),[d,v,r]}function PA(r,i){r.action=i}function r0(r){var i=pn(),u=Rt;if(u!==null)return n0(i,u,r);pn(),i=i.memoizedState,u=pn();var d=u.queue.dispatch;return u.memoizedState=r,[i,d,!1]}function Nl(r,i,u,d){return r={tag:r,create:u,deps:d,inst:i,next:null},i=Ye.updateQueue,i===null&&(i=vd(),Ye.updateQueue=i),u=i.lastEffect,u===null?i.lastEffect=r.next=r:(d=u.next,u.next=r,r.next=d,i.lastEffect=r),r}function a0(){return pn().memoizedState}function wd(r,i,u,d){var y=ar();Ye.flags|=r,y.memoizedState=Nl(1|i,{destroy:void 0},u,d===void 0?null:d)}function Sd(r,i,u,d){var y=pn();d=d===void 0?null:d;var v=y.memoizedState.inst;Rt!==null&&d!==null&&Tm(d,Rt.memoizedState.deps)?y.memoizedState=Nl(i,v,u,d):(Ye.flags|=r,y.memoizedState=Nl(1|i,v,u,d))}function i0(r,i){wd(8390656,8,r,i)}function Um(r,i){Sd(2048,8,r,i)}function UA(r){Ye.flags|=4;var i=Ye.updateQueue;if(i===null)i=vd(),Ye.updateQueue=i,i.events=[r];else{var u=i.events;u===null?i.events=[r]:u.push(r)}}function s0(r){var i=pn().memoizedState;return UA({ref:i,nextImpl:r}),function(){if((Et&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function l0(r,i){return Sd(4,2,r,i)}function o0(r,i){return Sd(4,4,r,i)}function u0(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 c0(r,i,u){u=u!=null?u.concat([r]):null,Sd(4,4,u0.bind(null,i,r),u)}function Bm(){}function d0(r,i){var u=pn();i=i===void 0?null:i;var d=u.memoizedState;return i!==null&&Tm(i,d[1])?d[0]:(u.memoizedState=[r,i],r)}function f0(r,i){var u=pn();i=i===void 0?null:i;var d=u.memoizedState;if(i!==null&&Tm(i,d[1]))return d[0];if(d=r(),As){At(!0);try{r()}finally{At(!1)}}return u.memoizedState=[d,i],d}function Fm(r,i,u){return u===void 0||(qa&1073741824)!==0&&(dt&261930)===0?r.memoizedState=i:(r.memoizedState=u,r=hw(),Ye.lanes|=r,Ri|=r,u)}function h0(r,i,u,d){return Rr(u,i)?u:jl.current!==null?(r=Fm(r,u,d),Rr(r,i)||(wn=!0),r):(qa&42)===0||(qa&1073741824)!==0&&(dt&261930)===0?(wn=!0,r.memoizedState=u):(r=hw(),Ye.lanes|=r,Ri|=r,i)}function m0(r,i,u,d,y){var v=ne.p;ne.p=v!==0&&8>v?v:8;var E=Z.T,A={};Z.T=A,qm(r,!1,i,u);try{var H=y(),te=Z.S;if(te!==null&&te(A,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var ue=MA(H,d);ou(r,i,ue,Lr(r))}else ou(r,i,d,Lr(r))}catch(fe){ou(r,i,{then:function(){},status:"rejected",reason:fe},Lr())}finally{ne.p=v,E!==null&&A.types!==null&&(E.types=A.types),Z.T=E}}function BA(){}function $m(r,i,u,d){if(r.tag!==5)throw Error(a(476));var y=p0(r).queue;m0(r,y,i,ke,u===null?BA:function(){return g0(r),u(d)})}function p0(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:ke,baseState:ke,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Za,lastRenderedState:ke},next:null};var u={};return i.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Za,lastRenderedState:u},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function g0(r){var i=p0(r);i.next===null&&(i=r.alternate.memoizedState),ou(r,i.next.queue,{},Lr())}function Hm(){return Fn(Eu)}function y0(){return pn().memoizedState}function v0(){return pn().memoizedState}function FA(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var u=Lr();r=Ei(u);var d=Ci(i,r,u);d!==null&&(br(d,i,u),ru(d,i,u)),i={cache:vm()},r.payload=i;return}i=i.return}}function $A(r,i,u){var d=Lr();u={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},kd(r)?x0(i,u):(u=lm(r,i,u,d),u!==null&&(br(u,r,d),w0(u,i,d)))}function b0(r,i,u){var d=Lr();ou(r,i,u,d)}function ou(r,i,u,d){var y={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(kd(r))x0(i,y);else{var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var E=i.lastRenderedState,A=v(E,u);if(y.hasEagerState=!0,y.eagerState=A,Rr(A,E))return rd(r,i,y,0),Dt===null&&nd(),!1}catch{}finally{}if(u=lm(r,i,y,d),u!==null)return br(u,r,d),w0(u,i,d),!0}return!1}function qm(r,i,u,d){if(d={lane:2,revertLane:Sp(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},kd(r)){if(i)throw Error(a(479))}else i=lm(r,u,d,2),i!==null&&br(i,r,2)}function kd(r){var i=r.alternate;return r===Ye||i!==null&&i===Ye}function x0(r,i){El=gd=!0;var u=r.pending;u===null?i.next=i:(i.next=u.next,u.next=i),r.pending=i}function w0(r,i,u){if((u&4194048)!==0){var d=i.lanes;d&=r.pendingLanes,u|=d,i.lanes=u,ys(r,u)}}var uu={readContext:Fn,use:bd,useCallback:nn,useContext:nn,useEffect:nn,useImperativeHandle:nn,useLayoutEffect:nn,useInsertionEffect:nn,useMemo:nn,useReducer:nn,useRef:nn,useState:nn,useDebugValue:nn,useDeferredValue:nn,useTransition:nn,useSyncExternalStore:nn,useId:nn,useHostTransitionStatus:nn,useFormState:nn,useActionState:nn,useOptimistic:nn,useMemoCache:nn,useCacheRefresh:nn};uu.useEffectEvent=nn;var S0={readContext:Fn,use:bd,useCallback:function(r,i){return ar().memoizedState=[r,i===void 0?null:i],r},useContext:Fn,useEffect:i0,useImperativeHandle:function(r,i,u){u=u!=null?u.concat([r]):null,wd(4194308,4,u0.bind(null,i,r),u)},useLayoutEffect:function(r,i){return wd(4194308,4,r,i)},useInsertionEffect:function(r,i){wd(4,2,r,i)},useMemo:function(r,i){var u=ar();i=i===void 0?null:i;var d=r();if(As){At(!0);try{r()}finally{At(!1)}}return u.memoizedState=[d,i],d},useReducer:function(r,i,u){var d=ar();if(u!==void 0){var y=u(i);if(As){At(!0);try{u(i)}finally{At(!1)}}}else y=i;return d.memoizedState=d.baseState=y,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:y},d.queue=r,r=r.dispatch=$A.bind(null,Ye,r),[d.memoizedState,r]},useRef:function(r){var i=ar();return r={current:r},i.memoizedState=r},useState:function(r){r=Lm(r);var i=r.queue,u=b0.bind(null,Ye,i);return i.dispatch=u,[r.memoizedState,u]},useDebugValue:Bm,useDeferredValue:function(r,i){var u=ar();return Fm(u,r,i)},useTransition:function(){var r=Lm(!1);return r=m0.bind(null,Ye,r.queue,!0,!1),ar().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,u){var d=Ye,y=ar();if(pt){if(u===void 0)throw Error(a(407));u=u()}else{if(u=i(),Dt===null)throw Error(a(349));(dt&127)!==0||Hx(d,i,u)}y.memoizedState=u;var v={value:u,getSnapshot:i};return y.queue=v,i0(Zx.bind(null,d,v,r),[r]),d.flags|=2048,Nl(9,{destroy:void 0},qx.bind(null,d,v,u,i),null),u},useId:function(){var r=ar(),i=Dt.identifierPrefix;if(pt){var u=ja,d=ka;u=(d&~(1<<32-lt(d)-1)).toString(32)+u,i="_"+i+"R_"+u,u=yd++,0<u&&(i+="H"+u.toString(32)),i+="_"}else u=DA++,i="_"+i+"r_"+u.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:Hm,useFormState:e0,useActionState:e0,useOptimistic:function(r){var i=ar();i.memoizedState=i.baseState=r;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=u,i=qm.bind(null,Ye,!0,u),u.dispatch=i,[r,i]},useMemoCache:Mm,useCacheRefresh:function(){return ar().memoizedState=FA.bind(null,Ye)},useEffectEvent:function(r){var i=ar(),u={impl:r};return i.memoizedState=u,function(){if((Et&2)!==0)throw Error(a(440));return u.impl.apply(void 0,arguments)}}},Zm={readContext:Fn,use:bd,useCallback:d0,useContext:Fn,useEffect:Um,useImperativeHandle:c0,useInsertionEffect:l0,useLayoutEffect:o0,useMemo:f0,useReducer:xd,useRef:a0,useState:function(){return xd(Za)},useDebugValue:Bm,useDeferredValue:function(r,i){var u=pn();return h0(u,Rt.memoizedState,r,i)},useTransition:function(){var r=xd(Za)[0],i=pn().memoizedState;return[typeof r=="boolean"?r:lu(r),i]},useSyncExternalStore:$x,useId:y0,useHostTransitionStatus:Hm,useFormState:t0,useActionState:t0,useOptimistic:function(r,i){var u=pn();return Qx(u,Rt,r,i)},useMemoCache:Mm,useCacheRefresh:v0};Zm.useEffectEvent=s0;var k0={readContext:Fn,use:bd,useCallback:d0,useContext:Fn,useEffect:Um,useImperativeHandle:c0,useInsertionEffect:l0,useLayoutEffect:o0,useMemo:f0,useReducer:Im,useRef:a0,useState:function(){return Im(Za)},useDebugValue:Bm,useDeferredValue:function(r,i){var u=pn();return Rt===null?Fm(u,r,i):h0(u,Rt.memoizedState,r,i)},useTransition:function(){var r=Im(Za)[0],i=pn().memoizedState;return[typeof r=="boolean"?r:lu(r),i]},useSyncExternalStore:$x,useId:y0,useHostTransitionStatus:Hm,useFormState:r0,useActionState:r0,useOptimistic:function(r,i){var u=pn();return Rt!==null?Qx(u,Rt,r,i):(u.baseState=r,[r,u.queue.dispatch])},useMemoCache:Mm,useCacheRefresh:v0};k0.useEffectEvent=s0;function Gm(r,i,u,d){i=r.memoizedState,u=u(d,i),u=u==null?i:g({},i,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var Vm={enqueueSetState:function(r,i,u){r=r._reactInternals;var d=Lr(),y=Ei(d);y.payload=i,u!=null&&(y.callback=u),i=Ci(r,y,d),i!==null&&(br(i,r,d),ru(i,r,d))},enqueueReplaceState:function(r,i,u){r=r._reactInternals;var d=Lr(),y=Ei(d);y.tag=1,y.payload=i,u!=null&&(y.callback=u),i=Ci(r,y,d),i!==null&&(br(i,r,d),ru(i,r,d))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var u=Lr(),d=Ei(u);d.tag=2,i!=null&&(d.callback=i),i=Ci(r,d,u),i!==null&&(br(i,r,u),ru(i,r,u))}};function j0(r,i,u,d,y,v,E){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,v,E):i.prototype&&i.prototype.isPureReactComponent?!Ko(u,d)||!Ko(y,v):!0}function E0(r,i,u,d){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(u,d),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(u,d),i.state!==r&&Vm.enqueueReplaceState(i,i.state,null)}function Rs(r,i){var u=i;if("ref"in i){u={};for(var d in i)d!=="ref"&&(u[d]=i[d])}if(r=r.defaultProps){u===i&&(u=g({},u));for(var y in r)u[y]===void 0&&(u[y]=r[y])}return u}function C0(r){td(r)}function N0(r){console.error(r)}function _0(r){td(r)}function jd(r,i){try{var u=r.onUncaughtError;u(i.value,{componentStack:i.stack})}catch(d){setTimeout(function(){throw d})}}function T0(r,i,u){try{var d=r.onCaughtError;d(u.value,{componentStack:u.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Qm(r,i,u){return u=Ei(u),u.tag=3,u.payload={element:null},u.callback=function(){jd(r,i)},u}function A0(r){return r=Ei(r),r.tag=3,r}function R0(r,i,u,d){var y=u.type.getDerivedStateFromError;if(typeof y=="function"){var v=d.value;r.payload=function(){return y(v)},r.callback=function(){T0(i,u,d)}}var E=u.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(r.callback=function(){T0(i,u,d),typeof y!="function"&&(Oi===null?Oi=new Set([this]):Oi.add(this));var A=d.stack;this.componentDidCatch(d.value,{componentStack:A!==null?A:""})})}function HA(r,i,u,d,y){if(u.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(i=u.alternate,i!==null&&bl(i,u,y,!0),u=zr.current,u!==null){switch(u.tag){case 31:case 13:return Xr===null?Id():u.alternate===null&&rn===0&&(rn=3),u.flags&=-257,u.flags|=65536,u.lanes=y,d===dd?u.flags|=16384:(i=u.updateQueue,i===null?u.updateQueue=new Set([d]):i.add(d),bp(r,d,y)),!1;case 22:return u.flags|=65536,d===dd?u.flags|=16384:(i=u.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([d])},u.updateQueue=i):(u=i.retryQueue,u===null?i.retryQueue=new Set([d]):u.add(d)),bp(r,d,y)),!1}throw Error(a(435,u.tag))}return bp(r,d,y),Id(),!1}if(pt)return i=zr.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=y,d!==hm&&(r=Error(a(422),{cause:d}),Wo(Vr(r,u)))):(d!==hm&&(i=Error(a(423),{cause:d}),Wo(Vr(i,u))),r=r.current.alternate,r.flags|=65536,y&=-y,r.lanes|=y,d=Vr(d,u),y=Qm(r.stateNode,d,y),jm(r,y),rn!==4&&(rn=2)),!1;var v=Error(a(520),{cause:d});if(v=Vr(v,u),yu===null?yu=[v]:yu.push(v),rn!==4&&(rn=2),i===null)return!0;d=Vr(d,u),u=i;do{switch(u.tag){case 3:return u.flags|=65536,r=y&-y,u.lanes|=r,r=Qm(u.stateNode,d,r),jm(u,r),!1;case 1:if(i=u.type,v=u.stateNode,(u.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Oi===null||!Oi.has(v))))return u.flags|=65536,y&=-y,u.lanes|=y,y=A0(y),R0(y,r,u,d),jm(u,y),!1}u=u.return}while(u!==null);return!1}var Km=Error(a(461)),wn=!1;function $n(r,i,u,d){i.child=r===null?Dx(i,null,u,d):Ts(i,r.child,u,d)}function O0(r,i,u,d,y){u=u.render;var v=i.ref;if("ref"in d){var E={};for(var A in d)A!=="ref"&&(E[A]=d[A])}else E=d;return Es(i),d=Am(r,i,u,E,v,y),A=Rm(),r!==null&&!wn?(Om(r,i,y),Ga(r,i,y)):(pt&&A&&dm(i),i.flags|=1,$n(r,i,d,y),i.child)}function z0(r,i,u,d,y){if(r===null){var v=u.type;return typeof v=="function"&&!om(v)&&v.defaultProps===void 0&&u.compare===null?(i.tag=15,i.type=v,M0(r,i,v,d,y)):(r=id(u.type,null,d,i,i.mode,y),r.ref=i.ref,r.return=i,i.child=r)}if(v=r.child,!rp(r,y)){var E=v.memoizedProps;if(u=u.compare,u=u!==null?u:Ko,u(E,d)&&r.ref===i.ref)return Ga(r,i,y)}return i.flags|=1,r=Ba(v,d),r.ref=i.ref,r.return=i,i.child=r}function M0(r,i,u,d,y){if(r!==null){var v=r.memoizedProps;if(Ko(v,d)&&r.ref===i.ref)if(wn=!1,i.pendingProps=d=v,rp(r,y))(r.flags&131072)!==0&&(wn=!0);else return i.lanes=r.lanes,Ga(r,i,y)}return Ym(r,i,u,d,y)}function D0(r,i,u,d){var y=d.children,v=r!==null?r.memoizedState:null;if(r===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((i.flags&128)!==0){if(v=v!==null?v.baseLanes|u:u,r!==null){for(d=i.child=r.child,y=0;d!==null;)y=y|d.lanes|d.childLanes,d=d.sibling;d=y&~v}else d=0,i.child=null;return I0(r,i,v,u,d)}if((u&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&ud(i,v!==null?v.cachePool:null),v!==null?Px(i,v):Cm(),Ux(i);else return d=i.lanes=536870912,I0(r,i,v!==null?v.baseLanes|u:u,u,d)}else v!==null?(ud(i,v.cachePool),Px(i,v),_i(),i.memoizedState=null):(r!==null&&ud(i,null),Cm(),_i());return $n(r,i,y,u),i.child}function cu(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function I0(r,i,u,d,y){var v=xm();return v=v===null?null:{parent:bn._currentValue,pool:v},i.memoizedState={baseLanes:u,cachePool:v},r!==null&&ud(i,null),Cm(),Ux(i),r!==null&&bl(r,i,d,!0),i.childLanes=y,null}function Ed(r,i){return i=Nd({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function L0(r,i,u){return Ts(i,r.child,null,u),r=Ed(i,i.pendingProps),r.flags|=2,Mr(i),i.memoizedState=null,r}function qA(r,i,u){var d=i.pendingProps,y=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(pt){if(d.mode==="hidden")return r=Ed(i,d),i.lanes=536870912,cu(null,r);if(_m(i),(r=$t)?(r=Kw(r,Yr),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:xi!==null?{id:ka,overflow:ja}:null,retryLane:536870912,hydrationErrors:null},u=xx(r),u.return=i,i.child=u,Bn=i,$t=null)):r=null,r===null)throw Si(i);return i.lanes=536870912,null}return Ed(i,d)}var v=r.memoizedState;if(v!==null){var E=v.dehydrated;if(_m(i),y)if(i.flags&256)i.flags&=-257,i=L0(r,i,u);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(a(558));else if(wn||bl(r,i,u,!1),y=(u&r.childLanes)!==0,wn||y){if(d=Dt,d!==null&&(E=$c(d,u),E!==0&&E!==v.retryLane))throw v.retryLane=E,ws(r,E),br(d,r,E),Km;Id(),i=L0(r,i,u)}else r=v.treeContext,$t=Wr(E.nextSibling),Bn=i,pt=!0,wi=null,Yr=!1,r!==null&&kx(i,r),i=Ed(i,d),i.flags|=4096;return i}return r=Ba(r.child,{mode:d.mode,children:d.children}),r.ref=i.ref,i.child=r,r.return=i,r}function Cd(r,i){var u=i.ref;if(u===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(a(284));(r===null||r.ref!==u)&&(i.flags|=4194816)}}function Ym(r,i,u,d,y){return Es(i),u=Am(r,i,u,d,void 0,y),d=Rm(),r!==null&&!wn?(Om(r,i,y),Ga(r,i,y)):(pt&&d&&dm(i),i.flags|=1,$n(r,i,u,y),i.child)}function P0(r,i,u,d,y,v){return Es(i),i.updateQueue=null,u=Fx(i,d,u,y),Bx(r),d=Rm(),r!==null&&!wn?(Om(r,i,v),Ga(r,i,v)):(pt&&d&&dm(i),i.flags|=1,$n(r,i,u,v),i.child)}function U0(r,i,u,d,y){if(Es(i),i.stateNode===null){var v=pl,E=u.contextType;typeof E=="object"&&E!==null&&(v=Fn(E)),v=new u(d,v),i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Vm,i.stateNode=v,v._reactInternals=i,v=i.stateNode,v.props=d,v.state=i.memoizedState,v.refs={},Sm(i),E=u.contextType,v.context=typeof E=="object"&&E!==null?Fn(E):pl,v.state=i.memoizedState,E=u.getDerivedStateFromProps,typeof E=="function"&&(Gm(i,u,E,d),v.state=i.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(E=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),E!==v.state&&Vm.enqueueReplaceState(v,v.state,null),iu(i,d,v,y),au(),v.state=i.memoizedState),typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!0}else if(r===null){v=i.stateNode;var A=i.memoizedProps,H=Rs(u,A);v.props=H;var te=v.context,ue=u.contextType;E=pl,typeof ue=="object"&&ue!==null&&(E=Fn(ue));var fe=u.getDerivedStateFromProps;ue=typeof fe=="function"||typeof v.getSnapshotBeforeUpdate=="function",A=i.pendingProps!==A,ue||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(A||te!==E)&&E0(i,v,d,E),ji=!1;var re=i.memoizedState;v.state=re,iu(i,d,v,y),au(),te=i.memoizedState,A||re!==te||ji?(typeof fe=="function"&&(Gm(i,u,fe,d),te=i.memoizedState),(H=ji||j0(i,u,H,d,re,te,E))?(ue||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(i.flags|=4194308)):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=d,i.memoizedState=te),v.props=d,v.state=te,v.context=E,d=H):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{v=i.stateNode,km(r,i),E=i.memoizedProps,ue=Rs(u,E),v.props=ue,fe=i.pendingProps,re=v.context,te=u.contextType,H=pl,typeof te=="object"&&te!==null&&(H=Fn(te)),A=u.getDerivedStateFromProps,(te=typeof A=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(E!==fe||re!==H)&&E0(i,v,d,H),ji=!1,re=i.memoizedState,v.state=re,iu(i,d,v,y),au();var le=i.memoizedState;E!==fe||re!==le||ji||r!==null&&r.dependencies!==null&&ld(r.dependencies)?(typeof A=="function"&&(Gm(i,u,A,d),le=i.memoizedState),(ue=ji||j0(i,u,ue,d,re,le,H)||r!==null&&r.dependencies!==null&&ld(r.dependencies))?(te||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(d,le,H),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(d,le,H)),typeof v.componentDidUpdate=="function"&&(i.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof v.componentDidUpdate!="function"||E===r.memoizedProps&&re===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&re===r.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=le),v.props=d,v.state=le,v.context=H,d=ue):(typeof v.componentDidUpdate!="function"||E===r.memoizedProps&&re===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&re===r.memoizedState||(i.flags|=1024),d=!1)}return v=d,Cd(r,i),d=(i.flags&128)!==0,v||d?(v=i.stateNode,u=d&&typeof u.getDerivedStateFromError!="function"?null:v.render(),i.flags|=1,r!==null&&d?(i.child=Ts(i,r.child,null,y),i.child=Ts(i,null,u,y)):$n(r,i,u,y),i.memoizedState=v.state,r=i.child):r=Ga(r,i,y),r}function B0(r,i,u,d){return ks(),i.flags|=256,$n(r,i,u,d),i.child}var Xm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wm(r){return{baseLanes:r,cachePool:Tx()}}function Jm(r,i,u){return r=r!==null?r.childLanes&~u:0,i&&(r|=Ir),r}function F0(r,i,u){var d=i.pendingProps,y=!1,v=(i.flags&128)!==0,E;if((E=v)||(E=r!==null&&r.memoizedState===null?!1:(mn.current&2)!==0),E&&(y=!0,i.flags&=-129),E=(i.flags&32)!==0,i.flags&=-33,r===null){if(pt){if(y?Ni(i):_i(),(r=$t)?(r=Kw(r,Yr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:xi!==null?{id:ka,overflow:ja}:null,retryLane:536870912,hydrationErrors:null},u=xx(r),u.return=i,i.child=u,Bn=i,$t=null)):r=null,r===null)throw Si(i);return Dp(r)?i.lanes=32:i.lanes=536870912,null}var A=d.children;return d=d.fallback,y?(_i(),y=i.mode,A=Nd({mode:"hidden",children:A},y),d=Ss(d,y,u,null),A.return=i,d.return=i,A.sibling=d,i.child=A,d=i.child,d.memoizedState=Wm(u),d.childLanes=Jm(r,E,u),i.memoizedState=Xm,cu(null,d)):(Ni(i),ep(i,A))}var H=r.memoizedState;if(H!==null&&(A=H.dehydrated,A!==null)){if(v)i.flags&256?(Ni(i),i.flags&=-257,i=tp(r,i,u)):i.memoizedState!==null?(_i(),i.child=r.child,i.flags|=128,i=null):(_i(),A=d.fallback,y=i.mode,d=Nd({mode:"visible",children:d.children},y),A=Ss(A,y,u,null),A.flags|=2,d.return=i,A.return=i,d.sibling=A,i.child=d,Ts(i,r.child,null,u),d=i.child,d.memoizedState=Wm(u),d.childLanes=Jm(r,E,u),i.memoizedState=Xm,i=cu(null,d));else if(Ni(i),Dp(A)){if(E=A.nextSibling&&A.nextSibling.dataset,E)var te=E.dgst;E=te,d=Error(a(419)),d.stack="",d.digest=E,Wo({value:d,source:null,stack:null}),i=tp(r,i,u)}else if(wn||bl(r,i,u,!1),E=(u&r.childLanes)!==0,wn||E){if(E=Dt,E!==null&&(d=$c(E,u),d!==0&&d!==H.retryLane))throw H.retryLane=d,ws(r,d),br(E,r,d),Km;Mp(A)||Id(),i=tp(r,i,u)}else Mp(A)?(i.flags|=192,i.child=r.child,i=null):(r=H.treeContext,$t=Wr(A.nextSibling),Bn=i,pt=!0,wi=null,Yr=!1,r!==null&&kx(i,r),i=ep(i,d.children),i.flags|=4096);return i}return y?(_i(),A=d.fallback,y=i.mode,H=r.child,te=H.sibling,d=Ba(H,{mode:"hidden",children:d.children}),d.subtreeFlags=H.subtreeFlags&65011712,te!==null?A=Ba(te,A):(A=Ss(A,y,u,null),A.flags|=2),A.return=i,d.return=i,d.sibling=A,i.child=d,cu(null,d),d=i.child,A=r.child.memoizedState,A===null?A=Wm(u):(y=A.cachePool,y!==null?(H=bn._currentValue,y=y.parent!==H?{parent:H,pool:H}:y):y=Tx(),A={baseLanes:A.baseLanes|u,cachePool:y}),d.memoizedState=A,d.childLanes=Jm(r,E,u),i.memoizedState=Xm,cu(r.child,d)):(Ni(i),u=r.child,r=u.sibling,u=Ba(u,{mode:"visible",children:d.children}),u.return=i,u.sibling=null,r!==null&&(E=i.deletions,E===null?(i.deletions=[r],i.flags|=16):E.push(r)),i.child=u,i.memoizedState=null,u)}function ep(r,i){return i=Nd({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function Nd(r,i){return r=Or(22,r,null,i),r.lanes=0,r}function tp(r,i,u){return Ts(i,r.child,null,u),r=ep(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function $0(r,i,u){r.lanes|=i;var d=r.alternate;d!==null&&(d.lanes|=i),gm(r.return,i,u)}function np(r,i,u,d,y,v){var E=r.memoizedState;E===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:y,treeForkCount:v}:(E.isBackwards=i,E.rendering=null,E.renderingStartTime=0,E.last=d,E.tail=u,E.tailMode=y,E.treeForkCount=v)}function H0(r,i,u){var d=i.pendingProps,y=d.revealOrder,v=d.tail;d=d.children;var E=mn.current,A=(E&2)!==0;if(A?(E=E&1|2,i.flags|=128):E&=1,T(mn,E),$n(r,i,d,u),d=pt?Xo:0,!A&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&$0(r,u,i);else if(r.tag===19)$0(r,u,i);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(y){case"forwards":for(u=i.child,y=null;u!==null;)r=u.alternate,r!==null&&pd(r)===null&&(y=u),u=u.sibling;u=y,u===null?(y=i.child,i.child=null):(y=u.sibling,u.sibling=null),np(i,!1,y,u,v,d);break;case"backwards":case"unstable_legacy-backwards":for(u=null,y=i.child,i.child=null;y!==null;){if(r=y.alternate,r!==null&&pd(r)===null){i.child=y;break}r=y.sibling,y.sibling=u,u=y,y=r}np(i,!0,u,null,v,d);break;case"together":np(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function Ga(r,i,u){if(r!==null&&(i.dependencies=r.dependencies),Ri|=i.lanes,(u&i.childLanes)===0)if(r!==null){if(bl(r,i,u,!1),(u&i.childLanes)===0)return null}else return null;if(r!==null&&i.child!==r.child)throw Error(a(153));if(i.child!==null){for(r=i.child,u=Ba(r,r.pendingProps),i.child=u,u.return=i;r.sibling!==null;)r=r.sibling,u=u.sibling=Ba(r,r.pendingProps),u.return=i;u.sibling=null}return i.child}function rp(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&ld(r)))}function ZA(r,i,u){switch(i.tag){case 3:we(i,i.stateNode.containerInfo),ki(i,bn,r.memoizedState.cache),ks();break;case 27:case 5:Me(i);break;case 4:we(i,i.stateNode.containerInfo);break;case 10:ki(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,_m(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(Ni(i),i.flags|=128,null):(u&i.child.childLanes)!==0?F0(r,i,u):(Ni(i),r=Ga(r,i,u),r!==null?r.sibling:null);Ni(i);break;case 19:var y=(r.flags&128)!==0;if(d=(u&i.childLanes)!==0,d||(bl(r,i,u,!1),d=(u&i.childLanes)!==0),y){if(d)return H0(r,i,u);i.flags|=128}if(y=i.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),T(mn,mn.current),d)break;return null;case 22:return i.lanes=0,D0(r,i,u,i.pendingProps);case 24:ki(i,bn,r.memoizedState.cache)}return Ga(r,i,u)}function q0(r,i,u){if(r!==null)if(r.memoizedProps!==i.pendingProps)wn=!0;else{if(!rp(r,u)&&(i.flags&128)===0)return wn=!1,ZA(r,i,u);wn=(r.flags&131072)!==0}else wn=!1,pt&&(i.flags&1048576)!==0&&Sx(i,Xo,i.index);switch(i.lanes=0,i.tag){case 16:e:{var d=i.pendingProps;if(r=Ns(i.elementType),i.type=r,typeof r=="function")om(r)?(d=Rs(r,d),i.tag=1,i=U0(null,i,r,d,u)):(i.tag=0,i=Ym(null,i,r,d,u));else{if(r!=null){var y=r.$$typeof;if(y===M){i.tag=11,i=O0(null,i,r,d,u);break e}else if(y===B){i.tag=14,i=z0(null,i,r,d,u);break e}}throw i=J(r)||r,Error(a(306,i,""))}}return i;case 0:return Ym(r,i,i.type,i.pendingProps,u);case 1:return d=i.type,y=Rs(d,i.pendingProps),U0(r,i,d,y,u);case 3:e:{if(we(i,i.stateNode.containerInfo),r===null)throw Error(a(387));d=i.pendingProps;var v=i.memoizedState;y=v.element,km(r,i),iu(i,d,null,u);var E=i.memoizedState;if(d=E.cache,ki(i,bn,d),d!==v.cache&&ym(i,[bn],u,!0),au(),d=E.element,v.isDehydrated)if(v={element:d,isDehydrated:!1,cache:E.cache},i.updateQueue.baseState=v,i.memoizedState=v,i.flags&256){i=B0(r,i,d,u);break e}else if(d!==y){y=Vr(Error(a(424)),i),Wo(y),i=B0(r,i,d,u);break e}else{switch(r=i.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for($t=Wr(r.firstChild),Bn=i,pt=!0,wi=null,Yr=!0,u=Dx(i,null,d,u),i.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(ks(),d===y){i=Ga(r,i,u);break e}$n(r,i,d,u)}i=i.child}return i;case 26:return Cd(r,i),r===null?(u=tS(i.type,null,i.pendingProps,null))?i.memoizedState=u:pt||(u=i.type,r=i.pendingProps,d=Hd(ae.current).createElement(u),d[fn]=i,d[Gt]=r,Hn(d,u,r),mt(d),i.stateNode=d):i.memoizedState=tS(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return Me(i),r===null&&pt&&(d=i.stateNode=Ww(i.type,i.pendingProps,ae.current),Bn=i,Yr=!0,y=$t,Ii(i.type)?(Ip=y,$t=Wr(d.firstChild)):$t=y),$n(r,i,i.pendingProps.children,u),Cd(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&pt&&((y=d=$t)&&(d=w2(d,i.type,i.pendingProps,Yr),d!==null?(i.stateNode=d,Bn=i,$t=Wr(d.firstChild),Yr=!1,y=!0):y=!1),y||Si(i)),Me(i),y=i.type,v=i.pendingProps,E=r!==null?r.memoizedProps:null,d=v.children,Rp(y,v)?d=null:E!==null&&Rp(y,E)&&(i.flags|=32),i.memoizedState!==null&&(y=Am(r,i,IA,null,null,u),Eu._currentValue=y),Cd(r,i),$n(r,i,d,u),i.child;case 6:return r===null&&pt&&((r=u=$t)&&(u=S2(u,i.pendingProps,Yr),u!==null?(i.stateNode=u,Bn=i,$t=null,r=!0):r=!1),r||Si(i)),null;case 13:return F0(r,i,u);case 4:return we(i,i.stateNode.containerInfo),d=i.pendingProps,r===null?i.child=Ts(i,null,d,u):$n(r,i,d,u),i.child;case 11:return O0(r,i,i.type,i.pendingProps,u);case 7:return $n(r,i,i.pendingProps,u),i.child;case 8:return $n(r,i,i.pendingProps.children,u),i.child;case 12:return $n(r,i,i.pendingProps.children,u),i.child;case 10:return d=i.pendingProps,ki(i,i.type,d.value),$n(r,i,d.children,u),i.child;case 9:return y=i.type._context,d=i.pendingProps.children,Es(i),y=Fn(y),d=d(y),i.flags|=1,$n(r,i,d,u),i.child;case 14:return z0(r,i,i.type,i.pendingProps,u);case 15:return M0(r,i,i.type,i.pendingProps,u);case 19:return H0(r,i,u);case 31:return qA(r,i,u);case 22:return D0(r,i,u,i.pendingProps);case 24:return Es(i),d=Fn(bn),r===null?(y=xm(),y===null&&(y=Dt,v=vm(),y.pooledCache=v,v.refCount++,v!==null&&(y.pooledCacheLanes|=u),y=v),i.memoizedState={parent:d,cache:y},Sm(i),ki(i,bn,y)):((r.lanes&u)!==0&&(km(r,i),iu(i,null,null,u),au()),y=r.memoizedState,v=i.memoizedState,y.parent!==d?(y={parent:d,cache:d},i.memoizedState=y,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=y),ki(i,bn,d)):(d=v.cache,ki(i,bn,d),d!==y.cache&&ym(i,[bn],u,!0))),$n(r,i,i.pendingProps.children,u),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Va(r){r.flags|=4}function ap(r,i,u,d,y){if((i=(r.mode&32)!==0)&&(i=!1),i){if(r.flags|=16777216,(y&335544128)===y)if(r.stateNode.complete)r.flags|=8192;else if(yw())r.flags|=8192;else throw _s=dd,wm}else r.flags&=-16777217}function Z0(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!sS(i))if(yw())r.flags|=8192;else throw _s=dd,wm}function _d(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?je():536870912,r.lanes|=i,Rl|=i)}function du(r,i){if(!pt)switch(r.tailMode){case"hidden":i=r.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?r.tail=null:u.sibling=null;break;case"collapsed":u=r.tail;for(var d=null;u!==null;)u.alternate!==null&&(d=u),u=u.sibling;d===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function Ht(r){var i=r.alternate!==null&&r.alternate.child===r.child,u=0,d=0;if(i)for(var y=r.child;y!==null;)u|=y.lanes|y.childLanes,d|=y.subtreeFlags&65011712,d|=y.flags&65011712,y.return=r,y=y.sibling;else for(y=r.child;y!==null;)u|=y.lanes|y.childLanes,d|=y.subtreeFlags,d|=y.flags,y.return=r,y=y.sibling;return r.subtreeFlags|=d,r.childLanes=u,i}function GA(r,i,u){var d=i.pendingProps;switch(fm(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ht(i),null;case 1:return Ht(i),null;case 3:return u=i.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),Ha(bn),me(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(r===null||r.child===null)&&(vl(i)?Va(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,mm())),Ht(i),null;case 26:var y=i.type,v=i.memoizedState;return r===null?(Va(i),v!==null?(Ht(i),Z0(i,v)):(Ht(i),ap(i,y,null,d,u))):v?v!==r.memoizedState?(Va(i),Ht(i),Z0(i,v)):(Ht(i),i.flags&=-16777217):(r=r.memoizedProps,r!==d&&Va(i),Ht(i),ap(i,y,r,d,u)),null;case 27:if(Ie(i),u=ae.current,y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Va(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return Ht(i),null}r=G.current,vl(i)?jx(i):(r=Ww(y,d,u),i.stateNode=r,Va(i))}return Ht(i),null;case 5:if(Ie(i),y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Va(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return Ht(i),null}if(v=G.current,vl(i))jx(i);else{var E=Hd(ae.current);switch(v){case 1:v=E.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:v=E.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":v=E.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":v=E.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":v=E.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof d.is=="string"?E.createElement("select",{is:d.is}):E.createElement("select"),d.multiple?v.multiple=!0:d.size&&(v.size=d.size);break;default:v=typeof d.is=="string"?E.createElement(y,{is:d.is}):E.createElement(y)}}v[fn]=i,v[Gt]=d;e:for(E=i.child;E!==null;){if(E.tag===5||E.tag===6)v.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===i)break e;for(;E.sibling===null;){if(E.return===null||E.return===i)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}i.stateNode=v;e:switch(Hn(v,y,d),y){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&Va(i)}}return Ht(i),ap(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,u),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==d&&Va(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(a(166));if(r=ae.current,vl(i)){if(r=i.stateNode,u=i.memoizedProps,d=null,y=Bn,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}r[fn]=i,r=!!(r.nodeValue===u||d!==null&&d.suppressHydrationWarning===!0||Fw(r.nodeValue,u)),r||Si(i,!0)}else r=Hd(r).createTextNode(d),r[fn]=i,i.stateNode=r}return Ht(i),null;case 31:if(u=i.memoizedState,r===null||r.memoizedState!==null){if(d=vl(i),u!==null){if(r===null){if(!d)throw Error(a(318));if(r=i.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(557));r[fn]=i}else ks(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ht(i),r=!1}else u=mm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=u),r=!0;if(!r)return i.flags&256?(Mr(i),i):(Mr(i),null);if((i.flags&128)!==0)throw Error(a(558))}return Ht(i),null;case 13:if(d=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(y=vl(i),d!==null&&d.dehydrated!==null){if(r===null){if(!y)throw Error(a(318));if(y=i.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(a(317));y[fn]=i}else ks(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ht(i),y=!1}else y=mm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=y),y=!0;if(!y)return i.flags&256?(Mr(i),i):(Mr(i),null)}return Mr(i),(i.flags&128)!==0?(i.lanes=u,i):(u=d!==null,r=r!==null&&r.memoizedState!==null,u&&(d=i.child,y=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(y=d.alternate.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==y&&(d.flags|=2048)),u!==r&&u&&(i.child.flags|=8192),_d(i,i.updateQueue),Ht(i),null);case 4:return me(),r===null&&Cp(i.stateNode.containerInfo),Ht(i),null;case 10:return Ha(i.type),Ht(i),null;case 19:if(F(mn),d=i.memoizedState,d===null)return Ht(i),null;if(y=(i.flags&128)!==0,v=d.rendering,v===null)if(y)du(d,!1);else{if(rn!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(v=pd(r),v!==null){for(i.flags|=128,du(d,!1),r=v.updateQueue,i.updateQueue=r,_d(i,r),i.subtreeFlags=0,r=u,u=i.child;u!==null;)bx(u,r),u=u.sibling;return T(mn,mn.current&1|2),pt&&Fa(i,d.treeForkCount),i.child}r=r.sibling}d.tail!==null&&cn()>zd&&(i.flags|=128,y=!0,du(d,!1),i.lanes=4194304)}else{if(!y)if(r=pd(v),r!==null){if(i.flags|=128,y=!0,r=r.updateQueue,i.updateQueue=r,_d(i,r),du(d,!0),d.tail===null&&d.tailMode==="hidden"&&!v.alternate&&!pt)return Ht(i),null}else 2*cn()-d.renderingStartTime>zd&&u!==536870912&&(i.flags|=128,y=!0,du(d,!1),i.lanes=4194304);d.isBackwards?(v.sibling=i.child,i.child=v):(r=d.last,r!==null?r.sibling=v:i.child=v,d.last=v)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=cn(),r.sibling=null,u=mn.current,T(mn,y?u&1|2:u&1),pt&&Fa(i,d.treeForkCount),r):(Ht(i),null);case 22:case 23:return Mr(i),Nm(),d=i.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(i.flags|=8192):d&&(i.flags|=8192),d?(u&536870912)!==0&&(i.flags&128)===0&&(Ht(i),i.subtreeFlags&6&&(i.flags|=8192)):Ht(i),u=i.updateQueue,u!==null&&_d(i,u.retryQueue),u=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==u&&(i.flags|=2048),r!==null&&F(Cs),null;case 24:return u=null,r!==null&&(u=r.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),Ha(bn),Ht(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function VA(r,i){switch(fm(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return Ha(bn),me(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return Ie(i),null;case 31:if(i.memoizedState!==null){if(Mr(i),i.alternate===null)throw Error(a(340));ks()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(Mr(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(a(340));ks()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return F(mn),null;case 4:return me(),null;case 10:return Ha(i.type),null;case 22:case 23:return Mr(i),Nm(),r!==null&&F(Cs),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return Ha(bn),null;case 25:return null;default:return null}}function G0(r,i){switch(fm(i),i.tag){case 3:Ha(bn),me();break;case 26:case 27:case 5:Ie(i);break;case 4:me();break;case 31:i.memoizedState!==null&&Mr(i);break;case 13:Mr(i);break;case 19:F(mn);break;case 10:Ha(i.type);break;case 22:case 23:Mr(i),Nm(),r!==null&&F(Cs);break;case 24:Ha(bn)}}function fu(r,i){try{var u=i.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var y=d.next;u=y;do{if((u.tag&r)===r){d=void 0;var v=u.create,E=u.inst;d=v(),E.destroy=d}u=u.next}while(u!==y)}}catch(A){Tt(i,i.return,A)}}function Ti(r,i,u){try{var d=i.updateQueue,y=d!==null?d.lastEffect:null;if(y!==null){var v=y.next;d=v;do{if((d.tag&r)===r){var E=d.inst,A=E.destroy;if(A!==void 0){E.destroy=void 0,y=i;var H=u,te=A;try{te()}catch(ue){Tt(y,H,ue)}}}d=d.next}while(d!==v)}}catch(ue){Tt(i,i.return,ue)}}function V0(r){var i=r.updateQueue;if(i!==null){var u=r.stateNode;try{Lx(i,u)}catch(d){Tt(r,r.return,d)}}}function Q0(r,i,u){u.props=Rs(r.type,r.memoizedProps),u.state=r.memoizedState;try{u.componentWillUnmount()}catch(d){Tt(r,i,d)}}function hu(r,i){try{var u=r.ref;if(u!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof u=="function"?r.refCleanup=u(d):u.current=d}}catch(y){Tt(r,i,y)}}function Ea(r,i){var u=r.ref,d=r.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(y){Tt(r,i,y)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(y){Tt(r,i,y)}else u.current=null}function K0(r){var i=r.type,u=r.memoizedProps,d=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":u.autoFocus&&d.focus();break e;case"img":u.src?d.src=u.src:u.srcSet&&(d.srcset=u.srcSet)}}catch(y){Tt(r,r.return,y)}}function ip(r,i,u){try{var d=r.stateNode;p2(d,r.type,u,i),d[Gt]=i}catch(y){Tt(r,r.return,y)}}function Y0(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&Ii(r.type)||r.tag===4}function sp(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Y0(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&Ii(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function lp(r,i,u){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(r,i):(i=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,i.appendChild(r),u=u._reactRootContainer,u!=null||i.onclick!==null||(i.onclick=Pa));else if(d!==4&&(d===27&&Ii(r.type)&&(u=r.stateNode,i=null),r=r.child,r!==null))for(lp(r,i,u),r=r.sibling;r!==null;)lp(r,i,u),r=r.sibling}function Td(r,i,u){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?u.insertBefore(r,i):u.appendChild(r);else if(d!==4&&(d===27&&Ii(r.type)&&(u=r.stateNode),r=r.child,r!==null))for(Td(r,i,u),r=r.sibling;r!==null;)Td(r,i,u),r=r.sibling}function X0(r){var i=r.stateNode,u=r.memoizedProps;try{for(var d=r.type,y=i.attributes;y.length;)i.removeAttributeNode(y[0]);Hn(i,d,u),i[fn]=r,i[Gt]=u}catch(v){Tt(r,r.return,v)}}var Qa=!1,Sn=!1,op=!1,W0=typeof WeakSet=="function"?WeakSet:Set,In=null;function QA(r,i){if(r=r.containerInfo,Tp=Yd,r=cx(r),tm(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var d=u.getSelection&&u.getSelection();if(d&&d.rangeCount!==0){u=d.anchorNode;var y=d.anchorOffset,v=d.focusNode;d=d.focusOffset;try{u.nodeType,v.nodeType}catch{u=null;break e}var E=0,A=-1,H=-1,te=0,ue=0,fe=r,re=null;t:for(;;){for(var le;fe!==u||y!==0&&fe.nodeType!==3||(A=E+y),fe!==v||d!==0&&fe.nodeType!==3||(H=E+d),fe.nodeType===3&&(E+=fe.nodeValue.length),(le=fe.firstChild)!==null;)re=fe,fe=le;for(;;){if(fe===r)break t;if(re===u&&++te===y&&(A=E),re===v&&++ue===d&&(H=E),(le=fe.nextSibling)!==null)break;fe=re,re=fe.parentNode}fe=le}u=A===-1||H===-1?null:{start:A,end:H}}else u=null}u=u||{start:0,end:0}}else u=null;for(Ap={focusedElem:r,selectionRange:u},Yd=!1,In=i;In!==null;)if(i=In,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,In=r;else for(;In!==null;){switch(i=In,v=i.alternate,r=i.flags,i.tag){case 0:if((r&4)!==0&&(r=i.updateQueue,r=r!==null?r.events:null,r!==null))for(u=0;u<r.length;u++)y=r[u],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&v!==null){r=void 0,u=i,y=v.memoizedProps,v=v.memoizedState,d=u.stateNode;try{var Te=Rs(u.type,y);r=d.getSnapshotBeforeUpdate(Te,v),d.__reactInternalSnapshotBeforeUpdate=r}catch(Ze){Tt(u,u.return,Ze)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,u=r.nodeType,u===9)zp(r);else if(u===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":zp(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(a(163))}if(r=i.sibling,r!==null){r.return=i.return,In=r;break}In=i.return}}function J0(r,i,u){var d=u.flags;switch(u.tag){case 0:case 11:case 15:Ya(r,u),d&4&&fu(5,u);break;case 1:if(Ya(r,u),d&4)if(r=u.stateNode,i===null)try{r.componentDidMount()}catch(E){Tt(u,u.return,E)}else{var y=Rs(u.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(y,i,r.__reactInternalSnapshotBeforeUpdate)}catch(E){Tt(u,u.return,E)}}d&64&&V0(u),d&512&&hu(u,u.return);break;case 3:if(Ya(r,u),d&64&&(r=u.updateQueue,r!==null)){if(i=null,u.child!==null)switch(u.child.tag){case 27:case 5:i=u.child.stateNode;break;case 1:i=u.child.stateNode}try{Lx(r,i)}catch(E){Tt(u,u.return,E)}}break;case 27:i===null&&d&4&&X0(u);case 26:case 5:Ya(r,u),i===null&&d&4&&K0(u),d&512&&hu(u,u.return);break;case 12:Ya(r,u);break;case 31:Ya(r,u),d&4&&nw(r,u);break;case 13:Ya(r,u),d&4&&rw(r,u),d&64&&(r=u.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(u=r2.bind(null,u),k2(r,u))));break;case 22:if(d=u.memoizedState!==null||Qa,!d){i=i!==null&&i.memoizedState!==null||Sn,y=Qa;var v=Sn;Qa=d,(Sn=i)&&!v?Xa(r,u,(u.subtreeFlags&8772)!==0):Ya(r,u),Qa=y,Sn=v}break;case 30:break;default:Ya(r,u)}}function ew(r){var i=r.alternate;i!==null&&(r.alternate=null,ew(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&Ue(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 Vt=null,pr=!1;function Ka(r,i,u){for(u=u.child;u!==null;)tw(r,i,u),u=u.sibling}function tw(r,i,u){if(Ut&&typeof Ut.onCommitFiberUnmount=="function")try{Ut.onCommitFiberUnmount(qt,u)}catch{}switch(u.tag){case 26:Sn||Ea(u,i),Ka(r,i,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:Sn||Ea(u,i);var d=Vt,y=pr;Ii(u.type)&&(Vt=u.stateNode,pr=!1),Ka(r,i,u),Su(u.stateNode),Vt=d,pr=y;break;case 5:Sn||Ea(u,i);case 6:if(d=Vt,y=pr,Vt=null,Ka(r,i,u),Vt=d,pr=y,Vt!==null)if(pr)try{(Vt.nodeType===9?Vt.body:Vt.nodeName==="HTML"?Vt.ownerDocument.body:Vt).removeChild(u.stateNode)}catch(v){Tt(u,i,v)}else try{Vt.removeChild(u.stateNode)}catch(v){Tt(u,i,v)}break;case 18:Vt!==null&&(pr?(r=Vt,Vw(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,u.stateNode),Ul(r)):Vw(Vt,u.stateNode));break;case 4:d=Vt,y=pr,Vt=u.stateNode.containerInfo,pr=!0,Ka(r,i,u),Vt=d,pr=y;break;case 0:case 11:case 14:case 15:Ti(2,u,i),Sn||Ti(4,u,i),Ka(r,i,u);break;case 1:Sn||(Ea(u,i),d=u.stateNode,typeof d.componentWillUnmount=="function"&&Q0(u,i,d)),Ka(r,i,u);break;case 21:Ka(r,i,u);break;case 22:Sn=(d=Sn)||u.memoizedState!==null,Ka(r,i,u),Sn=d;break;default:Ka(r,i,u)}}function nw(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{Ul(r)}catch(u){Tt(i,i.return,u)}}}function rw(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{Ul(r)}catch(u){Tt(i,i.return,u)}}function KA(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new W0),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new W0),i;default:throw Error(a(435,r.tag))}}function Ad(r,i){var u=KA(r);i.forEach(function(d){if(!u.has(d)){u.add(d);var y=a2.bind(null,r,d);d.then(y,y)}})}function gr(r,i){var u=i.deletions;if(u!==null)for(var d=0;d<u.length;d++){var y=u[d],v=r,E=i,A=E;e:for(;A!==null;){switch(A.tag){case 27:if(Ii(A.type)){Vt=A.stateNode,pr=!1;break e}break;case 5:Vt=A.stateNode,pr=!1;break e;case 3:case 4:Vt=A.stateNode.containerInfo,pr=!0;break e}A=A.return}if(Vt===null)throw Error(a(160));tw(v,E,y),Vt=null,pr=!1,v=y.alternate,v!==null&&(v.return=null),y.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)aw(i,r),i=i.sibling}var ga=null;function aw(r,i){var u=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:gr(i,r),yr(r),d&4&&(Ti(3,r,r.return),fu(3,r),Ti(5,r,r.return));break;case 1:gr(i,r),yr(r),d&512&&(Sn||u===null||Ea(u,u.return)),d&64&&Qa&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(u=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=u===null?d:u.concat(d))));break;case 26:var y=ga;if(gr(i,r),yr(r),d&512&&(Sn||u===null||Ea(u,u.return)),d&4){var v=u!==null?u.memoizedState:null;if(d=r.memoizedState,u===null)if(d===null)if(r.stateNode===null){e:{d=r.type,u=r.memoizedProps,y=y.ownerDocument||y;t:switch(d){case"title":v=y.getElementsByTagName("title")[0],(!v||v[vi]||v[fn]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=y.createElement(d),y.head.insertBefore(v,y.querySelector("head > title"))),Hn(v,d,u),v[fn]=r,mt(v),d=v;break e;case"link":var E=aS("link","href",y).get(d+(u.href||""));if(E){for(var A=0;A<E.length;A++)if(v=E[A],v.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&v.getAttribute("rel")===(u.rel==null?null:u.rel)&&v.getAttribute("title")===(u.title==null?null:u.title)&&v.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){E.splice(A,1);break t}}v=y.createElement(d),Hn(v,d,u),y.head.appendChild(v);break;case"meta":if(E=aS("meta","content",y).get(d+(u.content||""))){for(A=0;A<E.length;A++)if(v=E[A],v.getAttribute("content")===(u.content==null?null:""+u.content)&&v.getAttribute("name")===(u.name==null?null:u.name)&&v.getAttribute("property")===(u.property==null?null:u.property)&&v.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&v.getAttribute("charset")===(u.charSet==null?null:u.charSet)){E.splice(A,1);break t}}v=y.createElement(d),Hn(v,d,u),y.head.appendChild(v);break;default:throw Error(a(468,d))}v[fn]=r,mt(v),d=v}r.stateNode=d}else iS(y,r.type,r.stateNode);else r.stateNode=rS(y,d,r.memoizedProps);else v!==d?(v===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):v.count--,d===null?iS(y,r.type,r.stateNode):rS(y,d,r.memoizedProps)):d===null&&r.stateNode!==null&&ip(r,r.memoizedProps,u.memoizedProps)}break;case 27:gr(i,r),yr(r),d&512&&(Sn||u===null||Ea(u,u.return)),u!==null&&d&4&&ip(r,r.memoizedProps,u.memoizedProps);break;case 5:if(gr(i,r),yr(r),d&512&&(Sn||u===null||Ea(u,u.return)),r.flags&32){y=r.stateNode;try{ol(y,"")}catch(Te){Tt(r,r.return,Te)}}d&4&&r.stateNode!=null&&(y=r.memoizedProps,ip(r,y,u!==null?u.memoizedProps:y)),d&1024&&(op=!0);break;case 6:if(gr(i,r),yr(r),d&4){if(r.stateNode===null)throw Error(a(162));d=r.memoizedProps,u=r.stateNode;try{u.nodeValue=d}catch(Te){Tt(r,r.return,Te)}}break;case 3:if(Gd=null,y=ga,ga=qd(i.containerInfo),gr(i,r),ga=y,yr(r),d&4&&u!==null&&u.memoizedState.isDehydrated)try{Ul(i.containerInfo)}catch(Te){Tt(r,r.return,Te)}op&&(op=!1,iw(r));break;case 4:d=ga,ga=qd(r.stateNode.containerInfo),gr(i,r),yr(r),ga=d;break;case 12:gr(i,r),yr(r);break;case 31:gr(i,r),yr(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Ad(r,d)));break;case 13:gr(i,r),yr(r),r.child.flags&8192&&r.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(Od=cn()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Ad(r,d)));break;case 22:y=r.memoizedState!==null;var H=u!==null&&u.memoizedState!==null,te=Qa,ue=Sn;if(Qa=te||y,Sn=ue||H,gr(i,r),Sn=ue,Qa=te,yr(r),d&8192)e:for(i=r.stateNode,i._visibility=y?i._visibility&-2:i._visibility|1,y&&(u===null||H||Qa||Sn||Os(r)),u=null,i=r;;){if(i.tag===5||i.tag===26){if(u===null){H=u=i;try{if(v=H.stateNode,y)E=v.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{A=H.stateNode;var fe=H.memoizedProps.style,re=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;A.style.display=re==null||typeof re=="boolean"?"":(""+re).trim()}}catch(Te){Tt(H,H.return,Te)}}}else if(i.tag===6){if(u===null){H=i;try{H.stateNode.nodeValue=y?"":H.memoizedProps}catch(Te){Tt(H,H.return,Te)}}}else if(i.tag===18){if(u===null){H=i;try{var le=H.stateNode;y?Qw(le,!0):Qw(H.stateNode,!1)}catch(Te){Tt(H,H.return,Te)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===r)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;u===i&&(u=null),i=i.return}u===i&&(u=null),i.sibling.return=i.return,i=i.sibling}d&4&&(d=r.updateQueue,d!==null&&(u=d.retryQueue,u!==null&&(d.retryQueue=null,Ad(r,u))));break;case 19:gr(i,r),yr(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Ad(r,d)));break;case 30:break;case 21:break;default:gr(i,r),yr(r)}}function yr(r){var i=r.flags;if(i&2){try{for(var u,d=r.return;d!==null;){if(Y0(d)){u=d;break}d=d.return}if(u==null)throw Error(a(160));switch(u.tag){case 27:var y=u.stateNode,v=sp(r);Td(r,v,y);break;case 5:var E=u.stateNode;u.flags&32&&(ol(E,""),u.flags&=-33);var A=sp(r);Td(r,A,E);break;case 3:case 4:var H=u.stateNode.containerInfo,te=sp(r);lp(r,te,H);break;default:throw Error(a(161))}}catch(ue){Tt(r,r.return,ue)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function iw(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;iw(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function Ya(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)J0(r,i.alternate,i),i=i.sibling}function Os(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:Ti(4,i,i.return),Os(i);break;case 1:Ea(i,i.return);var u=i.stateNode;typeof u.componentWillUnmount=="function"&&Q0(i,i.return,u),Os(i);break;case 27:Su(i.stateNode);case 26:case 5:Ea(i,i.return),Os(i);break;case 22:i.memoizedState===null&&Os(i);break;case 30:Os(i);break;default:Os(i)}r=r.sibling}}function Xa(r,i,u){for(u=u&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var d=i.alternate,y=r,v=i,E=v.flags;switch(v.tag){case 0:case 11:case 15:Xa(y,v,u),fu(4,v);break;case 1:if(Xa(y,v,u),d=v,y=d.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(te){Tt(d,d.return,te)}if(d=v,y=d.updateQueue,y!==null){var A=d.stateNode;try{var H=y.shared.hiddenCallbacks;if(H!==null)for(y.shared.hiddenCallbacks=null,y=0;y<H.length;y++)Ix(H[y],A)}catch(te){Tt(d,d.return,te)}}u&&E&64&&V0(v),hu(v,v.return);break;case 27:X0(v);case 26:case 5:Xa(y,v,u),u&&d===null&&E&4&&K0(v),hu(v,v.return);break;case 12:Xa(y,v,u);break;case 31:Xa(y,v,u),u&&E&4&&nw(y,v);break;case 13:Xa(y,v,u),u&&E&4&&rw(y,v);break;case 22:v.memoizedState===null&&Xa(y,v,u),hu(v,v.return);break;case 30:break;default:Xa(y,v,u)}i=i.sibling}}function up(r,i){var u=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==u&&(r!=null&&r.refCount++,u!=null&&Jo(u))}function cp(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&Jo(r))}function ya(r,i,u,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)sw(r,i,u,d),i=i.sibling}function sw(r,i,u,d){var y=i.flags;switch(i.tag){case 0:case 11:case 15:ya(r,i,u,d),y&2048&&fu(9,i);break;case 1:ya(r,i,u,d);break;case 3:ya(r,i,u,d),y&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&Jo(r)));break;case 12:if(y&2048){ya(r,i,u,d),r=i.stateNode;try{var v=i.memoizedProps,E=v.id,A=v.onPostCommit;typeof A=="function"&&A(E,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(H){Tt(i,i.return,H)}}else ya(r,i,u,d);break;case 31:ya(r,i,u,d);break;case 13:ya(r,i,u,d);break;case 23:break;case 22:v=i.stateNode,E=i.alternate,i.memoizedState!==null?v._visibility&2?ya(r,i,u,d):mu(r,i):v._visibility&2?ya(r,i,u,d):(v._visibility|=2,_l(r,i,u,d,(i.subtreeFlags&10256)!==0||!1)),y&2048&&up(E,i);break;case 24:ya(r,i,u,d),y&2048&&cp(i.alternate,i);break;default:ya(r,i,u,d)}}function _l(r,i,u,d,y){for(y=y&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var v=r,E=i,A=u,H=d,te=E.flags;switch(E.tag){case 0:case 11:case 15:_l(v,E,A,H,y),fu(8,E);break;case 23:break;case 22:var ue=E.stateNode;E.memoizedState!==null?ue._visibility&2?_l(v,E,A,H,y):mu(v,E):(ue._visibility|=2,_l(v,E,A,H,y)),y&&te&2048&&up(E.alternate,E);break;case 24:_l(v,E,A,H,y),y&&te&2048&&cp(E.alternate,E);break;default:_l(v,E,A,H,y)}i=i.sibling}}function mu(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var u=r,d=i,y=d.flags;switch(d.tag){case 22:mu(u,d),y&2048&&up(d.alternate,d);break;case 24:mu(u,d),y&2048&&cp(d.alternate,d);break;default:mu(u,d)}i=i.sibling}}var pu=8192;function Tl(r,i,u){if(r.subtreeFlags&pu)for(r=r.child;r!==null;)lw(r,i,u),r=r.sibling}function lw(r,i,u){switch(r.tag){case 26:Tl(r,i,u),r.flags&pu&&r.memoizedState!==null&&D2(u,ga,r.memoizedState,r.memoizedProps);break;case 5:Tl(r,i,u);break;case 3:case 4:var d=ga;ga=qd(r.stateNode.containerInfo),Tl(r,i,u),ga=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=pu,pu=16777216,Tl(r,i,u),pu=d):Tl(r,i,u));break;default:Tl(r,i,u)}}function ow(r){var i=r.alternate;if(i!==null&&(r=i.child,r!==null)){i.child=null;do i=r.sibling,r.sibling=null,r=i;while(r!==null)}}function gu(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var u=0;u<i.length;u++){var d=i[u];In=d,cw(d,r)}ow(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)uw(r),r=r.sibling}function uw(r){switch(r.tag){case 0:case 11:case 15:gu(r),r.flags&2048&&Ti(9,r,r.return);break;case 3:gu(r);break;case 12:gu(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,Rd(r)):gu(r);break;default:gu(r)}}function Rd(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var u=0;u<i.length;u++){var d=i[u];In=d,cw(d,r)}ow(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:Ti(8,i,i.return),Rd(i);break;case 22:u=i.stateNode,u._visibility&2&&(u._visibility&=-3,Rd(i));break;default:Rd(i)}r=r.sibling}}function cw(r,i){for(;In!==null;){var u=In;switch(u.tag){case 0:case 11:case 15:Ti(8,u,i);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var d=u.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Jo(u.memoizedState.cache)}if(d=u.child,d!==null)d.return=u,In=d;else e:for(u=r;In!==null;){d=In;var y=d.sibling,v=d.return;if(ew(d),d===u){In=null;break e}if(y!==null){y.return=v,In=y;break e}In=v}}}var YA={getCacheForType:function(r){var i=Fn(bn),u=i.data.get(r);return u===void 0&&(u=r(),i.data.set(r,u)),u},cacheSignal:function(){return Fn(bn).controller.signal}},XA=typeof WeakMap=="function"?WeakMap:Map,Et=0,Dt=null,ot=null,dt=0,_t=0,Dr=null,Ai=!1,Al=!1,dp=!1,Wa=0,rn=0,Ri=0,zs=0,fp=0,Ir=0,Rl=0,yu=null,vr=null,hp=!1,Od=0,dw=0,zd=1/0,Md=null,Oi=null,_n=0,zi=null,Ol=null,Ja=0,mp=0,pp=null,fw=null,vu=0,gp=null;function Lr(){return(Et&2)!==0&&dt!==0?dt&-dt:Z.T!==null?Sp():Lo()}function hw(){if(Ir===0)if((dt&536870912)===0||pt){var r=ha;ha<<=1,(ha&3932160)===0&&(ha=262144),Ir=r}else Ir=536870912;return r=zr.current,r!==null&&(r.flags|=32),Ir}function br(r,i,u){(r===Dt&&(_t===2||_t===9)||r.cancelPendingCommit!==null)&&(zl(r,0),Mi(r,dt,Ir,!1)),yn(r,u),((Et&2)===0||r!==Dt)&&(r===Dt&&((Et&2)===0&&(zs|=u),rn===4&&Mi(r,dt,Ir,!1)),Ca(r))}function mw(r,i,u){if((Et&6)!==0)throw Error(a(327));var d=!u&&(i&127)===0&&(i&r.expiredLanes)===0||Sa(r,i),y=d?e2(r,i):vp(r,i,!0),v=d;do{if(y===0){Al&&!d&&Mi(r,i,0,!1);break}else{if(u=r.current.alternate,v&&!WA(u)){y=vp(r,i,!1),v=!1;continue}if(y===2){if(v=i,r.errorRecoveryDisabledLanes&v)var E=0;else E=r.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){i=E;e:{var A=r;y=yu;var H=A.current.memoizedState.isDehydrated;if(H&&(zl(A,E).flags|=256),E=vp(A,E,!1),E!==2){if(dp&&!H){A.errorRecoveryDisabledLanes|=v,zs|=v,y=4;break e}v=vr,vr=y,v!==null&&(vr===null?vr=v:vr.push.apply(vr,v))}y=E}if(v=!1,y!==2)continue}}if(y===1){zl(r,0),Mi(r,i,0,!0);break}e:{switch(d=r,v=y,v){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:Mi(d,i,Ir,!Ai);break e;case 2:vr=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(y=Od+300-cn(),10<y)){if(Mi(d,i,Ir,!Ai),Da(d,0,!0)!==0)break e;Ja=i,d.timeoutHandle=Zw(pw.bind(null,d,u,vr,Md,hp,i,Ir,zs,Rl,Ai,v,"Throttled",-0,0),y);break e}pw(d,u,vr,Md,hp,i,Ir,zs,Rl,Ai,v,null,-0,0)}}break}while(!0);Ca(r)}function pw(r,i,u,d,y,v,E,A,H,te,ue,fe,re,le){if(r.timeoutHandle=-1,fe=i.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Pa},lw(i,v,fe);var Te=(v&62914560)===v?Od-cn():(v&4194048)===v?dw-cn():0;if(Te=I2(fe,Te),Te!==null){Ja=v,r.cancelPendingCommit=Te(kw.bind(null,r,i,v,u,d,y,E,A,H,ue,fe,null,re,le)),Mi(r,v,E,!te);return}}kw(r,i,v,u,d,y,E,A,H)}function WA(r){for(var i=r;;){var u=i.tag;if((u===0||u===11||u===15)&&i.flags&16384&&(u=i.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var d=0;d<u.length;d++){var y=u[d],v=y.getSnapshot;y=y.value;try{if(!Rr(v(),y))return!1}catch{return!1}}if(u=i.child,i.subtreeFlags&16384&&u!==null)u.return=i,i=u;else{if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Mi(r,i,u,d){i&=~fp,i&=~zs,r.suspendedLanes|=i,r.pingedLanes&=~i,d&&(r.warmLanes|=i),d=r.expirationTimes;for(var y=i;0<y;){var v=31-lt(y),E=1<<v;d[v]=-1,y&=~E}u!==0&&yi(r,u,i)}function Dd(){return(Et&6)===0?(bu(0),!1):!0}function yp(){if(ot!==null){if(_t===0)var r=ot.return;else r=ot,$a=js=null,zm(r),kl=null,tu=0,r=ot;for(;r!==null;)G0(r.alternate,r),r=r.return;ot=null}}function zl(r,i){var u=r.timeoutHandle;u!==-1&&(r.timeoutHandle=-1,v2(u)),u=r.cancelPendingCommit,u!==null&&(r.cancelPendingCommit=null,u()),Ja=0,yp(),Dt=r,ot=u=Ba(r.current,null),dt=i,_t=0,Dr=null,Ai=!1,Al=Sa(r,i),dp=!1,Rl=Ir=fp=zs=Ri=rn=0,vr=yu=null,hp=!1,(i&8)!==0&&(i|=i&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=i;0<d;){var y=31-lt(d),v=1<<y;i|=r[y],d&=~v}return Wa=i,nd(),u}function gw(r,i){Ye=null,Z.H=uu,i===Sl||i===cd?(i=Ox(),_t=3):i===wm?(i=Ox(),_t=4):_t=i===Km?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Dr=i,ot===null&&(rn=1,jd(r,Vr(i,r.current)))}function yw(){var r=zr.current;return r===null?!0:(dt&4194048)===dt?Xr===null:(dt&62914560)===dt||(dt&536870912)!==0?r===Xr:!1}function vw(){var r=Z.H;return Z.H=uu,r===null?uu:r}function bw(){var r=Z.A;return Z.A=YA,r}function Id(){rn=4,Ai||(dt&4194048)!==dt&&zr.current!==null||(Al=!0),(Ri&134217727)===0&&(zs&134217727)===0||Dt===null||Mi(Dt,dt,Ir,!1)}function vp(r,i,u){var d=Et;Et|=2;var y=vw(),v=bw();(Dt!==r||dt!==i)&&(Md=null,zl(r,i)),i=!1;var E=rn;e:do try{if(_t!==0&&ot!==null){var A=ot,H=Dr;switch(_t){case 8:yp(),E=6;break e;case 3:case 2:case 9:case 6:zr.current===null&&(i=!0);var te=_t;if(_t=0,Dr=null,Ml(r,A,H,te),u&&Al){E=0;break e}break;default:te=_t,_t=0,Dr=null,Ml(r,A,H,te)}}JA(),E=rn;break}catch(ue){gw(r,ue)}while(!0);return i&&r.shellSuspendCounter++,$a=js=null,Et=d,Z.H=y,Z.A=v,ot===null&&(Dt=null,dt=0,nd()),E}function JA(){for(;ot!==null;)xw(ot)}function e2(r,i){var u=Et;Et|=2;var d=vw(),y=bw();Dt!==r||dt!==i?(Md=null,zd=cn()+500,zl(r,i)):Al=Sa(r,i);e:do try{if(_t!==0&&ot!==null){i=ot;var v=Dr;t:switch(_t){case 1:_t=0,Dr=null,Ml(r,i,v,1);break;case 2:case 9:if(Ax(v)){_t=0,Dr=null,ww(i);break}i=function(){_t!==2&&_t!==9||Dt!==r||(_t=7),Ca(r)},v.then(i,i);break e;case 3:_t=7;break e;case 4:_t=5;break e;case 7:Ax(v)?(_t=0,Dr=null,ww(i)):(_t=0,Dr=null,Ml(r,i,v,7));break;case 5:var E=null;switch(ot.tag){case 26:E=ot.memoizedState;case 5:case 27:var A=ot;if(E?sS(E):A.stateNode.complete){_t=0,Dr=null;var H=A.sibling;if(H!==null)ot=H;else{var te=A.return;te!==null?(ot=te,Ld(te)):ot=null}break t}}_t=0,Dr=null,Ml(r,i,v,5);break;case 6:_t=0,Dr=null,Ml(r,i,v,6);break;case 8:yp(),rn=6;break e;default:throw Error(a(462))}}t2();break}catch(ue){gw(r,ue)}while(!0);return $a=js=null,Z.H=d,Z.A=y,Et=u,ot!==null?0:(Dt=null,dt=0,nd(),rn)}function t2(){for(;ot!==null&&!pi();)xw(ot)}function xw(r){var i=q0(r.alternate,r,Wa);r.memoizedProps=r.pendingProps,i===null?Ld(r):ot=i}function ww(r){var i=r,u=i.alternate;switch(i.tag){case 15:case 0:i=P0(u,i,i.pendingProps,i.type,void 0,dt);break;case 11:i=P0(u,i,i.pendingProps,i.type.render,i.ref,dt);break;case 5:zm(i);default:G0(u,i),i=ot=bx(i,Wa),i=q0(u,i,Wa)}r.memoizedProps=r.pendingProps,i===null?Ld(r):ot=i}function Ml(r,i,u,d){$a=js=null,zm(i),kl=null,tu=0;var y=i.return;try{if(HA(r,y,i,u,dt)){rn=1,jd(r,Vr(u,r.current)),ot=null;return}}catch(v){if(y!==null)throw ot=y,v;rn=1,jd(r,Vr(u,r.current)),ot=null;return}i.flags&32768?(pt||d===1?r=!0:Al||(dt&536870912)!==0?r=!1:(Ai=r=!0,(d===2||d===9||d===3||d===6)&&(d=zr.current,d!==null&&d.tag===13&&(d.flags|=16384))),Sw(i,r)):Ld(i)}function Ld(r){var i=r;do{if((i.flags&32768)!==0){Sw(i,Ai);return}r=i.return;var u=GA(i.alternate,i,Wa);if(u!==null){ot=u;return}if(i=i.sibling,i!==null){ot=i;return}ot=i=r}while(i!==null);rn===0&&(rn=5)}function Sw(r,i){do{var u=VA(r.alternate,r);if(u!==null){u.flags&=32767,ot=u;return}if(u=r.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!i&&(r=r.sibling,r!==null)){ot=r;return}ot=r=u}while(r!==null);rn=6,ot=null}function kw(r,i,u,d,y,v,E,A,H){r.cancelPendingCommit=null;do Pd();while(_n!==0);if((Et&6)!==0)throw Error(a(327));if(i!==null){if(i===r.current)throw Error(a(177));if(v=i.lanes|i.childLanes,v|=sm,Ar(r,u,v,E,A,H),r===Dt&&(ot=Dt=null,dt=0),Ol=i,zi=r,Ja=u,mp=v,pp=y,fw=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,i2($e,function(){return _w(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=Z.T,Z.T=null,y=ne.p,ne.p=2,E=Et,Et|=4;try{QA(r,i,u)}finally{Et=E,ne.p=y,Z.T=d}}_n=1,jw(),Ew(),Cw()}}function jw(){if(_n===1){_n=0;var r=zi,i=Ol,u=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||u){u=Z.T,Z.T=null;var d=ne.p;ne.p=2;var y=Et;Et|=4;try{aw(i,r);var v=Ap,E=cx(r.containerInfo),A=v.focusedElem,H=v.selectionRange;if(E!==A&&A&&A.ownerDocument&&ux(A.ownerDocument.documentElement,A)){if(H!==null&&tm(A)){var te=H.start,ue=H.end;if(ue===void 0&&(ue=te),"selectionStart"in A)A.selectionStart=te,A.selectionEnd=Math.min(ue,A.value.length);else{var fe=A.ownerDocument||document,re=fe&&fe.defaultView||window;if(re.getSelection){var le=re.getSelection(),Te=A.textContent.length,Ze=Math.min(H.start,Te),zt=H.end===void 0?Ze:Math.min(H.end,Te);!le.extend&&Ze>zt&&(E=zt,zt=Ze,Ze=E);var X=ox(A,Ze),Q=ox(A,zt);if(X&&Q&&(le.rangeCount!==1||le.anchorNode!==X.node||le.anchorOffset!==X.offset||le.focusNode!==Q.node||le.focusOffset!==Q.offset)){var ee=fe.createRange();ee.setStart(X.node,X.offset),le.removeAllRanges(),Ze>zt?(le.addRange(ee),le.extend(Q.node,Q.offset)):(ee.setEnd(Q.node,Q.offset),le.addRange(ee))}}}}for(fe=[],le=A;le=le.parentNode;)le.nodeType===1&&fe.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<fe.length;A++){var de=fe[A];de.element.scrollLeft=de.left,de.element.scrollTop=de.top}}Yd=!!Tp,Ap=Tp=null}finally{Et=y,ne.p=d,Z.T=u}}r.current=i,_n=2}}function Ew(){if(_n===2){_n=0;var r=zi,i=Ol,u=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||u){u=Z.T,Z.T=null;var d=ne.p;ne.p=2;var y=Et;Et|=4;try{J0(r,i.alternate,i)}finally{Et=y,ne.p=d,Z.T=u}}_n=3}}function Cw(){if(_n===4||_n===3){_n=0,gi();var r=zi,i=Ol,u=Ja,d=fw;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?_n=5:(_n=0,Ol=zi=null,Nw(r,r.pendingLanes));var y=r.pendingLanes;if(y===0&&(Oi=null),ma(u),i=i.stateNode,Ut&&typeof Ut.onCommitFiberRoot=="function")try{Ut.onCommitFiberRoot(qt,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=Z.T,y=ne.p,ne.p=2,Z.T=null;try{for(var v=r.onRecoverableError,E=0;E<d.length;E++){var A=d[E];v(A.value,{componentStack:A.stack})}}finally{Z.T=i,ne.p=y}}(Ja&3)!==0&&Pd(),Ca(r),y=r.pendingLanes,(u&261930)!==0&&(y&42)!==0?r===gp?vu++:(vu=0,gp=r):vu=0,bu(0)}}function Nw(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,Jo(i)))}function Pd(){return jw(),Ew(),Cw(),_w()}function _w(){if(_n!==5)return!1;var r=zi,i=mp;mp=0;var u=ma(Ja),d=Z.T,y=ne.p;try{ne.p=32>u?32:u,Z.T=null,u=pp,pp=null;var v=zi,E=Ja;if(_n=0,Ol=zi=null,Ja=0,(Et&6)!==0)throw Error(a(331));var A=Et;if(Et|=4,uw(v.current),sw(v,v.current,E,u),Et=A,bu(0,!1),Ut&&typeof Ut.onPostCommitFiberRoot=="function")try{Ut.onPostCommitFiberRoot(qt,v)}catch{}return!0}finally{ne.p=y,Z.T=d,Nw(r,i)}}function Tw(r,i,u){i=Vr(u,i),i=Qm(r.stateNode,i,2),r=Ci(r,i,2),r!==null&&(yn(r,2),Ca(r))}function Tt(r,i,u){if(r.tag===3)Tw(r,r,u);else for(;i!==null;){if(i.tag===3){Tw(i,r,u);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Oi===null||!Oi.has(d))){r=Vr(u,r),u=A0(2),d=Ci(i,u,2),d!==null&&(R0(u,d,i,r),yn(d,2),Ca(d));break}}i=i.return}}function bp(r,i,u){var d=r.pingCache;if(d===null){d=r.pingCache=new XA;var y=new Set;d.set(i,y)}else y=d.get(i),y===void 0&&(y=new Set,d.set(i,y));y.has(u)||(dp=!0,y.add(u),r=n2.bind(null,r,i,u),i.then(r,r))}function n2(r,i,u){var d=r.pingCache;d!==null&&d.delete(i),r.pingedLanes|=r.suspendedLanes&u,r.warmLanes&=~u,Dt===r&&(dt&u)===u&&(rn===4||rn===3&&(dt&62914560)===dt&&300>cn()-Od?(Et&2)===0&&zl(r,0):fp|=u,Rl===dt&&(Rl=0)),Ca(r)}function Aw(r,i){i===0&&(i=je()),r=ws(r,i),r!==null&&(yn(r,i),Ca(r))}function r2(r){var i=r.memoizedState,u=0;i!==null&&(u=i.retryLane),Aw(r,u)}function a2(r,i){var u=0;switch(r.tag){case 31:case 13:var d=r.stateNode,y=r.memoizedState;y!==null&&(u=y.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(a(314))}d!==null&&d.delete(i),Aw(r,u)}function i2(r,i){return Pt(r,i)}var Ud=null,Dl=null,xp=!1,Bd=!1,wp=!1,Di=0;function Ca(r){r!==Dl&&r.next===null&&(Dl===null?Ud=Dl=r:Dl=Dl.next=r),Bd=!0,xp||(xp=!0,l2())}function bu(r,i){if(!wp&&Bd){wp=!0;do for(var u=!1,d=Ud;d!==null;){if(r!==0){var y=d.pendingLanes;if(y===0)var v=0;else{var E=d.suspendedLanes,A=d.pingedLanes;v=(1<<31-lt(42|r)+1)-1,v&=y&~(E&~A),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(u=!0,Mw(d,v))}else v=dt,v=Da(d,d===Dt?v:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(v&3)===0||Sa(d,v)||(u=!0,Mw(d,v));d=d.next}while(u);wp=!1}}function s2(){Rw()}function Rw(){Bd=xp=!1;var r=0;Di!==0&&y2()&&(r=Di);for(var i=cn(),u=null,d=Ud;d!==null;){var y=d.next,v=Ow(d,i);v===0?(d.next=null,u===null?Ud=y:u.next=y,y===null&&(Dl=u)):(u=d,(r!==0||(v&3)!==0)&&(Bd=!0)),d=y}_n!==0&&_n!==5||bu(r),Di!==0&&(Di=0)}function Ow(r,i){for(var u=r.suspendedLanes,d=r.pingedLanes,y=r.expirationTimes,v=r.pendingLanes&-62914561;0<v;){var E=31-lt(v),A=1<<E,H=y[E];H===-1?((A&u)===0||(A&d)!==0)&&(y[E]=Zt(A,i)):H<=i&&(r.expiredLanes|=A),v&=~A}if(i=Dt,u=dt,u=Da(r,r===i?u:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,u===0||r===i&&(_t===2||_t===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&hr(d),r.callbackNode=null,r.callbackPriority=0;if((u&3)===0||Sa(r,u)){if(i=u&-u,i===r.callbackPriority)return i;switch(d!==null&&hr(d),ma(u)){case 2:case 8:u=ge;break;case 32:u=$e;break;case 268435456:u=st;break;default:u=$e}return d=zw.bind(null,r),u=Pt(u,d),r.callbackPriority=i,r.callbackNode=u,i}return d!==null&&d!==null&&hr(d),r.callbackPriority=2,r.callbackNode=null,2}function zw(r,i){if(_n!==0&&_n!==5)return r.callbackNode=null,r.callbackPriority=0,null;var u=r.callbackNode;if(Pd()&&r.callbackNode!==u)return null;var d=dt;return d=Da(r,r===Dt?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(mw(r,d,i),Ow(r,cn()),r.callbackNode!=null&&r.callbackNode===u?zw.bind(null,r):null)}function Mw(r,i){if(Pd())return null;mw(r,i,!0)}function l2(){b2(function(){(Et&6)!==0?Pt(oe,s2):Rw()})}function Sp(){if(Di===0){var r=xl;r===0&&(r=fa,fa<<=1,(fa&261888)===0&&(fa=256)),Di=r}return Di}function Dw(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Qc(""+r)}function Iw(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 o2(r,i,u,d,y){if(i==="submit"&&u&&u.stateNode===y){var v=Dw((y[Gt]||null).action),E=d.submitter;E&&(i=(i=E[Gt]||null)?Dw(i.formAction):E.getAttribute("formAction"),i!==null&&(v=i,E=null));var A=new Wc("action","action",null,d,y);r.push({event:A,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Di!==0){var H=E?Iw(y,E):new FormData(y);$m(u,{pending:!0,data:H,method:y.method,action:v},null,H)}}else typeof v=="function"&&(A.preventDefault(),H=E?Iw(y,E):new FormData(y),$m(u,{pending:!0,data:H,method:y.method,action:v},v,H))},currentTarget:y}]})}}for(var kp=0;kp<im.length;kp++){var jp=im[kp],u2=jp.toLowerCase(),c2=jp[0].toUpperCase()+jp.slice(1);pa(u2,"on"+c2)}pa(hx,"onAnimationEnd"),pa(mx,"onAnimationIteration"),pa(px,"onAnimationStart"),pa("dblclick","onDoubleClick"),pa("focusin","onFocus"),pa("focusout","onBlur"),pa(CA,"onTransitionRun"),pa(NA,"onTransitionStart"),pa(_A,"onTransitionCancel"),pa(gx,"onTransitionEnd"),Dn("onMouseEnter",["mouseout","mouseover"]),Dn("onMouseLeave",["mouseout","mouseover"]),Dn("onPointerEnter",["pointerout","pointerover"]),Dn("onPointerLeave",["pointerout","pointerover"]),vn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),vn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),vn("onBeforeInput",["compositionend","keypress","textInput","paste"]),vn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),vn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),vn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),d2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(xu));function Lw(r,i){i=(i&4)!==0;for(var u=0;u<r.length;u++){var d=r[u],y=d.event;d=d.listeners;e:{var v=void 0;if(i)for(var E=d.length-1;0<=E;E--){var A=d[E],H=A.instance,te=A.currentTarget;if(A=A.listener,H!==v&&y.isPropagationStopped())break e;v=A,y.currentTarget=te;try{v(y)}catch(ue){td(ue)}y.currentTarget=null,v=H}else for(E=0;E<d.length;E++){if(A=d[E],H=A.instance,te=A.currentTarget,A=A.listener,H!==v&&y.isPropagationStopped())break e;v=A,y.currentTarget=te;try{v(y)}catch(ue){td(ue)}y.currentTarget=null,v=H}}}}function ut(r,i){var u=i[sl];u===void 0&&(u=i[sl]=new Set);var d=r+"__bubble";u.has(d)||(Pw(i,r,2,!1),u.add(d))}function Ep(r,i,u){var d=0;i&&(d|=4),Pw(u,r,d,i)}var Fd="_reactListening"+Math.random().toString(36).slice(2);function Cp(r){if(!r[Fd]){r[Fd]=!0,Wt.forEach(function(u){u!=="selectionchange"&&(d2.has(u)||Ep(u,!1,r),Ep(u,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[Fd]||(i[Fd]=!0,Ep("selectionchange",!1,i))}}function Pw(r,i,u,d){switch(hS(i)){case 2:var y=U2;break;case 8:y=B2;break;default:y=Fp}u=y.bind(null,i,u,r),y=void 0,!Gh||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(y=!0),d?y!==void 0?r.addEventListener(i,u,{capture:!0,passive:y}):r.addEventListener(i,u,!0):y!==void 0?r.addEventListener(i,u,{passive:y}):r.addEventListener(i,u,!1)}function Np(r,i,u,d,y){var v=d;if((i&1)===0&&(i&2)===0&&d!==null)e:for(;;){if(d===null)return;var E=d.tag;if(E===3||E===4){var A=d.stateNode.containerInfo;if(A===y)break;if(E===4)for(E=d.return;E!==null;){var H=E.tag;if((H===3||H===4)&&E.stateNode.containerInfo===y)return;E=E.return}for(;A!==null;){if(E=$(A),E===null)return;if(H=E.tag,H===5||H===6||H===26||H===27){d=v=E;continue e}A=A.parentNode}}d=d.return}Hb(function(){var te=v,ue=qh(u),fe=[];e:{var re=yx.get(r);if(re!==void 0){var le=Wc,Te=r;switch(r){case"keypress":if(Yc(u)===0)break e;case"keydown":case"keyup":le=aA;break;case"focusin":Te="focus",le=Yh;break;case"focusout":Te="blur",le=Yh;break;case"beforeblur":case"afterblur":le=Yh;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=Gb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=GT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=lA;break;case hx:case mx:case px:le=KT;break;case gx:le=uA;break;case"scroll":case"scrollend":le=qT;break;case"wheel":le=dA;break;case"copy":case"cut":case"paste":le=XT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=Qb;break;case"toggle":case"beforetoggle":le=hA}var Ze=(i&4)!==0,zt=!Ze&&(r==="scroll"||r==="scrollend"),X=Ze?re!==null?re+"Capture":null:re;Ze=[];for(var Q=te,ee;Q!==null;){var de=Q;if(ee=de.stateNode,de=de.tag,de!==5&&de!==26&&de!==27||ee===null||X===null||(de=$o(Q,X),de!=null&&Ze.push(wu(Q,de,ee))),zt)break;Q=Q.return}0<Ze.length&&(re=new le(re,Te,null,u,ue),fe.push({event:re,listeners:Ze}))}}if((i&7)===0){e:{if(re=r==="mouseover"||r==="pointerover",le=r==="mouseout"||r==="pointerout",re&&u!==Hh&&(Te=u.relatedTarget||u.fromElement)&&($(Te)||Te[Ia]))break e;if((le||re)&&(re=ue.window===ue?ue:(re=ue.ownerDocument)?re.defaultView||re.parentWindow:window,le?(Te=u.relatedTarget||u.toElement,le=te,Te=Te?$(Te):null,Te!==null&&(zt=o(Te),Ze=Te.tag,Te!==zt||Ze!==5&&Ze!==27&&Ze!==6)&&(Te=null)):(le=null,Te=te),le!==Te)){if(Ze=Gb,de="onMouseLeave",X="onMouseEnter",Q="mouse",(r==="pointerout"||r==="pointerover")&&(Ze=Qb,de="onPointerLeave",X="onPointerEnter",Q="pointer"),zt=le==null?re:Ce(le),ee=Te==null?re:Ce(Te),re=new Ze(de,Q+"leave",le,u,ue),re.target=zt,re.relatedTarget=ee,de=null,$(ue)===te&&(Ze=new Ze(X,Q+"enter",Te,u,ue),Ze.target=ee,Ze.relatedTarget=zt,de=Ze),zt=de,le&&Te)t:{for(Ze=f2,X=le,Q=Te,ee=0,de=X;de;de=Ze(de))ee++;de=0;for(var Fe=Q;Fe;Fe=Ze(Fe))de++;for(;0<ee-de;)X=Ze(X),ee--;for(;0<de-ee;)Q=Ze(Q),de--;for(;ee--;){if(X===Q||Q!==null&&X===Q.alternate){Ze=X;break t}X=Ze(X),Q=Ze(Q)}Ze=null}else Ze=null;le!==null&&Uw(fe,re,le,Ze,!1),Te!==null&&zt!==null&&Uw(fe,zt,Te,Ze,!0)}}e:{if(re=te?Ce(te):window,le=re.nodeName&&re.nodeName.toLowerCase(),le==="select"||le==="input"&&re.type==="file")var kt=nx;else if(ex(re))if(rx)kt=kA;else{kt=wA;var De=xA}else le=re.nodeName,!le||le.toLowerCase()!=="input"||re.type!=="checkbox"&&re.type!=="radio"?te&&$h(te.elementType)&&(kt=nx):kt=SA;if(kt&&(kt=kt(r,te))){tx(fe,kt,u,ue);break e}De&&De(r,re,te),r==="focusout"&&te&&re.type==="number"&&te.memoizedProps.value!=null&&Fh(re,"number",re.value)}switch(De=te?Ce(te):window,r){case"focusin":(ex(De)||De.contentEditable==="true")&&(fl=De,nm=te,Yo=null);break;case"focusout":Yo=nm=fl=null;break;case"mousedown":rm=!0;break;case"contextmenu":case"mouseup":case"dragend":rm=!1,dx(fe,u,ue);break;case"selectionchange":if(EA)break;case"keydown":case"keyup":dx(fe,u,ue)}var Xe;if(Wh)e:{switch(r){case"compositionstart":var ft="onCompositionStart";break e;case"compositionend":ft="onCompositionEnd";break e;case"compositionupdate":ft="onCompositionUpdate";break e}ft=void 0}else dl?Wb(r,u)&&(ft="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(ft="onCompositionStart");ft&&(Kb&&u.locale!=="ko"&&(dl||ft!=="onCompositionStart"?ft==="onCompositionEnd"&&dl&&(Xe=qb()):(bi=ue,Vh="value"in bi?bi.value:bi.textContent,dl=!0)),De=$d(te,ft),0<De.length&&(ft=new Vb(ft,r,null,u,ue),fe.push({event:ft,listeners:De}),Xe?ft.data=Xe:(Xe=Jb(u),Xe!==null&&(ft.data=Xe)))),(Xe=pA?gA(r,u):yA(r,u))&&(ft=$d(te,"onBeforeInput"),0<ft.length&&(De=new Vb("onBeforeInput","beforeinput",null,u,ue),fe.push({event:De,listeners:ft}),De.data=Xe)),o2(fe,r,te,u,ue)}Lw(fe,i)})}function wu(r,i,u){return{instance:r,listener:i,currentTarget:u}}function $d(r,i){for(var u=i+"Capture",d=[];r!==null;){var y=r,v=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||v===null||(y=$o(r,u),y!=null&&d.unshift(wu(r,y,v)),y=$o(r,i),y!=null&&d.push(wu(r,y,v))),r.tag===3)return d;r=r.return}return[]}function f2(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function Uw(r,i,u,d,y){for(var v=i._reactName,E=[];u!==null&&u!==d;){var A=u,H=A.alternate,te=A.stateNode;if(A=A.tag,H!==null&&H===d)break;A!==5&&A!==26&&A!==27||te===null||(H=te,y?(te=$o(u,v),te!=null&&E.unshift(wu(u,te,H))):y||(te=$o(u,v),te!=null&&E.push(wu(u,te,H)))),u=u.return}E.length!==0&&r.push({event:i,listeners:E})}var h2=/\r\n?/g,m2=/\u0000|\uFFFD/g;function Bw(r){return(typeof r=="string"?r:""+r).replace(h2,`
|
|
49
|
+
`).replace(m2,"")}function Fw(r,i){return i=Bw(i),Bw(r)===i}function Ot(r,i,u,d,y,v){switch(u){case"children":typeof d=="string"?i==="body"||i==="textarea"&&d===""||ol(r,d):(typeof d=="number"||typeof d=="bigint")&&i!=="body"&&ol(r,""+d);break;case"className":Gc(r,"class",d);break;case"tabIndex":Gc(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Gc(r,u,d);break;case"style":Fb(r,d,v);break;case"data":if(i!=="object"){Gc(r,"data",d);break}case"src":case"href":if(d===""&&(i!=="a"||u!=="href")){r.removeAttribute(u);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(u);break}d=Qc(""+d),r.setAttribute(u,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(u==="formAction"?(i!=="input"&&Ot(r,i,"name",y.name,y,null),Ot(r,i,"formEncType",y.formEncType,y,null),Ot(r,i,"formMethod",y.formMethod,y,null),Ot(r,i,"formTarget",y.formTarget,y,null)):(Ot(r,i,"encType",y.encType,y,null),Ot(r,i,"method",y.method,y,null),Ot(r,i,"target",y.target,y,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(u);break}d=Qc(""+d),r.setAttribute(u,d);break;case"onClick":d!=null&&(r.onclick=Pa);break;case"onScroll":d!=null&&ut("scroll",r);break;case"onScrollEnd":d!=null&&ut("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(u=d.__html,u!=null){if(y.children!=null)throw Error(a(60));r.innerHTML=u}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){r.removeAttribute("xlink:href");break}u=Qc(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(u,""+d):r.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(u,""):r.removeAttribute(u);break;case"capture":case"download":d===!0?r.setAttribute(u,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(u,d):r.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(u,d):r.removeAttribute(u);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(u):r.setAttribute(u,d);break;case"popover":ut("beforetoggle",r),ut("toggle",r),Zc(r,"popover",d);break;case"xlinkActuate":La(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":La(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":La(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":La(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":La(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":La(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":La(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":La(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":La(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Zc(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=$T.get(u)||u,Zc(r,u,d))}}function _p(r,i,u,d,y,v){switch(u){case"style":Fb(r,d,v);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(u=d.__html,u!=null){if(y.children!=null)throw Error(a(60));r.innerHTML=u}}break;case"children":typeof d=="string"?ol(r,d):(typeof d=="number"||typeof d=="bigint")&&ol(r,""+d);break;case"onScroll":d!=null&&ut("scroll",r);break;case"onScrollEnd":d!=null&&ut("scrollend",r);break;case"onClick":d!=null&&(r.onclick=Pa);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Un.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(y=u.endsWith("Capture"),i=u.slice(2,y?u.length-7:void 0),v=r[Gt]||null,v=v!=null?v[u]:null,typeof v=="function"&&r.removeEventListener(i,v,y),typeof d=="function")){typeof v!="function"&&v!==null&&(u in r?r[u]=null:r.hasAttribute(u)&&r.removeAttribute(u)),r.addEventListener(i,d,y);break e}u in r?r[u]=d:d===!0?r.setAttribute(u,""):Zc(r,u,d)}}}function Hn(r,i,u){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ut("error",r),ut("load",r);var d=!1,y=!1,v;for(v in u)if(u.hasOwnProperty(v)){var E=u[v];if(E!=null)switch(v){case"src":d=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Ot(r,i,v,E,u,null)}}y&&Ot(r,i,"srcSet",u.srcSet,u,null),d&&Ot(r,i,"src",u.src,u,null);return;case"input":ut("invalid",r);var A=v=E=y=null,H=null,te=null;for(d in u)if(u.hasOwnProperty(d)){var ue=u[d];if(ue!=null)switch(d){case"name":y=ue;break;case"type":E=ue;break;case"checked":H=ue;break;case"defaultChecked":te=ue;break;case"value":v=ue;break;case"defaultValue":A=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(a(137,i));break;default:Ot(r,i,d,ue,u,null)}}Lb(r,v,A,H,te,E,y,!1);return;case"select":ut("invalid",r),d=E=v=null;for(y in u)if(u.hasOwnProperty(y)&&(A=u[y],A!=null))switch(y){case"value":v=A;break;case"defaultValue":E=A;break;case"multiple":d=A;default:Ot(r,i,y,A,u,null)}i=v,u=E,r.multiple=!!d,i!=null?ll(r,!!d,i,!1):u!=null&&ll(r,!!d,u,!0);return;case"textarea":ut("invalid",r),v=y=d=null;for(E in u)if(u.hasOwnProperty(E)&&(A=u[E],A!=null))switch(E){case"value":d=A;break;case"defaultValue":y=A;break;case"children":v=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(a(91));break;default:Ot(r,i,E,A,u,null)}Ub(r,d,y,v);return;case"option":for(H in u)if(u.hasOwnProperty(H)&&(d=u[H],d!=null))switch(H){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Ot(r,i,H,d,u,null)}return;case"dialog":ut("beforetoggle",r),ut("toggle",r),ut("cancel",r),ut("close",r);break;case"iframe":case"object":ut("load",r);break;case"video":case"audio":for(d=0;d<xu.length;d++)ut(xu[d],r);break;case"image":ut("error",r),ut("load",r);break;case"details":ut("toggle",r);break;case"embed":case"source":case"link":ut("error",r),ut("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(te in u)if(u.hasOwnProperty(te)&&(d=u[te],d!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Ot(r,i,te,d,u,null)}return;default:if($h(i)){for(ue in u)u.hasOwnProperty(ue)&&(d=u[ue],d!==void 0&&_p(r,i,ue,d,u,void 0));return}}for(A in u)u.hasOwnProperty(A)&&(d=u[A],d!=null&&Ot(r,i,A,d,u,null))}function p2(r,i,u,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,v=null,E=null,A=null,H=null,te=null,ue=null;for(le in u){var fe=u[le];if(u.hasOwnProperty(le)&&fe!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":H=fe;default:d.hasOwnProperty(le)||Ot(r,i,le,null,d,fe)}}for(var re in d){var le=d[re];if(fe=u[re],d.hasOwnProperty(re)&&(le!=null||fe!=null))switch(re){case"type":v=le;break;case"name":y=le;break;case"checked":te=le;break;case"defaultChecked":ue=le;break;case"value":E=le;break;case"defaultValue":A=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(a(137,i));break;default:le!==fe&&Ot(r,i,re,le,d,fe)}}Bh(r,E,A,H,te,ue,v,y);return;case"select":le=E=A=re=null;for(v in u)if(H=u[v],u.hasOwnProperty(v)&&H!=null)switch(v){case"value":break;case"multiple":le=H;default:d.hasOwnProperty(v)||Ot(r,i,v,null,d,H)}for(y in d)if(v=d[y],H=u[y],d.hasOwnProperty(y)&&(v!=null||H!=null))switch(y){case"value":re=v;break;case"defaultValue":A=v;break;case"multiple":E=v;default:v!==H&&Ot(r,i,y,v,d,H)}i=A,u=E,d=le,re!=null?ll(r,!!u,re,!1):!!d!=!!u&&(i!=null?ll(r,!!u,i,!0):ll(r,!!u,u?[]:"",!1));return;case"textarea":le=re=null;for(A in u)if(y=u[A],u.hasOwnProperty(A)&&y!=null&&!d.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:Ot(r,i,A,null,d,y)}for(E in d)if(y=d[E],v=u[E],d.hasOwnProperty(E)&&(y!=null||v!=null))switch(E){case"value":re=y;break;case"defaultValue":le=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(a(91));break;default:y!==v&&Ot(r,i,E,y,d,v)}Pb(r,re,le);return;case"option":for(var Te in u)if(re=u[Te],u.hasOwnProperty(Te)&&re!=null&&!d.hasOwnProperty(Te))switch(Te){case"selected":r.selected=!1;break;default:Ot(r,i,Te,null,d,re)}for(H in d)if(re=d[H],le=u[H],d.hasOwnProperty(H)&&re!==le&&(re!=null||le!=null))switch(H){case"selected":r.selected=re&&typeof re!="function"&&typeof re!="symbol";break;default:Ot(r,i,H,re,d,le)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ze in u)re=u[Ze],u.hasOwnProperty(Ze)&&re!=null&&!d.hasOwnProperty(Ze)&&Ot(r,i,Ze,null,d,re);for(te in d)if(re=d[te],le=u[te],d.hasOwnProperty(te)&&re!==le&&(re!=null||le!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(a(137,i));break;default:Ot(r,i,te,re,d,le)}return;default:if($h(i)){for(var zt in u)re=u[zt],u.hasOwnProperty(zt)&&re!==void 0&&!d.hasOwnProperty(zt)&&_p(r,i,zt,void 0,d,re);for(ue in d)re=d[ue],le=u[ue],!d.hasOwnProperty(ue)||re===le||re===void 0&&le===void 0||_p(r,i,ue,re,d,le);return}}for(var X in u)re=u[X],u.hasOwnProperty(X)&&re!=null&&!d.hasOwnProperty(X)&&Ot(r,i,X,null,d,re);for(fe in d)re=d[fe],le=u[fe],!d.hasOwnProperty(fe)||re===le||re==null&&le==null||Ot(r,i,fe,re,d,le)}function $w(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function g2(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,u=performance.getEntriesByType("resource"),d=0;d<u.length;d++){var y=u[d],v=y.transferSize,E=y.initiatorType,A=y.duration;if(v&&A&&$w(E)){for(E=0,A=y.responseEnd,d+=1;d<u.length;d++){var H=u[d],te=H.startTime;if(te>A)break;var ue=H.transferSize,fe=H.initiatorType;ue&&$w(fe)&&(H=H.responseEnd,E+=ue*(H<A?1:(A-te)/(H-te)))}if(--d,i+=8*(v+E)/(y.duration/1e3),r++,10<r)break}}if(0<r)return i/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var Tp=null,Ap=null;function Hd(r){return r.nodeType===9?r:r.ownerDocument}function Hw(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 qw(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 Rp(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 Op=null;function y2(){var r=window.event;return r&&r.type==="popstate"?r===Op?!1:(Op=r,!0):(Op=null,!1)}var Zw=typeof setTimeout=="function"?setTimeout:void 0,v2=typeof clearTimeout=="function"?clearTimeout:void 0,Gw=typeof Promise=="function"?Promise:void 0,b2=typeof queueMicrotask=="function"?queueMicrotask:typeof Gw<"u"?function(r){return Gw.resolve(null).then(r).catch(x2)}:Zw;function x2(r){setTimeout(function(){throw r})}function Ii(r){return r==="head"}function Vw(r,i){var u=i,d=0;do{var y=u.nextSibling;if(r.removeChild(u),y&&y.nodeType===8)if(u=y.data,u==="/$"||u==="/&"){if(d===0){r.removeChild(y),Ul(i);return}d--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")d++;else if(u==="html")Su(r.ownerDocument.documentElement);else if(u==="head"){u=r.ownerDocument.head,Su(u);for(var v=u.firstChild;v;){var E=v.nextSibling,A=v.nodeName;v[vi]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&v.rel.toLowerCase()==="stylesheet"||u.removeChild(v),v=E}}else u==="body"&&Su(r.ownerDocument.body);u=y}while(u);Ul(i)}function Qw(r,i){var u=r;r=0;do{var d=u.nextSibling;if(u.nodeType===1?i?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(i?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),d&&d.nodeType===8)if(u=d.data,u==="/$"){if(r===0)break;r--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||r++;u=d}while(u)}function zp(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":zp(u),Ue(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}r.removeChild(u)}}function w2(r,i,u,d){for(;r.nodeType===1;){var y=u;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[vi])switch(i){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(v=r.getAttribute("rel"),v==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(v!==y.rel||r.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||r.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||r.getAttribute("title")!==(y.title==null?null:y.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(v=r.getAttribute("src"),(v!==(y.src==null?null:y.src)||r.getAttribute("type")!==(y.type==null?null:y.type)||r.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&v&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(i==="input"&&r.type==="hidden"){var v=y.name==null?null:""+y.name;if(y.type==="hidden"&&r.getAttribute("name")===v)return r}else return r;if(r=Wr(r.nextSibling),r===null)break}return null}function S2(r,i,u){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!u||(r=Wr(r.nextSibling),r===null))return null;return r}function Kw(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=Wr(r.nextSibling),r===null))return null;return r}function Mp(r){return r.data==="$?"||r.data==="$~"}function Dp(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function k2(r,i){var u=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||u.readyState!=="loading")i();else{var d=function(){i(),u.removeEventListener("DOMContentLoaded",d)};u.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function Wr(r){for(;r!=null;r=r.nextSibling){var i=r.nodeType;if(i===1||i===3)break;if(i===8){if(i=r.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return r}var Ip=null;function Yw(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var u=r.data;if(u==="/$"||u==="/&"){if(i===0)return Wr(r.nextSibling);i--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||i++}r=r.nextSibling}return null}function Xw(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 Ww(r,i,u){switch(i=Hd(u),r){case"html":if(r=i.documentElement,!r)throw Error(a(452));return r;case"head":if(r=i.head,!r)throw Error(a(453));return r;case"body":if(r=i.body,!r)throw Error(a(454));return r;default:throw Error(a(451))}}function Su(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);Ue(r)}var Jr=new Map,Jw=new Set;function qd(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var ei=ne.d;ne.d={f:j2,r:E2,D:C2,C:N2,L:_2,m:T2,X:R2,S:A2,M:O2};function j2(){var r=ei.f(),i=Dd();return r||i}function E2(r){var i=he(r);i!==null&&i.tag===5&&i.type==="form"?g0(i):ei.r(r)}var Il=typeof document>"u"?null:document;function eS(r,i,u){var d=Il;if(d&&typeof i=="string"&&i){var y=Zr(i);y='link[rel="'+r+'"][href="'+y+'"]',typeof u=="string"&&(y+='[crossorigin="'+u+'"]'),Jw.has(y)||(Jw.add(y),r={rel:r,crossOrigin:u,href:i},d.querySelector(y)===null&&(i=d.createElement("link"),Hn(i,"link",r),mt(i),d.head.appendChild(i)))}}function C2(r){ei.D(r),eS("dns-prefetch",r,null)}function N2(r,i){ei.C(r,i),eS("preconnect",r,i)}function _2(r,i,u){ei.L(r,i,u);var d=Il;if(d&&r&&i){var y='link[rel="preload"][as="'+Zr(i)+'"]';i==="image"&&u&&u.imageSrcSet?(y+='[imagesrcset="'+Zr(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(y+='[imagesizes="'+Zr(u.imageSizes)+'"]')):y+='[href="'+Zr(r)+'"]';var v=y;switch(i){case"style":v=Ll(r);break;case"script":v=Pl(r)}Jr.has(v)||(r=g({rel:"preload",href:i==="image"&&u&&u.imageSrcSet?void 0:r,as:i},u),Jr.set(v,r),d.querySelector(y)!==null||i==="style"&&d.querySelector(ku(v))||i==="script"&&d.querySelector(ju(v))||(i=d.createElement("link"),Hn(i,"link",r),mt(i),d.head.appendChild(i)))}}function T2(r,i){ei.m(r,i);var u=Il;if(u&&r){var d=i&&typeof i.as=="string"?i.as:"script",y='link[rel="modulepreload"][as="'+Zr(d)+'"][href="'+Zr(r)+'"]',v=y;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Pl(r)}if(!Jr.has(v)&&(r=g({rel:"modulepreload",href:r},i),Jr.set(v,r),u.querySelector(y)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(ju(v)))return}d=u.createElement("link"),Hn(d,"link",r),mt(d),u.head.appendChild(d)}}}function A2(r,i,u){ei.S(r,i,u);var d=Il;if(d&&r){var y=wt(d).hoistableStyles,v=Ll(r);i=i||"default";var E=y.get(v);if(!E){var A={loading:0,preload:null};if(E=d.querySelector(ku(v)))A.loading=5;else{r=g({rel:"stylesheet",href:r,"data-precedence":i},u),(u=Jr.get(v))&&Lp(r,u);var H=E=d.createElement("link");mt(H),Hn(H,"link",r),H._p=new Promise(function(te,ue){H.onload=te,H.onerror=ue}),H.addEventListener("load",function(){A.loading|=1}),H.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Zd(E,i,d)}E={type:"stylesheet",instance:E,count:1,state:A},y.set(v,E)}}}function R2(r,i){ei.X(r,i);var u=Il;if(u&&r){var d=wt(u).hoistableScripts,y=Pl(r),v=d.get(y);v||(v=u.querySelector(ju(y)),v||(r=g({src:r,async:!0},i),(i=Jr.get(y))&&Pp(r,i),v=u.createElement("script"),mt(v),Hn(v,"link",r),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(y,v))}}function O2(r,i){ei.M(r,i);var u=Il;if(u&&r){var d=wt(u).hoistableScripts,y=Pl(r),v=d.get(y);v||(v=u.querySelector(ju(y)),v||(r=g({src:r,async:!0,type:"module"},i),(i=Jr.get(y))&&Pp(r,i),v=u.createElement("script"),mt(v),Hn(v,"link",r),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(y,v))}}function tS(r,i,u,d){var y=(y=ae.current)?qd(y):null;if(!y)throw Error(a(446));switch(r){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(i=Ll(u.href),u=wt(y).hoistableStyles,d=u.get(i),d||(d={type:"style",instance:null,count:0,state:null},u.set(i,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){r=Ll(u.href);var v=wt(y).hoistableStyles,E=v.get(r);if(E||(y=y.ownerDocument||y,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(r,E),(v=y.querySelector(ku(r)))&&!v._p&&(E.instance=v,E.state.loading=5),Jr.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},Jr.set(r,u),v||z2(y,r,u,E.state))),i&&d===null)throw Error(a(528,""));return E}if(i&&d!==null)throw Error(a(529,""));return null;case"script":return i=u.async,u=u.src,typeof u=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Pl(u),u=wt(y).hoistableScripts,d=u.get(i),d||(d={type:"script",instance:null,count:0,state:null},u.set(i,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,r))}}function Ll(r){return'href="'+Zr(r)+'"'}function ku(r){return'link[rel="stylesheet"]['+r+"]"}function nS(r){return g({},r,{"data-precedence":r.precedence,precedence:null})}function z2(r,i,u,d){r.querySelector('link[rel="preload"][as="style"]['+i+"]")?d.loading=1:(i=r.createElement("link"),d.preload=i,i.addEventListener("load",function(){return d.loading|=1}),i.addEventListener("error",function(){return d.loading|=2}),Hn(i,"link",u),mt(i),r.head.appendChild(i))}function Pl(r){return'[src="'+Zr(r)+'"]'}function ju(r){return"script[async]"+r}function rS(r,i,u){if(i.count++,i.instance===null)switch(i.type){case"style":var d=r.querySelector('style[data-href~="'+Zr(u.href)+'"]');if(d)return i.instance=d,mt(d),d;var y=g({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),mt(d),Hn(d,"style",y),Zd(d,u.precedence,r),i.instance=d;case"stylesheet":y=Ll(u.href);var v=r.querySelector(ku(y));if(v)return i.state.loading|=4,i.instance=v,mt(v),v;d=nS(u),(y=Jr.get(y))&&Lp(d,y),v=(r.ownerDocument||r).createElement("link"),mt(v);var E=v;return E._p=new Promise(function(A,H){E.onload=A,E.onerror=H}),Hn(v,"link",d),i.state.loading|=4,Zd(v,u.precedence,r),i.instance=v;case"script":return v=Pl(u.src),(y=r.querySelector(ju(v)))?(i.instance=y,mt(y),y):(d=u,(y=Jr.get(v))&&(d=g({},u),Pp(d,y)),r=r.ownerDocument||r,y=r.createElement("script"),mt(y),Hn(y,"link",d),r.head.appendChild(y),i.instance=y);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(d=i.instance,i.state.loading|=4,Zd(d,u.precedence,r));return i.instance}function Zd(r,i,u){for(var d=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=d.length?d[d.length-1]:null,v=y,E=0;E<d.length;E++){var A=d[E];if(A.dataset.precedence===i)v=A;else if(v!==y)break}v?v.parentNode.insertBefore(r,v.nextSibling):(i=u.nodeType===9?u.head:u,i.insertBefore(r,i.firstChild))}function Lp(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function Pp(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var Gd=null;function aS(r,i,u){if(Gd===null){var d=new Map,y=Gd=new Map;y.set(u,d)}else y=Gd,d=y.get(u),d||(d=new Map,y.set(u,d));if(d.has(r))return d;for(d.set(r,null),u=u.getElementsByTagName(r),y=0;y<u.length;y++){var v=u[y];if(!(v[vi]||v[fn]||r==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var E=v.getAttribute(i)||"";E=r+E;var A=d.get(E);A?A.push(v):d.set(E,[v])}}return d}function iS(r,i,u){r=r.ownerDocument||r,r.head.insertBefore(u,i==="title"?r.querySelector("head > title"):null)}function M2(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 sS(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function D2(r,i,u,d){if(u.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var y=Ll(d.href),v=i.querySelector(ku(y));if(v){i=v._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=Vd.bind(r),i.then(r,r)),u.state.loading|=4,u.instance=v,mt(v);return}v=i.ownerDocument||i,d=nS(d),(y=Jr.get(y))&&Lp(d,y),v=v.createElement("link"),mt(v);var E=v;E._p=new Promise(function(A,H){E.onload=A,E.onerror=H}),Hn(v,"link",d),u.instance=v}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(u,i),(i=u.state.preload)&&(u.state.loading&3)===0&&(r.count++,u=Vd.bind(r),i.addEventListener("load",u),i.addEventListener("error",u))}}var Up=0;function I2(r,i){return r.stylesheets&&r.count===0&&Kd(r,r.stylesheets),0<r.count||0<r.imgCount?function(u){var d=setTimeout(function(){if(r.stylesheets&&Kd(r,r.stylesheets),r.unsuspend){var v=r.unsuspend;r.unsuspend=null,v()}},6e4+i);0<r.imgBytes&&Up===0&&(Up=62500*g2());var y=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Kd(r,r.stylesheets),r.unsuspend)){var v=r.unsuspend;r.unsuspend=null,v()}},(r.imgBytes>Up?50:800)+i);return r.unsuspend=u,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(y)}}:null}function Vd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Kd(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Qd=null;function Kd(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Qd=new Map,i.forEach(L2,r),Qd=null,Vd.call(r))}function L2(r,i){if(!(i.state.loading&4)){var u=Qd.get(r);if(u)var d=u.get(null);else{u=new Map,Qd.set(r,u);for(var y=r.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<y.length;v++){var E=y[v];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(u.set(E.dataset.precedence,E),d=E)}d&&u.set(null,d)}y=i.instance,E=y.getAttribute("data-precedence"),v=u.get(E)||d,v===d&&u.set(null,y),u.set(E,y),this.count++,d=Vd.bind(this),y.addEventListener("load",d),y.addEventListener("error",d),v?v.parentNode.insertBefore(y,v.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(y,r.firstChild)),i.state.loading|=4}}var Eu={$$typeof:R,Provider:null,Consumer:null,_currentValue:ke,_currentValue2:ke,_threadCount:0};function P2(r,i,u,d,y,v,E,A,H){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=nt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nt(0),this.hiddenUpdates=nt(null),this.identifierPrefix=d,this.onUncaughtError=y,this.onCaughtError=v,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function lS(r,i,u,d,y,v,E,A,H,te,ue,fe){return r=new P2(r,i,u,E,H,te,ue,fe,A),i=1,v===!0&&(i|=24),v=Or(3,null,null,i),r.current=v,v.stateNode=r,i=vm(),i.refCount++,r.pooledCache=i,i.refCount++,v.memoizedState={element:d,isDehydrated:u,cache:i},Sm(v),r}function oS(r){return r?(r=pl,r):pl}function uS(r,i,u,d,y,v){y=oS(y),d.context===null?d.context=y:d.pendingContext=y,d=Ei(i),d.payload={element:u},v=v===void 0?null:v,v!==null&&(d.callback=v),u=Ci(r,d,i),u!==null&&(br(u,r,i),ru(u,r,i))}function cS(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<i?u:i}}function Bp(r,i){cS(r,i),(r=r.alternate)&&cS(r,i)}function dS(r){if(r.tag===13||r.tag===31){var i=ws(r,67108864);i!==null&&br(i,r,67108864),Bp(r,67108864)}}function fS(r){if(r.tag===13||r.tag===31){var i=Lr();i=rr(i);var u=ws(r,i);u!==null&&br(u,r,i),Bp(r,i)}}var Yd=!0;function U2(r,i,u,d){var y=Z.T;Z.T=null;var v=ne.p;try{ne.p=2,Fp(r,i,u,d)}finally{ne.p=v,Z.T=y}}function B2(r,i,u,d){var y=Z.T;Z.T=null;var v=ne.p;try{ne.p=8,Fp(r,i,u,d)}finally{ne.p=v,Z.T=y}}function Fp(r,i,u,d){if(Yd){var y=$p(d);if(y===null)Np(r,i,d,Xd,u),mS(r,d);else if($2(y,r,i,u,d))d.stopPropagation();else if(mS(r,d),i&4&&-1<F2.indexOf(r)){for(;y!==null;){var v=he(y);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var E=Vn(v.pendingLanes);if(E!==0){var A=v;for(A.pendingLanes|=2,A.entangledLanes|=2;E;){var H=1<<31-lt(E);A.entanglements[1]|=H,E&=~H}Ca(v),(Et&6)===0&&(zd=cn()+500,bu(0))}}break;case 31:case 13:A=ws(v,2),A!==null&&br(A,v,2),Dd(),Bp(v,2)}if(v=$p(d),v===null&&Np(r,i,d,Xd,u),v===y)break;y=v}y!==null&&d.stopPropagation()}else Np(r,i,d,null,u)}}function $p(r){return r=qh(r),Hp(r)}var Xd=null;function Hp(r){if(Xd=null,r=$(r),r!==null){var i=o(r);if(i===null)r=null;else{var u=i.tag;if(u===13){if(r=c(i),r!==null)return r;r=null}else if(u===31){if(r=f(i),r!==null)return r;r=null}else if(u===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return Xd=r,null}function hS(r){switch(r){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(da()){case oe:return 2;case ge:return 8;case $e:case Ve:return 32;case st:return 268435456;default:return 32}default:return 32}}var qp=!1,Li=null,Pi=null,Ui=null,Cu=new Map,Nu=new Map,Bi=[],F2="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 mS(r,i){switch(r){case"focusin":case"focusout":Li=null;break;case"dragenter":case"dragleave":Pi=null;break;case"mouseover":case"mouseout":Ui=null;break;case"pointerover":case"pointerout":Cu.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Nu.delete(i.pointerId)}}function _u(r,i,u,d,y,v){return r===null||r.nativeEvent!==v?(r={blockedOn:i,domEventName:u,eventSystemFlags:d,nativeEvent:v,targetContainers:[y]},i!==null&&(i=he(i),i!==null&&dS(i)),r):(r.eventSystemFlags|=d,i=r.targetContainers,y!==null&&i.indexOf(y)===-1&&i.push(y),r)}function $2(r,i,u,d,y){switch(i){case"focusin":return Li=_u(Li,r,i,u,d,y),!0;case"dragenter":return Pi=_u(Pi,r,i,u,d,y),!0;case"mouseover":return Ui=_u(Ui,r,i,u,d,y),!0;case"pointerover":var v=y.pointerId;return Cu.set(v,_u(Cu.get(v)||null,r,i,u,d,y)),!0;case"gotpointercapture":return v=y.pointerId,Nu.set(v,_u(Nu.get(v)||null,r,i,u,d,y)),!0}return!1}function pS(r){var i=$(r.target);if(i!==null){var u=o(i);if(u!==null){if(i=u.tag,i===13){if(i=c(u),i!==null){r.blockedOn=i,Po(r.priority,function(){fS(u)});return}}else if(i===31){if(i=f(u),i!==null){r.blockedOn=i,Po(r.priority,function(){fS(u)});return}}else if(i===3&&u.stateNode.current.memoizedState.isDehydrated){r.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Wd(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var u=$p(r.nativeEvent);if(u===null){u=r.nativeEvent;var d=new u.constructor(u.type,u);Hh=d,u.target.dispatchEvent(d),Hh=null}else return i=he(u),i!==null&&dS(i),r.blockedOn=u,!1;i.shift()}return!0}function gS(r,i,u){Wd(r)&&u.delete(i)}function H2(){qp=!1,Li!==null&&Wd(Li)&&(Li=null),Pi!==null&&Wd(Pi)&&(Pi=null),Ui!==null&&Wd(Ui)&&(Ui=null),Cu.forEach(gS),Nu.forEach(gS)}function Jd(r,i){r.blockedOn===i&&(r.blockedOn=null,qp||(qp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,H2)))}var ef=null;function yS(r){ef!==r&&(ef=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ef===r&&(ef=null);for(var i=0;i<r.length;i+=3){var u=r[i],d=r[i+1],y=r[i+2];if(typeof d!="function"){if(Hp(d||u)===null)continue;break}var v=he(u);v!==null&&(r.splice(i,3),i-=3,$m(v,{pending:!0,data:y,method:u.method,action:d},d,y))}}))}function Ul(r){function i(H){return Jd(H,r)}Li!==null&&Jd(Li,r),Pi!==null&&Jd(Pi,r),Ui!==null&&Jd(Ui,r),Cu.forEach(i),Nu.forEach(i);for(var u=0;u<Bi.length;u++){var d=Bi[u];d.blockedOn===r&&(d.blockedOn=null)}for(;0<Bi.length&&(u=Bi[0],u.blockedOn===null);)pS(u),u.blockedOn===null&&Bi.shift();if(u=(r.ownerDocument||r).$$reactFormReplay,u!=null)for(d=0;d<u.length;d+=3){var y=u[d],v=u[d+1],E=y[Gt]||null;if(typeof v=="function")E||yS(u);else if(E){var A=null;if(v&&v.hasAttribute("formAction")){if(y=v,E=v[Gt]||null)A=E.formAction;else if(Hp(y)!==null)continue}else A=E.action;typeof A=="function"?u[d+1]=A:(u.splice(d,3),d-=3),yS(u)}}}function vS(){function r(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(E){return y=E})},focusReset:"manual",scroll:"manual"})}function i(){y!==null&&(y(),y=null),d||setTimeout(u,20)}function u(){if(!d&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,y=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(u,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),y!==null&&(y(),y=null)}}}function Zp(r){this._internalRoot=r}tf.prototype.render=Zp.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(a(409));var u=i.current,d=Lr();uS(u,d,r,i,null,null)},tf.prototype.unmount=Zp.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;uS(r.current,2,null,r,null,null),Dd(),i[Ia]=null}};function tf(r){this._internalRoot=r}tf.prototype.unstable_scheduleHydration=function(r){if(r){var i=Lo();r={blockedOn:null,target:r,priority:i};for(var u=0;u<Bi.length&&i!==0&&i<Bi[u].priority;u++);Bi.splice(u,0,r),u===0&&pS(r)}};var bS=t.version;if(bS!=="19.2.4")throw Error(a(527,bS,"19.2.4"));ne.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(a(188)):(r=Object.keys(r).join(","),Error(a(268,r)));return r=h(i),r=r!==null?p(r):null,r=r===null?null:r.stateNode,r};var q2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Z,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nf.isDisabled&&nf.supportsFiber)try{qt=nf.inject(q2),Ut=nf}catch{}}return Au.createRoot=function(r,i){if(!s(r))throw Error(a(299));var u=!1,d="",y=C0,v=N0,E=_0;return i!=null&&(i.unstable_strictMode===!0&&(u=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(y=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(E=i.onRecoverableError)),i=lS(r,1,!1,null,null,u,d,null,y,v,E,vS),r[Ia]=i.current,Cp(r),new Zp(i)},Au.hydrateRoot=function(r,i,u){if(!s(r))throw Error(a(299));var d=!1,y="",v=C0,E=N0,A=_0,H=null;return u!=null&&(u.unstable_strictMode===!0&&(d=!0),u.identifierPrefix!==void 0&&(y=u.identifierPrefix),u.onUncaughtError!==void 0&&(v=u.onUncaughtError),u.onCaughtError!==void 0&&(E=u.onCaughtError),u.onRecoverableError!==void 0&&(A=u.onRecoverableError),u.formState!==void 0&&(H=u.formState)),i=lS(r,1,!0,i,u??null,d,y,H,v,E,A,vS),i.context=oS(null),u=i.current,d=Lr(),d=rr(d),y=Ei(d),y.callback=null,Ci(u,y,d),u=d,i.current.lanes=u,yn(i,u),Ca(i),r[Ia]=i.current,Cp(r),new tf(i)},Au.version="19.2.4",Au}var AS;function tR(){if(AS)return Kp.exports;AS=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(),Kp.exports=eR(),Kp.exports}var nR=tR(),Ws=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Us,Ki,ao,gj,rR=(gj=class extends Ws{constructor(){super();Ne(this,Us);Ne(this,Ki);Ne(this,ao);Se(this,ao,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){U(this,Ki)||this.setEventListener(U(this,ao))}onUnsubscribe(){var t;this.hasListeners()||((t=U(this,Ki))==null||t.call(this),Se(this,Ki,void 0))}setEventListener(t){var n;Se(this,ao,t),(n=U(this,Ki))==null||n.call(this),Se(this,Ki,t(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(t){U(this,Us)!==t&&(Se(this,Us,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof U(this,Us)=="boolean"?U(this,Us):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Us=new WeakMap,Ki=new WeakMap,ao=new WeakMap,gj),lv=new rR,aR={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Yi,av,yj,iR=(yj=class{constructor(){Ne(this,Yi,aR);Ne(this,av,!1)}setTimeoutProvider(e){Se(this,Yi,e)}setTimeout(e,t){return U(this,Yi).setTimeout(e,t)}clearTimeout(e){U(this,Yi).clearTimeout(e)}setInterval(e,t){return U(this,Yi).setInterval(e,t)}clearInterval(e){U(this,Yi).clearInterval(e)}},Yi=new WeakMap,av=new WeakMap,yj),Is=new iR;function sR(e){setTimeout(e,0)}var lR=typeof window>"u"||"Deno"in globalThis;function Xn(){}function oR(e,t){return typeof e=="function"?e(t):e}function Qg(e){return typeof e=="number"&&e>=0&&e!==1/0}function Tj(e,t){return Math.max(e+(t||0)-Date.now(),0)}function is(e,t){return typeof e=="function"?e(t):e}function na(e,t){return typeof e=="function"?e(t):e}function RS(e,t){const{type:n="all",exact:a,fetchStatus:s,predicate:o,queryKey:c,stale:f}=e;if(c){if(a){if(t.queryHash!==ov(c,t.options))return!1}else if(!ac(t.queryKey,c))return!1}if(n!=="all"){const m=t.isActive();if(n==="active"&&!m||n==="inactive"&&m)return!1}return!(typeof f=="boolean"&&t.isStale()!==f||s&&s!==t.state.fetchStatus||o&&!o(t))}function OS(e,t){const{exact:n,status:a,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Qs(t.options.mutationKey)!==Qs(o))return!1}else if(!ac(t.options.mutationKey,o))return!1}return!(a&&t.state.status!==a||s&&!s(t))}function ov(e,t){return((t==null?void 0:t.queryKeyHashFn)||Qs)(e)}function Qs(e){return JSON.stringify(e,(t,n)=>Kg(n)?Object.keys(n).sort().reduce((a,s)=>(a[s]=n[s],a),{}):n)}function ac(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>ac(e[n],t[n])):!1}var uR=Object.prototype.hasOwnProperty;function uv(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=zS(e)&&zS(t);if(!a&&!(Kg(e)&&Kg(t)))return t;const o=(a?e:Object.keys(e)).length,c=a?t:Object.keys(t),f=c.length,m=a?new Array(f):{};let h=0;for(let p=0;p<f;p++){const g=a?p:c[p],x=e[g],w=t[g];if(x===w){m[g]=x,(a?p<o:uR.call(e,g))&&h++;continue}if(x===null||w===null||typeof x!="object"||typeof w!="object"){m[g]=w;continue}const S=uv(x,w,n+1);m[g]=S,S===x&&h++}return o===f&&h===o?e:m}function ic(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function zS(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Kg(e){if(!MS(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!MS(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function MS(e){return Object.prototype.toString.call(e)==="[object Object]"}function cR(e){return new Promise(t=>{Is.setTimeout(t,e)})}function Yg(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?uv(e,t):t}function dR(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function fR(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var cv=Symbol();function Aj(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===cv?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function dv(e,t){return typeof e=="function"?e(...t):!!e}function hR(e,t,n){let a=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),a||(a=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var sc=(()=>{let e=()=>lR;return{isServer(){return e()},setIsServer(t){e=t}}})();function Xg(){let e,t;const n=new Promise((s,o)=>{e=s,t=o});n.status="pending",n.catch(()=>{});function a(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{a({status:"fulfilled",value:s}),e(s)},n.reject=s=>{a({status:"rejected",reason:s}),t(s)},n}var mR=sR;function pR(){let e=[],t=0,n=f=>{f()},a=f=>{f()},s=mR;const o=f=>{t?e.push(f):s(()=>{n(f)})},c=()=>{const f=e;e=[],f.length&&s(()=>{a(()=>{f.forEach(m=>{n(m)})})})};return{batch:f=>{let m;t++;try{m=f()}finally{t--,t||c()}return m},batchCalls:f=>(...m)=>{o(()=>{f(...m)})},schedule:o,setNotifyFunction:f=>{n=f},setBatchNotifyFunction:f=>{a=f},setScheduler:f=>{s=f}}}var ln=pR(),io,Xi,so,vj,gR=(vj=class extends Ws{constructor(){super();Ne(this,io,!0);Ne(this,Xi);Ne(this,so);Se(this,so,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),a=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",a)}}})}onSubscribe(){U(this,Xi)||this.setEventListener(U(this,so))}onUnsubscribe(){var t;this.hasListeners()||((t=U(this,Xi))==null||t.call(this),Se(this,Xi,void 0))}setEventListener(t){var n;Se(this,so,t),(n=U(this,Xi))==null||n.call(this),Se(this,Xi,t(this.setOnline.bind(this)))}setOnline(t){U(this,io)!==t&&(Se(this,io,t),this.listeners.forEach(a=>{a(t)}))}isOnline(){return U(this,io)}},io=new WeakMap,Xi=new WeakMap,so=new WeakMap,vj),If=new gR;function yR(e){return Math.min(1e3*2**e,3e4)}function Rj(e){return(e??"online")==="online"?If.isOnline():!0}var Wg=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Oj(e){let t=!1,n=0,a;const s=Xg(),o=()=>s.status!=="pending",c=k=>{var j;if(!o()){const C=new Wg(k);x(C),(j=e.onCancel)==null||j.call(e,C)}},f=()=>{t=!0},m=()=>{t=!1},h=()=>lv.isFocused()&&(e.networkMode==="always"||If.isOnline())&&e.canRun(),p=()=>Rj(e.networkMode)&&e.canRun(),g=k=>{o()||(a==null||a(),s.resolve(k))},x=k=>{o()||(a==null||a(),s.reject(k))},w=()=>new Promise(k=>{var j;a=C=>{(o()||h())&&k(C)},(j=e.onPause)==null||j.call(e)}).then(()=>{var k;a=void 0,o()||(k=e.onContinue)==null||k.call(e)}),S=()=>{if(o())return;let k;const j=n===0?e.initialPromise:void 0;try{k=j??e.fn()}catch(C){k=Promise.reject(C)}Promise.resolve(k).then(g).catch(C=>{var O;if(o())return;const N=e.retry??(sc.isServer()?0:3),R=e.retryDelay??yR,M=typeof R=="function"?R(n,C):R,L=N===!0||typeof N=="number"&&n<N||typeof N=="function"&&N(n,C);if(t||!L){x(C);return}n++,(O=e.onFail)==null||O.call(e,n,C),cR(M).then(()=>h()?void 0:w()).then(()=>{t?x(C):S()})})};return{promise:s,status:()=>s.status,cancel:c,continue:()=>(a==null||a(),s),cancelRetry:f,continueRetry:m,canStart:p,start:()=>(p()?S():w().then(S),s)}}var Bs,bj,zj=(bj=class{constructor(){Ne(this,Bs)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Qg(this.gcTime)&&Se(this,Bs,Is.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(sc.isServer()?1/0:300*1e3))}clearGcTimeout(){U(this,Bs)&&(Is.clearTimeout(U(this,Bs)),Se(this,Bs,void 0))}},Bs=new WeakMap,bj),Fs,lo,ea,$s,Ln,xc,Hs,Br,Mj,ni,xj,vR=(xj=class extends zj{constructor(t){super();Ne(this,Br);Ne(this,Fs);Ne(this,lo);Ne(this,ea);Ne(this,$s);Ne(this,Ln);Ne(this,xc);Ne(this,Hs);Se(this,Hs,!1),Se(this,xc,t.defaultOptions),this.setOptions(t.options),this.observers=[],Se(this,$s,t.client),Se(this,ea,U(this,$s).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Se(this,Fs,IS(this.options)),this.state=t.state??U(this,Fs),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=U(this,Ln))==null?void 0:t.promise}setOptions(t){if(this.options={...U(this,xc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=IS(this.options);n.data!==void 0&&(this.setState(DS(n.data,n.dataUpdatedAt)),Se(this,Fs,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&U(this,ea).remove(this)}setData(t,n){const a=Yg(this.state.data,t,this.options);return Ge(this,Br,ni).call(this,{data:a,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),a}setState(t,n){Ge(this,Br,ni).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var a,s;const n=(a=U(this,Ln))==null?void 0:a.promise;return(s=U(this,Ln))==null||s.cancel(t),n?n.then(Xn).catch(Xn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return U(this,Fs)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>na(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===cv||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>is(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Tj(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(a=>a.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=U(this,Ln))==null||n.continue()}onOnline(){var n;const t=this.observers.find(a=>a.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=U(this,Ln))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),U(this,ea).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(U(this,Ln)&&(U(this,Hs)||Ge(this,Br,Mj).call(this)?U(this,Ln).cancel({revert:!0}):U(this,Ln).cancelRetry()),this.scheduleGc()),U(this,ea).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ge(this,Br,ni).call(this,{type:"invalidate"})}async fetch(t,n){var m,h,p,g,x,w,S,k,j,C,N,R;if(this.state.fetchStatus!=="idle"&&((m=U(this,Ln))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(U(this,Ln))return U(this,Ln).continueRetry(),U(this,Ln).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:()=>(Se(this,Hs,!0),a.signal)})},o=()=>{const M=Aj(this.options,n),O=(()=>{const B={client:U(this,$s),queryKey:this.queryKey,meta:this.meta};return s(B),B})();return Se(this,Hs,!1),this.options.persister?this.options.persister(M,O,this):M(O)},f=(()=>{const M={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:U(this,$s),state:this.state,fetchFn:o};return s(M),M})();(h=this.options.behavior)==null||h.onFetch(f,this),Se(this,lo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=f.fetchOptions)==null?void 0:p.meta))&&Ge(this,Br,ni).call(this,{type:"fetch",meta:(g=f.fetchOptions)==null?void 0:g.meta}),Se(this,Ln,Oj({initialPromise:n==null?void 0:n.initialPromise,fn:f.fetchFn,onCancel:M=>{M instanceof Wg&&M.revert&&this.setState({...U(this,lo),fetchStatus:"idle"}),a.abort()},onFail:(M,L)=>{Ge(this,Br,ni).call(this,{type:"failed",failureCount:M,error:L})},onPause:()=>{Ge(this,Br,ni).call(this,{type:"pause"})},onContinue:()=>{Ge(this,Br,ni).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0}));try{const M=await U(this,Ln).start();if(M===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(M),(w=(x=U(this,ea).config).onSuccess)==null||w.call(x,M,this),(k=(S=U(this,ea).config).onSettled)==null||k.call(S,M,this.state.error,this),M}catch(M){if(M instanceof Wg){if(M.silent)return U(this,Ln).promise;if(M.revert){if(this.state.data===void 0)throw M;return this.state.data}}throw Ge(this,Br,ni).call(this,{type:"error",error:M}),(C=(j=U(this,ea).config).onError)==null||C.call(j,M,this),(R=(N=U(this,ea).config).onSettled)==null||R.call(N,this.state.data,M,this),M}finally{this.scheduleGc()}}},Fs=new WeakMap,lo=new WeakMap,ea=new WeakMap,$s=new WeakMap,Ln=new WeakMap,xc=new WeakMap,Hs=new WeakMap,Br=new WeakSet,Mj=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ni=function(t){const n=a=>{switch(t.type){case"failed":return{...a,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...Dj(a.data,this.options),fetchMeta:t.meta??null};case"success":const s={...a,...DS(t.data,t.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Se(this,lo,t.manual?s:void 0),s;case"error":const o=t.error;return{...a,error:o,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...t.state}}};this.state=n(this.state),ln.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),U(this,ea).notify({query:this,type:"updated",action:t})})},xj);function Dj(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Rj(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function DS(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function IS(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,a=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Sr,gt,wc,lr,qs,oo,ri,Wi,Sc,uo,co,Zs,Gs,Ji,fo,Nt,Ku,Jg,ey,ty,ny,ry,ay,iy,Ij,wj,fv=(wj=class extends Ws{constructor(t,n){super();Ne(this,Nt);Ne(this,Sr);Ne(this,gt);Ne(this,wc);Ne(this,lr);Ne(this,qs);Ne(this,oo);Ne(this,ri);Ne(this,Wi);Ne(this,Sc);Ne(this,uo);Ne(this,co);Ne(this,Zs);Ne(this,Gs);Ne(this,Ji);Ne(this,fo,new Set);this.options=n,Se(this,Sr,t),Se(this,Wi,null),Se(this,ri,Xg()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(U(this,gt).addObserver(this),LS(U(this,gt),this.options)?Ge(this,Nt,Ku).call(this):this.updateResult(),Ge(this,Nt,ny).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return sy(U(this,gt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return sy(U(this,gt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ge(this,Nt,ry).call(this),Ge(this,Nt,ay).call(this),U(this,gt).removeObserver(this)}setOptions(t){const n=this.options,a=U(this,gt);if(this.options=U(this,Sr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof na(this.options.enabled,U(this,gt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ge(this,Nt,iy).call(this),U(this,gt).setOptions(this.options),n._defaulted&&!ic(this.options,n)&&U(this,Sr).getQueryCache().notify({type:"observerOptionsUpdated",query:U(this,gt),observer:this});const s=this.hasListeners();s&&PS(U(this,gt),a,this.options,n)&&Ge(this,Nt,Ku).call(this),this.updateResult(),s&&(U(this,gt)!==a||na(this.options.enabled,U(this,gt))!==na(n.enabled,U(this,gt))||is(this.options.staleTime,U(this,gt))!==is(n.staleTime,U(this,gt)))&&Ge(this,Nt,Jg).call(this);const o=Ge(this,Nt,ey).call(this);s&&(U(this,gt)!==a||na(this.options.enabled,U(this,gt))!==na(n.enabled,U(this,gt))||o!==U(this,Ji))&&Ge(this,Nt,ty).call(this,o)}getOptimisticResult(t){const n=U(this,Sr).getQueryCache().build(U(this,Sr),t),a=this.createResult(n,t);return xR(this,a)&&(Se(this,lr,a),Se(this,oo,this.options),Se(this,qs,U(this,gt).state)),a}getCurrentResult(){return U(this,lr)}trackResult(t,n){return new Proxy(t,{get:(a,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&U(this,ri).status==="pending"&&U(this,ri).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,s))})}trackProp(t){U(this,fo).add(t)}getCurrentQuery(){return U(this,gt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=U(this,Sr).defaultQueryOptions(t),a=U(this,Sr).getQueryCache().build(U(this,Sr),n);return a.fetch().then(()=>this.createResult(a,n))}fetch(t){return Ge(this,Nt,Ku).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),U(this,lr)))}createResult(t,n){var Y;const a=U(this,gt),s=this.options,o=U(this,lr),c=U(this,qs),f=U(this,oo),h=t!==a?t.state:U(this,wc),{state:p}=t;let g={...p},x=!1,w;if(n._optimisticResults){const z=this.hasListeners(),K=!z&&LS(t,n),ie=z&&PS(t,a,n,s);(K||ie)&&(g={...g,...Dj(p.data,t.options)}),n._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:S,errorUpdatedAt:k,status:j}=g;w=g.data;let C=!1;if(n.placeholderData!==void 0&&w===void 0&&j==="pending"){let z;o!=null&&o.isPlaceholderData&&n.placeholderData===(f==null?void 0:f.placeholderData)?(z=o.data,C=!0):z=typeof n.placeholderData=="function"?n.placeholderData((Y=U(this,co))==null?void 0:Y.state.data,U(this,co)):n.placeholderData,z!==void 0&&(j="success",w=Yg(o==null?void 0:o.data,z,n),x=!0)}if(n.select&&w!==void 0&&!C)if(o&&w===(c==null?void 0:c.data)&&n.select===U(this,Sc))w=U(this,uo);else try{Se(this,Sc,n.select),w=n.select(w),w=Yg(o==null?void 0:o.data,w,n),Se(this,uo,w),Se(this,Wi,null)}catch(z){Se(this,Wi,z)}U(this,Wi)&&(S=U(this,Wi),w=U(this,uo),k=Date.now(),j="error");const N=g.fetchStatus==="fetching",R=j==="pending",M=j==="error",L=R&&N,O=w!==void 0,I={status:j,fetchStatus:g.fetchStatus,isPending:R,isSuccess:j==="success",isError:M,isInitialLoading:L,isLoading:L,data:w,dataUpdatedAt:g.dataUpdatedAt,error:S,errorUpdatedAt:k,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>h.dataUpdateCount||g.errorUpdateCount>h.errorUpdateCount,isFetching:N,isRefetching:N&&!R,isLoadingError:M&&!O,isPaused:g.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:M&&O,isStale:hv(t,n),refetch:this.refetch,promise:U(this,ri),isEnabled:na(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const z=I.data!==void 0,K=I.status==="error"&&!z,ie=W=>{K?W.reject(I.error):z&&W.resolve(I.data)},ve=()=>{const W=Se(this,ri,I.promise=Xg());ie(W)},J=U(this,ri);switch(J.status){case"pending":t.queryHash===a.queryHash&&ie(J);break;case"fulfilled":(K||I.data!==J.value)&&ve();break;case"rejected":(!K||I.error!==J.reason)&&ve();break}}return I}updateResult(){const t=U(this,lr),n=this.createResult(U(this,gt),this.options);if(Se(this,qs,U(this,gt).state),Se(this,oo,this.options),U(this,qs).data!==void 0&&Se(this,co,U(this,gt)),ic(n,t))return;Se(this,lr,n);const a=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!U(this,fo).size)return!0;const c=new Set(o??U(this,fo));return this.options.throwOnError&&c.add("error"),Object.keys(U(this,lr)).some(f=>{const m=f;return U(this,lr)[m]!==t[m]&&c.has(m)})};Ge(this,Nt,Ij).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ge(this,Nt,ny).call(this)}},Sr=new WeakMap,gt=new WeakMap,wc=new WeakMap,lr=new WeakMap,qs=new WeakMap,oo=new WeakMap,ri=new WeakMap,Wi=new WeakMap,Sc=new WeakMap,uo=new WeakMap,co=new WeakMap,Zs=new WeakMap,Gs=new WeakMap,Ji=new WeakMap,fo=new WeakMap,Nt=new WeakSet,Ku=function(t){Ge(this,Nt,iy).call(this);let n=U(this,gt).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Xn)),n},Jg=function(){Ge(this,Nt,ry).call(this);const t=is(this.options.staleTime,U(this,gt));if(sc.isServer()||U(this,lr).isStale||!Qg(t))return;const a=Tj(U(this,lr).dataUpdatedAt,t)+1;Se(this,Zs,Is.setTimeout(()=>{U(this,lr).isStale||this.updateResult()},a))},ey=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(U(this,gt)):this.options.refetchInterval)??!1},ty=function(t){Ge(this,Nt,ay).call(this),Se(this,Ji,t),!(sc.isServer()||na(this.options.enabled,U(this,gt))===!1||!Qg(U(this,Ji))||U(this,Ji)===0)&&Se(this,Gs,Is.setInterval(()=>{(this.options.refetchIntervalInBackground||lv.isFocused())&&Ge(this,Nt,Ku).call(this)},U(this,Ji)))},ny=function(){Ge(this,Nt,Jg).call(this),Ge(this,Nt,ty).call(this,Ge(this,Nt,ey).call(this))},ry=function(){U(this,Zs)&&(Is.clearTimeout(U(this,Zs)),Se(this,Zs,void 0))},ay=function(){U(this,Gs)&&(Is.clearInterval(U(this,Gs)),Se(this,Gs,void 0))},iy=function(){const t=U(this,Sr).getQueryCache().build(U(this,Sr),this.options);if(t===U(this,gt))return;const n=U(this,gt);Se(this,gt,t),Se(this,wc,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Ij=function(t){ln.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(U(this,lr))}),U(this,Sr).getQueryCache().notify({query:U(this,gt),type:"observerResultsUpdated"})})},wj);function bR(e,t){return na(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function LS(e,t){return bR(e,t)||e.state.data!==void 0&&sy(e,t,t.refetchOnMount)}function sy(e,t,n){if(na(t.enabled,e)!==!1&&is(t.staleTime,e)!=="static"){const a=typeof n=="function"?n(e):n;return a==="always"||a!==!1&&hv(e,t)}return!1}function PS(e,t,n,a){return(e!==t||na(a.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&hv(e,n)}function hv(e,t){return na(t.enabled,e)!==!1&&e.isStaleByTime(is(t.staleTime,e))}function xR(e,t){return!ic(e.getCurrentResult(),t)}function US(e){return{onFetch:(t,n)=>{var p,g,x,w,S;const a=t.options,s=(x=(g=(p=t.fetchOptions)==null?void 0:p.meta)==null?void 0:g.fetchMore)==null?void 0:x.direction,o=((w=t.state.data)==null?void 0:w.pages)||[],c=((S=t.state.data)==null?void 0:S.pageParams)||[];let f={pages:[],pageParams:[]},m=0;const h=async()=>{let k=!1;const j=R=>{hR(R,()=>t.signal,()=>k=!0)},C=Aj(t.options,t.fetchOptions),N=async(R,M,L)=>{if(k)return Promise.reject();if(M==null&&R.pages.length)return Promise.resolve(R);const B=(()=>{const K={client:t.client,queryKey:t.queryKey,pageParam:M,direction:L?"backward":"forward",meta:t.options.meta};return j(K),K})(),I=await C(B),{maxPages:Y}=t.options,z=L?fR:dR;return{pages:z(R.pages,I,Y),pageParams:z(R.pageParams,M,Y)}};if(s&&o.length){const R=s==="backward",M=R?wR:BS,L={pages:o,pageParams:c},O=M(a,L);f=await N(L,O,R)}else{const R=e??o.length;do{const M=m===0?c[0]??a.initialPageParam:BS(a,f);if(m>0&&M==null)break;f=await N(f,M),m++}while(m<R)}return f};t.options.persister?t.fetchFn=()=>{var k,j;return(j=(k=t.options).persister)==null?void 0:j.call(k,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=h}}}function BS(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 wR(e,{pages:t,pageParams:n}){var a;return t.length>0?(a=e.getPreviousPageParam)==null?void 0:a.call(e,t[0],t,n[0],n):void 0}var kc,_a,Kn,Vs,Ta,Zi,Sj,SR=(Sj=class extends zj{constructor(t){super();Ne(this,Ta);Ne(this,kc);Ne(this,_a);Ne(this,Kn);Ne(this,Vs);Se(this,kc,t.client),this.mutationId=t.mutationId,Se(this,Kn,t.mutationCache),Se(this,_a,[]),this.state=t.state||Lj(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){U(this,_a).includes(t)||(U(this,_a).push(t),this.clearGcTimeout(),U(this,Kn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Se(this,_a,U(this,_a).filter(n=>n!==t)),this.scheduleGc(),U(this,Kn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){U(this,_a).length||(this.state.status==="pending"?this.scheduleGc():U(this,Kn).remove(this))}continue(){var t;return((t=U(this,Vs))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var c,f,m,h,p,g,x,w,S,k,j,C,N,R,M,L,O,B;const n=()=>{Ge(this,Ta,Zi).call(this,{type:"continue"})},a={client:U(this,kc),meta:this.options.meta,mutationKey:this.options.mutationKey};Se(this,Vs,Oj({fn:()=>this.options.mutationFn?this.options.mutationFn(t,a):Promise.reject(new Error("No mutationFn found")),onFail:(I,Y)=>{Ge(this,Ta,Zi).call(this,{type:"failed",failureCount:I,error:Y})},onPause:()=>{Ge(this,Ta,Zi).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>U(this,Kn).canRun(this)}));const s=this.state.status==="pending",o=!U(this,Vs).canStart();try{if(s)n();else{Ge(this,Ta,Zi).call(this,{type:"pending",variables:t,isPaused:o}),U(this,Kn).config.onMutate&&await U(this,Kn).config.onMutate(t,this,a);const Y=await((f=(c=this.options).onMutate)==null?void 0:f.call(c,t,a));Y!==this.state.context&&Ge(this,Ta,Zi).call(this,{type:"pending",context:Y,variables:t,isPaused:o})}const I=await U(this,Vs).start();return await((h=(m=U(this,Kn).config).onSuccess)==null?void 0:h.call(m,I,t,this.state.context,this,a)),await((g=(p=this.options).onSuccess)==null?void 0:g.call(p,I,t,this.state.context,a)),await((w=(x=U(this,Kn).config).onSettled)==null?void 0:w.call(x,I,null,this.state.variables,this.state.context,this,a)),await((k=(S=this.options).onSettled)==null?void 0:k.call(S,I,null,t,this.state.context,a)),Ge(this,Ta,Zi).call(this,{type:"success",data:I}),I}catch(I){try{await((C=(j=U(this,Kn).config).onError)==null?void 0:C.call(j,I,t,this.state.context,this,a))}catch(Y){Promise.reject(Y)}try{await((R=(N=this.options).onError)==null?void 0:R.call(N,I,t,this.state.context,a))}catch(Y){Promise.reject(Y)}try{await((L=(M=U(this,Kn).config).onSettled)==null?void 0:L.call(M,void 0,I,this.state.variables,this.state.context,this,a))}catch(Y){Promise.reject(Y)}try{await((B=(O=this.options).onSettled)==null?void 0:B.call(O,void 0,I,t,this.state.context,a))}catch(Y){Promise.reject(Y)}throw Ge(this,Ta,Zi).call(this,{type:"error",error:I}),I}finally{U(this,Kn).runNext(this)}}},kc=new WeakMap,_a=new WeakMap,Kn=new WeakMap,Vs=new WeakMap,Ta=new WeakSet,Zi=function(t){const n=a=>{switch(t.type){case"failed":return{...a,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...a,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:t.error,failureCount:a.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ln.batch(()=>{U(this,_a).forEach(a=>{a.onMutationUpdate(t)}),U(this,Kn).notify({mutation:this,type:"updated",action:t})})},Sj);function Lj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ai,va,jc,kj,kR=(kj=class extends Ws{constructor(t={}){super();Ne(this,ai);Ne(this,va);Ne(this,jc);this.config=t,Se(this,ai,new Set),Se(this,va,new Map),Se(this,jc,0)}build(t,n,a){const s=new SR({client:t,mutationCache:this,mutationId:++rf(this,jc)._,options:t.defaultMutationOptions(n),state:a});return this.add(s),s}add(t){U(this,ai).add(t);const n=af(t);if(typeof n=="string"){const a=U(this,va).get(n);a?a.push(t):U(this,va).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(U(this,ai).delete(t)){const n=af(t);if(typeof n=="string"){const a=U(this,va).get(n);if(a)if(a.length>1){const s=a.indexOf(t);s!==-1&&a.splice(s,1)}else a[0]===t&&U(this,va).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=af(t);if(typeof n=="string"){const a=U(this,va).get(n),s=a==null?void 0:a.find(o=>o.state.status==="pending");return!s||s===t}else return!0}runNext(t){var a;const n=af(t);if(typeof n=="string"){const s=(a=U(this,va).get(n))==null?void 0:a.find(o=>o!==t&&o.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ln.batch(()=>{U(this,ai).forEach(t=>{this.notify({type:"removed",mutation:t})}),U(this,ai).clear(),U(this,va).clear()})}getAll(){return Array.from(U(this,ai))}find(t){const n={exact:!0,...t};return this.getAll().find(a=>OS(n,a))}findAll(t={}){return this.getAll().filter(n=>OS(t,n))}notify(t){ln.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ln.batch(()=>Promise.all(t.map(n=>n.continue().catch(Xn))))}},ai=new WeakMap,va=new WeakMap,jc=new WeakMap,kj);function af(e){var t;return(t=e.options.scope)==null?void 0:t.id}var ii,es,kr,si,oi,Nf,ly,jj,jR=(jj=class extends Ws{constructor(n,a){super();Ne(this,oi);Ne(this,ii);Ne(this,es);Ne(this,kr);Ne(this,si);Se(this,ii,n),this.setOptions(a),this.bindMethods(),Ge(this,oi,Nf).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const a=this.options;this.options=U(this,ii).defaultMutationOptions(n),ic(this.options,a)||U(this,ii).getMutationCache().notify({type:"observerOptionsUpdated",mutation:U(this,kr),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&Qs(a.mutationKey)!==Qs(this.options.mutationKey)?this.reset():((s=U(this,kr))==null?void 0:s.state.status)==="pending"&&U(this,kr).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=U(this,kr))==null||n.removeObserver(this)}onMutationUpdate(n){Ge(this,oi,Nf).call(this),Ge(this,oi,ly).call(this,n)}getCurrentResult(){return U(this,es)}reset(){var n;(n=U(this,kr))==null||n.removeObserver(this),Se(this,kr,void 0),Ge(this,oi,Nf).call(this),Ge(this,oi,ly).call(this)}mutate(n,a){var s;return Se(this,si,a),(s=U(this,kr))==null||s.removeObserver(this),Se(this,kr,U(this,ii).getMutationCache().build(U(this,ii),this.options)),U(this,kr).addObserver(this),U(this,kr).execute(n)}},ii=new WeakMap,es=new WeakMap,kr=new WeakMap,si=new WeakMap,oi=new WeakSet,Nf=function(){var a;const n=((a=U(this,kr))==null?void 0:a.state)??Lj();Se(this,es,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},ly=function(n){ln.batch(()=>{var a,s,o,c,f,m,h,p;if(U(this,si)&&this.hasListeners()){const g=U(this,es).variables,x=U(this,es).context,w={client:U(this,ii),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(a=U(this,si)).onSuccess)==null||s.call(a,n.data,g,x,w)}catch(S){Promise.reject(S)}try{(c=(o=U(this,si)).onSettled)==null||c.call(o,n.data,null,g,x,w)}catch(S){Promise.reject(S)}}else if((n==null?void 0:n.type)==="error"){try{(m=(f=U(this,si)).onError)==null||m.call(f,n.error,g,x,w)}catch(S){Promise.reject(S)}try{(p=(h=U(this,si)).onSettled)==null||p.call(h,void 0,n.error,g,x,w)}catch(S){Promise.reject(S)}}}this.listeners.forEach(g=>{g(U(this,es))})})},jj);function FS(e,t){const n=new Set(t);return e.filter(a=>!n.has(a))}function ER(e,t,n){const a=e.slice(0);return a[t]=n,a}var ho,Ur,mo,po,ta,ts,Ec,Cc,Nc,_c,Gn,oy,uy,cy,dy,fy,Ej,CR=(Ej=class extends Ws{constructor(t,n,a){super();Ne(this,Gn);Ne(this,ho);Ne(this,Ur);Ne(this,mo);Ne(this,po);Ne(this,ta);Ne(this,ts);Ne(this,Ec);Ne(this,Cc);Ne(this,Nc);Ne(this,_c,[]);Se(this,ho,t),Se(this,po,a),Se(this,mo,[]),Se(this,ta,[]),Se(this,Ur,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&U(this,ta).forEach(t=>{t.subscribe(n=>{Ge(this,Gn,dy).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,U(this,ta).forEach(t=>{t.destroy()})}setQueries(t,n){Se(this,mo,t),Se(this,po,n),ln.batch(()=>{const a=U(this,ta),s=Ge(this,Gn,cy).call(this,U(this,mo));s.forEach(g=>g.observer.setOptions(g.defaultedQueryOptions));const o=s.map(g=>g.observer),c=o.map(g=>g.getCurrentResult()),f=a.length!==o.length,m=o.some((g,x)=>g!==a[x]),h=f||m,p=h?!0:c.some((g,x)=>{const w=U(this,Ur)[x];return!w||!ic(g,w)});!h&&!p||(h&&(Se(this,_c,s),Se(this,ta,o)),Se(this,Ur,c),this.hasListeners()&&(h&&(FS(a,o).forEach(g=>{g.destroy()}),FS(o,a).forEach(g=>{g.subscribe(x=>{Ge(this,Gn,dy).call(this,g,x)})})),Ge(this,Gn,fy).call(this)))})}getCurrentResult(){return U(this,Ur)}getQueries(){return U(this,ta).map(t=>t.getCurrentQuery())}getObservers(){return U(this,ta)}getOptimisticResult(t,n){const a=Ge(this,Gn,cy).call(this,t),s=a.map(c=>c.observer.getOptimisticResult(c.defaultedQueryOptions)),o=a.map(c=>c.defaultedQueryOptions.queryHash);return[s,c=>Ge(this,Gn,uy).call(this,c??s,n,o),()=>Ge(this,Gn,oy).call(this,s,a)]}},ho=new WeakMap,Ur=new WeakMap,mo=new WeakMap,po=new WeakMap,ta=new WeakMap,ts=new WeakMap,Ec=new WeakMap,Cc=new WeakMap,Nc=new WeakMap,_c=new WeakMap,Gn=new WeakSet,oy=function(t,n){return n.map((a,s)=>{const o=t[s];return a.defaultedQueryOptions.notifyOnChangeProps?o:a.observer.trackResult(o,c=>{n.forEach(f=>{f.observer.trackProp(c)})})})},uy=function(t,n,a){if(n){const s=U(this,Nc),o=a!==void 0&&s!==void 0&&(s.length!==a.length||a.some((c,f)=>c!==s[f]));return(!U(this,ts)||U(this,Ur)!==U(this,Cc)||o||n!==U(this,Ec))&&(Se(this,Ec,n),Se(this,Cc,U(this,Ur)),a!==void 0&&Se(this,Nc,a),Se(this,ts,uv(U(this,ts),n(t)))),U(this,ts)}return t},cy=function(t){const n=new Map;U(this,ta).forEach(s=>{const o=s.options.queryHash;if(!o)return;const c=n.get(o);c?c.push(s):n.set(o,[s])});const a=[];return t.forEach(s=>{var m;const o=U(this,ho).defaultQueryOptions(s),f=((m=n.get(o.queryHash))==null?void 0:m.shift())??new fv(U(this,ho),o);a.push({defaultedQueryOptions:o,observer:f})}),a},dy=function(t,n){const a=U(this,ta).indexOf(t);a!==-1&&(Se(this,Ur,ER(U(this,Ur),a,n)),Ge(this,Gn,fy).call(this))},fy=function(){var t;if(this.hasListeners()){const n=U(this,ts),a=Ge(this,Gn,oy).call(this,U(this,Ur),U(this,_c)),s=Ge(this,Gn,uy).call(this,a,(t=U(this,po))==null?void 0:t.combine);n!==s&&ln.batch(()=>{this.listeners.forEach(o=>{o(U(this,Ur))})})}},Ej),Aa,Cj,NR=(Cj=class extends Ws{constructor(t={}){super();Ne(this,Aa);this.config=t,Se(this,Aa,new Map)}build(t,n,a){const s=n.queryKey,o=n.queryHash??ov(s,n);let c=this.get(o);return c||(c=new vR({client:t,queryKey:s,queryHash:o,options:t.defaultQueryOptions(n),state:a,defaultOptions:t.getQueryDefaults(s)}),this.add(c)),c}add(t){U(this,Aa).has(t.queryHash)||(U(this,Aa).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=U(this,Aa).get(t.queryHash);n&&(t.destroy(),n===t&&U(this,Aa).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ln.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return U(this,Aa).get(t)}getAll(){return[...U(this,Aa).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(a=>RS(n,a))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(a=>RS(t,a)):n}notify(t){ln.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ln.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ln.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Aa=new WeakMap,Cj),sn,ns,rs,go,yo,as,vo,bo,Nj,_R=(Nj=class{constructor(e={}){Ne(this,sn);Ne(this,ns);Ne(this,rs);Ne(this,go);Ne(this,yo);Ne(this,as);Ne(this,vo);Ne(this,bo);Se(this,sn,e.queryCache||new NR),Se(this,ns,e.mutationCache||new kR),Se(this,rs,e.defaultOptions||{}),Se(this,go,new Map),Se(this,yo,new Map),Se(this,as,0)}mount(){rf(this,as)._++,U(this,as)===1&&(Se(this,vo,lv.subscribe(async e=>{e&&(await this.resumePausedMutations(),U(this,sn).onFocus())})),Se(this,bo,If.subscribe(async e=>{e&&(await this.resumePausedMutations(),U(this,sn).onOnline())})))}unmount(){var e,t;rf(this,as)._--,U(this,as)===0&&((e=U(this,vo))==null||e.call(this),Se(this,vo,void 0),(t=U(this,bo))==null||t.call(this),Se(this,bo,void 0))}isFetching(e){return U(this,sn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return U(this,ns).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=U(this,sn).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=U(this,sn).build(this,t),a=n.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(is(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return U(this,sn).findAll(e).map(({queryKey:t,state:n})=>{const a=n.data;return[t,a]})}setQueryData(e,t,n){const a=this.defaultQueryOptions({queryKey:e}),s=U(this,sn).get(a.queryHash),o=s==null?void 0:s.state.data,c=oR(t,o);if(c!==void 0)return U(this,sn).build(this,a).setData(c,{...n,manual:!0})}setQueriesData(e,t,n){return ln.batch(()=>U(this,sn).findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=U(this,sn).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=U(this,sn);ln.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=U(this,sn);return ln.batch(()=>(n.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},a=ln.batch(()=>U(this,sn).findAll(e).map(s=>s.cancel(n)));return Promise.all(a).then(Xn).catch(Xn)}invalidateQueries(e,t={}){return ln.batch(()=>(U(this,sn).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=ln.batch(()=>U(this,sn).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,n);return n.throwOnError||(o=o.catch(Xn)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(a).then(Xn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=U(this,sn).build(this,t);return n.isStaleByTime(is(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Xn).catch(Xn)}fetchInfiniteQuery(e){return e.behavior=US(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Xn).catch(Xn)}ensureInfiniteQueryData(e){return e.behavior=US(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return If.isOnline()?U(this,ns).resumePausedMutations():Promise.resolve()}getQueryCache(){return U(this,sn)}getMutationCache(){return U(this,ns)}getDefaultOptions(){return U(this,rs)}setDefaultOptions(e){Se(this,rs,e)}setQueryDefaults(e,t){U(this,go).set(Qs(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...U(this,go).values()],n={};return t.forEach(a=>{ac(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){U(this,yo).set(Qs(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...U(this,yo).values()],n={};return t.forEach(a=>{ac(e,a.mutationKey)&&Object.assign(n,a.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...U(this,rs).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ov(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===cv&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...U(this,rs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){U(this,sn).clear(),U(this,ns).clear()}},sn=new WeakMap,ns=new WeakMap,rs=new WeakMap,go=new WeakMap,yo=new WeakMap,as=new WeakMap,vo=new WeakMap,bo=new WeakMap,Nj),Pj=b.createContext(void 0),gn=e=>{const t=b.useContext(Pj);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},TR=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(Pj.Provider,{value:e,children:t})),Uj=b.createContext(!1),Bj=()=>b.useContext(Uj);Uj.Provider;function AR(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var RR=b.createContext(AR()),Fj=()=>b.useContext(RR),$j=(e,t,n)=>{const a=n!=null&&n.state.error&&typeof e.throwOnError=="function"?dv(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(t.isReset()||(e.retryOnMount=!1))},Hj=e=>{b.useEffect(()=>{e.clearReset()},[e])},qj=({result:e,errorResetBoundary:t,throwOnError:n,query:a,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&a&&(s&&e.data===void 0||dv(n,[e.error,a])),Zj=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))}},OR=(e,t)=>e.isLoading&&e.isFetching&&!t,hy=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,my=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function zR({queries:e,...t},n){const a=gn(),s=Bj(),o=Fj(),c=b.useMemo(()=>e.map(k=>{const j=a.defaultQueryOptions(k);return j._optimisticResults=s?"isRestoring":"optimistic",j}),[e,a,s]);c.forEach(k=>{Zj(k);const j=a.getQueryCache().get(k.queryHash);$j(k,o,j)}),Hj(o);const[f]=b.useState(()=>new CR(a,c,t)),[m,h,p]=f.getOptimisticResult(c,t.combine),g=!s&&t.subscribed!==!1;b.useSyncExternalStore(b.useCallback(k=>g?f.subscribe(ln.batchCalls(k)):Xn,[f,g]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),b.useEffect(()=>{f.setQueries(c,t)},[c,t,f]);const w=m.some((k,j)=>hy(c[j],k))?m.flatMap((k,j)=>{const C=c[j];if(C&&hy(C,k)){const N=new fv(a,C);return my(C,N,o)}return[]}):[];if(w.length>0)throw Promise.all(w);const S=m.find((k,j)=>{const C=c[j];return C&&qj({result:k,errorResetBoundary:o,throwOnError:C.throwOnError,query:a.getQueryCache().get(C.queryHash),suspense:C.suspense})});if(S!=null&&S.error)throw S.error;return h(p())}function MR(e,t,n){var x,w,S,k;const a=Bj(),s=Fj(),o=gn(),c=o.defaultQueryOptions(e);(w=(x=o.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||w.call(x,c);const f=o.getQueryCache().get(c.queryHash);c._optimisticResults=a?"isRestoring":"optimistic",Zj(c),$j(c,s,f),Hj(s);const m=!o.getQueryCache().get(c.queryHash),[h]=b.useState(()=>new t(o,c)),p=h.getOptimisticResult(c),g=!a&&e.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(j=>{const C=g?h.subscribe(ln.batchCalls(j)):Xn;return h.updateResult(),C},[h,g]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),b.useEffect(()=>{h.setOptions(c)},[c,h]),hy(c,p))throw my(c,h,s);if(qj({result:p,errorResetBoundary:s,throwOnError:c.throwOnError,query:f,suspense:c.suspense}))throw p.error;if((k=(S=o.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||k.call(S,c,p),c.experimental_prefetchInRender&&!sc.isServer()&&OR(p,a)){const j=m?my(c,h,s):f==null?void 0:f.promise;j==null||j.catch(Xn).finally(()=>{h.updateResult()})}return c.notifyOnChangeProps?p:h.trackResult(p)}function Ke(e,t){return MR(e,fv)}function ht(e,t){const n=gn(),[a]=b.useState(()=>new jR(n,e));b.useEffect(()=>{a.setOptions(e)},[a,e]);const s=b.useSyncExternalStore(b.useCallback(c=>a.subscribe(ln.batchCalls(c)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),o=b.useCallback((c,f)=>{a.mutate(c,f).catch(Xn)},[a]);if(s.error&&dv(a.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}/**
|
|
50
|
+
* react-router v7.13.1
|
|
51
|
+
*
|
|
52
|
+
* Copyright (c) Remix Software Inc.
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the MIT license found in the
|
|
55
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
56
|
+
*
|
|
57
|
+
* @license MIT
|
|
58
|
+
*/var $S="popstate";function HS(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function DR(e={}){function t(a,s){var h;let o=(h=s.state)==null?void 0:h.masked,{pathname:c,search:f,hash:m}=o||a.location;return py("",{pathname:c,search:f,hash:m},s.state&&s.state.usr||null,s.state&&s.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function n(a,s){return typeof s=="string"?s:lc(s)}return LR(t,n,null,e)}function Qt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ia(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function IR(){return Math.random().toString(36).substring(2,10)}function qS(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 py(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||IR(),unstable_mask:s}}function lc({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Co(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function LR(e,t,n,a={}){let{window:s=document.defaultView,v5Compat:o=!1}=a,c=s.history,f="POP",m=null,h=p();h==null&&(h=0,c.replaceState({...c.state,idx:h},""));function p(){return(c.state||{idx:null}).idx}function g(){f="POP";let j=p(),C=j==null?null:j-h;h=j,m&&m({action:f,location:k.location,delta:C})}function x(j,C){f="PUSH";let N=HS(j)?j:py(k.location,j,C);h=p()+1;let R=qS(N,h),M=k.createHref(N.unstable_mask||N);try{c.pushState(R,"",M)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;s.location.assign(M)}o&&m&&m({action:f,location:k.location,delta:1})}function w(j,C){f="REPLACE";let N=HS(j)?j:py(k.location,j,C);h=p();let R=qS(N,h),M=k.createHref(N.unstable_mask||N);c.replaceState(R,"",M),o&&m&&m({action:f,location:k.location,delta:0})}function S(j){return PR(j)}let k={get action(){return f},get location(){return e(s,c)},listen(j){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener($S,g),m=j,()=>{s.removeEventListener($S,g),m=null}},createHref(j){return t(s,j)},createURL:S,encodeLocation(j){let C=S(j);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:x,replace:w,go(j){return c.go(j)}};return k}function PR(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Qt(n,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:lc(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=n+a),new URL(a,n)}function Gj(e,t,n="/"){return UR(e,t,n,!1)}function UR(e,t,n,a){let s=typeof t=="string"?Co(t):t,o=ui(s.pathname||"/",n);if(o==null)return null;let c=Vj(e);BR(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let h=XR(o);f=KR(c[m],h,a)}return f}function Vj(e,t=[],n=[],a="",s=!1){let o=(c,f,m=s,h)=>{let p={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(a)&&m)return;Qt(p.relativePath.startsWith(a),`Absolute route path "${p.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(a.length)}let g=Oa([a,p.relativePath]),x=n.concat(p);c.children&&c.children.length>0&&(Qt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Vj(c.children,t,x,g,m)),!(c.path==null&&!c.index)&&t.push({path:g,score:VR(g,c.index),routesMeta:x})};return e.forEach((c,f)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))o(c,f);else for(let h of Qj(c.path))o(c,f,!0,h)}),t}function Qj(e){let t=e.split("/");if(t.length===0)return[];let[n,...a]=t,s=n.endsWith("?"),o=n.replace(/\?$/,"");if(a.length===0)return s?[o,""]:[o];let c=Qj(a.join("/")),f=[];return f.push(...c.map(m=>m===""?o:[o,m].join("/"))),s&&f.push(...c),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function BR(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:QR(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var FR=/^:[\w-]+$/,$R=3,HR=2,qR=1,ZR=10,GR=-2,ZS=e=>e==="*";function VR(e,t){let n=e.split("/"),a=n.length;return n.some(ZS)&&(a+=GR),t&&(a+=HR),n.filter(s=>!ZS(s)).reduce((s,o)=>s+(FR.test(o)?$R:o===""?qR:ZR),a)}function QR(e,t){return e.length===t.length&&e.slice(0,-1).every((a,s)=>a===t[s])?e[e.length-1]-t[t.length-1]:0}function KR(e,t,n=!1){let{routesMeta:a}=e,s={},o="/",c=[];for(let f=0;f<a.length;++f){let m=a[f],h=f===a.length-1,p=o==="/"?t:t.slice(o.length)||"/",g=Lf({path:m.relativePath,caseSensitive:m.caseSensitive,end:h},p),x=m.route;if(!g&&h&&n&&!a[a.length-1].route.index&&(g=Lf({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},p)),!g)return null;Object.assign(s,g.params),c.push({params:s,pathname:Oa([o,g.pathname]),pathnameBase:tO(Oa([o,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(o=Oa([o,g.pathnameBase]))}return c}function Lf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=YR(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let o=s[0],c=o.replace(/(.)\/+$/,"$1"),f=s.slice(1);return{params:a.reduce((h,{paramName:p,isOptional:g},x)=>{if(p==="*"){let S=f[x]||"";c=o.slice(0,o.length-S.length).replace(/(.)\/+$/,"$1")}const w=f[x];return g&&!w?h[p]=void 0:h[p]=(w||"").replace(/%2F/g,"/"),h},{}),pathname:o,pathnameBase:c,pattern:e}}function YR(e,t=!1,n=!0){ia(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,f,m,h,p)=>{if(a.push({paramName:f,isOptional:m!=null}),m){let g=p.charAt(h+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),a]}function XR(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ia(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function ui(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,a=e.charAt(n);return a&&a!=="/"?null:e.slice(n)||"/"}var WR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function JR(e,t="/"){let{pathname:n,search:a="",hash:s=""}=typeof e=="string"?Co(e):e,o;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?o=GS(n.substring(1),"/"):o=GS(n,t)):o=t,{pathname:o,search:nO(a),hash:rO(s)}}function GS(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 Jp(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 eO(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function mv(e){let t=eO(e);return t.map((n,a)=>a===t.length-1?n.pathname:n.pathnameBase)}function ah(e,t,n,a=!1){let s;typeof e=="string"?s=Co(e):(s={...e},Qt(!s.pathname||!s.pathname.includes("?"),Jp("?","pathname","search",s)),Qt(!s.pathname||!s.pathname.includes("#"),Jp("#","pathname","hash",s)),Qt(!s.search||!s.search.includes("#"),Jp("#","search","hash",s)));let o=e===""||s.pathname==="",c=o?"/":s.pathname,f;if(c==null)f=n;else{let g=t.length-1;if(!a&&c.startsWith("..")){let x=c.split("/");for(;x[0]==="..";)x.shift(),g-=1;s.pathname=x.join("/")}f=g>=0?t[g]:"/"}let m=JR(s,f),h=c&&c!=="/"&&c.endsWith("/"),p=(o||c===".")&&n.endsWith("/");return!m.pathname.endsWith("/")&&(h||p)&&(m.pathname+="/"),m}var Oa=e=>e.join("/").replace(/\/\/+/g,"/"),tO=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),nO=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,rO=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,aO=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 iO(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function sO(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Kj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Yj(e,t){let n=e;if(typeof n!="string"||!WR.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,s=!1;if(Kj)try{let o=new URL(window.location.href),c=n.startsWith("//")?new URL(o.protocol+n):new URL(n),f=ui(c.pathname,t);c.origin===o.origin&&f!=null?n=f+c.search+c.hash:s=!0}catch{ia(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Xj=["POST","PUT","PATCH","DELETE"];new Set(Xj);var lO=["GET",...Xj];new Set(lO);var No=b.createContext(null);No.displayName="DataRouter";var ih=b.createContext(null);ih.displayName="DataRouterState";var oO=b.createContext(!1),Wj=b.createContext({isTransitioning:!1});Wj.displayName="ViewTransition";var uO=b.createContext(new Map);uO.displayName="Fetchers";var cO=b.createContext(null);cO.displayName="Await";var $r=b.createContext(null);$r.displayName="Navigation";var Tc=b.createContext(null);Tc.displayName="Location";var la=b.createContext({outlet:null,matches:[],isDataRoute:!1});la.displayName="Route";var pv=b.createContext(null);pv.displayName="RouteError";var Jj="REACT_ROUTER_ERROR",dO="REDIRECT",fO="ROUTE_ERROR_RESPONSE";function hO(e){if(e.startsWith(`${Jj}:${dO}:{`))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 mO(e){if(e.startsWith(`${Jj}:${fO}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new aO(t.status,t.statusText,t.data)}catch{}}function pO(e,{relative:t}={}){Qt(_o(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=b.useContext($r),{hash:s,pathname:o,search:c}=Ac(e,{relative:t}),f=o;return n!=="/"&&(f=o==="/"?n:Oa([n,o])),a.createHref({pathname:f,search:c,hash:s})}function _o(){return b.useContext(Tc)!=null}function Cr(){return Qt(_o(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(Tc).location}var eE="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function tE(e){b.useContext($r).static||b.useLayoutEffect(e)}function An(){let{isDataRoute:e}=b.useContext(la);return e?AO():gO()}function gO(){Qt(_o(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(No),{basename:t,navigator:n}=b.useContext($r),{matches:a}=b.useContext(la),{pathname:s}=Cr(),o=JSON.stringify(mv(a)),c=b.useRef(!1);return tE(()=>{c.current=!0}),b.useCallback((m,h={})=>{if(ia(c.current,eE),!c.current)return;if(typeof m=="number"){n.go(m);return}let p=ah(m,JSON.parse(o),s,h.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:Oa([t,p.pathname])),(h.replace?n.replace:n.push)(p,h.state,h)},[t,n,o,s,e])}var yO=b.createContext(null);function vO(e){let t=b.useContext(la).outlet;return b.useMemo(()=>t&&b.createElement(yO.Provider,{value:e},t),[t,e])}function nE(){let{matches:e}=b.useContext(la),t=e[e.length-1];return t?t.params:{}}function Ac(e,{relative:t}={}){let{matches:n}=b.useContext(la),{pathname:a}=Cr(),s=JSON.stringify(mv(n));return b.useMemo(()=>ah(e,JSON.parse(s),a,t==="path"),[e,s,a,t])}function bO(e,t){return rE(e,t)}function rE(e,t,n){var j;Qt(_o(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=b.useContext($r),{matches:s}=b.useContext(la),o=s[s.length-1],c=o?o.params:{},f=o?o.pathname:"/",m=o?o.pathnameBase:"/",h=o&&o.route;{let C=h&&h.path||"";iE(f,!h||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
59
|
+
|
|
60
|
+
Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let p=Cr(),g;if(t){let C=typeof t=="string"?Co(t):t;Qt(m==="/"||((j=C.pathname)==null?void 0:j.startsWith(m)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${C.pathname}" was given in the \`location\` prop.`),g=C}else g=p;let x=g.pathname||"/",w=x;if(m!=="/"){let C=m.replace(/^\//,"").split("/");w="/"+x.replace(/^\//,"").split("/").slice(C.length).join("/")}let S=Gj(e,{pathname:w});ia(h||S!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),ia(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let k=jO(S&&S.map(C=>Object.assign({},C,{params:Object.assign({},c,C.params),pathname:Oa([m,a.encodeLocation?a.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?m:Oa([m,a.encodeLocation?a.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),s,n);return t&&k?b.createElement(Tc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},k):k}function xO(){let e=TO(),t=iO(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:o},"ErrorBoundary")," or"," ",b.createElement("code",{style:o},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),n?b.createElement("pre",{style:s},n):null,c)}var wO=b.createElement(xO,null),aE=class extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=mO(e.digest);n&&(e=n)}let t=e!==void 0?b.createElement(la.Provider,{value:this.props.routeContext},b.createElement(pv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(SO,{error:e},t):t}};aE.contextType=oO;var eg=new WeakMap;function SO({children:e,error:t}){let{basename:n}=b.useContext($r);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=hO(t.digest);if(a){let s=eg.get(t);if(s)throw s;let o=Yj(a.location,n);if(Kj&&!eg.get(t))if(o.isExternal||a.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:a.replace}));throw eg.set(t,c),c}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function kO({routeContext:e,match:t,children:n}){let a=b.useContext(No);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),b.createElement(la.Provider,{value:e},n)}function jO(e,t=[],n){let a=n==null?void 0:n.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let s=e,o=a==null?void 0:a.errors;if(o!=null){let p=s.findIndex(g=>g.route.id&&(o==null?void 0:o[g.route.id])!==void 0);Qt(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,p+1))}let c=!1,f=-1;if(n&&a){c=a.renderFallback;for(let p=0;p<s.length;p++){let g=s[p];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=p),g.route.id){let{loaderData:x,errors:w}=a,S=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!w||w[g.route.id]===void 0);if(g.route.lazy||S){n.isStatic&&(c=!0),f>=0?s=s.slice(0,f+1):s=[s[0]];break}}}}let m=n==null?void 0:n.onError,h=a&&m?(p,g)=>{var x,w;m(p,{location:a.location,params:((w=(x=a.matches)==null?void 0:x[0])==null?void 0:w.params)??{},unstable_pattern:sO(a.matches),errorInfo:g})}:void 0;return s.reduceRight((p,g,x)=>{let w,S=!1,k=null,j=null;a&&(w=o&&g.route.id?o[g.route.id]:void 0,k=g.route.errorElement||wO,c&&(f<0&&x===0?(iE("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,j=null):f===x&&(S=!0,j=g.route.hydrateFallbackElement||null)));let C=t.concat(s.slice(0,x+1)),N=()=>{let R;return w?R=k:S?R=j:g.route.Component?R=b.createElement(g.route.Component,null):g.route.element?R=g.route.element:R=p,b.createElement(kO,{match:g,routeContext:{outlet:p,matches:C,isDataRoute:a!=null},children:R})};return a&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?b.createElement(aE,{location:a.location,revalidation:a.revalidation,component:k,error:w,children:N(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:h}):N()},null)}function gv(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function EO(e){let t=b.useContext(No);return Qt(t,gv(e)),t}function CO(e){let t=b.useContext(ih);return Qt(t,gv(e)),t}function NO(e){let t=b.useContext(la);return Qt(t,gv(e)),t}function yv(e){let t=NO(e),n=t.matches[t.matches.length-1];return Qt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function _O(){return yv("useRouteId")}function TO(){var a;let e=b.useContext(pv),t=CO("useRouteError"),n=yv("useRouteError");return e!==void 0?e:(a=t.errors)==null?void 0:a[n]}function AO(){let{router:e}=EO("useNavigate"),t=yv("useNavigate"),n=b.useRef(!1);return tE(()=>{n.current=!0}),b.useCallback(async(s,o={})=>{ia(n.current,eE),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var VS={};function iE(e,t,n){!t&&!VS[e]&&(VS[e]=!0,ia(!1,n))}b.memo(RO);function RO({routes:e,future:t,state:n,isStatic:a,onError:s}){return rE(e,void 0,{state:n,isStatic:a,onError:s})}function or({to:e,replace:t,state:n,relative:a}){Qt(_o(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=b.useContext($r);ia(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=b.useContext(la),{pathname:c}=Cr(),f=An(),m=ah(e,mv(o),c,a==="path"),h=JSON.stringify(m);return b.useEffect(()=>{f(JSON.parse(h),{replace:t,state:n,relative:a})},[f,h,a,t,n]),null}function Pf(e){return vO(e.context)}function It(e){Qt(!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 OO({basename:e="/",children:t=null,location:n,navigationType:a="POP",navigator:s,static:o=!1,unstable_useTransitions:c}){Qt(!_o(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=b.useMemo(()=>({basename:f,navigator:s,static:o,unstable_useTransitions:c,future:{}}),[f,s,o,c]);typeof n=="string"&&(n=Co(n));let{pathname:h="/",search:p="",hash:g="",state:x=null,key:w="default",unstable_mask:S}=n,k=b.useMemo(()=>{let j=ui(h,f);return j==null?null:{location:{pathname:j,search:p,hash:g,state:x,key:w,unstable_mask:S},navigationType:a}},[f,h,p,g,x,w,a,S]);return ia(k!=null,`<Router basename="${f}"> is not able to match the URL "${h}${p}${g}" because it does not start with the basename, so the <Router> won't render anything.`),k==null?null:b.createElement($r.Provider,{value:m},b.createElement(Tc.Provider,{children:t,value:k}))}function zO({children:e,location:t}){return bO(gy(e),t)}function gy(e,t=[]){let n=[];return b.Children.forEach(e,(a,s)=>{if(!b.isValidElement(a))return;let o=[...t,s];if(a.type===b.Fragment){n.push.apply(n,gy(a.props.children,o));return}Qt(a.type===It,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Qt(!a.props.index||!a.props.children,"An index route cannot have child routes.");let c={id:a.props.id||o.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(c.children=gy(a.props.children,o)),n.push(c)}),n}var _f="get",Tf="application/x-www-form-urlencoded";function sh(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function MO(e){return sh(e)&&e.tagName.toLowerCase()==="button"}function DO(e){return sh(e)&&e.tagName.toLowerCase()==="form"}function IO(e){return sh(e)&&e.tagName.toLowerCase()==="input"}function LO(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function PO(e,t){return e.button===0&&(!t||t==="_self")&&!LO(e)}function yy(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 UO(e,t){let n=yy(e);return t&&t.forEach((a,s)=>{n.has(s)||t.getAll(s).forEach(o=>{n.append(s,o)})}),n}var sf=null;function BO(){if(sf===null)try{new FormData(document.createElement("form"),0),sf=!1}catch{sf=!0}return sf}var FO=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function tg(e){return e!=null&&!FO.has(e)?(ia(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Tf}"`),null):e}function $O(e,t){let n,a,s,o,c;if(DO(e)){let f=e.getAttribute("action");a=f?ui(f,t):null,n=e.getAttribute("method")||_f,s=tg(e.getAttribute("enctype"))||Tf,o=new FormData(e)}else if(MO(e)||IO(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||f.getAttribute("action");if(a=m?ui(m,t):null,n=e.getAttribute("formmethod")||f.getAttribute("method")||_f,s=tg(e.getAttribute("formenctype"))||tg(f.getAttribute("enctype"))||Tf,o=new FormData(f,e),!BO()){let{name:h,type:p,value:g}=e;if(p==="image"){let x=h?`${h}.`:"";o.append(`${x}x`,"0"),o.append(`${x}y`,"0")}else h&&o.append(h,g)}}else{if(sh(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=_f,a=null,s=Tf,c=e}return o&&s==="text/plain"&&(c=o,o=void 0),{action:a,method:n.toLowerCase(),encType:s,formData:o,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function vv(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function HO(e,t,n,a){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${a}`:s.pathname=`${s.pathname}.${a}`:s.pathname==="/"?s.pathname=`_root.${a}`:t&&ui(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${a}`,s}async function qO(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 ZO(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 GO(e,t,n){let a=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let c=await qO(o,n);return c.links?c.links():[]}return[]}));return YO(a.flat(1).filter(ZO).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function QS(e,t,n,a,s,o){let c=(m,h)=>n[h]?m.route.id!==n[h].route.id:!0,f=(m,h)=>{var p;return n[h].pathname!==m.pathname||((p=n[h].route.path)==null?void 0:p.endsWith("*"))&&n[h].params["*"]!==m.params["*"]};return o==="assets"?t.filter((m,h)=>c(m,h)||f(m,h)):o==="data"?t.filter((m,h)=>{var g;let p=a.routes[m.route.id];if(!p||!p.hasLoader)return!1;if(c(m,h)||f(m,h))return!0;if(m.route.shouldRevalidate){let x=m.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((g=n[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function VO(e,t,{includeHydrateFallback:n}={}){return QO(e.map(a=>{let s=t.routes[a.route.id];if(!s)return[];let o=[s.module];return s.clientActionModule&&(o=o.concat(s.clientActionModule)),s.clientLoaderModule&&(o=o.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(o=o.concat(s.hydrateFallbackModule)),s.imports&&(o=o.concat(s.imports)),o}).flat(1))}function QO(e){return[...new Set(e)]}function KO(e){let t={},n=Object.keys(e).sort();for(let a of n)t[a]=e[a];return t}function YO(e,t){let n=new Set;return new Set(t),e.reduce((a,s)=>{let o=JSON.stringify(KO(s));return n.has(o)||(n.add(o),a.push({key:o,link:s})),a},[])}function sE(){let e=b.useContext(No);return vv(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function XO(){let e=b.useContext(ih);return vv(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var bv=b.createContext(void 0);bv.displayName="FrameworkContext";function lE(){let e=b.useContext(bv);return vv(e,"You must render this element inside a <HydratedRouter> element"),e}function WO(e,t){let n=b.useContext(bv),[a,s]=b.useState(!1),[o,c]=b.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:h,onMouseLeave:p,onTouchStart:g}=t,x=b.useRef(null);b.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let k=C=>{C.forEach(N=>{c(N.isIntersecting)})},j=new IntersectionObserver(k,{threshold:.5});return x.current&&j.observe(x.current),()=>{j.disconnect()}}},[e]),b.useEffect(()=>{if(a){let k=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(k)}}},[a]);let w=()=>{s(!0)},S=()=>{s(!1),c(!1)};return n?e!=="intent"?[o,x,{}]:[o,x,{onFocus:Ru(f,w),onBlur:Ru(m,S),onMouseEnter:Ru(h,w),onMouseLeave:Ru(p,S),onTouchStart:Ru(g,w)}]:[!1,x,{}]}function Ru(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function JO({page:e,...t}){let{router:n}=sE(),a=b.useMemo(()=>Gj(n.routes,e,n.basename),[n.routes,e,n.basename]);return a?b.createElement(tz,{page:e,matches:a,...t}):null}function ez(e){let{manifest:t,routeModules:n}=lE(),[a,s]=b.useState([]);return b.useEffect(()=>{let o=!1;return GO(e,t,n).then(c=>{o||s(c)}),()=>{o=!0}},[e,t,n]),a}function tz({page:e,matches:t,...n}){let a=Cr(),{future:s,manifest:o,routeModules:c}=lE(),{basename:f}=sE(),{loaderData:m,matches:h}=XO(),p=b.useMemo(()=>QS(e,t,h,o,a,"data"),[e,t,h,o,a]),g=b.useMemo(()=>QS(e,t,h,o,a,"assets"),[e,t,h,o,a]),x=b.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let k=new Set,j=!1;if(t.forEach(N=>{var M;let R=o.routes[N.route.id];!R||!R.hasLoader||(!p.some(L=>L.route.id===N.route.id)&&N.route.id in m&&((M=c[N.route.id])!=null&&M.shouldRevalidate)||R.hasClientLoader?j=!0:k.add(N.route.id))}),k.size===0)return[];let C=HO(e,f,s.unstable_trailingSlashAwareDataRequests,"data");return j&&k.size>0&&C.searchParams.set("_routes",t.filter(N=>k.has(N.route.id)).map(N=>N.route.id).join(",")),[C.pathname+C.search]},[f,s.unstable_trailingSlashAwareDataRequests,m,a,o,p,t,e,c]),w=b.useMemo(()=>VO(g,o),[g,o]),S=ez(g);return b.createElement(b.Fragment,null,x.map(k=>b.createElement("link",{key:k,rel:"prefetch",as:"fetch",href:k,...n})),w.map(k=>b.createElement("link",{key:k,rel:"modulepreload",href:k,...n})),S.map(({key:k,link:j})=>b.createElement("link",{key:k,nonce:n.nonce,...j,crossOrigin:j.crossOrigin??n.crossOrigin})))}function nz(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var rz=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{rz&&(window.__reactRouterVersion="7.13.1")}catch{}function az({basename:e,children:t,unstable_useTransitions:n,window:a}){let s=b.useRef();s.current==null&&(s.current=DR({window:a,v5Compat:!0}));let o=s.current,[c,f]=b.useState({action:o.action,location:o.location}),m=b.useCallback(h=>{n===!1?f(h):b.startTransition(()=>f(h))},[n]);return b.useLayoutEffect(()=>o.listen(m),[o,m]),b.createElement(OO,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,unstable_useTransitions:n})}var oE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Rc=b.forwardRef(function({onClick:t,discover:n="render",prefetch:a="none",relative:s,reloadDocument:o,replace:c,unstable_mask:f,state:m,target:h,to:p,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:w,...S},k){let{basename:j,navigator:C,unstable_useTransitions:N}=b.useContext($r),R=typeof p=="string"&&oE.test(p),M=Yj(p,j);p=M.to;let L=pO(p,{relative:s}),O=Cr(),B=null;if(f){let W=ah(f,[],O.unstable_mask?O.unstable_mask.pathname:"/",!0);j!=="/"&&(W.pathname=W.pathname==="/"?j:Oa([j,W.pathname])),B=C.createHref(W)}let[I,Y,z]=WO(a,S),K=lz(p,{replace:c,unstable_mask:f,state:m,target:h,preventScrollReset:g,relative:s,viewTransition:x,unstable_defaultShouldRevalidate:w,unstable_useTransitions:N});function ie(W){t&&t(W),W.defaultPrevented||K(W)}let ve=!(M.isExternal||o),J=b.createElement("a",{...S,...z,href:(ve?B:void 0)||M.absoluteURL||L,onClick:ve?ie:t,ref:nz(k,Y),target:h,"data-discover":!R&&n==="render"?"true":void 0});return I&&!R?b.createElement(b.Fragment,null,J,b.createElement(JO,{page:L})):J});Rc.displayName="Link";var xv=b.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:s=!1,style:o,to:c,viewTransition:f,children:m,...h},p){let g=Ac(c,{relative:h.relative}),x=Cr(),w=b.useContext(ih),{navigator:S,basename:k}=b.useContext($r),j=w!=null&&fz(g)&&f===!0,C=S.encodeLocation?S.encodeLocation(g).pathname:g.pathname,N=x.pathname,R=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;n||(N=N.toLowerCase(),R=R?R.toLowerCase():null,C=C.toLowerCase()),R&&k&&(R=ui(R,k)||R);const M=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let L=N===C||!s&&N.startsWith(C)&&N.charAt(M)==="/",O=R!=null&&(R===C||!s&&R.startsWith(C)&&R.charAt(C.length)==="/"),B={isActive:L,isPending:O,isTransitioning:j},I=L?t:void 0,Y;typeof a=="function"?Y=a(B):Y=[a,L?"active":null,O?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let z=typeof o=="function"?o(B):o;return b.createElement(Rc,{...h,"aria-current":I,className:Y,ref:p,style:z,to:c,viewTransition:f},typeof m=="function"?m(B):m)});xv.displayName="NavLink";var iz=b.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:s,state:o,method:c=_f,action:f,onSubmit:m,relative:h,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:x,...w},S)=>{let{unstable_useTransitions:k}=b.useContext($r),j=cz(),C=dz(f,{relative:h}),N=c.toLowerCase()==="get"?"get":"post",R=typeof f=="string"&&oE.test(f),M=L=>{if(m&&m(L),L.defaultPrevented)return;L.preventDefault();let O=L.nativeEvent.submitter,B=(O==null?void 0:O.getAttribute("formmethod"))||c,I=()=>j(O||L.currentTarget,{fetcherKey:t,method:B,navigate:n,replace:s,state:o,relative:h,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:x});k&&n!==!1?b.startTransition(()=>I()):I()};return b.createElement("form",{ref:S,method:N,action:C,onSubmit:a?m:M,...w,"data-discover":!R&&e==="render"?"true":void 0})});iz.displayName="Form";function sz(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function uE(e){let t=b.useContext(No);return Qt(t,sz(e)),t}function lz(e,{target:t,replace:n,unstable_mask:a,state:s,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:h}={}){let p=An(),g=Cr(),x=Ac(e,{relative:c});return b.useCallback(w=>{if(PO(w,t)){w.preventDefault();let S=n!==void 0?n:lc(g)===lc(x),k=()=>p(e,{replace:S,unstable_mask:a,state:s,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});h?b.startTransition(()=>k()):k()}},[g,p,x,n,a,s,t,e,o,c,f,m,h])}function lh(e){ia(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=b.useRef(yy(e)),n=b.useRef(!1),a=Cr(),s=b.useMemo(()=>UO(a.search,n.current?null:t.current),[a.search]),o=An(),c=b.useCallback((f,m)=>{const h=yy(typeof f=="function"?f(new URLSearchParams(s)):f);n.current=!0,o("?"+h,m)},[o,s]);return[s,c]}var oz=0,uz=()=>`__${String(++oz)}__`;function cz(){let{router:e}=uE("useSubmit"),{basename:t}=b.useContext($r),n=_O(),a=e.fetch,s=e.navigate;return b.useCallback(async(o,c={})=>{let{action:f,method:m,encType:h,formData:p,body:g}=$O(o,t);if(c.navigate===!1){let x=c.fetcherKey||uz();await a(x,n,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:p,body:g,formMethod:c.method||m,formEncType:c.encType||h,flushSync:c.flushSync})}else await s(c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:p,body:g,formMethod:c.method||m,formEncType:c.encType||h,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[a,s,t,n])}function dz(e,{relative:t}={}){let{basename:n}=b.useContext($r),a=b.useContext(la);Qt(a,"useFormAction must be used inside a RouteContext");let[s]=a.matches.slice(-1),o={...Ac(e||".",{relative:t})},c=Cr();if(e==null){o.search=c.search;let f=new URLSearchParams(o.search),m=f.getAll("index");if(m.some(p=>p==="")){f.delete("index"),m.filter(g=>g).forEach(g=>f.append("index",g));let p=f.toString();o.search=p?`?${p}`:""}}return(!e||e===".")&&s.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Oa([n,o.pathname])),lc(o)}function fz(e,{relative:t}={}){let n=b.useContext(Wj);Qt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=uE("useViewTransitionState"),s=Ac(e,{relative:t});if(!n.isTransitioning)return!1;let o=ui(n.currentLocation.pathname,a)||n.currentLocation.pathname,c=ui(n.nextLocation.pathname,a)||n.nextLocation.pathname;return Lf(s.pathname,c)!=null||Lf(s.pathname,o)!=null}const hz="/api/v1";async function mz(e,t){const n=await fetch(`${hz}/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 cE="/api/v1",wv="first-tree-hub:tokens";let vy=null;function Ou(e){vy=e}function Rn(e){if(!vy)throw new Error(`withOrg("${e}") called before an organization is selected`);return`/orgs/${encodeURIComponent(vy)}${e}`}function by(e,t){return`/orgs/${encodeURIComponent(e)}${t}`}function oh(){const e=localStorage.getItem(wv);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function xy(e){localStorage.setItem(wv,JSON.stringify(e))}function dE(){localStorage.removeItem(wv)}class Js extends Error{constructor(t,n,a){super(n),this.status=t,this.issues=a,this.name="ApiError"}}let zu=null;async function pz(){const e=oh();return e!=null&&e.refreshToken?fE(e.refreshToken):null}async function fE(e){return zu||(zu=(async()=>{try{const t=await fetch(`${cE}/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 xy(a),a}catch{return null}finally{zu=null}})(),zu)}async function Mu(e,t){const{method:n="GET",body:a}=t??{},s=f=>{const m={};return f&&(m.Authorization=`Bearer ${f}`),a!==void 0&&(m["Content-Type"]="application/json"),fetch(`${cE}${e}`,{method:n,headers:m,body:a!==void 0?JSON.stringify(a):void 0})},o=oh();let c=await s(o==null?void 0:o.accessToken);if(c.status===401&&(o!=null&&o.refreshToken)){const f=await fE(o.refreshToken);f&&(c=await s(f.accessToken))}if(!c.ok){c.status===401&&(dE(),window.dispatchEvent(new CustomEvent("auth:logout")));const f=await c.text();let m,h;try{const p=JSON.parse(f);m=p.error??f,Array.isArray(p.details)&&(h=p.details.filter(g=>typeof g=="object"&&g!==null&&Array.isArray(g.path)))}catch{m=f}throw new Js(c.status,m,h)}if(c.status!==204)return await c.json()}const Ee={get:e=>Mu(e),post:(e,t)=>Mu(e,{method:"POST",body:t}),patch:(e,t)=>Mu(e,{method:"PATCH",body:t}),put:(e,t)=>Mu(e,{method:"PUT",body:t}),delete:e=>Mu(e,{method:"DELETE"})},Sv="onboarding:joinPath",gz="onboarding:draft",wy="onboarding:step1Confirmed";function hE(){return typeof window>"u"?!1:window.sessionStorage.getItem(wy)==="1"}function yz(e){typeof window>"u"||(e?window.sessionStorage.setItem(wy,"1"):window.sessionStorage.removeItem(wy))}const Sy="onboarding:agentUuid";function vz(){return typeof window>"u"?null:window.sessionStorage.getItem(Sy)}function bz(e){typeof window>"u"||(e?window.sessionStorage.setItem(Sy,e):window.sessionStorage.removeItem(Sy))}function mE(e){typeof window>"u"||window.sessionStorage.setItem(Sv,e)}function pE(){if(typeof window>"u")return null;const e=window.sessionStorage.getItem(Sv);return e==="solo"||e==="invite"?e:null}function xz(){typeof window>"u"||window.sessionStorage.removeItem(Sv)}function wz(e,t){return`${e??"unknown-org"}:${t??"unknown-member"}`}function kv(e){return`${gz}:${e}`}function Sz(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 kz(e){if(typeof window>"u")return null;const t=window.sessionStorage.getItem(kv(e));if(!t)return null;try{return Sz(JSON.parse(t))}catch{return null}}function jz(e,t){typeof window>"u"||window.sessionStorage.setItem(kv(e),JSON.stringify(t))}function Ez(e){typeof window>"u"||window.sessionStorage.removeItem(kv(e))}function Cz(){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 gE=b.createContext(null),ky="first-tree-hub:selectedOrganizationId";function Nz(){try{return localStorage.getItem(ky)}catch{return null}}function ng(e){try{e===null?localStorage.removeItem(ky):localStorage.setItem(ky,e)}catch{}}function _z({children:e}){const t=gn(),[n,a]=b.useState(()=>!!oh()),[s,o]=b.useState(null),[c,f]=b.useState([]),[m,h]=b.useState(()=>{const Y=Nz();return Ou(Y),Y}),[p,g]=b.useState(null),[x,w]=b.useState(null),[S,k]=b.useState(!1),j=b.useCallback(()=>{dE(),ng(null),Ou(null),t.clear(),Cz(),a(!1),o(null),f([]),h(null),g(null),w(null),k(!1)},[t]),C=b.useCallback(async()=>{var Y,z;try{const K=await Ee.get("/me");o(K.user??null);const ie=K.memberships??[];f(ie);const ve=((Y=K.onboarding)==null?void 0:Y.step)??null;g(ve),w(((z=K.onboarding)==null?void 0:z.dismissedAt)??null),ve==="completed"&&xz(),h(J=>{var ne;const W=J&&ie.some(ke=>ke.organizationId===J)?J:null;if(W)return Ou(W),W;const Z=K.defaultOrganizationId??((ne=ie[0])==null?void 0:ne.organizationId)??null;return ng(Z),Ou(Z),Z})}catch{}finally{k(!0)}},[]),N=b.useCallback(async(Y,z)=>{const K=await mz(Y,z);xy({accessToken:K.accessToken,refreshToken:K.refreshToken}),a(!0),await C()},[C]),R=b.useCallback(async Y=>{xy(Y),a(!0),await C()},[C]),M=b.useCallback(async Y=>{ng(Y),Ou(Y),t.clear(),h(Y),await C()},[C,t]),L=b.useRef(null);b.useEffect(()=>{L.current=x},[x]);const O=b.useCallback(async()=>{const Y=L.current;w(new Date().toISOString());try{const z=await Ee.patch("/me/onboarding",{dismissed:!0});z!=null&&z.dismissedAt&&w(z.dismissedAt)}catch{w(Y)}},[]),B=b.useCallback(async()=>{const Y=L.current;w(null);try{await Ee.patch("/me/onboarding",{dismissed:!1})}catch{w(Y)}},[]);b.useEffect(()=>{n&&!s&&C()},[n,s,C]),b.useEffect(()=>{const Y=()=>j();return window.addEventListener("auth:logout",Y),()=>window.removeEventListener("auth:logout",Y)},[j]);const I=b.useMemo(()=>c.length===0?null:c.find(z=>z.organizationId===m)??c[0]??null,[c,m]);return l.jsx(gE.Provider,{value:{isAuthenticated:n,meLoaded:S,user:s,memberships:c,currentMembership:I,organizationId:(I==null?void 0:I.organizationId)??null,memberId:(I==null?void 0:I.id)??null,role:(I==null?void 0:I.role)??null,agentId:(I==null?void 0:I.agentId)??null,onboardingStep:p,onboardingDismissedAt:x,dismissOnboarding:O,restoreOnboarding:B,login:N,adoptTokens:R,selectOrganization:M,refreshMe:C,logout:j},children:e})}function vt(){const e=b.useContext(gE);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const Tz="modulepreload",Az=function(e){return"/"+e},KS={},Rz=function(t,n,a){let s=Promise.resolve();if(n&&n.length>0){let c=function(h){return Promise.all(h.map(p=>Promise.resolve(p).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));s=c(n.map(h=>{if(h=Az(h),h in KS)return;KS[h]=!0;const p=h.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const x=document.createElement("link");if(x.rel=p?"stylesheet":Tz,p||(x.as="script"),x.crossOrigin="",x.href=h,m&&x.setAttribute("nonce",m),document.head.appendChild(x),p)return new Promise((w,S)=>{x.addEventListener("load",w),x.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return s.then(c=>{for(const f of c||[])f.status==="rejected"&&o(f.reason);return t().catch(o)})},Oz=b.lazy(()=>Rz(()=>import("./index-BPMrSv_A.js"),[]).then(e=>({default:e.LandingPage}))),YS=()=>l.jsx("div",{className:"landing-marketing min-h-screen bg-background"});function zz(){const{isAuthenticated:e,meLoaded:t}=vt(),n=Cr();return e?t?l.jsx(Pf,{}):l.jsx(YS,{}):n.pathname==="/"?l.jsx(b.Suspense,{fallback:l.jsx(YS,{}),children:l.jsx(Oz,{})}):l.jsx(or,{to:"/login",replace:!0,state:{from:n}})}/**
|
|
61
|
+
* @license lucide-react v0.577.0 - ISC
|
|
62
|
+
*
|
|
63
|
+
* This source code is licensed under the ISC license.
|
|
64
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
65
|
+
*/const yE=(...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 Mz=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 Dz=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 XS=e=>{const t=Dz(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 Iz={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 Lz=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 Pz=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:s="",children:o,iconNode:c,...f},m)=>b.createElement("svg",{ref:m,...Iz,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:yE("lucide",s),...!o&&!Lz(f)&&{"aria-hidden":"true"},...f},[...c.map(([h,p])=>b.createElement(h,p)),...Array.isArray(o)?o:[o]]));/**
|
|
96
|
+
* @license lucide-react v0.577.0 - ISC
|
|
97
|
+
*
|
|
98
|
+
* This source code is licensed under the ISC license.
|
|
99
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
+
*/const et=(e,t)=>{const n=b.forwardRef(({className:a,...s},o)=>b.createElement(Pz,{ref:o,iconNode:t,className:yE(`lucide-${Mz(XS(e))}`,`lucide-${e}`,a),...s}));return n.displayName=XS(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 Uz=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],jv=et("arrow-left",Uz);/**
|
|
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 Bz=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],vE=et("arrow-right",Bz);/**
|
|
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 Fz=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],bE=et("arrow-up",Fz);/**
|
|
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 $z=[["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"}]],Hz=et("at-sign",$z);/**
|
|
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 qz=[["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"}]],Zz=et("bell",qz);/**
|
|
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 Gz=[["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"}]],xE=et("bot",Gz);/**
|
|
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 Vz=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],Qz=et("building-2",Vz);/**
|
|
136
|
+
* @license lucide-react v0.577.0 - ISC
|
|
137
|
+
*
|
|
138
|
+
* This source code is licensed under the ISC license.
|
|
139
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
140
|
+
*/const Kz=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],cr=et("check",Kz);/**
|
|
141
|
+
* @license lucide-react v0.577.0 - ISC
|
|
142
|
+
*
|
|
143
|
+
* This source code is licensed under the ISC license.
|
|
144
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
145
|
+
*/const Yz=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ev=et("chevron-down",Yz);/**
|
|
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 Xz=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],wE=et("chevron-right",Xz);/**
|
|
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 Wz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Jz=et("circle-check",Wz);/**
|
|
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 eM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]],tM=et("circle-pause",eM);/**
|
|
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 nM=[["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"}]],Cv=et("copy",nM);/**
|
|
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 rM=[["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"}]],aM=et("ellipsis",rM);/**
|
|
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 iM=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Nv=et("external-link",iM);/**
|
|
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 sM=[["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"}]],lM=et("eye-off",sM);/**
|
|
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 oM=[["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"}]],SE=et("eye",oM);/**
|
|
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 uM=[["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"}]],cM=et("folder-tree",uM);/**
|
|
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 dM=[["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"}]],kE=et("github",dM);/**
|
|
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 fM=[["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"}]],hM=et("layout-dashboard",fM);/**
|
|
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 mM=[["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"}]],jy=et("link-2",mM);/**
|
|
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 pM=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],jE=et("loader-circle",pM);/**
|
|
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 gM=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],uh=et("lock",gM);/**
|
|
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 yM=[["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"}]],vM=et("log-out",yM);/**
|
|
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 bM=[["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"}]],_v=et("message-square",bM);/**
|
|
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 xM=[["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"}]],wM=et("moon",xM);/**
|
|
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 SM=[["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"}]],kM=et("paperclip",SM);/**
|
|
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 jM=[["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"}]],Tv=et("pencil",jM);/**
|
|
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 EM=[["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"}]],EE=et("play",EM);/**
|
|
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 CM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],xa=et("plus",CM);/**
|
|
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 NM=[["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"}]],_M=et("refresh-cw",NM);/**
|
|
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 TM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ch=et("search",TM);/**
|
|
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 AM=[["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"}]],RM=et("sun",AM);/**
|
|
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 OM=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Uf=et("trash-2",OM);/**
|
|
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 zM=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],To=et("triangle-alert",zM);/**
|
|
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 MM=[["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"}]],DM=et("undo-2",MM);/**
|
|
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 IM=[["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"}]],CE=et("user-plus",IM);/**
|
|
286
|
+
* @license lucide-react v0.577.0 - ISC
|
|
287
|
+
*
|
|
288
|
+
* This source code is licensed under the ISC license.
|
|
289
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
290
|
+
*/const LM=[["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"}]],NE=et("user",LM);/**
|
|
291
|
+
* @license lucide-react v0.577.0 - ISC
|
|
292
|
+
*
|
|
293
|
+
* This source code is licensed under the ISC license.
|
|
294
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
295
|
+
*/const PM=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],UM=et("users",PM);/**
|
|
296
|
+
* @license lucide-react v0.577.0 - ISC
|
|
297
|
+
*
|
|
298
|
+
* This source code is licensed under the ISC license.
|
|
299
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
300
|
+
*/const BM=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],os=et("x",BM);/**
|
|
301
|
+
* @license lucide-react v0.577.0 - ISC
|
|
302
|
+
*
|
|
303
|
+
* This source code is licensed under the ISC license.
|
|
304
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
305
|
+
*/const FM=[["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"}]],$M=et("zap",FM);function _E(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=_E(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function TE(){for(var e,t,n=0,a="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=_E(e))&&(a&&(a+=" "),a+=t);return a}const HM=(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},qM=(e,t)=>({classGroupId:e,validator:t}),AE=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Bf="-",WS=[],ZM="arbitrary..",GM=e=>{const t=QM(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return VM(c);const f=c.split(Bf),m=f[0]===""&&f.length>1?1:0;return RE(f,m,t)},getConflictingClassGroupIds:(c,f)=>{if(f){const m=a[c],h=n[c];return m?h?HM(h,m):m:h||WS}return n[c]||WS}}},RE=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const h=RE(e,t+1,o);if(h)return h}const c=n.validators;if(c===null)return;const f=t===0?e.join(Bf):e.slice(t).join(Bf),m=c.length;for(let h=0;h<m;h++){const p=c[h];if(p.validator(f))return p.classGroupId}},VM=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),a=t.slice(0,n);return a?ZM+a:void 0})(),QM=e=>{const{theme:t,classGroups:n}=e;return KM(n,t)},KM=(e,t)=>{const n=AE();for(const a in e){const s=e[a];Av(s,n,a,t)}return n},Av=(e,t,n,a)=>{const s=e.length;for(let o=0;o<s;o++){const c=e[o];YM(c,t,n,a)}},YM=(e,t,n,a)=>{if(typeof e=="string"){XM(e,t,n);return}if(typeof e=="function"){WM(e,t,n,a);return}JM(e,t,n,a)},XM=(e,t,n)=>{const a=e===""?t:OE(t,e);a.classGroupId=n},WM=(e,t,n,a)=>{if(eD(e)){Av(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(qM(n,e))},JM=(e,t,n,a)=>{const s=Object.entries(e),o=s.length;for(let c=0;c<o;c++){const[f,m]=s[c];Av(m,OE(t,f),n,a)}},OE=(e,t)=>{let n=e;const a=t.split(Bf),s=a.length;for(let o=0;o<s;o++){const c=a[o];let f=n.nextPart.get(c);f||(f=AE(),n.nextPart.set(c,f)),n=f}return n},eD=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,tD=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),a=Object.create(null);const s=(o,c)=>{n[o]=c,t++,t>e&&(t=0,a=n,n=Object.create(null))};return{get(o){let c=n[o];if(c!==void 0)return c;if((c=a[o])!==void 0)return s(o,c),c},set(o,c){o in n?n[o]=c:s(o,c)}}},Ey="!",JS=":",nD=[],e1=(e,t,n,a,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:s}),rD=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=s=>{const o=[];let c=0,f=0,m=0,h;const p=s.length;for(let k=0;k<p;k++){const j=s[k];if(c===0&&f===0){if(j===JS){o.push(s.slice(m,k)),m=k+1;continue}if(j==="/"){h=k;continue}}j==="["?c++:j==="]"?c--:j==="("?f++:j===")"&&f--}const g=o.length===0?s:s.slice(m);let x=g,w=!1;g.endsWith(Ey)?(x=g.slice(0,-1),w=!0):g.startsWith(Ey)&&(x=g.slice(1),w=!0);const S=h&&h>m?h-m:void 0;return e1(o,w,x,S)};if(t){const s=t+JS,o=a;a=c=>c.startsWith(s)?o(c.slice(s.length)):e1(nD,!1,c,void 0,!0)}if(n){const s=a;a=o=>n({className:o,parseClassName:s})}return a},aD=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,a)=>{t.set(n,1e6+a)}),n=>{const a=[];let s=[];for(let o=0;o<n.length;o++){const c=n[o],f=c[0]==="[",m=t.has(c);f||m?(s.length>0&&(s.sort(),a.push(...s),s=[]),a.push(c)):s.push(c)}return s.length>0&&(s.sort(),a.push(...s)),a}},iD=e=>({cache:tD(e.cacheSize),parseClassName:rD(e),sortModifiers:aD(e),...GM(e)}),sD=/\s+/,lD=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:s,sortModifiers:o}=t,c=[],f=e.trim().split(sD);let m="";for(let h=f.length-1;h>=0;h-=1){const p=f[h],{isExternal:g,modifiers:x,hasImportantModifier:w,baseClassName:S,maybePostfixModifierPosition:k}=n(p);if(g){m=p+(m.length>0?" "+m:m);continue}let j=!!k,C=a(j?S.substring(0,k):S);if(!C){if(!j){m=p+(m.length>0?" "+m:m);continue}if(C=a(S),!C){m=p+(m.length>0?" "+m:m);continue}j=!1}const N=x.length===0?"":x.length===1?x[0]:o(x).join(":"),R=w?N+Ey:N,M=R+C;if(c.indexOf(M)>-1)continue;c.push(M);const L=s(C,j);for(let O=0;O<L.length;++O){const B=L[O];c.push(R+B)}m=p+(m.length>0?" "+m:m)}return m},oD=(...e)=>{let t=0,n,a,s="";for(;t<e.length;)(n=e[t++])&&(a=zE(n))&&(s&&(s+=" "),s+=a);return s},zE=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=zE(e[a]))&&(n&&(n+=" "),n+=t);return n},uD=(e,...t)=>{let n,a,s,o;const c=m=>{const h=t.reduce((p,g)=>g(p),e());return n=iD(h),a=n.cache.get,s=n.cache.set,o=f,f(m)},f=m=>{const h=a(m);if(h)return h;const p=lD(m,n);return s(m,p),p};return o=c,(...m)=>o(oD(...m))},cD=[],Tn=e=>{const t=n=>n[e]||cD;return t.isThemeGetter=!0,t},ME=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,DE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,dD=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,fD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,hD=/\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$/,mD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,pD=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,gD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$i=e=>dD.test(e),rt=e=>!!e&&!Number.isNaN(Number(e)),Hi=e=>!!e&&Number.isInteger(Number(e)),rg=e=>e.endsWith("%")&&rt(e.slice(0,-1)),ti=e=>fD.test(e),IE=()=>!0,yD=e=>hD.test(e)&&!mD.test(e),Rv=()=>!1,vD=e=>pD.test(e),bD=e=>gD.test(e),xD=e=>!Re(e)&&!Oe(e),wD=e=>hs(e,UE,Rv),Re=e=>ME.test(e),Ms=e=>hs(e,BE,yD),t1=e=>hs(e,TD,rt),SD=e=>hs(e,$E,IE),kD=e=>hs(e,FE,Rv),n1=e=>hs(e,LE,Rv),jD=e=>hs(e,PE,bD),lf=e=>hs(e,HE,vD),Oe=e=>DE.test(e),Du=e=>el(e,BE),ED=e=>el(e,FE),r1=e=>el(e,LE),CD=e=>el(e,UE),ND=e=>el(e,PE),of=e=>el(e,HE,!0),_D=e=>el(e,$E,!0),hs=(e,t,n)=>{const a=ME.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},el=(e,t,n=!1)=>{const a=DE.exec(e);return a?a[1]?t(a[1]):n:!1},LE=e=>e==="position"||e==="percentage",PE=e=>e==="image"||e==="url",UE=e=>e==="length"||e==="size"||e==="bg-size",BE=e=>e==="length",TD=e=>e==="number",FE=e=>e==="family-name",$E=e=>e==="number"||e==="weight",HE=e=>e==="shadow",AD=()=>{const e=Tn("color"),t=Tn("font"),n=Tn("text"),a=Tn("font-weight"),s=Tn("tracking"),o=Tn("leading"),c=Tn("breakpoint"),f=Tn("container"),m=Tn("spacing"),h=Tn("radius"),p=Tn("shadow"),g=Tn("inset-shadow"),x=Tn("text-shadow"),w=Tn("drop-shadow"),S=Tn("blur"),k=Tn("perspective"),j=Tn("aspect"),C=Tn("ease"),N=Tn("animate"),R=()=>["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(),Oe,Re],O=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto","contain","none"],I=()=>[Oe,Re,m],Y=()=>[$i,"full","auto",...I()],z=()=>[Hi,"none","subgrid",Oe,Re],K=()=>["auto",{span:["full",Hi,Oe,Re]},Hi,Oe,Re],ie=()=>[Hi,"auto",Oe,Re],ve=()=>["auto","min","max","fr",Oe,Re],J=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],Z=()=>["auto",...I()],ne=()=>[$i,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],ke=()=>[$i,"screen","full","dvw","lvw","svw","min","max","fit",...I()],Ae=()=>[$i,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],D=()=>[e,Oe,Re],P=()=>[...M(),r1,n1,{position:[Oe,Re]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],T=()=>["auto","cover","contain",CD,wD,{size:[Oe,Re]}],G=()=>[rg,Du,Ms],q=()=>["","none","full",h,Oe,Re],ae=()=>["",rt,Du,Ms],be=()=>["solid","dashed","dotted","double"],we=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],me=()=>[rt,rg,r1,n1],Me=()=>["","none",S,Oe,Re],Ie=()=>["none",rt,Oe,Re],St=()=>["none",rt,Oe,Re],tt=()=>[rt,Oe,Re],it=()=>[$i,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ti],breakpoint:[ti],color:[IE],container:[ti],"drop-shadow":[ti],ease:["in","out","in-out"],font:[xD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ti],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ti],shadow:[ti],spacing:["px",rt],text:[ti],"text-shadow":[ti],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",$i,Re,Oe,j]}],container:["container"],columns:[{columns:[rt,Re,Oe,f]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Y()}],"inset-x":[{"inset-x":Y()}],"inset-y":[{"inset-y":Y()}],start:[{"inset-s":Y(),start:Y()}],end:[{"inset-e":Y(),end:Y()}],"inset-bs":[{"inset-bs":Y()}],"inset-be":[{"inset-be":Y()}],top:[{top:Y()}],right:[{right:Y()}],bottom:[{bottom:Y()}],left:[{left:Y()}],visibility:["visible","invisible","collapse"],z:[{z:[Hi,"auto",Oe,Re]}],basis:[{basis:[$i,"full","auto",f,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[rt,$i,"auto","initial","none",Re]}],grow:[{grow:["",rt,Oe,Re]}],shrink:[{shrink:["",rt,Oe,Re]}],order:[{order:[Hi,"first","last","none",Oe,Re]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:K()}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:K()}],"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":ve()}],"auto-rows":[{"auto-rows":ve()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...J(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...J()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":J()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pbs:[{pbs:I()}],pbe:[{pbe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:Z()}],mx:[{mx:Z()}],my:[{my:Z()}],ms:[{ms:Z()}],me:[{me:Z()}],mbs:[{mbs:Z()}],mbe:[{mbe:Z()}],mt:[{mt:Z()}],mr:[{mr:Z()}],mb:[{mb:Z()}],ml:[{ml:Z()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:ne()}],"inline-size":[{inline:["auto",...ke()]}],"min-inline-size":[{"min-inline":["auto",...ke()]}],"max-inline-size":[{"max-inline":["none",...ke()]}],"block-size":[{block:["auto",...Ae()]}],"min-block-size":[{"min-block":["auto",...Ae()]}],"max-block-size":[{"max-block":["none",...Ae()]}],w:[{w:[f,"screen",...ne()]}],"min-w":[{"min-w":[f,"screen","none",...ne()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[c]},...ne()]}],h:[{h:["screen","lh",...ne()]}],"min-h":[{"min-h":["screen","lh","none",...ne()]}],"max-h":[{"max-h":["screen","lh",...ne()]}],"font-size":[{text:["base",n,Du,Ms]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,_D,SD]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",rg,Re]}],"font-family":[{font:[ED,kD,t]}],"font-features":[{"font-features":[Re]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Oe,Re]}],"line-clamp":[{"line-clamp":[rt,"none",Oe,t1]}],leading:[{leading:[o,...I()]}],"list-image":[{"list-image":["none",Oe,Re]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Oe,Re]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...be(),"wavy"]}],"text-decoration-thickness":[{decoration:[rt,"from-font","auto",Oe,Ms]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[rt,"auto",Oe,Re]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Oe,Re]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Oe,Re]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Hi,Oe,Re],radial:["",Oe,Re],conic:[Hi,Oe,Re]},ND,jD]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:q()}],"rounded-s":[{"rounded-s":q()}],"rounded-e":[{"rounded-e":q()}],"rounded-t":[{"rounded-t":q()}],"rounded-r":[{"rounded-r":q()}],"rounded-b":[{"rounded-b":q()}],"rounded-l":[{"rounded-l":q()}],"rounded-ss":[{"rounded-ss":q()}],"rounded-se":[{"rounded-se":q()}],"rounded-ee":[{"rounded-ee":q()}],"rounded-es":[{"rounded-es":q()}],"rounded-tl":[{"rounded-tl":q()}],"rounded-tr":[{"rounded-tr":q()}],"rounded-br":[{"rounded-br":q()}],"rounded-bl":[{"rounded-bl":q()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-bs":[{"border-bs":ae()}],"border-w-be":[{"border-be":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...be(),"hidden","none"]}],"divide-style":[{divide:[...be(),"hidden","none"]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-bs":[{"border-bs":D()}],"border-color-be":[{"border-be":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...be(),"none","hidden"]}],"outline-offset":[{"outline-offset":[rt,Oe,Re]}],"outline-w":[{outline:["",rt,Du,Ms]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",p,of,lf]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",g,of,lf]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[rt,Ms]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",x,of,lf]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[rt,Oe,Re]}],"mix-blend":[{"mix-blend":[...we(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":we()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[rt]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"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":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"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":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"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":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"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":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"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":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"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":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[Oe,Re]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"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":[rt]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Oe,Re]}],filter:[{filter:["","none",Oe,Re]}],blur:[{blur:Me()}],brightness:[{brightness:[rt,Oe,Re]}],contrast:[{contrast:[rt,Oe,Re]}],"drop-shadow":[{"drop-shadow":["","none",w,of,lf]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",rt,Oe,Re]}],"hue-rotate":[{"hue-rotate":[rt,Oe,Re]}],invert:[{invert:["",rt,Oe,Re]}],saturate:[{saturate:[rt,Oe,Re]}],sepia:[{sepia:["",rt,Oe,Re]}],"backdrop-filter":[{"backdrop-filter":["","none",Oe,Re]}],"backdrop-blur":[{"backdrop-blur":Me()}],"backdrop-brightness":[{"backdrop-brightness":[rt,Oe,Re]}],"backdrop-contrast":[{"backdrop-contrast":[rt,Oe,Re]}],"backdrop-grayscale":[{"backdrop-grayscale":["",rt,Oe,Re]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[rt,Oe,Re]}],"backdrop-invert":[{"backdrop-invert":["",rt,Oe,Re]}],"backdrop-opacity":[{"backdrop-opacity":[rt,Oe,Re]}],"backdrop-saturate":[{"backdrop-saturate":[rt,Oe,Re]}],"backdrop-sepia":[{"backdrop-sepia":["",rt,Oe,Re]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Oe,Re]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[rt,"initial",Oe,Re]}],ease:[{ease:["linear","initial",C,Oe,Re]}],delay:[{delay:[rt,Oe,Re]}],animate:[{animate:["none",N,Oe,Re]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,Oe,Re]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Ie()}],"rotate-x":[{"rotate-x":Ie()}],"rotate-y":[{"rotate-y":Ie()}],"rotate-z":[{"rotate-z":Ie()}],scale:[{scale:St()}],"scale-x":[{"scale-x":St()}],"scale-y":[{"scale-y":St()}],"scale-z":[{"scale-z":St()}],"scale-3d":["scale-3d"],skew:[{skew:tt()}],"skew-x":[{"skew-x":tt()}],"skew-y":[{"skew-y":tt()}],transform:[{transform:[Oe,Re,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:it()}],"translate-x":[{"translate-x":it()}],"translate-y":[{"translate-y":it()}],"translate-z":[{"translate-z":it()}],"translate-none":["translate-none"],accent:[{accent:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Oe,Re]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mbs":[{"scroll-mbs":I()}],"scroll-mbe":[{"scroll-mbe":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pbs":[{"scroll-pbs":I()}],"scroll-pbe":[{"scroll-pbe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Oe,Re]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[rt,Du,Ms,t1]}],stroke:[{stroke:["none",...D()]}],"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"]}},RD=uD(AD);function ze(...e){return RD(TE(e))}function oc(e){return e?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(e)):"—"}function qE(e){return e?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(e)):"—"}function OD(e){return Ee.delete(`/clients/${encodeURIComponent(e)}`)}function Oc(){return Ee.get(Rn("/activity"))}function ci(){return Ee.get("/me/clients")}function dh(e){return Ee.get(`/clients/${e}`)}function zD(e){return Ee.post(`/clients/${e}/disconnect`)}function MD(){return Ee.post("/me/connect-tokens")}const a1=e=>["agent-sessions",e];function DD(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 ID(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 LD(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.text!="string"?null:{text:t.text}}function ZE(e,t){const n=new URLSearchParams;t!=null&&t.state&&n.set("state",t.state),t!=null&&t.runtimeState&&n.set("runtimeState",t.runtimeState);const a=n.toString();return Ee.get(`/agents/${e}/sessions${a?`?${a}`:""}`)}function PD(e,t,n){const a=new URLSearchParams;a.set("limit",String(n.limit)),(n==null?void 0:n.cursor)!==void 0&&a.set("cursor",String(n.cursor)),n!=null&&n.direction&&a.set("direction",n.direction);const s=a.toString();return Ee.get(`/agents/${e}/sessions/${t}/events${s?`?${s}`:""}`)}var i1=1,UD=.9,BD=.8,FD=.17,ag=.1,ig=.999,$D=.9999,HD=.99,qD=/[\\\/_+.#"@\[\(\{&]/,ZD=/[\\\/_+.#"@\[\(\{&]/g,GD=/[\s-]/,GE=/[\s-]/g;function Cy(e,t,n,a,s,o,c){if(o===t.length)return s===e.length?i1:HD;var f=`${s},${o}`;if(c[f]!==void 0)return c[f];for(var m=a.charAt(o),h=n.indexOf(m,s),p=0,g,x,w,S;h>=0;)g=Cy(e,t,n,a,h+1,o+1,c),g>p&&(h===s?g*=i1:qD.test(e.charAt(h-1))?(g*=BD,w=e.slice(s,h-1).match(ZD),w&&s>0&&(g*=Math.pow(ig,w.length))):GD.test(e.charAt(h-1))?(g*=UD,S=e.slice(s,h-1).match(GE),S&&s>0&&(g*=Math.pow(ig,S.length))):(g*=FD,s>0&&(g*=Math.pow(ig,h-s))),e.charAt(h)!==t.charAt(o)&&(g*=$D)),(g<ag&&n.charAt(h-1)===a.charAt(o+1)||a.charAt(o+1)===a.charAt(o)&&n.charAt(h-1)!==a.charAt(o))&&(x=Cy(e,t,n,a,h+1,o+2,c),x*ag>g&&(g=x*ag)),g>p&&(p=g),h=n.indexOf(m,h+1);return c[f]=p,p}function s1(e){return e.toLowerCase().replace(GE," ")}function VD(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Cy(e,t,s1(e),s1(t),0,0,{})}function ss(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function l1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function us(...e){return t=>{let n=!1;const a=e.map(s=>{const o=l1(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<a.length;s++){const o=a[s];typeof o=="function"?o():l1(e[s],null)}}}}function tl(...e){return b.useCallback(us(...e),e)}function QD(e,t){const n=b.createContext(t),a=o=>{const{children:c,...f}=o,m=b.useMemo(()=>f,Object.values(f));return l.jsx(n.Provider,{value:m,children:c})};a.displayName=e+"Provider";function s(o){const c=b.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[a,s]}function KD(e,t=[]){let n=[];function a(o,c){const f=b.createContext(c),m=n.length;n=[...n,c];const h=g=>{var C;const{scope:x,children:w,...S}=g,k=((C=x==null?void 0:x[e])==null?void 0:C[m])||f,j=b.useMemo(()=>S,Object.values(S));return l.jsx(k.Provider,{value:j,children:w})};h.displayName=o+"Provider";function p(g,x){var k;const w=((k=x==null?void 0:x[e])==null?void 0:k[m])||f,S=b.useContext(w);if(S)return S;if(c!==void 0)return c;throw new Error(`\`${g}\` must be used within \`${o}\``)}return[h,p]}const s=()=>{const o=n.map(c=>b.createContext(c));return function(f){const m=(f==null?void 0:f[e])||o;return b.useMemo(()=>({[`__scope${e}`]:{...f,[e]:m}}),[f,m])}};return s.scopeName=e,[a,YD(s,...t)]}function YD(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const c=a.reduce((f,{useScope:m,scopeName:h})=>{const g=m(o)[`__scope${h}`];return{...f,...g}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var uc=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},XD=sv[" useId ".trim().toString()]||(()=>{}),WD=0;function li(e){const[t,n]=b.useState(XD());return uc(()=>{n(a=>a??String(WD++))},[e]),t?`radix-${t}`:""}var JD=sv[" useInsertionEffect ".trim().toString()]||uc;function e3({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[s,o,c]=t3({defaultProp:t,onChange:n}),f=e!==void 0,m=f?e:s;{const p=b.useRef(e!==void 0);b.useEffect(()=>{const g=p.current;g!==f&&console.warn(`${a} is changing from ${g?"controlled":"uncontrolled"} to ${f?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=f},[f,a])}const h=b.useCallback(p=>{var g;if(f){const x=n3(p)?p(e):p;x!==e&&((g=c.current)==null||g.call(c,x))}else o(p)},[f,e,o,c]);return[m,h]}function t3({defaultProp:e,onChange:t}){const[n,a]=b.useState(e),s=b.useRef(n),o=b.useRef(t);return JD(()=>{o.current=t},[t]),b.useEffect(()=>{var c;s.current!==n&&((c=o.current)==null||c.call(o,n),s.current=n)},[n,s]),[n,a,o]}function n3(e){return typeof e=="function"}var Ov=_j();const r3=rh(Ov);function VE(e){const t=a3(e),n=b.forwardRef((a,s)=>{const{children:o,...c}=a,f=b.Children.toArray(o),m=f.find(s3);if(m){const h=m.props.children,p=f.map(g=>g===m?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:g);return l.jsx(t,{...c,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,p):null})}return l.jsx(t,{...c,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function a3(e){const t=b.forwardRef((n,a)=>{const{children:s,...o}=n;if(b.isValidElement(s)){const c=o3(s),f=l3(o,s.props);return s.type!==b.Fragment&&(f.ref=a?us(a,c):c),b.cloneElement(s,f)}return b.Children.count(s)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var i3=Symbol("radix.slottable");function s3(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===i3}function l3(e,t){const n={...t};for(const a in t){const s=e[a],o=t[a];/^on[A-Z]/.test(a)?s&&o?n[a]=(...f)=>{const m=o(...f);return s(...f),m}:s&&(n[a]=s):a==="style"?n[a]={...s,...o}:a==="className"&&(n[a]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function o3(e){var a,s;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var u3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fi=u3.reduce((e,t)=>{const n=VE(`Primitive.${t}`),a=b.forwardRef((s,o)=>{const{asChild:c,...f}=s,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(m,{...f,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function c3(e,t){e&&Ov.flushSync(()=>e.dispatchEvent(t))}function cc(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),b.useMemo(()=>(...n)=>{var a;return(a=t.current)==null?void 0:a.call(t,...n)},[])}function d3(e,t=globalThis==null?void 0:globalThis.document){const n=cc(e);b.useEffect(()=>{const a=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[n,t])}var f3="DismissableLayer",Ny="dismissableLayer.update",h3="dismissableLayer.pointerDownOutside",m3="dismissableLayer.focusOutside",o1,QE=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),KE=b.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:c,onDismiss:f,...m}=e,h=b.useContext(QE),[p,g]=b.useState(null),x=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=b.useState({}),S=tl(t,B=>g(B)),k=Array.from(h.layers),[j]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),C=k.indexOf(j),N=p?k.indexOf(p):-1,R=h.layersWithOutsidePointerEventsDisabled.size>0,M=N>=C,L=y3(B=>{const I=B.target,Y=[...h.branches].some(z=>z.contains(I));!M||Y||(s==null||s(B),c==null||c(B),B.defaultPrevented||f==null||f())},x),O=v3(B=>{const I=B.target;[...h.branches].some(z=>z.contains(I))||(o==null||o(B),c==null||c(B),B.defaultPrevented||f==null||f())},x);return d3(B=>{N===h.layers.size-1&&(a==null||a(B),!B.defaultPrevented&&f&&(B.preventDefault(),f()))},x),b.useEffect(()=>{if(p)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(o1=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(p)),h.layers.add(p),u1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=o1)}},[p,x,n,h]),b.useEffect(()=>()=>{p&&(h.layers.delete(p),h.layersWithOutsidePointerEventsDisabled.delete(p),u1())},[p,h]),b.useEffect(()=>{const B=()=>w({});return document.addEventListener(Ny,B),()=>document.removeEventListener(Ny,B)},[]),l.jsx(fi.div,{...m,ref:S,style:{pointerEvents:R?M?"auto":"none":void 0,...e.style},onFocusCapture:ss(e.onFocusCapture,O.onFocusCapture),onBlurCapture:ss(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:ss(e.onPointerDownCapture,L.onPointerDownCapture)})});KE.displayName=f3;var p3="DismissableLayerBranch",g3=b.forwardRef((e,t)=>{const n=b.useContext(QE),a=b.useRef(null),s=tl(t,a);return b.useEffect(()=>{const o=a.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),l.jsx(fi.div,{...e,ref:s})});g3.displayName=p3;function y3(e,t=globalThis==null?void 0:globalThis.document){const n=cc(e),a=b.useRef(!1),s=b.useRef(()=>{});return b.useEffect(()=>{const o=f=>{if(f.target&&!a.current){let m=function(){YE(h3,n,h,{discrete:!0})};const h={originalEvent:f};f.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=m,t.addEventListener("click",s.current,{once:!0})):m()}else t.removeEventListener("click",s.current);a.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>a.current=!0}}function v3(e,t=globalThis==null?void 0:globalThis.document){const n=cc(e),a=b.useRef(!1);return b.useEffect(()=>{const s=o=>{o.target&&!a.current&&YE(m3,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function u1(){const e=new CustomEvent(Ny);document.dispatchEvent(e)}function YE(e,t,n,{discrete:a}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),a?c3(s,o):s.dispatchEvent(o)}var sg="focusScope.autoFocusOnMount",lg="focusScope.autoFocusOnUnmount",c1={bubbles:!1,cancelable:!0},b3="FocusScope",XE=b.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...c}=e,[f,m]=b.useState(null),h=cc(s),p=cc(o),g=b.useRef(null),x=tl(t,k=>m(k)),w=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(a){let k=function(R){if(w.paused||!f)return;const M=R.target;f.contains(M)?g.current=M:Gi(g.current,{select:!0})},j=function(R){if(w.paused||!f)return;const M=R.relatedTarget;M!==null&&(f.contains(M)||Gi(g.current,{select:!0}))},C=function(R){if(document.activeElement===document.body)for(const L of R)L.removedNodes.length>0&&Gi(f)};document.addEventListener("focusin",k),document.addEventListener("focusout",j);const N=new MutationObserver(C);return f&&N.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",k),document.removeEventListener("focusout",j),N.disconnect()}}},[a,f,w.paused]),b.useEffect(()=>{if(f){f1.add(w);const k=document.activeElement;if(!f.contains(k)){const C=new CustomEvent(sg,c1);f.addEventListener(sg,h),f.dispatchEvent(C),C.defaultPrevented||(x3(E3(WE(f)),{select:!0}),document.activeElement===k&&Gi(f))}return()=>{f.removeEventListener(sg,h),setTimeout(()=>{const C=new CustomEvent(lg,c1);f.addEventListener(lg,p),f.dispatchEvent(C),C.defaultPrevented||Gi(k??document.body,{select:!0}),f.removeEventListener(lg,p),f1.remove(w)},0)}}},[f,h,p,w]);const S=b.useCallback(k=>{if(!n&&!a||w.paused)return;const j=k.key==="Tab"&&!k.altKey&&!k.ctrlKey&&!k.metaKey,C=document.activeElement;if(j&&C){const N=k.currentTarget,[R,M]=w3(N);R&&M?!k.shiftKey&&C===M?(k.preventDefault(),n&&Gi(R,{select:!0})):k.shiftKey&&C===R&&(k.preventDefault(),n&&Gi(M,{select:!0})):C===N&&k.preventDefault()}},[n,a,w.paused]);return l.jsx(fi.div,{tabIndex:-1,...c,ref:x,onKeyDown:S})});XE.displayName=b3;function x3(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(Gi(a,{select:t}),document.activeElement!==n)return}function w3(e){const t=WE(e),n=d1(t,e),a=d1(t.reverse(),e);return[n,a]}function WE(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 d1(e,t){for(const n of e)if(!S3(n,{upTo:t}))return n}function S3(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 k3(e){return e instanceof HTMLInputElement&&"select"in e}function Gi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&k3(e)&&t&&e.select()}}var f1=j3();function j3(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=h1(e,t),e.unshift(t)},remove(t){var n;e=h1(e,t),(n=e[0])==null||n.resume()}}}function h1(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function E3(e){return e.filter(t=>t.tagName!=="A")}var C3="Portal",JE=b.forwardRef((e,t)=>{var f;const{container:n,...a}=e,[s,o]=b.useState(!1);uc(()=>o(!0),[]);const c=n||s&&((f=globalThis==null?void 0:globalThis.document)==null?void 0:f.body);return c?r3.createPortal(l.jsx(fi.div,{...a,ref:t}),c):null});JE.displayName=C3;function N3(e,t){return b.useReducer((n,a)=>t[n][a]??n,e)}var fh=e=>{const{present:t,children:n}=e,a=_3(t),s=typeof n=="function"?n({present:a.isPresent}):b.Children.only(n),o=tl(a.ref,T3(s));return typeof n=="function"||a.isPresent?b.cloneElement(s,{ref:o}):null};fh.displayName="Presence";function _3(e){const[t,n]=b.useState(),a=b.useRef(null),s=b.useRef(e),o=b.useRef("none"),c=e?"mounted":"unmounted",[f,m]=N3(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=uf(a.current);o.current=f==="mounted"?h:"none"},[f]),uc(()=>{const h=a.current,p=s.current;if(p!==e){const x=o.current,w=uf(h);e?m("MOUNT"):w==="none"||(h==null?void 0:h.display)==="none"?m("UNMOUNT"):m(p&&x!==w?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,m]),uc(()=>{if(t){let h;const p=t.ownerDocument.defaultView??window,g=w=>{const k=uf(a.current).includes(CSS.escape(w.animationName));if(w.target===t&&k&&(m("ANIMATION_END"),!s.current)){const j=t.style.animationFillMode;t.style.animationFillMode="forwards",h=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=j)})}},x=w=>{w.target===t&&(o.current=uf(a.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{p.clearTimeout(h),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:b.useCallback(h=>{a.current=h?getComputedStyle(h):null,n(h)},[])}}function uf(e){return(e==null?void 0:e.animationName)||"none"}function T3(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 og=0;function A3(){b.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??m1()),document.body.insertAdjacentElement("beforeend",e[1]??m1()),og++,()=>{og===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),og--}},[])}function m1(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ra=function(){return Ra=Object.assign||function(t){for(var n,a=1,s=arguments.length;a<s;a++){n=arguments[a];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Ra.apply(this,arguments)};function eC(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 R3(e,t,n){if(n||arguments.length===2)for(var a=0,s=t.length,o;a<s;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))}var Af="right-scroll-bar-position",Rf="width-before-scroll-bar",O3="with-scroll-bars-hidden",z3="--removed-body-scroll-bar-size";function ug(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function M3(e,t){var n=b.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(a){var s=n.value;s!==a&&(n.value=a,n.callback(a,s))}}}})[0];return n.callback=t,n.facade}var D3=typeof window<"u"?b.useLayoutEffect:b.useEffect,p1=new WeakMap;function I3(e,t){var n=M3(null,function(a){return e.forEach(function(s){return ug(s,a)})});return D3(function(){var a=p1.get(n);if(a){var s=new Set(a),o=new Set(e),c=n.current;s.forEach(function(f){o.has(f)||ug(f,null)}),o.forEach(function(f){s.has(f)||ug(f,c)})}p1.set(n,e)},[e]),n}function L3(e){return e}function P3(e,t){t===void 0&&(t=L3);var n=[],a=!1,s={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var c=t(o,a);return n.push(c),function(){n=n.filter(function(f){return f!==c})}},assignSyncMedium:function(o){for(a=!0;n.length;){var c=n;n=[],c.forEach(o)}n={push:function(f){return o(f)},filter:function(){return n}}},assignMedium:function(o){a=!0;var c=[];if(n.length){var f=n;n=[],f.forEach(o),c=n}var m=function(){var p=c;c=[],p.forEach(o)},h=function(){return Promise.resolve().then(m)};h(),n={push:function(p){c.push(p),h()},filter:function(p){return c=c.filter(p),n}}}};return s}function U3(e){e===void 0&&(e={});var t=P3(null);return t.options=Ra({async:!0,ssr:!1},e),t}var tC=function(e){var t=e.sideCar,n=eC(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return b.createElement(a,Ra({},n))};tC.isSideCarExport=!0;function B3(e,t){return e.useMedium(t),tC}var nC=U3(),cg=function(){},hh=b.forwardRef(function(e,t){var n=b.useRef(null),a=b.useState({onScrollCapture:cg,onWheelCapture:cg,onTouchMoveCapture:cg}),s=a[0],o=a[1],c=e.forwardProps,f=e.children,m=e.className,h=e.removeScrollBar,p=e.enabled,g=e.shards,x=e.sideCar,w=e.noRelative,S=e.noIsolation,k=e.inert,j=e.allowPinchZoom,C=e.as,N=C===void 0?"div":C,R=e.gapMode,M=eC(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=x,O=I3([n,t]),B=Ra(Ra({},M),s);return b.createElement(b.Fragment,null,p&&b.createElement(L,{sideCar:nC,removeScrollBar:h,shards:g,noRelative:w,noIsolation:S,inert:k,setCallbacks:o,allowPinchZoom:!!j,lockRef:n,gapMode:R}),c?b.cloneElement(b.Children.only(f),Ra(Ra({},B),{ref:O})):b.createElement(N,Ra({},B,{className:m,ref:O}),f))});hh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};hh.classNames={fullWidth:Rf,zeroRight:Af};var F3=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function $3(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=F3();return t&&e.setAttribute("nonce",t),e}function H3(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function q3(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Z3=function(){var e=0,t=null;return{add:function(n){e==0&&(t=$3())&&(H3(t,n),q3(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},G3=function(){var e=Z3();return function(t,n){b.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},rC=function(){var e=G3(),t=function(n){var a=n.styles,s=n.dynamic;return e(a,s),null};return t},V3={left:0,top:0,right:0,gap:0},dg=function(e){return parseInt(e||"",10)||0},Q3=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[dg(n),dg(a),dg(s)]},K3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return V3;var t=Q3(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])}},Y3=rC(),to="data-scroll-locked",X3=function(e,t,n,a){var s=e.left,o=e.top,c=e.right,f=e.gap;return n===void 0&&(n="margin"),`
|
|
306
|
+
.`.concat(O3,` {
|
|
307
|
+
overflow: hidden `).concat(a,`;
|
|
308
|
+
padding-right: `).concat(f,"px ").concat(a,`;
|
|
309
|
+
}
|
|
310
|
+
body[`).concat(to,`] {
|
|
311
|
+
overflow: hidden `).concat(a,`;
|
|
312
|
+
overscroll-behavior: contain;
|
|
313
|
+
`).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
|
|
314
|
+
padding-left: `.concat(s,`px;
|
|
315
|
+
padding-top: `).concat(o,`px;
|
|
316
|
+
padding-right: `).concat(c,`px;
|
|
317
|
+
margin-left:0;
|
|
318
|
+
margin-top:0;
|
|
319
|
+
margin-right: `).concat(f,"px ").concat(a,`;
|
|
320
|
+
`),n==="padding"&&"padding-right: ".concat(f,"px ").concat(a,";")].filter(Boolean).join(""),`
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.`).concat(Af,` {
|
|
324
|
+
right: `).concat(f,"px ").concat(a,`;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.`).concat(Rf,` {
|
|
328
|
+
margin-right: `).concat(f,"px ").concat(a,`;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.`).concat(Af," .").concat(Af,` {
|
|
332
|
+
right: 0 `).concat(a,`;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.`).concat(Rf," .").concat(Rf,` {
|
|
336
|
+
margin-right: 0 `).concat(a,`;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
body[`).concat(to,`] {
|
|
340
|
+
`).concat(z3,": ").concat(f,`px;
|
|
341
|
+
}
|
|
342
|
+
`)},g1=function(){var e=parseInt(document.body.getAttribute(to)||"0",10);return isFinite(e)?e:0},W3=function(){b.useEffect(function(){return document.body.setAttribute(to,(g1()+1).toString()),function(){var e=g1()-1;e<=0?document.body.removeAttribute(to):document.body.setAttribute(to,e.toString())}},[])},J3=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,s=a===void 0?"margin":a;W3();var o=b.useMemo(function(){return K3(s)},[s]);return b.createElement(Y3,{styles:X3(o,!t,s,n?"":"!important")})},_y=!1;if(typeof window<"u")try{var cf=Object.defineProperty({},"passive",{get:function(){return _y=!0,!0}});window.addEventListener("test",cf,cf),window.removeEventListener("test",cf,cf)}catch{_y=!1}var Bl=_y?{passive:!1}:!1,eI=function(e){return e.tagName==="TEXTAREA"},aC=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!eI(e)&&n[t]==="visible")},tI=function(e){return aC(e,"overflowY")},nI=function(e){return aC(e,"overflowX")},y1=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var s=iC(e,a);if(s){var o=sC(e,a),c=o[1],f=o[2];if(c>f)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},rI=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},aI=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},iC=function(e,t){return e==="v"?tI(t):nI(t)},sC=function(e,t){return e==="v"?rI(t):aI(t)},iI=function(e,t){return e==="h"&&t==="rtl"?-1:1},sI=function(e,t,n,a,s){var o=iI(e,window.getComputedStyle(t).direction),c=o*a,f=n.target,m=t.contains(f),h=!1,p=c>0,g=0,x=0;do{if(!f)break;var w=sC(e,f),S=w[0],k=w[1],j=w[2],C=k-j-o*S;(S||C)&&iC(e,f)&&(g+=C,x+=S);var N=f.parentNode;f=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!m&&f!==document.body||m&&(t.contains(f)||t===f));return(p&&Math.abs(g)<1||!p&&Math.abs(x)<1)&&(h=!0),h},df=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},v1=function(e){return[e.deltaX,e.deltaY]},b1=function(e){return e&&"current"in e?e.current:e},lI=function(e,t){return e[0]===t[0]&&e[1]===t[1]},oI=function(e){return`
|
|
343
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
344
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
345
|
+
`)},uI=0,Fl=[];function cI(e){var t=b.useRef([]),n=b.useRef([0,0]),a=b.useRef(),s=b.useState(uI++)[0],o=b.useState(rC)[0],c=b.useRef(e);b.useEffect(function(){c.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var k=R3([e.lockRef.current],(e.shards||[]).map(b1),!0).filter(Boolean);return k.forEach(function(j){return j.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),k.forEach(function(j){return j.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var f=b.useCallback(function(k,j){if("touches"in k&&k.touches.length===2||k.type==="wheel"&&k.ctrlKey)return!c.current.allowPinchZoom;var C=df(k),N=n.current,R="deltaX"in k?k.deltaX:N[0]-C[0],M="deltaY"in k?k.deltaY:N[1]-C[1],L,O=k.target,B=Math.abs(R)>Math.abs(M)?"h":"v";if("touches"in k&&B==="h"&&O.type==="range")return!1;var I=window.getSelection(),Y=I&&I.anchorNode,z=Y?Y===O||Y.contains(O):!1;if(z)return!1;var K=y1(B,O);if(!K)return!0;if(K?L=B:(L=B==="v"?"h":"v",K=y1(B,O)),!K)return!1;if(!a.current&&"changedTouches"in k&&(R||M)&&(a.current=L),!L)return!0;var ie=a.current||L;return sI(ie,j,k,ie==="h"?R:M)},[]),m=b.useCallback(function(k){var j=k;if(!(!Fl.length||Fl[Fl.length-1]!==o)){var C="deltaY"in j?v1(j):df(j),N=t.current.filter(function(L){return L.name===j.type&&(L.target===j.target||j.target===L.shadowParent)&&lI(L.delta,C)})[0];if(N&&N.should){j.cancelable&&j.preventDefault();return}if(!N){var R=(c.current.shards||[]).map(b1).filter(Boolean).filter(function(L){return L.contains(j.target)}),M=R.length>0?f(j,R[0]):!c.current.noIsolation;M&&j.cancelable&&j.preventDefault()}}},[]),h=b.useCallback(function(k,j,C,N){var R={name:k,delta:j,target:C,should:N,shadowParent:dI(C)};t.current.push(R),setTimeout(function(){t.current=t.current.filter(function(M){return M!==R})},1)},[]),p=b.useCallback(function(k){n.current=df(k),a.current=void 0},[]),g=b.useCallback(function(k){h(k.type,v1(k),k.target,f(k,e.lockRef.current))},[]),x=b.useCallback(function(k){h(k.type,df(k),k.target,f(k,e.lockRef.current))},[]);b.useEffect(function(){return Fl.push(o),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:x}),document.addEventListener("wheel",m,Bl),document.addEventListener("touchmove",m,Bl),document.addEventListener("touchstart",p,Bl),function(){Fl=Fl.filter(function(k){return k!==o}),document.removeEventListener("wheel",m,Bl),document.removeEventListener("touchmove",m,Bl),document.removeEventListener("touchstart",p,Bl)}},[]);var w=e.removeScrollBar,S=e.inert;return b.createElement(b.Fragment,null,S?b.createElement(o,{styles:oI(s)}):null,w?b.createElement(J3,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function dI(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const fI=B3(nC,cI);var lC=b.forwardRef(function(e,t){return b.createElement(hh,Ra({},e,{ref:t,sideCar:fI}))});lC.classNames=hh.classNames;var hI=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},$l=new WeakMap,ff=new WeakMap,hf={},fg=0,oC=function(e){return e&&(e.host||oC(e.parentNode))},mI=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=oC(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})},pI=function(e,t,n,a){var s=mI(t,Array.isArray(e)?e:[e]);hf[n]||(hf[n]=new WeakMap);var o=hf[n],c=[],f=new Set,m=new Set(s),h=function(g){!g||f.has(g)||(f.add(g),h(g.parentNode))};s.forEach(h);var p=function(g){!g||m.has(g)||Array.prototype.forEach.call(g.children,function(x){if(f.has(x))p(x);else try{var w=x.getAttribute(a),S=w!==null&&w!=="false",k=($l.get(x)||0)+1,j=(o.get(x)||0)+1;$l.set(x,k),o.set(x,j),c.push(x),k===1&&S&&ff.set(x,!0),j===1&&x.setAttribute(n,"true"),S||x.setAttribute(a,"true")}catch(C){console.error("aria-hidden: cannot operate on ",x,C)}})};return p(t),f.clear(),fg++,function(){c.forEach(function(g){var x=$l.get(g)-1,w=o.get(g)-1;$l.set(g,x),o.set(g,w),x||(ff.has(g)||g.removeAttribute(a),ff.delete(g)),w||g.removeAttribute(n)}),fg--,fg||($l=new WeakMap,$l=new WeakMap,ff=new WeakMap,hf={})}},gI=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),s=hI(e);return s?(a.push.apply(a,Array.from(s.querySelectorAll("[aria-live], script"))),pI(a,s,n,"aria-hidden")):function(){return null}},mh="Dialog",[uC]=KD(mh),[yI,wa]=uC(mh),cC=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:s,onOpenChange:o,modal:c=!0}=e,f=b.useRef(null),m=b.useRef(null),[h,p]=e3({prop:a,defaultProp:s??!1,onChange:o,caller:mh});return l.jsx(yI,{scope:t,triggerRef:f,contentRef:m,contentId:li(),titleId:li(),descriptionId:li(),open:h,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(g=>!g),[p]),modal:c,children:n})};cC.displayName=mh;var dC="DialogTrigger",vI=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=wa(dC,n),o=tl(t,s.triggerRef);return l.jsx(fi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Dv(s.open),...a,ref:o,onClick:ss(e.onClick,s.onOpenToggle)})});vI.displayName=dC;var zv="DialogPortal",[bI,fC]=uC(zv,{forceMount:void 0}),hC=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:s}=e,o=wa(zv,t);return l.jsx(bI,{scope:t,forceMount:n,children:b.Children.map(a,c=>l.jsx(fh,{present:n||o.open,children:l.jsx(JE,{asChild:!0,container:s,children:c})}))})};hC.displayName=zv;var Ff="DialogOverlay",mC=b.forwardRef((e,t)=>{const n=fC(Ff,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,o=wa(Ff,e.__scopeDialog);return o.modal?l.jsx(fh,{present:a||o.open,children:l.jsx(wI,{...s,ref:t})}):null});mC.displayName=Ff;var xI=VE("DialogOverlay.RemoveScroll"),wI=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=wa(Ff,n);return l.jsx(lC,{as:xI,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(fi.div,{"data-state":Dv(s.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),Ks="DialogContent",pC=b.forwardRef((e,t)=>{const n=fC(Ks,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,o=wa(Ks,e.__scopeDialog);return l.jsx(fh,{present:a||o.open,children:o.modal?l.jsx(SI,{...s,ref:t}):l.jsx(kI,{...s,ref:t})})});pC.displayName=Ks;var SI=b.forwardRef((e,t)=>{const n=wa(Ks,e.__scopeDialog),a=b.useRef(null),s=tl(t,n.contentRef,a);return b.useEffect(()=>{const o=a.current;if(o)return gI(o)},[]),l.jsx(gC,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ss(e.onCloseAutoFocus,o=>{var c;o.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:ss(e.onPointerDownOutside,o=>{const c=o.detail.originalEvent,f=c.button===0&&c.ctrlKey===!0;(c.button===2||f)&&o.preventDefault()}),onFocusOutside:ss(e.onFocusOutside,o=>o.preventDefault())})}),kI=b.forwardRef((e,t)=>{const n=wa(Ks,e.__scopeDialog),a=b.useRef(!1),s=b.useRef(!1);return l.jsx(gC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var c,f;(c=e.onCloseAutoFocus)==null||c.call(e,o),o.defaultPrevented||(a.current||(f=n.triggerRef.current)==null||f.focus(),o.preventDefault()),a.current=!1,s.current=!1},onInteractOutside:o=>{var m,h;(m=e.onInteractOutside)==null||m.call(e,o),o.defaultPrevented||(a.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const c=o.target;((h=n.triggerRef.current)==null?void 0:h.contains(c))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),gC=b.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:o,...c}=e,f=wa(Ks,n),m=b.useRef(null),h=tl(t,m);return A3(),l.jsxs(l.Fragment,{children:[l.jsx(XE,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(KE,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":Dv(f.open),...c,ref:h,onDismiss:()=>f.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(jI,{titleId:f.titleId}),l.jsx(CI,{contentRef:m,descriptionId:f.descriptionId})]})]})}),Mv="DialogTitle",yC=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=wa(Mv,n);return l.jsx(fi.h2,{id:s.titleId,...a,ref:t})});yC.displayName=Mv;var vC="DialogDescription",bC=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=wa(vC,n);return l.jsx(fi.p,{id:s.descriptionId,...a,ref:t})});bC.displayName=vC;var xC="DialogClose",wC=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=wa(xC,n);return l.jsx(fi.button,{type:"button",...a,ref:t,onClick:ss(e.onClick,()=>s.onOpenChange(!1))})});wC.displayName=xC;function Dv(e){return e?"open":"closed"}var SC="DialogTitleWarning",[JY,kC]=QD(SC,{contentName:Ks,titleName:Mv,docsSlug:"dialog"}),jI=({titleId:e})=>{const t=kC(SC),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
346
|
+
|
|
347
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
348
|
+
|
|
349
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return b.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},EI="DialogDescriptionWarning",CI=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${kC(EI).contentName}}.`;return b.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},jC=cC,EC=hC,CC=mC,NC=pC,NI=yC,_I=bC,TI=wC,AI=Symbol.for("react.lazy"),$f=sv[" use ".trim().toString()];function RI(e){return typeof e=="object"&&e!==null&&"then"in e}function _C(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===AI&&"_payload"in e&&RI(e._payload)}function TC(e){const t=zI(e),n=b.forwardRef((a,s)=>{let{children:o,...c}=a;_C(o)&&typeof $f=="function"&&(o=$f(o._payload));const f=b.Children.toArray(o),m=f.find(DI);if(m){const h=m.props.children,p=f.map(g=>g===m?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:g);return l.jsx(t,{...c,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,p):null})}return l.jsx(t,{...c,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var OI=TC("Slot");function zI(e){const t=b.forwardRef((n,a)=>{let{children:s,...o}=n;if(_C(s)&&typeof $f=="function"&&(s=$f(s._payload)),b.isValidElement(s)){const c=LI(s),f=II(o,s.props);return s.type!==b.Fragment&&(f.ref=a?us(a,c):c),b.cloneElement(s,f)}return b.Children.count(s)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var MI=Symbol("radix.slottable");function DI(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===MI}function II(e,t){const n={...t};for(const a in t){const s=e[a],o=t[a];/^on[A-Z]/.test(a)?s&&o?n[a]=(...f)=>{const m=o(...f);return s(...f),m}:s&&(n[a]=s):a==="style"?n[a]={...s,...o}:a==="className"&&(n[a]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function LI(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 PI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],hi=PI.reduce((e,t)=>{const n=TC(`Primitive.${t}`),a=b.forwardRef((s,o)=>{const{asChild:c,...f}=s,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(m,{...f,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),Iu='[cmdk-group=""]',hg='[cmdk-group-items=""]',UI='[cmdk-group-heading=""]',AC='[cmdk-item=""]',x1=`${AC}:not([aria-disabled="true"])`,Ty="cmdk-item-select",Gl="data-value",BI=(e,t,n)=>VD(e,t,n),RC=b.createContext(void 0),zc=()=>b.useContext(RC),OC=b.createContext(void 0),Iv=()=>b.useContext(OC),zC=b.createContext(void 0),MC=b.forwardRef((e,t)=>{let n=Vl(()=>{var F,T;return{search:"",value:(T=(F=e.value)!=null?F:e.defaultValue)!=null?T:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=Vl(()=>new Set),s=Vl(()=>new Map),o=Vl(()=>new Map),c=Vl(()=>new Set),f=DC(e),{label:m,children:h,value:p,onValueChange:g,filter:x,shouldFilter:w,loop:S,disablePointerSelection:k=!1,vimBindings:j=!0,...C}=e,N=li(),R=li(),M=li(),L=b.useRef(null),O=XI();Ys(()=>{if(p!==void 0){let F=p.trim();n.current.value=F,B.emit()}},[p]),Ys(()=>{O(6,ve)},[]);let B=b.useMemo(()=>({subscribe:F=>(c.current.add(F),()=>c.current.delete(F)),snapshot:()=>n.current,setState:(F,T,G)=>{var q,ae,be,we;if(!Object.is(n.current[F],T)){if(n.current[F]=T,F==="search")ie(),z(),O(1,K);else if(F==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let me=document.getElementById(M);me?me.focus():(q=document.getElementById(N))==null||q.focus()}if(O(7,()=>{var me;n.current.selectedItemId=(me=J())==null?void 0:me.id,B.emit()}),G||O(5,ve),((ae=f.current)==null?void 0:ae.value)!==void 0){let me=T??"";(we=(be=f.current).onValueChange)==null||we.call(be,me);return}}B.emit()}},emit:()=>{c.current.forEach(F=>F())}}),[]),I=b.useMemo(()=>({value:(F,T,G)=>{var q;T!==((q=o.current.get(F))==null?void 0:q.value)&&(o.current.set(F,{value:T,keywords:G}),n.current.filtered.items.set(F,Y(T,G)),O(2,()=>{z(),B.emit()}))},item:(F,T)=>(a.current.add(F),T&&(s.current.has(T)?s.current.get(T).add(F):s.current.set(T,new Set([F]))),O(3,()=>{ie(),z(),n.current.value||K(),B.emit()}),()=>{o.current.delete(F),a.current.delete(F),n.current.filtered.items.delete(F);let G=J();O(4,()=>{ie(),(G==null?void 0:G.getAttribute("id"))===F&&K(),B.emit()})}),group:F=>(s.current.has(F)||s.current.set(F,new Set),()=>{o.current.delete(F),s.current.delete(F)}),filter:()=>f.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>f.current.disablePointerSelection,listId:N,inputId:M,labelId:R,listInnerRef:L}),[]);function Y(F,T){var G,q;let ae=(q=(G=f.current)==null?void 0:G.filter)!=null?q:BI;return F?ae(F,n.current.search,T):0}function z(){if(!n.current.search||f.current.shouldFilter===!1)return;let F=n.current.filtered.items,T=[];n.current.filtered.groups.forEach(q=>{let ae=s.current.get(q),be=0;ae.forEach(we=>{let me=F.get(we);be=Math.max(me,be)}),T.push([q,be])});let G=L.current;W().sort((q,ae)=>{var be,we;let me=q.getAttribute("id"),Me=ae.getAttribute("id");return((be=F.get(Me))!=null?be:0)-((we=F.get(me))!=null?we:0)}).forEach(q=>{let ae=q.closest(hg);ae?ae.appendChild(q.parentElement===ae?q:q.closest(`${hg} > *`)):G.appendChild(q.parentElement===G?q:q.closest(`${hg} > *`))}),T.sort((q,ae)=>ae[1]-q[1]).forEach(q=>{var ae;let be=(ae=L.current)==null?void 0:ae.querySelector(`${Iu}[${Gl}="${encodeURIComponent(q[0])}"]`);be==null||be.parentElement.appendChild(be)})}function K(){let F=W().find(G=>G.getAttribute("aria-disabled")!=="true"),T=F==null?void 0:F.getAttribute(Gl);B.setState("value",T||void 0)}function ie(){var F,T,G,q;if(!n.current.search||f.current.shouldFilter===!1){n.current.filtered.count=a.current.size;return}n.current.filtered.groups=new Set;let ae=0;for(let be of a.current){let we=(T=(F=o.current.get(be))==null?void 0:F.value)!=null?T:"",me=(q=(G=o.current.get(be))==null?void 0:G.keywords)!=null?q:[],Me=Y(we,me);n.current.filtered.items.set(be,Me),Me>0&&ae++}for(let[be,we]of s.current)for(let me of we)if(n.current.filtered.items.get(me)>0){n.current.filtered.groups.add(be);break}n.current.filtered.count=ae}function ve(){var F,T,G;let q=J();q&&(((F=q.parentElement)==null?void 0:F.firstChild)===q&&((G=(T=q.closest(Iu))==null?void 0:T.querySelector(UI))==null||G.scrollIntoView({block:"nearest"})),q.scrollIntoView({block:"nearest"}))}function J(){var F;return(F=L.current)==null?void 0:F.querySelector(`${AC}[aria-selected="true"]`)}function W(){var F;return Array.from(((F=L.current)==null?void 0:F.querySelectorAll(x1))||[])}function Z(F){let T=W()[F];T&&B.setState("value",T.getAttribute(Gl))}function ne(F){var T;let G=J(),q=W(),ae=q.findIndex(we=>we===G),be=q[ae+F];(T=f.current)!=null&&T.loop&&(be=ae+F<0?q[q.length-1]:ae+F===q.length?q[0]:q[ae+F]),be&&B.setState("value",be.getAttribute(Gl))}function ke(F){let T=J(),G=T==null?void 0:T.closest(Iu),q;for(;G&&!q;)G=F>0?KI(G,Iu):YI(G,Iu),q=G==null?void 0:G.querySelector(x1);q?B.setState("value",q.getAttribute(Gl)):ne(F)}let Ae=()=>Z(W().length-1),D=F=>{F.preventDefault(),F.metaKey?Ae():F.altKey?ke(1):ne(1)},P=F=>{F.preventDefault(),F.metaKey?Z(0):F.altKey?ke(-1):ne(-1)};return b.createElement(hi.div,{ref:t,tabIndex:-1,...C,"cmdk-root":"",onKeyDown:F=>{var T;(T=C.onKeyDown)==null||T.call(C,F);let G=F.nativeEvent.isComposing||F.keyCode===229;if(!(F.defaultPrevented||G))switch(F.key){case"n":case"j":{j&&F.ctrlKey&&D(F);break}case"ArrowDown":{D(F);break}case"p":case"k":{j&&F.ctrlKey&&P(F);break}case"ArrowUp":{P(F);break}case"Home":{F.preventDefault(),Z(0);break}case"End":{F.preventDefault(),Ae();break}case"Enter":{F.preventDefault();let q=J();if(q){let ae=new Event(Ty);q.dispatchEvent(ae)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:I.inputId,id:I.labelId,style:JI},m),ph(e,F=>b.createElement(OC.Provider,{value:B},b.createElement(RC.Provider,{value:I},F))))}),FI=b.forwardRef((e,t)=>{var n,a;let s=li(),o=b.useRef(null),c=b.useContext(zC),f=zc(),m=DC(e),h=(a=(n=m.current)==null?void 0:n.forceMount)!=null?a:c==null?void 0:c.forceMount;Ys(()=>{if(!h)return f.item(s,c==null?void 0:c.id)},[h]);let p=IC(s,o,[e.value,e.children,o],e.keywords),g=Iv(),x=cs(O=>O.value&&O.value===p.current),w=cs(O=>h||f.filter()===!1?!0:O.search?O.filtered.items.get(s)>0:!0);b.useEffect(()=>{let O=o.current;if(!(!O||e.disabled))return O.addEventListener(Ty,S),()=>O.removeEventListener(Ty,S)},[w,e.onSelect,e.disabled]);function S(){var O,B;k(),(B=(O=m.current).onSelect)==null||B.call(O,p.current)}function k(){g.setState("value",p.current,!0)}if(!w)return null;let{disabled:j,value:C,onSelect:N,forceMount:R,keywords:M,...L}=e;return b.createElement(hi.div,{ref:us(o,t),...L,id:s,"cmdk-item":"",role:"option","aria-disabled":!!j,"aria-selected":!!x,"data-disabled":!!j,"data-selected":!!x,onPointerMove:j||f.getDisablePointerSelection()?void 0:k,onClick:j?void 0:S},e.children)}),$I=b.forwardRef((e,t)=>{let{heading:n,children:a,forceMount:s,...o}=e,c=li(),f=b.useRef(null),m=b.useRef(null),h=li(),p=zc(),g=cs(w=>s||p.filter()===!1?!0:w.search?w.filtered.groups.has(c):!0);Ys(()=>p.group(c),[]),IC(c,f,[e.value,e.heading,m]);let x=b.useMemo(()=>({id:c,forceMount:s}),[s]);return b.createElement(hi.div,{ref:us(f,t),...o,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},n&&b.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),ph(e,w=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},b.createElement(zC.Provider,{value:x},w))))}),HI=b.forwardRef((e,t)=>{let{alwaysRender:n,...a}=e,s=b.useRef(null),o=cs(c=>!c.search);return!n&&!o?null:b.createElement(hi.div,{ref:us(s,t),...a,"cmdk-separator":"",role:"separator"})}),qI=b.forwardRef((e,t)=>{let{onValueChange:n,...a}=e,s=e.value!=null,o=Iv(),c=cs(h=>h.search),f=cs(h=>h.selectedItemId),m=zc();return b.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),b.createElement(hi.input,{ref:t,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":f,id:m.inputId,type:"text",value:s?e.value:c,onChange:h=>{s||o.setState("search",h.target.value),n==null||n(h.target.value)}})}),ZI=b.forwardRef((e,t)=>{let{children:n,label:a="Suggestions",...s}=e,o=b.useRef(null),c=b.useRef(null),f=cs(h=>h.selectedItemId),m=zc();return b.useEffect(()=>{if(c.current&&o.current){let h=c.current,p=o.current,g,x=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let w=h.offsetHeight;p.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return x.observe(h),()=>{cancelAnimationFrame(g),x.unobserve(h)}}},[]),b.createElement(hi.div,{ref:us(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":f,"aria-label":a,id:m.listId},ph(e,h=>b.createElement("div",{ref:us(c,m.listInnerRef),"cmdk-list-sizer":""},h)))}),GI=b.forwardRef((e,t)=>{let{open:n,onOpenChange:a,overlayClassName:s,contentClassName:o,container:c,...f}=e;return b.createElement(jC,{open:n,onOpenChange:a},b.createElement(EC,{container:c},b.createElement(CC,{"cmdk-overlay":"",className:s}),b.createElement(NC,{"aria-label":e.label,"cmdk-dialog":"",className:o},b.createElement(MC,{ref:t,...f}))))}),VI=b.forwardRef((e,t)=>cs(n=>n.filtered.count===0)?b.createElement(hi.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),QI=b.forwardRef((e,t)=>{let{progress:n,children:a,label:s="Loading...",...o}=e;return b.createElement(hi.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},ph(e,c=>b.createElement("div",{"aria-hidden":!0},c)))}),Nr=Object.assign(MC,{List:ZI,Item:FI,Input:qI,Group:$I,Separator:HI,Dialog:GI,Empty:VI,Loading:QI});function KI(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function YI(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function DC(e){let t=b.useRef(e);return Ys(()=>{t.current=e}),t}var Ys=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Vl(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function cs(e){let t=Iv(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function IC(e,t,n,a=[]){let s=b.useRef(),o=zc();return Ys(()=>{var c;let f=(()=>{var h;for(let p of n){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(h=p.current.textContent)==null?void 0:h.trim():s.current}})(),m=a.map(h=>h.trim());o.value(e,f,m),(c=t.current)==null||c.setAttribute(Gl,f),s.current=f}),s}var XI=()=>{let[e,t]=b.useState(),n=Vl(()=>new Map);return Ys(()=>{n.current.forEach(a=>a()),n.current=new Map},[e]),(a,s)=>{n.current.set(a,s),t({})}};function WI(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&&b.isValidElement(t)?b.cloneElement(WI(t),{ref:t.ref},n(t.props.children)):n(t)}var JI={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const On=jC,e4=EC,LC=b.forwardRef(({className:e,...t},n)=>l.jsx(CC,{ref:n,className:ze("fixed inset-0 z-50 bg-overlay-scrim data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));LC.displayName="DialogOverlay";const Nn=b.forwardRef(({className:e,children:t,...n},a)=>l.jsxs(e4,{children:[l.jsx(LC,{}),l.jsxs(NC,{ref:a,className:ze("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",e),...n,children:[t,l.jsxs(TI,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[l.jsx(os,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Nn.displayName="DialogContent";function Pn({className:e,...t}){return l.jsx("div",{className:ze("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function fr({className:e,...t}){return l.jsx("div",{className:ze("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t})}const zn=b.forwardRef(({className:e,...t},n)=>l.jsx(NI,{ref:n,className:ze("text-subtitle leading-none tracking-tight",e),...t}));zn.displayName="DialogTitle";const Lv=b.forwardRef(({className:e,...t},n)=>l.jsx(_I,{ref:n,className:ze("text-body text-muted-foreground",e),...t}));Lv.displayName="DialogDescription";const PC=b.forwardRef(({className:e,...t},n)=>l.jsx(Nr,{ref:n,className:ze("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));PC.displayName=Nr.displayName;function t4({open:e,onOpenChange:t,children:n}){return l.jsx(On,{open:e,onOpenChange:t,children:l.jsx(Nn,{className:"overflow-hidden p-0 shadow-lg",children:l.jsx(PC,{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 UC=b.forwardRef(({className:e,...t},n)=>l.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[l.jsx(ch,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),l.jsx(Nr.Input,{ref:n,className:ze("flex h-11 w-full rounded-md bg-transparent py-3 text-body outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));UC.displayName=Nr.Input.displayName;const BC=b.forwardRef(({className:e,...t},n)=>l.jsx(Nr.List,{ref:n,className:ze("max-h-[var(--sp-75)] overflow-y-auto overflow-x-hidden",e),...t}));BC.displayName=Nr.List.displayName;const FC=b.forwardRef((e,t)=>l.jsx(Nr.Empty,{ref:t,className:"py-6 text-center text-body",...e}));FC.displayName=Nr.Empty.displayName;const Of=b.forwardRef(({className:e,...t},n)=>l.jsx(Nr.Group,{ref:n,className:ze("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-caption [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));Of.displayName=Nr.Group.displayName;const Ay=b.forwardRef(({className:e,...t},n)=>l.jsx(Nr.Separator,{ref:n,className:ze("-mx-1 h-px bg-border",e),...t}));Ay.displayName=Nr.Separator.displayName;const zf=b.forwardRef(({className:e,...t},n)=>l.jsx(Nr.Item,{ref:n,className:ze("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-body outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));zf.displayName=Nr.Item.displayName;function Mc(e){const t=new URLSearchParams;e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.type&&t.set("type",e.type);const n=t.toString();return Ee.get(Rn(`/agents${n?`?${n}`:""}`))}function n4(e){const t=new URLSearchParams;e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor);const n=t.toString();return Ee.get(Rn(`/agents/all${n?`?${n}`:""}`))}function Pv(){return Ee.get("/me/managed-agents")}function r4(e){return Ee.get(`/agents/${encodeURIComponent(e)}`)}function a4(e){return Ee.post(Rn("/agents"),e)}function i4(e){return Ee.get(Rn(`/agents/names/${encodeURIComponent(e)}/availability`))}function Ry(e,t){return Ee.patch(`/agents/${encodeURIComponent(e)}`,t)}function s4(e,t){return Ee.patch(`/agents/${encodeURIComponent(e)}/rebind`,t)}function $C(e){return Ee.delete(`/agents/${encodeURIComponent(e)}`)}function HC(e){return Ee.post(`/agents/${encodeURIComponent(e)}/suspend`,{})}function qC(e){return Ee.post(`/agents/${encodeURIComponent(e)}/reactivate`,{})}function l4(e){return Ee.post(`/agents/${encodeURIComponent(e)}/test`,{})}function gh(){const{data:e}=Ke({queryKey:["agents","name-map"],queryFn:()=>Mc({limit:100}),staleTime:3e4}),{data:t}=Ke({queryKey:["managed-agents","name-map"],queryFn:Pv,staleTime:3e4});return b.useMemo(()=>{const n=new Map;if(t)for(const a of t)n.set(a.uuid,a.displayName);if(e!=null&&e.items)for(const a of e.items)n.set(a.uuid,a.displayName);return a=>a?n.get(a)??a:"—"},[e,t])}function Uv(){const{data:e}=Ke({queryKey:["agents","name-map"],queryFn:()=>Mc({limit:100}),staleTime:3e4}),{data:t}=Ke({queryKey:["managed-agents","name-map"],queryFn:Pv,staleTime:3e4});return b.useMemo(()=>{const n=new Map;if(t)for(const a of t)n.set(a.uuid,{name:a.name,displayName:a.displayName});if(e!=null&&e.items)for(const a of e.items)n.set(a.uuid,{name:a.name,displayName:a.displayName});return a=>a?n.get(a)??null:null},[e,t])}const o4=[{path:"/",label:"Workspace"},{path:"/context",label:"Context"},{path:"/team",label:"Team"},{path:"/settings",label:"Settings"}];function u4({open:e,onOpenChange:t}){const n=An(),a=gh(),{data:s}=Ke({queryKey:["activity"],queryFn:Oc,enabled:e,staleTime:3e4}),o=(s==null?void 0:s.agents)??[],f=Ke({queryKey:["palette-sessions",o.map(h=>h.agentId).join(",")],queryFn:async()=>{const h=[];for(const p of o)try{const g=await ZE(p.agentId);for(const x of g)h.push({agentId:p.agentId,session:x})}catch{}return h},enabled:e&&o.length>0,staleTime:3e4}).data??[],m=h=>{t(!1),n(h)};return l.jsxs(t4,{open:e,onOpenChange:t,children:[l.jsx(UC,{placeholder:"Jump to agent, chat, or page…"}),l.jsxs(BC,{children:[l.jsx(FC,{children:"No results"}),o.length>0&&l.jsx(Of,{heading:"Agents",children:o.map(h=>{const p=a(h.agentId);return l.jsxs(zf,{value:`agent ${p} ${h.agentId}`,onSelect:()=>m(`/?a=${h.agentId}`),children:[l.jsx(xE,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),l.jsx("span",{className:"flex-1 truncate",children:p}),l.jsx("span",{className:"text-caption text-muted-foreground font-mono ml-2",children:h.agentId.slice(0,8)})]},h.agentId)})}),f.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Ay,{}),l.jsx(Of,{heading:"Chats",children:f.map(({agentId:h,session:p})=>{const g=a(h);return l.jsxs(zf,{value:`chat ${g} ${p.chatId}`,onSelect:()=>m(`/?a=${h}&c=${p.chatId}`),children:[l.jsx(_v,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),l.jsx("span",{className:"flex-1 truncate",children:g}),l.jsx("span",{className:"text-caption text-muted-foreground font-mono ml-2",children:p.chatId.slice(0,8)})]},`${h}-${p.chatId}`)})})]}),l.jsx(Ay,{}),l.jsx(Of,{heading:"Pages",children:o4.map(h=>l.jsxs(zf,{value:`page ${h.label}`,onSelect:()=>m(h.path),children:[l.jsx(hM,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),l.jsx("span",{children:h.label})]},h.path))})]})]})}function c4(e,t){return t?e.filter(n=>n.userId===t&&n.status==="disconnected"&&n.agentCount>0):[]}function d4(){var a;const{user:e}=vt(),{data:t}=Ke({queryKey:["clients"],queryFn:ci,refetchInterval:1e4,enabled:!!e});if(!t||!e)return{rows:[],firstHostname:null};const n=c4(t,e.id);return{rows:n,firstHostname:((a=n[0])==null?void 0:a.hostname)??null}}const f4=160;function h4(){const e=An(),{rows:t,firstHostname:n}=d4();if(t.length===0)return null;const a=t.length>1,s=a?`${t.length} computers disconnected. Click to manage.`:`${n??"Your computer"} is disconnected. Click to manage.`;return l.jsxs("button",{type:"button",onClick:()=>e("/settings/computers"),title:s,"aria-label":s,className:"inline-flex items-center cursor-pointer text-body font-medium",style:{gap:8,height:26,padding:"0 var(--sp-2_5) 0 var(--sp-2_25)",borderRadius:999,border:0,outline:"var(--hairline) solid color-mix(in oklch, var(--state-error) 38%, transparent)",outlineOffset:-1,background:"color-mix(in oklch, var(--state-error) 14%, transparent)",color:"color-mix(in oklch, var(--state-error) 80%, var(--fg))",minWidth:0},children:[l.jsx(m4,{}),a?l.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[l.jsx("span",{className:"font-semibold",children:t.length})," computers disconnected"]}):l.jsxs("span",{className:"inline-flex items-center",style:{gap:5,minWidth:0},children:[l.jsx("span",{className:"mono text-label font-medium",style:{maxWidth:f4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"color-mix(in oklch, var(--state-error) 60%, var(--fg))"},children:n??"computer"}),l.jsx("span",{style:{flexShrink:0},children:"disconnected"})]})]})}function m4(){return l.jsxs("span",{"aria-hidden":"true",style:{position:"relative",width:8,height:8,flexShrink:0,display:"inline-block"},children:[l.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--state-error)"}}),l.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--state-error)",animation:"ring-pulse 1.8s infinite",opacity:.6}})]})}function Dc(e){return l.jsxs("svg",{viewBox:"0 0 9 10",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",shapeRendering:"crispEdges","aria-hidden":"true",...e,children:[l.jsx("rect",{x:"4",y:"0",width:"1",height:"1"}),l.jsx("rect",{x:"3",y:"1",width:"3",height:"1"}),l.jsx("rect",{x:"2",y:"2",width:"5",height:"1"}),l.jsx("rect",{x:"3",y:"3",width:"3",height:"1"}),l.jsx("rect",{x:"2",y:"4",width:"5",height:"1"}),l.jsx("rect",{x:"1",y:"5",width:"7",height:"1"}),l.jsx("rect",{x:"2",y:"6",width:"5",height:"1"}),l.jsx("rect",{x:"1",y:"7",width:"7",height:"1"}),l.jsx("rect",{x:"0",y:"8",width:"9",height:"1"}),l.jsx("rect",{x:"3",y:"9",width:"3",height:"1"})]})}function w1(e){const t=new URLSearchParams;e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.severity&&t.set("severity",e.severity),(e==null?void 0:e.read)!==void 0&&t.set("read",String(e.read)),e!=null&&e.agentId&&t.set("agentId",e.agentId);const n=t.toString();return Ee.get(Rn(`/notifications${n?`?${n}`:""}`))}function p4(e){return Ee.post(Rn(`/notifications/${e}/read`))}function g4(){return Ee.post(Rn("/notifications/read-all"))}const y4={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 v4(e){switch(e){case"high":return"var(--state-error)";case"medium":return"var(--state-blocked)";default:return"var(--accent-dim)"}}function b4({notification:e,onClick:t,clickable:n}){const a=(y4[e.type]??e.type).toString(),s=v4(e.severity),o=n??!0;return l.jsxs("button",{type:"button",onClick:t,className:ze("w-full text-left transition-colors text-body",o?"cursor-pointer":"cursor-default"),style:{padding:"var(--sp-1_5) var(--sp-2)",background:e.read?"transparent":"var(--bg-sunken)",borderLeft:`var(--hairline-bold) solid ${s}`,borderRadius:"0 var(--sp-0_75) var(--sp-0_75) 0"},onMouseEnter:c=>{o&&(c.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:c=>{c.currentTarget.style.background=e.read?"transparent":"var(--bg-sunken)"},children:[l.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:8},children:[l.jsx("span",{className:"mono uppercase text-label",style:{color:e.severity==="high"?"var(--state-error)":"var(--fg-3)"},children:a.replace("_"," ")}),l.jsx("span",{className:"mono text-label",style:{color:"var(--fg-4)",whiteSpace:"nowrap"},children:oc(e.createdAt)})]}),l.jsx("div",{style:{color:"var(--fg-2)",marginTop:1,wordBreak:"break-word"},children:e.message})]})}function x4(){var w;const[e,t]=b.useState(!1),[n,a]=b.useState(null),s=b.useRef(null),o=An(),c=gn(),{data:f}=Ke({queryKey:["notifications","bell"],queryFn:()=>w1({limit:8}),refetchInterval:1e4}),{data:m}=Ke({queryKey:["notifications","unread-count"],queryFn:()=>w1({read:!1,limit:100}),refetchInterval:1e4}),h=((w=m==null?void 0:m.items)==null?void 0:w.length)??0,p=h>0,g=b.useCallback(async S=>{S.read||(p4(S.id).catch(()=>{}),c.invalidateQueries({queryKey:["notifications"]})),t(!1),S.agentId&&S.chatId?o(`/?a=${S.agentId}&c=${S.chatId}`):S.agentId&&o(`/?a=${S.agentId}`)},[o,c]),x=b.useCallback(async()=>{a(null);try{await g4(),await c.invalidateQueries({queryKey:["notifications"]})}catch(S){a(S instanceof Error?S.message:"Failed to mark all as read")}},[c]);return l.jsxs("div",{className:"relative",children:[l.jsxs("button",{type:"button",onClick:()=>t(!e),className:"relative flex items-center justify-center rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",children:[l.jsx(Zz,{className:"h-4 w-4"}),p&&l.jsx("span",{className:"absolute -top-0.5 -right-0.5 flex items-center justify-center rounded-full px-1 font-medium text-label",style:{height:16,minWidth:16,background:"var(--state-error)",color:"var(--bg)"},children:h>99?"99+":h})]}),e&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"fixed inset-0 z-40 cursor-default",onClick:()=>t(!1)}),l.jsxs("div",{ref:s,className:"absolute right-0 top-full mt-1 z-50",style:{width:320,background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:6,boxShadow:"var(--shadow-md)"},children:[l.jsxs("div",{className:"flex items-center justify-between",style:{padding:"var(--sp-2) var(--sp-3)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[l.jsx("span",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:"Notifications"}),p&&l.jsx("button",{type:"button",onClick:x,className:"hover:underline text-body",style:{color:"var(--accent)"},children:"Mark all read"})]}),n&&l.jsx("div",{className:"text-body",style:{padding:"var(--sp-1_5) var(--sp-3)",color:"var(--state-error)",background:"var(--bg-sunken)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:n}),l.jsx("div",{className:"flex flex-col overflow-y-auto",style:{maxHeight:360,padding:8,gap:4},children:!(f!=null&&f.items)||f.items.length===0?l.jsx("div",{className:"text-center text-body",style:{color:"var(--fg-3)",padding:"var(--sp-4_5) 0"},children:"No notifications"}):f.items.map(S=>l.jsx(b4,{notification:S,clickable:!!S.agentId,onClick:()=>g(S)},S.id))})]})]})]})}function w4(){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 S4(){const[e,t]=b.useState(w4);return b.useEffect(()=>{document.documentElement.classList.toggle("dark",e==="dark"),window.localStorage.setItem("theme",e)},[e]),l.jsx("button",{type:"button",onClick:()=>t(e==="dark"?"light":"dark"),"aria-label":e==="dark"?"Switch to light theme":"Switch to dark theme",className:"flex items-center gap-1.5 rounded-md px-2 py-1.5 text-body text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:e==="dark"?l.jsx(RM,{className:"h-4 w-4"}):l.jsx(wM,{className:"h-4 w-4"})})}function k4(e){var n;const t=e.trim();return t?((n=t[0])==null?void 0:n.toUpperCase())??"?":"?"}function S1({src:e,name:t,size:n=28,className:a}){const s=`${n}px`;return e?l.jsx("img",{src:e,alt:t,width:n,height:n,className:a,style:{width:s,height:s,borderRadius:"50%",objectFit:"cover",display:"block"}}):l.jsx("span",{className:a,role:"img","aria-label":t,style:{width:s,height:s,borderRadius:"50%",background:"var(--accent)",color:"var(--bg-raised)",display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1,userSelect:"none"},children:l.jsx("span",{className:"text-subtitle font-semibold",children:k4(t)})})}const k1=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,j1=TE,j4=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return j1(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,c=Object.keys(s).map(h=>{const p=n==null?void 0:n[h],g=o==null?void 0:o[h];if(p===null)return null;const x=k1(p)||k1(g);return s[h][x]}),f=n&&Object.entries(n).reduce((h,p)=>{let[g,x]=p;return x===void 0||(h[g]=x),h},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((h,p)=>{let{class:g,className:x,...w}=p;return Object.entries(w).every(S=>{let[k,j]=S;return Array.isArray(j)?j.includes({...o,...f}[k]):{...o,...f}[k]===j})?[...h,g,x]:h},[]);return j1(e,c,m,n==null?void 0:n.class,n==null?void 0:n.className)},E4=j4("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[var(--radius-input)] text-body font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 px-3 text-label",xs:"h-7 rounded-[var(--radius-chip)] px-2.5 text-label gap-1.5",lg:"h-10 px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ye=b.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...s},o)=>{const c=a?OI:"button";return l.jsx(c,{className:ze(E4({variant:t,size:n,className:e})),ref:o,...s})});ye.displayName="Button";const Ft=b.forwardRef(({className:e,type:t,...n},a)=>l.jsx("input",{type:t,className:ze("flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors file:border-0 file:bg-transparent file:text-body file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...n}));Ft.displayName="Input";function C4({action:e,onClose:t}){const n=e!==null;return l.jsx(On,{open:n,onOpenChange:a=>!a&&t(),children:l.jsxs(Nn,{children:[l.jsxs(Pn,{children:[l.jsx(zn,{children:e==="join"?"Join a team":"Create a new team"}),l.jsx(Lv,{children:e==="join"?"Paste the invite token shared with you.":"You'll be the admin. You can rename or invite teammates afterward."})]}),e==="create"&&l.jsx(_4,{onDone:t}),e==="join"&&l.jsx(T4,{onDone:t})]})})}function N4(e){return e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"team"}function _4({onDone:e}){const{adoptTokens:t}=vt(),n=An(),[a,s]=b.useState(""),[o,c]=b.useState(null),[f,m]=b.useState(!1);b.useEffect(()=>{s(""),c(null),m(!1)},[]);const h=async p=>{p.preventDefault();const g=a.trim();if(g){m(!0),c(null);try{const x=await Ee.post("/me/organizations",{name:N4(g),displayName:g});await t(x.tokens),e(),n("/",{replace:!0})}catch(x){c(x instanceof Error?x.message:"Failed to create team")}finally{m(!1)}}};return l.jsxs("form",{className:"space-y-3",onSubmit:h,children:[o&&l.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:o}),l.jsx(Ft,{id:"team-display-name","aria-label":"Team name",value:a,onChange:p=>s(p.target.value),placeholder:"Acme Robotics",autoFocus:!0}),l.jsx(ye,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Creating…":"Create team"})]})}function T4({onDone:e}){const{adoptTokens:t}=vt(),n=An(),[a,s]=b.useState(""),[o,c]=b.useState(null),[f,m]=b.useState(!1);b.useEffect(()=>{s(""),c(null),m(!1)},[]);const h=async p=>{if(p.preventDefault(),!!a.trim()){m(!0),c(null);try{const g=a.trim(),x=/\/invite\/([^/?#]+)/.exec(g),w=(x==null?void 0:x[1])??g,S=await Ee.post("/me/organizations/join",{token:w});await t(S.tokens),e(),n("/",{replace:!0})}catch(g){c(g instanceof Error?g.message:"Failed to join team")}finally{m(!1)}}};return l.jsxs("form",{className:"space-y-3",onSubmit:h,children:[o&&l.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:o}),l.jsx(Ft,{id:"join-token","aria-label":"Invite token or full URL",value:a,onChange:p=>s(p.target.value),placeholder:"abc123… or https://hub/invite/abc123",autoFocus:!0}),l.jsx(ye,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Joining…":"Join team"})]})}function A4(){var L,O;const{organizationId:e,role:t,user:n,selectOrganization:a,logout:s}=vt(),o=An(),[c,f]=b.useState([]),[m,h]=b.useState(!1),[p,g]=b.useState(null),x=b.useRef(null);b.useEffect(()=>{(async()=>{try{const B=await Ee.get("/me/organizations");f(B)}catch{}})()},[]),b.useEffect(()=>{const B=Y=>{m&&x.current&&!x.current.contains(Y.target)&&h(!1)},I=Y=>{m&&Y.key==="Escape"&&h(!1)};return window.addEventListener("mousedown",B),window.addEventListener("keydown",I),()=>{window.removeEventListener("mousedown",B),window.removeEventListener("keydown",I)}},[m]);const w=(n==null?void 0:n.displayName)??"User",S=(n==null?void 0:n.username)??"",k=(n==null?void 0:n.avatarUrl)??null,j=c.find(B=>B.id===e)??null,C=(j==null?void 0:j.role)??(t==="admin"||t==="member"?t:null),N=async B=>{if(B===e){h(!1);return}try{await a(B),h(!1),o("/",{replace:!0})}catch{}},R=()=>{h(!1),g("create")},M=()=>{h(!1),g("join")};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{ref:x,className:"relative","data-testid":"user-menu",children:[l.jsx("button",{type:"button","aria-label":`User menu, ${w}`,"aria-haspopup":"menu","aria-expanded":m,onClick:()=>h(B=>!B),className:"inline-flex items-center justify-center rounded-full focus:outline-none focus:ring-2 focus:ring-ring transition-shadow",style:{background:"transparent",border:m?"var(--hairline) solid var(--border)":"var(--hairline) solid transparent",padding:1,cursor:"pointer"},children:l.jsx(S1,{src:k,name:w,size:28})}),m&&l.jsxs("div",{role:"menu",className:"absolute right-0 z-30 mt-2 rounded-md border bg-popover shadow-md",style:{width:280},children:[l.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3",style:{borderColor:"var(--border)"},children:[l.jsx(S1,{src:k,name:w,size:32}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-subtitle font-medium truncate",style:{color:"var(--fg)"},children:w}),S&&S!==w&&l.jsxs("div",{className:"text-label text-muted-foreground truncate",children:["@",S]})]})]}),c.length>0&&l.jsxs("div",{className:"border-b py-1",style:{borderColor:"var(--border)"},children:[l.jsx("div",{className:"px-4 py-1 text-eyebrow text-muted-foreground",children:"Current team"}),c.length===1?l.jsxs("div",{className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body",style:{color:"var(--fg)"},children:[l.jsx("span",{style:{width:14,display:"inline-flex"},children:l.jsx(cr,{className:"h-3.5 w-3.5"})}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:(L=c[0])==null?void 0:L.displayName}),l.jsx(E1,{role:((O=c[0])==null?void 0:O.role)??C})]}):l.jsx("div",{children:c.map(B=>l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>void N(B.id),className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[l.jsx("span",{style:{width:14,display:"inline-flex"},children:B.id===e?l.jsx(cr,{className:"h-3.5 w-3.5"}):null}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:B.displayName}),l.jsx(E1,{role:B.role})]},B.id))})]}),l.jsxs("div",{className:"border-b py-1",style:{borderColor:"var(--border)"},children:[l.jsxs("button",{type:"button",role:"menuitem",onClick:R,className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[l.jsx(xa,{className:"h-3.5 w-3.5"}),l.jsx("span",{children:"Create new team"})]}),l.jsxs("button",{type:"button",role:"menuitem",onClick: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:[l.jsx(CE,{className:"h-3.5 w-3.5"}),l.jsx("span",{children:"Join with invite link"})]})]}),l.jsx("div",{className:"py-1",children:l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{h(!1),s()},className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[l.jsx(vM,{className:"h-3.5 w-3.5"}),l.jsx("span",{children:"Sign out"})]})})]})]}),l.jsx(C4,{action:p,onClose:()=>g(null)})]})}function E1({role:e}){return e!=="admin"&&e!=="member"?null:l.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",color:e==="admin"?"var(--accent-dim)":"var(--fg-3)",border:"var(--hairline) solid var(--border)",background:e==="admin"?"var(--accent-bg)":"var(--bg-sunken)"},children:e})}const R4=[{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 O4(){const[e,t]=b.useState(!1),n=Cr(),a=n.pathname==="/"||n.search.includes("a=");return b.useEffect(()=>{const s=o=>{(o.metaKey||o.ctrlKey)&&o.key.toLowerCase()==="k"&&(o.preventDefault(),t(c=>!c))};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[]),l.jsxs("div",{className:"flex flex-col overflow-hidden",style:{height:"100vh",background:"var(--bg)"},children:[l.jsxs("header",{className:"relative shrink-0 grid items-center",style:{height:48,gridTemplateColumns:"1fr auto 1fr",gap:"var(--sp-3)",padding:"0 var(--sp-3)",borderBottom:"var(--hairline) solid var(--border)",background:"var(--bg-raised)"},children:[l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-3_5)",justifySelf:"start",minWidth:0},children:[l.jsxs("span",{className:"flex items-center",style:{gap:10,flexShrink:0},children:[l.jsx(Dc,{width:16,height:18,style:{color:"var(--fg)"}}),l.jsx("span",{className:"text-title",style:{color:"var(--fg)"},children:"First Tree"})]}),l.jsx(h4,{})]}),l.jsx("nav",{className:"flex",style:{gap:2,pointerEvents:"none",justifySelf:"center"},children:R4.map(s=>l.jsx(xv,{to:s.to,end:s.end,style:{pointerEvents:"auto"},className:({isActive:o})=>ze("inline-flex items-center transition-colors",o?"":"hover:text-[var(--fg)]"),children:({isActive:o})=>l.jsxs("span",{className:"inline-flex items-center text-subtitle font-medium",style:{padding:"var(--sp-1_5) var(--sp-3)",gap:6,borderRadius:5,color:o?"var(--fg)":"var(--fg-3)",background:o?"var(--bg-hover)":"transparent"},children:[s.label,o&&l.jsx("span",{className:"kbd",children:s.kbd})]})},s.to))}),l.jsxs("div",{className:"flex items-center",style:{gap:6,justifySelf:"end"},children:[l.jsxs("button",{type:"button",onClick:()=>t(!0),"aria-label":"Open command palette",className:"inline-flex items-center transition-colors text-body",style:{gap:8,padding:"var(--sp-1) var(--sp-2)",color:"var(--fg-3)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)"},onMouseEnter:s=>{s.currentTarget.style.color="var(--fg)"},onMouseLeave:s=>{s.currentTarget.style.color="var(--fg-3)"},children:[l.jsx(ch,{className:"h-4 w-4"}),l.jsx("span",{children:"Jump to…"}),l.jsx("span",{className:"kbd",children:"⌘K"})]}),l.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),l.jsx(x4,{}),l.jsx(S4,{}),l.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),l.jsx(A4,{})]})]}),l.jsx(u4,{open:e,onOpenChange:t}),a?l.jsx(Pf,{}):l.jsx("main",{className:"flex-1 overflow-auto",children:l.jsx("div",{className:"p-6 mx-auto",style:{maxWidth:1280},children:l.jsx(Pf,{})})})]})}const ZC=b.createContext(null),z4=5e3;function M4({children:e}){const[t,n]=b.useState([]),a=b.useCallback(c=>{n(f=>f.filter(m=>m.id!==c))},[]),o={addToast:b.useCallback(c=>{const f=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;n(m=>[...m,{...c,id:f}])},[])};return l.jsxs(ZC.Provider,{value:o,children:[e,l.jsx(D4,{toasts:t,onDismiss:a})]})}function Ic(){const e=b.useContext(ZC);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function D4({toasts:e,onDismiss:t}){return e.length===0?null:l.jsx("div",{style:{position:"fixed",bottom:"var(--sp-4)",right:"var(--sp-4)",zIndex:100,display:"flex",flexDirection:"column",gap:"var(--sp-2)",pointerEvents:"none",maxWidth:380},"aria-live":"polite","aria-atomic":"false",children:e.map(n=>l.jsx(I4,{toast:n,onDismiss:()=>t(n.id)},n.id))})}function I4({toast:e,onDismiss:t}){const n=b.useRef(t);return n.current=t,b.useEffect(()=>{if(e.durationMs===null)return;const a=e.durationMs??z4,s=setTimeout(()=>n.current(),a);return()=>clearTimeout(s)},[e.durationMs]),l.jsxs("div",{role:"status",style:{pointerEvents:"auto",display:"flex",alignItems:"flex-start",gap:"var(--sp-2)",padding:"var(--sp-3) var(--sp-3_5)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",boxShadow:"var(--shadow-md)",animation:"toast-slide-in 180ms ease-out"},children:[l.jsxs("div",{className:"flex-1 min-w-0",style:{display:"flex",flexDirection:"column",gap:"var(--sp-1)"},children:[l.jsx("p",{className:"text-body font-medium",style:{margin:0,color:"var(--fg)"},children:e.title}),e.description?l.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-3)"},children:e.description}):null,e.action?l.jsx("button",{type:"button",onClick:()=>{var a;(a=e.action)==null||a.onClick(),t()},className:"text-label font-medium hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{alignSelf:"flex-start",marginTop:"var(--sp-1)",padding:0,background:"transparent",border:"none",color:"var(--accent)",cursor:"pointer"},children:e.action.label}):null]}),l.jsx("button",{type:"button",onClick:t,"aria-label":"Dismiss",className:"hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{padding:"var(--sp-1)",background:"transparent",border:"none",borderRadius:"var(--radius-input)",cursor:"pointer",color:"var(--fg-4)",flexShrink:0},children:l.jsx(os,{className:"h-4 w-4"})})]})}function ce(e,t,n){function a(f,m){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:m,constr:c,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,m);const h=c.prototype,p=Object.keys(h);for(let g=0;g<p.length;g++){const x=p[g];x in f||(f[x]=h[x].bind(f))}}const s=(n==null?void 0:n.Parent)??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function c(f){var m;const h=n!=null&&n.Parent?new o:this;a(h,f),(m=h._zod).deferred??(m.deferred=[]);for(const p of h._zod.deferred)p();return h}return Object.defineProperty(c,"init",{value:a}),Object.defineProperty(c,Symbol.hasInstance,{value:f=>{var m,h;return n!=null&&n.Parent&&f instanceof n.Parent?!0:(h=(m=f==null?void 0:f._zod)==null?void 0:m.traits)==null?void 0:h.has(e)}}),Object.defineProperty(c,"name",{value:e}),c}class no extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class GC extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const VC={};function ds(e){return VC}function QC(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 Oy(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 Bv(e){return e==null}function Fv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function L4(e,t){const n=(e.toString().split(".")[1]||"").length,a=t.toString();let s=(a.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(a)){const m=a.match(/\d?e-(\d?)/);m!=null&&m[1]&&(s=Number.parseInt(m[1]))}const o=n>s?n:s,c=Number.parseInt(e.toFixed(o).replace(".","")),f=Number.parseInt(t.toFixed(o).replace(".",""));return c%f/10**o}const C1=Symbol("evaluating");function Ct(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==C1)return a===void 0&&(a=C1,a=n()),a},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function nl(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ms(...e){const t={};for(const n of e){const a=Object.getOwnPropertyDescriptors(n);Object.assign(t,a)}return Object.defineProperties({},t)}function N1(e){return JSON.stringify(e)}function P4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const KC="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function dc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const U4=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 xo(e){if(dc(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(dc(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function YC(e){return xo(e)?{...e}:Array.isArray(e)?[...e]:e}const B4=new Set(["string","number","symbol"]);function wo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ps(e,t,n){const a=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(a._zod.parent=e),a}function Le(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function F4(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const $4={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 H4(e,t){const n=e._zod.def,a=n.checks;if(a&&a.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const o=ms(e._zod.def,{get shape(){const c={};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(c[f]=n.shape[f])}return nl(this,"shape",c),c},checks:[]});return ps(e,o)}function q4(e,t){const n=e._zod.def,a=n.checks;if(a&&a.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const o=ms(e._zod.def,{get shape(){const c={...e._zod.def.shape};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete c[f]}return nl(this,"shape",c),c},checks:[]});return ps(e,o)}function Z4(e,t){if(!xo(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const o=e._zod.def.shape;for(const c in t)if(Object.getOwnPropertyDescriptor(o,c)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=ms(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return nl(this,"shape",o),o}});return ps(e,s)}function G4(e,t){if(!xo(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=ms(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return nl(this,"shape",a),a}});return ps(e,n)}function V4(e,t){const n=ms(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return nl(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:[]});return ps(e,n)}function Q4(e,t,n){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const c=ms(t._zod.def,{get shape(){const f=t._zod.def.shape,m={...f};if(n)for(const h in n){if(!(h in f))throw new Error(`Unrecognized key: "${h}"`);n[h]&&(m[h]=e?new e({type:"optional",innerType:f[h]}):f[h])}else for(const h in f)m[h]=e?new e({type:"optional",innerType:f[h]}):f[h];return nl(this,"shape",m),m},checks:[]});return ps(t,c)}function K4(e,t,n){const a=ms(t._zod.def,{get shape(){const s=t._zod.def.shape,o={...s};if(n)for(const c in n){if(!(c in o))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(o[c]=new e({type:"nonoptional",innerType:s[c]}))}else for(const c in s)o[c]=new e({type:"nonoptional",innerType:s[c]});return nl(this,"shape",o),o}});return ps(t,a)}function Xl(e,t=0){var n;if(e.aborted===!0)return!0;for(let a=t;a<e.issues.length;a++)if(((n=e.issues[a])==null?void 0:n.continue)!==!0)return!0;return!1}function Wl(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function mf(e){return typeof e=="string"?e:e==null?void 0:e.message}function fs(e,t,n){var s,o,c,f,m,h;const a={...e,path:e.path??[]};if(!e.message){const p=mf((c=(o=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:o.error)==null?void 0:c.call(o,e))??mf((f=t==null?void 0:t.error)==null?void 0:f.call(t,e))??mf((m=n.customError)==null?void 0:m.call(n,e))??mf((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";a.message=p}return delete a.inst,delete a.continue,t!=null&&t.reportInput||delete a.input,a}function $v(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function fc(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}const XC=(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,Oy,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},WC=ce("$ZodError",XC),JC=ce("$ZodError",XC,{Parent:Error});function Y4(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 X4(e,t=n=>n.message){const n={_errors:[]},a=s=>{for(const o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(c=>a({issues:c}));else if(o.code==="invalid_key")a({issues:o.issues});else if(o.code==="invalid_element")a({issues:o.issues});else if(o.path.length===0)n._errors.push(t(o));else{let c=n,f=0;for(;f<o.path.length;){const m=o.path[f];f===o.path.length-1?(c[m]=c[m]||{_errors:[]},c[m]._errors.push(t(o))):c[m]=c[m]||{_errors:[]},c=c[m],f++}}};return a(e),n}const Hv=e=>(t,n,a,s)=>{const o=a?Object.assign(a,{async:!1}):{async:!1},c=t._zod.run({value:n,issues:[]},o);if(c instanceof Promise)throw new no;if(c.issues.length){const f=new((s==null?void 0:s.Err)??e)(c.issues.map(m=>fs(m,o,ds())));throw KC(f,s==null?void 0:s.callee),f}return c.value},qv=e=>async(t,n,a,s)=>{const o=a?Object.assign(a,{async:!0}):{async:!0};let c=t._zod.run({value:n,issues:[]},o);if(c instanceof Promise&&(c=await c),c.issues.length){const f=new((s==null?void 0:s.Err)??e)(c.issues.map(m=>fs(m,o,ds())));throw KC(f,s==null?void 0:s.callee),f}return c.value},vh=e=>(t,n,a)=>{const s=a?{...a,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw new no;return o.issues.length?{success:!1,error:new(e??WC)(o.issues.map(c=>fs(c,s,ds())))}:{success:!0,data:o.value}},W4=vh(JC),bh=e=>async(t,n,a)=>{const s=a?Object.assign(a,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(c=>fs(c,s,ds())))}:{success:!0,data:o.value}},J4=bh(JC),e5=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Hv(e)(t,n,s)},t5=e=>(t,n,a)=>Hv(e)(t,n,a),n5=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return qv(e)(t,n,s)},r5=e=>async(t,n,a)=>qv(e)(t,n,a),a5=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return vh(e)(t,n,s)},i5=e=>(t,n,a)=>vh(e)(t,n,a),s5=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return bh(e)(t,n,s)},l5=e=>async(t,n,a)=>bh(e)(t,n,a),o5=/^[cC][^\s-]{8,}$/,u5=/^[0-9a-z]+$/,c5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,d5=/^[0-9a-vA-V]{20}$/,f5=/^[A-Za-z0-9]{27}$/,h5=/^[a-zA-Z0-9_-]{21}$/,m5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,p5=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,_1=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,g5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,y5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function v5(){return new RegExp(y5,"u")}const b5=/^(?:(?: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])$/,x5=/^(([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}|:))$/,w5=/^((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])$/,S5=/^(([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])$/,k5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,eN=/^[A-Za-z0-9_-]*$/,j5=/^\+[1-9]\d{6,14}$/,tN="(?:(?:\\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])))",E5=new RegExp(`^${tN}$`);function nN(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 C5(e){return new RegExp(`^${nN(e)}$`)}function N5(e){const t=nN({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(`^${tN}T(?:${a})$`)}const _5=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}$`)},T5=/^-?\d+$/,rN=/^-?\d+(?:\.\d+)?$/,A5=/^(?:true|false)$/i,R5=/^null$/i,O5=/^[^A-Z]*$/,z5=/^[^a-z]*$/,_r=ce("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),aN={number:"number",bigint:"bigint",object:"date"},iN=ce("$ZodCheckLessThan",(e,t)=>{_r.init(e,t);const n=aN[typeof t.value];e._zod.onattach.push(a=>{const s=a._zod.bag,o=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sN=ce("$ZodCheckGreaterThan",(e,t)=>{_r.init(e,t);const n=aN[typeof t.value];e._zod.onattach.push(a=>{const s=a._zod.bag,o=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),M5=ce("$ZodCheckMultipleOf",(e,t)=>{_r.init(e,t),e._zod.onattach.push(n=>{var a;(a=n._zod.bag).multipleOf??(a.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):L4(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})}}),D5=ce("$ZodCheckNumberFormat",(e,t)=>{var c;_r.init(e,t),t.format=t.format||"float64";const n=(c=t.format)==null?void 0:c.includes("int"),a=n?"int":"number",[s,o]=$4[t.format];e._zod.onattach.push(f=>{const m=f._zod.bag;m.format=t.format,m.minimum=s,m.maximum=o,n&&(m.pattern=T5)}),e._zod.check=f=>{const m=f.value;if(n){if(!Number.isInteger(m)){f.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:m,inst:e});return}if(!Number.isSafeInteger(m)){m>0?f.issues.push({input:m,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}):f.issues.push({input:m,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort});return}}m<s&&f.issues.push({origin:"number",input:m,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),m>o&&f.issues.push({origin:"number",input:m,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),I5=ce("$ZodCheckMaxLength",(e,t)=>{var n;_r.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Bv(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const s=a.value;if(s.length<=t.maximum)return;const c=$v(s);a.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),L5=ce("$ZodCheckMinLength",(e,t)=>{var n;_r.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Bv(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const s=a.value;if(s.length>=t.minimum)return;const c=$v(s);a.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),P5=ce("$ZodCheckLengthEquals",(e,t)=>{var n;_r.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Bv(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=a=>{const s=a.value,o=s.length;if(o===t.length)return;const c=$v(s),f=o>t.length;a.issues.push({origin:c,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),xh=ce("$ZodCheckStringFormat",(e,t)=>{var n,a;_r.init(e,t),e._zod.onattach.push(s=>{const o=s._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),U5=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})}}),B5=ce("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=O5),xh.init(e,t)}),F5=ce("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=z5),xh.init(e,t)}),$5=ce("$ZodCheckIncludes",(e,t)=>{_r.init(e,t);const n=wo(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=a,e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(a)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),H5=ce("$ZodCheckStartsWith",(e,t)=>{_r.init(e,t);const n=new RegExp(`^${wo(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:e,continue:!t.abort})}}),q5=ce("$ZodCheckEndsWith",(e,t)=>{_r.init(e,t);const n=new RegExp(`.*${wo(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:e,continue:!t.abort})}}),Z5=ce("$ZodCheckOverwrite",(e,t)=>{_r.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class G5{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const a=t.split(`
|
|
350
|
+
`).filter(c=>c),s=Math.min(...a.map(c=>c.length-c.trimStart().length)),o=a.map(c=>c.slice(s)).map(c=>" ".repeat(this.indent*2)+c);for(const c of o)this.content.push(c)}compile(){const t=Function,n=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(o=>` ${o}`)];return new t(...n,s.join(`
|
|
351
|
+
`))}}const V5={major:4,minor:3,patch:6},Kt=ce("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=V5;const a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const o of a)for(const c of o._zod.onattach)c(e);if(a.length===0)(n=e._zod).deferred??(n.deferred=[]),(s=e._zod.deferred)==null||s.push(()=>{e._zod.run=e._zod.parse});else{const o=(f,m,h)=>{let p=Xl(f),g;for(const x of m){if(x._zod.def.when){if(!x._zod.def.when(f))continue}else if(p)continue;const w=f.issues.length,S=x._zod.check(f);if(S instanceof Promise&&(h==null?void 0:h.async)===!1)throw new no;if(g||S instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await S,f.issues.length!==w&&(p||(p=Xl(f,w)))});else{if(f.issues.length===w)continue;p||(p=Xl(f,w))}}return g?g.then(()=>f):f},c=(f,m,h)=>{if(Xl(f))return f.aborted=!0,f;const p=o(m,a,h);if(p instanceof Promise){if(h.async===!1)throw new no;return p.then(g=>e._zod.parse(g,h))}return e._zod.parse(p,h)};e._zod.run=(f,m)=>{if(m.skipChecks)return e._zod.parse(f,m);if(m.direction==="backward"){const p=e._zod.parse({value:f.value,issues:[]},{...m,skipChecks:!0});return p instanceof Promise?p.then(g=>c(g,f,m)):c(p,f,m)}const h=e._zod.parse(f,m);if(h instanceof Promise){if(m.async===!1)throw new no;return h.then(p=>o(p,a,m))}return o(h,a,m)}}Ct(e,"~standard",()=>({validate:o=>{var c;try{const f=W4(e,o);return f.success?{value:f.data}:{issues:(c=f.error)==null?void 0:c.issues}}catch{return J4(e,o).then(m=>{var h;return m.success?{value:m.data}:{issues:(h=m.error)==null?void 0:h.issues}})}},vendor:"zod",version:1}))}),Zv=ce("$ZodString",(e,t)=>{var n;Kt.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??_5(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}}),Yt=ce("$ZodStringFormat",(e,t)=>{xh.init(e,t),Zv.init(e,t)}),Q5=ce("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=p5),Yt.init(e,t)}),K5=ce("$ZodUUID",(e,t)=>{if(t.version){const a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(a===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=_1(a))}else t.pattern??(t.pattern=_1());Yt.init(e,t)}),Y5=ce("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=g5),Yt.init(e,t)}),X5=ce("$ZodURL",(e,t)=>{Yt.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})}}}),W5=ce("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=v5()),Yt.init(e,t)}),J5=ce("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=h5),Yt.init(e,t)}),eL=ce("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=o5),Yt.init(e,t)}),tL=ce("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=u5),Yt.init(e,t)}),nL=ce("$ZodULID",(e,t)=>{t.pattern??(t.pattern=c5),Yt.init(e,t)}),rL=ce("$ZodXID",(e,t)=>{t.pattern??(t.pattern=d5),Yt.init(e,t)}),aL=ce("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=f5),Yt.init(e,t)}),iL=ce("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=N5(t)),Yt.init(e,t)}),sL=ce("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=E5),Yt.init(e,t)}),lL=ce("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=C5(t)),Yt.init(e,t)}),oL=ce("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=m5),Yt.init(e,t)}),uL=ce("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=b5),Yt.init(e,t),e._zod.bag.format="ipv4"}),cL=ce("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=x5),Yt.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})}}}),dL=ce("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=w5),Yt.init(e,t)}),fL=ce("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=S5),Yt.init(e,t),e._zod.check=n=>{const a=n.value.split("/");try{if(a.length!==2)throw new Error;const[s,o]=a;if(!o)throw new Error;const c=Number(o);if(`${c}`!==o)throw new Error;if(c<0||c>128)throw new Error;new URL(`http://[${s}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function lN(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const hL=ce("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=k5),Yt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{lN(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function mL(e){if(!eN.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return lN(n)}const pL=ce("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=eN),Yt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{mL(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),gL=ce("$ZodE164",(e,t)=>{t.pattern??(t.pattern=j5),Yt.init(e,t)});function yL(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 vL=ce("$ZodJWT",(e,t)=>{Yt.init(e,t),e._zod.check=n=>{yL(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),oN=ce("$ZodNumber",(e,t)=>{Kt.init(e,t),e._zod.pattern=e._zod.bag.pattern??rN,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const o=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...o?{received:o}:{}}),n}}),bL=ce("$ZodNumberFormat",(e,t)=>{D5.init(e,t),oN.init(e,t)}),xL=ce("$ZodBoolean",(e,t)=>{Kt.init(e,t),e._zod.pattern=A5,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}}),wL=ce("$ZodNull",(e,t)=>{Kt.init(e,t),e._zod.pattern=R5,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}}),SL=ce("$ZodUnknown",(e,t)=>{Kt.init(e,t),e._zod.parse=n=>n}),kL=ce("$ZodNever",(e,t)=>{Kt.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function T1(e,t,n){e.issues.length&&t.issues.push(...Wl(n,e.issues)),t.value[n]=e.value}const jL=ce("$ZodArray",(e,t)=>{Kt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const o=[];for(let c=0;c<s.length;c++){const f=s[c],m=t.element._zod.run({value:f,issues:[]},a);m instanceof Promise?o.push(m.then(h=>T1(h,n,c))):T1(m,n,c)}return o.length?Promise.all(o).then(()=>n):n}});function Hf(e,t,n,a,s){if(e.issues.length){if(s&&!(n in a))return;t.issues.push(...Wl(n,e.issues))}e.value===void 0?n in a&&(t.value[n]=void 0):t.value[n]=e.value}function uN(e){var a,s,o,c;const t=Object.keys(e.shape);for(const f of t)if(!((c=(o=(s=(a=e.shape)==null?void 0:a[f])==null?void 0:s._zod)==null?void 0:o.traits)!=null&&c.has("$ZodType")))throw new Error(`Invalid element at key "${f}": expected a Zod schema`);const n=F4(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function cN(e,t,n,a,s,o){const c=[],f=s.keySet,m=s.catchall._zod,h=m.def.type,p=m.optout==="optional";for(const g in t){if(f.has(g))continue;if(h==="never"){c.push(g);continue}const x=m.run({value:t[g],issues:[]},a);x instanceof Promise?e.push(x.then(w=>Hf(w,n,g,t,p))):Hf(x,n,g,t,p)}return c.length&&n.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const EL=ce("$ZodObject",(e,t)=>{Kt.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const f=t.shape;Object.defineProperty(t,"shape",{get:()=>{const m={...f};return Object.defineProperty(t,"shape",{value:m}),m}})}const a=yh(()=>uN(t));Ct(e._zod,"propValues",()=>{const f=t.shape,m={};for(const h in f){const p=f[h]._zod;if(p.values){m[h]??(m[h]=new Set);for(const g of p.values)m[h].add(g)}}return m});const s=dc,o=t.catchall;let c;e._zod.parse=(f,m)=>{c??(c=a.value);const h=f.value;if(!s(h))return f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f;f.value={};const p=[],g=c.shape;for(const x of c.keys){const w=g[x],S=w._zod.optout==="optional",k=w._zod.run({value:h[x],issues:[]},m);k instanceof Promise?p.push(k.then(j=>Hf(j,f,x,h,S))):Hf(k,f,x,h,S)}return o?cN(p,h,f,m,a.value,e):p.length?Promise.all(p).then(()=>f):f}}),CL=ce("$ZodObjectJIT",(e,t)=>{EL.init(e,t);const n=e._zod.parse,a=yh(()=>uN(t)),s=x=>{var R;const w=new G5(["shape","payload","ctx"]),S=a.value,k=M=>{const L=N1(M);return`shape[${L}]._zod.run({ value: input[${L}], issues: [] }, ctx)`};w.write("const input = payload.value;");const j=Object.create(null);let C=0;for(const M of S.keys)j[M]=`key_${C++}`;w.write("const newResult = {};");for(const M of S.keys){const L=j[M],O=N1(M),B=x[M],I=((R=B==null?void 0:B._zod)==null?void 0:R.optout)==="optional";w.write(`const ${L} = ${k(M)};`),I?w.write(`
|
|
352
|
+
if (${L}.issues.length) {
|
|
353
|
+
if (${O} in input) {
|
|
354
|
+
payload.issues = payload.issues.concat(${L}.issues.map(iss => ({
|
|
355
|
+
...iss,
|
|
356
|
+
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
357
|
+
})));
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
if (${L}.value === undefined) {
|
|
362
|
+
if (${O} in input) {
|
|
363
|
+
newResult[${O}] = undefined;
|
|
364
|
+
}
|
|
365
|
+
} else {
|
|
366
|
+
newResult[${O}] = ${L}.value;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
`):w.write(`
|
|
370
|
+
if (${L}.issues.length) {
|
|
371
|
+
payload.issues = payload.issues.concat(${L}.issues.map(iss => ({
|
|
372
|
+
...iss,
|
|
373
|
+
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
374
|
+
})));
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
if (${L}.value === undefined) {
|
|
378
|
+
if (${O} in input) {
|
|
379
|
+
newResult[${O}] = undefined;
|
|
380
|
+
}
|
|
381
|
+
} else {
|
|
382
|
+
newResult[${O}] = ${L}.value;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
`)}w.write("payload.value = newResult;"),w.write("return payload;");const N=w.compile();return(M,L)=>N(x,M,L)};let o;const c=dc,f=!VC.jitless,h=f&&U4.value,p=t.catchall;let g;e._zod.parse=(x,w)=>{g??(g=a.value);const S=x.value;return c(S)?f&&h&&(w==null?void 0:w.async)===!1&&w.jitless!==!0?(o||(o=s(t.shape)),x=o(x,w),p?cN([],S,x,w,g,e):x):n(x,w):(x.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),x)}});function A1(e,t,n,a){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const s=e.filter(o=>!Xl(o));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(c=>fs(c,a,ds())))}),t)}const dN=ce("$ZodUnion",(e,t)=>{Kt.init(e,t),Ct(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),Ct(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),Ct(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),Ct(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${s.map(o=>Fv(o.source)).join("|")})$`)}});const n=t.options.length===1,a=t.options[0]._zod.run;e._zod.parse=(s,o)=>{if(n)return a(s,o);let c=!1;const f=[];for(const m of t.options){const h=m._zod.run({value:s.value,issues:[]},o);if(h instanceof Promise)f.push(h),c=!0;else{if(h.issues.length===0)return h;f.push(h)}}return c?Promise.all(f).then(m=>A1(m,s,e,o)):A1(f,s,e,o)}}),NL=ce("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,dN.init(e,t);const n=e._zod.parse;Ct(e._zod,"propValues",()=>{const s={};for(const o of t.options){const c=o._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const[f,m]of Object.entries(c)){s[f]||(s[f]=new Set);for(const h of m)s[f].add(h)}}return s});const a=yh(()=>{var c;const s=t.options,o=new Map;for(const f of s){const m=(c=f._zod.propValues)==null?void 0:c[t.discriminator];if(!m||m.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(f)}"`);for(const h of m){if(o.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);o.set(h,f)}}return o});e._zod.parse=(s,o)=>{const c=s.value;if(!dc(c))return s.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),s;const f=a.value.get(c==null?void 0:c[t.discriminator]);return f?f._zod.run(s,o):t.unionFallback?n(s,o):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:c,path:[t.discriminator],inst:e}),s)}}),_L=ce("$ZodIntersection",(e,t)=>{Kt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value,o=t.left._zod.run({value:s,issues:[]},a),c=t.right._zod.run({value:s,issues:[]},a);return o instanceof Promise||c instanceof Promise?Promise.all([o,c]).then(([m,h])=>R1(n,m,h)):R1(n,o,c)}});function zy(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(xo(e)&&xo(t)){const n=Object.keys(t),a=Object.keys(e).filter(o=>n.indexOf(o)!==-1),s={...e,...t};for(const o of a){const c=zy(e[o],t[o]);if(!c.valid)return{valid:!1,mergeErrorPath:[o,...c.mergeErrorPath]};s[o]=c.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let a=0;a<e.length;a++){const s=e[a],o=t[a],c=zy(s,o);if(!c.valid)return{valid:!1,mergeErrorPath:[a,...c.mergeErrorPath]};n.push(c.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function R1(e,t,n){const a=new Map;let s;for(const f of t.issues)if(f.code==="unrecognized_keys"){s??(s=f);for(const m of f.keys)a.has(m)||a.set(m,{}),a.get(m).l=!0}else e.issues.push(f);for(const f of n.issues)if(f.code==="unrecognized_keys")for(const m of f.keys)a.has(m)||a.set(m,{}),a.get(m).r=!0;else e.issues.push(f);const o=[...a].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(o.length&&s&&e.issues.push({...s,keys:o}),Xl(e))return e;const c=zy(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 TL=ce("$ZodRecord",(e,t)=>{Kt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value;if(!xo(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;const o=[],c=t.keyType._zod.values;if(c){n.value={};const f=new Set;for(const h of c)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){f.add(typeof h=="number"?h.toString():h);const p=t.valueType._zod.run({value:s[h],issues:[]},a);p instanceof Promise?o.push(p.then(g=>{g.issues.length&&n.issues.push(...Wl(h,g.issues)),n.value[h]=g.value})):(p.issues.length&&n.issues.push(...Wl(h,p.issues)),n.value[h]=p.value)}let m;for(const h in s)f.has(h)||(m=m??[],m.push(h));m&&m.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:m})}else{n.value={};for(const f of Reflect.ownKeys(s)){if(f==="__proto__")continue;let m=t.keyType._zod.run({value:f,issues:[]},a);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&rN.test(f)&&m.issues.length){const g=t.keyType._zod.run({value:Number(f),issues:[]},a);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(m=g)}if(m.issues.length){t.mode==="loose"?n.value[f]=s[f]:n.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map(g=>fs(g,a,ds())),input:f,path:[f],inst:e});continue}const p=t.valueType._zod.run({value:s[f],issues:[]},a);p instanceof Promise?o.push(p.then(g=>{g.issues.length&&n.issues.push(...Wl(f,g.issues)),n.value[m.value]=g.value})):(p.issues.length&&n.issues.push(...Wl(f,p.issues)),n.value[m.value]=p.value)}}return o.length?Promise.all(o).then(()=>n):n}}),AL=ce("$ZodEnum",(e,t)=>{Kt.init(e,t);const n=QC(t.entries),a=new Set(n);e._zod.values=a,e._zod.pattern=new RegExp(`^(${n.filter(s=>B4.has(typeof s)).map(s=>typeof s=="string"?wo(s):s.toString()).join("|")})$`),e._zod.parse=(s,o)=>{const c=s.value;return a.has(c)||s.issues.push({code:"invalid_value",values:n,input:c,inst:e}),s}}),RL=ce("$ZodLiteral",(e,t)=>{if(Kt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(a=>typeof a=="string"?wo(a):a?wo(a.toString()):String(a)).join("|")})$`),e._zod.parse=(a,s)=>{const o=a.value;return n.has(o)||a.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),a}}),OL=ce("$ZodTransform",(e,t)=>{Kt.init(e,t),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new GC(e.constructor.name);const s=t.transform(n.value,n);if(a.async)return(s instanceof Promise?s:Promise.resolve(s)).then(c=>(n.value=c,n));if(s instanceof Promise)throw new no;return n.value=s,n}});function O1(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const fN=ce("$ZodOptional",(e,t)=>{Kt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ct(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ct(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Fv(n.source)})?$`):void 0}),e._zod.parse=(n,a)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>O1(o,n.value)):O1(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,a)}}),zL=ce("$ZodExactOptional",(e,t)=>{fN.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)=>{Kt.init(e,t),Ct(e._zod,"optin",()=>t.innerType._zod.optin),Ct(e._zod,"optout",()=>t.innerType._zod.optout),Ct(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Fv(n.source)}|null)$`):void 0}),Ct(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,a)=>n.value===null?n:t.innerType._zod.run(n,a)}),DL=ce("$ZodDefault",(e,t)=>{Kt.init(e,t),e._zod.optin="optional",Ct(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>z1(o,t)):z1(s,t)}});function z1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const IL=ce("$ZodPrefault",(e,t)=>{Kt.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))}),LL=ce("$ZodNonOptional",(e,t)=>{Kt.init(e,t),Ct(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(a=>a!==void 0)):void 0}),e._zod.parse=(n,a)=>{const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>M1(o,e)):M1(s,e)}});function M1(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const PL=ce("$ZodCatch",(e,t)=>{Kt.init(e,t),Ct(e._zod,"optin",()=>t.innerType._zod.optin),Ct(e._zod,"optout",()=>t.innerType._zod.optout),Ct(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(c=>fs(c,a,ds()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(o=>fs(o,a,ds()))},input:n.value}),n.issues=[]),n)}}),UL=ce("$ZodPipe",(e,t)=>{Kt.init(e,t),Ct(e._zod,"values",()=>t.in._zod.values),Ct(e._zod,"optin",()=>t.in._zod.optin),Ct(e._zod,"optout",()=>t.out._zod.optout),Ct(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,a)=>{if(a.direction==="backward"){const o=t.out._zod.run(n,a);return o instanceof Promise?o.then(c=>pf(c,t.in,a)):pf(o,t.in,a)}const s=t.in._zod.run(n,a);return s instanceof Promise?s.then(o=>pf(o,t.out,a)):pf(s,t.out,a)}});function pf(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const BL=ce("$ZodReadonly",(e,t)=>{Kt.init(e,t),Ct(e._zod,"propValues",()=>t.innerType._zod.propValues),Ct(e._zod,"values",()=>t.innerType._zod.values),Ct(e._zod,"optin",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optin}),Ct(e._zod,"optout",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optout}),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(D1):D1(s)}});function D1(e){return e.value=Object.freeze(e.value),e}const FL=ce("$ZodCustom",(e,t)=>{_r.init(e,t),Kt.init(e,t),e._zod.parse=(n,a)=>n,e._zod.check=n=>{const a=n.value,s=t.fn(a);if(s instanceof Promise)return s.then(o=>I1(o,n,a,e));I1(s,n,a,e)}});function I1(e,t,n,a){if(!e){const s={code:"custom",input:n,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(s.params=a._zod.def.params),t.issues.push(fc(s))}}var L1;class $L{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 HL(){return new $L}(L1=globalThis).__zod_globalRegistry??(L1.__zod_globalRegistry=HL());const Yu=globalThis.__zod_globalRegistry;function qL(e,t){return new e({type:"string",...Le(t)})}function ZL(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Le(t)})}function P1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Le(t)})}function GL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Le(t)})}function VL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Le(t)})}function QL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Le(t)})}function KL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Le(t)})}function YL(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Le(t)})}function XL(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Le(t)})}function WL(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Le(t)})}function JL(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Le(t)})}function eP(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Le(t)})}function tP(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Le(t)})}function nP(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Le(t)})}function rP(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Le(t)})}function aP(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Le(t)})}function iP(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Le(t)})}function sP(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Le(t)})}function lP(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Le(t)})}function oP(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Le(t)})}function uP(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Le(t)})}function cP(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Le(t)})}function dP(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Le(t)})}function fP(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Le(t)})}function hP(e,t){return new e({type:"string",format:"date",check:"string_format",...Le(t)})}function mP(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Le(t)})}function pP(e,t){return new e({type:"string",format:"duration",check:"string_format",...Le(t)})}function gP(e,t){return new e({type:"number",checks:[],...Le(t)})}function yP(e,t){return new e({type:"number",coerce:!0,checks:[],...Le(t)})}function vP(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Le(t)})}function bP(e,t){return new e({type:"boolean",...Le(t)})}function xP(e,t){return new e({type:"null",...Le(t)})}function wP(e){return new e({type:"unknown"})}function SP(e,t){return new e({type:"never",...Le(t)})}function U1(e,t){return new iN({check:"less_than",...Le(t),value:e,inclusive:!1})}function mg(e,t){return new iN({check:"less_than",...Le(t),value:e,inclusive:!0})}function B1(e,t){return new sN({check:"greater_than",...Le(t),value:e,inclusive:!1})}function pg(e,t){return new sN({check:"greater_than",...Le(t),value:e,inclusive:!0})}function F1(e,t){return new M5({check:"multiple_of",...Le(t),value:e})}function hN(e,t){return new I5({check:"max_length",...Le(t),maximum:e})}function qf(e,t){return new L5({check:"min_length",...Le(t),minimum:e})}function mN(e,t){return new P5({check:"length_equals",...Le(t),length:e})}function kP(e,t){return new U5({check:"string_format",format:"regex",...Le(t),pattern:e})}function jP(e){return new B5({check:"string_format",format:"lowercase",...Le(e)})}function EP(e){return new F5({check:"string_format",format:"uppercase",...Le(e)})}function CP(e,t){return new $5({check:"string_format",format:"includes",...Le(t),includes:e})}function NP(e,t){return new H5({check:"string_format",format:"starts_with",...Le(t),prefix:e})}function _P(e,t){return new q5({check:"string_format",format:"ends_with",...Le(t),suffix:e})}function Ao(e){return new Z5({check:"overwrite",tx:e})}function TP(e){return Ao(t=>t.normalize(e))}function AP(){return Ao(e=>e.trim())}function RP(){return Ao(e=>e.toLowerCase())}function OP(){return Ao(e=>e.toUpperCase())}function zP(){return Ao(e=>P4(e))}function MP(e,t,n){return new e({type:"array",element:t,...Le(n)})}function DP(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Le(n)})}function IP(e){const t=LP(n=>(n.addIssue=a=>{if(typeof a=="string")n.issues.push(fc(a,n.value,t._zod.def));else{const s=a;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),n.issues.push(fc(s))}},e(n.value,n)));return t}function LP(e,t){const n=new _r({check:"custom",...Le(t)});return n._zod.check=e,n}function pN(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Yu,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function jn(e,t,n={path:[],schemaPath:[]}){var p,g;var a;const s=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const c={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,c);const f=(g=(p=e._zod).toJSONSchema)==null?void 0:g.call(p);if(f)c.schema=f;else{const x={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,x);else{const S=c.schema,k=t.processors[s.type];if(!k)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);k(e,t,S,x)}const w=e._zod.parent;w&&(c.ref||(c.ref=w),jn(w,t,x),t.seen.get(w).isParent=!0)}const m=t.metadataRegistry.get(e);return m&&Object.assign(c.schema,m),t.io==="input"&&ir(e)&&(delete c.schema.examples,delete c.schema.default),t.io==="input"&&c.schema._prefault&&((a=c.schema).default??(a.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}function gN(e,t){var c,f,m,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=new Map;for(const p of e.seen.entries()){const g=(c=e.metadataRegistry.get(p[0]))==null?void 0:c.id;if(g){const x=a.get(g);if(x&&x!==p[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(g,p[0])}}const s=p=>{var k;const g=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const j=(k=e.external.registry.get(p[0]))==null?void 0:k.id,C=e.external.uri??(R=>R);if(j)return{ref:C(j)};const N=p[1].defId??p[1].schema.id??`schema${e.counter++}`;return p[1].defId=N,{defId:N,ref:`${C("__shared")}#/${g}/${N}`}}if(p[1]===n)return{ref:"#"};const w=`#/${g}/`,S=p[1].schema.id??`__schema${e.counter++}`;return{defId:S,ref:w+S}},o=p=>{if(p[1].schema.$ref)return;const g=p[1],{ref:x,defId:w}=s(p);g.def={...g.schema},w&&(g.defId=w);const S=g.schema;for(const k in S)delete S[k];S.$ref=x};if(e.cycles==="throw")for(const p of e.seen.entries()){const g=p[1];if(g.cycle)throw new Error(`Cycle detected: #/${(f=g.cycle)==null?void 0:f.join("/")}/<root>
|
|
386
|
+
|
|
387
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const p of e.seen.entries()){const g=p[1];if(t===p[0]){o(p);continue}if(e.external){const w=(m=e.external.registry.get(p[0]))==null?void 0:m.id;if(t!==p[0]&&w){o(p);continue}}if((h=e.metadataRegistry.get(p[0]))==null?void 0:h.id){o(p);continue}if(g.cycle){o(p);continue}if(g.count>1&&e.reused==="ref"){o(p);continue}}}function yN(e,t){var c,f,m;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=h=>{const p=e.seen.get(h);if(p.ref===null)return;const g=p.def??p.schema,x={...g},w=p.ref;if(p.ref=null,w){a(w);const k=e.seen.get(w),j=k.schema;if(j.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(j)):Object.assign(g,j),Object.assign(g,x),h._zod.parent===w)for(const N in g)N==="$ref"||N==="allOf"||N in x||delete g[N];if(j.$ref&&k.def)for(const N in g)N==="$ref"||N==="allOf"||N in k.def&&JSON.stringify(g[N])===JSON.stringify(k.def[N])&&delete g[N]}const S=h._zod.parent;if(S&&S!==w){a(S);const k=e.seen.get(S);if(k!=null&&k.schema.$ref&&(g.$ref=k.schema.$ref,k.def))for(const j in g)j==="$ref"||j==="allOf"||j in k.def&&JSON.stringify(g[j])===JSON.stringify(k.def[j])&&delete g[j]}e.override({zodSchema:h,jsonSchema:g,path:p.path??[]})};for(const h of[...e.seen.entries()].reverse())a(h[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,(c=e.external)!=null&&c.uri){const h=(f=e.external.registry.get(t))==null?void 0:f.id;if(!h)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(h)}Object.assign(s,n.def??n.schema);const o=((m=e.external)==null?void 0:m.defs)??{};for(const h of e.seen.entries()){const p=h[1];p.def&&p.defId&&(o[p.defId]=p.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const h=JSON.parse(JSON.stringify(s));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input:Zf(t,"input",e.processors),output:Zf(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function ir(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return ir(a.element,n);if(a.type==="set")return ir(a.valueType,n);if(a.type==="lazy")return ir(a.getter(),n);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault")return ir(a.innerType,n);if(a.type==="intersection")return ir(a.left,n)||ir(a.right,n);if(a.type==="record"||a.type==="map")return ir(a.keyType,n)||ir(a.valueType,n);if(a.type==="pipe")return ir(a.in,n)||ir(a.out,n);if(a.type==="object"){for(const s in a.shape)if(ir(a.shape[s],n))return!0;return!1}if(a.type==="union"){for(const s of a.options)if(ir(s,n))return!0;return!1}if(a.type==="tuple"){for(const s of a.items)if(ir(s,n))return!0;return!!(a.rest&&ir(a.rest,n))}return!1}const PP=(e,t={})=>n=>{const a=pN({...n,processors:t});return jn(e,a),gN(a,e),yN(a,e)},Zf=(e,t,n={})=>a=>{const{libraryOptions:s,target:o}=a??{},c=pN({...s??{},target:o,io:t,processors:n});return jn(e,c),gN(c,e),yN(c,e)},UP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},BP=(e,t,n,a)=>{const s=n;s.type="string";const{minimum:o,maximum:c,format:f,patterns:m,contentEncoding:h}=e._zod.bag;if(typeof o=="number"&&(s.minLength=o),typeof c=="number"&&(s.maxLength=c),f&&(s.format=UP[f]??f,s.format===""&&delete s.format,f==="time"&&delete s.format),h&&(s.contentEncoding=h),m&&m.size>0){const p=[...m];p.length===1?s.pattern=p[0].source:p.length>1&&(s.allOf=[...p.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},FP=(e,t,n,a)=>{const s=n,{minimum:o,maximum:c,format:f,multipleOf:m,exclusiveMaximum:h,exclusiveMinimum:p}=e._zod.bag;typeof f=="string"&&f.includes("int")?s.type="integer":s.type="number",typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.minimum=p,s.exclusiveMinimum=!0):s.exclusiveMinimum=p),typeof o=="number"&&(s.minimum=o,typeof p=="number"&&t.target!=="draft-04"&&(p>=o?delete s.minimum:delete s.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.maximum=h,s.exclusiveMaximum=!0):s.exclusiveMaximum=h),typeof c=="number"&&(s.maximum=c,typeof h=="number"&&t.target!=="draft-04"&&(h<=c?delete s.maximum:delete s.exclusiveMaximum)),typeof m=="number"&&(s.multipleOf=m)},$P=(e,t,n,a)=>{n.type="boolean"},HP=(e,t,n,a)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},qP=(e,t,n,a)=>{n.not={}},ZP=(e,t,n,a)=>{},GP=(e,t,n,a)=>{const s=e._zod.def,o=QC(s.entries);o.every(c=>typeof c=="number")&&(n.type="number"),o.every(c=>typeof c=="string")&&(n.type="string"),n.enum=o},VP=(e,t,n,a)=>{const s=e._zod.def,o=[];for(const c of s.values)if(c===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof c=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(c))}else o.push(c);if(o.length!==0)if(o.length===1){const c=o[0];n.type=c===null?"null":typeof c,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[c]:n.const=c}else o.every(c=>typeof c=="number")&&(n.type="number"),o.every(c=>typeof c=="string")&&(n.type="string"),o.every(c=>typeof c=="boolean")&&(n.type="boolean"),o.every(c=>c===null)&&(n.type="null"),n.enum=o},QP=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},KP=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},YP=(e,t,n,a)=>{const s=n,o=e._zod.def,{minimum:c,maximum:f}=e._zod.bag;typeof c=="number"&&(s.minItems=c),typeof f=="number"&&(s.maxItems=f),s.type="array",s.items=jn(o.element,t,{...a,path:[...a.path,"items"]})},XP=(e,t,n,a)=>{var h;const s=n,o=e._zod.def;s.type="object",s.properties={};const c=o.shape;for(const p in c)s.properties[p]=jn(c[p],t,{...a,path:[...a.path,"properties",p]});const f=new Set(Object.keys(c)),m=new Set([...f].filter(p=>{const g=o.shape[p]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));m.size>0&&(s.required=Array.from(m)),((h=o.catchall)==null?void 0:h._zod.def.type)==="never"?s.additionalProperties=!1:o.catchall?o.catchall&&(s.additionalProperties=jn(o.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},WP=(e,t,n,a)=>{const s=e._zod.def,o=s.inclusive===!1,c=s.options.map((f,m)=>jn(f,t,{...a,path:[...a.path,o?"oneOf":"anyOf",m]}));o?n.oneOf=c:n.anyOf=c},JP=(e,t,n,a)=>{const s=e._zod.def,o=jn(s.left,t,{...a,path:[...a.path,"allOf",0]}),c=jn(s.right,t,{...a,path:[...a.path,"allOf",1]}),f=h=>"allOf"in h&&Object.keys(h).length===1,m=[...f(o)?o.allOf:[o],...f(c)?c.allOf:[c]];n.allOf=m},eU=(e,t,n,a)=>{const s=n,o=e._zod.def;s.type="object";const c=o.keyType,f=c._zod.bag,m=f==null?void 0:f.patterns;if(o.mode==="loose"&&m&&m.size>0){const p=jn(o.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});s.patternProperties={};for(const g of m)s.patternProperties[g.source]=p}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(s.propertyNames=jn(o.keyType,t,{...a,path:[...a.path,"propertyNames"]})),s.additionalProperties=jn(o.valueType,t,{...a,path:[...a.path,"additionalProperties"]});const h=c._zod.values;if(h){const p=[...h].filter(g=>typeof g=="string"||typeof g=="number");p.length>0&&(s.required=p)}},tU=(e,t,n,a)=>{const s=e._zod.def,o=jn(s.innerType,t,a),c=t.seen.get(e);t.target==="openapi-3.0"?(c.ref=s.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},nU=(e,t,n,a)=>{const s=e._zod.def;jn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType},rU=(e,t,n,a)=>{const s=e._zod.def;jn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},aU=(e,t,n,a)=>{const s=e._zod.def;jn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},iU=(e,t,n,a)=>{const s=e._zod.def;jn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType;let c;try{c=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=c},sU=(e,t,n,a)=>{const s=e._zod.def,o=t.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;jn(o,t,a);const c=t.seen.get(e);c.ref=o},lU=(e,t,n,a)=>{const s=e._zod.def;jn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,n.readOnly=!0},vN=(e,t,n,a)=>{const s=e._zod.def;jn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType},oU=ce("ZodISODateTime",(e,t)=>{iL.init(e,t),tn.init(e,t)});function uU(e){return fP(oU,e)}const cU=ce("ZodISODate",(e,t)=>{sL.init(e,t),tn.init(e,t)});function dU(e){return hP(cU,e)}const fU=ce("ZodISOTime",(e,t)=>{lL.init(e,t),tn.init(e,t)});function hU(e){return mP(fU,e)}const mU=ce("ZodISODuration",(e,t)=>{oL.init(e,t),tn.init(e,t)});function pU(e){return pP(mU,e)}const gU=(e,t)=>{WC.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>X4(e,n)},flatten:{value:n=>Y4(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Oy,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Oy,2)}},isEmpty:{get(){return e.issues.length===0}}})},oa=ce("ZodError",gU,{Parent:Error}),yU=Hv(oa),vU=qv(oa),bU=vh(oa),xU=bh(oa),wU=e5(oa),SU=t5(oa),kU=n5(oa),jU=r5(oa),EU=a5(oa),CU=i5(oa),NU=s5(oa),_U=l5(oa),Xt=ce("ZodType",(e,t)=>(Kt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Zf(e,"input"),output:Zf(e,"output")}}),e.toJSONSchema=PP(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(ms(t,{checks:[...t.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0}),e.with=e.check,e.clone=(n,a)=>ps(e,n,a),e.brand=()=>e,e.register=((n,a)=>(n.add(e,a),e)),e.parse=(n,a)=>yU(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>bU(e,n,a),e.parseAsync=async(n,a)=>vU(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>xU(e,n,a),e.spa=e.safeParseAsync,e.encode=(n,a)=>wU(e,n,a),e.decode=(n,a)=>SU(e,n,a),e.encodeAsync=async(n,a)=>kU(e,n,a),e.decodeAsync=async(n,a)=>jU(e,n,a),e.safeEncode=(n,a)=>EU(e,n,a),e.safeDecode=(n,a)=>CU(e,n,a),e.safeEncodeAsync=async(n,a)=>NU(e,n,a),e.safeDecodeAsync=async(n,a)=>_U(e,n,a),e.refine=(n,a)=>e.check(S6(n,a)),e.superRefine=n=>e.check(k6(n)),e.overwrite=n=>e.check(Ao(n)),e.optional=()=>q1(e),e.exactOptional=()=>u6(e),e.nullable=()=>Z1(e),e.nullish=()=>q1(Z1(e)),e.nonoptional=n=>p6(e,n),e.array=()=>yt(e),e.or=n=>wh([e,n]),e.and=n=>a6(e,n),e.transform=n=>Dy(e,wN(n)),e.default=n=>f6(e,n),e.prefault=n=>m6(e,n),e.catch=n=>y6(e,n),e.pipe=n=>Dy(e,n),e.readonly=()=>x6(e),e.describe=n=>{const a=e.clone();return Yu.add(a,{description:n}),a},Object.defineProperty(e,"description",{get(){var n;return(n=Yu.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Yu.get(e);const a=e.clone();return Yu.add(a,n[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),bN=ce("_ZodString",(e,t)=>{Zv.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>BP(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(kP(...a)),e.includes=(...a)=>e.check(CP(...a)),e.startsWith=(...a)=>e.check(NP(...a)),e.endsWith=(...a)=>e.check(_P(...a)),e.min=(...a)=>e.check(qf(...a)),e.max=(...a)=>e.check(hN(...a)),e.length=(...a)=>e.check(mN(...a)),e.nonempty=(...a)=>e.check(qf(1,...a)),e.lowercase=a=>e.check(jP(a)),e.uppercase=a=>e.check(EP(a)),e.trim=()=>e.check(AP()),e.normalize=(...a)=>e.check(TP(...a)),e.toLowerCase=()=>e.check(RP()),e.toUpperCase=()=>e.check(OP()),e.slugify=()=>e.check(zP())}),TU=ce("ZodString",(e,t)=>{Zv.init(e,t),bN.init(e,t),e.email=n=>e.check(ZL(AU,n)),e.url=n=>e.check(YL(RU,n)),e.jwt=n=>e.check(dP(GU,n)),e.emoji=n=>e.check(XL(OU,n)),e.guid=n=>e.check(P1($1,n)),e.uuid=n=>e.check(GL(gf,n)),e.uuidv4=n=>e.check(VL(gf,n)),e.uuidv6=n=>e.check(QL(gf,n)),e.uuidv7=n=>e.check(KL(gf,n)),e.nanoid=n=>e.check(WL(zU,n)),e.guid=n=>e.check(P1($1,n)),e.cuid=n=>e.check(JL(MU,n)),e.cuid2=n=>e.check(eP(DU,n)),e.ulid=n=>e.check(tP(IU,n)),e.base64=n=>e.check(oP(HU,n)),e.base64url=n=>e.check(uP(qU,n)),e.xid=n=>e.check(nP(LU,n)),e.ksuid=n=>e.check(rP(PU,n)),e.ipv4=n=>e.check(aP(UU,n)),e.ipv6=n=>e.check(iP(BU,n)),e.cidrv4=n=>e.check(sP(FU,n)),e.cidrv6=n=>e.check(lP($U,n)),e.e164=n=>e.check(cP(ZU,n)),e.datetime=n=>e.check(uU(n)),e.date=n=>e.check(dU(n)),e.time=n=>e.check(hU(n)),e.duration=n=>e.check(pU(n))});function _(e){return qL(TU,e)}const tn=ce("ZodStringFormat",(e,t)=>{Yt.init(e,t),bN.init(e,t)}),AU=ce("ZodEmail",(e,t)=>{Y5.init(e,t),tn.init(e,t)}),$1=ce("ZodGUID",(e,t)=>{Q5.init(e,t),tn.init(e,t)}),gf=ce("ZodUUID",(e,t)=>{K5.init(e,t),tn.init(e,t)}),RU=ce("ZodURL",(e,t)=>{X5.init(e,t),tn.init(e,t)}),OU=ce("ZodEmoji",(e,t)=>{W5.init(e,t),tn.init(e,t)}),zU=ce("ZodNanoID",(e,t)=>{J5.init(e,t),tn.init(e,t)}),MU=ce("ZodCUID",(e,t)=>{eL.init(e,t),tn.init(e,t)}),DU=ce("ZodCUID2",(e,t)=>{tL.init(e,t),tn.init(e,t)}),IU=ce("ZodULID",(e,t)=>{nL.init(e,t),tn.init(e,t)}),LU=ce("ZodXID",(e,t)=>{rL.init(e,t),tn.init(e,t)}),PU=ce("ZodKSUID",(e,t)=>{aL.init(e,t),tn.init(e,t)}),UU=ce("ZodIPv4",(e,t)=>{uL.init(e,t),tn.init(e,t)}),BU=ce("ZodIPv6",(e,t)=>{cL.init(e,t),tn.init(e,t)}),FU=ce("ZodCIDRv4",(e,t)=>{dL.init(e,t),tn.init(e,t)}),$U=ce("ZodCIDRv6",(e,t)=>{fL.init(e,t),tn.init(e,t)}),HU=ce("ZodBase64",(e,t)=>{hL.init(e,t),tn.init(e,t)}),qU=ce("ZodBase64URL",(e,t)=>{pL.init(e,t),tn.init(e,t)}),ZU=ce("ZodE164",(e,t)=>{gL.init(e,t),tn.init(e,t)}),GU=ce("ZodJWT",(e,t)=>{vL.init(e,t),tn.init(e,t)}),Gv=ce("ZodNumber",(e,t)=>{oN.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>FP(e,a,s),e.gt=(a,s)=>e.check(B1(a,s)),e.gte=(a,s)=>e.check(pg(a,s)),e.min=(a,s)=>e.check(pg(a,s)),e.lt=(a,s)=>e.check(U1(a,s)),e.lte=(a,s)=>e.check(mg(a,s)),e.max=(a,s)=>e.check(mg(a,s)),e.int=a=>e.check(H1(a)),e.safe=a=>e.check(H1(a)),e.positive=a=>e.check(B1(0,a)),e.nonnegative=a=>e.check(pg(0,a)),e.negative=a=>e.check(U1(0,a)),e.nonpositive=a=>e.check(mg(0,a)),e.multipleOf=(a,s)=>e.check(F1(a,s)),e.step=(a,s)=>e.check(F1(a,s)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function qe(e){return gP(Gv,e)}const VU=ce("ZodNumberFormat",(e,t)=>{bL.init(e,t),Gv.init(e,t)});function H1(e){return vP(VU,e)}const QU=ce("ZodBoolean",(e,t)=>{xL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>$P(e,n,a)});function Zn(e){return bP(QU,e)}const KU=ce("ZodNull",(e,t)=>{wL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>HP(e,n,a)});function YU(e){return xP(KU,e)}const XU=ce("ZodUnknown",(e,t)=>{SL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>ZP()});function en(){return wP(XU)}const WU=ce("ZodNever",(e,t)=>{kL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>qP(e,n,a)});function JU(e){return SP(WU,e)}const e6=ce("ZodArray",(e,t)=>{jL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>YP(e,n,a,s),e.element=t.element,e.min=(n,a)=>e.check(qf(n,a)),e.nonempty=n=>e.check(qf(1,n)),e.max=(n,a)=>e.check(hN(n,a)),e.length=(n,a)=>e.check(mN(n,a)),e.unwrap=()=>e.element});function yt(e,t){return MP(e6,e,t)}const t6=ce("ZodObject",(e,t)=>{CL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>XP(e,n,a,s),Ct(e,"shape",()=>t.shape),e.keyof=()=>Be(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:en()}),e.loose=()=>e.clone({...e._zod.def,catchall:en()}),e.strict=()=>e.clone({...e._zod.def,catchall:JU()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Z4(e,n),e.safeExtend=n=>G4(e,n),e.merge=n=>V4(e,n),e.pick=n=>H4(e,n),e.omit=n=>q4(e,n),e.partial=(...n)=>Q4(SN,e,n[0]),e.required=(...n)=>K4(kN,e,n[0])});function se(e,t){const n={type:"object",shape:e??{},...Le(t)};return new t6(n)}const xN=ce("ZodUnion",(e,t)=>{dN.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>WP(e,n,a,s),e.options=t.options});function wh(e,t){return new xN({type:"union",options:e,...Le(t)})}const n6=ce("ZodDiscriminatedUnion",(e,t)=>{xN.init(e,t),NL.init(e,t)});function Sh(e,t,n){return new n6({type:"union",options:t,discriminator:e,...Le(n)})}const r6=ce("ZodIntersection",(e,t)=>{_L.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>JP(e,n,a,s)});function a6(e,t){return new r6({type:"intersection",left:e,right:t})}const i6=ce("ZodRecord",(e,t)=>{TL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>eU(e,n,a,s),e.keyType=t.keyType,e.valueType=t.valueType});function un(e,t,n){return new i6({type:"record",keyType:e,valueType:t,...Le(n)})}const My=ce("ZodEnum",(e,t)=>{AL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>GP(e,a,s),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(a,s)=>{const o={};for(const c of a)if(n.has(c))o[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new My({...t,checks:[],...Le(s),entries:o})},e.exclude=(a,s)=>{const o={...t.entries};for(const c of a)if(n.has(c))delete o[c];else throw new Error(`Key ${c} not found in enum`);return new My({...t,checks:[],...Le(s),entries:o})}});function Be(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new My({type:"enum",entries:n,...Le(t)})}const s6=ce("ZodLiteral",(e,t)=>{RL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>VP(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 on(e,t){return new s6({type:"literal",values:Array.isArray(e)?e:[e],...Le(t)})}const l6=ce("ZodTransform",(e,t)=>{OL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>KP(e,n),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new GC(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(fc(o,n.value,t));else{const c=o;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=n.value),c.inst??(c.inst=e),n.issues.push(fc(c))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(o=>(n.value=o,n)):(n.value=s,n)}});function wN(e){return new l6({type:"transform",transform:e})}const SN=ce("ZodOptional",(e,t)=>{fN.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>vN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function q1(e){return new SN({type:"optional",innerType:e})}const o6=ce("ZodExactOptional",(e,t)=>{zL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>vN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function u6(e){return new o6({type:"optional",innerType:e})}const c6=ce("ZodNullable",(e,t)=>{ML.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>tU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function Z1(e){return new c6({type:"nullable",innerType:e})}const d6=ce("ZodDefault",(e,t)=>{DL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>rU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function f6(e,t){return new d6({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():YC(t)}})}const h6=ce("ZodPrefault",(e,t)=>{IL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>aU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function m6(e,t){return new h6({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():YC(t)}})}const kN=ce("ZodNonOptional",(e,t)=>{LL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>nU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function p6(e,t){return new kN({type:"nonoptional",innerType:e,...Le(t)})}const g6=ce("ZodCatch",(e,t)=>{PL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>iU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function y6(e,t){return new g6({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const v6=ce("ZodPipe",(e,t)=>{UL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>sU(e,n,a,s),e.in=t.in,e.out=t.out});function Dy(e,t){return new v6({type:"pipe",in:e,out:t})}const b6=ce("ZodReadonly",(e,t)=>{BL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>lU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function x6(e){return new b6({type:"readonly",innerType:e})}const w6=ce("ZodCustom",(e,t)=>{FL.init(e,t),Xt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>QP(e,n)});function S6(e,t={}){return DP(w6,e,t)}function k6(e){return IP(e)}function j6(e,t){return Dy(wN(e),t)}const Ls={custom:"custom"};function kh(e){return yP(Gv,e)}const E6=new RegExp("(?<![A-Za-z0-9_.@-])@([A-Za-z0-9][A-Za-z0-9_-]{0,63})\\b","g");function C6(e){return e.replace(/```[\s\S]*?```/g,"").replace(/~~~[\s\S]*?~~~/g,"").replace(/`[^`\n]+`/g,"")}function jN(e,t){const n=C6(e),a=new Map;for(const o of t)o.name&&a.set(o.name.toLowerCase(),o.agentId);if(a.size===0)return[];const s=new Set;for(const o of n.matchAll(E6)){const c=o[1];if(!c)continue;const f=a.get(c.toLowerCase());f&&s.add(f)}return[...s]}const N6=/^\/(?![/\\])[A-Za-z0-9_\-./?=&%#]*$/,G1="/";function EN(e){return!e||typeof e!="string"||e.length>256||!N6.test(e)?"/":e}const _6={FEISHU:"feishu",SLACK:"slack",KAEL:"kael"},CN=Be(["feishu","slack","kael"]),NN=Be(["active","inactive"]);se({platform:CN,agentId:_().min(1),credentials:un(_(),en()),status:NN.default("active")});se({agentId:_().min(1).optional(),credentials:un(_(),en()).optional(),status:NN.optional()});se({id:qe(),platform:_(),agentId:_(),hasCredentials:Zn(),status:_(),createdAt:_(),updatedAt:_()});const T6=Be(["code","reverse_token","oauth","manual"]);se({appId:_().min(1),appSecret:_().min(1)});se({platform:CN,externalUserId:_().min(1),agentId:_().min(1),boundVia:T6.default("manual"),displayName:_().max(200).optional()});se({id:qe(),platform:_(),externalUserId:_(),agentId:_(),boundVia:_().nullable(),displayName:_().nullable(),createdAt:_()});se({feishuUserId:_().min(1),displayName:_().max(200).optional()});se({configId:qe(),platform:_(),agentId:_(),appId:_(),connected:Zn(),lastActiveAt:_().nullable()});const A6=32e3,Vv=/^[a-z0-9][a-z0-9_-]{0,63}$/i,R6=/^[A-Z][A-Z0-9_]*$/,_N=se({append:_().max(A6).default("")}),O6=se({name:_().regex(Vv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:on("stdio"),command:_().min(1),args:yt(_()).optional()}),z6=se({name:_().regex(Vv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:on("http"),url:_().url(),headers:un(_(),_()).optional()}),M6=se({name:_().regex(Vv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:on("sse"),url:_().url(),headers:un(_(),_()).optional()}),TN=Sh("transport",[O6,z6,M6]),AN=se({key:_().regex(R6,"Env key must match /^[A-Z][A-Z0-9_]*$/"),value:_(),sensitive:Zn().default(!1)}),Qv=se({url:_().min(1),ref:_().min(1).optional(),localPath:_().min(1).optional()}),RN=se({prompt:_N.default({append:""}),model:_().default("opus"),mcpServers:yt(TN).default([]),env:yt(AN).default([]),gitRepos:yt(Qv).default([])}),D6=RN.extend({kind:on("claude-code")}),I6=RN.extend({kind:on("codex")}),L6=Sh("kind",[D6,I6]),P6=(e,t)=>{const n=new Set;e.mcpServers.forEach((o,c)=>{const f=o.name.toLowerCase();n.has(f)&&t.addIssue({code:Ls.custom,path:["mcpServers",c,"name"],message:`Duplicate MCP server name "${o.name}"`}),n.add(f)});const a=new Set;e.env.forEach((o,c)=>{a.has(o.key)&&t.addIssue({code:Ls.custom,path:["env",c,"key"],message:`Duplicate env key "${o.key}"`}),a.add(o.key)});const s=new Set;e.gitRepos.forEach((o,c)=>{const f=o.localPath??Vf(o.url);f&&(s.has(f)&&t.addIssue({code:Ls.custom,path:["gitRepos",c,"localPath"],message:`Duplicate git repo local path "${f}"`}),s.add(f))})},ON=j6(e=>e&&typeof e=="object"&&!Array.isArray(e)&&!("kind"in e)?{...e,kind:"claude-code"}:e,L6).superRefine((e,t)=>{P6(e,t)}),U6=se({agentId:_(),version:qe().int().positive(),payload:ON,updatedAt:_(),updatedBy:_()}),zN=se({prompt:_N,model:_(),mcpServers:yt(TN),env:yt(AN),gitRepos:yt(Qv)}).partial();se({expectedVersion:qe().int().positive(),payload:zN});se({payload:zN});se({current:U6,next:ON,diff:yt(se({path:_(),op:Be(["add","remove","replace"]),before:en().optional(),after:en().optional()}))});const Gf="***";function Vf(e){const t=e.trim();return t?((t.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,""):""}const MN=Be(["online","offline"]),DN=Be(["idle","working","blocked","error"]);Be(["active","suspended","evicted","errored"]);const B6=Be(["active","suspended","errored"]);se({chatId:_().min(1),state:B6});se({runtimeState:DN});se({agentId:_().min(1),runtimeType:_().max(50),runtimeVersion:_().max(50).optional()});Be(["wrong_client","not_owned","agent_suspended","wrong_org","unknown_agent","runtime_provider_mismatch"]);se({agentId:_(),status:MN,connectedAt:_().nullable(),lastSeenAt:_(),clientId:_().nullable().optional(),runtimeType:_().nullable().optional(),runtimeVersion:_().nullable().optional(),runtimeState:DN.nullable().optional(),activeSessions:qe().int().nullable().optional(),totalSessions:qe().int().nullable().optional(),runtimeUpdatedAt:_().nullable().optional()});se({total:qe().int(),running:qe().int(),byState:se({idle:qe().int(),working:qe().int(),blocked:qe().int(),error:qe().int()}),clients:qe().int()});const Qf={CLAUDE_CODE:"claude-code",CODEX:"codex"},jh=Be(["claude-code","codex"]),Eh=Be(["human","personal_assistant","autonomous_agent"]),V1={PRIVATE:"private",ORGANIZATION:"organization"},Kv=Be(["private","organization"]),F6=Be(["admin-api","portal"]);Be(["active","suspended"]);const Iy=/^[a-z0-9][a-z0-9_-]{0,63}$/,Jl=64,$6=["admin","agent","first-tree","hub","me","null","system","undefined"],H6=new Set($6);function Ly(e){return H6.has(e)}se({name:_().min(1).max(64).regex(Iy,"Must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_). Max 64 chars.").refine(e=>!Ly(e),{message:"That agent name is reserved — pick a different one."}).optional(),type:Eh,displayName:_().min(1).max(200).optional(),delegateMention:_().max(100).optional(),organizationId:_().min(1).max(100).optional(),source:F6.optional(),visibility:Kv.optional(),metadata:un(_(),en()).optional(),managerId:_().optional(),clientId:_().min(1).max(100).optional(),runtimeProvider:jh.optional(),gitRepos:yt(Qv).optional()});se({type:Eh.optional(),displayName:_().min(1).max(200).optional(),delegateMention:_().max(100).nullable().optional(),visibility:Kv.optional(),metadata:un(_(),en()).optional(),managerId:_().nullable().optional(),clientId:_().min(1).max(100).nullable().optional()});se({clientId:_().min(1).max(100),runtimeProvider:jh,force:Zn().optional()});se({uuid:_(),name:_().nullable(),organizationId:_(),type:Eh,displayName:_(),delegateMention:_().nullable(),inboxId:_(),status:_(),source:_().nullable().optional(),visibility:Kv,metadata:un(_(),en()),managerId:_().nullable(),clientId:_().nullable(),runtimeProvider:jh,presenceStatus:MN.optional(),createdAt:_(),updatedAt:_()});se({repo:_().nullable(),branch:_().nullable()});se({type:on("agent:pinned"),agentId:_(),name:_().nullable(),displayName:_(),agentType:Eh,runtimeProvider:jh});se({username:_().min(1),password:_().min(1)});se({accessToken:_(),refreshToken:_()});se({refreshToken:_().min(1)});se({token:_().min(1)});se({token:_(),expiresIn:qe(),command:_()});const q6=["issue","pull_request","discussion","commit"],Z6=Be(q6),G6=se({source:on("github"),entityType:Z6,entityKey:_().min(1),entityUrl:_().url().optional()}),V6=se({source:on("feishu"),externalChannelId:_().min(1)}),Q6=Sh("source",[G6,V6]),K6=wh([se({}).strict(),Q6]),Y6=Be(["direct","group","thread"]),Py={ACTIVE:"active",ARCHIVED:"archived",DELETED:"deleted"},Yv=Be(["active","archived","deleted"]);se({status:Yv});se({type:Y6,topic:_().max(500).optional(),participantIds:yt(_()).min(1),metadata:K6.optional()});const IN=se({agentId:_(),role:_(),mode:_(),joinedAt:_()});IN.extend({name:_().nullable(),displayName:_(),type:_()});const X6=se({id:_(),organizationId:_(),type:_(),topic:_().nullable(),lifecyclePolicy:_().nullable().optional(),metadata:un(_(),en()),createdAt:_(),updatedAt:_()});X6.extend({participants:yt(IN),title:_(),firstMessagePreview:_().nullable(),engagementStatus:Yv});se({topic:_().trim().max(500).nullable()});se({agentId:_().min(1)});se({agentId:_().min(1)});const W6=Be(["connected","disconnected"]),J6=Be(["ok","expired"]);se({id:_(),userId:_().nullable(),status:W6,authState:J6,sdkVersion:_().max(50).nullable(),hostname:_().max(100).nullable(),os:_().max(50).nullable(),agentCount:qe().int().min(0),connectedAt:_().nullable(),lastSeenAt:_(),metadata:un(_(),en()).nullable()});const eB=se({wsInboxDeliver:Zn().default(!1)}).partial();se({clientId:_().min(1).max(100),hostname:_().max(100).optional(),os:_().max(50).optional(),sdkVersion:_().max(50).optional(),wireCapabilities:eB.optional()});se({clientId:_(),previousUserId:_().nullable(),unpinnedAgentCount:qe().int().nonnegative()});const tB=Be(["ok","missing","unauthenticated","error"]),nB=Be(["api_key","oauth","auth_json","none"]),rB=se({state:tB,available:Zn(),authenticated:Zn(),sdkVersion:_().nullable().optional(),authMethod:nB,error:_().nullable().optional(),detectedAt:_()}),aB=un(_(),rB);se({capabilities:aB});se({limit:kh().int().min(1).max(100).default(20),cursor:_().optional()});const iB=Be(["active","stale","unavailable"]),sB=Be(["ok","warning","error"]),lB=se({label:_(),detail:_().nullable(),severity:sB}),oB=Be(["root","domain","subdomain","leaf"]),Xv=Be(["added","edited","removed"]),uB=Be(["parent","soft_link","markdown_link"]),cB=Be(["low","medium","high"]),dB=se({id:_(),path:_(),sourcePath:_().nullable(),title:_(),kind:oB,owners:yt(_()),parentId:_().nullable(),preview:_().nullable(),relatedNodeIds:yt(_()),affectedContextArea:_(),changeType:Xv.nullable(),changedAtCommit:_().nullable()}),fB=se({source:_(),target:_(),kind:uB}),hB=se({path:_(),nodeId:_().nullable(),type:Xv,commit:_().nullable(),changedAt:_().nullable(),changedBy:_().nullable(),summary:_().nullable()}),mB=se({id:_(),nodeId:_().nullable(),path:_(),title:_(),changeType:Xv,affectedContextArea:_(),reason:_(),summary:_(),changedBy:_().nullable(),owners:yt(_()),relatedNodeIds:yt(_()),sourceCommit:_().nullable(),riskLevel:cB}),pB=se({addedCount:qe().int().nonnegative(),editedCount:qe().int().nonnegative(),removedCount:qe().int().nonnegative(),changedNodeCount:qe().int().nonnegative()});se({repo:_().nullable(),branch:_().nullable(),headCommit:_().nullable(),syncedAt:_().nullable(),snapshotStatus:iB,contextStatus:lB,summary:pB,updates:yt(mB),nodes:yt(dB),edges:yt(fB),changes:yt(hB)});const gB=["User","Organization"],yB=Be(gB),vB=["read","write","admin"],bB=Be(vB),xB=un(_(),bB),wB=yt(_());se({login:_().optional(),accessToken:_().optional(),accessTokenExpiresAt:_().datetime({offset:!0}).optional(),refreshToken:_().optional(),refreshTokenExpiresAt:_().datetime({offset:!0}).optional()});se({installationId:qe().int().positive()});se({installationId:qe().int().positive(),accountType:yB,accountLogin:_(),accountGithubId:qe().int().positive(),permissions:xB,events:wB,suspended:Zn(),manageUrl:_().url(),createdAt:_().datetime({offset:!0}),updatedAt:_().datetime({offset:!0})});const SB=["image/png","image/jpeg","image/gif","image/webp"],Wv=Be(SB);se({data:_().min(1),mimeType:Wv,filename:_().min(1),size:qe().int().nonnegative().optional(),imageId:_().uuid().optional()});se({imageId:_().uuid(),mimeType:Wv,filename:_().min(1),size:qe().int().nonnegative().optional()});se({type:on("image_payload"),imageId:_().uuid(),chatId:_(),base64:_().min(1),mimeType:Wv,filename:_().min(1),size:qe().int().nonnegative().optional()});const Jv=Be(["hub_ui","cli","feishu","github","api"]),LN=Be(["text","markdown","card","reference","file","question","question_answer"]);se({format:LN.default("text"),content:en(),metadata:un(_(),en()).optional(),inReplyTo:_().optional(),replyToInbox:_().optional(),replyToChat:_().optional(),source:Jv.optional()});se({format:LN.default("text"),content:en(),metadata:un(_(),en()).optional(),replyToInbox:_().optional(),replyToChat:_().optional(),source:Jv.optional()});const kB=se({id:_(),chatId:_(),senderId:_(),format:_(),content:en(),metadata:un(_(),en()),replyToInbox:_().nullable(),replyToChat:_().nullable(),inReplyTo:_().nullable(),source:Jv.nullable(),createdAt:_()}),jB=se({senderId:_(),chatId:_(),replyToChat:_().nullable()}).nullable(),EB=Be(["full","mention_only"]),CB=se({id:_(),senderId:_(),format:_(),content:en(),metadata:un(_(),en()).default({}),createdAt:_()}),PN=kB.extend({configVersion:qe().int().positive(),recipientMode:EB.default("full"),inReplyToSnapshot:jB.default(null),precedingMessages:yt(CB).default([])});Be(["pending","delivered","acked","failed"]);const NB=se({id:qe(),inboxId:_(),messageId:_(),chatId:_().nullable(),status:_(),retryCount:qe(),createdAt:_(),deliveredAt:_().nullable(),ackedAt:_().nullable()});NB.extend({message:PN});se({limit:kh().int().min(1).max(50).default(10)});se({type:on("inbox:deliver"),entryId:qe().int().nonnegative(),inboxId:_().min(1),chatId:_().nullable(),message:PN}).passthrough();se({type:on("inbox:ack"),entryId:qe().int().nonnegative()});const _B=7;se({organizationId:_(),organizationName:_(),organizationDisplayName:_(),role:_(),expiresAt:_().nullable()});se({id:_(),organizationId:_(),token:_(),inviteUrl:_(),role:_(),createdAt:_(),expiresAt:_().nullable()});se({token:_().min(1)});se({}).optional();const TB=["all","unread","watching"],AB=Be(TB),UN=Be(["participant","watching"]),RB=["active","archived","all"],BN=Be(RB);se({cursor:_().optional(),limit:kh().int().min(1).max(200).default(50),filter:AB.default("all"),engagement:BN.default("active")});const OB=se({agentId:_(),displayName:_(),type:_()}),zB=se({chatId:_(),type:_(),membershipKind:UN,title:_(),topic:_().nullable(),participants:yt(OB),participantCount:qe().int(),lastMessageAt:_().nullable(),lastMessagePreview:_().nullable(),unreadMentionCount:qe().int(),canReply:Zn(),engagementStatus:Yv});se({rows:yt(zB),nextCursor:_().nullable()});se({participantIds:yt(_().min(1)).min(1),topic:_().trim().max(500).optional().nullable()});se({participantIds:yt(_().min(1)).min(1)});se({chatId:_(),lastReadAt:_(),unreadMentionCount:qe().int()});se({chatId:_(),membershipKind:UN.nullable()});se({type:on("chat:message"),chatId:_()});Be(["connect","create_agent","completed"]);se({id:_(),name:_(),displayName:_(),role:Be(["admin","member"])});se({name:_().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/),displayName:_().min(1).max(200)});se({dismissed:Zn().optional()});const MB=Be(["team_renamed","agent_created","tree_chat_started","tree_intro_dismissed"]);se({event:MB,attrs:un(_(),wh([_(),qe(),Zn(),YU()])).optional()});se({id:_(),organizationId:_(),organizationName:_(),role:Be(["admin","member"]),agentId:_()});const DB={ADMIN:"admin",MEMBER:"member"},eb=Be(["admin","member"]),IB=se({id:_(),userId:_(),organizationId:_(),agentId:_(),role:eb,createdAt:_()});se({username:_().min(1).max(100),displayName:_().min(1).max(200),role:eb.default("member")});se({role:eb.optional(),displayName:_().min(1).max(200).optional()});IB.extend({username:_(),displayName:_(),password:_()});const LB=Be(["agent_error","session_error","agent_needs_decision","agent_blocked","agent_stale","agent_disconnected","agent_connected","session_completed"]),FN=Be(["high","medium","low"]);se({id:_(),organizationId:_(),type:LB,severity:FN,agentId:_().nullable(),chatId:_().nullable(),message:_(),read:Zn(),createdAt:_()});se({limit:kh().int().min(1).max(100).default(20),cursor:_().optional(),severity:FN.optional(),read:Be(["true","false"]).transform(e=>e==="true").optional(),agentId:_().optional()});se({next:_().max(256).optional()});se({code:_().min(1),state:_().min(1),installation_id:_().regex(/^\d+$/).optional(),setup_action:Be(["install","update","request"]).optional()});se({githubId:_().min(1),login:_().min(1),email:_().email().optional(),displayName:_().optional(),next:_().max(256).optional(),installationId:_().regex(/^\d+$/).optional(),installationAccountType:Be(["User","Organization"]).optional(),installationAccountLogin:_().min(1).optional(),installationAccountGithubId:_().regex(/^\d+$/).optional()});const PB=/^(?:[A-Za-z0-9_.-]+@)?[A-Za-z0-9.-]+:(?!\d+(?:\/|$))[^/:@\s][^:@\s]*$/;function UB(e){return e.includes("://")?!1:PB.test(e)}const Ch=_().min(1).superRefine((e,t)=>{if(UB(e))return;let n;try{n=new URL(e)}catch{t.addIssue({code:Ls.custom,message:"Repo URL must be HTTPS, SSH (ssh://...), or scp-like (git@host:path)."});return}if(n.protocol!=="https:"&&n.protocol!=="ssh:"){t.addIssue({code:Ls.custom,message:"Repo URL must use HTTPS or SSH."});return}if(n.password.length>0){t.addIssue({code:Ls.custom,message:"Repo URL must not include credentials."});return}if(n.protocol==="https:"&&n.username.length>0){t.addIssue({code:Ls.custom,message:"Repo URL must not include credentials."});return}}),BB=se({repo:Ch.optional(),branch:_().default("main")}),FB=se({repo:Ch.nullish(),branch:_().min(1).nullish()}),$B=se({repo:_().optional(),branch:_().optional()}),HB=se({webhookSecretCipher:_().optional()}),qB=se({webhookSecret:_().min(1).nullish()}),ZB=se({webhookSecretConfigured:Zn(),webhookUrl:_()}),GB=se({repos:yt(se({url:Ch,defaultBranch:_().optional()})).default([])}),VB=se({repos:yt(se({url:Ch,defaultBranch:_().min(1).optional()})).optional()}),QB=se({repos:yt(se({url:_(),defaultBranch:_().optional()}))}),KB={context_tree:{storage:BB,input:FB,output:$B,readPolicy:"member"},github_integration:{storage:HB,input:qB,output:ZB,readPolicy:"admin"},source_repos:{storage:GB,input:VB,output:QB,readPolicy:"member"}},YB=Object.keys(KB);Be(YB);const $N=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;se({name:_().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/,"Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine(e=>!$N.test(e),"Name must not be a UUID format"),displayName:_().min(1).max(200),maxAgents:qe().int().min(0).default(0),maxMessagesPerMinute:qe().int().min(0).default(0),features:un(_(),en()).default({})});se({name:_().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/,"Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine(e=>!$N.test(e),"Name must not be a UUID format").optional(),displayName:_().min(1).max(200).optional(),maxAgents:qe().int().min(0).optional(),maxMessagesPerMinute:qe().int().min(0).optional(),features:un(_(),en()).optional()});se({id:_(),name:_(),displayName:_(),maxAgents:qe(),maxMessagesPerMinute:qe(),features:un(_(),en()),createdAt:_(),updatedAt:_()});const XB=se({workingCount:qe().int().nonnegative(),errorMask:Zn()}),WB=se({type:on("pulse:tick"),organizationId:_(),agents:un(_(),yt(XB).length(32))}),JB=se({label:_().min(1),description:_(),preview:_().nullable().optional()}),e9=se({question:_().min(1),header:_().min(1).max(24),options:yt(JB).min(2).max(4),multiSelect:Zn()}),t9=Be(["html","markdown"]).nullable(),n9=se({correlationId:_().min(1),questions:yt(e9).min(1).max(4),previewFormat:t9,allowFreeText:Zn()}),r9=se({correlationId:_().min(1),answers:un(_().min(1),_())});se({answers:un(_().min(1),_())});Be(["pending","answered","superseded"]);const a9=Be(["tool_call","error","assistant_text","thinking","turn_end"]),HN=se({toolUseId:_(),name:_(),args:en(),status:Be(["pending","ok","error"]),durationMs:qe().int().nonnegative().optional(),resultPreview:_().max(400).optional()}),qN=se({source:Be(["sdk","runtime","tool"]),message:_().max(2e3)}),ZN=se({text:_().max(8e3)}),GN=se({}),VN=se({status:Be(["success","error"])}),i9=Sh("kind",[se({kind:on("tool_call"),payload:HN}),se({kind:on("error"),payload:qN}),se({kind:on("assistant_text"),payload:ZN}),se({kind:on("thinking"),payload:GN}),se({kind:on("turn_end"),payload:VN})]);se({id:_(),agentId:_(),chatId:_(),seq:qe().int().positive(),kind:a9,payload:wh([HN,qN,ZN,GN,VN]),createdAt:_()});se({agentId:_(),chatId:_(),event:i9});se({agentId:_(),chatId:_()});se({type:on("session:reconcile"),agentId:_().min(1),chatIds:yt(_().min(1)).max(500)});se({type:on("session:reconcile:result"),agentId:_().min(1),staleChatIds:yt(_().min(1))});const s9=se({organizationId:_(),agentCount:qe(),chatCount:qe(),messageCount:qe()});se({totalAgents:qe(),totalChats:qe(),totalMessages:qe(),byOrganization:yt(s9)});const l9=Be(["active","suspended"]);se({id:_(),username:_(),displayName:_(),avatarUrl:_().nullable(),status:l9,createdAt:_(),updatedAt:_()});se({username:_().min(1).max(100),displayName:_().min(1).max(200),password:_().min(8).max(200)});se({displayName:_().min(1).max(200).optional(),password:_().min(8).max(200).optional()});se({type:on("auth"),token:_().min(1)});const o9=se({wsInboxDeliver:Zn().default(!1)}).partial();se({type:on("server:welcome"),serverCommandVersion:_().min(1),serverTimeMs:qe().int().nonnegative(),capabilities:o9.optional()}).passthrough();const QN=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));function u9(e){const t=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));for(const n of Object.values(e))for(let a=0;a<32&&a<n.length;a++){const s=n[a],o=t[a];!s||!o||(o.workingCount+=s.workingCount,o.errorMask=o.errorMask||s.errorMask)}return t}const c9=2e3,d9=3e4;let Qi=null,hc=!1,Kf=0,Wu=null;const Uy=new Set;let Vi=null,Ps=0;function f9(e){for(const t of Uy)try{t(e)}catch{}if(Vi){if(e.type==="notification")Vi.invalidateQueries({queryKey:["notifications"]});else if(e.type==="session:state")Vi.invalidateQueries({queryKey:["activity"]}),Vi.invalidateQueries({queryKey:["sessions"]});else if(e.type==="chat:message"){const t=typeof e.chatId=="string"?e.chatId:null;Vi.invalidateQueries({queryKey:["me","chats"]}),t&&(Vi.invalidateQueries({queryKey:["chat-messages",t]}),Vi.invalidateQueries({queryKey:["chat-detail",t]}))}}}function tb(){const e=oh();if(!(e!=null&&e.accessToken))return;let t=null;try{t=localStorage.getItem("first-tree-hub:selectedOrganizationId")}catch{t=null}if(!t)return;const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/orgs/${encodeURIComponent(t)}/ws/?token=${e.accessToken}`,s=new WebSocket(a);Qi=s,s.onmessage=o=>{if(s===Qi)try{const c=JSON.parse(o.data);f9(c)}catch{}},s.onopen=()=>{s===Qi&&(Kf=0)},s.onclose=o=>{if(s===Qi&&(Qi=null,!(hc||Ps===0))){if(o.code===4001){pz().then(c=>{hc||Ps===0||(c?(Kf=0,tb()):Q1())});return}Q1()}}}function Q1(){Kf++;const e=Math.min(c9*2**(Kf-1),d9);Wu=setTimeout(()=>{Wu=null,!hc&&Ps>0&&tb()},e)}function h9(){hc=!0,Wu&&(clearTimeout(Wu),Wu=null),Qi&&(Qi.close(1e3,"unmount"),Qi=null)}function KN(e){const{onMessage:t,enabled:n=!0}=e??{},a=gn(),s=b.useRef(t);s.current=t,b.useEffect(()=>{Vi=a},[a]),b.useEffect(()=>{if(!n)return;const o=c=>{var f;return(f=s.current)==null?void 0:f.call(s,c)};return Uy.add(o),Ps++,Ps===1&&(hc=!1,tb()),()=>{Uy.delete(o),Ps--,Ps===0&&h9()}},[n])}const m9=b.createContext({aggregated:QN,agents:{},receivedAtMs:null,stale:!0});function p9({children:e}){const[t,n]=b.useState({aggregated:QN,agents:{},receivedAtMs:null}),[a,s]=b.useState(()=>Date.now());KN({onMessage:c=>{const f=WB.safeParse(c);f.success&&n({aggregated:u9(f.data.agents),agents:f.data.agents,receivedAtMs:Date.now()})}}),b.useEffect(()=>{const c=setInterval(()=>s(Date.now()),1e4);return()=>clearInterval(c)},[]);const o=b.useMemo(()=>({...t,stale:t.receivedAtMs===null||a-t.receivedAtMs>3e4}),[t,a]);return l.jsx(m9.Provider,{value:o,children:e})}function Nh(e){return Ee.get(`/agents/${e}/config`)}function _h(e,t){return Ee.patch(`/agents/${e}/config`,t)}function g9(e,t){return Ee.post(`/agents/${e}/config/dry-run`,{payload:t})}function y9(e){return Ee.get(`/agents/${e}/client-status`)}function v9({className:e,style:t,...n}){return l.jsx("div",{className:ze("flex items-center text-body",e),style:{gap:6,color:"var(--fg-3)",...t},...n})}function b9({onClick:e,children:t}){return l.jsx("button",{type:"button",onClick:e,className:"bg-transparent border-0 p-0 cursor-pointer",style:{color:"var(--fg-3)",textDecoration:"none",font:"inherit"},onMouseEnter:n=>{n.currentTarget.style.color="var(--fg)"},onMouseLeave:n=>{n.currentTarget.style.color="var(--fg-3)"},children:t})}function x9(){return l.jsx("span",{style:{color:"var(--fg-4)"},children:"/"})}function w9({children:e,mono:t}){return l.jsx("span",{className:ze("font-medium",t&&"mono"),style:{color:"var(--fg)"},children:e})}const S9={neutral:{bg:"var(--bg-sunken)",fg:"var(--fg-2)",bd:"var(--border)"},accent:{bg:"var(--accent-bg)",fg:"var(--accent-dim)",bd:"color-mix(in oklch, var(--accent) 30%, transparent)"},warn:{bg:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",fg:"color-mix(in oklch, var(--state-blocked) 50%, var(--fg))",bd:"color-mix(in oklch, var(--state-blocked) 30%, transparent)"},error:{bg:"color-mix(in oklch, var(--state-error) 14%, transparent)",fg:"var(--state-error)",bd:"color-mix(in oklch, var(--state-error) 30%, transparent)"},outline:{bg:"transparent",fg:"var(--fg-3)",bd:"var(--border)"},idle:{bg:"color-mix(in oklch, var(--state-idle) 14%, transparent)",fg:"var(--state-idle)",bd:"color-mix(in oklch, var(--state-idle) 30%, transparent)"},working:{bg:"color-mix(in oklch, var(--state-working) 14%, transparent)",fg:"var(--state-working)",bd:"color-mix(in oklch, var(--state-working) 30%, transparent)"},blocked:{bg:"color-mix(in oklch, var(--state-blocked) 14%, transparent)",fg:"color-mix(in oklch, var(--state-blocked) 50%, var(--fg))",bd:"color-mix(in oklch, var(--state-blocked) 30%, transparent)"},offline:{bg:"color-mix(in oklch, var(--state-offline) 14%, transparent)",fg:"var(--state-offline)",bd:"color-mix(in oklch, var(--state-offline) 30%, transparent)"}};function Er({tone:e="neutral",className:t,style:n,...a}){const s=S9[e],o={background:s.bg,color:s.fg,border:`var(--hairline) solid ${s.bd}`,...n};return l.jsx("span",{className:ze("mono inline-flex items-center uppercase text-caption leading-[1.6]",t),style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",...o},...a})}function By({children:e,right:t,className:n,style:a,...s}){return l.jsxs("div",{className:ze("mono flex items-center justify-between uppercase text-eyebrow",n),style:{padding:"var(--sp-1_75) var(--sp-3_5)",color:"var(--fg-4)",background:"var(--bg-raised)",borderBottom:"var(--hairline) solid var(--border-faint)",...a},...s,children:[l.jsx("span",{children:e}),t]})}function nb({className:e,style:t,...n}){return l.jsx("span",{className:ze("mono uppercase text-caption",e),style:{color:"var(--fg-3)",...t},...n})}function Ju({state:e,size:t=8,className:n}){const a={width:t,height:t,display:"inline-block",position:"relative",flexShrink:0};return e==="working"?l.jsxs("span",{className:ze("shrink-0",n),style:a,role:"img","aria-label":"working",children:[l.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--state-working)"}}),l.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--state-working)",animation:"ring-pulse 1.8s infinite",opacity:.6}})]}):e==="blocked"?l.jsx("span",{className:ze("shrink-0",n),style:{...a,border:"var(--hairline-bold) dashed var(--state-blocked)",borderRadius:"50%",animation:"dash-spin 4s linear infinite"},role:"img","aria-label":"blocked",children:l.jsx("span",{style:{position:"absolute",inset:2,borderRadius:"50%",background:"var(--state-blocked)"}})}):e==="error"?l.jsx("span",{className:ze("shrink-0",n),style:{...a,background:"var(--state-error)",clipPath:"polygon(50% 0%, 100% 100%, 0% 100%)",borderRadius:1},role:"img","aria-label":"error"}):e==="idle"?l.jsx("span",{className:ze("shrink-0",n),style:{...a,borderRadius:"50%",background:"var(--state-idle)"},role:"img","aria-label":"idle"}):l.jsx("span",{className:ze("shrink-0",n),style:{...a,borderRadius:"50%",border:"var(--hairline) solid var(--state-offline)",background:"transparent"},role:"img","aria-label":"offline"})}function k9(e){return e==="idle"||e==="working"||e==="blocked"||e==="error"||e==="offline"}function mc({state:e,className:t}){const n=e!==null&&k9(e)?e:"offline",a=n==="offline"?"var(--fg-3)":`var(--state-${n})`;return l.jsxs("span",{className:ze("mono inline-flex items-center gap-1.5 uppercase text-caption",t),style:{color:a},children:[l.jsx(Ju,{state:n,size:7}),n]})}function yf({label:e,value:t,accent:n}){return l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",cursor:"default"},children:[l.jsx("div",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:e}),l.jsx("div",{className:"mono text-subtitle font-semibold",style:{color:n??"var(--fg)",marginTop:"var(--sp-px)"},children:t})]})}function j9({runtimeLabel:e,computerLabel:t,visible:n=!0}){return n?l.jsx("div",{className:"sticky z-20 flex items-center justify-between gap-3 backdrop-blur",style:{top:0,padding:"var(--sp-1_75) var(--sp-5)",background:"color-mix(in oklch, var(--bg-raised) 94%, transparent)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:l.jsxs("div",{className:"mono text-caption flex items-center gap-2",style:{color:"var(--fg-3)"},children:[l.jsxs("span",{children:["Runs on ",l.jsx("span",{style:{color:"var(--fg-2)"},children:e})]}),t&&l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{color:"var(--fg-4)"},"aria-hidden":!0,children:"@"}),l.jsx("span",{style:{color:"var(--fg-2)"},children:t})]})]})}):null}function E9(e){const{agent:t}=e,[n,a]=b.useState(!1),[s,o]=b.useState(!1),c=t.displayName||t.name||t.uuid;return l.jsxs("section",{id:"ad-danger",style:{background:"color-mix(in oklch, var(--state-error) 6%, var(--bg-raised))",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-panel)"},children:[l.jsxs("header",{className:"flex items-center gap-2",style:{padding:"var(--sp-2_5) var(--sp-3_5)"},children:[l.jsx(To,{className:"h-3.5 w-3.5",style:{color:"var(--state-error)"}}),l.jsx("h3",{className:"text-body font-semibold",style:{color:"var(--state-error)"},children:"Danger zone"})]}),l.jsxs("div",{children:[t.status==="active"?l.jsx(gg,{title:"Suspend agent",body:"Pause all active sessions. You can reactivate later; tokens stay revoked until then.",action:l.jsx(ye,{variant:"outline",size:"xs",onClick:()=>o(!0),disabled:e.suspendPending,children:e.suspendPending?"Suspending…":"Suspend"})}):l.jsx(gg,{title:"Reactivate agent",body:"Resume sessions. Tokens must be recreated — they are not restored.",action:l.jsx(ye,{variant:"outline",size:"xs",onClick:e.onReactivate,disabled:e.reactivatePending,children:e.reactivatePending?"Reactivating…":"Reactivate"})}),l.jsx(gg,{title:"Delete agent",body:"Permanent. Configuration, bindings, tokens, and session history are all dropped.",action:l.jsxs(ye,{variant:"destructive",size:"xs",onClick:()=>a(!0),disabled:e.deletePending,children:[l.jsx(Uf,{className:"h-3 w-3"}),"Delete"]})})]}),l.jsx(C9,{open:s,onOpenChange:o,label:c,onConfirm:()=>{o(!1),e.onSuspend()},pending:e.suspendPending}),l.jsx(N9,{open:n,onOpenChange:a,expected:c,onDelete:()=>{a(!1),e.onDelete()},deleting:e.deletePending})]})}function gg(e){return l.jsxs("div",{className:"flex items-start justify-between gap-4 text-body",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderTop:"var(--hairline) solid color-mix(in oklch, var(--state-error) 14%, transparent)"},children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-medium",style:{color:"var(--fg)"},children:e.title}),l.jsx("p",{className:"text-label font-normal",style:{color:"var(--fg-3)"},children:e.body})]}),l.jsx("div",{children:e.action})]})}function C9({open:e,onOpenChange:t,label:n,onConfirm:a,pending:s}){return l.jsx(On,{open:e,onOpenChange:t,children:l.jsxs(Nn,{children:[l.jsx(Pn,{children:l.jsxs(zn,{children:['Suspend "',n,'"?']})}),l.jsx("div",{className:"space-y-3",children:l.jsx("p",{className:"text-body",style:{color:"var(--fg-2)"},children:"Runtime binds and HTTP calls will be refused while the agent is suspended. Active sessions end on their next message. You can reactivate later from this same page."})}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),l.jsx(ye,{type:"button",variant:"destructive",onClick:a,disabled:s,children:s?"Suspending…":"Suspend"})]})]})})}function N9({open:e,onOpenChange:t,expected:n,onDelete:a,deleting:s}){const[o,c]=b.useState("");function f(m){m.preventDefault(),o===n&&a()}return l.jsx(On,{open:e,onOpenChange:m=>{t(m),m||c("")},children:l.jsxs(Nn,{children:[l.jsx(Pn,{children:l.jsxs(zn,{children:['Delete "',n,'"?']})}),l.jsxs("form",{onSubmit:f,className:"space-y-4",children:[l.jsxs("p",{className:"text-body text-muted-foreground",children:["This action cannot be undone. Type ",l.jsx("span",{className:"font-mono font-medium text-foreground",children:n})," ","to confirm."]}),l.jsx(Ft,{value:o,onChange:m=>c(m.target.value),autoFocus:!0,placeholder:n,className:"font-mono"}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),l.jsx(ye,{type:"submit",variant:"destructive",disabled:o!==n||s,children:s?"Deleting…":"Delete"})]})]})]})})}var _9="Label",YN=b.forwardRef((e,t)=>l.jsx(hi.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));YN.displayName=_9;var T9=YN;const bt=b.forwardRef(({className:e,...t},n)=>l.jsx(T9,{ref:n,className:ze("text-label leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));bt.displayName="Label";const En=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:ze("overflow-hidden",e),style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",...t},...n}));En.displayName="Panel";const ua=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:ze("flex items-center justify-between gap-3",e),style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));ua.displayName="PanelHeader";const ca=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:ze("inline-flex items-center gap-2 text-body font-semibold",e),style:{color:"var(--fg)",...t},...n}));ca.displayName="PanelTitle";const Jn=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:ze(e),style:{padding:"var(--sp-3) var(--sp-3_5)",...t},...n}));Jn.displayName="PanelBody";const A9={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 rb({status:e,onEdit:t,onDelete:n,onUndo:a,children:s,disabled:o}){const c=A9[e],f=e==="deleted";return l.jsxs("div",{className:ze("flex items-center gap-2 rounded border px-3 py-2 text-body",f?"bg-error-soft border-error text-error line-through decoration-error":"bg-card"),children:[l.jsx("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:s}),c.label&&l.jsx("span",{className:ze("text-caption rounded px-1.5 py-0.5 whitespace-nowrap",c.tone),children:c.label}),!o&&(f?l.jsxs(ye,{size:"sm",variant:"ghost",onClick:a,children:[l.jsx(DM,{className:"h-3.5 w-3.5 mr-1"}),"Undo"]}):l.jsxs("div",{className:"flex gap-1 shrink-0",children:[l.jsxs(ye,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:t,title:"Edit",children:[l.jsx(Tv,{className:"h-3.5 w-3.5"}),l.jsx("span",{className:"sr-only",children:"Edit"})]}),l.jsxs(ye,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:n,title:"Delete",children:[l.jsx(Uf,{className:"h-3.5 w-3.5"}),l.jsx("span",{className:"sr-only",children:"Delete"})]})]}))]})}function R9(e){const[t,n]=b.useState(null),[a,s]=b.useState(()=>new Set),o=f=>s(m=>{const h=new Set(m);return h.has(f)?h.delete(f):h.add(f),h}),c=e.items.filter(f=>f.status!=="deleted").length;return l.jsxs(En,{children:[l.jsxs(ua,{children:[l.jsxs(ca,{children:["Environment variables (",c,")"]}),!e.disabled&&l.jsxs(ye,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(xa,{className:"h-3 w-3"})," Add"]})]}),l.jsx(Jn,{className:"space-y-2",children:e.items.length===0?l.jsx("p",{className:"text-body text-muted-foreground",children:"No environment variables."}):e.items.map(f=>{const m=f.value.sensitive,h=f.value.value===Gf,p=m&&!h&&!!f.value.value,g=a.has(f.key);let x;return m?p&&g?x=f.value.value:x="••••••":x=f.value.value||l.jsx("em",{children:"(empty)"}),l.jsxs(rb,{status:f.status,onEdit:()=>n({mode:"edit",key:f.key,initial:f.value}),onDelete:()=>e.onDelete(f.key),onUndo:()=>e.onUndoDelete(f.key),disabled:e.disabled,children:[l.jsx("span",{className:"font-mono font-medium",children:f.value.key}),l.jsx("span",{className:"font-mono text-caption text-muted-foreground truncate max-w-xs",children:x}),m&&l.jsx(uh,{className:"h-3 w-3 text-muted-foreground","aria-hidden":!0}),m&&l.jsx("button",{type:"button",onClick:()=>p&&o(f.key),className:"bg-transparent border-0 cursor-pointer inline-flex items-center text-muted-foreground",title:p?g?"Hide value":"Reveal value":"Saved sensitive values can't be revealed. Edit to set a new value.","aria-label":g?"Hide value":"Reveal value",disabled:!p,style:{padding:0,opacity:p?1:.4},children:g?l.jsx(lM,{className:"h-3.5 w-3.5"}):l.jsx(SE,{className:"h-3.5 w-3.5"})})]},f.key)})}),t&&l.jsx(O9,{open:!!t,onOpenChange:f=>!f&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenKeys:e.otherKeys(t.mode==="edit"?t.key:null),onSubmit:f=>{t.mode==="edit"?e.onUpdate(t.key,f):e.onAdd(f),n(null)}})]})}function O9({open:e,onOpenChange:t,initial:n,forbiddenKeys:a,onSubmit:s}){const[o,c]=b.useState((n==null?void 0:n.key)??""),[f,m]=b.useState(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),[h,p]=b.useState((n==null?void 0:n.sensitive)??!1),[g,x]=b.useState(null);b.useEffect(()=>{e&&(c((n==null?void 0:n.key)??""),m(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),p((n==null?void 0:n.sensitive)??!1),x(null))},[e,n]);function w(S){if(S.preventDefault(),!o.match(/^[A-Z][A-Z0-9_]*$/)){x("Key must match /^[A-Z][A-Z0-9_]*$/.");return}if(a.has(o)){x(`Another entry already uses key "${o}".`);return}let k=f;if(h&&(n!=null&&n.sensitive)&&!f&&(k=Gf),!h&&!n&&!f){x("Value is required for non-sensitive entries.");return}s({key:o,value:k,sensitive:h})}return l.jsx(On,{open:e,onOpenChange:t,children:l.jsxs(Nn,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:n?"Edit environment variable":"Add environment variable"})}),l.jsxs("form",{onSubmit:w,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"env-key",children:"Key"}),l.jsx(Ft,{id:"env-key",value:o,onChange:S=>c(S.target.value.toUpperCase()),placeholder:"OPENAI_API_KEY",className:"font-mono",disabled:!!n}),n&&l.jsx("p",{className:"text-caption text-muted-foreground",children:"Key can't be renamed — delete and re-add."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"env-value",children:"Value"}),l.jsx(Ft,{id:"env-value",type:h?"password":"text",autoComplete:"new-password",value:f,onChange:S=>m(S.target.value),placeholder:n!=null&&n.sensitive?"Leave empty to keep existing value":h?"new secret":"value",className:"font-mono"})]}),l.jsxs("label",{className:"flex items-center gap-2 text-body",children:[l.jsx("input",{type:"checkbox",checked:h,onChange:S=>p(S.target.checked),className:"h-4 w-4",disabled:!!n&&n.sensitive}),"Mark as sensitive (encrypted at rest, never displayed again)"]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Sensitive values cannot be viewed after saving. If you need to verify, save a new value."}),g&&l.jsx("p",{className:"text-body text-destructive",children:g}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(ye,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function z9(e){const[t,n]=b.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return l.jsxs(En,{children:[l.jsxs(ua,{children:[l.jsxs(ca,{children:["Git repositories (",a,")"]}),!e.disabled&&l.jsxs(ye,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(xa,{className:"h-3 w-3"})," Add"]})]}),l.jsx(Jn,{className:"space-y-2",children:e.items.length===0?l.jsx("p",{className:"text-body text-muted-foreground",children:"No Git repositories."}):e.items.map(s=>{const o=s.value.localPath??Vf(s.value.url);return l.jsxs(rb,{status:s.status,onEdit:()=>n({mode:"edit",key:s.key,initial:s.value}),onDelete:()=>e.onDelete(s.key),onUndo:()=>e.onUndoDelete(s.key),disabled:e.disabled,children:[l.jsx("span",{className:"font-mono text-caption",children:s.value.url}),s.value.ref&&l.jsxs("span",{className:"text-caption text-muted-foreground",children:["@ ",s.value.ref]}),l.jsxs("span",{className:"text-caption text-muted-foreground",children:["→ ",o||"./"]})]},s.key)})}),t&&l.jsx(M9,{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 M9({open:e,onOpenChange:t,initial:n,forbiddenPaths:a,onSubmit:s}){const[o,c]=b.useState((n==null?void 0:n.url)??""),[f,m]=b.useState((n==null?void 0:n.ref)??""),[h,p]=b.useState((n==null?void 0:n.localPath)??""),[g,x]=b.useState(null);b.useEffect(()=>{e&&(c((n==null?void 0:n.url)??""),m((n==null?void 0:n.ref)??""),p((n==null?void 0:n.localPath)??""),x(null))},[e,n]);function w(S){S.preventDefault();const k=o.trim();if(!k){x("URL is required.");return}const j=h.trim()||Vf(k);if(j&&a.has(j)){x(`Another repo already occupies local path "${j}".`);return}const C={url:k,...f.trim()?{ref:f.trim()}:{},...h.trim()?{localPath:h.trim()}:{}};s(C)}return l.jsx(On,{open:e,onOpenChange:t,children:l.jsxs(Nn,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:n?"Edit Git repository":"Add Git repository"})}),l.jsxs("form",{onSubmit:w,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"git-url",children:"URL"}),l.jsx(Ft,{id:"git-url",value:o,onChange:S=>c(S.target.value),placeholder:"git@github.com:org/repo.git",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"git-ref",children:"Ref (branch / tag / sha, optional)"}),l.jsx(Ft,{id:"git-ref",value:f,onChange:S=>m(S.target.value),placeholder:"main",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"git-path",children:"Local path (optional)"}),l.jsx(Ft,{id:"git-path",value:h,onChange:S=>p(S.target.value),placeholder:Vf(o)||"repo-name",className:"font-mono"}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Relative to the session working directory. Leave empty to derive from the URL."})]}),g&&l.jsx("p",{className:"text-body text-destructive",children:g}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(ye,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function XN({name:e,displayName:t,variant:n="inline",tone:a="neutral",emptyLabel:s="—",className:o,style:c,title:f}){const m=typeof e=="string"&&e.length>0,h=typeof t=="string"&&t.length>0;if(!m&&!h)return l.jsx("span",{className:ze("mono text-label",o),style:{color:"var(--fg-4)",...c},title:f,children:s});const p=f??(m&&h?`${t} (@${e})`:h?t:`@${e}`),g=a==="accent"?"var(--accent-dim)":void 0,x=a==="accent"?"var(--accent-dim)":"var(--fg-3)";return n==="stacked"?l.jsxs("span",{className:ze("inline-flex flex-col leading-tight",o),style:{gap:1,...c},title:p??void 0,children:[h&&l.jsx("span",{className:"text-body",style:{color:g},children:t}),m&&l.jsxs("span",{className:"mono text-caption",style:{color:x},children:["@",e]})]}):l.jsxs("span",{className:ze("inline-flex items-baseline gap-1.5",o),style:c,title:p??void 0,children:[h&&l.jsx("span",{style:{color:g},children:t}),m&&l.jsxs("span",{className:"mono text-caption",style:{color:x},children:["@",e]})]})}function WN(){return Ee.get(Rn("/members"))}function D9(e,t){return Ee.patch(Rn(`/members/${encodeURIComponent(e)}`),t)}function I9(e){return Ee.delete(Rn(`/members/${encodeURIComponent(e)}`))}function JN(){const{data:e}=Ke({queryKey:["members","name-map"],queryFn:WN,staleTime:3e4});return b.useMemo(()=>{const t=new Map;if(e)for(const n of e)t.set(n.id,n.displayName||n.username);return n=>n?t.get(n)??n:"—"},[e])}function L9({agent:e,onSave:t}){const[n,a]=b.useState(!1),s=Uv(),o=JN(),c=e.metadata,f=c==null?void 0:c.tree,m=typeof(f==null?void 0:f.role)=="string"?f.role:null,h=Array.isArray(f==null?void 0:f.domains)?(f==null?void 0:f.domains).filter(x=>typeof x=="string"):[],p=e.managerId?o(e.managerId):null,g=e.delegateMention?s(e.delegateMention):null;return l.jsxs(En,{children:[l.jsxs(ua,{children:[l.jsx(ca,{children:"Profile"}),e.status==="active"&&l.jsxs(ye,{size:"xs",variant:"outline",onClick:()=>a(!0),children:[l.jsx(Tv,{className:"h-3 w-3"})," Edit"]})]}),l.jsxs(Jn,{className:"text-body space-y-1",children:[l.jsxs("div",{children:[l.jsx("span",{className:"font-semibold",children:e.displayName}),e.name&&l.jsxs("span",{className:"ml-2 font-mono text-caption text-muted-foreground",children:["@",e.name]}),g&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"mx-2 text-muted-foreground",children:"·"}),l.jsxs("span",{className:"text-muted-foreground",children:["delegate ",l.jsx(XN,{name:g.name,displayName:g.displayName})]})]})]}),l.jsxs("div",{className:"text-caption text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1",children:[l.jsxs("span",{children:["owner ",l.jsx("span",{className:"text-foreground",children:p??"—"})]}),m&&l.jsxs("span",{children:["role ",l.jsx("span",{className:"text-foreground",children:m})]}),l.jsxs("span",{children:["type ",l.jsx(Er,{tone:e.type==="autonomous_agent"?"accent":"neutral",children:e.type})]}),l.jsxs("span",{children:["visibility"," ",l.jsx(Er,{tone:e.visibility==="organization"?"accent":"outline",children:e.visibility})]}),h.length>0&&l.jsxs("span",{children:["domains"," ",l.jsx("span",{className:"inline-flex flex-wrap gap-1 align-middle",children:h.map(x=>l.jsx(Er,{tone:"outline",children:x},x))})]})]})]}),l.jsx(P9,{agent:e,open:n,onOpenChange:a,onSave:t})]})}function P9({agent:e,open:t,onOpenChange:n,onSave:a}){var M;const{memberId:s,role:o}=vt(),[c,f]=b.useState(e.displayName),[m,h]=b.useState(e.delegateMention??""),[p,g]=b.useState(e.visibility),[x,w]=b.useState(!1),[S,k]=b.useState(null);b.useEffect(()=>{t&&(f(e.displayName),h(e.delegateMention??""),g(e.visibility),k(null))},[t,e]);const j=e.type==="human",C=o==="admin"||e.managerId===s,N=Ke({queryKey:["agents-for-delegate"],queryFn:async()=>(await Mc({limit:100})).items.filter(O=>O.type==="personal_assistant"&&O.status==="active"),enabled:t&&j});async function R(L){L.preventDefault(),k(null);const O=c.trim();if(!O){k("Display name is required.");return}w(!0);try{const B={displayName:O,delegateMention:m||null};p!==e.visibility&&(B.visibility=p),await a(B),n(!1)}catch(B){k(B instanceof Error?B.message:String(B))}finally{w(!1)}}return l.jsx(On,{open:t,onOpenChange:n,children:l.jsxs(Nn,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:"Edit Identity"})}),l.jsxs("form",{onSubmit:R,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{children:"Agent name"}),l.jsx(Ft,{value:e.name?`@${e.name}`:"",disabled:!0,className:"font-mono"}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Agent name is permanent after creation — used in @mentions and CLI commands."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"id-display",children:"Display Name"}),l.jsx(Ft,{id:"id-display",value:c,onChange:L=>f(L.target.value),placeholder:"How teammates see this agent",maxLength:200})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"id-visibility",children:"Visibility"}),l.jsxs("select",{id:"id-visibility",value:p,onChange:L=>g(L.target.value),disabled:!C,className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[l.jsx("option",{value:V1.PRIVATE,children:"Private — only the manager"}),l.jsx("option",{value:V1.ORGANIZATION,children:"Organization — all members"})]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:C?"Private agents are only visible to their manager; organization agents appear in every member's list.":"Only the manager or an admin can change this agent's visibility."})]}),j&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"id-delegate",children:"Delegate Mention"}),l.jsxs("select",{id:"id-delegate",value:m,onChange:L=>h(L.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"",children:"None"}),(M=N.data)==null?void 0:M.map(L=>l.jsx("option",{value:L.uuid,children:L.displayName?`${L.displayName} (@${L.name??L.uuid})`:L.name?`@${L.name}`:L.uuid},L.uuid))]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Assistant that acts on behalf of this agent."})]}),S&&l.jsx("p",{className:"text-body text-destructive",children:S}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:()=>n(!1),disabled:x,children:"Cancel"}),l.jsx(ye,{type:"submit",disabled:x,children:x?"Saving…":"Save"})]})]})]})})}function U9(e){return e==="working"?"accent":e==="error"?"error":"outline"}function B9(e){const[t,n]=b.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return l.jsxs(En,{children:[l.jsxs(ua,{children:[l.jsxs(ca,{children:["MCP servers (",a,")"]}),!e.disabled&&l.jsxs(ye,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(xa,{className:"h-3 w-3"})," Add"]})]}),l.jsx(Jn,{className:"space-y-2",children:e.items.length===0?l.jsx("p",{className:"text-body text-muted-foreground",children:"No MCP servers. Add one to extend the agent's tools."}):e.items.map(s=>{const o=s.status==="deleted"||!e.toolHealth?"unknown":e.toolHealth(s.value.name);return l.jsxs(rb,{status:s.status,onEdit:()=>n({mode:"edit",key:s.key,initial:s.value}),onDelete:()=>e.onDelete(s.key),onUndo:()=>e.onUndoDelete(s.key),disabled:e.disabled,children:[l.jsx("span",{className:"text-caption rounded bg-muted px-1.5 py-0.5 font-mono",children:s.value.transport}),l.jsx("span",{className:"font-medium font-mono",children:s.value.name}),l.jsx(Er,{tone:U9(o),children:o}),l.jsx("span",{className:"text-caption text-muted-foreground truncate",children:F9(s.value)})]},s.key)})}),t&&l.jsx($9,{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 F9(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 $9({open:e,onOpenChange:t,initial:n,forbiddenNames:a,onSubmit:s}){const[o,c]=b.useState((n==null?void 0:n.transport)??"stdio"),[f,m]=b.useState((n==null?void 0:n.name)??""),[h,p]=b.useState((n==null?void 0:n.transport)==="stdio"?n.command:""),[g,x]=b.useState((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),[w,S]=b.useState(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),[k,j]=b.useState(null);b.useEffect(()=>{e&&(c((n==null?void 0:n.transport)??"stdio"),m((n==null?void 0:n.name)??""),p((n==null?void 0:n.transport)==="stdio"?n.command:""),x((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),S(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),j(null))},[e,n]);function C(N){if(N.preventDefault(),!f.match(/^[a-z0-9][a-z0-9_-]{0,63}$/i)){j("Name must start alphanumeric and contain only a-z0-9_-.");return}if(a.has(f.toLowerCase())){j(`Another MCP server is already named "${f}".`);return}let R;if(o==="stdio"){if(!h.trim()){j("stdio transport requires a command.");return}const M=g.trim().split(/\s+/).filter(L=>L.length>0);R={name:f,transport:"stdio",command:h.trim(),...M.length?{args:M}:{}}}else{const M=w.trim();try{new URL(M)}catch{j("URL is not valid.");return}R={name:f,transport:o,url:M}}s(R)}return l.jsx(On,{open:e,onOpenChange:t,children:l.jsxs(Nn,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:n?"Edit MCP server":"Add MCP server"})}),l.jsxs("form",{onSubmit:C,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"mcp-transport",children:"Transport"}),l.jsxs("select",{id:"mcp-transport",value:o,onChange:N=>c(N.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"stdio",children:"stdio (local subprocess)"}),l.jsx("option",{value:"http",children:"http"}),l.jsx("option",{value:"sse",children:"sse"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"mcp-name",children:"Name"}),l.jsx(Ft,{id:"mcp-name",value:f,onChange:N=>m(N.target.value),placeholder:"playwright",className:"font-mono"})]}),o==="stdio"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"mcp-command",children:"Command"}),l.jsx(Ft,{id:"mcp-command",value:h,onChange:N=>p(N.target.value),placeholder:"/usr/local/bin/playwright-mcp",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"mcp-args",children:"Args (space-separated, optional)"}),l.jsx(Ft,{id:"mcp-args",value:g,onChange:N=>x(N.target.value),placeholder:"--port 3000",className:"font-mono"})]})]}):l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"mcp-url",children:"URL"}),l.jsx(Ft,{id:"mcp-url",value:w,onChange:N=>S(N.target.value),placeholder:"https://internal.api/mcp",className:"font-mono"})]}),k&&l.jsx("p",{className:"text-body text-destructive",children:k}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(ye,{type:"submit",children:n?"Done":"Add"})]})]})]})})}const H9=[{value:"opus",label:"opus",hint:"most capable"},{value:"sonnet",label:"sonnet",hint:"balanced"},{value:"haiku",label:"haiku",hint:"fastest"}],q9=[{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"}],Z9={"claude-code":H9,codex:q9},G9={"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."},V9={value:"",label:"(unset — inherits local)"};function Q9({value:e,baseline:t,onChange:n,onRevert:a,disabled:s,provider:o="claude-code"}){const c=e!==t,f=Z9[o],m=b.useMemo(()=>{const h=[V9,...f];return e!==""&&!f.some(p=>p.value===e)&&h.push({value:e,label:e,hint:"custom"}),h},[f,e]);return l.jsxs(En,{style:{borderColor:c?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[l.jsxs(ua,{children:[l.jsxs(ca,{children:["Model",c&&l.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",color:"color-mix(in oklch, var(--state-blocked) 60%, var(--fg))"},children:"changed"})]}),c&&l.jsx(ye,{size:"xs",variant:"ghost",onClick:a,disabled:s,children:"Revert"})]}),l.jsxs(Jn,{className:"space-y-2",children:[l.jsx(K9,{items:m,value:e,onChange:n,disabled:s}),l.jsx("p",{className:"text-caption text-muted-foreground",children:G9[o]})]})]})}function K9({items:e,value:t,onChange:n,disabled:a}){const[s,o]=b.useState(!1),[c,f]=b.useState(null),m=b.useRef(null),h=b.useRef(null),p=e.find(x=>x.value===t)??e[0],g=b.useCallback(()=>{const x=m.current;if(!x)return;const w=x.getBoundingClientRect();f({top:w.bottom+4,left:w.left,width:w.width})},[]);return b.useLayoutEffect(()=>{s&&g()},[s,g]),b.useEffect(()=>{if(!s)return;const x=k=>{var C,N;const j=k.target;(C=m.current)!=null&&C.contains(j)||(N=h.current)!=null&&N.contains(j)||o(!1)},w=k=>{var j;k.key==="Escape"&&(o(!1),(j=m.current)==null||j.focus())},S=()=>g();return document.addEventListener("pointerdown",x),document.addEventListener("keydown",w),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",w),window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[s,g]),l.jsxs("div",{className:"max-w-md",children:[l.jsxs("button",{ref:m,type:"button",disabled:a,onClick:()=>o(x=>!x),className:"mono flex h-9 w-full items-center justify-between rounded-[var(--radius-input)] border border-input bg-transparent pl-3 pr-2 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 hover:border-ring transition-colors cursor-pointer","aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:"truncate",style:{color:(p==null?void 0:p.value)===""?"var(--fg-3)":void 0},children:(p==null?void 0:p.label)??t}),l.jsx(Ev,{className:"ml-2 h-3.5 w-3.5 transition-transform",style:{color:"var(--fg-3)",transform:s?"rotate(180deg)":void 0}})]}),s&&c&&Ov.createPortal(l.jsx("div",{ref:h,className:"fixed z-50 overflow-hidden rounded-[var(--radius-input)] py-1",style:{top:c.top,left:c.left,width:c.width,background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",boxShadow:"var(--shadow-md)",maxHeight:280,overflowY:"auto"},children:e.map(x=>{const w=x.value===t;return l.jsxs("button",{type:"button",onClick:()=>{n(x.value),o(!1)},className:"mono flex w-full items-center gap-2 cursor-pointer px-3 py-1.5 text-body text-left hover:bg-accent/40 transition-colors focus-visible:outline-none focus-visible:bg-accent/40",style:{background:w?"var(--bg-hover)":void 0,color:x.value===""?"var(--fg-3)":void 0},children:[l.jsx(cr,{className:"h-3.5 w-3.5 flex-shrink-0",style:{visibility:w?"visible":"hidden",color:"var(--state-idle)"}}),l.jsx("span",{className:"flex-1 truncate",children:x.label}),x.hint&&l.jsx("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:x.hint})]},x.value||"__unset")})}),document.body)]})}function Y9(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const X9=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,W9=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,J9={};function K1(e,t){return(J9.jsx?W9:X9).test(e)}const eF=/[ \t\n\f\r]/g;function tF(e){return typeof e=="object"?e.type==="text"?Y1(e.value):!1:Y1(e)}function Y1(e){return e.replace(eF,"")===""}class Lc{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}}Lc.prototype.normal={};Lc.prototype.property={};Lc.prototype.space=void 0;function e_(e,t){const n={},a={};for(const s of e)Object.assign(n,s.property),Object.assign(a,s.normal);return new Lc(n,a,t)}function Fy(e){return e.toLowerCase()}class Tr{constructor(t,n){this.attribute=n,this.property=t}}Tr.prototype.attribute="";Tr.prototype.booleanish=!1;Tr.prototype.boolean=!1;Tr.prototype.commaOrSpaceSeparated=!1;Tr.prototype.commaSeparated=!1;Tr.prototype.defined=!1;Tr.prototype.mustUseProperty=!1;Tr.prototype.number=!1;Tr.prototype.overloadedBoolean=!1;Tr.prototype.property="";Tr.prototype.spaceSeparated=!1;Tr.prototype.space=void 0;let nF=0;const Je=rl(),kn=rl(),$y=rl(),xe=rl(),Bt=rl(),ro=rl(),Pr=rl();function rl(){return 2**++nF}const Hy=Object.freeze(Object.defineProperty({__proto__:null,boolean:Je,booleanish:kn,commaOrSpaceSeparated:Pr,commaSeparated:ro,number:xe,overloadedBoolean:$y,spaceSeparated:Bt},Symbol.toStringTag,{value:"Module"})),yg=Object.keys(Hy);class ab extends Tr{constructor(t,n,a,s){let o=-1;if(super(t,n),X1(this,"space",s),typeof a=="number")for(;++o<yg.length;){const c=yg[o];X1(this,yg[o],(a&Hy[c])===Hy[c])}}}ab.prototype.defined=!0;function X1(e,t,n){n&&(e[t]=n)}function Ro(e){const t={},n={};for(const[a,s]of Object.entries(e.properties)){const o=new ab(a,e.transform(e.attributes||{},a),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(o.mustUseProperty=!0),t[a]=o,n[Fy(a)]=a,n[Fy(o.attribute)]=a}return new Lc(t,n,e.space)}const t_=Ro({properties:{ariaActiveDescendant:null,ariaAtomic:kn,ariaAutoComplete:null,ariaBusy:kn,ariaChecked:kn,ariaColCount:xe,ariaColIndex:xe,ariaColSpan:xe,ariaControls:Bt,ariaCurrent:null,ariaDescribedBy:Bt,ariaDetails:null,ariaDisabled:kn,ariaDropEffect:Bt,ariaErrorMessage:null,ariaExpanded:kn,ariaFlowTo:Bt,ariaGrabbed:kn,ariaHasPopup:null,ariaHidden:kn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Bt,ariaLevel:xe,ariaLive:null,ariaModal:kn,ariaMultiLine:kn,ariaMultiSelectable:kn,ariaOrientation:null,ariaOwns:Bt,ariaPlaceholder:null,ariaPosInSet:xe,ariaPressed:kn,ariaReadOnly:kn,ariaRelevant:null,ariaRequired:kn,ariaRoleDescription:Bt,ariaRowCount:xe,ariaRowIndex:xe,ariaRowSpan:xe,ariaSelected:kn,ariaSetSize:xe,ariaSort:null,ariaValueMax:xe,ariaValueMin:xe,ariaValueNow:xe,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 r_(e,t){return n_(e,t.toLowerCase())}const rF=Ro({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ro,acceptCharset:Bt,accessKey:Bt,action:null,allow:null,allowFullScreen:Je,allowPaymentRequest:Je,allowUserMedia:Je,alt:null,as:null,async:Je,autoCapitalize:null,autoComplete:Bt,autoFocus:Je,autoPlay:Je,blocking:Bt,capture:null,charSet:null,checked:Je,cite:null,className:Bt,cols:xe,colSpan:null,content:null,contentEditable:kn,controls:Je,controlsList:Bt,coords:xe|ro,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Je,defer:Je,dir:null,dirName:null,disabled:Je,download:$y,draggable:kn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Je,formTarget:null,headers:Bt,height:xe,hidden:$y,high:xe,href:null,hrefLang:null,htmlFor:Bt,httpEquiv:Bt,id:null,imageSizes:null,imageSrcSet:null,inert:Je,inputMode:null,integrity:null,is:null,isMap:Je,itemId:null,itemProp:Bt,itemRef:Bt,itemScope:Je,itemType:Bt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Je,low:xe,manifest:null,max:null,maxLength:xe,media:null,method:null,min:null,minLength:xe,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:xe,pattern:null,ping:Bt,placeholder:null,playsInline:Je,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Je,referrerPolicy:null,rel:Bt,required:Je,reversed:Je,rows:xe,rowSpan:xe,sandbox:Bt,scope:null,scoped:Je,seamless:Je,selected:Je,shadowRootClonable:Je,shadowRootDelegatesFocus:Je,shadowRootMode:null,shape:null,size:xe,sizes:null,slot:null,span:xe,spellCheck:kn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:xe,step:null,style:null,tabIndex:xe,target:null,title:null,translate:null,type:null,typeMustMatch:Je,useMap:null,value:kn,width:xe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Bt,axis:null,background:null,bgColor:null,border:xe,borderColor:null,bottomMargin:xe,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:xe,leftMargin:xe,link:null,longDesc:null,lowSrc:null,marginHeight:xe,marginWidth:xe,noResize:Je,noHref:Je,noShade:Je,noWrap:Je,object:null,profile:null,prompt:null,rev:null,rightMargin:xe,rules:null,scheme:null,scrolling:kn,standby:null,summary:null,text:null,topMargin:xe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:xe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Je,disableRemotePlayback:Je,prefix:null,property:null,results:xe,security:null,unselectable:null},space:"html",transform:r_}),aF=Ro({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Pr,accentHeight:xe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:xe,amplitude:xe,arabicForm:null,ascent:xe,attributeName:null,attributeType:null,azimuth:xe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:xe,by:null,calcMode:null,capHeight:xe,className:Bt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:xe,diffuseConstant:xe,direction:null,display:null,dur:null,divisor:xe,dominantBaseline:null,download:Je,dx:null,dy:null,edgeMode:null,editable:null,elevation:xe,enableBackground:null,end:null,event:null,exponent:xe,externalResourcesRequired:null,fill:null,fillOpacity:xe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ro,g2:ro,glyphName:ro,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:xe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:xe,horizOriginX:xe,horizOriginY:xe,id:null,ideographic:xe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:xe,k:xe,k1:xe,k2:xe,k3:xe,k4:xe,kernelMatrix:Pr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:xe,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:xe,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:xe,overlineThickness:xe,paintOrder:null,panose1:null,path:null,pathLength:xe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Bt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:xe,pointsAtY:xe,pointsAtZ:xe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Pr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Pr,rev:Pr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Pr,requiredFeatures:Pr,requiredFonts:Pr,requiredFormats:Pr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:xe,specularExponent:xe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:xe,strikethroughThickness:xe,string:null,stroke:null,strokeDashArray:Pr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:xe,strokeOpacity:xe,strokeWidth:null,style:null,surfaceScale:xe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Pr,tabIndex:xe,tableValues:null,target:null,targetX:xe,targetY:xe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Pr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:xe,underlineThickness:xe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:xe,values:null,vAlphabetic:xe,vMathematical:xe,vectorEffect:null,vHanging:xe,vIdeographic:xe,version:null,vertAdvY:xe,vertOriginX:xe,vertOriginY:xe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:xe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:n_}),a_=Ro({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),i_=Ro({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:r_}),s_=Ro({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),iF={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"},sF=/[A-Z]/g,W1=/-[a-z]/g,lF=/^data[-\w.:]+$/i;function oF(e,t){const n=Fy(t);let a=t,s=Tr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&lF.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(W1,cF);a="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!W1.test(o)){let c=o.replace(sF,uF);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}s=ab}return new s(a,t)}function uF(e){return"-"+e.toLowerCase()}function cF(e){return e.charAt(1).toUpperCase()}const dF=e_([t_,rF,a_,i_,s_],"html"),ib=e_([t_,aF,a_,i_,s_],"svg");function fF(e){return e.join(" ").trim()}var Hl={},vg,J1;function hF(){if(J1)return vg;J1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
|
|
388
|
+
`,h="/",p="*",g="",x="comment",w="declaration";function S(j,C){if(typeof j!="string")throw new TypeError("First argument must be a string");if(!j)return[];C=C||{};var N=1,R=1;function M(J){var W=J.match(t);W&&(N+=W.length);var Z=J.lastIndexOf(m);R=~Z?J.length-Z:R+J.length}function L(){var J={line:N,column:R};return function(W){return W.position=new O(J),Y(),W}}function O(J){this.start=J,this.end={line:N,column:R},this.source=C.source}O.prototype.content=j;function B(J){var W=new Error(C.source+":"+N+":"+R+": "+J);if(W.reason=J,W.filename=C.source,W.line=N,W.column=R,W.source=j,!C.silent)throw W}function I(J){var W=J.exec(j);if(W){var Z=W[0];return M(Z),j=j.slice(Z.length),W}}function Y(){I(n)}function z(J){var W;for(J=J||[];W=K();)W!==!1&&J.push(W);return J}function K(){var J=L();if(!(h!=j.charAt(0)||p!=j.charAt(1))){for(var W=2;g!=j.charAt(W)&&(p!=j.charAt(W)||h!=j.charAt(W+1));)++W;if(W+=2,g===j.charAt(W-1))return B("End of comment missing");var Z=j.slice(2,W-2);return R+=2,M(Z),j=j.slice(W),R+=2,J({type:x,comment:Z})}}function ie(){var J=L(),W=I(a);if(W){if(K(),!I(s))return B("property missing ':'");var Z=I(o),ne=J({type:w,property:k(W[0].replace(e,g)),value:Z?k(Z[0].replace(e,g)):g});return I(c),ne}}function ve(){var J=[];z(J);for(var W;W=ie();)W!==!1&&(J.push(W),z(J));return J}return Y(),ve()}function k(j){return j?j.replace(f,g):g}return vg=S,vg}var ek;function mF(){if(ek)return Hl;ek=1;var e=Hl&&Hl.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Hl,"__esModule",{value:!0}),Hl.default=n;const t=e(hF());function n(a,s){let o=null;if(!a||typeof a!="string")return o;const c=(0,t.default)(a),f=typeof s=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:p}=m;f?s(h,p,m):p&&(o=o||{},o[h]=p)}),o}return Hl}var Lu={},tk;function pF(){if(tk)return Lu;tk=1,Object.defineProperty(Lu,"__esModule",{value:!0}),Lu.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,o=function(h){return!h||n.test(h)||e.test(h)},c=function(h,p){return p.toUpperCase()},f=function(h,p){return"".concat(p,"-")},m=function(h,p){return p===void 0&&(p={}),o(h)?h:(h=h.toLowerCase(),p.reactCompat?h=h.replace(s,f):h=h.replace(a,f),h.replace(t,c))};return Lu.camelCase=m,Lu}var Pu,nk;function gF(){if(nk)return Pu;nk=1;var e=Pu&&Pu.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(mF()),n=pF();function a(s,o){var c={};return!s||typeof s!="string"||(0,t.default)(s,function(f,m){f&&m&&(c[(0,n.camelCase)(f,o)]=m)}),c}return a.default=a,Pu=a,Pu}var yF=gF();const vF=rh(yF),l_=o_("end"),sb=o_("start");function o_(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 bF(e){const t=sb(e),n=l_(e);if(t&&n)return{start:t,end:n}}function ec(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?rk(e.position):"start"in e||"end"in e?rk(e):"line"in e||"column"in e?qy(e):""}function qy(e){return ak(e&&e.line)+":"+ak(e&&e.column)}function rk(e){return qy(e&&e.start)+"-"+qy(e&&e.end)}function ak(e){return e&&typeof e=="number"?e:1}class er extends Error{constructor(t,n,a){super(),typeof n=="string"&&(a=n,n=void 0);let s="",o={},c=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?s=t:!o.cause&&t&&(c=!0,s=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof a=="string"){const m=a.indexOf(":");m===-1?o.ruleId=a:(o.source=a.slice(0,m),o.ruleId=a.slice(m+1))}if(!o.place&&o.ancestors&&o.ancestors){const m=o.ancestors[o.ancestors.length-1];m&&(o.place=m.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=f?f.line:void 0,this.name=ec(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}er.prototype.file="";er.prototype.name="";er.prototype.reason="";er.prototype.message="";er.prototype.stack="";er.prototype.column=void 0;er.prototype.line=void 0;er.prototype.ancestors=void 0;er.prototype.cause=void 0;er.prototype.fatal=void 0;er.prototype.place=void 0;er.prototype.ruleId=void 0;er.prototype.source=void 0;const lb={}.hasOwnProperty,xF=new Map,wF=/[A-Z]/g,SF=new Set(["table","tbody","thead","tfoot","tr"]),kF=new Set(["td","th"]),u_="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function jF(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=OF(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=RF(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"?ib:dF,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=c_(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function c_(e,t,n){if(t.type==="element")return EF(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return CF(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return _F(e,t,n);if(t.type==="mdxjsEsm")return NF(e,t);if(t.type==="root")return TF(e,t,n);if(t.type==="text")return AF(e,t)}function EF(e,t,n){const a=e.schema;let s=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(s=ib,e.schema=s),e.ancestors.push(t);const o=f_(e,t.tagName,!1),c=zF(e,t);let f=ub(e,t);return SF.has(t.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!tF(m):!0})),d_(e,c,o,t),ob(c,f),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function CF(e,t){if(t.data&&t.data.estree&&e.evaluater){const a=t.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}pc(e,t.position)}function NF(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);pc(e,t.position)}function _F(e,t,n){const a=e.schema;let s=a;t.name==="svg"&&a.space==="html"&&(s=ib,e.schema=s),e.ancestors.push(t);const o=t.name===null?e.Fragment:f_(e,t.name,!0),c=MF(e,t),f=ub(e,t);return d_(e,c,o,t),ob(c,f),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function TF(e,t,n){const a={};return ob(a,ub(e,t)),e.create(t,e.Fragment,a,n)}function AF(e,t){return t.value}function d_(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function ob(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function RF(e,t,n){return a;function a(s,o,c,f){const h=Array.isArray(c.children)?n:t;return f?h(o,c,f):h(o,c)}}function OF(e,t){return n;function n(a,s,o,c){const f=Array.isArray(o.children),m=sb(a);return t(s,o,c,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function zF(e,t){const n={};let a,s;for(s in t.properties)if(s!=="children"&&lb.call(t.properties,s)){const o=DF(e,s,t.properties[s]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&kF.has(t.tagName)?a=f:n[c]=f}}if(a){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return n}function MF(e,t){const n={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const o=a.data.estree.body[0];o.type;const c=o.expression;c.type;const f=c.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else pc(e,t.position);else{const s=a.name;let o;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const f=a.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else pc(e,t.position);else o=a.value===null?!0:a.value;n[s]=o}return n}function ub(e,t){const n=[];let a=-1;const s=e.passKeys?new Map:xF;for(;++a<t.children.length;){const o=t.children[a];let c;if(e.passKeys){const m=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(m){const h=s.get(m)||0;c=m+"-"+h,s.set(m,h+1)}}const f=c_(e,o,c);f!==void 0&&n.push(f)}return n}function DF(e,t,n){const a=oF(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=a.commaSeparated?Y9(n):fF(n)),a.property==="style"){let s=typeof n=="object"?n:IF(e,String(n));return e.stylePropertyNameCase==="css"&&(s=LF(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&a.space?iF[a.property]||a.property:a.attribute,n]}}function IF(e,t){try{return vF(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const a=n,s=new er("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=u_+"#cannot-parse-style-attribute",s}}function f_(e,t,n){let a;if(!n)a={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let o=-1,c;for(;++o<s.length;){const f=K1(s[o])?{type:"Identifier",name:s[o]}:{type:"Literal",value:s[o]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}a=c}else a=K1(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const s=a.value;return lb.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(a);pc(e)}function pc(e,t){const n=new er("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=u_+"#cannot-handle-mdx-estrees-without-createevaluater",n}function LF(e){const t={};let n;for(n in e)lb.call(e,n)&&(t[PF(n)]=e[n]);return t}function PF(e){let t=e.replace(wF,UF);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function UF(e){return"-"+e.toLowerCase()}const bg={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"]},BF={};function cb(e,t){const n=BF,a=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return h_(e,a,s)}function h_(e,t,n){if(FF(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return ik(e.children,t,n)}return Array.isArray(e)?ik(e,t,n):""}function ik(e,t,n){const a=[];let s=-1;for(;++s<e.length;)a[s]=h_(e[s],t,n);return a.join("")}function FF(e){return!!(e&&typeof e=="object")}const sk=document.createElement("i");function db(e){const t="&"+e+";";sk.innerHTML=t;const n=sk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Fr(e,t,n,a){const s=e.length;let o=0,c;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,a.length<1e4)c=Array.from(a),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);o<a.length;)c=a.slice(o,o+1e4),c.unshift(t,0),e.splice(...c),o+=1e4,t+=1e4}function ra(e,t){return e.length>0?(Fr(e,e.length,0,t),e):t}const lk={}.hasOwnProperty;function m_(e){const t={};let n=-1;for(;++n<e.length;)$F(t,e[n]);return t}function $F(e,t){let n;for(n in t){const s=(lk.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let c;if(o)for(c in o){lk.call(s,c)||(s[c]=[]);const f=o[c];HF(s[c],Array.isArray(f)?f:f?[f]:[])}}}function HF(e,t){let n=-1;const a=[];for(;++n<t.length;)(t[n].add==="after"?e:a).push(t[n]);Fr(e,0,0,a)}function p_(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ba(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ur=gs(/[A-Za-z]/),Wn=gs(/[\dA-Za-z]/),qF=gs(/[#-'*+\--9=?A-Z^-~]/);function Yf(e){return e!==null&&(e<32||e===127)}const Zy=gs(/\d/),ZF=gs(/[\dA-Fa-f]/),GF=gs(/[!-/:-@[-`{-~]/);function He(e){return e!==null&&e<-2}function Lt(e){return e!==null&&(e<0||e===32)}function ct(e){return e===-2||e===-1||e===32}const Th=gs(new RegExp("\\p{P}|\\p{S}","u")),Xs=gs(/\s/);function gs(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Oo(e){const t=[];let n=-1,a=0,s=0;for(;++n<e.length;){const o=e.charCodeAt(n);let c="";if(o===37&&Wn(e.charCodeAt(n+1))&&Wn(e.charCodeAt(n+2)))s=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(c=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(n+1);o<56320&&f>56319&&f<57344?(c=String.fromCharCode(o,f),s=1):c="�"}else c=String.fromCharCode(o);c&&(t.push(e.slice(a,n),encodeURIComponent(c)),a=n+s+1,c=""),s&&(n+=s,s=0)}return t.join("")+e.slice(a)}function xt(e,t,n,a){const s=a?a-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(m){return ct(m)?(e.enter(n),f(m)):t(m)}function f(m){return ct(m)&&o++<s?(e.consume(m),f):(e.exit(n),t(m))}}const VF={tokenize:QF};function QF(e){const t=e.attempt(this.parser.constructs.contentInitial,a,s);let n;return t;function a(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),xt(e,t,"linePrefix")}function s(f){return e.enter("paragraph"),o(f)}function o(f){const m=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=m),n=m,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return He(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const KF={tokenize:YF},ok={tokenize:XF};function YF(e){const t=this,n=[];let a=0,s,o,c;return f;function f(R){if(a<n.length){const M=n[a];return t.containerState=M[1],e.attempt(M[0].continuation,m,h)(R)}return h(R)}function m(R){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&N();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 B=M;for(;B<t.events.length;)t.events[B][1].end={...O},B++;return Fr(t.events,L+1,0,t.events.slice(M)),t.events.length=B,h(R)}return f(R)}function h(R){if(a===n.length){if(!s)return x(R);if(s.currentConstruct&&s.currentConstruct.concrete)return S(R);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ok,p,g)(R)}function p(R){return s&&N(),C(a),x(R)}function g(R){return t.parser.lazy[t.now().line]=a!==n.length,c=t.now().offset,S(R)}function x(R){return t.containerState={},e.attempt(ok,w,S)(R)}function w(R){return a++,n.push([t.currentConstruct,t.containerState]),x(R)}function S(R){if(R===null){s&&N(),C(0),e.consume(R);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:o}),k(R)}function k(R){if(R===null){j(e.exit("chunkFlow"),!0),C(0),e.consume(R);return}return He(R)?(e.consume(R),j(e.exit("chunkFlow")),a=0,t.interrupt=void 0,f):(e.consume(R),k)}function j(R,M){const L=t.sliceStream(R);if(M&&L.push(null),R.previous=o,o&&(o.next=R),o=R,s.defineSkip(R.start),s.write(L),t.parser.lazy[R.start.line]){let O=s.events.length;for(;O--;)if(s.events[O][1].start.offset<c&&(!s.events[O][1].end||s.events[O][1].end.offset>c))return;const B=t.events.length;let I=B,Y,z;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(Y){z=t.events[I][1].end;break}Y=!0}for(C(a),O=B;O<t.events.length;)t.events[O][1].end={...z},O++;Fr(t.events,I+1,0,t.events.slice(B)),t.events.length=O}}function C(R){let M=n.length;for(;M-- >R;){const L=n[M];t.containerState=L[1],L[0].exit.call(t,e)}n.length=R}function N(){s.write([null]),o=void 0,s=void 0,t.containerState._closeFlow=void 0}}function XF(e,t,n){return xt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function So(e){if(e===null||Lt(e)||Xs(e))return 1;if(Th(e))return 2}function Ah(e,t,n){const a=[];let s=-1;for(;++s<e.length;){const o=e[s].resolveAll;o&&!a.includes(o)&&(t=o(t,n),a.push(o))}return t}const Gy={name:"attention",resolveAll:WF,tokenize:JF};function WF(e,t){let n=-1,a,s,o,c,f,m,h,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(a=n;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;m=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[a][1].end},x={...e[n][1].start};uk(g,-m),uk(x,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[a][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:x},o={type:m>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},s={type:m>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[a][1].end={...c.start},e[n][1].start={...f.end},h=[],e[a][1].end.offset-e[a][1].start.offset&&(h=ra(h,[["enter",e[a][1],t],["exit",e[a][1],t]])),h=ra(h,[["enter",s,t],["enter",c,t],["exit",c,t],["enter",o,t]]),h=ra(h,Ah(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),h=ra(h,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,h=ra(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Fr(e,a-1,n-a+3,h),n=a+h.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function JF(e,t){const n=this.parser.constructs.attentionMarkers.null,a=this.previous,s=So(a);let o;return c;function c(m){return o=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===o)return e.consume(m),f;const h=e.exit("attentionSequence"),p=So(m),g=!p||p===2&&s||n.includes(m),x=!s||s===2&&p||n.includes(a);return h._open=!!(o===42?g:g&&(s||!x)),h._close=!!(o===42?x:x&&(p||!g)),t(m)}}function uk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const e$={name:"autolink",tokenize:t$};function t$(e,t,n){let a=0;return s;function s(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(w){return ur(w)?(e.consume(w),c):w===64?n(w):h(w)}function c(w){return w===43||w===45||w===46||Wn(w)?(a=1,f(w)):h(w)}function f(w){return w===58?(e.consume(w),a=0,m):(w===43||w===45||w===46||Wn(w))&&a++<32?(e.consume(w),f):(a=0,h(w))}function m(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):w===null||w===32||w===60||Yf(w)?n(w):(e.consume(w),m)}function h(w){return w===64?(e.consume(w),p):qF(w)?(e.consume(w),h):n(w)}function p(w){return Wn(w)?g(w):n(w)}function g(w){return w===46?(e.consume(w),a=0,p):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):x(w)}function x(w){if((w===45||Wn(w))&&a++<63){const S=w===45?x:g;return e.consume(w),S}return n(w)}}const Pc={partial:!0,tokenize:n$};function n$(e,t,n){return a;function a(o){return ct(o)?xt(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||He(o)?t(o):n(o)}}const g_={continuation:{tokenize:a$},exit:i$,name:"blockQuote",tokenize:r$};function r$(e,t,n){const a=this;return s;function s(c){if(c===62){const f=a.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),o}return n(c)}function o(c){return ct(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function a$(e,t,n){const a=this;return s;function s(c){return ct(c)?xt(e,o,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(g_,t,n)(c)}}function i$(e){e.exit("blockQuote")}const y_={name:"characterEscape",tokenize:s$};function s$(e,t,n){return a;function a(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),s}function s(o){return GF(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const v_={name:"characterReference",tokenize:l$};function l$(e,t,n){const a=this;let s=0,o,c;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),o=31,c=Wn,p(g))}function h(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=ZF,p):(e.enter("characterReferenceValue"),o=7,c=Zy,p(g))}function p(g){if(g===59&&s){const x=e.exit("characterReferenceValue");return c===Wn&&!db(a.sliceSerialize(x))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&s++<o?(e.consume(g),p):n(g)}}const ck={partial:!0,tokenize:u$},dk={concrete:!0,name:"codeFenced",tokenize:o$};function o$(e,t,n){const a=this,s={partial:!0,tokenize:L};let o=0,c=0,f;return m;function m(O){return h(O)}function h(O){const B=a.events[a.events.length-1];return o=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,f=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(O)}function p(O){return O===f?(c++,e.consume(O),p):c<3?n(O):(e.exit("codeFencedFenceSequence"),ct(O)?xt(e,g,"whitespace")(O):g(O))}function g(O){return O===null||He(O)?(e.exit("codeFencedFence"),a.interrupt?t(O):e.check(ck,k,M)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(O))}function x(O){return O===null||He(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(O)):ct(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),xt(e,w,"whitespace")(O)):O===96&&O===f?n(O):(e.consume(O),x)}function w(O){return O===null||He(O)?g(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(O))}function S(O){return O===null||He(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(O)):O===96&&O===f?n(O):(e.consume(O),S)}function k(O){return e.attempt(s,M,j)(O)}function j(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),C}function C(O){return o>0&&ct(O)?xt(e,N,"linePrefix",o+1)(O):N(O)}function N(O){return O===null||He(O)?e.check(ck,k,M)(O):(e.enter("codeFlowValue"),R(O))}function R(O){return O===null||He(O)?(e.exit("codeFlowValue"),N(O)):(e.consume(O),R)}function M(O){return e.exit("codeFenced"),t(O)}function L(O,B,I){let Y=0;return z;function z(W){return O.enter("lineEnding"),O.consume(W),O.exit("lineEnding"),K}function K(W){return O.enter("codeFencedFence"),ct(W)?xt(O,ie,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):ie(W)}function ie(W){return W===f?(O.enter("codeFencedFenceSequence"),ve(W)):I(W)}function ve(W){return W===f?(Y++,O.consume(W),ve):Y>=c?(O.exit("codeFencedFenceSequence"),ct(W)?xt(O,J,"whitespace")(W):J(W)):I(W)}function J(W){return W===null||He(W)?(O.exit("codeFencedFence"),B(W)):I(W)}}}function u$(e,t,n){const a=this;return s;function s(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o)}function o(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}const xg={name:"codeIndented",tokenize:d$},c$={partial:!0,tokenize:f$};function d$(e,t,n){const a=this;return s;function s(h){return e.enter("codeIndented"),xt(e,o,"linePrefix",5)(h)}function o(h){const p=a.events[a.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?c(h):n(h)}function c(h){return h===null?m(h):He(h)?e.attempt(c$,c,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||He(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),t(h)}}function f$(e,t,n){const a=this;return s;function s(c){return a.parser.lazy[a.now().line]?n(c):He(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),s):xt(e,o,"linePrefix",5)(c)}function o(c){const f=a.events[a.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):He(c)?s(c):n(c)}}const h$={name:"codeText",previous:p$,resolve:m$,tokenize:g$};function m$(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 p$(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function g$(e,t,n){let a=0,s,o;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),a++,f):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(o=e.enter("codeTextSequence"),s=0,p(g)):He(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(g))}function h(g){return g===null||g===32||g===96||He(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),h)}function p(g){return g===96?(e.consume(g),s++,p):s===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(o.type="codeTextData",h(g))}}class y${constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const a=n??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(t,a):t>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,n,a){const s=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return a&&Uu(this.left,a),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Uu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Uu(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Uu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Uu(this.left,n.reverse())}}}function Uu(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function b_(e){const t={};let n=-1,a,s,o,c,f,m,h;const p=new y$(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(a=p.get(n),n&&a[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(m=a[1]._tokenizer.events,o=0,o<m.length&&m[o][1].type==="lineEndingBlank"&&(o+=2),o<m.length&&m[o][1].type==="content"))for(;++o<m.length&&m[o][1].type!=="content";)m[o][1].type==="chunkText"&&(m[o][1]._isInFirstContentOfListItem=!0,o++);if(a[0]==="enter")a[1].contentType&&(Object.assign(t,v$(p,n)),n=t[n],h=!0);else if(a[1]._container){for(o=n,s=void 0;o--;)if(c=p.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(s&&(p.get(s)[1].type="lineEndingBlank"),c[1].type="lineEnding",s=o);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;s&&(a[1].end={...p.get(s)[1].start},f=p.slice(s,n),f.unshift(a),p.splice(s,n-s+1,f))}}return Fr(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!h}function v$(e,t){const n=e.get(t)[1],a=e.get(t)[2];let s=t-1;const o=[];let c=n._tokenizer;c||(c=a.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,m=[],h={};let p,g,x=-1,w=n,S=0,k=0;const j=[k];for(;w;){for(;e.get(++s)[1]!==w;);o.push(s),w._tokenizer||(p=a.sliceStream(w),w.next||p.push(null),g&&c.defineSkip(w.start),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(p),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=w,w=w.next}for(w=n;++x<f.length;)f[x][0]==="exit"&&f[x-1][0]==="enter"&&f[x][1].type===f[x-1][1].type&&f[x][1].start.line!==f[x][1].end.line&&(k=x+1,j.push(k),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(c.events=[],w?(w._tokenizer=void 0,w.previous=void 0):j.pop(),x=j.length;x--;){const C=f.slice(j[x],j[x+1]),N=o.pop();m.push([N,N+C.length-1]),e.splice(N,2,C)}for(m.reverse(),x=-1;++x<m.length;)h[S+m[x][0]]=S+m[x][1],S+=m[x][1]-m[x][0]-1;return h}const b$={resolve:w$,tokenize:S$},x$={partial:!0,tokenize:k$};function w$(e){return b_(e),e}function S$(e,t){let n;return a;function a(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(f)}function s(f){return f===null?o(f):He(f)?e.check(x$,c,o)(f):(e.consume(f),s)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function c(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function k$(e,t,n){const a=this;return s;function s(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),xt(e,o,"linePrefix")}function o(c){if(c===null||He(c))return n(c);const f=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):e.interrupt(a.parser.constructs.flow,n,t)(c)}}function x_(e,t,n,a,s,o,c,f,m){const h=m||Number.POSITIVE_INFINITY;let p=0;return g;function g(C){return C===60?(e.enter(a),e.enter(s),e.enter(o),e.consume(C),e.exit(o),x):C===null||C===32||C===41||Yf(C)?n(C):(e.enter(a),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),k(C))}function x(C){return C===62?(e.enter(o),e.consume(C),e.exit(o),e.exit(s),e.exit(a),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),w(C))}function w(C){return C===62?(e.exit("chunkString"),e.exit(f),x(C)):C===null||C===60||He(C)?n(C):(e.consume(C),C===92?S:w)}function S(C){return C===60||C===62||C===92?(e.consume(C),w):w(C)}function k(C){return!p&&(C===null||C===41||Lt(C))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(a),t(C)):p<h&&C===40?(e.consume(C),p++,k):C===41?(e.consume(C),p--,k):C===null||C===32||C===40||Yf(C)?n(C):(e.consume(C),C===92?j:k)}function j(C){return C===40||C===41||C===92?(e.consume(C),k):k(C)}}function w_(e,t,n,a,s,o){const c=this;let f=0,m;return h;function h(w){return e.enter(a),e.enter(s),e.consume(w),e.exit(s),e.enter(o),p}function p(w){return f>999||w===null||w===91||w===93&&!m||w===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?n(w):w===93?(e.exit(o),e.enter(s),e.consume(w),e.exit(s),e.exit(a),t):He(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),g(w))}function g(w){return w===null||w===91||w===93||He(w)||f++>999?(e.exit("chunkString"),p(w)):(e.consume(w),m||(m=!ct(w)),w===92?x:g)}function x(w){return w===91||w===92||w===93?(e.consume(w),f++,g):g(w)}}function S_(e,t,n,a,s,o){let c;return f;function f(x){return x===34||x===39||x===40?(e.enter(a),e.enter(s),e.consume(x),e.exit(s),c=x===40?41:x,m):n(x)}function m(x){return x===c?(e.enter(s),e.consume(x),e.exit(s),e.exit(a),t):(e.enter(o),h(x))}function h(x){return x===c?(e.exit(o),m(c)):x===null?n(x):He(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),xt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===c||x===null||He(x)?(e.exit("chunkString"),h(x)):(e.consume(x),x===92?g:p)}function g(x){return x===c||x===92?(e.consume(x),p):p(x)}}function tc(e,t){let n;return a;function a(s){return He(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,a):ct(s)?xt(e,a,n?"linePrefix":"lineSuffix")(s):t(s)}}const j$={name:"definition",tokenize:C$},E$={partial:!0,tokenize:N$};function C$(e,t,n){const a=this;let s;return o;function o(w){return e.enter("definition"),c(w)}function c(w){return w_.call(a,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return s=ba(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),m):n(w)}function m(w){return Lt(w)?tc(e,h)(w):h(w)}function h(w){return x_(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function p(w){return e.attempt(E$,g,g)(w)}function g(w){return ct(w)?xt(e,x,"whitespace")(w):x(w)}function x(w){return w===null||He(w)?(e.exit("definition"),a.parser.defined.push(s),t(w)):n(w)}}function N$(e,t,n){return a;function a(f){return Lt(f)?tc(e,s)(f):n(f)}function s(f){return S_(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return ct(f)?xt(e,c,"whitespace")(f):c(f)}function c(f){return f===null||He(f)?t(f):n(f)}}const _$={name:"hardBreakEscape",tokenize:T$};function T$(e,t,n){return a;function a(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return He(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const A$={name:"headingAtx",resolve:R$,tokenize:O$};function R$(e,t){let n=e.length-2,a=3,s,o;return e[a][1].type==="whitespace"&&(a+=2),n-2>a&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(a===n-1||n-4>a&&e[n-2][1].type==="whitespace")&&(n-=a+1===n?2:4),n>a&&(s={type:"atxHeadingText",start:e[a][1].start,end:e[n][1].end},o={type:"chunkText",start:e[a][1].start,end:e[n][1].end,contentType:"text"},Fr(e,a,n-a+1,[["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t]])),e}function O$(e,t,n){let a=0;return s;function s(p){return e.enter("atxHeading"),o(p)}function o(p){return e.enter("atxHeadingSequence"),c(p)}function c(p){return p===35&&a++<6?(e.consume(p),c):p===null||Lt(p)?(e.exit("atxHeadingSequence"),f(p)):n(p)}function f(p){return p===35?(e.enter("atxHeadingSequence"),m(p)):p===null||He(p)?(e.exit("atxHeading"),t(p)):ct(p)?xt(e,f,"whitespace")(p):(e.enter("atxHeadingText"),h(p))}function m(p){return p===35?(e.consume(p),m):(e.exit("atxHeadingSequence"),f(p))}function h(p){return p===null||p===35||Lt(p)?(e.exit("atxHeadingText"),f(p)):(e.consume(p),h)}}const z$=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],fk=["pre","script","style","textarea"],M$={concrete:!0,name:"htmlFlow",resolveTo:L$,tokenize:P$},D$={partial:!0,tokenize:B$},I$={partial:!0,tokenize:U$};function L$(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 P$(e,t,n){const a=this;let s,o,c,f,m;return h;function h(T){return p(T)}function p(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),g}function g(T){return T===33?(e.consume(T),x):T===47?(e.consume(T),o=!0,k):T===63?(e.consume(T),s=3,a.interrupt?t:D):ur(T)?(e.consume(T),c=String.fromCharCode(T),j):n(T)}function x(T){return T===45?(e.consume(T),s=2,w):T===91?(e.consume(T),s=5,f=0,S):ur(T)?(e.consume(T),s=4,a.interrupt?t:D):n(T)}function w(T){return T===45?(e.consume(T),a.interrupt?t:D):n(T)}function S(T){const G="CDATA[";return T===G.charCodeAt(f++)?(e.consume(T),f===G.length?a.interrupt?t:ie:S):n(T)}function k(T){return ur(T)?(e.consume(T),c=String.fromCharCode(T),j):n(T)}function j(T){if(T===null||T===47||T===62||Lt(T)){const G=T===47,q=c.toLowerCase();return!G&&!o&&fk.includes(q)?(s=1,a.interrupt?t(T):ie(T)):z$.includes(c.toLowerCase())?(s=6,G?(e.consume(T),C):a.interrupt?t(T):ie(T)):(s=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(T):o?N(T):R(T))}return T===45||Wn(T)?(e.consume(T),c+=String.fromCharCode(T),j):n(T)}function C(T){return T===62?(e.consume(T),a.interrupt?t:ie):n(T)}function N(T){return ct(T)?(e.consume(T),N):z(T)}function R(T){return T===47?(e.consume(T),z):T===58||T===95||ur(T)?(e.consume(T),M):ct(T)?(e.consume(T),R):z(T)}function M(T){return T===45||T===46||T===58||T===95||Wn(T)?(e.consume(T),M):L(T)}function L(T){return T===61?(e.consume(T),O):ct(T)?(e.consume(T),L):R(T)}function O(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),m=T,B):ct(T)?(e.consume(T),O):I(T)}function B(T){return T===m?(e.consume(T),m=null,Y):T===null||He(T)?n(T):(e.consume(T),B)}function I(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||Lt(T)?L(T):(e.consume(T),I)}function Y(T){return T===47||T===62||ct(T)?R(T):n(T)}function z(T){return T===62?(e.consume(T),K):n(T)}function K(T){return T===null||He(T)?ie(T):ct(T)?(e.consume(T),K):n(T)}function ie(T){return T===45&&s===2?(e.consume(T),Z):T===60&&s===1?(e.consume(T),ne):T===62&&s===4?(e.consume(T),P):T===63&&s===3?(e.consume(T),D):T===93&&s===5?(e.consume(T),Ae):He(T)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(D$,F,ve)(T)):T===null||He(T)?(e.exit("htmlFlowData"),ve(T)):(e.consume(T),ie)}function ve(T){return e.check(I$,J,F)(T)}function J(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),W}function W(T){return T===null||He(T)?ve(T):(e.enter("htmlFlowData"),ie(T))}function Z(T){return T===45?(e.consume(T),D):ie(T)}function ne(T){return T===47?(e.consume(T),c="",ke):ie(T)}function ke(T){if(T===62){const G=c.toLowerCase();return fk.includes(G)?(e.consume(T),P):ie(T)}return ur(T)&&c.length<8?(e.consume(T),c+=String.fromCharCode(T),ke):ie(T)}function Ae(T){return T===93?(e.consume(T),D):ie(T)}function D(T){return T===62?(e.consume(T),P):T===45&&s===2?(e.consume(T),D):ie(T)}function P(T){return T===null||He(T)?(e.exit("htmlFlowData"),F(T)):(e.consume(T),P)}function F(T){return e.exit("htmlFlow"),t(T)}}function U$(e,t,n){const a=this;return s;function s(c){return He(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):n(c)}function o(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}function B$(e,t,n){return a;function a(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Pc,t,n)}}const F$={name:"htmlText",tokenize:$$};function $$(e,t,n){const a=this;let s,o,c;return f;function f(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),m}function m(D){return D===33?(e.consume(D),h):D===47?(e.consume(D),L):D===63?(e.consume(D),R):ur(D)?(e.consume(D),I):n(D)}function h(D){return D===45?(e.consume(D),p):D===91?(e.consume(D),o=0,S):ur(D)?(e.consume(D),N):n(D)}function p(D){return D===45?(e.consume(D),w):n(D)}function g(D){return D===null?n(D):D===45?(e.consume(D),x):He(D)?(c=g,ne(D)):(e.consume(D),g)}function x(D){return D===45?(e.consume(D),w):g(D)}function w(D){return D===62?Z(D):D===45?x(D):g(D)}function S(D){const P="CDATA[";return D===P.charCodeAt(o++)?(e.consume(D),o===P.length?k:S):n(D)}function k(D){return D===null?n(D):D===93?(e.consume(D),j):He(D)?(c=k,ne(D)):(e.consume(D),k)}function j(D){return D===93?(e.consume(D),C):k(D)}function C(D){return D===62?Z(D):D===93?(e.consume(D),C):k(D)}function N(D){return D===null||D===62?Z(D):He(D)?(c=N,ne(D)):(e.consume(D),N)}function R(D){return D===null?n(D):D===63?(e.consume(D),M):He(D)?(c=R,ne(D)):(e.consume(D),R)}function M(D){return D===62?Z(D):R(D)}function L(D){return ur(D)?(e.consume(D),O):n(D)}function O(D){return D===45||Wn(D)?(e.consume(D),O):B(D)}function B(D){return He(D)?(c=B,ne(D)):ct(D)?(e.consume(D),B):Z(D)}function I(D){return D===45||Wn(D)?(e.consume(D),I):D===47||D===62||Lt(D)?Y(D):n(D)}function Y(D){return D===47?(e.consume(D),Z):D===58||D===95||ur(D)?(e.consume(D),z):He(D)?(c=Y,ne(D)):ct(D)?(e.consume(D),Y):Z(D)}function z(D){return D===45||D===46||D===58||D===95||Wn(D)?(e.consume(D),z):K(D)}function K(D){return D===61?(e.consume(D),ie):He(D)?(c=K,ne(D)):ct(D)?(e.consume(D),K):Y(D)}function ie(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),s=D,ve):He(D)?(c=ie,ne(D)):ct(D)?(e.consume(D),ie):(e.consume(D),J)}function ve(D){return D===s?(e.consume(D),s=void 0,W):D===null?n(D):He(D)?(c=ve,ne(D)):(e.consume(D),ve)}function J(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||Lt(D)?Y(D):(e.consume(D),J)}function W(D){return D===47||D===62||Lt(D)?Y(D):n(D)}function Z(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function ne(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),ke}function ke(D){return ct(D)?xt(e,Ae,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):Ae(D)}function Ae(D){return e.enter("htmlTextData"),c(D)}}const fb={name:"labelEnd",resolveAll:G$,resolveTo:V$,tokenize:Q$},H$={tokenize:K$},q$={tokenize:Y$},Z$={tokenize:X$};function G$(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&&Fr(e,0,e.length,n),e}function V$(e,t){let n=e.length,a=0,s,o,c,f;for(;n--;)if(s=e[n][1],o){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(o=n,s.type!=="labelLink")){a=2;break}}else s.type==="labelEnd"&&(c=n);const m={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[o][1].start},end:{...e[c][1].end}},p={type:"labelText",start:{...e[o+a+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",m,t],["enter",h,t]],f=ra(f,e.slice(o+1,o+a+3)),f=ra(f,[["enter",p,t]]),f=ra(f,Ah(t.parser.constructs.insideSpan.null,e.slice(o+a+4,c-3),t)),f=ra(f,[["exit",p,t],e[c-2],e[c-1],["exit",h,t]]),f=ra(f,e.slice(c+1)),f=ra(f,[["exit",m,t]]),Fr(e,o,e.length,f),e}function Q$(e,t,n){const a=this;let s=a.events.length,o,c;for(;s--;)if((a.events[s][1].type==="labelImage"||a.events[s][1].type==="labelLink")&&!a.events[s][1]._balanced){o=a.events[s][1];break}return f;function f(x){return o?o._inactive?g(x):(c=a.parser.defined.includes(ba(a.sliceSerialize({start:o.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(x),e.exit("labelMarker"),e.exit("labelEnd"),m):n(x)}function m(x){return x===40?e.attempt(H$,p,c?p:g)(x):x===91?e.attempt(q$,p,c?h:g)(x):c?p(x):g(x)}function h(x){return e.attempt(Z$,p,g)(x)}function p(x){return t(x)}function g(x){return o._balanced=!0,n(x)}}function K$(e,t,n){return a;function a(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),s}function s(g){return Lt(g)?tc(e,o)(g):o(g)}function o(g){return g===41?p(g):x_(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Lt(g)?tc(e,m)(g):p(g)}function f(g){return n(g)}function m(g){return g===34||g===39||g===40?S_(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):p(g)}function h(g){return Lt(g)?tc(e,p)(g):p(g)}function p(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function Y$(e,t,n){const a=this;return s;function s(f){return w_.call(a,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return a.parser.defined.includes(ba(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function c(f){return n(f)}}function X$(e,t,n){return a;function a(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),s}function s(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const W$={name:"labelStartImage",resolveAll:fb.resolveAll,tokenize:J$};function J$(e,t,n){const a=this;return s;function s(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):n(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(f):t(f)}}const e8={name:"labelStartLink",resolveAll:fb.resolveAll,tokenize:t8};function t8(e,t,n){const a=this;return s;function s(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),o}function o(c){return c===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(c):t(c)}}const wg={name:"lineEnding",tokenize:n8};function n8(e,t){return n;function n(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),xt(e,t,"linePrefix")}}const Mf={name:"thematicBreak",tokenize:r8};function r8(e,t,n){let a=0,s;return o;function o(h){return e.enter("thematicBreak"),c(h)}function c(h){return s=h,f(h)}function f(h){return h===s?(e.enter("thematicBreakSequence"),m(h)):a>=3&&(h===null||He(h))?(e.exit("thematicBreak"),t(h)):n(h)}function m(h){return h===s?(e.consume(h),a++,m):(e.exit("thematicBreakSequence"),ct(h)?xt(e,f,"whitespace")(h):f(h))}}const xr={continuation:{tokenize:l8},exit:u8,name:"list",tokenize:s8},a8={partial:!0,tokenize:c8},i8={partial:!0,tokenize:o8};function s8(e,t,n){const a=this,s=a.events[a.events.length-1];let o=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,c=0;return f;function f(w){const S=a.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!a.containerState.marker||w===a.containerState.marker:Zy(w)){if(a.containerState.type||(a.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(Mf,n,h)(w):h(w);if(!a.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(w)}return n(w)}function m(w){return Zy(w)&&++c<10?(e.consume(w),m):(!a.interrupt||c<2)&&(a.containerState.marker?w===a.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),h(w)):n(w)}function h(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||w,e.check(Pc,a.interrupt?n:p,e.attempt(a8,x,g))}function p(w){return a.containerState.initialBlankLine=!0,o++,x(w)}function g(w){return ct(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),x):n(w)}function x(w){return a.containerState.size=o+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(w)}}function l8(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(Pc,s,o);function s(f){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,xt(e,t,"listItemIndent",a.containerState.size+1)(f)}function o(f){return a.containerState.furtherBlankLines||!ct(f)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,c(f)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(i8,t,c)(f))}function c(f){return a.containerState._closeFlow=!0,a.interrupt=void 0,xt(e,e.attempt(xr,t,n),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function o8(e,t,n){const a=this;return xt(e,s,"listItemIndent",a.containerState.size+1);function s(o){const c=a.events[a.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===a.containerState.size?t(o):n(o)}}function u8(e){e.exit(this.containerState.type)}function c8(e,t,n){const a=this;return xt(e,s,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(o){const c=a.events[a.events.length-1];return!ct(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const hk={name:"setextUnderline",resolveTo:d8,tokenize:f8};function d8(e,t){let n=e.length,a,s,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){a=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const c={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",o?(e.splice(s,0,["enter",c,t]),e.splice(o+1,0,["exit",e[a][1],t]),e[a][1].end={...e[o][1].end}):e[a][1]=c,e.push(["exit",c,t]),e}function f8(e,t,n){const a=this;let s;return o;function o(h){let p=a.events.length,g;for(;p--;)if(a.events[p][1].type!=="lineEnding"&&a.events[p][1].type!=="linePrefix"&&a.events[p][1].type!=="content"){g=a.events[p][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||g)?(e.enter("setextHeadingLine"),s=h,c(h)):n(h)}function c(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===s?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),ct(h)?xt(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||He(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const h8={tokenize:m8};function m8(e){const t=this,n=e.attempt(Pc,a,e.attempt(this.parser.constructs.flowInitial,s,xt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(b$,s)),"linePrefix")));return n;function a(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const p8={resolveAll:j_()},g8=k_("string"),y8=k_("text");function k_(e){return{resolveAll:j_(e==="text"?v8:void 0),tokenize:t};function t(n){const a=this,s=this.parser.constructs[e],o=n.attempt(s,c,f);return c;function c(p){return h(p)?o(p):f(p)}function f(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),m}function m(p){return h(p)?(n.exit("data"),o(p)):(n.consume(p),m)}function h(p){if(p===null)return!0;const g=s[p];let x=-1;if(g)for(;++x<g.length;){const w=g[x];if(!w.previous||w.previous.call(a,a.previous))return!0}return!1}}}function j_(e){return t;function t(n,a){let s=-1,o;for(;++s<=n.length;)o===void 0?n[s]&&n[s][1].type==="data"&&(o=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==o+2&&(n[o][1].end=n[s-1][1].end,n.splice(o+2,s-o-2),s=o+2),o=void 0);return e?e(n,a):n}}function v8(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const a=e[n-1][1],s=t.sliceStream(a);let o=s.length,c=-1,f=0,m;for(;o--;){const h=s[o];if(typeof h=="string"){for(c=h.length;h.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(h===-2)m=!0,f++;else if(h!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const h={type:n===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?c:a.start._bufferIndex+c,_index:a.start._index+o,line:a.end.line,column:a.end.column-f,offset:a.end.offset-f},end:{...a.end}};a.end={...h.start},a.start.offset===a.end.offset?Object.assign(a,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const b8={42:xr,43:xr,45:xr,48:xr,49:xr,50:xr,51:xr,52:xr,53:xr,54:xr,55:xr,56:xr,57:xr,62:g_},x8={91:j$},w8={[-2]:xg,[-1]:xg,32:xg},S8={35:A$,42:Mf,45:[hk,Mf],60:M$,61:hk,95:Mf,96:dk,126:dk},k8={38:v_,92:y_},j8={[-5]:wg,[-4]:wg,[-3]:wg,33:W$,38:v_,42:Gy,60:[e$,F$],91:e8,92:[_$,y_],93:fb,95:Gy,96:h$},E8={null:[Gy,p8]},C8={null:[42,95]},N8={null:[]},_8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:C8,contentInitial:x8,disable:N8,document:b8,flow:S8,flowInitial:w8,insideSpan:E8,string:k8,text:j8},Symbol.toStringTag,{value:"Module"}));function T8(e,t,n){let a={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},o=[];let c=[],f=[];const m={attempt:B(L),check:B(O),consume:N,enter:R,exit:M,interrupt:B(O,{interrupt:!0})},h={code:null,containerState:{},defineSkip:k,events:[],now:S,parser:e,previous:null,sliceSerialize:x,sliceStream:w,write:g};let p=t.tokenize.call(h,m);return t.resolveAll&&o.push(t),h;function g(K){return c=ra(c,K),j(),c[c.length-1]!==null?[]:(I(t,0),h.events=Ah(o,h.events,h),h.events)}function x(K,ie){return R8(w(K),ie)}function w(K){return A8(c,K)}function S(){const{_bufferIndex:K,_index:ie,line:ve,column:J,offset:W}=a;return{_bufferIndex:K,_index:ie,line:ve,column:J,offset:W}}function k(K){s[K.line]=K.column,z()}function j(){let K;for(;a._index<c.length;){const ie=c[a._index];if(typeof ie=="string")for(K=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===K&&a._bufferIndex<ie.length;)C(ie.charCodeAt(a._bufferIndex));else C(ie)}}function C(K){p=p(K)}function N(K){He(K)?(a.line++,a.column=1,a.offset+=K===-3?2:1,z()):K!==-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=K}function R(K,ie){const ve=ie||{};return ve.type=K,ve.start=S(),h.events.push(["enter",ve,h]),f.push(ve),ve}function M(K){const ie=f.pop();return ie.end=S(),h.events.push(["exit",ie,h]),ie}function L(K,ie){I(K,ie.from)}function O(K,ie){ie.restore()}function B(K,ie){return ve;function ve(J,W,Z){let ne,ke,Ae,D;return Array.isArray(J)?F(J):"tokenize"in J?F([J]):P(J);function P(ae){return be;function be(we){const me=we!==null&&ae[we],Me=we!==null&&ae.null,Ie=[...Array.isArray(me)?me:me?[me]:[],...Array.isArray(Me)?Me:Me?[Me]:[]];return F(Ie)(we)}}function F(ae){return ne=ae,ke=0,ae.length===0?Z:T(ae[ke])}function T(ae){return be;function be(we){return D=Y(),Ae=ae,ae.partial||(h.currentConstruct=ae),ae.name&&h.parser.constructs.disable.null.includes(ae.name)?q():ae.tokenize.call(ie?Object.assign(Object.create(h),ie):h,m,G,q)(we)}}function G(ae){return K(Ae,D),W}function q(ae){return D.restore(),++ke<ne.length?T(ne[ke]):Z}}}function I(K,ie){K.resolveAll&&!o.includes(K)&&o.push(K),K.resolve&&Fr(h.events,ie,h.events.length-ie,K.resolve(h.events.slice(ie),h)),K.resolveTo&&(h.events=K.resolveTo(h.events,h))}function Y(){const K=S(),ie=h.previous,ve=h.currentConstruct,J=h.events.length,W=Array.from(f);return{from:J,restore:Z};function Z(){a=K,h.previous=ie,h.currentConstruct=ve,h.events.length=J,f=W,z()}}function z(){a.line in s&&a.column<2&&(a.column=s[a.line],a.offset+=s[a.line]-1)}}function A8(e,t){const n=t.start._index,a=t.start._bufferIndex,s=t.end._index,o=t.end._bufferIndex;let c;if(n===s)c=[e[n].slice(a,o)];else{if(c=e.slice(n,s),a>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(a):c.shift()}o>0&&c.push(e[s].slice(0,o))}return c}function R8(e,t){let n=-1;const a=[];let s;for(;++n<e.length;){const o=e[n];let c;if(typeof o=="string")c=o;else switch(o){case-5:{c="\r";break}case-4:{c=`
|
|
389
|
+
`;break}case-3:{c=`\r
|
|
390
|
+
`;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&s)continue;c=" ";break}default:c=String.fromCharCode(o)}s=o===-2,a.push(c)}return a.join("")}function O8(e){const a={constructs:m_([_8,...(e||{}).extensions||[]]),content:s(VF),defined:[],document:s(KF),flow:s(h8),lazy:{},string:s(g8),text:s(y8)};return a;function s(o){return c;function c(f){return T8(a,o,f)}}}function z8(e){for(;!b_(e););return e}const mk=/[\0\t\n\r]/g;function M8(){let e=1,t="",n=!0,a;return s;function s(o,c,f){const m=[];let h,p,g,x,w;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),g=0,t="",n&&(o.charCodeAt(0)===65279&&g++,n=void 0);g<o.length;){if(mk.lastIndex=g,h=mk.exec(o),x=h&&h.index!==void 0?h.index:o.length,w=o.charCodeAt(x),!h){t=o.slice(g);break}if(w===10&&g===x&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),g<x&&(m.push(o.slice(g,x)),e+=x-g),w){case 0:{m.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,m.push(-2);e++<p;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:a=!0,e=1}g=x+1}return f&&(a&&m.push(-5),t&&m.push(t),m.push(null)),m}}const D8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function I8(e){return e.replace(D8,L8)}function L8(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),o=s===120||s===88;return p_(n.slice(o?2:1),o?16:10)}return db(n)||e}const E_={}.hasOwnProperty;function P8(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),U8(n)(z8(O8(n).document().write(M8()(e,t,!0))))}function U8(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Mt),autolinkProtocol:Y,autolinkEmail:Y,atxHeading:o(V),blockQuote:o(Me),characterEscape:Y,characterReference:Y,codeFenced:o(Ie),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(Ie,c),codeText:o(St,c),codeTextData:Y,data:Y,codeFlowValue:Y,definition:o(tt),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(it),hardBreakEscape:o(pe),hardBreakTrailing:o(pe),htmlFlow:o(_e,c),htmlFlowData:Y,htmlText:o(_e,c),htmlTextData:Y,image:o(Pe),label:c,link:o(Mt),listItem:o(hr),listItemValue:x,listOrdered:o(Pt,g),listUnordered:o(Pt),paragraph:o(pi),reference:T,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(V),strong:o(gi),thematicBreak:o(da)},exit:{atxHeading:m(),atxHeadingSequence:L,autolink:m(),autolinkEmail:me,autolinkProtocol:we,blockQuote:m(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:q,characterReferenceMarkerNumeric:q,characterReferenceValue:ae,characterReference:be,codeFenced:m(j),codeFencedFence:k,codeFencedFenceInfo:w,codeFencedFenceMeta:S,codeFlowValue:z,codeIndented:m(C),codeText:m(W),codeTextData:z,data:z,definition:m(),definitionDestinationString:M,definitionLabelString:N,definitionTitleString:R,emphasis:m(),hardBreakEscape:m(ie),hardBreakTrailing:m(ie),htmlFlow:m(ve),htmlFlowData:z,htmlText:m(J),htmlTextData:z,image:m(ne),label:Ae,labelText:ke,lineEnding:K,link:m(Z),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:G,resourceDestinationString:D,resourceTitleString:P,resource:F,setextHeading:m(I),setextHeadingLineSequence:B,setextHeadingText:O,strong:m(),thematicBreak:m()}};C_(t,(e||{}).mdastExtensions||[]);const n={};return a;function a(oe){let ge={type:"root",children:[]};const $e={stack:[ge],tokenStack:[],config:t,enter:f,exit:h,buffer:c,resume:p,data:n},Ve=[];let st=-1;for(;++st<oe.length;)if(oe[st][1].type==="listOrdered"||oe[st][1].type==="listUnordered")if(oe[st][0]==="enter")Ve.push(st);else{const dn=Ve.pop();st=s(oe,dn,st)}for(st=-1;++st<oe.length;){const dn=t[oe[st][0]];E_.call(dn,oe[st][1].type)&&dn[oe[st][1].type].call(Object.assign({sliceSerialize:oe[st][2].sliceSerialize},$e),oe[st][1])}if($e.tokenStack.length>0){const dn=$e.tokenStack[$e.tokenStack.length-1];(dn[1]||pk).call($e,void 0,dn[0])}for(ge.position={start:qi(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:qi(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},st=-1;++st<t.transforms.length;)ge=t.transforms[st](ge)||ge;return ge}function s(oe,ge,$e){let Ve=ge-1,st=-1,dn=!1,tr,qt,Ut,At;for(;++Ve<=$e;){const lt=oe[Ve];switch(lt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{lt[0]==="enter"?st++:st--,At=void 0;break}case"lineEndingBlank":{lt[0]==="enter"&&(tr&&!At&&!st&&!Ut&&(Ut=Ve),At=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:At=void 0}if(!st&<[0]==="enter"&<[1].type==="listItemPrefix"||st===-1&<[0]==="exit"&&(lt[1].type==="listUnordered"||lt[1].type==="listOrdered")){if(tr){let nr=Ve;for(qt=void 0;nr--;){const Mn=oe[nr];if(Mn[1].type==="lineEnding"||Mn[1].type==="lineEndingBlank"){if(Mn[0]==="exit")continue;qt&&(oe[qt][1].type="lineEndingBlank",dn=!0),Mn[1].type="lineEnding",qt=nr}else if(!(Mn[1].type==="linePrefix"||Mn[1].type==="blockQuotePrefix"||Mn[1].type==="blockQuotePrefixWhitespace"||Mn[1].type==="blockQuoteMarker"||Mn[1].type==="listItemIndent"))break}Ut&&(!qt||Ut<qt)&&(tr._spread=!0),tr.end=Object.assign({},qt?oe[qt][1].start:lt[1].end),oe.splice(qt||Ve,0,["exit",tr,lt[2]]),Ve++,$e++}if(lt[1].type==="listItemPrefix"){const nr={type:"listItem",_spread:!1,start:Object.assign({},lt[1].start),end:void 0};tr=nr,oe.splice(Ve,0,["enter",nr,lt[2]]),Ve++,$e++,Ut=void 0,At=!0}}}return oe[ge][1]._spread=dn,$e}function o(oe,ge){return $e;function $e(Ve){f.call(this,oe(Ve),Ve),ge&&ge.call(this,Ve)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(oe,ge,$e){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([ge,$e||void 0]),oe.position={start:qi(ge.start),end:void 0}}function m(oe){return ge;function ge($e){oe&&oe.call(this,$e),h.call(this,$e)}}function h(oe,ge){const $e=this.stack.pop(),Ve=this.tokenStack.pop();if(Ve)Ve[0].type!==oe.type&&(ge?ge.call(this,oe,Ve[0]):(Ve[1]||pk).call(this,oe,Ve[0]));else throw new Error("Cannot close `"+oe.type+"` ("+ec({start:oe.start,end:oe.end})+"): it’s not open");$e.position.end=qi(oe.end)}function p(){return cb(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(oe){if(this.data.expectingFirstListItemValue){const ge=this.stack[this.stack.length-2];ge.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function w(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.lang=oe}function S(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.meta=oe}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function j(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=oe.replace(/(\r?\n|\r)$/g,"")}function N(oe){const ge=this.resume(),$e=this.stack[this.stack.length-1];$e.label=ge,$e.identifier=ba(this.sliceSerialize(oe)).toLowerCase()}function R(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.title=oe}function M(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.url=oe}function L(oe){const ge=this.stack[this.stack.length-1];if(!ge.depth){const $e=this.sliceSerialize(oe).length;ge.depth=$e}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function B(oe){const ge=this.stack[this.stack.length-1];ge.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function Y(oe){const $e=this.stack[this.stack.length-1].children;let Ve=$e[$e.length-1];(!Ve||Ve.type!=="text")&&(Ve=cn(),Ve.position={start:qi(oe.start),end:void 0},$e.push(Ve)),this.stack.push(Ve)}function z(oe){const ge=this.stack.pop();ge.value+=this.sliceSerialize(oe),ge.position.end=qi(oe.end)}function K(oe){const ge=this.stack[this.stack.length-1];if(this.data.atHardBreak){const $e=ge.children[ge.children.length-1];$e.position.end=qi(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ge.type)&&(Y.call(this,oe),z.call(this,oe))}function ie(){this.data.atHardBreak=!0}function ve(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=oe}function J(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=oe}function W(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=oe}function Z(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ge,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function ne(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ge,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function ke(oe){const ge=this.sliceSerialize(oe),$e=this.stack[this.stack.length-2];$e.label=I8(ge),$e.identifier=ba(ge).toLowerCase()}function Ae(){const oe=this.stack[this.stack.length-1],ge=this.resume(),$e=this.stack[this.stack.length-1];if(this.data.inReference=!0,$e.type==="link"){const Ve=oe.children;$e.children=Ve}else $e.alt=ge}function D(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.url=oe}function P(){const oe=this.resume(),ge=this.stack[this.stack.length-1];ge.title=oe}function F(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function G(oe){const ge=this.resume(),$e=this.stack[this.stack.length-1];$e.label=ge,$e.identifier=ba(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function q(oe){this.data.characterReferenceType=oe.type}function ae(oe){const ge=this.sliceSerialize(oe),$e=this.data.characterReferenceType;let Ve;$e?(Ve=p_(ge,$e==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ve=db(ge);const st=this.stack[this.stack.length-1];st.value+=Ve}function be(oe){const ge=this.stack.pop();ge.position.end=qi(oe.end)}function we(oe){z.call(this,oe);const ge=this.stack[this.stack.length-1];ge.url=this.sliceSerialize(oe)}function me(oe){z.call(this,oe);const ge=this.stack[this.stack.length-1];ge.url="mailto:"+this.sliceSerialize(oe)}function Me(){return{type:"blockquote",children:[]}}function Ie(){return{type:"code",lang:null,meta:null,value:""}}function St(){return{type:"inlineCode",value:""}}function tt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function it(){return{type:"emphasis",children:[]}}function V(){return{type:"heading",depth:0,children:[]}}function pe(){return{type:"break"}}function _e(){return{type:"html",value:""}}function Pe(){return{type:"image",title:null,url:"",alt:null}}function Mt(){return{type:"link",title:null,url:"",children:[]}}function Pt(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function hr(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function pi(){return{type:"paragraph",children:[]}}function gi(){return{type:"strong",children:[]}}function cn(){return{type:"text",value:""}}function da(){return{type:"thematicBreak"}}}function qi(e){return{line:e.line,column:e.column,offset:e.offset}}function C_(e,t){let n=-1;for(;++n<t.length;){const a=t[n];Array.isArray(a)?C_(e,a):B8(e,a)}}function B8(e,t){let n;for(n in t)if(E_.call(t,n))switch(n){case"canContainEols":{const a=t[n];a&&e[n].push(...a);break}case"transforms":{const a=t[n];a&&e[n].push(...a);break}case"enter":case"exit":{const a=t[n];a&&Object.assign(e[n],a);break}}}function pk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ec({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ec({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ec({start:t.start,end:t.end})+") is still open")}function F8(e){const t=this;t.parser=n;function n(a){return P8(a,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function $8(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 H8(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
391
|
+
`}]}function q8(e,t){const n=t.value?t.value+`
|
|
392
|
+
`:"",a={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(a.className=["language-"+s[0]]);let o={type:"element",tagName:"code",properties:a,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function Z8(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function G8(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function V8(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),s=Oo(a.toLowerCase()),o=e.footnoteOrder.indexOf(a);let c,f=e.footnoteCounts.get(a);f===void 0?(f=0,e.footnoteOrder.push(a),c=e.footnoteOrder.length):c=o+1,f+=1,e.footnoteCounts.set(a,f);const m={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,m);const h={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(t,h),e.applyData(t,h)}function Q8(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 K8(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function N_(e,t){const n=t.referenceType;let a="]";if(n==="collapsed"?a+="[]":n==="full"&&(a+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+a}];const s=e.all(t),o=s[0];o&&o.type==="text"?o.value="["+o.value:s.unshift({type:"text",value:"["});const c=s[s.length-1];return c&&c.type==="text"?c.value+=a:s.push({type:"text",value:a}),s}function Y8(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return N_(e,t);const s={src:Oo(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(s.title=a.title);const o={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,o),e.applyData(t,o)}function X8(e,t){const n={src:Oo(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,a),e.applyData(t,a)}function W8(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 J8(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return N_(e,t);const s={href:Oo(a.url||"")};a.title!==null&&a.title!==void 0&&(s.title=a.title);const o={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function eH(e,t){const n={href:Oo(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function tH(e,t,n){const a=e.all(t),s=n?nH(n):__(t),o={},c=[];if(typeof t.checked=="boolean"){const p=a[0];let g;p&&p.type==="element"&&p.tagName==="p"?g=p:(g={type:"element",tagName:"p",properties:{},children:[]},a.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let f=-1;for(;++f<a.length;){const p=a[f];(s||f!==0||p.type!=="element"||p.tagName!=="p")&&c.push({type:"text",value:`
|
|
393
|
+
`}),p.type==="element"&&p.tagName==="p"&&!s?c.push(...p.children):c.push(p)}const m=a[a.length-1];m&&(s||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
|
|
394
|
+
`});const h={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,h),e.applyData(t,h)}function nH(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=__(n[a])}return t}function __(e){const t=e.spread;return t??e.children.length>1}function rH(e,t){const n={},a=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<a.length;){const c=a[s];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function aH(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function iH(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function sH(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lH(e,t){const n=e.all(t),a=n.shift(),s=[];if(a){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!0)};e.patch(t.children[0],c),s.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},f=sb(t.children[1]),m=l_(t.children[t.children.length-1]);f&&m&&(c.position={start:f,end:m}),s.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function oH(e,t,n){const a=n?n.children:void 0,o=(a?a.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,f=c?c.length:t.children.length;let m=-1;const h=[];for(;++m<f;){const g=t.children[m],x={},w=c?c[m]:void 0;w&&(x.align=w);let S={type:"element",tagName:o,properties:x,children:[]};g&&(S.children=e.all(g),e.patch(g,S),S=e.applyData(g,S)),h.push(S)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,p),e.applyData(t,p)}function uH(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const gk=9,yk=32;function cH(e){const t=String(e),n=/\r?\n|\r/g;let a=n.exec(t),s=0;const o=[];for(;a;)o.push(vk(t.slice(s,a.index),s>0,!0),a[0]),s=a.index+a[0].length,a=n.exec(t);return o.push(vk(t.slice(s),s>0,!1)),o.join("")}function vk(e,t,n){let a=0,s=e.length;if(t){let o=e.codePointAt(a);for(;o===gk||o===yk;)a++,o=e.codePointAt(a)}if(n){let o=e.codePointAt(s-1);for(;o===gk||o===yk;)s--,o=e.codePointAt(s-1)}return s>a?e.slice(a,s):""}function dH(e,t){const n={type:"text",value:cH(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function fH(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const hH={blockquote:$8,break:H8,code:q8,delete:Z8,emphasis:G8,footnoteReference:V8,heading:Q8,html:K8,imageReference:Y8,image:X8,inlineCode:W8,linkReference:J8,link:eH,listItem:tH,list:rH,paragraph:aH,root:iH,strong:sH,table:lH,tableCell:uH,tableRow:oH,text:dH,thematicBreak:fH,toml:vf,yaml:vf,definition:vf,footnoteDefinition:vf};function vf(){}const T_=-1,Rh=0,nc=1,Xf=2,hb=3,mb=4,pb=5,gb=6,A_=7,R_=8,bk=typeof self=="object"?self:globalThis,mH=(e,t)=>{const n=(s,o)=>(e.set(o,s),s),a=s=>{if(e.has(s))return e.get(s);const[o,c]=t[s];switch(o){case Rh:case T_:return n(c,s);case nc:{const f=n([],s);for(const m of c)f.push(a(m));return f}case Xf:{const f=n({},s);for(const[m,h]of c)f[a(m)]=a(h);return f}case hb:return n(new Date(c),s);case mb:{const{source:f,flags:m}=c;return n(new RegExp(f,m),s)}case pb:{const f=n(new Map,s);for(const[m,h]of c)f.set(a(m),a(h));return f}case gb:{const f=n(new Set,s);for(const m of c)f.add(a(m));return f}case A_:{const{name:f,message:m}=c;return n(new bk[f](m),s)}case R_:return n(BigInt(c),s);case"BigInt":return n(Object(BigInt(c)),s);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:f}=new Uint8Array(c);return n(new DataView(f),c)}}return n(new bk[o](c),s)};return a},xk=e=>mH(new Map,e)(0),ql="",{toString:pH}={},{keys:gH}=Object,Bu=e=>{const t=typeof e;if(t!=="object"||!e)return[Rh,t];const n=pH.call(e).slice(8,-1);switch(n){case"Array":return[nc,ql];case"Object":return[Xf,ql];case"Date":return[hb,ql];case"RegExp":return[mb,ql];case"Map":return[pb,ql];case"Set":return[gb,ql];case"DataView":return[nc,n]}return n.includes("Array")?[nc,n]:n.includes("Error")?[A_,n]:[Xf,n]},bf=([e,t])=>e===Rh&&(t==="function"||t==="symbol"),yH=(e,t,n,a)=>{const s=(c,f)=>{const m=a.push(c)-1;return n.set(f,m),m},o=c=>{if(n.has(c))return n.get(c);let[f,m]=Bu(c);switch(f){case Rh:{let p=c;switch(m){case"bigint":f=R_,p=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);p=null;break;case"undefined":return s([T_],c)}return s([f,p],c)}case nc:{if(m){let x=c;return m==="DataView"?x=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(x=new Uint8Array(c)),s([m,[...x]],c)}const p=[],g=s([f,p],c);for(const x of c)p.push(o(x));return g}case Xf:{if(m)switch(m){case"BigInt":return s([m,c.toString()],c);case"Boolean":case"Number":case"String":return s([m,c.valueOf()],c)}if(t&&"toJSON"in c)return o(c.toJSON());const p=[],g=s([f,p],c);for(const x of gH(c))(e||!bf(Bu(c[x])))&&p.push([o(x),o(c[x])]);return g}case hb:return s([f,c.toISOString()],c);case mb:{const{source:p,flags:g}=c;return s([f,{source:p,flags:g}],c)}case pb:{const p=[],g=s([f,p],c);for(const[x,w]of c)(e||!(bf(Bu(x))||bf(Bu(w))))&&p.push([o(x),o(w)]);return g}case gb:{const p=[],g=s([f,p],c);for(const x of c)(e||!bf(Bu(x)))&&p.push(o(x));return g}}const{message:h}=c;return s([f,{name:m,message:h}],c)};return o},wk=(e,{json:t,lossy:n}={})=>{const a=[];return yH(!(t||n),!!t,new Map,a)(e),a},Wf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?xk(wk(e,t)):structuredClone(e):(e,t)=>xk(wk(e,t));function vH(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 bH(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function xH(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||vH,a=e.options.footnoteBackLabel||bH,s=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let m=-1;for(;++m<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[m]);if(!h)continue;const p=e.all(h),g=String(h.identifier).toUpperCase(),x=Oo(g.toLowerCase());let w=0;const S=[],k=e.footnoteCounts.get(g);for(;k!==void 0&&++w<=k;){S.length>0&&S.push({type:"text",value:" "});let N=typeof n=="string"?n:n(m,w);typeof N=="string"&&(N={type:"text",value:N}),S.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+x+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,w),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const j=p[p.length-1];if(j&&j.type==="element"&&j.tagName==="p"){const N=j.children[j.children.length-1];N&&N.type==="text"?N.value+=" ":j.children.push({type:"text",value:" "}),j.children.push(...S)}else p.push(...S);const C={type:"element",tagName:"li",properties:{id:t+"fn-"+x},children:e.wrap(p,!0)};e.patch(h,C),f.push(C)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Wf(c),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
|
|
395
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
396
|
+
`}]}}const Oh=(function(e){if(e==null)return jH;if(typeof e=="function")return zh(e);if(typeof e=="object")return Array.isArray(e)?wH(e):SH(e);if(typeof e=="string")return kH(e);throw new Error("Expected function, string, or object as test")});function wH(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Oh(e[n]);return zh(a);function a(...s){let o=-1;for(;++o<t.length;)if(t[o].apply(this,s))return!0;return!1}}function SH(e){const t=e;return zh(n);function n(a){const s=a;let o;for(o in e)if(s[o]!==t[o])return!1;return!0}}function kH(e){return zh(t);function t(n){return n&&n.type===e}}function zh(e){return t;function t(n,a,s){return!!(EH(n)&&e.call(this,n,typeof a=="number"?a:void 0,s||void 0))}}function jH(){return!0}function EH(e){return e!==null&&typeof e=="object"&&"type"in e}const O_=[],CH=!0,Vy=!1,NH="skip";function z_(e,t,n,a){let s;typeof t=="function"&&typeof n!="function"?(a=n,n=t):s=t;const o=Oh(s),c=a?-1:1;f(e,void 0,[])();function f(m,h,p){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const w=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return x;function x(){let w=O_,S,k,j;if((!t||o(m,h,p[p.length-1]||void 0))&&(w=_H(n(m,p)),w[0]===Vy))return w;if("children"in m&&m.children){const C=m;if(C.children&&w[0]!==NH)for(k=(a?C.children.length:-1)+c,j=p.concat(C);k>-1&&k<C.children.length;){const N=C.children[k];if(S=f(N,k,j)(),S[0]===Vy)return S;k=typeof S[1]=="number"?S[1]:k+c}}return w}}}function _H(e){return Array.isArray(e)?e:typeof e=="number"?[CH,e]:e==null?O_:[e]}function yb(e,t,n,a){let s,o,c;typeof t=="function"&&typeof n!="function"?(o=void 0,c=t,s=n):(o=t,c=n,s=a),z_(e,o,f,s);function f(m,h){const p=h[h.length-1],g=p?p.children.indexOf(m):void 0;return c(m,g,p)}}const Qy={}.hasOwnProperty,TH={};function AH(e,t){const n=t||TH,a=new Map,s=new Map,o=new Map,c={...hH,...n.handlers},f={all:h,applyData:OH,definitionById:a,footnoteById:s,footnoteCounts:o,footnoteOrder:[],handlers:c,one:m,options:n,patch:RH,wrap:MH};return yb(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const g=p.type==="definition"?a:s,x=String(p.identifier).toUpperCase();g.has(x)||g.set(x,p)}}),f;function m(p,g){const x=p.type,w=f.handlers[x];if(Qy.call(f.handlers,x)&&w)return w(f,p,g);if(f.options.passThrough&&f.options.passThrough.includes(x)){if("children"in p){const{children:k,...j}=p,C=Wf(j);return C.children=f.all(p),C}return Wf(p)}return(f.options.unknownHandler||zH)(f,p,g)}function h(p){const g=[];if("children"in p){const x=p.children;let w=-1;for(;++w<x.length;){const S=f.one(x[w],p);if(S){if(w&&x[w-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=Sk(S.value)),!Array.isArray(S)&&S.type==="element")){const k=S.children[0];k&&k.type==="text"&&(k.value=Sk(k.value))}Array.isArray(S)?g.push(...S):g.push(S)}}}return g}}function RH(e,t){e.position&&(t.position=bF(e))}function OH(e,t){let n=t;if(e&&e.data){const a=e.data.hName,s=e.data.hChildren,o=e.data.hProperties;if(typeof a=="string")if(n.type==="element")n.tagName=a;else{const c="children"in n?n.children:[n];n={type:"element",tagName:a,properties:{},children:c}}n.type==="element"&&o&&Object.assign(n.properties,Wf(o)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function zH(e,t){const n=t.data||{},a="value"in t&&!(Qy.call(n,"hProperties")||Qy.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 MH(e,t){const n=[];let a=-1;for(t&&n.push({type:"text",value:`
|
|
397
|
+
`});++a<e.length;)a&&n.push({type:"text",value:`
|
|
398
|
+
`}),n.push(e[a]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
399
|
+
`}),n}function Sk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function kk(e,t){const n=AH(e,t),a=n.one(e,void 0),s=xH(n),o=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return s&&o.children.push({type:"text",value:`
|
|
400
|
+
`},s),o}function DH(e,t){return e&&"run"in e?async function(n,a){const s=kk(n,{file:a,...t});await e.run(s,a)}:function(n,a){return kk(n,{file:a,...e||t})}}function jk(e){if(e)throw e}var Sg,Ek;function IH(){if(Ek)return Sg;Ek=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},o=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var p=e.call(h,"constructor"),g=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!p&&!g)return!1;var x;for(x in h);return typeof x>"u"||e.call(h,x)},c=function(h,p){n&&p.name==="__proto__"?n(h,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):h[p.name]=p.newValue},f=function(h,p){if(p==="__proto__")if(e.call(h,p)){if(a)return a(h,p).value}else return;return h[p]};return Sg=function m(){var h,p,g,x,w,S,k=arguments[0],j=1,C=arguments.length,N=!1;for(typeof k=="boolean"&&(N=k,k=arguments[1]||{},j=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});j<C;++j)if(h=arguments[j],h!=null)for(p in h)g=f(k,p),x=f(h,p),k!==x&&(N&&x&&(o(x)||(w=s(x)))?(w?(w=!1,S=g&&s(g)?g:[]):S=g&&o(g)?g:{},c(k,{name:p,newValue:m(N,S,x)})):typeof x<"u"&&c(k,{name:p,newValue:x}));return k},Sg}var LH=IH();const kg=rh(LH);function Ky(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 PH(){const e=[],t={run:n,use:a};return t;function n(...s){let o=-1;const c=s.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...s);function f(m,...h){const p=e[++o];let g=-1;if(m){c(m);return}for(;++g<s.length;)(h[g]===null||h[g]===void 0)&&(h[g]=s[g]);s=h,p?UH(p,f)(...h):c(null,...h)}}function a(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function UH(e,t){let n;return a;function a(...c){const f=e.length>c.length;let m;f&&c.push(s);try{m=e.apply(this,c)}catch(h){const p=h;if(f&&n)throw p;return s(p)}f||(m&&m.then&&typeof m.then=="function"?m.then(o,s):m instanceof Error?s(m):o(m))}function s(c,...f){n||(n=!0,t(c,...f))}function o(c){s(null,c)}}const Na={basename:BH,dirname:FH,extname:$H,join:HH,sep:"/"};function BH(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Uc(e);let n=0,a=-1,s=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else a<0&&(o=!0,a=s+1);return a<0?"":e.slice(n,a)}if(t===e)return"";let c=-1,f=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else c<0&&(o=!0,c=s+1),f>-1&&(e.codePointAt(s)===t.codePointAt(f--)?f<0&&(a=s):(f=-1,a=c));return n===a?a=c:a<0&&(a=e.length),e.slice(n,a)}function FH(e){if(Uc(e),e.length===0)return".";let t=-1,n=e.length,a;for(;--n;)if(e.codePointAt(n)===47){if(a){t=n;break}}else a||(a=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function $H(e){Uc(e);let t=e.length,n=-1,a=0,s=-1,o=0,c;for(;t--;){const f=e.codePointAt(t);if(f===47){if(c){a=t+1;break}continue}n<0&&(c=!0,n=t+1),f===46?s<0?s=t:o!==1&&(o=1):s>-1&&(o=-1)}return s<0||n<0||o===0||o===1&&s===n-1&&s===a+1?"":e.slice(s,n)}function HH(...e){let t=-1,n;for(;++t<e.length;)Uc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":qH(n)}function qH(e){Uc(e);const t=e.codePointAt(0)===47;let n=ZH(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function ZH(e,t){let n="",a=0,s=-1,o=0,c=-1,f,m;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(s===c-1||o===1))if(s!==c-1&&o===2){if(n.length<2||a!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(m=n.lastIndexOf("/"),m!==n.length-1){m<0?(n="",a=0):(n=n.slice(0,m),a=n.length-1-n.lastIndexOf("/")),s=c,o=0;continue}}else if(n.length>0){n="",a=0,s=c,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",a=2)}else n.length>0?n+="/"+e.slice(s+1,c):n=e.slice(s+1,c),a=c-s-1;s=c,o=0}else f===46&&o>-1?o++:o=-1}return n}function Uc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const GH={cwd:VH};function VH(){return"/"}function Yy(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function QH(e){if(typeof e=="string")e=new URL(e);else if(!Yy(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 KH(e)}function KH(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 jg=["history","path","basename","stem","extname","dirname"];class M_{constructor(t){let n;t?Yy(t)?n={path:t}:typeof t=="string"||YH(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":GH.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<jg.length;){const o=jg[a];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let s;for(s in n)jg.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Na.basename(this.path):void 0}set basename(t){Cg(t,"basename"),Eg(t,"basename"),this.path=Na.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Na.dirname(this.path):void 0}set dirname(t){Ck(this.basename,"dirname"),this.path=Na.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Na.extname(this.path):void 0}set extname(t){if(Eg(t,"extname"),Ck(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Na.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Yy(t)&&(t=QH(t)),Cg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Na.basename(this.path,this.extname):void 0}set stem(t){Cg(t,"stem"),Eg(t,"stem"),this.path=Na.join(this.dirname||"",t+(this.extname||""))}fail(t,n,a){const s=this.message(t,n,a);throw s.fatal=!0,s}info(t,n,a){const s=this.message(t,n,a);return s.fatal=void 0,s}message(t,n,a){const s=new er(t,n,a);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Eg(e,t){if(e&&e.includes(Na.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Na.sep+"`")}function Cg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ck(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function YH(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const XH=(function(e){const a=this.constructor.prototype,s=a[e],o=function(){return s.apply(o,arguments)};return Object.setPrototypeOf(o,a),o}),WH={}.hasOwnProperty;class vb extends XH{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=PH()}copy(){const t=new vb;let n=-1;for(;++n<this.attachers.length;){const a=this.attachers[n];t.use(...a)}return t.data(kg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Tg("data",this.frozen),this.namespace[t]=n,this):WH.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Tg("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const s=n.call(t,...a);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=xf(t),a=this.parser||this.Parser;return Ng("parse",a),a(String(n),n)}process(t,n){const a=this;return this.freeze(),Ng("process",this.parser||this.Parser),_g("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(o,c){const f=xf(t),m=a.parse(f);a.run(m,f,function(p,g,x){if(p||!g||!x)return h(p);const w=g,S=a.stringify(w,x);tq(S)?x.value=S:x.result=S,h(p,x)});function h(p,g){p||!g?c(p):o?o(g):n(void 0,g)}}}processSync(t){let n=!1,a;return this.freeze(),Ng("processSync",this.parser||this.Parser),_g("processSync",this.compiler||this.Compiler),this.process(t,s),_k("processSync","process",n),a;function s(o,c){n=!0,jk(o),a=c}}run(t,n,a){Nk(t),this.freeze();const s=this.transformers;return!a&&typeof n=="function"&&(a=n,n=void 0),a?o(void 0,a):new Promise(o);function o(c,f){const m=xf(n);s.run(t,m,h);function h(p,g,x){const w=g||t;p?f(p):c?c(w):a(void 0,w,x)}}}runSync(t,n){let a=!1,s;return this.run(t,n,o),_k("runSync","run",a),s;function o(c,f){jk(c),s=f,a=!0}}stringify(t,n){this.freeze();const a=xf(n),s=this.compiler||this.Compiler;return _g("stringify",s),Nk(t),s(t,a)}use(t,...n){const a=this.attachers,s=this.namespace;if(Tg("use",this.frozen),t!=null)if(typeof t=="function")m(t,n);else if(typeof t=="object")Array.isArray(t)?f(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(h){if(typeof h=="function")m(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[p,...g]=h;m(p,g)}else c(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function c(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(h.plugins),h.settings&&(s.settings=kg(!0,s.settings,h.settings))}function f(h){let p=-1;if(h!=null)if(Array.isArray(h))for(;++p<h.length;){const g=h[p];o(g)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function m(h,p){let g=-1,x=-1;for(;++g<a.length;)if(a[g][0]===h){x=g;break}if(x===-1)a.push([h,...p]);else if(p.length>0){let[w,...S]=p;const k=a[x][1];Ky(k)&&Ky(w)&&(w=kg(!0,k,w)),a[x]=[h,w,...S]}}}}const JH=new vb().freeze();function Ng(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function _g(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Tg(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Nk(e){if(!Ky(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function _k(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function xf(e){return eq(e)?e:new M_(e)}function eq(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function tq(e){return typeof e=="string"||nq(e)}function nq(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const rq="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Tk=[],Ak={allowDangerousHtml:!0},aq=/^(https?|ircs?|mailto|xmpp)$/i,iq=[{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 sq(e){const t=lq(e),n=oq(e);return uq(t.runSync(t.parse(n),n),e)}function lq(e){const t=e.rehypePlugins||Tk,n=e.remarkPlugins||Tk,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ak}:Ak;return JH().use(F8).use(n).use(DH,a).use(t)}function oq(e){const t=e.children||"",n=new M_;return typeof t=="string"&&(n.value=t),n}function uq(e,t){const n=t.allowedElements,a=t.allowElement,s=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,m=t.urlTransform||cq;for(const p of iq)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+rq+p.id,void 0);return yb(e,h),jF(e,{Fragment:l.Fragment,components:s,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function h(p,g,x){if(p.type==="raw"&&x&&typeof g=="number")return c?x.children.splice(g,1):x.children[g]={type:"text",value:p.value},g;if(p.type==="element"){let w;for(w in bg)if(Object.hasOwn(bg,w)&&Object.hasOwn(p.properties,w)){const S=p.properties[w],k=bg[w];(k===null||k.includes(p.tagName))&&(p.properties[w]=m(String(S||""),w,p))}}if(p.type==="element"){let w=n?!n.includes(p.tagName):o?o.includes(p.tagName):!1;if(!w&&a&&typeof g=="number"&&(w=!a(p,g,x)),w&&x&&typeof g=="number")return f&&p.children?x.children.splice(g,1,...p.children):x.children.splice(g,1),g}}}function cq(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||aq.test(e.slice(0,t))?e:""}function dq(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function D_(e,t,n){const s=Oh((n||{}).ignore||[]),o=fq(t);let c=-1;for(;++c<o.length;)z_(e,"text",f);function f(h,p){let g=-1,x;for(;++g<p.length;){const w=p[g],S=x?x.children:void 0;if(s(w,S?S.indexOf(w):void 0,x))return;x=w}if(x)return m(h,p)}function m(h,p){const g=p[p.length-1],x=o[c][0],w=o[c][1];let S=0;const j=g.children.indexOf(h);let C=!1,N=[];x.lastIndex=0;let R=x.exec(h.value);for(;R;){const M=R.index,L={index:R.index,input:R.input,stack:[...p,h]};let O=w(...R,L);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?x.lastIndex=M+1:(S!==M&&N.push({type:"text",value:h.value.slice(S,M)}),Array.isArray(O)?N.push(...O):O&&N.push(O),S=M+R[0].length,C=!0),!x.global)break;R=x.exec(h.value)}return C?(S<h.value.length&&N.push({type:"text",value:h.value.slice(S)}),g.children.splice(j,1,...N)):N=[h],j+N.length}}function fq(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([hq(s[0]),mq(s[1])])}return t}function hq(e){return typeof e=="string"?new RegExp(dq(e),"g"):e}function mq(e){return typeof e=="function"?e:function(){return e}}function pq(e){D_(e,[/\r?\n|\r/g,gq])}function gq(){return{type:"break"}}function yq(){return function(e){pq(e)}}function Rk(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,s=n.indexOf(t);for(;s!==-1;)a++,s=n.indexOf(t,s+t.length);return a}const Ag="phrasing",Rg=["autolink","link","image","label"];function vq(){return{transforms:[Eq],enter:{literalAutolink:xq,literalAutolinkEmail:Og,literalAutolinkHttp:Og,literalAutolinkWww:Og},exit:{literalAutolink:jq,literalAutolinkEmail:kq,literalAutolinkHttp:wq,literalAutolinkWww:Sq}}}function bq(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ag,notInConstruct:Rg},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ag,notInConstruct:Rg},{character:":",before:"[ps]",after:"\\/",inConstruct:Ag,notInConstruct:Rg}]}}function xq(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Og(e){this.config.enter.autolinkProtocol.call(this,e)}function wq(e){this.config.exit.autolinkProtocol.call(this,e)}function Sq(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 kq(e){this.config.exit.autolinkEmail.call(this,e)}function jq(e){this.exit(e)}function Eq(e){D_(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Cq],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Nq]],{ignore:["link","linkReference"]})}function Cq(e,t,n,a,s){let o="";if(!I_(s)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!_q(n)))return!1;const c=Tq(n+a);if(!c[0])return!1;const f={type:"link",title:null,url:o+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function Nq(e,t,n,a){return!I_(a,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function _q(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Tq(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],a=n.indexOf(")");const s=Rk(e,"(");let o=Rk(e,")");for(;a!==-1&&s>o;)e+=n.slice(0,a+1),n=n.slice(a+1),a=n.indexOf(")"),o++;return[e,n]}function I_(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Xs(n)||Th(n))&&(!t||n!==47)}L_.peek=Pq;function Aq(){this.buffer()}function Rq(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Oq(){this.buffer()}function zq(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Mq(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ba(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Dq(e){this.exit(e)}function Iq(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ba(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Lq(e){this.exit(e)}function Pq(){return"["}function L_(e,t,n,a){const s=n.createTracker(a);let o=s.move("[^");const c=n.enter("footnoteReference"),f=n.enter("reference");return o+=s.move(n.safe(n.associationId(e),{after:"]",before:o})),f(),c(),o+=s.move("]"),o}function Uq(){return{enter:{gfmFootnoteCallString:Aq,gfmFootnoteCall:Rq,gfmFootnoteDefinitionLabelString:Oq,gfmFootnoteDefinition:zq},exit:{gfmFootnoteCallString:Mq,gfmFootnoteCall:Dq,gfmFootnoteDefinitionLabelString:Iq,gfmFootnoteDefinition:Lq}}}function Bq(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:L_},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(a,s,o,c){const f=o.createTracker(c);let m=f.move("[^");const h=o.enter("footnoteDefinition"),p=o.enter("label");return m+=f.move(o.safe(o.associationId(a),{before:m,after:"]"})),p(),m+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),m+=f.move((t?`
|
|
401
|
+
`:" ")+o.indentLines(o.containerFlow(a,f.current()),t?P_:Fq))),h(),m}}function Fq(e,t,n){return t===0?e:P_(e,t,n)}function P_(e,t,n){return(n?"":" ")+e}const $q=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];U_.peek=Vq;function Hq(){return{canContainEols:["delete"],enter:{strikethrough:Zq},exit:{strikethrough:Gq}}}function qq(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:$q}],handlers:{delete:U_}}}function Zq(e){this.enter({type:"delete",children:[]},e)}function Gq(e){this.exit(e)}function U_(e,t,n,a){const s=n.createTracker(a),o=n.enter("strikethrough");let c=s.move("~~");return c+=n.containerPhrasing(e,{...s.current(),before:c,after:"~"}),c+=s.move("~~"),o(),c}function Vq(){return"~"}function Qq(e){return e.length}function Kq(e,t){const n=t||{},a=(n.align||[]).concat(),s=n.stringLength||Qq,o=[],c=[],f=[],m=[];let h=0,p=-1;for(;++p<e.length;){const k=[],j=[];let C=-1;for(e[p].length>h&&(h=e[p].length);++C<e[p].length;){const N=Yq(e[p][C]);if(n.alignDelimiters!==!1){const R=s(N);j[C]=R,(m[C]===void 0||R>m[C])&&(m[C]=R)}k.push(N)}c[p]=k,f[p]=j}let g=-1;if(typeof a=="object"&&"length"in a)for(;++g<h;)o[g]=Ok(a[g]);else{const k=Ok(a);for(;++g<h;)o[g]=k}g=-1;const x=[],w=[];for(;++g<h;){const k=o[g];let j="",C="";k===99?(j=":",C=":"):k===108?j=":":k===114&&(C=":");let N=n.alignDelimiters===!1?1:Math.max(1,m[g]-j.length-C.length);const R=j+"-".repeat(N)+C;n.alignDelimiters!==!1&&(N=j.length+N+C.length,N>m[g]&&(m[g]=N),w[g]=N),x[g]=R}c.splice(1,0,x),f.splice(1,0,w),p=-1;const S=[];for(;++p<c.length;){const k=c[p],j=f[p];g=-1;const C=[];for(;++g<h;){const N=k[g]||"";let R="",M="";if(n.alignDelimiters!==!1){const L=m[g]-(j[g]||0),O=o[g];O===114?R=" ".repeat(L):O===99?L%2?(R=" ".repeat(L/2+.5),M=" ".repeat(L/2-.5)):(R=" ".repeat(L/2),M=R):M=" ".repeat(L)}n.delimiterStart!==!1&&!g&&C.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&N==="")&&(n.delimiterStart!==!1||g)&&C.push(" "),n.alignDelimiters!==!1&&C.push(R),C.push(N),n.alignDelimiters!==!1&&C.push(M),n.padding!==!1&&C.push(" "),(n.delimiterEnd!==!1||g!==h-1)&&C.push("|")}S.push(n.delimiterEnd===!1?C.join("").replace(/ +$/,""):C.join(""))}return S.join(`
|
|
402
|
+
`)}function Yq(e){return e==null?"":String(e)}function Ok(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Xq(e,t,n,a){const s=n.enter("blockquote"),o=n.createTracker(a);o.move("> "),o.shift(2);const c=n.indentLines(n.containerFlow(e,o.current()),Wq);return s(),c}function Wq(e,t,n){return">"+(n?"":" ")+e}function Jq(e,t){return zk(e,t.inConstruct,!0)&&!zk(e,t.notInConstruct,!1)}function zk(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let a=-1;for(;++a<t.length;)if(e.includes(t[a]))return!0;return!1}function Mk(e,t,n,a){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
|
|
403
|
+
`&&Jq(n.stack,n.unsafe[s]))return/[ \t]/.test(a.before)?"":" ";return`\\
|
|
404
|
+
`}function e7(e,t){const n=String(e);let a=n.indexOf(t),s=a,o=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===s?++o>c&&(c=o):o=1,s=a+t.length,a=n.indexOf(t,s);return c}function t7(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 n7(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 r7(e,t,n,a){const s=n7(n),o=e.value||"",c=s==="`"?"GraveAccent":"Tilde";if(t7(e,n)){const g=n.enter("codeIndented"),x=n.indentLines(o,a7);return g(),x}const f=n.createTracker(a),m=s.repeat(Math.max(e7(o,s)+1,3)),h=n.enter("codeFenced");let p=f.move(m);if(e.lang){const g=n.enter(`codeFencedLang${c}`);p+=f.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...f.current()})),g()}if(e.lang&&e.meta){const g=n.enter(`codeFencedMeta${c}`);p+=f.move(" "),p+=f.move(n.safe(e.meta,{before:p,after:`
|
|
405
|
+
`,encode:["`"],...f.current()})),g()}return p+=f.move(`
|
|
406
|
+
`),o&&(p+=f.move(o+`
|
|
407
|
+
`)),p+=f.move(m),h(),p}function a7(e,t,n){return(n?"":" ")+e}function bb(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 i7(e,t,n,a){const s=bb(n),o=s==='"'?"Quote":"Apostrophe",c=n.enter("definition");let f=n.enter("label");const m=n.createTracker(a);let h=m.move("[");return h+=m.move(n.safe(n.associationId(e),{before:h,after:"]",...m.current()})),h+=m.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(n.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=n.enter("destinationRaw"),h+=m.move(n.safe(e.url,{before:h,after:e.title?" ":`
|
|
408
|
+
`,...m.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=m.move(" "+s),h+=m.move(n.safe(e.title,{before:h,after:s,...m.current()})),h+=m.move(s),f()),c(),h}function s7(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function gc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Jf(e,t,n){const a=So(e),s=So(t);return a===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}B_.peek=l7;function B_(e,t,n,a){const s=s7(n),o=n.enter("emphasis"),c=n.createTracker(a),f=c.move(s);let m=c.move(n.containerPhrasing(e,{after:s,before:f,...c.current()}));const h=m.charCodeAt(0),p=Jf(a.before.charCodeAt(a.before.length-1),h,s);p.inside&&(m=gc(h)+m.slice(1));const g=m.charCodeAt(m.length-1),x=Jf(a.after.charCodeAt(0),g,s);x.inside&&(m=m.slice(0,-1)+gc(g));const w=c.move(s);return o(),n.attentionEncodeSurroundingInfo={after:x.outside,before:p.outside},f+m+w}function l7(e,t,n){return n.options.emphasis||"*"}function o7(e,t){let n=!1;return yb(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,Vy}),!!((!e.depth||e.depth<3)&&cb(e)&&(t.options.setext||n))}function u7(e,t,n,a){const s=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(a);if(o7(e,n)){const p=n.enter("headingSetext"),g=n.enter("phrasing"),x=n.containerPhrasing(e,{...o.current(),before:`
|
|
409
|
+
`,after:`
|
|
410
|
+
`});return g(),p(),x+`
|
|
411
|
+
`+(s===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
|
|
412
|
+
`))+1))}const c="#".repeat(s),f=n.enter("headingAtx"),m=n.enter("phrasing");o.move(c+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
|
|
413
|
+
`,...o.current()});return/^[\t ]/.test(h)&&(h=gc(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,n.options.closeAtx&&(h+=" "+c),m(),f(),h}F_.peek=c7;function F_(e){return e.value||""}function c7(){return"<"}$_.peek=d7;function $_(e,t,n,a){const s=bb(n),o=s==='"'?"Quote":"Apostrophe",c=n.enter("image");let f=n.enter("label");const m=n.createTracker(a);let h=m.move("![");return h+=m.move(n.safe(e.alt,{before:h,after:"]",...m.current()})),h+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(n.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=n.enter("destinationRaw"),h+=m.move(n.safe(e.url,{before:h,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=m.move(" "+s),h+=m.move(n.safe(e.title,{before:h,after:s,...m.current()})),h+=m.move(s),f()),h+=m.move(")"),c(),h}function d7(){return"!"}H_.peek=f7;function H_(e,t,n,a){const s=e.referenceType,o=n.enter("imageReference");let c=n.enter("label");const f=n.createTracker(a);let m=f.move("![");const h=n.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),c();const p=n.stack;n.stack=[],c=n.enter("reference");const g=n.safe(n.associationId(e),{before:m,after:"]",...f.current()});return c(),n.stack=p,o(),s==="full"||!h||h!==g?m+=f.move(g+"]"):s==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function f7(){return"!"}q_.peek=h7;function q_(e,t,n){let a=e.value||"",s="`",o=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(a);)s+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++o<n.unsafe.length;){const c=n.unsafe[o],f=n.compilePattern(c);let m;if(c.atBreak)for(;m=f.exec(a);){let h=m.index;a.charCodeAt(h)===10&&a.charCodeAt(h-1)===13&&h--,a=a.slice(0,h)+" "+a.slice(m.index+1)}}return s+a+s}function h7(){return"`"}function Z_(e,t){const n=cb(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))}G_.peek=m7;function G_(e,t,n,a){const s=bb(n),o=s==='"'?"Quote":"Apostrophe",c=n.createTracker(a);let f,m;if(Z_(e,n)){const p=n.stack;n.stack=[],f=n.enter("autolink");let g=c.move("<");return g+=c.move(n.containerPhrasing(e,{before:g,after:">",...c.current()})),g+=c.move(">"),f(),n.stack=p,g}f=n.enter("link"),m=n.enter("label");let h=c.move("[");return h+=c.move(n.containerPhrasing(e,{before:h,after:"](",...c.current()})),h+=c.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(e.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(m=n.enter("destinationRaw"),h+=c.move(n.safe(e.url,{before:h,after:e.title?" ":")",...c.current()}))),m(),e.title&&(m=n.enter(`title${o}`),h+=c.move(" "+s),h+=c.move(n.safe(e.title,{before:h,after:s,...c.current()})),h+=c.move(s),m()),h+=c.move(")"),f(),h}function m7(e,t,n){return Z_(e,n)?"<":"["}V_.peek=p7;function V_(e,t,n,a){const s=e.referenceType,o=n.enter("linkReference");let c=n.enter("label");const f=n.createTracker(a);let m=f.move("[");const h=n.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),c();const p=n.stack;n.stack=[],c=n.enter("reference");const g=n.safe(n.associationId(e),{before:m,after:"]",...f.current()});return c(),n.stack=p,o(),s==="full"||!h||h!==g?m+=f.move(g+"]"):s==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function p7(){return"["}function xb(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 g7(e){const t=xb(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 y7(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 Q_(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 v7(e,t,n,a){const s=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?y7(n):xb(n);const f=e.ordered?c==="."?")":".":g7(n);let m=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(m=!0),Q_(n)===c&&p){let g=-1;for(;++g<e.children.length;){const x=e.children[g];if(x&&x.type==="listItem"&&x.children&&x.children[0]&&x.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=f),n.bulletCurrent=c;const h=n.containerFlow(e,a);return n.bulletLastUsed=c,n.bulletCurrent=o,s(),h}function b7(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 x7(e,t,n,a){const s=b7(n);let o=n.bulletCurrent||xb(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let c=o.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=n.createTracker(a);f.move(o+" ".repeat(c-o.length)),f.shift(c);const m=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,f.current()),p);return m(),h;function p(g,x,w){return x?(w?"":" ".repeat(c))+g:(w?o:o+" ".repeat(c-o.length))+g}}function w7(e,t,n,a){const s=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,a);return o(),s(),c}const S7=Oh(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function k7(e,t,n,a){return(e.children.some(function(c){return S7(c)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function j7(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}K_.peek=E7;function K_(e,t,n,a){const s=j7(n),o=n.enter("strong"),c=n.createTracker(a),f=c.move(s+s);let m=c.move(n.containerPhrasing(e,{after:s,before:f,...c.current()}));const h=m.charCodeAt(0),p=Jf(a.before.charCodeAt(a.before.length-1),h,s);p.inside&&(m=gc(h)+m.slice(1));const g=m.charCodeAt(m.length-1),x=Jf(a.after.charCodeAt(0),g,s);x.inside&&(m=m.slice(0,-1)+gc(g));const w=c.move(s+s);return o(),n.attentionEncodeSurroundingInfo={after:x.outside,before:p.outside},f+m+w}function E7(e,t,n){return n.options.strong||"*"}function C7(e,t,n,a){return n.safe(e.value,a)}function N7(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 _7(e,t,n){const a=(Q_(n)+(n.options.ruleSpaces?" ":"")).repeat(N7(n));return n.options.ruleSpaces?a.slice(0,-1):a}const Y_={blockquote:Xq,break:Mk,code:r7,definition:i7,emphasis:B_,hardBreak:Mk,heading:u7,html:F_,image:$_,imageReference:H_,inlineCode:q_,link:G_,linkReference:V_,list:v7,listItem:x7,paragraph:w7,root:k7,strong:K_,text:C7,thematicBreak:_7};function T7(){return{enter:{table:A7,tableData:Dk,tableHeader:Dk,tableRow:O7},exit:{codeText:z7,table:R7,tableData:zg,tableHeader:zg,tableRow:zg}}}function A7(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 R7(e){this.exit(e),this.data.inTable=void 0}function O7(e){this.enter({type:"tableRow",children:[]},e)}function zg(e){this.exit(e)}function Dk(e){this.enter({type:"tableCell",children:[]},e)}function z7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,M7));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function M7(e,t){return t==="|"?t:e}function D7(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,s=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
414
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:c,tableCell:m,tableRow:f}};function c(w,S,k,j){return h(p(w,k,j),w.align)}function f(w,S,k,j){const C=g(w,k,j),N=h([C]);return N.slice(0,N.indexOf(`
|
|
415
|
+
`))}function m(w,S,k,j){const C=k.enter("tableCell"),N=k.enter("phrasing"),R=k.containerPhrasing(w,{...j,before:o,after:o});return N(),C(),R}function h(w,S){return Kq(w,{align:S,alignDelimiters:a,padding:n,stringLength:s})}function p(w,S,k){const j=w.children;let C=-1;const N=[],R=S.enter("table");for(;++C<j.length;)N[C]=g(j[C],S,k);return R(),N}function g(w,S,k){const j=w.children;let C=-1;const N=[],R=S.enter("tableRow");for(;++C<j.length;)N[C]=m(j[C],w,S,k);return R(),N}function x(w,S,k){let j=Y_.inlineCode(w,S,k);return k.stack.includes("tableCell")&&(j=j.replace(/\|/g,"\\$&")),j}}function I7(){return{exit:{taskListCheckValueChecked:Ik,taskListCheckValueUnchecked:Ik,paragraph:P7}}}function L7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:U7}}}function Ik(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function P7(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const a=n.children[0];if(a&&a.type==="text"){const s=t.children;let o=-1,c;for(;++o<s.length;){const f=s[o];if(f.type==="paragraph"){c=f;break}}c===n&&(a.value=a.value.slice(1),a.value.length===0?n.children.shift():n.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,n.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function U7(e,t,n,a){const s=e.children[0],o=typeof e.checked=="boolean"&&s&&s.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=n.createTracker(a);o&&f.move(c);let m=Y_.listItem(e,t,n,{...a,...f.current()});return o&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(p){return p+c}}function B7(){return[vq(),Uq(),Hq(),T7(),I7()]}function F7(e){return{extensions:[bq(),Bq(e),qq(),D7(e),L7()]}}const $7={tokenize:Q7,partial:!0},X_={tokenize:K7,partial:!0},W_={tokenize:Y7,partial:!0},J_={tokenize:X7,partial:!0},H7={tokenize:W7,partial:!0},eT={name:"wwwAutolink",tokenize:G7,previous:nT},tT={name:"protocolAutolink",tokenize:V7,previous:rT},mi={name:"emailAutolink",tokenize:Z7,previous:aT},za={};function q7(){return{text:za}}let Ds=48;for(;Ds<123;)za[Ds]=mi,Ds++,Ds===58?Ds=65:Ds===91&&(Ds=97);za[43]=mi;za[45]=mi;za[46]=mi;za[95]=mi;za[72]=[mi,tT];za[104]=[mi,tT];za[87]=[mi,eT];za[119]=[mi,eT];function Z7(e,t,n){const a=this;let s,o;return c;function c(g){return!Xy(g)||!aT.call(a,a.previous)||wb(a.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return Xy(g)?(e.consume(g),f):g===64?(e.consume(g),m):n(g)}function m(g){return g===46?e.check(H7,p,h)(g):g===45||g===95||Wn(g)?(o=!0,e.consume(g),m):p(g)}function h(g){return e.consume(g),s=!0,m}function p(g){return o&&s&&ur(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function G7(e,t,n){const a=this;return s;function s(c){return c!==87&&c!==119||!nT.call(a,a.previous)||wb(a.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check($7,e.attempt(X_,e.attempt(W_,o),n),n)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function V7(e,t,n){const a=this;let s="",o=!1;return c;function c(g){return(g===72||g===104)&&rT.call(a,a.previous)&&!wb(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(g),e.consume(g),f):n(g)}function f(g){if(ur(g)&&s.length<5)return s+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const x=s.toLowerCase();if(x==="http"||x==="https")return e.consume(g),m}return n(g)}function m(g){return g===47?(e.consume(g),o?h:(o=!0,m)):n(g)}function h(g){return g===null||Yf(g)||Lt(g)||Xs(g)||Th(g)?n(g):e.attempt(X_,e.attempt(W_,p),n)(g)}function p(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function Q7(e,t,n){let a=0;return s;function s(c){return(c===87||c===119)&&a<3?(a++,e.consume(c),s):c===46&&a===3?(e.consume(c),o):n(c)}function o(c){return c===null?n(c):t(c)}}function K7(e,t,n){let a,s,o;return c;function c(h){return h===46||h===95?e.check(J_,m,f)(h):h===null||Lt(h)||Xs(h)||h!==45&&Th(h)?m(h):(o=!0,e.consume(h),c)}function f(h){return h===95?a=!0:(s=a,a=void 0),e.consume(h),c}function m(h){return s||a||!o?n(h):t(h)}}function Y7(e,t){let n=0,a=0;return s;function s(c){return c===40?(n++,e.consume(c),s):c===41&&a<n?o(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(J_,t,o)(c):c===null||Lt(c)||Xs(c)?t(c):(e.consume(c),s)}function o(c){return c===41&&a++,e.consume(c),s}}function X7(e,t,n){return a;function a(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),a):f===38?(e.consume(f),o):f===93?(e.consume(f),s):f===60||f===null||Lt(f)||Xs(f)?t(f):n(f)}function s(f){return f===null||f===40||f===91||Lt(f)||Xs(f)?t(f):a(f)}function o(f){return ur(f)?c(f):n(f)}function c(f){return f===59?(e.consume(f),a):ur(f)?(e.consume(f),c):n(f)}}function W7(e,t,n){return a;function a(o){return e.consume(o),s}function s(o){return Wn(o)?n(o):t(o)}}function nT(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Lt(e)}function rT(e){return!ur(e)}function aT(e){return!(e===47||Xy(e))}function Xy(e){return e===43||e===45||e===46||e===95||Wn(e)}function wb(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 J7={tokenize:lZ,partial:!0};function eZ(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:aZ,continuation:{tokenize:iZ},exit:sZ}},text:{91:{name:"gfmFootnoteCall",tokenize:rZ},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:tZ,resolveTo:nZ}}}}function tZ(e,t,n){const a=this;let s=a.events.length;const o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c;for(;s--;){const m=a.events[s][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!c||!c._balanced)return n(m);const h=ba(a.sliceSerialize({start:c.end,end:a.now()}));return h.codePointAt(0)!==94||!o.includes(h.slice(1))?n(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),t(m))}}function nZ(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},f=[e[n+1],e[n+2],["enter",a,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(n,e.length-n+1,...f),e}function rZ(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o=0,c;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(g){if(o>999||g===93&&!c||g===null||g===91||Lt(g))return n(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return s.includes(ba(a.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return Lt(g)||(c=!0),o++,e.consume(g),g===92?p:h}function p(g){return g===91||g===92||g===93?(e.consume(g),o++,h):h(g)}}function aZ(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o,c=0,f;return m;function m(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(S)}function p(S){if(c>999||S===93&&!f||S===null||S===91||Lt(S))return n(S);if(S===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=ba(a.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return Lt(S)||(f=!0),c++,e.consume(S),S===92?g:p}function g(S){return S===91||S===92||S===93?(e.consume(S),c++,p):p(S)}function x(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),s.includes(o)||s.push(o),xt(e,w,"gfmFootnoteDefinitionWhitespace")):n(S)}function w(S){return t(S)}}function iZ(e,t,n){return e.check(Pc,t,e.attempt(J7,t,n))}function sZ(e){e.exit("gfmFootnoteDefinition")}function lZ(e,t,n){const a=this;return xt(e,s,"gfmFootnoteDefinitionIndent",5);function s(o){const c=a.events[a.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(o):n(o)}}function oZ(e){let n=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:o,resolveAll:s};return n==null&&(n=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function s(c,f){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let h=m;for(;h--;)if(c[h][0]==="exit"&&c[h][1].type==="strikethroughSequenceTemporary"&&c[h][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[h][1].end.offset-c[h][1].start.offset){c[m][1].type="strikethroughSequence",c[h][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[m][1].start)},x=[["enter",p,f],["enter",c[h][1],f],["exit",c[h][1],f],["enter",g,f]],w=f.parser.constructs.insideSpan.null;w&&Fr(x,x.length,0,Ah(w,c.slice(h+1,m),f)),Fr(x,x.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",p,f]]),Fr(c,h-1,m-h+3,x),m=h+x.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function o(c,f,m){const h=this.previous,p=this.events;let g=0;return x;function x(S){return h===126&&p[p.length-1][1].type!=="characterEscape"?m(S):(c.enter("strikethroughSequenceTemporary"),w(S))}function w(S){const k=So(h);if(S===126)return g>1?m(S):(c.consume(S),g++,w);if(g<2&&!n)return m(S);const j=c.exit("strikethroughSequenceTemporary"),C=So(S);return j._open=!C||C===2&&!!k,j._close=!k||k===2&&!!C,f(S)}}}class uZ{constructor(){this.map=[]}add(t,n,a){cZ(this,t,n,a)}consume(t){if(this.map.sort(function(o,c){return o[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const a=[];for(;n>0;)n-=1,a.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];a.push(t.slice()),t.length=0;let s=a.pop();for(;s;){for(const o of s)t.push(o);s=a.pop()}this.map.length=0}}function cZ(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 dZ(e,t){let n=!1;const a=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&a.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=a.length-1;a[o]=a[o]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return a}function fZ(){return{flow:{null:{name:"table",tokenize:hZ,resolveAll:mZ}}}}function hZ(e,t,n){const a=this;let s=0,o=0,c;return f;function f(z){let K=a.events.length-1;for(;K>-1;){const J=a.events[K][1].type;if(J==="lineEnding"||J==="linePrefix")K--;else break}const ie=K>-1?a.events[K][1].type:null,ve=ie==="tableHead"||ie==="tableRow"?O:m;return ve===O&&a.parser.lazy[a.now().line]?n(z):ve(z)}function m(z){return e.enter("tableHead"),e.enter("tableRow"),h(z)}function h(z){return z===124||(c=!0,o+=1),p(z)}function p(z){return z===null?n(z):He(z)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),w):n(z):ct(z)?xt(e,p,"whitespace")(z):(o+=1,c&&(c=!1,s+=1),z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),c=!0,p):(e.enter("data"),g(z)))}function g(z){return z===null||z===124||Lt(z)?(e.exit("data"),p(z)):(e.consume(z),z===92?x:g)}function x(z){return z===92||z===124?(e.consume(z),g):g(z)}function w(z){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(z):(e.enter("tableDelimiterRow"),c=!1,ct(z)?xt(e,S,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):S(z))}function S(z){return z===45||z===58?j(z):z===124?(c=!0,e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),k):L(z)}function k(z){return ct(z)?xt(e,j,"whitespace")(z):j(z)}function j(z){return z===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),C):z===45?(o+=1,C(z)):z===null||He(z)?M(z):L(z)}function C(z){return z===45?(e.enter("tableDelimiterFiller"),N(z)):L(z)}function N(z){return z===45?(e.consume(z),N):z===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),R):(e.exit("tableDelimiterFiller"),R(z))}function R(z){return ct(z)?xt(e,M,"whitespace")(z):M(z)}function M(z){return z===124?S(z):z===null||He(z)?!c||s!==o?L(z):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(z)):L(z)}function L(z){return n(z)}function O(z){return e.enter("tableRow"),B(z)}function B(z){return z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),B):z===null||He(z)?(e.exit("tableRow"),t(z)):ct(z)?xt(e,B,"whitespace")(z):(e.enter("data"),I(z))}function I(z){return z===null||z===124||Lt(z)?(e.exit("data"),B(z)):(e.consume(z),z===92?Y:I)}function Y(z){return z===92||z===124?(e.consume(z),I):I(z)}}function mZ(e,t){let n=-1,a=!0,s=0,o=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,h,p,g;const x=new uZ;for(;++n<e.length;){const w=e[n],S=w[1];w[0]==="enter"?S.type==="tableHead"?(f=!1,m!==0&&(Lk(x,t,m,h,p),p=void 0,m=0),h={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(n,0,[["enter",h,t]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(a=!0,g=void 0,o=[0,0,0,0],c=[0,n+1,0,0],f&&(f=!1,p={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(n,0,[["enter",p,t]])),s=S.type==="tableDelimiterRow"?2:p?3:1):s&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(a=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],g=wf(x,t,o,s,void 0,g),o=[0,0,0,0]),c[2]=n)):S.type==="tableCellDivider"&&(a?a=!1:(o[1]!==0&&(c[0]=c[1],g=wf(x,t,o,s,void 0,g)),o=c,c=[o[1],n,0,0])):S.type==="tableHead"?(f=!0,m=n):S.type==="tableRow"||S.type==="tableDelimiterRow"?(m=n,o[1]!==0?(c[0]=c[1],g=wf(x,t,o,s,n,g)):c[1]!==0&&(g=wf(x,t,c,s,n,g)),s=0):s&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(c[3]=n)}for(m!==0&&Lk(x,t,m,h,p),x.consume(t.events),n=-1;++n<t.events.length;){const w=t.events[n];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=dZ(t.events,n))}return e}function wf(e,t,n,a,s,o){const c=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},Ql(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const m=Ql(t.events,n[1]);if(o={type:c,start:Object.assign({},m),end:Object.assign({},m)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const h=Ql(t.events,n[2]),p=Ql(t.events,n[3]),g={type:f,start:Object.assign({},h),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",g,t]]),a!==2){const x=t.events[n[2]],w=t.events[n[3]];if(x[1].end=Object.assign({},w[1].end),x[1].type="chunkText",x[1].contentType="text",n[3]>n[2]+1){const S=n[2]+1,k=n[3]-n[2]-1;e.add(S,k,[])}}e.add(n[3]+1,0,[["exit",g,t]])}return s!==void 0&&(o.end=Object.assign({},Ql(t.events,s)),e.add(s,0,[["exit",o,t]]),o=void 0),o}function Lk(e,t,n,a,s){const o=[],c=Ql(t.events,n);s&&(s.end=Object.assign({},c),o.push(["exit",s,t])),a.end=Object.assign({},c),o.push(["exit",a,t]),e.add(n+1,0,o)}function Ql(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const pZ={name:"tasklistCheck",tokenize:yZ};function gZ(){return{text:{91:pZ}}}function yZ(e,t,n){const a=this;return s;function s(m){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?n(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),o)}function o(m){return Lt(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):n(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):n(m)}function f(m){return He(m)?t(m):ct(m)?e.check({tokenize:vZ},t,n)(m):n(m)}}function vZ(e,t,n){return xt(e,a,"whitespace");function a(s){return s===null?n(s):t(s)}}function bZ(e){return m_([q7(),eZ(),oZ(e),fZ(),gZ()])}const xZ={};function wZ(e){const t=this,n=e||xZ,a=t.data(),s=a.micromarkExtensions||(a.micromarkExtensions=[]),o=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);s.push(bZ(n)),o.push(B7()),c.push(F7(n))}function Mh({children:e,className:t}){return l.jsx("div",{className:ze("prose prose-sm max-w-none leading-[1.55] text-[color:inherit]","prose-headings:text-current prose-p:text-current prose-li:text-current prose-strong:text-current prose-em:text-current prose-blockquote:text-current","prose-p:my-2 prose-headings:mt-3 prose-headings:mb-1.5 prose-ul:my-2 prose-ol:my-2 prose-li:my-0.5 prose-pre:my-2 prose-blockquote:my-2 prose-hr:my-3","prose-a:text-[color:var(--accent)] prose-a:no-underline hover:prose-a:underline","prose-code:text-current prose-code:bg-[color:var(--bg-sunken)] prose-code:rounded prose-code:px-1 prose-code:py-0.5 prose-code:text-[0.9em] prose-code:before:content-none prose-code:after:content-none","prose-pre:bg-[color:var(--bg-sunken)] prose-pre:text-current prose-pre:border prose-pre:border-[color:var(--border)]","prose-hr:border-[color:var(--border)]","prose-blockquote:border-l-[color:var(--border-strong)] prose-blockquote:text-[color:var(--fg-2)]","prose-th:border-[color:var(--border)] prose-td:border-[color:var(--border)]",t),children:l.jsx(sq,{remarkPlugins:[wZ,yq],children:e})})}function SZ({value:e,baseline:t,onChange:n,onRevert:a,disabled:s}){const[o,c]=b.useState(!1),f=b.useRef(null),m=e!==t;return b.useEffect(()=>{var h;o&&((h=f.current)==null||h.focus())},[o]),l.jsxs(En,{style:{borderColor:m?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[l.jsxs(ua,{children:[l.jsxs(ca,{children:["System prompt append",m&&l.jsx(kZ,{})]}),!o&&!s&&l.jsxs(ye,{size:"xs",variant:"outline",onClick:()=>c(!0),children:[l.jsx(Tv,{className:"h-3 w-3"})," Edit"]})]}),l.jsx(Jn,{children:o?l.jsxs("div",{className:"space-y-2",children:[l.jsx("textarea",{ref:f,value:e,onChange:h=>n(h.target.value),onKeyDown:h=>{h.key==="Escape"&&(h.preventDefault(),c(!1))},rows:10,className:"w-full rounded border bg-transparent p-2 font-mono text-body shadow-sm focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Appended to Claude Code's default system prompt.",maxLength:32e3,spellCheck:!1}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(ye,{size:"xs",variant:"ghost",onClick:()=>{a(),c(!1)},disabled:!m,children:"Revert"}),l.jsx(ye,{size:"xs",onClick:()=>c(!1),children:"Done"})]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"`Done` collapses this editor. The change is saved only when you click Save in the bar at the bottom of the page."})]}):l.jsx("div",{className:"rounded bg-muted p-3 text-body max-h-64 overflow-auto min-h-8",children:e?l.jsx(Mh,{children:e}):l.jsx("span",{className:"text-muted-foreground italic",children:"No prompt append."})})})]})}function kZ(){return l.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",color:"color-mix(in oklch, var(--state-blocked) 60%, var(--fg))"},children:"changed"})}const iT={"claude-code":"Claude Code",codex:"Codex"},jZ=[Qf.CLAUDE_CODE,Qf.CODEX];function EZ({open:e,onOpenChange:t,agent:n}){const a=gn(),s=n.clientId,o=n.runtimeProvider,[c,f]=b.useState(s),[m,h]=b.useState(o),[p,g]=b.useState(!1),w=Ke({queryKey:["clients-rebind"],queryFn:ci,enabled:e}).data??[],S=zR({queries:w.map(I=>({queryKey:["client-capabilities",I.id],queryFn:()=>dh(I.id),enabled:e}))}),k=b.useMemo(()=>{const I=new Map;return S.forEach((Y,z)=>{const K=w[z];if(!K)return;const ie=Y.data;ie!=null&&ie.capabilities&&I.set(K.id,ie.capabilities)}),I},[S,w]);b.useEffect(()=>{e||(f(s),h(o),g(!1))},[e,s,o]);const j=c?k.get(c)??null:null,C=(j==null?void 0:j[m])??null,N=!C||C.state==="missing"||C.state==="error",R=!!c&&(c!==s||m!==o)&&(!N||p),M=m!==o,L=c!==s,O=ht({mutationFn:()=>{if(!c)throw new Error("clientId required");return s4(n.uuid,{clientId:c,runtimeProvider:m,force:N&&p?!0:void 0})},onSuccess:()=>{a.invalidateQueries({queryKey:["agent",n.uuid]}),a.invalidateQueries({queryKey:["agents"]}),t(!1)}}),B=O.error instanceof Js||O.error instanceof Error?O.error.message:null;return l.jsx(On,{open:e,onOpenChange:t,children:l.jsxs(Nn,{className:"max-w-lg",children:[l.jsx(Pn,{children:l.jsx(zn,{children:"Re-bind agent"})}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:["Currently:"," ",l.jsx("span",{className:"mono",children:NZ(s,w,o)})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{children:"Computer"}),l.jsx("select",{value:c??"",onChange:I=>f(I.target.value||null),className:"w-full rounded-[var(--radius-input)] border border-input bg-background px-3 py-2 text-body",children:w.map(I=>l.jsx("option",{value:I.id,children:CZ(I)},I.id))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{children:"Runtime"}),l.jsx("div",{className:"space-y-2",children:jZ.map(I=>{const Y=(j==null?void 0:j[I])??null,z=!!Y&&Y.state!=="missing",K=m===I;return l.jsxs("label",{className:K?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":z?"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30":"flex items-start gap-3 rounded-md border border-border p-3 opacity-60",children:[l.jsx("input",{type:"radio",name:"rebind-runtime",checked:K,onChange:()=>h(I),className:"mt-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-body font-medium",children:iT[I]}),l.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:TZ(Y,I)})]})]},I)})})]}),(L||M)&&l.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-caption space-y-1",children:[l.jsxs("p",{children:[l.jsx("span",{className:"font-medium",children:"Heads up:"})," active sessions on the previous computer are suspended at re-bind. Chat history is preserved."]}),M&&l.jsx("p",{children:"Some configuration fields don't transfer between providers (e.g. claude permission_mode is dropped; codex sandboxMode resets to default)."})]}),N&&l.jsxs("label",{className:"flex items-start gap-2 text-caption",style:{color:"var(--fg-2)"},children:[l.jsx("input",{type:"checkbox",checked:p,onChange:I=>g(I.target.checked),className:"mt-0.5"}),l.jsx("span",{children:"Override capability check — pick this if the destination computer is offline or the SDK was just installed and capabilities haven't refreshed yet."})]}),B&&l.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:B})]}),l.jsxs(fr,{children:[l.jsx(ye,{variant:"outline",onClick:()=>t(!1),disabled:O.isPending,children:"Cancel"}),l.jsx(ye,{onClick:()=>O.mutate(),disabled:!R||O.isPending,children:O.isPending?"Re-binding…":"Re-bind"})]})]})})}function CZ(e){return`${e.hostname??e.id} · ${e.status}`}function NZ(e,t,n){const a=e?t.find(o=>o.id===e):null;return`${(a==null?void 0:a.hostname)??e??"(unbound)"} · ${iT[n]}`}const _Z={"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 TZ(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. ${_Z[t]}`;case"missing":return"SDK not installed on this computer.";case"error":return e.error?`Probe error: ${e.error}`:"Probe error."}}const AZ={prompt:"Prompt",model:"Model",mcp:"MCP",env:"Env",git:"Git"};function RZ(e){if(!e.summary.anyDirty&&!e.conflictMessage&&!e.errorMessage&&!e.justSaved)return null;const t=e.summary.dirtySections.length;return l.jsx("div",{className:"sticky bottom-0 z-30 -mx-6 backdrop-blur",style:{padding:"var(--sp-3) var(--sp-6)",background:"color-mix(in oklch, var(--bg-raised) 94%, transparent)",borderTop:"var(--hairline) solid var(--border)"},children:l.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[l.jsxs("div",{className:"flex flex-col gap-1 text-body min-w-0",children:[e.summary.anyDirty&&l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx(Ju,{state:"blocked",size:8}),l.jsxs("span",{className:"font-medium",children:[t," section",t===1?"":"s"," with unsaved changes"]}),l.jsx("span",{style:{color:"var(--fg-4)"},"aria-hidden":!0,children:"·"}),l.jsx("span",{className:"flex flex-wrap gap-1",children:e.summary.dirtySections.map(n=>l.jsx("button",{type:"button",onClick:()=>e.onJumpTo(n),className:"text-caption transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{padding:"var(--sp-0_5) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",color:"var(--fg-2)",cursor:"pointer"},children:AZ[n]},n))})]}),e.justSaved&&!e.summary.anyDirty&&!e.errorMessage&&!e.conflictMessage&&l.jsxs("div",{className:"inline-flex items-center gap-1.5 text-body font-medium",style:{color:"var(--state-idle)"},children:[l.jsx(cr,{className:"h-3.5 w-3.5"}),"Saved"]}),e.saveHint&&l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:e.saveHint}),e.conflictMessage&&l.jsx("p",{className:"text-caption font-medium",style:{color:"var(--state-blocked)"},children:e.conflictMessage}),e.errorMessage&&l.jsx("p",{className:"text-caption font-medium",style:{color:"var(--state-error)"},children:e.errorMessage})]}),l.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.conflictMessage&&l.jsx(ye,{variant:"outline",size:"sm",onClick:e.onReloadRemote,children:"Discard mine, load latest"}),l.jsx(ye,{variant:"ghost",size:"sm",onClick:e.onDiscard,disabled:e.saving,children:"Discard changes"}),l.jsx(ye,{size:"sm",onClick:e.onSave,disabled:e.saving||!e.summary.anyDirty,children:e.saving?l.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[l.jsx(jE,{className:"h-3 w-3 animate-spin","aria-hidden":!0}),"Saving…"]}):"Save"})]})]})})}function rc(e){return`agent-cfg-${e}`}function Fu({anchorId:e,title:t,caption:n,right:a,children:s,className:o,sectionProps:c}){return l.jsxs("section",{id:e,className:ze("space-y-3",o),...c,children:[l.jsxs("div",{className:"flex items-end justify-between gap-3",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"text-subtitle",style:{color:"var(--fg)"},children:t}),n&&l.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:n})]}),a]}),l.jsx("div",{className:"space-y-3",children:s})]})}function OZ(){return l.jsx("hr",{"aria-hidden":!0,style:{border:0,borderTop:"var(--hairline) solid var(--border)",margin:"var(--sp-2) 0"}})}const zZ={"claude-code":{name:"Claude Code",caption:"Anthropic's Claude Code runtime. Re-bind via the agent's settings to switch computer or runtime."},codex:{name:"Codex",caption:"OpenAI's Codex CLI runtime. Re-bind via the agent's settings to switch computer or runtime."}};function MZ(e){const t=zZ[e.runtimeProvider];return l.jsxs("div",{className:"space-y-3",children:[l.jsx(DZ,{name:t.name,caption:t.caption,locked:!0}),l.jsx(IZ,{computerLabel:e.computerLabel,canBindComputer:e.canBindComputer,bindPending:e.bindComputerPending??!1,onBindComputer:e.onBindComputer,onRebind:e.onRebind}),e.modelSlot]})}function DZ({name:e,caption:t,locked:n}){return l.jsxs(En,{children:[l.jsx(ua,{children:l.jsxs(ca,{children:["Where it runs",n&&l.jsxs("span",{className:"mono uppercase text-caption inline-flex items-center gap-1",style:{color:"var(--fg-4)"},children:[l.jsx(uh,{className:"h-3 w-3","aria-hidden":!0})," locked"]})]})}),l.jsxs(Jn,{className:"space-y-1 text-body",children:[l.jsxs("div",{className:"inline-flex items-center gap-2",children:[l.jsx(EE,{className:"h-3.5 w-3.5","aria-hidden":!0,style:{color:"var(--accent)"}}),l.jsx("span",{className:"font-medium",children:e})]}),l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:t})]})]})}function IZ(e){const t=!!e.computerLabel;return l.jsxs(En,{children:[l.jsxs(ua,{children:[l.jsx(ca,{children:"Bound computer"}),e.canBindComputer&&e.onBindComputer&&!t&&l.jsxs(ye,{size:"xs",variant:"outline",onClick:e.onBindComputer,disabled:e.bindPending,children:[l.jsx(jy,{className:"h-3 w-3"}),e.bindPending?"Binding…":"Bind computer"]}),t&&e.onRebind&&l.jsxs(ye,{size:"xs",variant:"outline",onClick:e.onRebind,children:[l.jsx(jy,{className:"h-3 w-3"}),"Re-bind"]})]}),l.jsx(Jn,{className:"text-body",children:t?l.jsx("div",{className:"mono",style:{color:"var(--fg-2)"},children:e.computerLabel}):l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"No computer bound. A computer claims this agent on its first WebSocket connect, or you can pick one manually via the button above."})})]})}function LZ(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 PZ(e,t){let n=t.size+1;for(;t.has(`${e}-${n}`);)n++;return`${e}-${n}`}function UZ(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Mg(e,t){return e.map((n,a)=>({key:`${t}-${a+1}`,value:n,baseline:n,status:"unchanged"}))}function Pk(e){return e.map(t=>t.status==="deleted"?t:t.baseline==null?{...t,status:"added"}:UZ(t.value,t.baseline)?{...t,status:"unchanged"}:{...t,status:"modified"})}function Dg(e,t){const n=e;return{add:a=>t(s=>{const o=s[e],c=new Set(o.map(h=>h.key)),f=PZ(n,c),m=[...o,{key:f,value:a,baseline:null,status:"added"}];return{...s,[e]:Pk(m)}}),update:(a,s)=>t(o=>{const f=o[e].map(m=>m.key===a?{...m,value:s}:m);return{...o,[e]:Pk(f)}}),remove:a=>t(s=>{const c=s[e].map(f=>f.key!==a?f:f.baseline==null?null:{...f,status:"deleted"}).filter(f=>f!==null);return{...s,[e]:c}}),undo:a=>t(s=>{const c=s[e].map(f=>f.key!==a||f.baseline==null?f:{...f,value:f.baseline,status:"unchanged"});return{...s,[e]:c}})}}function BZ(e){return{promptAppend:e.payload.prompt.append,model:e.payload.model,mcp:Mg(e.payload.mcpServers,"mcp"),env:Mg(e.payload.env,"env"),git:Mg(e.payload.gitRepos,"git")}}function FZ(e){const[t,n]=b.useState(null);b.useEffect(()=>{e&&t===null&&n(BZ(e))},[e,t]);const a=t??{promptAppend:"",model:"",mcp:[],env:[],git:[]},s=(e==null?void 0:e.payload.prompt.append)??"",o=(e==null?void 0:e.payload.model)??"",c=a.promptAppend!==s,f=a.model!==o,m=b.useMemo(()=>{const R=[],M=I=>I.reduce((Y,z)=>z.status==="unchanged"?Y:Y+1,0),L=M(a.mcp),O=M(a.env),B=M(a.git);return c&&R.push("prompt"),f&&R.push("model"),L>0&&R.push("mcp"),O>0&&R.push("env"),B>0&&R.push("git"),{anyDirty:R.length>0,dirtySections:R,counts:{prompt:c?1:0,model:f?1:0,mcp:L,env:O,git:B}}},[a,c,f]),h=b.useCallback(R=>{n(M=>M&&R(M))},[]),p=b.useCallback(R=>h(M=>({...M,promptAppend:R})),[h]),g=b.useCallback(()=>h(R=>({...R,promptAppend:s})),[h,s]),x=b.useCallback(R=>h(M=>({...M,model:R})),[h]),w=b.useCallback(()=>h(R=>({...R,model:o})),[h,o]),S=b.useMemo(()=>Dg("mcp",h),[h]),k=b.useMemo(()=>Dg("env",h),[h]),j=b.useMemo(()=>Dg("git",h),[h]),C=b.useCallback(()=>{n(null)},[]),N=b.useCallback(()=>{if(!t||!e)return{};const R={};c&&(R.prompt={append:t.promptAppend}),f&&(R.model=t.model);const M=m.counts.mcp>0,L=m.counts.env>0,O=m.counts.git>0;return M&&(R.mcpServers=t.mcp.filter(B=>B.status!=="deleted").map(B=>B.value)),L&&(R.env=t.env.filter(B=>B.status!=="deleted").map(B=>{const I=B.value;return I.sensitive&&I.value===Gf?{key:I.key,value:Gf,sensitive:!0}:I})),O&&(R.gitRepos=t.git.filter(B=>B.status!=="deleted").map(B=>B.value)),R},[t,e,c,f,m]);return{draft:a,summary:m,promptDirty:c,modelDirty:f,setPromptAppend:p,revertPrompt:g,setModel:x,revertModel:w,addMcp:S.add,updateMcp:S.update,deleteMcp:S.remove,undoDeleteMcp:S.undo,addEnv:k.add,updateEnv:k.update,deleteEnv:k.remove,undoDeleteEnv:k.undo,addGit:j.add,updateGit:j.update,deleteGit:j.remove,undoDeleteGit:j.undo,resetAll:C,buildPayloadPatch:N}}const Yn={overview:"ad-overview",setup:"ad-setup",prompt:rc("prompt"),tools:rc("mcp"),advanced:"ad-advanced",danger:"ad-danger"};function $Z(e){const t=[{key:"overview",label:"Profile",anchor:Yn.overview}];return e||t.push({key:"setup",label:"Setup",anchor:Yn.setup},{key:"prompt",label:"Prompt",anchor:Yn.prompt},{key:"tools",label:"Tools",anchor:Yn.tools},{key:"advanced",label:"Advanced",anchor:Yn.advanced}),t.push({key:"danger",label:"Danger zone",anchor:Yn.danger,divider:!0,danger:!0}),t}function HZ(){var At,lt,nr,Mn,il,fa,ha,Ma,Vn,Da,Sa,Zt;const t=nE().uuid??"",n=An(),a=gn(),s=Ke({queryKey:["agent",t],queryFn:()=>r4(t),enabled:!!t}),o=Ke({queryKey:["agent-config",t],queryFn:()=>Nh(t),enabled:!!t&&((At=s.data)==null?void 0:At.type)!=="human"}),c=Ke({queryKey:["agent-client-status",t],queryFn:()=>y9(t),enabled:!!t&&((lt=s.data)==null?void 0:lt.type)!=="human"}),f=Ke({queryKey:["agent-sessions-active",t],queryFn:()=>ZE(t,{state:"active"}),enabled:!!t&&((nr=s.data)==null?void 0:nr.type)!=="human"}),m=Ke({queryKey:["clients"],queryFn:ci,enabled:!!t&&((Mn=s.data)==null?void 0:Mn.type)!=="human",refetchInterval:3e4}),h=FZ(o.data),[p,g]=b.useState(null),[x,w]=b.useState(null),[S,k]=b.useState(!1),j=ht({mutationFn:async()=>{if(!o.data)throw new Error("config not loaded");const je=h.buildPayloadPatch();return _h(t,{expectedVersion:o.data.version,payload:je})},onSuccess:je=>{a.setQueryData(["agent-config",t],je),g(null),w(null),k(!0)},onError:je=>{if(k(!1),je instanceof Js&&je.status===409){w("Someone else saved a newer version while you were editing."),g(null);return}g(je instanceof Error?je.message:String(je))}});b.useEffect(()=>{if(!S)return;const je=setTimeout(()=>k(!1),2500);return()=>clearTimeout(je)},[S]),b.useEffect(()=>{h.summary.anyDirty&&k(!1)},[h.summary.anyDirty]);const C=b.useCallback(()=>{w(null),g(null),a.invalidateQueries({queryKey:["agent-config",t]}),h.resetAll()},[a,t,h]),N=b.useCallback(je=>{const nt=document.getElementById(je);nt&&nt.scrollIntoView({behavior:"smooth",block:"start"})},[]),R=ht({mutationFn:je=>Ry(t,je),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agents"]})}}),M=ht({mutationFn:()=>HC(t),onSuccess:()=>a.invalidateQueries({queryKey:["agent",t]})}),L=ht({mutationFn:()=>qC(t),onSuccess:()=>a.invalidateQueries({queryKey:["agent",t]})}),O=ht({mutationFn:()=>$C(t),onSuccess:()=>n("/team")}),B=ht({mutationFn:()=>l4(t)}),[I,Y]=b.useState(!1),[z,K]=b.useState(""),[ie,ve]=b.useState(null),[J,W]=b.useState(!1),Z=Ke({queryKey:["clients"],queryFn:ci,enabled:I}),ne=ht({mutationFn:je=>Ry(t,{clientId:je}),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agent-client-status",t]}),a.invalidateQueries({queryKey:["agents"]}),Y(!1),K(""),ve(null)},onError:je=>ve(je instanceof Error?je.message:String(je))}),[ke,Ae]=b.useState(!1),[D,P]=b.useState(null),F=ht({mutationFn:()=>g9(t,h.buildPayloadPatch()),onSuccess:je=>{const nt=je.diff.length?je.diff.map(yn=>`${yn.op} ${yn.path}`).join(`
|
|
416
|
+
`):"(no changes)";P(nt)},onError:je=>P(`Dry run failed: ${je instanceof Error?je.message:String(je)}`)});b.useEffect(()=>{if(!h.summary.anyDirty)return;const je=nt=>{nt.preventDefault(),nt.returnValue=""};return window.addEventListener("beforeunload",je),()=>window.removeEventListener("beforeunload",je)},[h.summary.anyDirty]);const T=((il=s.data)==null?void 0:il.type)==="human",G=b.useMemo(()=>$Z(T),[T]),q=b.useRef(null),[ae,be]=b.useState(!1);b.useEffect(()=>{if(T)return;const je=q.current;if(!je||typeof IntersectionObserver>"u")return;const nt=new IntersectionObserver(yn=>{const Ar=yn[0];Ar&&be(!Ar.isIntersecting&&Ar.boundingClientRect.top<0)},{threshold:0});return nt.observe(je),()=>nt.disconnect()},[T]);const[we,me]=b.useState(Yn.overview);b.useEffect(()=>{if(typeof IntersectionObserver>"u")return;const je=[];for(const nt of G){const yn=document.getElementById(nt.anchor);if(!yn)continue;const Ar=new IntersectionObserver(yi=>{for(const ys of yi)ys.isIntersecting&&me(nt.anchor)},{rootMargin:"0% 0% -70% 0%",threshold:0});Ar.observe(yn),je.push(Ar)}return()=>{for(const nt of je)nt.disconnect()}},[G]);const Me=b.useMemo(()=>{const je=new Set;for(const nt of h.summary.dirtySections)nt==="prompt"&&je.add(Yn.prompt),nt==="model"&&je.add(Yn.setup),nt==="mcp"&&je.add(Yn.tools),(nt==="env"||nt==="git")&&je.add(Yn.advanced);return je},[h.summary.dirtySections]);if(s.isLoading)return l.jsx("div",{className:"-m-6 flex",style:{minHeight:"100%"},children:l.jsx("div",{className:"p-6 text-body",style:{color:"var(--fg-3)"},children:"Loading…"})});if(s.error)return l.jsxs("div",{className:"-m-6 p-6 text-body",style:{color:"var(--state-error)"},children:["Failed to load agent: ",s.error instanceof Error?s.error.message:"Unknown error"]});const Ie=s.data;if(!Ie)return l.jsx("div",{className:"-m-6 p-6 text-body",style:{color:"var(--fg-3)"},children:"Agent not found"});const St=Ie.type==="human",tt=c.data,it=((fa=f.data)==null?void 0:fa.length)??0,V=!St&&!(tt!=null&&tt.clientId),pe=!St&&tt?!tt.online&&!!tt.clientId:!1,_e=Ie,Pe=_e.runtimeState??null,Mt=_e.runtimeType??null,Pt=_e.totalSessions??null,hr=Ie.uuid.slice(0,8),pi=LZ({activeSessions:it,isUnclaimed:V,isOffline:pe}),gi=h.draft.mcp.filter(je=>je.status!=="deleted"),cn=h.draft.env.filter(je=>je.status!=="deleted"),da=h.draft.git.filter(je=>je.status!=="deleted"),oe=je=>new Set(gi.filter(nt=>nt.key!==je).map(nt=>nt.value.name.toLowerCase())),ge=je=>new Set(cn.filter(nt=>nt.key!==je).map(nt=>nt.value.key)),$e=je=>new Set(da.filter(nt=>nt.key!==je).map(nt=>{const{value:yn}=nt;return yn.localPath?yn.localPath:((yn.url.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,"")}).filter(Boolean)),Ve={sessions:Pt??"—",active:it,runtime:Mt??(St?"human":"—"),model:((Ma=(ha=o.data)==null?void 0:ha.payload.model)==null?void 0:Ma.trim())||"—"},st=(tt==null?void 0:tt.clientId)??null,dn=st?((Vn=m.data)==null?void 0:Vn.find(je=>je.id===st))??null:null,tr=st?(dn==null?void 0:dn.hostname)??st:null,qt=Ie.runtimeProvider??"claude-code",Ut=qt==="codex"?"Codex":"Claude Code";return l.jsxs("div",{className:"-m-6 flex",style:{minHeight:"calc(100vh - var(--sp-10))"},children:[l.jsxs("aside",{className:"shrink-0 overflow-auto",style:{width:220,borderRight:"var(--hairline) solid var(--border)",background:"var(--bg-raised)",padding:"var(--sp-3) 0"},children:[l.jsx(nb,{style:{display:"block",padding:"var(--sp-1) var(--sp-4) var(--sp-2)"},children:"Agent"}),G.map(je=>l.jsxs("div",{children:[je.divider&&l.jsx("div",{"aria-hidden":!0,style:{margin:"var(--sp-2) var(--sp-3_5)",borderTop:"var(--hairline) solid var(--border)"}}),l.jsx(qZ,{label:je.label,active:we===je.anchor,danger:je.danger??!1,dirty:Me.has(je.anchor),onClick:()=>N(je.anchor)})]},je.key))]}),l.jsxs("div",{className:"flex-1 min-w-0 overflow-auto",style:{background:"var(--bg)"},children:[l.jsxs("div",{style:{padding:"var(--sp-3_5) var(--sp-5)",borderBottom:"var(--hairline) solid var(--border-faint)",background:"var(--bg-raised)"},children:[l.jsxs(v9,{style:{marginBottom:"var(--sp-2)"},children:[l.jsx(b9,{onClick:()=>n("/team"),children:"Agents"}),l.jsx(x9,{}),l.jsx(w9,{mono:!0,children:Ie.name??hr})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"inline-flex items-center justify-center",style:{width:36,height:36,borderRadius:"var(--radius-panel)",background:"var(--bg-active)",border:"var(--hairline) solid var(--border-strong)"},children:l.jsx(Dc,{width:18,height:20,style:{color:"var(--accent)"}})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-baseline gap-2",children:[l.jsx("span",{className:"text-title",title:`agt_${hr}`,children:Ie.displayName}),l.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:["@",Ie.name??hr]})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-caption",style:{color:"var(--fg-4)"},children:[l.jsx(Er,{tone:Ie.type==="autonomous_agent"?"accent":"neutral",children:Ie.type}),Ie.visibility&&l.jsx(Er,{tone:Ie.visibility==="organization"?"accent":"outline",children:Ie.visibility}),(tt==null?void 0:tt.offlineSince)&&l.jsxs("span",{className:"mono",children:["offline since ",oc(tt.offlineSince)]})]})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l.jsx(mc,{state:Pe}),l.jsxs(ye,{variant:"ghost",size:"xs",onClick:()=>n(`/?a=${Ie.uuid}`),children:[l.jsx(_v,{className:"h-3 w-3"})," Open chat"]}),!St&&Ie.status==="active"&&l.jsxs(ye,{variant:"outline",size:"xs",onClick:()=>{B.reset(),B.mutate()},disabled:B.isPending,children:[l.jsx(EE,{className:"h-3 w-3"}),B.isPending?"Testing…":"Test"]})]})]}),l.jsxs("div",{className:"grid gap-1.5 mt-3",style:{gridTemplateColumns:"repeat(4, 1fr)"},children:[l.jsx(yf,{label:"sessions",value:Ve.sessions}),l.jsx(yf,{label:"active",value:Ve.active,accent:typeof Ve.active=="number"&&Ve.active>0?"var(--accent)":void 0}),l.jsx(yf,{label:"runtime",value:Ve.runtime}),l.jsx(yf,{label:"model",value:Ve.model})]})]}),l.jsx("div",{ref:q,"aria-hidden":!0,style:{height:0}}),!St&&l.jsx(j9,{runtimeLabel:Ut,computerLabel:tr,visible:ae}),l.jsxs("div",{className:"mx-auto",style:{padding:"var(--sp-3_5) var(--sp-5) var(--sp-7)",maxWidth:960,display:"flex",flexDirection:"column",gap:20},children:[(B.data||B.error)&&l.jsx(YZ,{result:B.data??{status:"error",message:"Failed to reach server"},onDismiss:()=>B.reset()}),l.jsx(Fu,{anchorId:Yn.overview,title:"Profile",right:l.jsxs(ye,{variant:"outline",size:"xs",onClick:()=>n(`/settings/integrations?agent=${Ie.uuid}`),title:"Manage platform bindings in Integrations",children:[l.jsx(jy,{className:"h-3 w-3"}),"Manage bindings"]}),children:l.jsx(L9,{agent:Ie,onSave:async je=>{await R.mutateAsync(je)}})}),!St&&l.jsxs(l.Fragment,{children:[l.jsxs(Fu,{anchorId:Yn.setup,title:"Setup",caption:((Da=o.data)==null?void 0:Da.version)!=null?l.jsxs("span",{className:"mono",children:["config v",o.data.version,h.summary.anyDirty&&l.jsxs(l.Fragment,{children:[" · ",l.jsx("span",{style:{color:"var(--state-blocked)"},children:"draft"})]})]}):null,children:[o.isLoading&&l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading configuration…"}),o.error&&l.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load configuration: ",String(o.error)]}),o.data&&l.jsx(MZ,{runtimeProvider:qt,computerLabel:tr,canBindComputer:V&&Ie.status==="active",bindComputerPending:ne.isPending,onBindComputer:()=>Y(!0),onRebind:Ie.clientId?()=>W(!0):void 0,modelSlot:l.jsx(Q9,{value:h.draft.model,baseline:((Sa=o.data)==null?void 0:Sa.payload.model)??"",onChange:h.setModel,onRevert:h.revertModel,disabled:Ie.status!=="active",provider:qt})})]}),l.jsx(Fu,{anchorId:Yn.prompt,title:"Prompt",children:o.data?l.jsx(SZ,{value:h.draft.promptAppend,baseline:((Zt=o.data)==null?void 0:Zt.payload.prompt.append)??"",onChange:h.setPromptAppend,onRevert:h.revertPrompt,disabled:Ie.status!=="active"}):null}),l.jsx(Fu,{anchorId:Yn.tools,title:"Tools",caption:"MCP servers available to this agent",children:o.data?l.jsx(B9,{items:h.draft.mcp,otherNames:oe,onAdd:h.addMcp,onUpdate:h.updateMcp,onDelete:h.deleteMcp,onUndoDelete:h.undoDeleteMcp,disabled:Ie.status!=="active"}):null}),l.jsx(Fu,{anchorId:Yn.advanced,title:"Advanced",caption:"Environment variables and git repositories the runtime clones into each session.",children:o.data&&l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{id:rc("env"),children:l.jsx(R9,{items:h.draft.env,otherKeys:ge,onAdd:h.addEnv,onUpdate:h.updateEnv,onDelete:h.deleteEnv,onUndoDelete:h.undoDeleteEnv,disabled:Ie.status!=="active"})}),l.jsx("div",{id:rc("git"),children:l.jsx(z9,{items:h.draft.git,otherPaths:$e,onAdd:h.addGit,onUpdate:h.updateGit,onDelete:h.deleteGit,onUndoDelete:h.undoDeleteGit,disabled:Ie.status!=="active"})}),D&&l.jsx("pre",{className:"whitespace-pre-wrap mono text-label",style:{padding:"var(--sp-2)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",color:"var(--fg-2)"},children:D}),h.summary.anyDirty&&l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)"},children:l.jsx("button",{type:"button",onClick:()=>F.mutate(),className:"underline bg-transparent border-0 cursor-pointer",style:{color:"var(--fg-3)"},disabled:F.isPending,children:F.isPending?"Computing dry-run…":"Preview server-side diff"})})]})})]}),l.jsx(OZ,{}),l.jsx(E9,{agent:Ie,suspendPending:M.isPending,reactivatePending:L.isPending,deletePending:O.isPending,onSuspend:()=>M.mutate(),onReactivate:()=>L.mutate(),onDelete:()=>O.mutate()})]}),!St&&l.jsx(RZ,{summary:h.summary,saveHint:pi,conflictMessage:x,errorMessage:p,saving:j.isPending,justSaved:S,onSave:()=>j.mutate(),onDiscard:()=>{h.summary.anyDirty&&Ae(!0)},onReloadRemote:C,onJumpTo:je=>N(rc(je))})]}),l.jsx(ZZ,{open:ke,onOpenChange:Ae,title:"Discard unsaved changes?",description:"Your edits to Prompt / Model / Tools / Advanced will be reverted to the last saved baseline.",confirmLabel:"Discard changes",destructive:!0,onConfirm:()=>{h.resetAll(),g(null),w(null),Ae(!1)}}),l.jsx(On,{open:I,onOpenChange:je=>{Y(je),je||(K(""),ve(null),ne.reset())},children:l.jsxs(Nn,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:"Bind computer"})}),l.jsxs("div",{className:"space-y-4",children:[l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Pick a computer you own to pin this agent to. The bind is one-shot — once set, moving the agent requires deleting and re-creating it on the target computer."}),Z.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading computers…"}):Z.error?l.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load computers: ",Z.error instanceof Error?Z.error.message:"Unknown"]}):l.jsx(GZ,{clients:Z.data??[],selected:z,onSelect:K}),ie&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:ie})]}),l.jsxs(fr,{children:[l.jsx(ye,{variant:"outline",onClick:()=>Y(!1),children:"Cancel"}),l.jsx(ye,{disabled:!z||ne.isPending,onClick:()=>{ve(null),ne.mutate(z)},children:ne.isPending?"Binding…":"Bind"})]})]})}),l.jsx(EZ,{open:J,onOpenChange:W,agent:Ie})]})}function qZ({label:e,active:t,danger:n,dirty:a,onClick:s}){return l.jsx("button",{type:"button",onClick:s,className:ze("block w-full text-left bg-transparent text-body transition-colors cursor-pointer","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",t?"":"hover:bg-accent"),style:{padding:"var(--sp-1_25) var(--sp-4) var(--sp-1_25) var(--sp-3_5)",border:"none",borderLeft:`var(--hairline-bold) solid ${t?"var(--accent)":"transparent"}`,background:t?"var(--bg-active)":"transparent",color:t?"var(--fg)":"var(--fg-3)",fontWeight:t?500:400},children:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"flex-1 truncate",children:e}),a&&l.jsx("span",{role:"img","aria-label":"unsaved changes",style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--state-blocked)",flexShrink:0}}),n&&!a&&l.jsx("span",{"aria-hidden":!0,style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--state-error)",flexShrink:0}})]})})}function ZZ(e){return l.jsx(On,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(Nn,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:e.title})}),l.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(ye,{type:"button",variant:e.destructive?"destructive":"default",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function GZ({clients:e,selected:t,onSelect:n}){const a=e.filter(s=>s.status==="connected");return a.length===0?l.jsxs("div",{className:"text-body",style:{background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",padding:"var(--sp-2_5) var(--sp-3)",color:"var(--fg-3)"},children:["No connected computers available. Run"," ",l.jsx("code",{className:"mono text-label",children:"first-tree-hub client connect <url>"})," on the computer that should run this agent, then reopen this dialog."]}):l.jsx("ul",{className:"max-h-64 overflow-y-auto",style:{border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",margin:0,padding:0,listStyle:"none"},children:a.map(s=>{const o=s.id===t,c=s.status==="online"||s.status==="active";return l.jsx("li",{style:{borderTop:"var(--hairline) solid var(--border-faint)"},children:l.jsxs("button",{type:"button",onClick:()=>n(s.id),className:ze("w-full text-left flex items-center gap-3"),style:{padding:"var(--sp-2) var(--sp-3)",background:o?"var(--accent-bg)":"transparent",border:"none",cursor:"pointer"},children:[l.jsx("span",{className:ze("inline-block h-2 w-2 rounded-full shrink-0"),style:{background:c?"var(--state-idle)":"var(--fg-4)"},"aria-hidden":!0}),l.jsxs("span",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"block text-body truncate font-medium",children:s.hostname??s.id}),l.jsxs("span",{className:"block mono truncate text-caption",style:{color:"var(--fg-4)"},children:[s.id,s.os?` · ${s.os}`:"",s.sdkVersion?` · SDK ${s.sdkVersion}`:""]})]}),l.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:s.status})]})},s.id)})})}const VZ={success:"Connected",timeout:"Timed out",offline:"Offline",stale:"Stale",error:"Error"},QZ={success:"var(--state-idle)",timeout:"var(--state-blocked)",offline:"var(--state-offline)",stale:"var(--state-blocked)",error:"var(--state-error)"},KZ={success:"accent",timeout:"warn",stale:"warn",error:"error",offline:"neutral"};function YZ({result:e,onDismiss:t}){const n=QZ[e.status],a=KZ[e.status],s=e.connection;return l.jsx("div",{style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderLeft:`var(--sp-0_75) solid ${n}`,borderRadius:"var(--radius-panel)",padding:"var(--sp-3) var(--sp-3_5)"},children:l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Er,{tone:a,children:VZ[e.status]}),e.responseTime!=null&&l.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:[(e.responseTime/1e3).toFixed(1),"s"]})]}),e.message&&l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:e.message}),s&&l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:6,marginTop:2},children:[l.jsx("div",{children:s.runtimeState&&l.jsxs("span",{className:"mono",children:["runtime: ",s.runtimeState]})}),s.client?l.jsxs("div",{children:["Computer: ",s.client.hostname??s.client.id,s.client.os&&` (${s.client.os})`,s.client.sdkVersion&&` · SDK ${s.client.sdkVersion}`]}):l.jsx("div",{children:"No computer bound"}),s.lastSeenAt&&l.jsxs("div",{children:["Last seen: ",new Date(s.lastSeenAt).toLocaleString()]})]}),e.responseContent&&l.jsx("p",{className:"mono whitespace-pre-wrap text-label",style:{background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",padding:8,maxHeight:160,overflow:"auto"},children:e.responseContent})]}),l.jsx(ye,{variant:"ghost",size:"sm",onClick:t,children:"Dismiss"})]})})}function XZ(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 WZ(){return this.eachAfter(XZ)}function JZ(e,t){let n=-1;for(const a of this)e.call(t,a,++n,this);return this}function eG(e,t){for(var n=this,a=[n],s,o,c=-1;n=a.pop();)if(e.call(t,n,++c,this),s=n.children)for(o=s.length-1;o>=0;--o)a.push(s[o]);return this}function tG(e,t){for(var n=this,a=[n],s=[],o,c,f,m=-1;n=a.pop();)if(s.push(n),o=n.children)for(c=0,f=o.length;c<f;++c)a.push(o[c]);for(;n=s.pop();)e.call(t,n,++m,this);return this}function nG(e,t){let n=-1;for(const a of this)if(e.call(t,a,++n,this))return a}function rG(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 aG(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function iG(e){for(var t=this,n=sG(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 sG(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 lG(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function oG(){return Array.from(this)}function uG(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function cG(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*dG(){var e=this,t,n=[e],a,s,o;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,a=e.children)for(s=0,o=a.length;s<o;++s)n.push(a[s]);while(n.length)}function sT(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=mG)):t===void 0&&(t=hG);for(var n=new ko(e),a,s=[n],o,c,f,m;a=s.pop();)if((c=t(a.data))&&(m=(c=Array.from(c)).length))for(a.children=c,f=m-1;f>=0;--f)s.push(o=c[f]=new ko(c[f])),o.parent=a,o.depth=a.depth+1;return n.eachBefore(lT)}function fG(){return sT(this).eachBefore(pG)}function hG(e){return e.children}function mG(e){return Array.isArray(e)?e[1]:null}function pG(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function lT(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function ko(e){this.data=e,this.depth=this.height=0,this.parent=null}ko.prototype=sT.prototype={constructor:ko,count:WZ,each:JZ,eachAfter:tG,eachBefore:eG,find:nG,sum:rG,sort:aG,path:iG,ancestors:lG,descendants:oG,leaves:uG,links:cG,copy:fG,[Symbol.iterator]:dG};function Ig(e){return e==null?null:gG(e)}function gG(e){if(typeof e!="function")throw new Error;return e}var yG={depth:-1},Uk={},Lg={};function vG(e){return e.id}function bG(e){return e.parentId}function xG(){var e=vG,t=bG,n;function a(s){var o=Array.from(s),c=e,f=t,m,h,p,g,x,w,S,k,j=new Map;if(n!=null){const C=o.map((M,L)=>wG(n(M,L,s))),N=C.map(Bk),R=new Set(C).add("");for(const M of N)R.has(M)||(R.add(M),C.push(M),N.push(Bk(M)),o.push(Lg));c=(M,L)=>C[L],f=(M,L)=>N[L]}for(p=0,m=o.length;p<m;++p)h=o[p],w=o[p]=new ko(h),(S=c(h,p,s))!=null&&(S+="")&&(k=w.id=S,j.set(k,j.has(k)?Uk:w)),(S=f(h,p,s))!=null&&(S+="")&&(w.parent=S);for(p=0;p<m;++p)if(w=o[p],S=w.parent){if(x=j.get(S),!x)throw new Error("missing: "+S);if(x===Uk)throw new Error("ambiguous: "+S);x.children?x.children.push(w):x.children=[w],w.parent=x}else{if(g)throw new Error("multiple roots");g=w}if(!g)throw new Error("no root");if(n!=null){for(;g.data===Lg&&g.children.length===1;)g=g.children[0],--m;for(let C=o.length-1;C>=0&&(w=o[C],w.data===Lg);--C)w.data=null}if(g.parent=yG,g.eachBefore(function(C){C.depth=C.parent.depth+1,--m}).eachBefore(lT),g.parent=null,m>0)throw new Error("cycle");return g}return a.id=function(s){return arguments.length?(e=Ig(s),a):e},a.parentId=function(s){return arguments.length?(t=Ig(s),a):t},a.path=function(s){return arguments.length?(n=Ig(s),a):n},a}function wG(e){e=`${e}`;let t=e.length;return Wy(e,t-1)&&!Wy(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function Bk(e){let t=e.length;if(t<2)return"";for(;--t>1&&!Wy(e,t););return e.slice(0,t)}function Wy(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if((n&1)===0)return!0}return!1}function SG(e,t){return e.parent===t.parent?1:2}function Pg(e){var t=e.children;return t?t[0]:e.t}function Ug(e){var t=e.children;return t?t[t.length-1]:e.t}function kG(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 jG(e){for(var t=0,n=0,a=e.children,s=a.length,o;--s>=0;)o=a[s],o.z+=t,o.m+=t,t+=o.s+(n+=o.c)}function EG(e,t,n){return e.a.parent===t.parent?e.a:n}function Df(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}Df.prototype=Object.create(ko.prototype);function CG(e){for(var t=new Df(e,0),n,a=[t],s,o,c,f;n=a.pop();)if(o=n._.children)for(n.children=new Array(f=o.length),c=f-1;c>=0;--c)a.push(s=n.children[c]=new Df(o[c],c)),s.parent=n;return(t.parent=new Df(null,0)).children=[t],t}function NG(){var e=SG,t=1,n=1,a=null;function s(h){var p=CG(h);if(p.eachAfter(o),p.parent.m=-p.z,p.eachBefore(c),a)h.eachBefore(m);else{var g=h,x=h,w=h;h.eachBefore(function(N){N.x<g.x&&(g=N),N.x>x.x&&(x=N),N.depth>w.depth&&(w=N)});var S=g===x?1:e(g,x)/2,k=S-g.x,j=t/(x.x+S+k),C=n/(w.depth||1);h.eachBefore(function(N){N.x=(N.x+k)*j,N.y=N.depth*C})}return h}function o(h){var p=h.children,g=h.parent.children,x=h.i?g[h.i-1]:null;if(p){jG(h);var w=(p[0].z+p[p.length-1].z)/2;x?(h.z=x.z+e(h._,x._),h.m=h.z-w):h.z=w}else x&&(h.z=x.z+e(h._,x._));h.parent.A=f(h,x,h.parent.A||g[0])}function c(h){h._.x=h.z+h.parent.m,h.m+=h.parent.m}function f(h,p,g){if(p){for(var x=h,w=h,S=p,k=x.parent.children[0],j=x.m,C=w.m,N=S.m,R=k.m,M;S=Ug(S),x=Pg(x),S&&x;)k=Pg(k),w=Ug(w),w.a=h,M=S.z+N-x.z-j+e(S._,x._),M>0&&(kG(EG(S,h,g),h,M),j+=M,C+=M),N+=S.m,j+=x.m,R+=k.m,C+=w.m;S&&!Ug(w)&&(w.t=S,w.m+=N-C),x&&!Pg(k)&&(k.t=x,k.m+=j-R,g=h)}return g}function m(h){h.x*=t,h.y=h.depth*n}return s.separation=function(h){return arguments.length?(e=h,s):e},s.size=function(h){return arguments.length?(a=!1,t=+h[0],n=+h[1],s):a?null:[t,n]},s.nodeSize=function(h){return arguments.length?(a=!0,t=+h[0],n=+h[1],s):a?[t,n]:null},s}function _G(e,t){const n=`?window=${encodeURIComponent(t)}`;return Ee.get(by(e,`/context-tree/snapshot${n}`))}function eh({active:e,count:t,warn:n,className:a,children:s,style:o,...c}){return l.jsxs("button",{type:"button",className:ze("mono inline-flex items-center gap-1 text-caption leading-[1.6]",a),style:{padding:"var(--sp-0_5) var(--sp-1_75)",borderRadius:3,border:`var(--hairline) solid ${e?"var(--border-strong)":"var(--border)"}`,background:e?"var(--bg-active)":"transparent",color:e?"var(--fg)":"var(--fg-3)",cursor:"pointer",...o},...c,children:[s,t!==void 0&&l.jsx("span",{className:"mono",style:{color:n&&typeof t=="number"&&t>0?"var(--state-error)":"var(--fg-4)"},children:t})]})}function al({title:e,subtitle:t,right:n,className:a,style:s,...o}){return l.jsxs("div",{className:ze("flex items-baseline gap-3 shrink-0",a),style:{padding:"var(--sp-4) var(--sp-5) var(--sp-3)",...s},...o,children:[l.jsx("h1",{className:"m-0 text-subtitle",style:{color:"var(--fg)"},children:e}),t&&l.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:t}),l.jsx("div",{style:{flex:1}}),n]})}const oT=[{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 TG({previewSnapshot:e}={}){const{organizationId:t}=vt(),[n,a]=b.useState("7d"),[s,o]=b.useState(null),[c,f]=b.useState(null),m=e!==void 0,h=Ke({queryKey:["context-tree-snapshot",t,n,m],queryFn:()=>{if(!t)throw new Error("No organization selected");return _G(t,n)},enabled:!m&&!!t}),p=e??h.data,g=b.useMemo(()=>p?p.updates.find(S=>S.id===s)??p.updates[0]??null:null,[s,p]),x=b.useMemo(()=>p&&g!=null&&g.nodeId?p.nodes.find(S=>S.id===g.nodeId)??null:null,[g,p]),w=c??(g==null?void 0:g.nodeId)??(x==null?void 0:x.id)??null;return b.useEffect(()=>{var S;p&&(s&&p.updates.some(k=>k.id===s)||o(((S=p.updates[0])==null?void 0:S.id)??null))},[s,p]),l.jsxs(l.Fragment,{children:[l.jsx(al,{title:"Context",subtitle:"Team context available to agents, and how it is changing"}),l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[!m&&h.isLoading?l.jsx(UG,{}):null,!m&&h.error?l.jsx(BG,{message:h.error instanceof Error?h.error.message:"Failed to load"}):null,p&&(m||!h.isLoading)?p.snapshotStatus==="unavailable"?l.jsx(cT,{snapshot:p}):l.jsxs(l.Fragment,{children:[l.jsx(AG,{snapshot:p}),l.jsx(RG,{snapshot:p,window:n,onWindowChange:a}),l.jsx(OG,{snapshot:p,selectedUpdate:g,selectedUpdateNode:x,selectedOverviewNodeId:w,onSelectUpdate:S=>{o(S.id),f(S.nodeId)},onSelectOverviewNode:f})]}):null]})]})}function AG({snapshot:e}){const t=e.contextStatus.severity==="ok"?l.jsx(Jz,{size:18}):l.jsx(To,{size:18}),n=e.contextStatus.label,a=eV(e);return l.jsx(En,{children:l.jsx(Jn,{style:{padding:"var(--sp-2_5) var(--sp-3_5)"},children:l.jsxs("div",{className:"flex items-start",style:{gap:"var(--sp-2)",minWidth:0},children:[l.jsx("span",{style:{color:JG(e.contextStatus.severity),flex:"0 0 auto",marginTop:"var(--sp-0_5)"},children:t}),l.jsxs("div",{style:{minWidth:0,flex:1},children:[l.jsxs("div",{className:"flex flex-wrap items-baseline",style:{gap:"var(--sp-2)"},children:[l.jsx("div",{className:"text-subtitle font-semibold",style:{color:"var(--fg)"},children:n}),a?l.jsx("div",{className:"text-label font-medium",style:{color:"var(--fg-3)"},children:a}):null]}),l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-0_5)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.contextStatus.detail??"Agents have a synced team context snapshot available."})]})]})})})}function RG({snapshot:e,window:t,onWindowChange:n}){const a=WG(t);return l.jsxs("div",{className:"flex flex-wrap items-center justify-between",style:{gap:"var(--sp-3)"},children:[l.jsxs("fieldset",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-1)"},children:[l.jsx("legend",{className:"sr-only",children:"Context update window"}),oT.map(s=>l.jsx(eh,{active:s.value===t,onClick:()=>n(s.value),children:s.label},s.value))]}),l.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[l.jsx(Sf,{value:e.summary.changedNodeCount,label:`updates in the ${a}`}),l.jsx(Sf,{value:e.summary.addedCount,label:"added",tone:"added"}),l.jsx(Sf,{value:e.summary.editedCount,label:"edited",tone:"edited"}),l.jsx(Sf,{value:e.summary.removedCount,label:"removed",tone:"removed"})]})]})}function OG({snapshot:e,selectedUpdate:t,selectedUpdateNode:n,selectedOverviewNodeId:a,onSelectUpdate:s,onSelectOverviewNode:o}){const c=f=>{o(f);const m=e.updates.find(h=>h.nodeId===f);m&&s(m)};return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-3)"},children:[l.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-[minmax(26rem,1fr)_minmax(0,1fr)]",style:{gap:"var(--sp-3)",alignItems:"stretch"},children:[l.jsxs(En,{className:"flex h-full flex-col",style:{maxHeight:"min(52vh, 30rem)"},children:[l.jsx(ua,{children:l.jsx(ca,{children:"Context Updates"})}),l.jsx(Jn,{className:"flex-1",style:{padding:0,overflow:"auto"},children:e.updates.length===0?l.jsx("div",{style:{padding:"var(--sp-3) var(--sp-3_5)"},children:l.jsx(dT,{})}):e.updates.map((f,m)=>l.jsx(zG,{update:f,selected:f.id===(t==null?void 0:t.id),isLast:m===e.updates.length-1,onClick:()=>s(f)},f.id))})]}),l.jsx(MG,{update:t,node:n,snapshot:e},(t==null?void 0:t.id)??"empty")]}),l.jsx(DG,{snapshot:e,selectedNodeId:a,onSelectNode:c})]})}function zG({update:e,selected:t,isLast:n,onClick:a}){return l.jsx("button",{type:"button",onClick:a,className:"block w-full text-left transition-colors",style:{background:t?"var(--bg-sunken)":"transparent",borderBottom:n?"none":"var(--hairline) solid var(--border-faint)",padding:"var(--sp-2) var(--sp-3_5)"},children:l.jsx("div",{className:"flex items-start",style:{gap:"var(--sp-2)",minWidth:0},children:l.jsxs("div",{style:{minWidth:0,flex:1},children:[l.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[l.jsx(uT,{type:e.changeType}),l.jsx("span",{className:"text-body font-medium",style:{color:"var(--fg)",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden"},children:aV(e)})]}),l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["In ",hT(e.path)," · ",cV(e.owners),e.relatedNodeIds.length>0?` · ${dV(e.relatedNodeIds.length)}`:""]})]})})})}function MG({update:e,node:t,snapshot:n}){const[a,s]=b.useState(!1),o=t==null?void 0:t.relatedNodeIds.map(g=>n.nodes.find(x=>x.id===g)).filter(g=>!!g),c=(t==null?void 0:t.sourcePath)??(e==null?void 0:e.path)??null,f=e!=null&&e.sourceCommit?e.sourceCommit.slice(0,7):"no commit",m=e?uV(e.owners):"No owner",h=o&&o.length>0?o.map(g=>g.title||g.path||"root"):[],p=e?fV(e.path)||hT(e.path):"root";return l.jsxs(En,{className:"flex h-full flex-col",style:{maxHeight:"min(52vh, 30rem)"},children:[l.jsxs(ua,{children:[l.jsx(ca,{children:"Selected Change"}),e?l.jsx(uT,{type:e.changeType}):null]}),l.jsx(Jn,{className:"flex-1",style:{overflow:"auto"},children:e?l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-title font-semibold",style:{color:"var(--fg)"},children:e.title}),l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[iV(e)," · ",nV(e.changeType)," · ",p]}),l.jsx("div",{className:"text-label font-mono",style:{color:"var(--fg-4)",marginTop:"var(--sp-0_5)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.path})]}),l.jsx(LG,{value:sV(e),impact:rV(e)}),l.jsx(PG,{commit:f,linkedContextItems:h,owner:m,path:c??e.path,preview:(t==null?void 0:t.preview)??null,sourceExpanded:a,onTogglePreview:()=>{s(g=>!g)}})]}):l.jsx(dT,{})})]})}function DG({snapshot:e,selectedNodeId:t,onSelectNode:n}){const[a,s]=b.useState(()=>new Set),o=b.useMemo(()=>XG(e.nodes),[e.nodes]),c=b.useMemo(()=>qG(e.nodes,t,o,a),[t,e.nodes,o,a]),f=b.useRef(null),m=b.useCallback(j=>{if(!j)return;const C=f.current;if(!C)return;const N=j.getBoundingClientRect(),R=C.getBoundingClientRect();if(N.top>=R.top&&N.bottom<=R.bottom)return;const M=N.top-R.top-(R.height-N.height)/2;C.scrollBy({top:M})},[]),h=b.useCallback(j=>{s(C=>{const N=new Set(C);return N.has(j)?N.delete(j):N.add(j),N})},[]),p=Math.max(760,...c.map(j=>j.x+280)),g=Math.max(280,...c.map(j=>j.y+48)),x=g+24,w=560,S=x>w,k=QG(e.nodes,t);return l.jsxs(En,{children:[l.jsx(ua,{children:l.jsxs("div",{children:[l.jsxs(ca,{children:[l.jsx(cM,{size:17}),"Where Context Changed"]}),l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"Numbers = updated areas under each branch."})]})}),l.jsx(Jn,{children:c.length===0?l.jsx(cT,{snapshot:e}):l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-3)"},children:[l.jsxs("div",{className:"flex flex-wrap items-center",style:{columnGap:"var(--sp-4)",rowGap:"var(--sp-1_5)"},children:[l.jsxs("div",{className:"flex flex-wrap items-center text-label",style:{color:"var(--fg-3)",gap:"var(--sp-1_5)"},children:[l.jsx("span",{className:"font-semibold",style:{color:"var(--fg-2)"},children:"Selected"}),l.jsx("span",{children:k??"No update selected"})]}),l.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[l.jsx($u,{color:"var(--accent)",label:"Selected path"}),l.jsx($u,{color:"var(--ok)",label:"Added"}),l.jsx($u,{color:"var(--warn)",label:"Edited"}),l.jsx($u,{color:"var(--danger)",label:"Removed"}),l.jsx($u,{color:"var(--bg-raised)",label:"Quiet"})]})]}),l.jsx("div",{ref:f,style:{overflow:S?"auto":"hidden",maxHeight:S?`${w}px`:void 0,minHeight:`${Math.min(x,w)}px`},children:l.jsxs("svg",{viewBox:`0 0 ${p} ${g}`,role:"img","aria-label":"Context Tree overview",preserveAspectRatio:"xMinYMin meet",style:{display:"block",width:"100%",height:`${x}px`},children:[c.map(j=>!j.parent||j.isSummary&&j.isExpanded?null:l.jsx("line",{x1:j.parent.x,y1:j.parent.y,x2:j.x,y2:j.y,stroke:j.selectedPath&&j.parent.selectedPath?"var(--accent)":"var(--border)",strokeOpacity:j.muted?.34:j.selectedPath?.72:.56,strokeWidth:j.selectedPath&&j.parent.selectedPath?1.6:1},`edge:${j.id}`)),c.map(j=>{const C=j.isSummary||j.sourceNodeId!==null,N=()=>{j.isSummary&&j.parentId?h(j.parentId):j.sourceNodeId&&n(j.sourceNodeId)};return l.jsx("foreignObject",{x:j.x-10,y:j.y-15,width:p-j.x-8,height:30,children:l.jsxs("button",{ref:j.selected?m:void 0,type:"button",disabled:!C,"aria-expanded":j.isSummary?j.isExpanded:void 0,onClick:N,className:"flex w-full items-center text-left text-label transition-colors",style:{background:"transparent",color:j.muted?"var(--fg-3)":"var(--fg)",cursor:C?"pointer":"default",gap:"var(--sp-2)",opacity:j.muted?.66:1,padding:"0 var(--sp-1)"},onMouseEnter:R=>{C&&(R.currentTarget.style.background="var(--bg-sunken)")},onMouseLeave:R=>{R.currentTarget.style.background="transparent"},children:[j.isSummary?l.jsx(wE,{size:12,style:{color:"var(--fg-4)",flex:"0 0 auto",transform:j.isExpanded?"rotate(90deg)":void 0,transition:"transform 120ms"}}):l.jsx("span",{"aria-hidden":"true",style:{width:j.selected?"var(--sp-4)":"var(--sp-3)",height:j.selected?"var(--sp-4)":"var(--sp-3)",borderRadius:"50%",background:hV(j),border:`${j.selected?"var(--hairline-bold)":"var(--hairline)"} solid ${j.selected?"var(--accent)":mV(j)}`,flex:"0 0 auto"}}),l.jsx("span",{className:j.selectedPath?"font-semibold":"font-medium",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:j.title}),j.updateCount>0&&!j.isSummary?l.jsx("span",{className:"font-semibold",style:{background:"var(--accent-bg)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-chip)",color:"var(--fg-2)",flex:"0 0 auto",padding:"0 var(--sp-1)"},children:j.updateCount}):null]})},j.id)})]})})]})})]})}function $u({color:e,label:t}){return l.jsxs("span",{className:"inline-flex items-center text-label",style:{color:"var(--fg-3)",gap:"var(--sp-1)"},children:[l.jsx("span",{"aria-hidden":"true",style:{background:e,border:"var(--hairline) solid var(--border-strong)",borderRadius:"50%",height:"var(--sp-2)",width:"var(--sp-2)"}}),l.jsx("span",{children:t})]})}function Sf({value:e,label:t,tone:n}){return l.jsxs("span",{className:"inline-flex items-baseline text-label",style:{color:"var(--fg-3)",gap:"var(--sp-1)"},children:[l.jsx("span",{className:"font-semibold",style:{color:n?Dh(n):"var(--fg)"},children:e}),l.jsx("span",{children:t})]})}function IG({label:e,tone:t,strong:n}){return l.jsx("span",{className:`text-label ${n?"font-semibold":"font-medium"}`,style:{color:t?Dh(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 uT({type:e}){return l.jsx(IG,{label:tV(e),tone:e})}function LG({value:e,impact:t}){return l.jsxs("div",{style:{color:"var(--fg-2)"},children:[l.jsx("div",{className:"text-label font-semibold",style:{color:"var(--fg)",marginBottom:"var(--sp-1)"},children:"Change summary"}),l.jsx("div",{className:"text-body",children:e}),l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:["Impact: ",t]})]})}function PG({path:e,commit:t,linkedContextItems:n,owner:a,preview:s,sourceExpanded:o,onTogglePreview:c}){const f=[{label:"Owner",value:a},...n.length>0?[{label:"Linked",value:n.join(", ")}]:[],{label:"Source",value:e,mono:!0},{label:"Commit",value:t,mono:!0}];return l.jsxs("div",{children:[l.jsx("div",{className:"text-label font-semibold",style:{color:"var(--fg)",marginBottom:"var(--sp-1)"},children:"Reference"}),l.jsx("div",{className:"flex flex-wrap text-label",style:{color:"var(--fg-2)",gap:"var(--sp-2)"},children:f.map((m,h)=>l.jsxs("span",{className:"inline-flex items-baseline",style:{gap:"var(--sp-1)",minWidth:0},children:[h>0?l.jsx("span",{"aria-hidden":"true",style:{color:"var(--fg-4)"},children:"·"}):null,l.jsx("span",{style:{color:"var(--fg-3)"},children:m.label}),l.jsx("span",{className:m.mono?"font-mono":"font-medium",style:{color:"var(--fg-2)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.value})]},m.label))}),l.jsxs("div",{className:"flex flex-wrap",style:{gap:"var(--sp-1)",marginTop:"var(--sp-2_5)"},children:[l.jsx(ye,{variant:"outline",size:"xs",onClick:c,children:o?"Hide source":"Preview source"}),l.jsxs(ye,{variant:"ghost",size:"xs",onClick:()=>void navigator.clipboard.writeText(e),children:[l.jsx(Cv,{size:14}),"Copy path"]})]}),o?l.jsx("div",{style:{marginTop:"var(--sp-3)"},children:s?l.jsx(Mh,{children:s}):l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No source preview available."})}):null]})}function UG(){return l.jsx(En,{children:l.jsx(Jn,{children:l.jsxs("div",{className:"flex items-center text-body",style:{color:"var(--fg-2)",gap:"var(--sp-2)"},children:[l.jsx(_M,{size:17}),"Loading team context..."]})})})}function BG({message:e}){return l.jsx(En,{children:l.jsx(Jn,{children:l.jsxs("div",{className:"flex items-center text-body",style:{color:"var(--danger)",gap:"var(--sp-2)"},children:[l.jsx(To,{size:17}),e]})})})}function cT({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?FG(e.repo):null;return l.jsx(En,{children:l.jsx(Jn,{children:l.jsxs("div",{className:"flex items-start text-body",style:{color:"var(--fg-2)",gap:"var(--sp-2)"},children:[l.jsx(To,{size:18,style:{color:"var(--warn)"}}),l.jsxs("div",{children:[l.jsx("div",{className:"font-semibold",style:{color:"var(--fg)"},children:t}),l.jsx("div",{style:{marginTop:"var(--sp-1)"},children:n}),a?l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:a}):null,e.repo||e.branch?l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:[s?`Repo: ${s}`:null,e.repo&&e.branch?" · ":null,e.branch?`Branch: ${e.branch}`:null]}):null]})]})})})}function FG(e){return e.replace(/(https?:\/\/)[^/@\s]+@/g,"$1[redacted]@")}function dT(){return l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No context updates in this time window."})}const $G=1,HG=3;function qG(e,t,n,a){const s=ZG(e,t,n,a);if(s.length===0)return[];const o=xG().id(p=>p.id).parentId(p=>p.parentId)(s).sort((p,g)=>p.data.isSummary!==g.data.isSummary?p.data.isSummary?-1:1:p.data.path.localeCompare(g.data.path)),f=NG().nodeSize([30,170])(o).descendants(),m=Math.min(...f.map(p=>p.x));return f.map(p=>({...p.data,x:28+p.y,y:28+p.x-m,parent:null})).map((p,g,x)=>({...p,parent:p.parentId?x.find(w=>w.id===p.parentId)??null:null}))}function ZG(e,t,n,a){const s=new Map(e.map(k=>[k.id,k])),o=e.filter(k=>!k.parentId||s.has(k.parentId)).sort((k,j)=>k.path.localeCompare(j.path));if(o.length===0)return[];const c=GG(o),f=VG(t,s),m=new Set,h=new Map;for(const k of o){const j=fT(k,s,h),C=n.get(k.id)??0;(j<=$G||f.has(k.id)||C>0&&j<=HG)&&KG(k.id,s,m)}let p=!0;for(;p;){p=!1;for(const k of[...m]){const j=(c.get(k)??[]).filter(C=>!m.has(C.id));if(j.length===1){const C=j[0];C&&(m.add(C.id),p=!0)}}}const g=new Set(m);for(const k of a)if(g.has(k))for(const j of c.get(k)??[])g.add(j.id);const x=f.size>0,w=o.filter(k=>g.has(k.id)).map(k=>{const j=n.get(k.id)??0,C=f.has(k.id);return{id:k.id,parentId:k.parentId&&g.has(k.parentId)?k.parentId:null,sourceNodeId:k.id,title:k.title,path:k.path,changeType:k.changeType,updateCount:j,isSummary:!1,isExpanded:!1,selected:t===k.id,selectedPath:C,muted:x&&!C&&j===0}}),S=[];for(const k of o){if(!g.has(k.id))continue;const j=(c.get(k.id)??[]).filter(R=>!m.has(R.id));if(j.length===0)continue;const C=a.has(k.id),N=j.filter(R=>(n.get(R.id)??0)>0).length;S.push({id:`summary:${k.id}`,parentId:k.id,sourceNodeId:null,title:C?"Show less":YG(j.length,N),path:`${k.path}/~summary`,changeType:null,updateCount:N,isSummary:!0,isExpanded:C,selected:!1,selectedPath:f.has(k.id),muted:x&&!f.has(k.id)})}return[...w,...S]}function GG(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 VG(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 QG(e,t){const n=new Map(e.map(o=>[o.id,o])),a=[];let s=t?n.get(t):void 0;for(;s;)a.unshift(s.title),s=s.parentId?n.get(s.parentId):void 0;return a.length>0?a.join(" / "):null}function KG(e,t,n){let a=t.get(e);for(;a;)n.add(a.id),a=a.parentId?t.get(a.parentId):void 0}function fT(e,t,n){const a=n.get(e.id);if(a!==void 0)return a;const s=e.parentId?t.get(e.parentId):void 0,o=s?fT(s,t,n)+1:0;return n.set(e.id,o),o}function YG(e,t){return t>0?`Show ${e} more · ${t} changed`:`Show ${e} more`}function XG(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 WG(e){var t;return((t=oT.find(n=>n.value===e))==null?void 0:t.summary)??"last 7 days"}function JG(e){return e==="ok"?"var(--ok)":e==="warning"?"var(--warn)":"var(--danger)"}function eV(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 tV(e){return e==="added"?"New":e==="removed"?"Removed":"Updated"}function nV(e){return e==="added"?"New knowledge":e==="removed"?"Removed knowledge":"Updated knowledge"}function rV(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 aV(e){const t=e.changedBy??"Someone",n=e.changeType==="added"?"added":e.changeType==="removed"?"removed":"updated";return`${t} ${n} ${e.title}`}function iV(e){const t=e.changedBy??"Someone";return`${e.changeType==="added"?"Added":e.changeType==="removed"?"Removed":"Updated"} by ${t}`}function sV(e){const t=e.changedBy??"Someone",n=e.changeType==="added"?"added":e.changeType==="removed"?"removed":"updated",a=oV(e);return a?`${t} ${n} ${e.title}: ${a}`:`${t} ${n} ${e.title}.`}function lV(e){return e.summary.replace(/^updated:\s*/i,"")}function oV(e){const t=lV(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 uV(e){return e.length===0?"No owner":e.length===1?e[0]??"No owner":e.join(", ")}function cV(e){return e.length===0?"Owner not set":e.length===1?`Owner: ${e[0]??"Unknown"}`:`Owners: ${e.join(", ")}`}function dV(e){return`${e} linked context${e===1?"":"s"}`}function fV(e){const t=e.split("/").filter(Boolean);return t.length<=1?null:t.slice(0,-1).map(mT).join(" / ")}function hT(e){return e.split("/").filter(Boolean).map(mT).join(" / ")||"root"}function mT(e){return e.replace(/[-_]+/g," ").replace(/\b\w/g,t=>t.toUpperCase()).trim()}function Dh(e){return e==="added"?"var(--ok)":e==="edited"?"var(--warn)":"var(--danger)"}function hV(e){return e.isSummary?"var(--bg-sunken)":e.selected?"var(--accent)":e.changeType?Dh(e.changeType):e.updateCount>0?"var(--accent-bg)":"var(--bg-raised)"}function mV(e){return e.changeType?Dh(e.changeType):"var(--border-strong)"}const zo=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("rounded-[var(--radius-panel)] border bg-card text-card-foreground shadow-sm",e),...t}));zo.displayName="Card";const Mo=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("flex flex-col space-y-1.5 p-6",e),...t}));Mo.displayName="CardHeader";const Bc=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("text-subtitle leading-none",e),...t}));Bc.displayName="CardTitle";const pT=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("text-body text-muted-foreground",e),...t}));pT.displayName="CardDescription";const Do=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("p-6 pt-0",e),...t}));Do.displayName="CardContent";const pV=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("flex items-center p-6 pt-0",e),...t}));pV.displayName="CardFooter";function gV(){const{token:e}=nE(),t=An(),{isAuthenticated:n,adoptTokens:a}=vt(),[s,o]=b.useState(null),[c,f]=b.useState(null),[m,h]=b.useState(!1),[p,g]=b.useState(null);if(b.useEffect(()=>{e&&(async()=>{try{const j=await fetch(`/api/v1/invitations/${encodeURIComponent(e)}/preview`);if(!j.ok){f("This invitation is no longer valid");return}o(await j.json())}catch{f("Network error while loading invitation")}})()},[e]),b.useEffect(()=>{n&&(async()=>{try{const j=await Ee.get("/me/organizations"),C=await Ee.get("/me"),N=j.find(R=>R.id===C.member.organizationId);g((N==null?void 0:N.displayName)??null)}catch{}})()},[n]),!e)return l.jsx(Fk,{message:"Bad invitation URL"});if(c)return l.jsx(Fk,{message:"This invitation is no longer valid"});if(!s)return l.jsx(yV,{});const x=async()=>{h(!0);try{const j=await Ee.post("/me/organizations/join",{token:e});await a(j.tokens),mE("invite"),t("/",{replace:!0})}catch(j){f(j instanceof Error?j.message:"Failed to join team")}finally{h(!1)}},w=`/api/v1/auth/github/start?next=${encodeURIComponent(`/invite/${e}`)}`,S=n&&p&&p!==s.organizationDisplayName,k=vV(s.expiresAt);return l.jsx(Sb,{children:l.jsxs(zo,{className:"w-full max-w-sm",children:[l.jsx(Mo,{className:"text-center",children:l.jsxs(Bc,{className:"text-title",children:["You're invited to join",l.jsx("br",{}),s.organizationDisplayName]})}),l.jsxs(Do,{className:"space-y-4",children:[S&&l.jsxs("div",{className:"flex items-start gap-2 rounded-md p-3 text-label",style:{background:"var(--bg-sunken)",color:"var(--fg-2)"},children:[l.jsx(To,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),l.jsxs("span",{children:["You'll switch from ",l.jsx("span",{className:"font-medium",children:p})," to"," ",l.jsx("span",{className:"font-medium",children:s.organizationDisplayName}),"."]})]}),n?l.jsx(ye,{className:"w-full",disabled:m,onClick:x,children:m?"Joining…":`Join ${s.organizationDisplayName}`}):l.jsx(ye,{asChild:!0,className:"w-full",children:l.jsxs("a",{href:w,children:[l.jsx(kE,{className:"h-4 w-4"}),"Continue with GitHub to join"]})}),k&&l.jsx("p",{className:"text-center text-label",style:{color:k.urgent?"var(--destructive)":"var(--fg-3)"},children:k.text}),l.jsxs("p",{className:"text-center text-label text-muted-foreground",children:["By continuing you agree to our"," ",l.jsx("a",{href:"/terms",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Terms"})," ","·"," ",l.jsx("a",{href:"/privacy",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Privacy"})]})]})]})})}function Sb({children:e}){return l.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[l.jsx("header",{className:"px-4 py-3",children:l.jsxs(Rc,{to:"/",className:"inline-flex items-center gap-1.5 rounded-[var(--radius-input)] px-2 py-1 text-body text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:[l.jsx(jv,{className:"h-3.5 w-3.5"}),"Back to home"]})}),l.jsx("div",{className:"flex flex-1 items-center justify-center px-4 pb-16",children:e})]})}function yV(){return l.jsx(Sb,{children:l.jsxs(zo,{className:"w-full max-w-sm",children:[l.jsxs(Mo,{className:"text-center",children:[l.jsx("div",{className:"mx-auto h-5 w-2/3 rounded-md",style:{background:"var(--bg-sunken)"}}),l.jsx("div",{className:"mx-auto mt-2 h-5 w-1/2 rounded-md",style:{background:"var(--bg-sunken)"}})]}),l.jsxs(Do,{className:"space-y-4",children:[l.jsx("div",{className:"h-9 w-full rounded-md",style:{background:"var(--bg-sunken)"}}),l.jsx("div",{className:"mx-auto h-3 w-1/3 rounded-md",style:{background:"var(--bg-sunken)"}})]})]})})}function Fk({message:e}){return l.jsx(Sb,{children:l.jsxs(zo,{className:"w-full max-w-sm",children:[l.jsxs(Mo,{className:"text-center",children:[l.jsx("div",{className:"mb-2 flex justify-center text-fg-3",children:l.jsx(To,{className:"h-6 w-6"})}),l.jsx(Bc,{className:"text-title",children:e})]}),l.jsxs(Do,{className:"space-y-4",children:[l.jsx("p",{className:"text-center text-body text-muted-foreground",children:"It may have expired or been revoked. Ask the team admin for a fresh link."}),l.jsx(ye,{asChild:!0,variant:"outline",className:"w-full",children:l.jsxs(Rc,{to:"/",children:[l.jsx(jv,{className:"h-3.5 w-3.5"}),"Back to home"]})})]})]})})}function vV(e){if(!e)return null;const t=new Date(e).getTime();if(!Number.isFinite(t))return null;const n=t-Date.now();if(n<=0)return null;const a=Math.floor(n/6e4),s=Math.floor(a/60),o=Math.floor(s/24);return o>7?null:o>=1?{text:`Expires in ${o} ${o===1?"day":"days"}`,urgent:!1}:s>=1?{text:`Expires in ${s} ${s===1?"hour":"hours"}`,urgent:!0}:{text:`Expires in ${Math.max(1,a)} ${a===1?"minute":"minutes"}`,urgent:!0}}function bV(e){if(typeof e!="object"||e===null||!("from"in e))return null;const t=e.from;if(typeof t!="object"||t===null||!("pathname"in t)||typeof t.pathname!="string"||t.pathname==="/login")return null;const n="search"in t&&typeof t.search=="string"?t.search:"",a="hash"in t&&typeof t.hash=="string"?t.hash:"",s=`${t.pathname}${n}${a}`,o=EN(s);return o===G1&&s!==G1?null:o}function xV(){const{isAuthenticated:e}=vt(),t=Cr(),n=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),a=bV(t.state)??"/",s=a==="/"?"/api/v1/auth/github/start":`/api/v1/auth/github/start?next=${encodeURIComponent(a)}`,o="/api/v1/auth/github/dev-callback?githubId=1&login=devuser&displayName=Dev+User";return e?l.jsx(or,{to:a,replace:!0}):l.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[l.jsx("header",{className:"px-4 py-3",children:l.jsxs(Rc,{to:"/",className:"inline-flex items-center gap-1.5 rounded-[var(--radius-input)] px-2 py-1 text-body text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:[l.jsx(jv,{className:"h-3.5 w-3.5"}),"Back to home"]})}),l.jsx("div",{className:"flex flex-1 items-center justify-center px-4 pb-16",children:l.jsxs(zo,{className:"w-full max-w-sm",children:[l.jsxs(Mo,{className:"text-center",children:[l.jsx("div",{className:"mb-2 flex justify-center text-foreground",children:l.jsx(Dc,{width:28,height:32})}),l.jsxs(Bc,{className:"text-title",children:["First Tree ",l.jsx("span",{className:"font-normal text-muted-foreground",children:"Hub"})]})]}),l.jsxs(Do,{className:"space-y-4",children:[l.jsx(ye,{asChild:!0,className:"w-full",children:l.jsxs("a",{href:s,children:[l.jsx(kE,{className:"h-4 w-4"}),"Continue with GitHub"]})}),l.jsxs("p",{className:"text-center text-label text-muted-foreground",children:["By continuing you agree to our"," ",l.jsx("a",{href:"/terms",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Terms"})," ","·"," ",l.jsx("a",{href:"/privacy",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Privacy"})]}),n&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative my-2 text-center text-label text-muted-foreground",children:[l.jsx("span",{className:"relative z-10 bg-card px-2",children:"localhost only"}),l.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-border"})]}),l.jsx(ye,{asChild:!0,variant:"outline",className:"w-full",children:l.jsxs("a",{href:o,children:[l.jsx($M,{className:"h-4 w-4"}),"Dev: skip GitHub"]})})]})]})]})})]})}function wV(){const e=An(),{adoptTokens:t}=vt(),[n,a]=b.useState(null);return b.useEffect(()=>{const s=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash,o=new URLSearchParams(s),c=o.get("access"),f=o.get("refresh"),m=EN(o.get("next")),h=o.get("joinPath");if(!c||!f){a("Sign-in did not complete. Please try again.");return}(h==="solo"||h==="invite")&&mE(h),window.history.replaceState(null,"",window.location.pathname),(async()=>(await t({accessToken:c,refreshToken:f}),e(m,{replace:!0})))()},[t,e]),l.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-body text-muted-foreground",children:n??"Signing you in…"})}const yc=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("table",{ref:a,className:ze("w-full",e),style:{borderCollapse:"separate",borderSpacing:0,...t},...n}));yc.displayName="DenseTable";const vc=b.forwardRef(({className:e,...t},n)=>l.jsx("thead",{ref:n,className:e,...t}));vc.displayName="DenseTableHeader";const bc=b.forwardRef(({className:e,...t},n)=>l.jsx("tbody",{ref:n,className:e,...t}));bc.displayName="DenseTableBody";const aa=b.forwardRef(({className:e,interactive:t,selected:n,style:a,...s},o)=>l.jsx("tr",{ref:o,className:ze("transition-colors",e),"data-interactive":t?"":void 0,"data-selected":n?"":void 0,style:{background:n?"var(--bg-active)":void 0,cursor:t?"pointer":void 0,...a},...s}));aa.displayName="DenseTableRow";const Jt=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("th",{ref:a,className:ze("text-left text-label whitespace-nowrap",e),style:{padding:"var(--sp-2) var(--sp-3_5)",color:"var(--fg-3)",fontWeight:500,borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));Jt.displayName="DenseTableHead";const at=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("td",{ref:a,className:ze("align-middle text-body",e),style:{padding:"var(--sp-2_25) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));at.displayName="DenseTableCell";const SV=1500;function kV({command:e,expiresInSeconds:t,phase:n,copyLabel:a={idle:"Copy",done:"Copied"},waitingText:s="Waiting for your computer to connect…",successContent:o,errorContent:c,caption:f="Single-use · regenerates the previous one.",copyButtonPlacement:m="right"}){const[h,p]=b.useState(!1),g=async()=>{e&&(await navigator.clipboard.writeText(e),p(!0),setTimeout(()=>p(!1),SV))},x=t!==void 0?Math.max(1,Math.round(t/60)):null,w=l.jsx("pre",{className:"mono text-label",style:{margin:0,padding:"var(--sp-2_5) var(--sp-3)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",whiteSpace:"pre-wrap",wordBreak:"break-all",overflowWrap:"anywhere",minWidth:0,flex:m==="right"?1:void 0},title:e??"",children:e?l.jsxs(l.Fragment,{children:[e,x!==null&&l.jsxs("span",{style:{color:"var(--fg-4)"},children:[" # expires in ",x,"m"]})]}):"Generating token…"}),S=l.jsxs(ye,{type:"button",variant:"outline",size:"sm",onClick:g,disabled:!e,style:{alignSelf:"flex-start"},children:[h?l.jsx(cr,{className:"h-3.5 w-3.5"}):l.jsx(Cv,{className:"h-3.5 w-3.5"}),h?a.done:a.idle]});return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[m==="right"?l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[w,S]}):l.jsxs(l.Fragment,{children:[w,S]}),f&&l.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",margin:0},children:f}),n==="waiting"&&l.jsxs("div",{className:"flex items-center text-body",style:{gap:"var(--sp-2_5)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-blocked) 14%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-blocked) 35%, transparent)",borderRadius:"var(--radius-input)",color:"color-mix(in oklch, var(--state-blocked) 35%, var(--fg))"},children:[l.jsx(jV,{}),s]}),n==="success"&&o&&l.jsxs("div",{className:"flex items-center text-body",style:{gap:"var(--sp-2_5)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-idle) 14%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-idle) 35%, transparent)",borderRadius:"var(--radius-input)",color:"color-mix(in oklch, var(--state-idle) 45%, var(--fg))"},children:[l.jsx(cr,{className:"h-3.5 w-3.5",style:{flexShrink:0}}),l.jsx("span",{style:{minWidth:0},children:o})]}),n==="error"&&c&&l.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:c})]})}function jV(){return l.jsx("span",{"aria-hidden":"true",style:{width:12,height:12,flexShrink:0,borderRadius:"50%",border:"var(--hairline-bold) solid color-mix(in oklch, var(--state-blocked) 30%, transparent)",borderTopColor:"var(--state-blocked)",animation:"spin 0.85s linear infinite"}})}const EV=3e3,CV=1200;function NV({open:e,onOpenChange:t}){const n=gn(),{user:a}=vt(),[s,o]=b.useState("loading"),[c,f]=b.useState(null),[m,h]=b.useState(null),[p,g]=b.useState(null),x=b.useRef(new Set);return b.useEffect(()=>{if(!e){o("loading"),f(null),h(null),g(null),x.current=new Set;return}let w=!1;const S=(n.getQueryData(["clients"])??[]).map(k=>k.id);return x.current=new Set(S),(async()=>{try{const k=await MD();if(w)return;f(k),o("waiting")}catch(k){if(w)return;h(k instanceof Error?k.message:"Failed to generate connect token"),o("error")}})(),()=>{w=!0}},[e,n]),b.useEffect(()=>{if(!e||s!=="waiting"||!a)return;const S=setInterval(async()=>{try{const k=await n.fetchQuery({queryKey:["clients"],queryFn:ci}),j=x.current,C=k.find(N=>!j.has(N.id)&&N.status==="connected"&&N.userId===a.id);C&&(g(C.hostname??null),o("success"))}catch{}},EV);return()=>clearInterval(S)},[e,s,n,a]),b.useEffect(()=>{if(s!=="success")return;const w=setTimeout(()=>{n.invalidateQueries({queryKey:["clients"]}),t(!1)},CV);return()=>clearTimeout(w)},[s,t,n]),l.jsx(On,{open:e,onOpenChange:t,children:l.jsxs(Nn,{children:[l.jsxs(Pn,{children:[l.jsx(zn,{children:"Connect computer"}),l.jsx(Lv,{children:"Run this command on the machine you want to pair with this Hub."})]}),l.jsx(kV,{command:(c==null?void 0:c.command)??null,expiresInSeconds:c==null?void 0:c.expiresIn,phase:s,successContent:l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"font-semibold",children:p??"Computer"})," connected. Closing…"]}),errorContent:m}),l.jsx("div",{className:"flex justify-end",style:{gap:"var(--sp-2)"},children:l.jsx(ye,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"})})]})})}function _V({embedded:e=!1}={}){const t=gn(),n=gh(),[a,s]=b.useState(()=>new Set),[o,c]=b.useState(null),[f,m]=b.useState(null),[h,p]=b.useState(null),[g,x]=b.useState(!1),{data:w}=Ke({queryKey:["clients"],queryFn:ci,refetchInterval:1e4}),{data:S}=Ke({queryKey:["activity"],queryFn:Oc,refetchInterval:1e4}),k=ht({mutationFn:zD,onSuccess:()=>{c(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})}}),j=ht({mutationFn:OD,onSuccess:()=>{m(null),p(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})},onError:O=>{O instanceof Js?p(O.message):p(O instanceof Error?O.message:String(O))}}),C=b.useMemo(()=>{const O=new Map;for(const B of(S==null?void 0:S.agents)??[]){if(!B.clientId)continue;const I=O.get(B.clientId)??[];I.push(B),O.set(B.clientId,I)}return O},[S==null?void 0:S.agents]),N=O=>C.get(O)??[],R=(w??[]).filter(O=>O.status==="connected").length,M=(w??[]).reduce((O,B)=>O+B.agentCount,0),L=(w??[]).filter(O=>O.authState!=="ok").length;return l.jsxs("div",{className:e?"":"-m-6",children:[l.jsx(al,{title:"Computers",subtitle:w&&w.length>0?l.jsxs(l.Fragment,{children:[w.length," total · ",R," connected · ",M," agents bound",L>0&&l.jsxs(l.Fragment,{children:[" · ",l.jsxs("span",{style:{color:"var(--state-error)"},children:[L," need re-auth"]})]})]}):null,right:l.jsx("div",{className:"flex items-center gap-1.5",children:l.jsxs(ye,{size:"xs",onClick:()=>x(!0),children:[l.jsx(xa,{className:"h-3 w-3"}),"Connect computer"]})})}),l.jsxs("div",{style:{padding:"var(--sp-3_5) var(--sp-5) var(--sp-7)"},children:[l.jsx(NV,{open:g,onOpenChange:x}),f&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:l.jsxs("div",{className:"max-w-md w-full",style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",padding:24,boxShadow:"var(--shadow-md)"},children:[l.jsx("h3",{className:"text-subtitle mb-2",children:"Retire Computer"}),l.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["Permanently remove"," ",l.jsx("span",{className:"font-medium",style:{color:"var(--fg)"},children:f.hostname??f.id.slice(0,8)}),". Retire refuses if any agent is still pinned to this computer — you must delete those agents first (reassign is not available in this milestone)."]}),N(f.id).length>0&&l.jsxs("div",{className:"mb-3 p-2 rounded",style:{background:"color-mix(in oklch, var(--state-blocked) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-blocked) 28%, transparent)"},children:[l.jsx("div",{className:"text-label mb-1",children:"Agents currently bound to this computer (delete them first):"}),l.jsx("ul",{className:"text-body space-y-0.5",children:N(f.id).map(O=>l.jsx("li",{className:"font-medium",children:n(O.agentId)},O.agentId))})]}),h&&l.jsx("div",{className:"mb-3 p-2 rounded text-body",style:{background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",color:"var(--state-error)"},children:h}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(ye,{variant:"outline",size:"sm",onClick:()=>{m(null),p(null)},children:"Cancel"}),l.jsx(ye,{variant:"destructive",size:"sm",onClick:()=>j.mutate(f.id),disabled:j.isPending,children:j.isPending?"Retiring…":"Retire"})]})]})}),o&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:l.jsxs("div",{className:"max-w-md w-full",style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",padding:24,boxShadow:"var(--shadow-md)"},children:[l.jsx("h3",{className:"text-subtitle mb-2",children:"Disconnect Computer"}),l.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["This will disconnect"," ",l.jsx("span",{className:"font-medium",style:{color:"var(--fg)"},children:o.hostname??o.id.slice(0,8)})," ","and affect all bound agents:"]}),l.jsx("ul",{className:"mb-4 space-y-1",children:N(o.id).length===0?l.jsx("li",{className:"text-body",style:{color:"var(--fg-3)"},children:"No bound agents"}):N(o.id).map(O=>l.jsxs("li",{className:"text-body flex items-center gap-2",children:[l.jsx("span",{className:"font-medium",children:n(O.agentId)}),l.jsx(mc,{state:O.runtimeState})]},O.agentId))}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(ye,{variant:"outline",size:"sm",onClick:()=>c(null),children:"Cancel"}),l.jsx(ye,{variant:"destructive",size:"sm",onClick:()=>k.mutate(o.id),disabled:k.isPending,children:k.isPending?"Disconnecting…":"Disconnect"})]})]})}),!w||w.length===0?l.jsx(En,{children:l.jsx("div",{className:"text-center py-10 text-body",style:{color:"var(--fg-3)"},children:"No computers connected. Use the button above to generate a connect command."})}):l.jsxs(En,{children:[l.jsxs(By,{children:["Registered · ",w.length]}),l.jsxs(yc,{children:[l.jsx(vc,{children:l.jsxs(aa,{children:[l.jsx(Jt,{style:{width:16}}),l.jsx(Jt,{children:"Hostname"}),l.jsx(Jt,{children:"OS"}),l.jsx(Jt,{children:"SDK"}),l.jsx(Jt,{children:"Agents"}),l.jsx(Jt,{children:"Connected"}),l.jsx(Jt,{children:"Status"}),l.jsx(Jt,{"aria-hidden":!0})]})}),l.jsx(bc,{children:w.map(O=>{const B=!a.has(O.id),I=N(O.id);return l.jsx(DV,{client:O,boundAgents:I,isExpanded:B,agentName:n,onToggle:()=>s(Y=>{const z=new Set(Y);return z.has(O.id)?z.delete(O.id):z.add(O.id),z}),onDisconnect:()=>c(O),onRetire:()=>{p(null),m(O)},onReconnect:()=>x(!0)},O.id)})})]})]})]})]})}const TV={"claude-code":"Claude Code",codex:"Codex"},AV=[Qf.CLAUDE_CODE,Qf.CODEX],$k={"claude-code":"Run `npm install -g @anthropic-ai/claude-code` on this computer.",codex:"Install the OpenAI Codex CLI on this computer."},RV={"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 OV({clientId:e,enabled:t}){const{data:n,isLoading:a}=Ke({queryKey:["client-capabilities",e],queryFn:()=>dh(e),enabled:t}),s=(n==null?void 0:n.capabilities)??null;return l.jsxs(l.Fragment,{children:[l.jsx(nb,{style:{display:"block",marginBottom:6},children:"Runtimes"}),a&&!s?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):s&&Object.keys(s).length===0?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Capabilities not yet reported. Reconnect this computer to refresh."}):l.jsx("div",{className:"flex flex-col gap-1",children:AV.map(o=>l.jsx(zV,{provider:o,entry:s?s[o]??null:null},o))})]})}function zV({provider:e,entry:t}){const n=TV[e];if(!t)return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",style:{opacity:.7},children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:["not reported · ",$k[e]]})]});switch(t.state){case"ok":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--state-idle)"},children:["✓ ",t.sdkVersion?`v${t.sdkVersion} · `:"","authenticated (",t.authMethod,")"]})]});case"unauthenticated":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--state-blocked)"},children:["⚠ installed",t.sdkVersion?` v${t.sdkVersion}`:"",", not authenticated ·"," ",RV[e]]})]});case"missing":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",style:{opacity:.7},children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:["✗ not installed · ",$k[e]]})]});case"error":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--state-error)"},children:["error · ",t.error??"probe failed"]})]})}}function MV(){return l.jsxs("span",{className:"mono inline-flex items-center gap-1.5 uppercase text-caption",style:{color:"var(--state-error)"},children:[l.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"var(--state-error)",display:"inline-block"}}),"AUTH EXPIRED"]})}function DV({client:e,boundAgents:t,isExpanded:n,agentName:a,onToggle:s,onDisconnect:o,onRetire:c,onReconnect:f}){const h=e.status!=="connected",p=e.authState!=="ok",g=e.status==="connected"?"idle":"offline";return l.jsxs(l.Fragment,{children:[l.jsxs(aa,{interactive:!0,selected:n,onClick:s,children:[l.jsx(at,{style:{width:16},children:l.jsx("span",{style:{color:"var(--fg-4)",display:"inline-flex"},children:n?l.jsx(Ev,{className:"h-3.5 w-3.5"}):l.jsx(wE,{className:"h-3.5 w-3.5"})})}),l.jsx(at,{className:"font-medium",children:e.hostname??"—"}),l.jsx(at,{style:{color:"var(--fg-3)"},children:e.os??"—"}),l.jsx(at,{className:"mono text-label",style:{color:"var(--fg-3)"},children:e.sdkVersion??"—"}),l.jsx(at,{children:l.jsx("span",{className:"mono tnum text-label",children:e.agentCount})}),l.jsx(at,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:e.connectedAt?oc(e.connectedAt):"—"}),l.jsx(at,{children:p?l.jsx(MV,{}):l.jsx(mc,{state:g})}),l.jsx(at,{style:{width:1,whiteSpace:"nowrap"},children:l.jsxs("div",{className:"flex items-center justify-end text-label",style:{gap:"var(--sp-3_5)"},children:[h&&l.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:p?"var(--state-error)":"var(--fg-2)"},onClick:x=>{x.stopPropagation(),f()},children:"Reconnect"}),l.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:"var(--fg-2)"},onClick:x=>{x.stopPropagation(),o()},children:"Disconnect"}),l.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:"var(--fg-4)"},onClick:x=>{x.stopPropagation(),c()},children:"Retire"})]})})]}),n&&l.jsxs("tr",{style:{background:"var(--bg-sunken)"},children:[l.jsx(at,{}),l.jsxs(at,{colSpan:7,style:{padding:"var(--sp-2_5) var(--sp-3) var(--sp-3_5)"},children:[l.jsx(OV,{clientId:e.id,enabled:n}),t.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs(nb,{style:{display:"block",marginTop:"var(--sp-3)",marginBottom:6},children:["Bound agents · ",t.length]}),l.jsx("div",{className:"flex flex-col gap-1",children:t.map(x=>l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:a(x.agentId)}),l.jsx(mc,{state:x.runtimeState}),x.activeSessions!==null&&l.jsxs("span",{className:"mono tnum text-caption",style:{color:"var(--fg-3)"},children:[x.activeSessions," / ",x.totalSessions??0," sessions"]})]},x.agentId))})]})]})]})]})}function IV(){return l.jsx(_V,{embedded:!0})}async function LV(e){try{return await Ee.get(`/orgs/${e}/github-app-installation`)}catch(t){if(t instanceof Js&&t.status===404)return null;throw t}}async function PV(e){const{installUrl:t}=await Ee.get(`/orgs/${e}/github-app-installation/install-url`);return t}function Fc({title:e,description:t,right:n,children:a,isFirst:s=!1}){return l.jsxs("section",{style:{padding:"var(--sp-6) 0",borderTop:s?void 0:"var(--hairline) solid var(--border-faint)"},children:[l.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:"var(--sp-3)"},children:[l.jsxs("div",{style:{minWidth:0},children:[l.jsx("h2",{className:"text-subtitle font-medium m-0",style:{color:"var(--fg)"},children:e}),t&&l.jsx("p",{className:"text-label m-0",style:{color:"var(--fg-3)",marginTop:"var(--sp-0_5)"},children:t})]}),n]}),l.jsx("div",{style:{marginTop:"var(--sp-4)"},children:a})]})}function UV({isFirst:e=!1}){const{organizationId:t}=vt(),n=Ke({queryKey:["github-app-installation",t],queryFn:()=>t?LV(t):Promise.reject(new Error("no org")),enabled:!!t});return l.jsx(Fc,{title:"GitHub App",description:"One installation unlocks user sign-in, webhook ingestion, and (later) server-side write access.",isFirst:e,children:n.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):n.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:n.error instanceof Error?n.error.message:"Failed to load installation"}):n.data==null?l.jsx(BV,{organizationId:t}):l.jsx(FV,{data:n.data})})}function BV({organizationId:e}){const t=ht({mutationFn:()=>{if(!e)throw new Error("No organization selected");return PV(e)},onSuccess:o=>{window.location.assign(o)}}),n=t.error instanceof Js&&t.error.status===503,a=t.isPending,s=!e||a;return l.jsxs("div",{children:[l.jsx("p",{className:"text-body",style:{color:"var(--fg-2)",marginBottom:"var(--sp-3)"},children:"Install the GitHub App on your personal account or organization to start receiving issues, pull requests, and reviews as routed messages."}),n?l.jsxs("p",{className:"text-body",style:{color:"var(--state-error)"},children:["The GitHub App slug isn't configured on this hub. Ask your operator to set"," ",l.jsx("code",{className:"mono",children:"FIRST_TREE_HUB_GITHUB_APP_SLUG"}),"."]}):l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",onClick:()=>t.mutate(),disabled:s,className:"inline-flex items-center justify-center font-medium",style:{gap:"var(--sp-1)",padding:"var(--sp-2) var(--sp-3)",background:"var(--accent)",color:"var(--accent-fg, white)",border:"none",borderRadius:"var(--radius-input)",cursor:s?"default":"pointer",opacity:s?.6:1},children:[a?"Opening GitHub…":"Install on GitHub",l.jsx(Nv,{className:"h-3 w-3"})]}),t.error&&!n&&l.jsx("p",{className:"text-body",style:{color:"var(--state-error)",marginTop:"var(--sp-2)"},children:t.error instanceof Error?t.error.message:"Failed to build the install URL"})]})]})}function FV({data:e}){const t=e.accountType==="Organization"?Qz:NE,n=Object.entries(e.permissions);return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[e.suspended&&l.jsx($V,{}),l.jsxs("div",{children:[l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Connected as"}),l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)"},children:[l.jsx(t,{className:"h-4 w-4",style:{color:"var(--fg-2)"}}),l.jsx("span",{className:"text-body font-medium",style:{color:"var(--fg)"},children:e.accountLogin}),l.jsx("span",{className:"text-label",style:{padding:"var(--sp-0_5) var(--sp-1_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",color:"var(--fg-3)"},children:e.accountType})]})]}),n.length>0&&l.jsxs("div",{children:[l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Permissions granted"}),l.jsx("ul",{className:"text-body",style:{listStyle:"none",padding:0,margin:0,display:"grid",gridTemplateColumns:"1fr 1fr",gap:"var(--sp-1)",color:"var(--fg-2)"},children:n.map(([a,s])=>l.jsxs("li",{className:"mono",children:[a,": ",l.jsx("strong",{style:{color:"var(--fg)"},children:s})]},a))})]}),e.events.length>0&&l.jsxs("div",{children:[l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Subscribed events"}),l.jsx("div",{className:"text-body mono",style:{color:"var(--fg-2)"},children:e.events.join(", ")})]}),l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)"},children:[l.jsxs("a",{href:e.manageUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center text-body",style:{gap:"var(--sp-1)",padding:"var(--sp-1_5) var(--sp-2_5)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)",textDecoration:"none"},children:["Manage on GitHub",l.jsx(Nv,{className:"h-3 w-3"})]}),l.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)"},children:["Installation #",e.installationId]})]})]})}function $V(){return l.jsxs("div",{className:"flex items-start text-body",style:{gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",color:"var(--state-warning, var(--fg-3))"},children:[l.jsx(tM,{className:"h-4 w-4 shrink-0",style:{marginTop:"var(--sp-0_5)"}}),l.jsx("span",{children:"This installation is suspended upstream. GitHub is not delivering webhooks and Hub can't act as the App on this account. Unsuspend it from the GitHub side to restore service."})]})}function HV(){const{role:e}=vt();return e===null?l.jsx("div",{className:"text-body",style:{padding:"var(--sp-5)",color:"var(--fg-3)"},children:"Loading..."}):e!=="admin"?l.jsx(or,{to:"/settings/computers",replace:!0}):l.jsxs(l.Fragment,{children:[l.jsx(al,{title:"GitHub",subtitle:"Connected GitHub App and granted permissions"}),l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:l.jsx(UV,{isFirst:!0})})]})}function qV(){return Ee.get(Rn("/adapter-mappings"))}function ZV(e){return Ee.post(Rn("/adapter-mappings"),e)}function GV(e){return Ee.delete(`/adapter-mappings/${e}`)}function VV(){return Ee.get(Rn("/adapters/status"))}function QV(){return Ee.get(Rn("/adapters"))}function KV(e){return Ee.post(Rn("/adapters"),e)}function YV(e,t){return Ee.patch(`/adapters/${e}`,t)}function XV(e){return Ee.delete(`/adapters/${e}`)}const WV=Object.values(_6),Hk={platform:"feishu",feishuAppId:"",feishuAppSecret:"",credentialsJson:"{}",status:"active",externalUserId:"",displayName:"",kaelUserId:"",kaelProjectId:""};function qk(e){const[t,n]=b.useState(Hk),[a,s]=b.useState("");b.useEffect(()=>{e.open&&(n({...Hk,platform:e.initialPlatform??"feishu",status:e.initialStatus??"active"}),s(""))},[e.open,e.initialPlatform,e.initialStatus]);function o(f){if(f.preventDefault(),s(""),e.kind==="user"){if(!t.externalUserId)return;e.onSubmit({kind:"user-create",draft:{platform:t.platform,externalUserId:t.externalUserId,displayName:t.displayName||null}});return}if(t.platform==="feishu"){if(!e.editingId&&(!t.feishuAppId||!t.feishuAppSecret)){s("App ID and App Secret are required");return}}else if(t.platform==="kael"){if(!e.editingId&&(!t.kaelUserId||!t.kaelProjectId)){s("User ID and Project ID are required");return}}else{const h=t.credentialsJson.trim();if(!e.editingId&&!h){s("Credentials are required");return}if(h)try{JSON.parse(h)}catch{s("Invalid JSON");return}}const m=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 l.jsx(On,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(Nn,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:c})}),l.jsxs("form",{onSubmit:o,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"binding-platform",children:"Platform"}),l.jsx("select",{id:"binding-platform",value:t.platform,onChange:f=>n({...t,platform:f.target.value}),disabled:!!e.editingId,className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50",children:WV.map(f=>l.jsx("option",{value:f,children:f},f))})]}),e.kind==="user"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"binding-ext-id",children:"External user ID"}),l.jsx(Ft,{id:"binding-ext-id",value:t.externalUserId,onChange:f=>n({...t,externalUserId:f.target.value}),placeholder:"ou_xxxxxxxx...",className:"font-mono",required:!0})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"binding-name",children:"Display name (optional)"}),l.jsx(Ft,{id:"binding-name",value:t.displayName,onChange:f=>n({...t,displayName:f.target.value})})]})]}):l.jsxs(l.Fragment,{children:[t.platform==="feishu"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs(bt,{htmlFor:"feishu-app-id",children:["App ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Ft,{id:"feishu-app-id",value:t.feishuAppId,onChange:f=>n({...t,feishuAppId:f.target.value}),placeholder:"cli_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(bt,{htmlFor:"feishu-app-secret",children:["App Secret",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Ft,{id:"feishu-app-secret",type:"password",autoComplete:"new-password",value:t.feishuAppSecret,onChange:f=>n({...t,feishuAppSecret:f.target.value}),placeholder:"••••••••"})]})]}):t.platform==="kael"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs(bt,{htmlFor:"kael-user-id",children:["User ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Ft,{id:"kael-user-id",value:t.kaelUserId,onChange:f=>n({...t,kaelUserId:f.target.value}),placeholder:"user_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(bt,{htmlFor:"kael-project-id",children:["Project ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Ft,{id:"kael-project-id",value:t.kaelProjectId,onChange:f=>n({...t,kaelProjectId:f.target.value}),placeholder:"proj_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),!e.editingId&&l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Agent Token will be created automatically when you save."})]}):l.jsxs("div",{className:"space-y-2",children:[l.jsxs(bt,{htmlFor:"binding-creds",children:["Credentials (JSON)",e.editingId?" — leave empty to keep existing":""]}),l.jsx("textarea",{id:"binding-creds",value:t.credentialsJson,onChange:f=>n({...t,credentialsJson:f.target.value}),rows:4,className:"flex w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-2 text-body shadow-sm font-mono focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",placeholder:'{"bot_token": "xoxb-...", "signing_secret": "..."}'})]}),a&&l.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:a}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"binding-status",children:"Status"}),l.jsxs("select",{id:"binding-status",value:t.status,onChange:f=>n({...t,status:f.target.value}),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"active",children:"active"}),l.jsx("option",{value:"inactive",children:"inactive"})]})]})]}),e.errorMessage&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:e.errorMessage}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(ye,{type:"submit",disabled:e.pending,children:e.pending?"Saving…":e.editingId?"Update":"Create"})]})]})]})})}function 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 eQ(){var T;const e=An(),t=gn(),[n,a]=lh(),s=n.get("agent"),o=gh(),c=Ke({queryKey:["adapters"],queryFn:QV}),f=Ke({queryKey:["adapter-mappings"],queryFn:qV}),m=Ke({queryKey:["adapter-statuses"],queryFn:VV,refetchInterval:15e3}),p=((T=Ke({queryKey:["agents","name-map"],queryFn:()=>Mc({limit:100}),staleTime:3e4}).data)==null?void 0:T.items)??[],g=b.useMemo(()=>{const G=new Map;for(const q of m.data??[])G.set(q.configId,q);return G},[m.data]),x=b.useMemo(()=>{const G=c.data??[];return s?G.filter(q=>q.agentId===s):G},[c.data,s]),w=b.useMemo(()=>{const G=f.data??[];return s?G.filter(q=>q.agentId===s):G},[f.data,s]),S=x.reduce((G,q)=>{var ae;return G+((ae=g.get(q.id))!=null&&ae.connected?1:0)},0),k=x.length-S,j=c.isLoading||f.isLoading,[C,N]=b.useState(null),[R,M]=b.useState(""),[L,O]=b.useState(null),[B,I]=b.useState(null),[Y,z]=b.useState(null),[K,ie]=b.useState(null),ve=ht({mutationFn:G=>KV({platform:G.platform,agentId:G.agentId,credentials:G.credentials,status:G.status}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),O(null)}}),J=ht({mutationFn:G=>{const q={status:G.status};return G.credentials&&(q.credentials=G.credentials),YV(G.id,q)},onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),O(null)}}),W=ht({mutationFn:XV,onSuccess:()=>t.invalidateQueries({queryKey:["adapters"]})}),Z=ht({mutationFn:G=>ZV({platform:G.platform,externalUserId:G.externalUserId,agentId:G.agentId,boundVia:"manual",displayName:G.displayName??void 0}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapter-mappings"]}),I(null)}}),ne=ht({mutationFn:GV,onSuccess:()=>t.invalidateQueries({queryKey:["adapter-mappings"]})});function ke(G){if(s){G==="bot"?O({agentId:s,editingId:null}):I({agentId:s});return}M(""),N({kind:G})}function Ae(){!C||!R||(C.kind==="bot"?O({agentId:R,editingId:null}):I({agentId:R}),N(null))}function D(G){if(L){if(G.kind==="bot-create")ve.mutate({agentId:L.agentId,platform:G.draft.platform,status:G.draft.status,credentials:G.draft.credentials});else if(G.kind==="bot-update"){if(!L.editingId)return;J.mutate({id:L.editingId,status:G.status,credentials:G.credentials})}}}function P(G){!B||G.kind!=="user-create"||Z.mutate({agentId:B.agentId,platform:G.draft.platform,externalUserId:G.draft.externalUserId,displayName:G.draft.displayName})}const F=s?p.find(G=>G.uuid===s):null;return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",padding:"0 var(--sp-0_5) var(--sp-3)"},children:"Manage how external platforms (Feishu, Slack, Kael) reach your agents. Bot bindings hold encrypted credentials; user bindings map an external user to a human agent in this organization."}),s&&l.jsxs("div",{className:"flex items-center gap-2",style:{padding:"0 var(--sp-0_5) var(--sp-3)"},children:[l.jsx("span",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Filtered to"}),l.jsxs("span",{className:"inline-flex items-center gap-1.5 mono text-caption",style:{padding:"var(--sp-0_5) var(--sp-2)",borderRadius:"var(--radius-chip)",background:"var(--bg-active)",border:"var(--hairline) solid var(--border)"},children:[(F==null?void 0:F.displayName)??s,l.jsx("button",{type:"button",onClick:()=>{const G=new URLSearchParams(n);G.delete("agent"),a(G,{replace:!0})},"aria-label":"Clear filter",className:"inline-flex items-center justify-center hover:bg-accent rounded-full",style:{width:14,height:14,border:"none",background:"transparent",cursor:"pointer"},children:l.jsx(os,{className:"h-3 w-3"})})]})]}),l.jsxs(En,{className:"mb-3.5",children:[l.jsxs(By,{right:l.jsxs("span",{className:"inline-flex items-center gap-2",children:[l.jsxs("span",{className:"inline-flex items-center gap-3 text-caption",children:[l.jsxs("span",{className:"mono inline-flex items-center gap-1",style:{color:"var(--state-idle)"},children:[l.jsx(Ju,{state:"idle",size:6})," ",S," online"]}),l.jsxs("span",{className:"mono inline-flex items-center gap-1",style:{color:"var(--fg-4)"},children:[l.jsx(Ju,{state:"offline",size:6})," ",k," offline"]})]}),l.jsxs(ye,{size:"xs",variant:"outline",onClick:()=>ke("bot"),children:[l.jsx(xa,{className:"h-3 w-3"})," Bot binding"]})]}),children:["Bot bindings · ",x.length]}),j?l.jsx(kf,{children:"Loading…"}):x.length?l.jsxs(yc,{children:[l.jsx(vc,{children:l.jsxs(aa,{children:[l.jsx(Jt,{children:"Agent"}),l.jsx(Jt,{children:"Platform"}),l.jsx(Jt,{children:"Status"}),l.jsx(Jt,{children:"Connection"}),l.jsx(Jt,{children:"Created"}),l.jsx(Jt,{style:{width:96,textAlign:"right"}})]})}),l.jsx(bc,{children:x.map(G=>{var ae;const q=((ae=g.get(G.id))==null?void 0:ae.connected)??!1;return l.jsxs(aa,{interactive:!0,onClick:()=>e(`/agents/${G.agentId}`),children:[l.jsx(at,{children:l.jsx("span",{className:"mono font-medium",children:o(G.agentId)})}),l.jsx(at,{children:l.jsx(Er,{children:G.platform})}),l.jsx(at,{children:l.jsx(Er,{tone:G.status==="active"?"accent":"outline",children:G.status})}),l.jsx(at,{children:l.jsxs("span",{className:"inline-flex items-center gap-1.5 text-label",children:[l.jsx(Ju,{state:q?"idle":"offline",size:7}),l.jsx("span",{style:{color:"var(--fg-3)"},children:q?"Online":"Offline"})]})}),l.jsx(at,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:oc(G.createdAt)}),l.jsxs(at,{style:{textAlign:"right",whiteSpace:"nowrap"},onClick:be=>be.stopPropagation(),children:[l.jsx(ye,{variant:"ghost",size:"xs",className:"text-label",onClick:()=>O({agentId:G.agentId,editingId:G.id,initialPlatform:tQ(G.platform),initialStatus:nQ(G.status)}),children:"Edit"}),l.jsx(ye,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>z(G.id),disabled:W.isPending,title:"Delete",children:l.jsx(Uf,{className:"h-3.5 w-3.5"})})]})]},G.id)})})]}):l.jsx(kf,{children:s?"No bot bindings for this agent yet.":"No bot bindings"})]}),l.jsxs(En,{children:[l.jsxs(By,{right:l.jsxs(ye,{size:"xs",variant:"outline",onClick:()=>ke("user"),children:[l.jsx(xa,{className:"h-3 w-3"})," User binding"]}),children:["User bindings · ",w.length]}),j?l.jsx(kf,{children:"Loading…"}):w.length?l.jsxs(yc,{children:[l.jsx(vc,{children:l.jsxs(aa,{children:[l.jsx(Jt,{children:"Agent"}),l.jsx(Jt,{children:"Platform"}),l.jsx(Jt,{children:"External user ID"}),l.jsx(Jt,{children:"Display name"}),l.jsx(Jt,{children:"Bound via"}),l.jsx(Jt,{children:"Created"}),l.jsx(Jt,{style:{width:32}})]})}),l.jsx(bc,{children:w.map(G=>l.jsxs(aa,{interactive:!0,onClick:()=>e(`/agents/${G.agentId}`),children:[l.jsx(at,{children:l.jsx("span",{className:"mono font-medium",style:{color:"var(--accent-dim)"},children:o(G.agentId)})}),l.jsx(at,{children:l.jsx(Er,{children:G.platform})}),l.jsx(at,{children:l.jsx("span",{className:"mono text-label",style:{color:"var(--fg-2)"},children:G.externalUserId})}),l.jsx(at,{style:{color:"var(--fg-2)"},children:G.displayName??"—"}),l.jsx(at,{children:l.jsx(Er,{tone:"outline",children:G.boundVia??"—"})}),l.jsx(at,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:oc(G.createdAt)}),l.jsx(at,{onClick:q=>q.stopPropagation(),children:l.jsx(ye,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>ie(G.id),disabled:ne.isPending,title:"Delete",children:l.jsx(Uf,{className:"h-3.5 w-3.5"})})})]},G.id))})]}):l.jsx(kf,{children:s?"No user bindings for this agent yet.":"No user bindings"})]}),l.jsx(rQ,{open:C!=null,kind:(C==null?void 0:C.kind)??"bot",agents:p,agentId:R,onAgentChange:M,onCancel:()=>N(null),onConfirm:Ae}),l.jsx(qk,{open:L!=null,kind:"bot",editingId:(L==null?void 0:L.editingId)??null,initialPlatform:L==null?void 0:L.initialPlatform,initialStatus:L==null?void 0:L.initialStatus,agentLabel:L?o(L.agentId):"",pending:ve.isPending||J.isPending,errorMessage:(ve.error??J.error)instanceof Error?(ve.error??J.error).message:null,onOpenChange:G=>{G||(O(null),ve.reset(),J.reset())},onSubmit:D}),l.jsx(qk,{open:B!=null,kind:"user",editingId:null,agentLabel:B?o(B.agentId):"",pending:Z.isPending,errorMessage:Z.error instanceof Error?Z.error.message:null,onOpenChange:G=>{G||(I(null),Z.reset())},onSubmit:P}),l.jsx(Zk,{open:Y!=null,onOpenChange:G=>!G&&z(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:()=>{Y!=null&&(W.mutate(Y),z(null))}}),l.jsx(Zk,{open:K!=null,onOpenChange:G=>!G&&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:()=>{K!=null&&(ne.mutate(K),ie(null))}})]})}function tQ(e){return e==="feishu"||e==="slack"||e==="kael"?e:"feishu"}function nQ(e){return e==="inactive"?"inactive":"active"}function kf({children:e}){return l.jsx("div",{className:"text-center py-6 text-body",style:{color:"var(--fg-3)"},children:e})}function rQ(e){const t=e.kind==="user"?e.agents.filter(n=>n.type==="human"&&n.status==="active"):e.agents.filter(n=>n.type!=="human"&&n.status==="active");return l.jsx(On,{open:e.open,onOpenChange:n=>!n&&e.onCancel(),children:l.jsxs(Nn,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:e.kind==="bot"?"Bind a bot":"Bind an external user"})}),l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Pick the agent this binding routes to."}),l.jsxs("select",{value:e.agentId,onChange:n=>e.onAgentChange(n.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"",children:"Select an agent…"}),t.map(n=>l.jsxs("option",{value:n.uuid,children:[n.displayName," ",n.name?`(@${n.name})`:""]},n.uuid))]})]}),l.jsxs(fr,{children:[l.jsx(ye,{variant:"ghost",onClick:e.onCancel,children:"Cancel"}),l.jsx(ye,{onClick:e.onConfirm,disabled:!e.agentId,children:"Continue"})]})]})})}function Zk(e){return l.jsx(On,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(Nn,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:e.title})}),l.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(ye,{type:"button",variant:"destructive",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function aQ({embedded:e=!1}={}){return l.jsxs("div",{className:e?"":"-m-6",children:[l.jsx(al,{title:"Messaging",subtitle:"Feishu / Slack bridges to your team's agents"}),l.jsx("div",{style:{padding:"var(--sp-4) var(--sp-5) var(--sp-7)"},children:l.jsx(eQ,{})})]})}function iQ(){return l.jsx(aQ,{embedded:!0})}function sQ(){const{onboardingStep:e,onboardingDismissedAt:t,dismissOnboarding:n,restoreOnboarding:a}=vt(),s=!!t,o=e==="completed";return l.jsxs(l.Fragment,{children:[l.jsx(al,{title:"Onboarding",subtitle:"Guided setup controls"}),l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:l.jsx(Fc,{title:"Onboarding guide",description:s?"The stepper is hidden. Bring it back if you want to walk through Step 3 (build your context-tree).":"The stepper is shown above your workspace. You can hide it any time once your agent is set up.",right:s?null:l.jsx(lQ,{}),isFirst:!0,children:s?l.jsx(ye,{type:"button",size:"sm",onClick:()=>void a(),children:"Resume onboarding"}):l.jsx(ye,{type:"button",size:"sm",variant:"outline",onClick:()=>void n(),disabled:!o,title:o?void 0:"Finish setting up your agent first",children:"Hide onboarding guide"})})})]})}function lQ(){return l.jsxs("span",{className:"text-label inline-flex items-center",style:{gap:"var(--sp-1)",color:"color-mix(in oklch, var(--accent) 35%, var(--fg))"},children:[l.jsx(cr,{className:"h-3 w-3"}),"Active"]})}function oQ(){const{role:e}=vt(),t=e==="admin";return l.jsxs("div",{className:"-m-6 flex",style:{minHeight:"calc(100vh - var(--sp-10))"},children:[l.jsxs("aside",{className:"shrink-0 overflow-auto",style:{width:200,padding:"var(--sp-4) var(--sp-2)"},children:[l.jsx(Hu,{to:"/settings/team",label:"Team"}),l.jsx(Hu,{to:"/settings/computers",label:"Computers"}),t&&l.jsx(Hu,{to:"/settings/github",label:"GitHub"}),l.jsx(Hu,{to:"/settings/integrations",label:"Messaging"}),l.jsx(Hu,{to:"/settings/onboarding",label:"Onboarding"})]}),l.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:l.jsx(Pf,{})})]})}function Hu({to:e,label:t}){return l.jsx(xv,{to:e,className:({isActive:n})=>ze("block w-full text-left bg-transparent text-body transition-colors","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",!n&&"hover:bg-accent"),style:{borderRadius:"var(--radius-input)"},children:({isActive:n})=>l.jsx("span",{className:"flex items-center",style:{padding:"var(--sp-1_25) var(--sp-2_5)",background:n?"var(--bg-active)":"transparent",color:n?"var(--fg)":"var(--fg-3)",fontWeight:n?500:400,borderRadius:"var(--radius-input)"},children:l.jsx("span",{className:"flex-1 truncate",children:t})})})}function Jy(e){return e.normalize("NFKD").replace(new RegExp("\\p{M}+","gu"),"").toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+|[-_]+$/g,"").slice(0,Jl)}const Bg=200;function uQ(e){if(!e||e.length===0)return{};const t={},n=["name","displayName","clientId"];for(const a of e){const s=a.path[0];if(typeof s=="string"&&n.includes(s)){const o=s;t[o]||(t[o]=a.message)}else t._root=a.message}return t}function cQ(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+/,"").slice(0,Jl)}function gT(e){return e==="claude-code"||e==="codex"?e:null}function dQ(e){var t,n;if(((t=e["claude-code"])==null?void 0:t.state)==="ok")return"claude-code";if(((n=e.codex)==null?void 0:n.state)==="ok")return"codex";for(const[a,s]of Object.entries(e))if(s.state==="ok"){const o=gT(a);if(o)return o}return null}function fQ(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function hQ(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 mQ({open:e,onOpenChange:t,onCreated:n}){const a=gn(),{refreshMe:s,organizationId:o}=vt(),[c,f]=b.useState(""),[m,h]=b.useState(""),[p,g]=b.useState(!1),[x,w]=b.useState("private"),[S,k]=b.useState("claude-code"),[j,C]=b.useState(!1),[N,R]=b.useState([]),[M,L]=b.useState(!1),[O,B]=b.useState(null),[I,Y]=b.useState(null),[z,K]=b.useState(null),[ie,ve]=b.useState(null),[J,W]=b.useState(null),[Z,ne]=b.useState(null),[ke,Ae]=b.useState(!1),[D,P]=b.useState({}),[F,T]=b.useState({status:"idle"});b.useEffect(()=>{e&&(f(""),h(""),g(!1),w("private"),k("claude-code"),C(!1),R([]),L(!1),B(null),Y(null),K(null),ve(null),W(null),ne(null),Ae(!1),P({}),T({status:"idle"}))},[e]),b.useEffect(()=>{p||h(Jy(c))},[c,p]);const G=b.useRef(0);b.useEffect(()=>{if(!e||!m){T({status:"idle"});return}if(!Iy.test(m)){T({status:"bad",reason:"invalid"});return}if(Ly(m)){T({status:"bad",reason:"reserved"});return}const V=++G.current;T({status:"checking"});const pe=window.setTimeout(()=>{i4(m).then(_e=>{V===G.current&&(_e.available?T({status:"ok"}):T({status:"bad",reason:_e.reason}))}).catch(()=>{V===G.current&&T({status:"idle"})})},300);return()=>window.clearTimeout(pe)},[m,e]),b.useEffect(()=>{if(!e)return;let V=!1;const pe=async()=>{try{const Pe=await ci();if(V)return;const Mt=Pe.filter(Pt=>Pt.status==="connected").sort((Pt,hr)=>hr.lastSeenAt.localeCompare(Pt.lastSeenAt));R(Mt),L(!0)}catch{V||L(!0)}};pe();const _e=window.setInterval(pe,3e3);return()=>{V=!0,window.clearInterval(_e)}},[e]),b.useEffect(()=>{if(N.length===0){B(null);return}B(V=>{var pe;return V&&N.some(_e=>_e.id===V)?V:((pe=N[0])==null?void 0:pe.id)??null})},[N]),b.useEffect(()=>{if(!O){Y(null),K(null);return}let V=!1;const pe=async()=>{try{const Pe=await dh(O);if(V)return;Y(Pe.capabilities),K(O)}catch{}};pe();const _e=window.setInterval(pe,3e3);return()=>{V=!0,window.clearInterval(_e)}},[O]),b.useEffect(()=>{if(!e||N.length>0)return;if(ie&&Z&&Z>Date.now()){const pe=Math.max(Z-Date.now(),0),_e=window.setTimeout(()=>{ve(null),ne(null)},pe);return()=>window.clearTimeout(_e)}ie&&(ve(null),W(null),ne(null));let V=!1;return(async()=>{try{const pe=await Ee.post("/me/connect-tokens",{});if(V)return;ve(pe.token),W(pe.command),ne(Date.now()+pe.expiresIn*1e3)}catch{}})(),()=>{V=!0}},[e,N.length,ie,Z]);const q=O&&z===O?I:null,ae=b.useMemo(()=>{if(!q)return[];const V=[];for(const[pe,_e]of Object.entries(q)){if(_e.state!=="ok")continue;const Pe=gT(pe);Pe&&V.push(Pe)}return V},[q]);b.useEffect(()=>{q&&k(V=>{var pe;return((pe=q[V])==null?void 0:pe.state)==="ok"?V:dQ(q)??V})},[q]);const be=ht({mutationFn:async V=>{const pe=c.trim()||m.trim()||"Untitled assistant";return a4({name:m||void 0,type:"personal_assistant",displayName:pe,clientId:V.clientId,runtimeProvider:S,visibility:x,...o?{organizationId:o}:{}})},onSuccess:V=>{a.invalidateQueries({queryKey:["agents"]}),a.invalidateQueries({queryKey:["activity"]}),s(),n(V,S)}}),we=b.useMemo(()=>{const V=be.error;if(!V)return{};if(V instanceof Js){const pe=uQ(V.issues);return Object.keys(pe).length>0?pe:V.status===409?{name:"That agent name is already in use in this organization. Pick a different one."}:{_root:V.message}}return V instanceof Error?{_root:V.message}:{}},[be.error]),me=F.status==="bad"?hQ(F.reason):void 0,Me={...me?{name:me}:{},...we,...D};function Ie(){const V={};return m?m.length>Jl?V.name=`Agent name must be at most ${Jl} characters (got ${m.length}).`:Iy.test(m)?Ly(m)&&(V.name="That agent name is reserved — pick a different one."):V.name="Agent name must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_).":c.trim().length>0&&(V.name="Agent name must contain at least one letter or digit (e.g. a-z, 0-9)."),c.length>Bg&&(V.displayName=`Display name must be at most ${Bg} characters (got ${c.length}).`),V}function St(V){V.preventDefault();const pe=Ie();P(pe),!(Object.keys(pe).length>0)&&F.status!=="bad"&&O&&(ae.length===0||!ae.includes(S)||be.mutate({clientId:O}))}const tt=F.status==="bad",it=c.trim().length>0&&!tt&&!be.isPending&&!!O&&ae.length>0&&ae.includes(S);return l.jsx(On,{open:e,onOpenChange:t,children:l.jsxs(Nn,{className:"max-w-lg",children:[l.jsx(Pn,{children:l.jsx(zn,{children:"New Agent"})}),l.jsxs("form",{onSubmit:St,className:"space-y-5 min-w-0",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"new-agent-display-name",children:"Display name"}),l.jsx(Ft,{id:"new-agent-display-name",value:c,onChange:V=>{f(V.target.value),D.displayName&&P(pe=>({...pe,displayName:void 0}))},placeholder:"My Dev Assistant",autoFocus:!0,maxLength:Bg,"aria-invalid":Me.displayName?!0:void 0,"aria-describedby":"new-agent-display-name-help new-agent-display-name-error"}),l.jsx("p",{id:"new-agent-display-name-help",className:"text-caption text-muted-foreground",children:"How teammates see this agent in chats and lists. Can be changed anytime."}),Me.displayName&&l.jsx("p",{id:"new-agent-display-name-error",className:"text-caption text-destructive",children:Me.displayName}),!j&&(c.trim()||m)&&l.jsxs("div",{className:"flex items-baseline gap-2 text-caption text-muted-foreground",children:[m?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"font-mono",children:["@",m]}),l.jsx("span",{"aria-hidden":!0,children:"·"}),l.jsx("span",{children:"permanent"})]}):l.jsx("span",{className:"italic",children:"No @handle from this display name"}),l.jsx("span",{"aria-hidden":!0,children:"·"}),l.jsx("button",{type:"button",onClick:()=>C(!0),className:"text-foreground underline underline-offset-2 hover:text-primary focus:outline-none focus-visible:text-primary",children:"Edit"})]}),!j&&Me.name&&l.jsx("p",{className:"text-caption text-destructive",children:Me.name})]}),j&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[l.jsx(bt,{htmlFor:"new-agent-name",children:"Agent name"}),l.jsx("button",{type:"button",onClick:()=>C(!1),className:"text-caption text-muted-foreground underline underline-offset-2 hover:text-primary focus:outline-none focus-visible:text-primary",children:"Done"})]}),l.jsxs("div",{className:"flex items-stretch",children:[l.jsx("span",{"aria-hidden":!0,className:"inline-flex items-center px-2 font-mono text-body text-muted-foreground border border-r-0 border-input rounded-l-[var(--radius-input)] bg-muted/40",children:"@"}),l.jsx(Ft,{id:"new-agent-name",value:m,autoFocus:!0,onChange:V=>{const pe=cQ(V.target.value);h(pe),g(!0),D.name&&P(_e=>({..._e,name:void 0}))},onBlur:V=>{const pe=Jy(V.target.value);pe!==m&&h(pe)},placeholder:"my-dev-assistant",className:"rounded-l-none font-mono",maxLength:Jl,"aria-invalid":Me.name?!0:void 0,"aria-describedby":"new-agent-name-help new-agent-name-error new-agent-name-status"})]}),l.jsxs("p",{id:"new-agent-name-help",className:"text-caption text-muted-foreground",children:["Used in @mentions and CLI commands. Lowercase letters, digits, hyphens (-), and underscores (_). Up to"," ",Jl," characters. Permanent after creation."]}),m&&!Me.name&&F.status!=="idle"&&l.jsxs("p",{id:"new-agent-name-status",className:"text-caption",style:{color:F.status==="ok"?"var(--state-idle)":F.status==="checking"?"var(--fg-3)":"var(--fg-4)"},children:[F.status==="checking"&&"Checking availability…",F.status==="ok"&&"Available."]}),Me.name&&l.jsx("p",{id:"new-agent-name-error",className:"text-caption text-destructive",children:Me.name})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{children:"Visibility"}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{className:x==="organization"?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"visibility",checked:x==="organization",onChange:()=>w("organization"),className:"mt-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-body font-medium",children:"Shared with team"}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Anyone in your org can @mention and chat with this agent."})]})]}),l.jsxs("label",{className:x==="private"?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"visibility",checked:x==="private",onChange:()=>w("private"),className:"mt-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-body font-medium",children:"Private to you"}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Only you can see this agent and chat with it. Others on the team won't see it listed. (default)"})]})]})]})]}),l.jsxs("div",{className:"space-y-3",style:{minHeight:168},children:[l.jsx(bt,{children:"Where it runs"}),M?N.length===0?l.jsx(pQ,{command:J,copied:ke,onCopy:async()=>{J&&(await navigator.clipboard.writeText(J),Ae(!0),window.setTimeout(()=>Ae(!1),1500))}}):N.length===1?l.jsx(gQ,{client:N[0]}):l.jsx("div",{className:"space-y-2",children:N.map(V=>{const pe=O===V.id;return l.jsxs("label",{className:pe?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"picked-client",checked:pe,onChange:()=>B(V.id),className:"mt-1"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-body font-medium truncate",children:V.hostname??V.id}),l.jsxs("div",{className:"text-caption text-muted-foreground",children:[V.os??"unknown OS"," · last seen ",new Date(V.lastSeenAt).toLocaleString()]})]})]},V.id)})}):l.jsx(yQ,{label:"Detecting connected computers…"}),(O||!M)&&l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("div",{className:"text-caption text-muted-foreground",children:"Powered by"}),!O||q===null?l.jsx(vQ,{}):ae.length===0?l.jsx("p",{className:"text-caption text-destructive",children:"No runtime ready on this computer. Install Claude Code or Codex on it (and sign in), then come back."}):l.jsx("div",{className:"flex flex-wrap gap-2",children:ae.map(V=>{const pe=S===V;return l.jsxs("label",{className:pe?"inline-flex items-center gap-2 rounded-md border border-primary bg-primary/5 px-3 py-1.5 cursor-pointer":"inline-flex items-center gap-2 rounded-md border border-border px-3 py-1.5 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"runtime",checked:pe,onChange:()=>k(V)}),l.jsx("span",{className:"text-body",children:fQ(V)})]},V)})})]}),Me.clientId&&l.jsx("p",{className:"text-caption text-destructive",children:Me.clientId})]}),Me._root&&l.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:Me._root}),l.jsx(fr,{children:l.jsx(ye,{type:"submit",disabled:!it,children:be.isPending?"Creating…":"Create"})})]})]})})}function pQ({command:e,copied:t,onCopy:n}){return l.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3 space-y-2",children:[l.jsx("div",{className:"text-body font-medium",children:"No computer connected yet."}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Run this on the machine where this agent should live. We'll pick it up here automatically."}),l.jsxs("div",{className:"flex items-stretch gap-2 min-w-0",children:[l.jsx("code",{className:"block flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-caption px-2 py-1.5 bg-muted/50 border border-border rounded",title:e??void 0,children:e??"Generating token…"}),l.jsx("button",{type:"button",onClick:n,disabled:!e,className:"shrink-0 px-3 py-1.5 text-caption font-medium border border-border rounded hover:bg-accent/30 disabled:opacity-50",children:t?"Copied":"Copy"})]})]})}function gQ({client:e}){return e?l.jsxs("div",{className:"rounded-md border border-primary bg-primary/5 p-3",children:[l.jsx("div",{className:"text-body font-medium truncate",children:e.hostname??e.id}),l.jsxs("div",{className:"text-caption text-muted-foreground",children:[e.os??"unknown OS"," · last seen ",new Date(e.lastSeenAt).toLocaleString()]})]}):null}function yQ({label:e}){return l.jsxs("div",{className:"rounded-md border border-border bg-muted/20 p-3",role:"status","aria-live":"polite","aria-label":e,children:[l.jsx("div",{className:"text-body font-medium",style:{color:"var(--fg-3)"},children:e}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Looking for a machine running the Hub client…"})]})}function vQ(){return l.jsx("div",{className:"flex flex-wrap gap-2",role:"status","aria-live":"polite","aria-label":"Detecting installed runtimes",children:l.jsx("span",{className:"inline-flex items-center rounded-md border border-border bg-muted/30 px-3 py-1.5 text-body",style:{color:"var(--fg-4)"},children:"Detecting installed runtimes…"})})}function bQ(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 xQ(){const{organizationId:e}=vt(),[t,n]=b.useState(null),[a,s]=b.useState(null),[o,c]=b.useState(!1),[f,m]=b.useState(!1);b.useEffect(()=>{e&&(async()=>{try{const p=await Ee.get(by(e,"/invitations"));n(p)}catch(p){s(p instanceof Error?p.message:"Failed to load invite link")}})()},[e]);const h=async()=>{if(e){c(!0),s(null);try{const p=await Ee.post(by(e,"/invitations/rotate"));n(p)}catch(p){s(p instanceof Error?p.message:"Failed to rotate invite link")}finally{c(!1)}}};return l.jsxs(zo,{children:[l.jsxs(Mo,{children:[l.jsx(Bc,{children:"Invite link"}),l.jsxs(pT,{children:["Anyone with this link can join your team as a member. Links expire after ",_B," days; rotating revokes the old link instantly and resets the timer."]})]}),l.jsxs(Do,{className:"space-y-3",children:[a&&l.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:a}),t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{readOnly:!0,className:"flex-1 rounded-md border bg-muted px-2 py-1 text-label font-mono",value:t.inviteUrl}),l.jsx(ye,{size:"sm",variant:"outline",onClick:()=>{navigator.clipboard.writeText(t.inviteUrl),m(!0),setTimeout(()=>m(!1),1500)},children:f?"Copied!":"Copy"}),l.jsx(ye,{size:"sm",onClick:h,disabled:o,children:o?"Rotating…":"Rotate"})]}),l.jsxs("p",{className:"text-label text-muted-foreground",children:["Created ",new Date(t.createdAt).toLocaleString(),t.expiresAt?` · ${bQ(t.expiresAt)}`:" · no expiry"]})]}):l.jsx("p",{className:"text-label text-muted-foreground",children:"Loading…"})]})]})}function kb({actions:e,ariaLabel:t,triggerClassName:n,icon:a=aM}){const[s,o]=b.useState(!1),[c,f]=b.useState("down"),m=b.useRef(null),h=b.useRef(null);return b.useEffect(()=>{if(!s)return;const p=x=>{m.current&&!m.current.contains(x.target)&&o(!1)},g=x=>{x.key==="Escape"&&o(!1)};return window.addEventListener("mousedown",p),window.addEventListener("keydown",g),()=>{window.removeEventListener("mousedown",p),window.removeEventListener("keydown",g)}},[s]),b.useEffect(()=>{if(!s||!h.current)return;const p=32,g=8,x=h.current.getBoundingClientRect(),w=window.innerHeight-x.bottom,S=e.length*p+g;f(w>=S?"down":"up")},[s,e.length]),e.length===0?null:l.jsxs("div",{ref:m,className:"relative inline-flex",children:[l.jsx("button",{ref:h,type:"button","aria-label":t,"aria-haspopup":"menu","aria-expanded":s,onClick:p=>{p.stopPropagation(),o(g=>!g)},className:ze("inline-flex items-center justify-center",n),style:{width:28,height:28,borderRadius:4,background:"transparent",color:"var(--fg-3)",cursor:"pointer",border:0},children:l.jsx(a,{className:"h-3.5 w-3.5"})}),s&&l.jsx("div",{role:"menu",className:"absolute right-0 z-30 rounded-md border bg-popover shadow-md",onClick:p=>p.stopPropagation(),onKeyDown:p=>p.stopPropagation(),style:{minWidth:180,borderColor:"var(--border)",...c==="up"?{bottom:"100%",marginBottom:4}:{top:"100%",marginTop:4}},children:e.map(p=>l.jsx("button",{type:"button",role:"menuitem",disabled:p.disabled,onClick:g=>{g.stopPropagation(),o(!1),p.onSelect()},className:"flex w-full items-center px-3 py-1.5 text-left text-body hover:bg-accent transition-colors disabled:opacity-50 disabled:cursor-not-allowed",style:{color:p.destructive?"var(--state-error)":"var(--fg)",background:"transparent",border:0,cursor:p.disabled?"not-allowed":"pointer"},children:p.label},p.key))})]})}const jb=[{key:"name",label:"Name",width:220},{key:"delegate",label:"Delegate",width:180},{key:"manager",label:"Manager",width:180},{key:"runtime",label:"Runs on",width:220},{key:"status",label:"Status",width:160},{key:"created",label:"Created",width:160},{key:"actions",label:"",width:44}];function jr(e,t){return e?{...t,borderBottom:0}:t}function wQ({groups:e,runtimeMap:t,clientHostMap:n,onAgentClick:a,getHumanActions:s,getAgentActions:o}){return l.jsxs(yc,{className:"table-fixed",children:[l.jsx(vc,{children:l.jsx(aa,{children:jb.map(c=>l.jsx(Jt,{style:{width:c.width,...c.key==="name"?{paddingLeft:"var(--sp-6)"}:null},"aria-hidden":c.key==="actions",children:c.label},c.key))})}),e.map(c=>l.jsx(SQ,{group:c,runtimeMap:t,clientHostMap:n,onAgentClick:a,getHumanActions:s,getAgentActions:o},c.key))]})}function SQ({group:e,runtimeMap:t,clientHostMap:n,onAgentClick:a,getHumanActions:s,getAgentActions:o}){const[c,f]=b.useState(!e.collapsible);return l.jsxs(bc,{children:[l.jsx(jQ,{group:e,open:c,onToggle:()=>f(m=>!m)}),c&&e.rows.length===0&&e.emptyMessage&&l.jsx(aa,{children:l.jsx(at,{colSpan:jb.length,style:{color:"var(--fg-4)",textAlign:"left",padding:"0 var(--sp-3_5) var(--sp-3) var(--sp-6)",borderBottom:0},children:e.emptyMessage})}),c&&e.rows.map((m,h)=>{const p=h===e.rows.length-1;return m.kind==="human"?l.jsx(EQ,{row:m,actions:s(m),isLast:p},`h:${m.id}`):l.jsx(NQ,{row:m,runtime:t.get(m.agent.uuid)??null,clientHost:m.agent.clientId?n.get(m.agent.clientId)??null:null,actions:o(m),onClick:()=>a(m.agent.uuid),isLast:p},`a:${m.agent.uuid}`)})]})}function kQ(e){switch(e){case"humans":return NE;case"yours":case"team":return xE;case"other-private":return uh;default:return null}}function jQ({group:e,open:t,onToggle:n}){const a=kQ(e.key),s=l.jsxs("span",{className:"inline-flex items-center relative",style:{gap:"var(--sp-2)"},children:[e.collapsible&&l.jsx("span",{"aria-hidden":!0,style:{position:"absolute",left:"calc(-1 * var(--sp-3))",top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)",lineHeight:1},children:t?"▾":"▸"}),a&&l.jsx(a,{className:"h-4 w-4","aria-hidden":!0,style:{color:"var(--fg-3)"}}),l.jsx("span",{className:"text-body font-medium",style:{color:"var(--fg)"},children:e.title}),l.jsx(Er,{tone:"outline",children:e.count})]});return l.jsx(aa,{children:l.jsx("td",{colSpan:jb.length,style:{padding:"var(--sp-6) var(--sp-3_5) var(--sp-2) 0"},children:e.collapsible?l.jsx("button",{type:"button",onClick:n,"aria-expanded":t,style:{background:"transparent",border:0,cursor:"pointer",color:"inherit",padding:"0 0 0 var(--sp-3)",marginLeft:"calc(-1 * var(--sp-3))"},children:s}):s})})}function EQ({row:e,actions:t,isLast:n}){return l.jsxs(aa,{children:[l.jsx(at,{style:jr(n,{paddingLeft:"var(--sp-6)"}),children:l.jsx(yT,{displayName:e.displayName,handle:`@${e.username}`,selfTag:e.isSelf})}),l.jsx(at,{style:jr(n),children:l.jsx(CQ,{row:e})}),l.jsx(at,{className:"text-label",style:jr(n,{color:"var(--fg-4)"}),children:"—"}),l.jsx(at,{className:"text-label",style:jr(n,{color:"var(--fg-4)"}),children:"—"}),l.jsx(at,{className:"text-label",style:jr(n,{color:"var(--fg-4)"}),children:"—"}),l.jsx(at,{className:"mono text-caption",style:jr(n,{color:"var(--fg-4)"}),children:qE(e.createdAt)}),l.jsx(at,{style:jr(n,{padding:0,textAlign:"right"}),children:l.jsx(kb,{actions:t,ariaLabel:`Actions for ${e.displayName}`})})]})}function CQ({row:e}){if(!e.delegate&&!e.canEditDelegate)return l.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:"—"});const t=e.delegate?e.delegate.name?`${e.delegate.displayName} (@${e.delegate.name})`:e.delegate.displayName:"Set delegate",n=e.delegate?l.jsx("span",{className:"block max-w-full overflow-hidden text-ellipsis whitespace-nowrap",children:l.jsx(XN,{name:e.delegate.name,displayName:e.delegate.displayName})}):l.jsx("span",{style:{color:"var(--accent-dim)"},children:"Set delegate →"}),a=e.delegate?e.canEditDelegate?`Change delegate · ${t}`:t:"Set delegate";return e.canEditDelegate?l.jsx("button",{type:"button",onClick:e.onEditDelegate,className:"text-label hover:underline block max-w-full overflow-hidden",style:{background:"transparent",border:0,padding:0,cursor:"pointer",color:"inherit",textAlign:"left"},title:a,children:n}):l.jsx("span",{className:"text-label block max-w-full overflow-hidden",title:a,children:n})}function NQ({row:e,runtime:t,clientHost:n,actions:a,onClick:s,isLast:o}){const{agent:c,managerLabel:f,isOwnedBySelf:m,showVisibilityChip:h}=e;return l.jsxs(aa,{interactive:!0,onClick:s,children:[l.jsx(at,{style:jr(o,{paddingLeft:"var(--sp-6)"}),children:l.jsx(yT,{displayName:c.displayName,handle:c.name?`@${c.name}`:null,visibility:h?c.visibility:null})}),l.jsx(at,{className:"text-label",style:jr(o,{color:"var(--fg-4)"}),children:"—"}),l.jsx(at,{className:"text-label",style:jr(o,{color:"var(--fg-2)"}),children:f?l.jsxs("span",{className:"truncate inline-block max-w-full",title:f,children:[f,m&&l.jsx("span",{className:"text-label italic",style:{marginLeft:6,color:"var(--fg-3)"},children:"(you)"})]}):l.jsx("span",{style:{color:"var(--fg-4)"},children:"—"})}),l.jsx(at,{className:"mono text-caption",style:jr(o,{color:"var(--fg-3)"}),children:l.jsxs("div",{className:"truncate",title:n?`${c.runtimeProvider} @ ${n}`:c.runtimeProvider,children:[c.runtimeProvider,n&&l.jsxs("span",{style:{color:"var(--fg-4)"},children:[" @ ",n]})]})}),l.jsx(at,{style:jr(o),children:l.jsx(mc,{state:(t==null?void 0:t.runtimeState)??null})}),l.jsx(at,{className:"mono text-caption",style:jr(o,{color:"var(--fg-4)"}),children:qE(c.createdAt)}),l.jsx(at,{style:jr(o,{padding:0,textAlign:"right"}),onClick:p=>p.stopPropagation(),children:l.jsx(kb,{actions:a,ariaLabel:`Actions for ${c.displayName}`})})]})}function yT({displayName:e,handle:t,selfTag:n,visibility:a}){return l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline gap-1.5 min-w-0",children:[l.jsx("span",{className:"font-medium text-body truncate",style:{color:"var(--fg)"},title:e,children:e}),n&&l.jsx("span",{className:"text-label italic shrink-0",style:{color:"var(--fg-3)"},children:"(you)"}),a&&l.jsx(_Q,{visibility:a})]}),t&&l.jsx("div",{className:"mono text-caption truncate",style:{color:"var(--fg-4)"},title:t,children:t})]})}function _Q({visibility:e}){return e==="private"?l.jsxs(Er,{tone:"outline",title:"Private — only you can see this agent",className:"shrink-0",children:[l.jsx(uh,{className:"h-2.5 w-2.5","aria-hidden":!0,style:{marginRight:3}}),"Private"]}):l.jsxs(Er,{tone:"accent",title:"Shared — anyone in the team can @mention this agent",className:"shrink-0",children:[l.jsx(UM,{className:"h-2.5 w-2.5","aria-hidden":!0,style:{marginRight:3}}),"Shared"]})}const Gk=100,Vk=100;async function TQ(e){const t=[];let n;for(let a=0;a<Vk;a++){const s=await e(n?{limit:Gk,cursor:n}:{limit:Gk});if(t.push(...s.items),!s.nextCursor)return t;n=s.nextCursor}throw new Error(`fetchAllAgents exceeded ${Vk} pages; server cursor pagination may be broken`)}function AQ(){const{role:e,memberId:t}=vt(),n=e==="admin",a=An(),s=gn(),o=JN(),[c,f]=b.useState(!1),[m,h]=b.useState(!1),[p,g]=b.useState(null),[x,w]=b.useState(null),[S,k]=b.useState("all"),[j,C]=b.useState(""),N=Ke({queryKey:["members"],queryFn:WN}),R=Ke({queryKey:["agents","team-page",n?"admin":"member"],queryFn:()=>TQ(q=>n?n4(q):Mc(q))}),{data:M}=Ke({queryKey:["activity"],queryFn:Oc,refetchInterval:1e4}),L=b.useMemo(()=>{const q=new Map;for(const ae of(M==null?void 0:M.agents)??[])q.set(ae.agentId,ae);return q},[M==null?void 0:M.agents]),{data:O}=Ke({queryKey:["clients","team-page"],queryFn:ci,staleTime:3e4}),B=b.useMemo(()=>{const q=new Map;for(const ae of O??[])ae.hostname&&q.set(ae.id,ae.hostname);return q},[O]),I=b.useMemo(()=>N.data??[],[N.data]),Y=b.useMemo(()=>R.data??[],[R.data]),z=b.useMemo(()=>{const q=new Map;for(const ae of Y)q.set(ae.uuid,ae);return q},[Y]),K=b.useMemo(()=>Y.filter(q=>q.type!=="human"),[Y]),ie=b.useMemo(()=>K.filter(q=>q.managerId===t),[K,t]),ve=b.useMemo(()=>K.filter(q=>q.visibility==="organization"&&q.managerId!==t),[K,t]),J=b.useMemo(()=>K.filter(q=>q.visibility==="private"&&q.managerId!==t),[K,t]),W=ht({mutationFn:async q=>D9(q.id,q.patch),onSuccess:()=>s.invalidateQueries({queryKey:["members"]})}),Z=ht({mutationFn:I9,onSuccess:()=>{s.invalidateQueries({queryKey:["members"]}),s.invalidateQueries({queryKey:["agents"]})}}),ne=ht({mutationFn:$C,onSuccess:()=>{s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}}),ke=ht({mutationFn:HC,onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),Ae=ht({mutationFn:qC,onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),D=ht({mutationFn:async q=>Ry(q.humanAgentId,{delegateMention:q.delegateMention}),onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),P=j.trim().toLowerCase(),F=b.useMemo(()=>zQ({filter:S,search:P,isAdmin:n,selfMemberId:t,members:I,yourAgents:ie,teamAgents:ve,otherPrivateAgents:J,resolveMember:o,agentByUuid:z,openDelegate:(q,ae)=>{var be;return w({humanAgentId:q,humanDisplayName:ae,currentDelegate:((be=z.get(q))==null?void 0:be.delegateMention)??null})}}),[S,P,n,t,I,ie,ve,J,o,z]);function T(q){const ae=[];return n&&ae.push({key:"edit",label:"Edit profile",onSelect:()=>g({id:q.id,username:q.username,displayName:q.displayName,role:q.role})}),n&&!q.isSelf&&ae.push({key:"remove",label:"Remove from org",destructive:!0,onSelect:()=>{window.confirm(`Remove ${q.displayName} from the org? The human agent will be deactivated.`)&&Z.mutate(q.id)}}),ae}function G(q){const{agent:ae,isOwnedBySelf:be}=q,we=n||be,me=[{key:"open",label:"Open",onSelect:()=>a(`/agents/${encodeURIComponent(ae.uuid)}`)}];return we&&(ae.status==="suspended"?me.push({key:"reactivate",label:"Reactivate",onSelect:()=>Ae.mutate(ae.uuid)}):me.push({key:"suspend",label:"Suspend",onSelect:()=>ke.mutate(ae.uuid)}),me.push({key:"delete",label:"Delete",destructive:!0,onSelect:()=>{window.confirm(`Delete agent ${ae.displayName}? This cannot be undone.`)&&ne.mutate(ae.uuid)}})),me}return l.jsxs(l.Fragment,{children:[l.jsx(al,{title:"Team",right:l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)"},children:[l.jsxs(ye,{size:"xs",onClick:()=>h(!0),children:[l.jsx(xa,{className:"h-3 w-3"}),"New agent"]}),n&&l.jsxs(ye,{size:"xs",variant:"ghost",onClick:()=>f(!0),children:[l.jsx(CE,{className:"h-3 w-3"}),"Invite link"]})]})}),l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[l.jsx(OQ,{filter:S,onFilter:k,query:j,onQuery:C,counts:{yours:ie.length,humans:I.length,team:ve.length}}),R.isLoading||N.isLoading?l.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):R.error||N.error?l.jsxs("div",{className:"text-center py-8 text-body",style:{color:"var(--state-error)"},children:["Failed to load: ",RQ(R.error??N.error)]}):l.jsx(wQ,{groups:F,runtimeMap:L,clientHostMap:B,onAgentClick:q=>a(`/agents/${encodeURIComponent(q)}`),getHumanActions:T,getAgentActions:G})]}),l.jsx(On,{open:c,onOpenChange:f,children:l.jsxs(Nn,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:"Invite link"})}),l.jsx(xQ,{})]})}),l.jsx(mQ,{open:m,onOpenChange:h,onCreated:(q,ae)=>{h(!1),s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}}),l.jsx(IQ,{target:p,isAdmin:n,isSaving:W.isPending,onClose:()=>g(null),onSave:async q=>{p&&(await W.mutateAsync({id:p.id,patch:q}),g(null))}}),l.jsx(LQ,{target:x,candidates:MQ(Y),isSaving:D.isPending,onClose:()=>w(null),onSave:async q=>{x&&(await D.mutateAsync({humanAgentId:x.humanAgentId,delegateMention:q}),w(null))}})]})}function RQ(e){return e instanceof Error?e.message:String(e)}function OQ({filter:e,onFilter:t,query:n,onQuery:a,counts:s}){const o=[{key:"all",label:"All"},{key:"yours",label:"Your agents",count:s.yours},{key:"humans",label:"Humans",count:s.humans},{key:"team",label:"Team agents",count:s.team}];return l.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[l.jsx("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-1)"},children:o.map(c=>l.jsx(eh,{active:e===c.key,count:c.count,onClick:()=>t(c.key),children:c.label},c.key))}),l.jsxs("div",{className:"relative",style:{width:220},children:[l.jsx(ch,{"aria-hidden":!0,className:"h-3.5 w-3.5",style:{position:"absolute",left:"var(--sp-1_5)",top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)"}}),l.jsx(Ft,{value:n,onChange:c=>a(c.target.value),placeholder:"Search name or @handle","aria-label":"Search team",className:"h-7 text-caption",style:{paddingLeft:"var(--sp-5)",borderRadius:3}})]})]})}function zQ(e){const{filter:t,search:n,isAdmin:a,selfMemberId:s,members:o,yourAgents:c,teamAgents:f,otherPrivateAgents:m,agentByUuid:h,openDelegate:p}=e,g=I=>{const Y=h.get(I);if(!(Y!=null&&Y.delegateMention))return null;const z=h.get(Y.delegateMention);return z?{name:z.name,displayName:z.displayName}:null},x=I=>!n||I.displayName.toLowerCase().includes(n)||I.username.toLowerCase().includes(n),w=I=>!n||I.displayName.toLowerCase().includes(n)||(I.name??"").toLowerCase().includes(n),S=t==="all"||t==="yours",k=t==="all"||t==="humans",j=t==="all"||t==="team",C=a&&t==="all",N=o.filter(x).map(I=>{const Y=s===I.id;return{kind:"human",id:I.id,agentId:I.agentId,username:I.username,displayName:I.displayName,role:I.role,createdAt:I.createdAt,isSelf:Y,delegate:g(I.agentId),canEditDelegate:Y||a,onEditDelegate:()=>p(I.agentId,I.displayName)}}).sort((I,Y)=>Number(Y.isSelf)-Number(I.isSelf)),R=(I,Y)=>({kind:"agent",agent:I,managerLabel:I.managerId?e.resolveMember(I.managerId):null,isOwnedBySelf:I.managerId===s,showVisibilityChip:(Y==null?void 0:Y.showVisibilityChip)??!1}),M=c.filter(w).map(I=>R(I,{showVisibilityChip:!0})).sort((I,Y)=>{const z=I.agent.visibility==="private"?0:1,K=Y.agent.visibility==="private"?0:1;return z!==K?z-K:I.agent.displayName.localeCompare(Y.agent.displayName,void 0,{sensitivity:"base"})}),L=f.filter(w).map(I=>R(I)),O=m.filter(w).map(I=>R(I)),B=[];return S&&B.push({key:"yours",title:"Your agents",count:M.length,rows:M,emptyMessage:n?"No agents match this search.":"You haven't created any agents yet. Click New agent above to add one."}),k&&B.push({key:"humans",title:"Humans",count:N.length,rows:N,emptyMessage:n?"No humans match this search.":void 0}),j&&B.push({key:"team",title:"Team agents",count:L.length,rows:L,emptyMessage:n?"No team agents match this search.":"No shared agents from other team members yet."}),C&&O.length>0&&B.push({key:"other-private",title:"Other members' private agents",count:O.length,rows:O,collapsible:!0}),B}function MQ(e){return e.filter(t=>t.type==="personal_assistant"&&t.status==="active")}const DQ=Object.values(DB);function IQ({target:e,isAdmin:t,isSaving:n,onClose:a,onSave:s}){const[o,c]=b.useState(""),[f,m]=b.useState("member"),[h,p]=b.useState(null);b.useEffect(()=>{e&&(c(e.displayName),m(e.role),p(null))},[e]);async function g(w){if(w.preventDefault(),!e)return;const S={};if(o.trim()&&o!==e.displayName&&(S.displayName=o.trim()),t&&f!==e.role&&(S.role=f),Object.keys(S).length===0){a();return}try{await s(S)}catch(k){p(k instanceof Error?k.message:String(k))}}const x=e!==null;return l.jsx(On,{open:x,onOpenChange:w=>w?void 0:a(),children:l.jsxs(Nn,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:"Edit profile"})}),e&&l.jsxs("form",{onSubmit:g,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{children:"Username"}),l.jsx(Ft,{value:e.username,disabled:!0,className:"font-mono"}),l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Username is permanent after creation."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"edit-member-display",children:"Display name"}),l.jsx(Ft,{id:"edit-member-display",value:o,onChange:w=>c(w.target.value),required:!0,maxLength:200})]}),t&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"edit-member-role",children:"Role"}),l.jsx("select",{id:"edit-member-role",value:f,onChange:w=>m(w.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:DQ.map(w=>l.jsx("option",{value:w,children:w},w))}),l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Demoting the last admin is blocked — every org needs at least one admin to manage members."})]}),h&&l.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:h}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:a,disabled:n,children:"Cancel"}),l.jsx(ye,{type:"submit",disabled:n,children:n?"Saving…":"Save"})]})]})]})})}function LQ({target:e,candidates:t,isSaving:n,onClose:a,onSave:s}){const[o,c]=b.useState(""),[f,m]=b.useState(null);b.useEffect(()=>{e&&(c(e.currentDelegate??""),m(null))},[e]);async function h(g){if(g.preventDefault(),!!e){m(null);try{await s(o||null)}catch(x){m(x instanceof Error?x.message:String(x))}}}const p=e!==null;return l.jsx(On,{open:p,onOpenChange:g=>g?void 0:a(),children:l.jsxs(Nn,{children:[l.jsx(Pn,{children:l.jsx(zn,{children:"Set delegate"})}),e&&l.jsxs("form",{onSubmit:h,className:"space-y-4",children:[l.jsxs("p",{className:"text-body",style:{color:"var(--fg-2)"},children:["Pick a personal assistant to act on behalf of ",l.jsx("strong",{children:e.humanDisplayName}),". When teammates @mention this human, the assistant receives the message and can reply in their place."]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(bt,{htmlFor:"set-delegate-pick",children:"Delegate"}),l.jsxs("select",{id:"set-delegate-pick",value:o,onChange:g=>c(g.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"",children:"None — no delegate"}),t.map(g=>l.jsx("option",{value:g.uuid,children:g.displayName?`${g.displayName} (@${g.name??g.uuid})`:g.name?`@${g.name}`:g.uuid},g.uuid))]}),t.length===0&&l.jsxs("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:["No personal assistants available. Create one from the ",l.jsx("em",{children:"New agent"})," button above first."]})]}),f&&l.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:f}),l.jsxs(fr,{children:[l.jsx(ye,{type:"button",variant:"ghost",onClick:a,disabled:n,children:"Cancel"}),l.jsx(ye,{type:"submit",disabled:n,children:n?"Saving…":"Save"})]})]})]})})}function Ih(e,t){return`/orgs/${encodeURIComponent(e)}/settings/${encodeURIComponent(t)}`}function Eb(e){return Ee.get(Ih(e,"context_tree"))}function vT(e,t){return Ee.put(Ih(e,"context_tree"),t)}function bT(e){return Ee.get(Ih(e,"source_repos"))}function xT(e,t){return Ee.put(Ih(e,"source_repos"),t)}function ev({label:e,hint:t,value:n,onChange:a,saved:s=!1,mono:o=!1,type:c="text",placeholder:f,rightSlot:m,readOnly:h=!1,pattern:p}){const g=b.useId(),x=`flex-1 min-w-0 outline-none text-body focus-visible:ring-1 focus-visible:ring-ring ${o?"mono":""}`,w={padding:"var(--sp-1_5) var(--sp-2_5)",background:"var(--bg-sunken)",border:"var(--hairline) solid transparent",borderRadius:"var(--radius-input)",color:"var(--fg)"};return l.jsxs("div",{style:{marginBottom:"var(--sp-4)"},children:[l.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:"var(--sp-2)"},children:[l.jsx("label",{htmlFor:g,className:"text-body font-medium",style:{color:"var(--fg)"},children:e}),s&&l.jsx(PQ,{})]}),t&&l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",margin:"var(--sp-0_5) 0 var(--sp-2)"},children:t}),l.jsxs("div",{className:"flex items-stretch",style:{gap:"var(--sp-2)"},children:[h?l.jsx("input",{id:g,value:n,readOnly:!0,className:x,style:{...w,color:"var(--fg-2)"}}):l.jsx("input",{id:g,value:n,onChange:S=>a==null?void 0:a(S.target.value),type:c,placeholder:f,pattern:p,className:x,style:w}),m]})]})}function PQ(){return l.jsxs("span",{className:"text-label inline-flex items-center fade-in",style:{gap:"var(--sp-1)",color:"color-mix(in oklch, var(--accent) 35%, var(--fg))"},children:[l.jsx(cr,{className:"h-3 w-3"}),"Saved"]})}function wT({pending:e,disabled:t=!1}){const n=e||t;return l.jsx("button",{type:"submit",disabled:n,"aria-label":"Save",title:"Save",className:"settings-save-button",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,width:"var(--sp-8)",background:"transparent",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",padding:0,cursor:n?"default":"pointer",color:"var(--fg-3)",opacity:n?.5:1,transition:"color 0.15s, background 0.15s, border-color 0.15s"},children:e?l.jsx(jE,{className:"h-4 w-4 animate-spin"}):l.jsx(cr,{className:"h-4 w-4"})})}function UQ({isFirst:e=!1}){const{organizationId:t}=vt(),n=gn(),a=Ke({queryKey:["org-setting",t,"context_tree"],queryFn:()=>t?Eb(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,o]=b.useState(""),[c,f]=b.useState(""),[m,h]=b.useState(!1);b.useEffect(()=>{a.data&&(o(a.data.repo??""),f(a.data.branch??"main"))},[a.data]);const p=ht({mutationFn:()=>{if(!t)throw new Error("organization not loaded");return vT(t,{repo:s.trim()?s.trim():null,branch:c.trim()?c.trim():null})},onSuccess:x=>{n.setQueryData(["org-setting",t,"context_tree"],x),h(!0),setTimeout(()=>h(!1),2e3)}}),g=x=>{x.preventDefault(),p.mutate()};return l.jsx(Fc,{title:"Context tree",description:"Changes apply to new agent sessions. Members should restart agents to pick up updated tree contents.",isFirst:e,children:a.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):a.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:a.error instanceof Error?a.error.message:"Failed to load setting"}):l.jsxs("form",{onSubmit:g,children:[l.jsx(ev,{label:"Repo URL",hint:"HTTPS URL of the Context Tree git repository for this team.",value:s,onChange:o,mono:!0,placeholder:"https://github.com/your-org/first-tree-context"}),l.jsx(ev,{label:"Branch",hint:"Branch checked out by client agents on startup.",value:c,onChange:f,mono:!0,placeholder:"main",saved:m,rightSlot:l.jsx(wT,{pending:p.isPending,disabled:!a.data})}),p.error instanceof Error&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:p.error.message})]})})}function BQ({isFirst:e=!1}){var h;const{organizationId:t,role:n}=vt(),a=n==="admin",s=gn(),o=Ke({queryKey:["org-setting",t,"source_repos"],queryFn:()=>t?bT(t):Promise.reject(new Error("no org")),enabled:!!t}),c=ht({mutationFn:async p=>{var w;if(!t)throw new Error("organization not loaded");const x=(((w=o.data)==null?void 0:w.repos)??[]).filter(S=>S.url!==p);return xT(t,{repos:x})},onSuccess:p=>{s.setQueryData(["org-setting",t,"source_repos"],p)}}),f=((h=o.data)==null?void 0:h.repos)??[],m=f.length>0?l.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:f.length}):null;return l.jsxs(Fc,{title:"Source repos",description:a?"Repos your team's agents are bound to. New repos are added during agent onboarding.":"Repos your team's agents are bound to. Read-only — only admins can edit.",right:m,isFirst:e,children:[o.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):o.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:o.error instanceof Error?o.error.message:"Failed to load setting"}):f.length===0?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)",padding:"var(--sp-3) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)"},children:"No source repos bound yet."}):l.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:f.map(p=>l.jsx(FQ,{url:p.url,defaultBranch:p.defaultBranch,isAdmin:a,isRemoving:c.isPending,onRemove:()=>c.mutate(p.url)},p.url))}),c.error instanceof Error&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)",marginTop:"var(--sp-2)"},children:c.error.message})]})}function FQ({url:e,defaultBranch:t,isAdmin:n,isRemoving:a,onRemove:s}){return l.jsxs("li",{className:"group flex items-center",style:{gap:"var(--sp-3)",padding:"var(--sp-2) var(--sp-2_5)",borderRadius:"var(--radius-input)"},children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-body mono",style:{color:"var(--fg)",overflowWrap:"anywhere"},children:e}),t&&l.jsxs("div",{className:"text-label",style:{color:"var(--fg-4)",marginTop:"var(--sp-0_5)"},children:["branch: ",t]})]}),n&&l.jsx("button",{type:"button","aria-label":`Remove ${e}`,disabled:a,onClick:s,className:"opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,border:0,borderRadius:"var(--radius-input)",background:"transparent",color:"var(--fg-3)",cursor:a?"not-allowed":"pointer",flexShrink:0},onMouseEnter:o=>{o.currentTarget.style.background="var(--surface-2)",o.currentTarget.style.color="var(--fg)"},onMouseLeave:o=>{o.currentTarget.style.background="transparent",o.currentTarget.style.color="var(--fg-3)"},children:l.jsx(os,{className:"h-3.5 w-3.5"})})]})}function $Q(e){return Ee.get(`/orgs/${encodeURIComponent(e)}`)}function HQ(e,t){return Ee.patch(`/orgs/${encodeURIComponent(e)}`,t)}function qQ({isFirst:e=!1}){const{organizationId:t}=vt(),n=gn(),a=Ke({queryKey:["organization",t],queryFn:()=>t?$Q(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,o]=b.useState(""),[c,f]=b.useState(!1);b.useEffect(()=>{a.data&&o(a.data.displayName)},[a.data]);const m=ht({mutationFn:()=>{if(!t||!a.data)throw new Error("organization not loaded");const p=s.trim();return!p||p===a.data.displayName?Promise.resolve(a.data):HQ(t,{displayName:p})},onSuccess:p=>{n.setQueryData(["organization",t],p),n.invalidateQueries({queryKey:["me-organizations"]}),f(!0),setTimeout(()=>f(!1),2e3)}}),h=p=>{p.preventDefault(),m.mutate()};return l.jsx(Fc,{title:"Identity",isFirst:e,children:a.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):a.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:a.error instanceof Error?a.error.message:"Failed to load team"}):l.jsxs("form",{onSubmit:h,children:[l.jsx(ev,{label:"Team name",hint:"Shown in the team switcher and dashboard header.",value:s,onChange:o,saved:c,rightSlot:l.jsx(wT,{pending:m.isPending,disabled:!a.data})}),m.error instanceof Error&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:m.error.message})]})})}function ZQ(){const{role:e}=vt(),t=e==="admin";return l.jsxs("div",{children:[t&&l.jsx(qQ,{isFirst:!0}),t&&l.jsx(UQ,{}),l.jsx(BQ,{isFirst:!t})]})}function GQ(){const{role:e}=vt();if(e===null)return l.jsx("div",{className:"text-body",style:{padding:"var(--sp-5)",color:"var(--fg-3)"},children:"Loading..."});const t=e==="admin"?"Identity, Context Tree, source repos":"Repos your team's agents are bound to";return l.jsxs(l.Fragment,{children:[l.jsx(al,{title:"Team settings",subtitle:t}),l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:l.jsx(ZQ,{})})]})}function th(e){const t=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.filter&&t.set("filter",e.filter),e!=null&&e.engagement&&t.set("engagement",e.engagement);const n=t.toString();return Ee.get(Rn(`/chats${n?`?${n}`:""}`))}function VQ(e){return Ee.post(Rn("/chats"),e)}function QQ(e){return Ee.post(`/chats/${encodeURIComponent(e)}/read`)}function ST(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/participants`,t)}function KQ(e){return Ee.post(`/chats/${encodeURIComponent(e)}/workspace-join`)}function kT(e){return Ee.get(`/chats/${encodeURIComponent(e)}`)}function YQ(e,t){return Ee.patch(`/chats/${encodeURIComponent(e)}`,{topic:t})}function jT(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/engagement`,{status:t})}function jo(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"text",content:t})}function XQ(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"file",content:t})}function WQ(e){return new Promise((t,n)=>{const a=new FileReader;a.onload=()=>{const s=a.result;if(typeof s!="string"){n(new Error("Unexpected FileReader result"));return}const o=s.indexOf(",");t(o>=0?s.slice(o+1):s)},a.onerror=()=>n(a.error??new Error("FileReader error")),a.readAsDataURL(e)})}function Cb(e){return Ee.post(`/agents/${encodeURIComponent(e)}/chats`,{})}function JQ(e,t){const n=new URLSearchParams;n.set("limit",String(t.limit)),t!=null&&t.cursor&&n.set("cursor",t.cursor);const a=n.toString();return Ee.get(`/chats/${encodeURIComponent(e)}/messages${a?`?${a}`:""}`)}const{ACTIVE:Qk,ARCHIVED:Kk,DELETED:Yk}=Py;function eK(e,t){return e===Qk?[{key:"archive",label:"Archive",onSelect:()=>t(Kk)},{key:"delete",label:"Delete",destructive:!0,onSelect:()=>t(Yk)}]:e===Kk?[{key:"unarchive",label:"Unarchive",onSelect:()=>t(Qk)},{key:"delete",label:"Delete",destructive:!0,onSelect:()=>t(Yk)}]:[]}const tK="opacity-0 group-hover:opacity-100 focus-visible:opacity-100 aria-expanded:opacity-100";function nK({chatId:e,status:t}){const n=gn(),a=ht({mutationFn:o=>jT(e,o),onSuccess:()=>{n.invalidateQueries({queryKey:["me","chats"]}),n.invalidateQueries({queryKey:["chat-detail",e]})}}),s=eK(t,o=>a.mutate(o));return l.jsx(kb,{actions:s,ariaLabel:"Manage chat",triggerClassName:tK})}const nh="draft",rK=[{value:"active",label:"Active"},{value:"archived",label:"Archived"},{value:"all",label:"All"}];function aK(e){if(!e)return"";const t=new Date(e),a=Date.now()-t.getTime();if(a<6e4)return"now";if(a<60*6e4)return`${Math.round(a/6e4)}m`;if(a<1440*6e4)return`${Math.round(a/36e5)}h`;const s=new Intl.DateTimeFormat("en-GB",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(t),o=c=>{var f;return((f=s.find(m=>m.type===c))==null?void 0:f.value)??""};return`${o("month")}/${o("day")} ${o("hour")}:${o("minute")}`}function iK(e){return e.membershipKind==="watching"?e.lastMessagePreview?`Watching · ${e.lastMessagePreview}`:"Watching":e.lastMessagePreview??""}function sK({selectedChatId:e,onSelectChat:t,onNewChat:n,engagement:a,onEngagementChange:s}){const[o,c]=b.useState("all"),[f,m]=b.useState(""),[h,p]=b.useState([]),[g,x]=b.useState(!1),[w,S]=b.useState(null),{data:k,isLoading:j}=Ke({queryKey:["me","chats",o,a],queryFn:()=>th({filter:o,engagement:a}),refetchInterval:15e3}),C=()=>{h.length>0&&p([]),S(null)},N=(k==null?void 0:k.rows)??[],R=b.useMemo(()=>[...N,...h],[N,h]),M=b.useMemo(()=>{const z=f.trim().toLowerCase();return z?R.filter(K=>K.title.toLowerCase().includes(z)||(K.lastMessagePreview??"").toLowerCase().includes(z)?!0:K.participants.map(W=>W.displayName.toLowerCase()).join(" ").includes(z)):R},[R,f]),L=async()=>{if(g)return;const z=k==null?void 0:k.nextCursor;if(z){x(!0),S(null);try{const K=await th({filter:o,engagement:a,cursor:z});p(ie=>[...ie,...K.rows]),B(K.nextCursor)}catch(K){S(K instanceof Error?K.message:"Failed to load more")}finally{x(!1)}}},[O,B]=b.useState(null),I=(k==null?void 0:k.nextCursor)??null;b.useEffect(()=>{B(I)},[I]);const Y=b.useMemo(()=>R.reduce((z,K)=>z+(K.unreadMentionCount>0?1:0),0),[R]);return l.jsxs("aside",{className:"shrink-0 flex flex-col overflow-hidden",style:{width:320,background:"var(--bg-raised)",borderRight:"var(--hairline) solid var(--border)"},children:[l.jsxs("div",{className:"shrink-0 flex flex-col",style:{gap:6,padding:"var(--sp-2_5) var(--sp-3) var(--sp-2)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[l.jsxs("button",{type:"button",onClick:n,className:"w-full inline-flex items-center transition-colors text-body hover:bg-[var(--bg-hover)]",style:{gap:6,padding:"var(--sp-1_25) var(--sp-2)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:e===nh?"var(--bg-active)":"transparent",color:e===nh?"var(--accent)":"var(--fg)",cursor:"pointer",fontWeight:500},title:"New chat",children:[l.jsx(xa,{className:"h-3.5 w-3.5",strokeWidth:2}),"New chat"]}),l.jsx("div",{className:"flex items-center",style:{gap:4},children:rK.map(z=>l.jsx(eh,{active:a===z.value,onClick:()=>{a!==z.value&&(s(z.value),C())},children:z.label},z.value))}),l.jsxs("div",{className:"flex items-center",style:{gap:8},children:[l.jsx("div",{className:"flex gap-1 shrink-0",children:Y>0&&l.jsx(eh,{active:o==="unread",count:Y,onClick:()=>{c(o==="unread"?"all":"unread"),C()},children:"unread"})}),l.jsxs("div",{className:"relative",style:{flex:1,minWidth:0},children:[l.jsx(ch,{className:"h-3 w-3 absolute pointer-events-none",style:{left:4,top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)"}}),l.jsx("input",{value:f,onChange:z=>m(z.target.value),placeholder:"Search…",className:"w-full outline-none text-caption",style:{padding:"var(--sp-0_5) var(--sp-1) var(--sp-0_5) var(--sp-5)",background:"transparent",border:"none",color:"var(--fg-2)"}})]})]})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto",children:[j&&M.length===0&&l.jsx("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:"Loading…"}),!j&&M.length===0&&l.jsx("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:f?"No matches":l.jsxs(l.Fragment,{children:[l.jsx("p",{style:{margin:0},children:"No conversations yet."}),l.jsx("p",{className:"text-label",style:{margin:"var(--sp-1) 0 0",color:"var(--fg-4)"},children:"Start with New chat."})]})}),M.map(z=>{const K=e===z.chatId,ie=iK(z),ve=ie&&ie!==z.title?ie:"",J=z.unreadMentionCount>0;return l.jsxs("div",{className:"group relative",style:{borderBottom:"var(--hairline) solid var(--border-faint)"},children:[l.jsxs("button",{type:"button",onClick:()=>t(z.chatId),className:ze("w-full text-left transition-colors flex flex-col","hover:bg-[var(--bg-hover)]"),style:{padding:"var(--sp-2) var(--sp-3)",background:K?"var(--bg-active)":"transparent",borderLeft:`var(--hairline-bold) solid ${K?"var(--accent)":"transparent"}`},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:6},children:[J&&l.jsx("span",{"aria-label":`${z.unreadMentionCount} unread mentions`,role:"status",style:{width:6,height:6,borderRadius:"50%",background:"var(--state-error)",flexShrink:0,alignSelf:"center"}}),l.jsx("span",{className:"truncate text-subtitle",style:{color:J?"var(--fg)":"var(--fg-2)",fontWeight:J?700:500,flex:1,minWidth:0},children:z.title}),z.lastMessageAt&&l.jsx("span",{className:"mono text-caption shrink-0 transition-opacity group-hover:opacity-0 group-has-aria-expanded:opacity-0",style:{color:"var(--fg-4)"},children:aK(z.lastMessageAt)})]}),l.jsx("div",{className:"truncate text-body",style:{color:J?"var(--fg-2)":"var(--fg-3)",marginTop:2},children:ve||"—"})]}),l.jsx("div",{className:"absolute",style:{top:"var(--sp-2)",right:"var(--sp-3)"},children:l.jsx(nK,{chatId:z.chatId,status:z.engagementStatus})})]},z.chatId)}),O&&M.length>0&&l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3)"},children:[l.jsx("button",{type:"button",onClick:L,disabled:g,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:g?"default":"pointer",opacity:g?.6:1},children:g?"Loading…":"Load more"}),w&&l.jsx("p",{className:"mono text-caption",style:{color:"var(--state-error)",marginTop:4},children:w})]})]})]})}function Nb(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 lK(e,t){return!e.name||!e.displayName?!1:e.displayName!==e.name?!0:t.has(e.displayName)}function _b({candidate:e,ambiguous:t}){const n=e.name?`@${e.name}`:"—";return l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"font-medium",children:e.displayName??n}),lK(e,t)&&l.jsxs("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:["@",e.name]})]})}function oK(e,t){if(t<=0||t>e.length)return null;let n=t-1;for(;n>=0;){const s=e[n];if(s===void 0)return null;if(s==="@")break;if(!/[A-Za-z0-9_-]/.test(s))return null;n--}if(n<0||e[n]!=="@")return null;if(n>0){const s=e[n-1];if(s!==void 0&&/[A-Za-z0-9_.@-]/.test(s))return null}const a=e.slice(n+1,t).toLowerCase();return{triggerIndex:n,query:a}}function Xk(e,t){return(e.displayName??e.name??"").localeCompare(t.displayName??t.name??"")}function Tb(e){const t=e.filter(a=>a.managedByMe).sort(Xk),n=e.filter(a=>!a.managedByMe).sort(Xk);return t.length>0&&n.length>0?[...t,{divider:!0},...n]:[...t,...n]}function uK(e,t){if(!t)return Tb(e).filter(a=>!("divider"in a)).slice(0,8);const n=[];for(const a of e){const s=(a.name??"").toLowerCase(),o=(a.displayName??"").toLowerCase();let c=1/0;s.startsWith(t)?c=0:o.startsWith(t)?c=1:o.includes(t)&&(c=2),c!==1/0&&n.push({c:a,score:c})}return n.sort((a,s)=>a.score-s.score||(a.c.displayName??"").localeCompare(s.c.displayName??"")),n.slice(0,8).map(a=>a.c)}function cK(e,t,n,a){if(!a.name)return null;const s=e.slice(0,t.triggerIndex),o=e.slice(n),c=`@${a.name}`,f=o.length===0||!/\s/.test(o[0]??""),m=f?` ${o}`:o,h=`${s}${c}${m}`,p=s.length+c.length+(f?1:0);return{text:h,cursor:p}}function ET({value:e,cursor:t,candidates:n,onSelect:a,disabled:s}){const[o,c]=b.useState(0),[f,m]=b.useState(null),h=b.useMemo(()=>s?null:oK(e,t),[e,t,s]),p=b.useMemo(()=>h?uK(n,h.query):[],[h,n]),g=h?`${h.triggerIndex}:${h.query}`:"";b.useEffect(()=>{c(0)},[g]),b.useEffect(()=>{h===null&&f!==null&&m(null)},[h,f]);const x=f!==null&&h!==null&&f===h.triggerIndex,w=h!==null&&p.length>0&&!x;function S(){m((h==null?void 0:h.triggerIndex)??null)}function k(C){if(!h)return;const N=cK(e,h,t,C);N&&a(N)}return{trigger:w?h:null,results:w?p:[],highlightIndex:o,handleKey:C=>{if(!w||!h)return!1;if(C.key==="ArrowDown")return C.preventDefault(),c(N=>p.length===0?0:(N+1)%p.length),!0;if(C.key==="ArrowUp")return C.preventDefault(),c(N=>p.length===0?0:(N-1+p.length)%p.length),!0;if(C.key==="Enter"||C.key==="Tab"){const N=p[o]??p[0];return N?(C.preventDefault(),k(N),!0):!1}return C.key==="Escape"?(C.preventDefault(),S(),!0):!1},pick:k,dismiss:S}}function CT({trigger:e,results:t,highlightIndex:n,onPick:a,anchorRef:s}){const o=b.useRef(null);return b.useEffect(()=>{var m;const f=(m=o.current)==null?void 0:m.querySelector(`[data-mention-index="${n}"]`);f==null||f.scrollIntoView({block:"nearest"})},[n]),!e||t.length===0||!s.current?null:l.jsx("div",{ref:o,role:"listbox","aria-label":"Mention suggestions",className:ze("absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg"),style:{bottom:"calc(100% + var(--sp-1))",left:0,minWidth:240,maxWidth:360,background:"var(--bg-raised)",borderColor:"var(--border)"},children:(()=>{const f=Nb(t);return t.map((m,h)=>{const p=h===n;return l.jsx("button",{type:"button",role:"option","aria-selected":p,"data-mention-index":h,title:m.name?`@${m.name}`:void 0,onMouseDown:g=>{g.preventDefault(),a(m)},className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:p?"var(--bg-hover)":"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:l.jsx(_b,{candidate:m,ambiguous:f})},m.agentId)})})()})}function NT(e,t){b.useLayoutEffect(()=>{const n=e.current;n&&(n.style.height="auto",n.style.height=`${n.scrollHeight}px`)},[e,t])}function dK({onCreated:e}){const t=gn(),{agentId:n}=vt(),a=Uv(),[s,o]=b.useState([]),[c,f]=b.useState(""),[m,h]=b.useState(0),[p,g]=b.useState(null),[x,w]=b.useState(!1),[S,k]=b.useState(!1),j=b.useRef(null),C=b.useRef(!1),N=b.useRef(null);NT(j,c);const{data:R}=Ke({queryKey:["activity"],queryFn:Oc,refetchInterval:15e3}),M=b.useMemo(()=>{const J=(R==null?void 0:R.agents)??[],W=[];for(const Z of J){if(n&&Z.agentId===n)continue;const ne=a(Z.agentId);!ne||!ne.name||W.push({agentId:Z.agentId,name:ne.name,displayName:ne.displayName,managedByMe:Z.managedByMe})}return W},[R,a,n]);b.useEffect(()=>{if(C.current||s.length>0||M.length===0)return;const J=hK(M,(R==null?void 0:R.agents)??[]);J&&(o([J]),C.current=!0)},[M,R,s.length]);const L=b.useMemo(()=>{const J=M.map(W=>({agentId:W.agentId,name:W.name}));return jN(c,J)},[c,M]),O=ET({value:c,cursor:m,candidates:M,disabled:x,onSelect:J=>{f(J.text),h(J.cursor),requestAnimationFrame(()=>{const W=j.current;W&&(W.focus(),W.setSelectionRange(J.cursor,J.cursor))})}});b.useEffect(()=>{L.length!==0&&o(J=>{const W=new Set(J);let Z=!1;for(const ne of L)W.has(ne)||(W.add(ne),Z=!0);return Z?[...W]:J})},[L]),b.useEffect(()=>{if(!S)return;const J=W=>{N.current&&(N.current.contains(W.target)||k(!1))};return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[S]);const B=ht({mutationFn:async({participantIds:J,text:W})=>{const Z=await VQ({participantIds:J}),ne=W.trim();return ne.length>0&&await jo(Z.chatId,ne),Z.chatId},onSuccess:J=>{f(""),o([]),C.current=!1,t.invalidateQueries({queryKey:["me","chats"]}),e(J)},onError:J=>{g(J instanceof Error?J.message:"Failed to create chat")}}),I=b.useMemo(()=>!(x||B.isPending||s.length===0||c.trim().length===0||s.length>=2&&L.length===0),[x,B.isPending,s.length,c,L.length]),Y=b.useMemo(()=>s.length===0?"Add at least one participant":c.trim().length===0?null:s.length>=2&&L.length===0?"Group chats need an @ to wake at least one participant":null,[s.length,c,L.length]),z=async()=>{if(!I)return;const J=Array.from(new Set([...s,...L]));g(null),w(!0);try{await B.mutateAsync({participantIds:J,text:c})}finally{w(!1)}},K=J=>{o(W=>W.filter(Z=>Z!==J))},ie=J=>{o(W=>W.includes(J)?W:[...W,J]),k(!1)},ve=b.useMemo(()=>M.filter(J=>!s.includes(J.agentId)),[M,s]);return l.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",style:{background:"var(--bg-base)"},children:l.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",style:{padding:"var(--sp-6)"},children:l.jsxs("div",{style:{width:"100%",maxWidth:"clamp(55rem, 75%, 70rem)"},children:[l.jsx("p",{className:"text-title",style:{color:"var(--fg)",textAlign:"center",marginBottom:"var(--sp-5)"},children:"What's the task?"}),l.jsxs("div",{style:{borderRadius:10,background:"var(--bg-raised)",boxShadow:"var(--shadow-md)",overflow:"visible"},children:[l.jsx(fK,{chips:s,candidates:M,chipCandidates:ve,pickerOpen:S,setPickerOpen:k,pickerContainerRef:N,onAdd:ie,onRemove:K}),l.jsxs("div",{style:{position:"relative"},children:[l.jsx(CT,{trigger:O.trigger,results:O.results,highlightIndex:O.highlightIndex,anchorRef:j,onPick:O.pick}),l.jsx("textarea",{ref:j,value:c,onChange:J=>{f(J.target.value),h(J.target.selectionStart??J.target.value.length)},onSelect:J=>{h(J.currentTarget.selectionStart??c.length)},placeholder:s.length>=2?"Describe the task. Use @ to address one or more.":"Describe the task…",rows:1,onKeyDown:J=>{O.handleKey(J)||J.key==="Enter"&&!J.shiftKey&&(J.preventDefault(),z())},disabled:x||B.isPending,className:"w-full outline-none text-subtitle font-normal",style:{padding:"var(--sp-2) var(--sp-3)",background:"transparent",border:"none",maxHeight:"10.5rem",overflowY:"auto",resize:"none",color:"var(--fg)"}}),s.length>=2&&L.length===0&&c.trim().length>0&&l.jsxs("div",{"aria-hidden":"true",className:"text-subtitle font-normal",style:{position:"absolute",inset:0,padding:"var(--sp-2) var(--sp-3)",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",pointerEvents:"none",color:"transparent",overflow:"hidden"},children:[c,l.jsx("span",{style:{color:"var(--fg-4)"},children:" ← @ a group member to send"})]})]}),l.jsx("div",{className:"flex items-center justify-end",style:{padding:"var(--sp-1_5) var(--sp-2_5)"},children:l.jsx("button",{type:"button",onClick:()=>void z(),disabled:!I,title:Y??"Send (Enter)","aria-label":"Send",className:ze("inline-flex items-center justify-center transition-opacity",!I&&"opacity-40 cursor-not-allowed"),style:{width:28,height:28,borderRadius:"var(--radius-input)",background:"var(--fg)",color:"var(--bg-raised)",border:"none"},children:l.jsx(bE,{className:"h-3.5 w-3.5",strokeWidth:2.5})})})]}),p&&l.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)",marginTop:8},children:p})]})})})}function fK({chips:e,candidates:t,chipCandidates:n,pickerOpen:a,setPickerOpen:s,pickerContainerRef:o,onAdd:c,onRemove:f}){return l.jsxs("div",{className:"flex items-center flex-wrap",style:{gap:6,padding:"var(--sp-1_5) var(--sp-2_5) var(--sp-1)"},children:[e.map(m=>{const h=t.find(g=>g.agentId===m),p=(h==null?void 0:h.displayName)??(h==null?void 0:h.name)??m;return l.jsxs("span",{className:"group inline-flex items-center text-label",style:{gap:2,padding:"var(--sp-0_5) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"var(--bg-sunken)",color:"var(--fg)"},children:[l.jsx("span",{children:p}),l.jsx("button",{type:"button",onClick:()=>f(m),title:"Remove participant",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{background:"none",border:"none",padding:0,marginLeft:2,cursor:"pointer",color:"var(--fg-3)",display:"inline-flex",alignItems:"center"},children:l.jsx(os,{className:"h-3 w-3"})})]},m)}),l.jsxs("div",{ref:o,style:{position:"relative"},children:[l.jsx("button",{type:"button",onClick:()=>s(!a),title:"Add participant","aria-label":"Add participant",disabled:n.length===0,className:"inline-flex items-center transition-colors hover:bg-[var(--bg-sunken)]",style:{padding:"var(--sp-0_5) var(--sp-1)",borderRadius:"var(--radius-chip)",border:"var(--hairline) solid var(--border)",background:"transparent",color:n.length===0?"var(--fg-4)":"var(--fg-3)",cursor:n.length===0?"not-allowed":"pointer"},children:l.jsx(xa,{className:"h-3 w-3"})}),a&&n.length>0&&l.jsx("div",{role:"listbox","aria-label":"Add participant",className:"absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg",style:{top:"calc(100% + var(--sp-1))",left:0,minWidth:280,background:"var(--bg-raised)",borderColor:"var(--border)"},children:(()=>{const m=Nb(n);return Tb(n).map(h=>"divider"in h?l.jsx("div",{role:"presentation",style:{height:"var(--hairline)",background:"var(--border-faint)",margin:"var(--sp-0_5) var(--sp-3)"}},"__divider"):l.jsx("button",{type:"button",role:"option","aria-selected":"false",title:h.name?`@${h.name}`:void 0,onClick:()=>c(h.agentId),className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:l.jsx(_b,{candidate:h,ambiguous:m})},h.agentId))})()})]})]})}function hK(e,t){var c;const n=new Set(e.map(f=>f.agentId)),a=t.filter(f=>n.has(f.agentId)&&f.managedByMe);if(a.length===0)return null;const s=[...a].filter(f=>f.runtimeUpdatedAt).sort((f,m)=>(m.runtimeUpdatedAt??"").localeCompare(f.runtimeUpdatedAt??""))[0];if(s)return s.agentId;const o=a.find(f=>f.type==="personal_assistant");return o?o.agentId:((c=a[0])==null?void 0:c.agentId)??null}const mK="first-tree-hub-images",pK=1,Eo="images";let jf=null;function _T(){return jf||(jf=new Promise(e=>{if(typeof indexedDB>"u"){e(null);return}const t=indexedDB.open(mK,pK);t.onupgradeneeded=()=>{const n=t.result;n.objectStoreNames.contains(Eo)||n.createObjectStore(Eo,{keyPath:"imageId"})},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null),t.onblocked=()=>e(null)}),jf)}async function gK(e){const t=await _T();if(!t)throw new Error("Image storage unavailable (IndexedDB disabled or blocked)");await new Promise((n,a)=>{const s=t.transaction(Eo,"readwrite"),o=s.objectStore(Eo),c={imageId:e.imageId,base64:e.base64,mimeType:e.mimeType,createdAt:Date.now()};o.put(c),s.oncomplete=()=>n(),s.onerror=()=>a(s.error??new Error("Image storage write failed")),s.onabort=()=>a(s.error??new Error("Image storage write aborted"))})}async function yK(e){const t=await _T();return t?new Promise(n=>{const o=t.transaction(Eo,"readonly").objectStore(Eo).get(e);o.onsuccess=()=>{const c=o.result;if(!c){n(null);return}n({base64:c.base64,mimeType:c.mimeType})},o.onerror=()=>n(null)}):null}function vK(e,t,n){return Ee.post(`/chats/${encodeURIComponent(e)}/questions/${encodeURIComponent(t)}/answer`,{answers:n})}/*! @license DOMPurify 3.4.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.2/LICENSE */const{entries:TT,setPrototypeOf:Wk,isFrozen:bK,getPrototypeOf:xK,getOwnPropertyDescriptor:wK}=Object;let{freeze:dr,seal:sa,create:Kl}=Object,{apply:tv,construct:nv}=typeof Reflect<"u"&&Reflect;dr||(dr=function(t){return t});sa||(sa=function(t){return t});tv||(tv=function(t,n){for(var a=arguments.length,s=new Array(a>2?a-2:0),o=2;o<a;o++)s[o-2]=arguments[o];return t.apply(n,s)});nv||(nv=function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];return new t(...a)});const qu=Cn(Array.prototype.forEach),SK=Cn(Array.prototype.lastIndexOf),Jk=Cn(Array.prototype.pop),Zu=Cn(Array.prototype.push),kK=Cn(Array.prototype.splice),sr=Array.isArray,Xu=Cn(String.prototype.toLowerCase),Fg=Cn(String.prototype.toString),ej=Cn(String.prototype.match),Zl=Cn(String.prototype.replace),tj=Cn(String.prototype.indexOf),jK=Cn(String.prototype.trim),EK=Cn(Number.prototype.toString),CK=Cn(Boolean.prototype.toString),nj=typeof BigInt>"u"?null:Cn(BigInt.prototype.toString),rj=typeof Symbol>"u"?null:Cn(Symbol.prototype.toString),an=Cn(Object.prototype.hasOwnProperty),Gu=Cn(Object.prototype.toString),qn=Cn(RegExp.prototype.test),Ef=NK(TypeError);function Cn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];return tv(e,t,a)}}function NK(e){return function(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return nv(e,n)}}function We(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Xu;if(Wk&&Wk(e,null),!sr(t))return e;let a=t.length;for(;a--;){let s=t[a];if(typeof s=="string"){const o=n(s);o!==s&&(bK(t)||(t[a]=o),s=o)}e[s]=!0}return e}function _K(e){for(let t=0;t<e.length;t++)an(e,t)||(e[t]=null);return e}function wr(e){const t=Kl(null);for(const[n,a]of TT(e))an(e,n)&&(sr(a)?t[n]=_K(a):a&&typeof a=="object"&&a.constructor===Object?t[n]=wr(a):t[n]=a);return t}function TK(e){switch(typeof e){case"string":return e;case"number":return EK(e);case"boolean":return CK(e);case"bigint":return nj?nj(e):"0";case"symbol":return rj?rj(e):"Symbol()";case"undefined":return Gu(e);case"function":case"object":{if(e===null)return Gu(e);const t=e,n=Yl(t,"toString");if(typeof n=="function"){const a=n(t);return typeof a=="string"?a:Gu(a)}return Gu(e)}default:return Gu(e)}}function Yl(e,t){for(;e!==null;){const a=wK(e,t);if(a){if(a.get)return Cn(a.get);if(typeof a.value=="function")return Cn(a.value)}e=xK(e)}function n(){return null}return n}function AK(e){try{return qn(e,""),!0}catch{return!1}}const aj=dr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),$g=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"]),Hg=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"]),RK=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"]),qg=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"]),OK=dr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ij=dr(["#text"]),sj=dr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Zg=dr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),lj=dr(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Cf=dr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),zK=sa(/\{\{[\w\W]*|[\w\W]*\}\}/gm),MK=sa(/<%[\w\W]*|[\w\W]*%>/gm),DK=sa(/\$\{[\w\W]*/gm),IK=sa(/^data-[\-\w.\u00B7-\uFFFF]+$/),LK=sa(/^aria-[\-\w]+$/),AT=sa(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),PK=sa(/^(?:\w+script|data):/i),UK=sa(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),RT=sa(/^html$/i),BK=sa(/^[a-z][.\w]*(-[.\w]+)+$/i);var oj=Object.freeze({__proto__:null,ARIA_ATTR:LK,ATTR_WHITESPACE:UK,CUSTOM_ELEMENT:BK,DATA_ATTR:IK,DOCTYPE_NAME:RT,ERB_EXPR:MK,IS_ALLOWED_URI:AT,IS_SCRIPT_OR_DATA:PK,MUSTACHE_EXPR:zK,TMPLIT_EXPR:DK});const Vu={element:1,text:3,progressingInstruction:7,comment:8,document:9},FK=function(){return typeof window>"u"?null:window},$K=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let a=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(a=n.getAttribute(s));const o="dompurify"+(a?"#"+a:"");try{return t.createPolicy(o,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},uj=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function OT(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:FK();const t=Ue=>OT(Ue);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Vu.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const a=n,s=a.currentScript,{DocumentFragment:o,HTMLTemplateElement:c,Node:f,Element:m,NodeFilter:h,NamedNodeMap:p=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:x,trustedTypes:w}=e,S=m.prototype,k=Yl(S,"cloneNode"),j=Yl(S,"remove"),C=Yl(S,"nextSibling"),N=Yl(S,"childNodes"),R=Yl(S,"parentNode");if(typeof c=="function"){const Ue=n.createElement("template");Ue.content&&Ue.content.ownerDocument&&(n=Ue.content.ownerDocument)}let M,L="";const{implementation:O,createNodeIterator:B,createDocumentFragment:I,getElementsByTagName:Y}=n,{importNode:z}=a;let K=uj();t.isSupported=typeof TT=="function"&&typeof R=="function"&&O&&O.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ie,ERB_EXPR:ve,TMPLIT_EXPR:J,DATA_ATTR:W,ARIA_ATTR:Z,IS_SCRIPT_OR_DATA:ne,ATTR_WHITESPACE:ke,CUSTOM_ELEMENT:Ae}=oj;let{IS_ALLOWED_URI:D}=oj,P=null;const F=We({},[...aj,...$g,...Hg,...qg,...ij]);let T=null;const G=We({},[...sj,...Zg,...lj,...Cf]);let q=Object.seal(Kl(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ae=null,be=null;const we=Object.seal(Kl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let me=!0,Me=!0,Ie=!1,St=!0,tt=!1,it=!0,V=!1,pe=!1,_e=!1,Pe=!1,Mt=!1,Pt=!1,hr=!0,pi=!1;const gi="user-content-";let cn=!0,da=!1,oe={},ge=null;const $e=We({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ve=null;const st=We({},["audio","video","img","source","image","track"]);let dn=null;const tr=We({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),qt="http://www.w3.org/1998/Math/MathML",Ut="http://www.w3.org/2000/svg",At="http://www.w3.org/1999/xhtml";let lt=At,nr=!1,Mn=null;const il=We({},[qt,Ut,At],Fg);let fa=We({},["mi","mo","mn","ms","mtext"]),ha=We({},["annotation-xml"]);const Ma=We({},["title","style","font","a","script"]);let Vn=null;const Da=["application/xhtml+xml","text/html"],Sa="text/html";let Zt=null,je=null;const nt=n.createElement("form"),yn=function($){return $ instanceof RegExp||$ instanceof Function},Ar=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(je&&je===$)return;(!$||typeof $!="object")&&($={}),$=wr($),Vn=Da.indexOf($.PARSER_MEDIA_TYPE)===-1?Sa:$.PARSER_MEDIA_TYPE,Zt=Vn==="application/xhtml+xml"?Fg:Xu,P=an($,"ALLOWED_TAGS")&&sr($.ALLOWED_TAGS)?We({},$.ALLOWED_TAGS,Zt):F,T=an($,"ALLOWED_ATTR")&&sr($.ALLOWED_ATTR)?We({},$.ALLOWED_ATTR,Zt):G,Mn=an($,"ALLOWED_NAMESPACES")&&sr($.ALLOWED_NAMESPACES)?We({},$.ALLOWED_NAMESPACES,Fg):il,dn=an($,"ADD_URI_SAFE_ATTR")&&sr($.ADD_URI_SAFE_ATTR)?We(wr(tr),$.ADD_URI_SAFE_ATTR,Zt):tr,Ve=an($,"ADD_DATA_URI_TAGS")&&sr($.ADD_DATA_URI_TAGS)?We(wr(st),$.ADD_DATA_URI_TAGS,Zt):st,ge=an($,"FORBID_CONTENTS")&&sr($.FORBID_CONTENTS)?We({},$.FORBID_CONTENTS,Zt):$e,ae=an($,"FORBID_TAGS")&&sr($.FORBID_TAGS)?We({},$.FORBID_TAGS,Zt):wr({}),be=an($,"FORBID_ATTR")&&sr($.FORBID_ATTR)?We({},$.FORBID_ATTR,Zt):wr({}),oe=an($,"USE_PROFILES")?$.USE_PROFILES&&typeof $.USE_PROFILES=="object"?wr($.USE_PROFILES):$.USE_PROFILES:!1,me=$.ALLOW_ARIA_ATTR!==!1,Me=$.ALLOW_DATA_ATTR!==!1,Ie=$.ALLOW_UNKNOWN_PROTOCOLS||!1,St=$.ALLOW_SELF_CLOSE_IN_ATTR!==!1,tt=$.SAFE_FOR_TEMPLATES||!1,it=$.SAFE_FOR_XML!==!1,V=$.WHOLE_DOCUMENT||!1,Pe=$.RETURN_DOM||!1,Mt=$.RETURN_DOM_FRAGMENT||!1,Pt=$.RETURN_TRUSTED_TYPE||!1,_e=$.FORCE_BODY||!1,hr=$.SANITIZE_DOM!==!1,pi=$.SANITIZE_NAMED_PROPS||!1,cn=$.KEEP_CONTENT!==!1,da=$.IN_PLACE||!1,D=AK($.ALLOWED_URI_REGEXP)?$.ALLOWED_URI_REGEXP:AT,lt=typeof $.NAMESPACE=="string"?$.NAMESPACE:At,fa=an($,"MATHML_TEXT_INTEGRATION_POINTS")&&$.MATHML_TEXT_INTEGRATION_POINTS&&typeof $.MATHML_TEXT_INTEGRATION_POINTS=="object"?wr($.MATHML_TEXT_INTEGRATION_POINTS):We({},["mi","mo","mn","ms","mtext"]),ha=an($,"HTML_INTEGRATION_POINTS")&&$.HTML_INTEGRATION_POINTS&&typeof $.HTML_INTEGRATION_POINTS=="object"?wr($.HTML_INTEGRATION_POINTS):We({},["annotation-xml"]);const he=an($,"CUSTOM_ELEMENT_HANDLING")&&$.CUSTOM_ELEMENT_HANDLING&&typeof $.CUSTOM_ELEMENT_HANDLING=="object"?wr($.CUSTOM_ELEMENT_HANDLING):Kl(null);if(q=Kl(null),an(he,"tagNameCheck")&&yn(he.tagNameCheck)&&(q.tagNameCheck=he.tagNameCheck),an(he,"attributeNameCheck")&&yn(he.attributeNameCheck)&&(q.attributeNameCheck=he.attributeNameCheck),an(he,"allowCustomizedBuiltInElements")&&typeof he.allowCustomizedBuiltInElements=="boolean"&&(q.allowCustomizedBuiltInElements=he.allowCustomizedBuiltInElements),tt&&(Me=!1),Mt&&(Pe=!0),oe&&(P=We({},ij),T=Kl(null),oe.html===!0&&(We(P,aj),We(T,sj)),oe.svg===!0&&(We(P,$g),We(T,Zg),We(T,Cf)),oe.svgFilters===!0&&(We(P,Hg),We(T,Zg),We(T,Cf)),oe.mathMl===!0&&(We(P,qg),We(T,lj),We(T,Cf))),we.tagCheck=null,we.attributeCheck=null,an($,"ADD_TAGS")&&(typeof $.ADD_TAGS=="function"?we.tagCheck=$.ADD_TAGS:sr($.ADD_TAGS)&&(P===F&&(P=wr(P)),We(P,$.ADD_TAGS,Zt))),an($,"ADD_ATTR")&&(typeof $.ADD_ATTR=="function"?we.attributeCheck=$.ADD_ATTR:sr($.ADD_ATTR)&&(T===G&&(T=wr(T)),We(T,$.ADD_ATTR,Zt))),an($,"ADD_URI_SAFE_ATTR")&&sr($.ADD_URI_SAFE_ATTR)&&We(dn,$.ADD_URI_SAFE_ATTR,Zt),an($,"FORBID_CONTENTS")&&sr($.FORBID_CONTENTS)&&(ge===$e&&(ge=wr(ge)),We(ge,$.FORBID_CONTENTS,Zt)),an($,"ADD_FORBID_CONTENTS")&&sr($.ADD_FORBID_CONTENTS)&&(ge===$e&&(ge=wr(ge)),We(ge,$.ADD_FORBID_CONTENTS,Zt)),cn&&(P["#text"]=!0),V&&We(P,["html","head","body"]),P.table&&(We(P,["tbody"]),delete ae.tbody),$.TRUSTED_TYPES_POLICY){if(typeof $.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ef('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof $.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ef('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');M=$.TRUSTED_TYPES_POLICY,L=M.createHTML("")}else M===void 0&&(M=$K(w,s)),M!==null&&typeof L=="string"&&(L=M.createHTML(""));dr&&dr($),je=$},yi=We({},[...$g,...Hg,...RK]),ys=We({},[...qg,...OK]),$c=function($){let he=R($);(!he||!he.tagName)&&(he={namespaceURI:lt,tagName:"template"});const Ce=Xu($.tagName),wt=Xu(he.tagName);return Mn[$.namespaceURI]?$.namespaceURI===Ut?he.namespaceURI===At?Ce==="svg":he.namespaceURI===qt?Ce==="svg"&&(wt==="annotation-xml"||fa[wt]):!!yi[Ce]:$.namespaceURI===qt?he.namespaceURI===At?Ce==="math":he.namespaceURI===Ut?Ce==="math"&&ha[wt]:!!ys[Ce]:$.namespaceURI===At?he.namespaceURI===Ut&&!ha[wt]||he.namespaceURI===qt&&!fa[wt]?!1:!ys[Ce]&&(Ma[Ce]||!yi[Ce]):!!(Vn==="application/xhtml+xml"&&Mn[$.namespaceURI]):!1},rr=function($){Zu(t.removed,{element:$});try{R($).removeChild($)}catch{j($)}},ma=function($,he){try{Zu(t.removed,{attribute:he.getAttributeNode($),from:he})}catch{Zu(t.removed,{attribute:null,from:he})}if(he.removeAttribute($),$==="is")if(Pe||Mt)try{rr(he)}catch{}else try{he.setAttribute($,"")}catch{}},Lo=function($){let he=null,Ce=null;if(_e)$="<remove></remove>"+$;else{const Wt=ej($,/^[\r\n\t ]+/);Ce=Wt&&Wt[0]}Vn==="application/xhtml+xml"&<===At&&($='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+$+"</body></html>");const wt=M?M.createHTML($):$;if(lt===At)try{he=new x().parseFromString(wt,Vn)}catch{}if(!he||!he.documentElement){he=O.createDocument(lt,"template",null);try{he.documentElement.innerHTML=nr?L:wt}catch{}}const mt=he.body||he.documentElement;return $&&Ce&&mt.insertBefore(n.createTextNode(Ce),mt.childNodes[0]||null),lt===At?Y.call(he,V?"html":"body")[0]:V?he.documentElement:mt},Po=function($){return B.call($.ownerDocument||$,$,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Hr=function($){return $ instanceof g&&(typeof $.nodeName!="string"||typeof $.textContent!="string"||typeof $.removeChild!="function"||!($.attributes instanceof p)||typeof $.removeAttribute!="function"||typeof $.setAttribute!="function"||typeof $.namespaceURI!="string"||typeof $.insertBefore!="function"||typeof $.hasChildNodes!="function")},fn=function($){return typeof f=="function"&&$ instanceof f};function Gt(Ue,$,he){qu(Ue,Ce=>{Ce.call(t,$,he,je)})}const Ia=function($){let he=null;if(Gt(K.beforeSanitizeElements,$,null),Hr($))return rr($),!0;const Ce=Zt($.nodeName);if(Gt(K.uponSanitizeElement,$,{tagName:Ce,allowedTags:P}),it&&$.hasChildNodes()&&!fn($.firstElementChild)&&qn(/<[/\w!]/g,$.innerHTML)&&qn(/<[/\w!]/g,$.textContent)||it&&$.namespaceURI===At&&Ce==="style"&&fn($.firstElementChild)||$.nodeType===Vu.progressingInstruction||it&&$.nodeType===Vu.comment&&qn(/<[/\w]/g,$.data))return rr($),!0;if(ae[Ce]||!(we.tagCheck instanceof Function&&we.tagCheck(Ce))&&!P[Ce]){if(!ae[Ce]&&Hc(Ce)&&(q.tagNameCheck instanceof RegExp&&qn(q.tagNameCheck,Ce)||q.tagNameCheck instanceof Function&&q.tagNameCheck(Ce)))return!1;if(cn&&!ge[Ce]){const wt=R($)||$.parentNode,mt=N($)||$.childNodes;if(mt&&wt){const Wt=mt.length;for(let Un=Wt-1;Un>=0;--Un){const vn=k(mt[Un],!0);wt.insertBefore(vn,C($))}}}return rr($),!0}return $ instanceof m&&!$c($)||(Ce==="noscript"||Ce==="noembed"||Ce==="noframes")&&qn(/<\/no(script|embed|frames)/i,$.innerHTML)?(rr($),!0):(tt&&$.nodeType===Vu.text&&(he=$.textContent,qu([ie,ve,J],wt=>{he=Zl(he,wt," ")}),$.textContent!==he&&(Zu(t.removed,{element:$.cloneNode()}),$.textContent=he)),Gt(K.afterSanitizeElements,$,null),!1)},sl=function($,he,Ce){if(be[he]||hr&&(he==="id"||he==="name")&&(Ce in n||Ce in nt))return!1;const wt=T[he]||we.attributeCheck instanceof Function&&we.attributeCheck(he,$);if(!(Me&&!be[he]&&qn(W,he))){if(!(me&&qn(Z,he))){if(!wt||be[he]){if(!(Hc($)&&(q.tagNameCheck instanceof RegExp&&qn(q.tagNameCheck,$)||q.tagNameCheck instanceof Function&&q.tagNameCheck($))&&(q.attributeNameCheck instanceof RegExp&&qn(q.attributeNameCheck,he)||q.attributeNameCheck instanceof Function&&q.attributeNameCheck(he,$))||he==="is"&&q.allowCustomizedBuiltInElements&&(q.tagNameCheck instanceof RegExp&&qn(q.tagNameCheck,Ce)||q.tagNameCheck instanceof Function&&q.tagNameCheck(Ce))))return!1}else if(!dn[he]){if(!qn(D,Zl(Ce,ke,""))){if(!((he==="src"||he==="xlink:href"||he==="href")&&$!=="script"&&tj(Ce,"data:")===0&&Ve[$])){if(!(Ie&&!qn(ne,Zl(Ce,ke,"")))){if(Ce)return!1}}}}}}return!0},Ph=We({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Hc=function($){return!Ph[Xu($)]&&qn(Ae,$)},Uo=function($){Gt(K.beforeSanitizeAttributes,$,null);const{attributes:he}=$;if(!he||Hr($))return;const Ce={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:T,forceKeepAttr:void 0};let wt=he.length;for(;wt--;){const mt=he[wt],{name:Wt,namespaceURI:Un,value:vn}=mt,Dn=Zt(Wt),Bo=vn;let hn=Wt==="value"?Bo:jK(Bo);if(Ce.attrName=Dn,Ce.attrValue=hn,Ce.keepAttr=!0,Ce.forceKeepAttr=void 0,Gt(K.uponSanitizeAttribute,$,Ce),hn=Ce.attrValue,pi&&(Dn==="id"||Dn==="name")&&tj(hn,gi)!==0&&(ma(Wt,$),hn=gi+hn),it&&qn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,hn)){ma(Wt,$);continue}if(Dn==="attributename"&&ej(hn,"href")){ma(Wt,$);continue}if(Ce.forceKeepAttr)continue;if(!Ce.keepAttr){ma(Wt,$);continue}if(!St&&qn(/\/>/i,hn)){ma(Wt,$);continue}tt&&qu([ie,ve,J],qc=>{hn=Zl(hn,qc," ")});const Fo=Zt($.nodeName);if(!sl(Fo,Dn,hn)){ma(Wt,$);continue}if(M&&typeof w=="object"&&typeof w.getAttributeType=="function"&&!Un)switch(w.getAttributeType(Fo,Dn)){case"TrustedHTML":{hn=M.createHTML(hn);break}case"TrustedScriptURL":{hn=M.createScriptURL(hn);break}}if(hn!==Bo)try{Un?$.setAttributeNS(Un,Wt,hn):$.setAttribute(Wt,hn),Hr($)?rr($):Jk(t.removed)}catch{ma(Wt,$)}}Gt(K.afterSanitizeAttributes,$,null)},vi=function($){let he=null;const Ce=Po($);for(Gt(K.beforeSanitizeShadowDOM,$,null);he=Ce.nextNode();)Gt(K.uponSanitizeShadowNode,he,null),Ia(he),Uo(he),he.content instanceof o&&vi(he.content);Gt(K.afterSanitizeShadowDOM,$,null)};return t.sanitize=function(Ue){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},he=null,Ce=null,wt=null,mt=null;if(nr=!Ue,nr&&(Ue="<!-->"),typeof Ue!="string"&&!fn(Ue)&&(Ue=TK(Ue),typeof Ue!="string"))throw Ef("dirty is not a string, aborting");if(!t.isSupported)return Ue;if(pe||Ar($),t.removed=[],typeof Ue=="string"&&(da=!1),da){const vn=Ue.nodeName;if(typeof vn=="string"){const Dn=Zt(vn);if(!P[Dn]||ae[Dn])throw Ef("root node is forbidden and cannot be sanitized in-place")}}else if(Ue instanceof f)he=Lo("<!---->"),Ce=he.ownerDocument.importNode(Ue,!0),Ce.nodeType===Vu.element&&Ce.nodeName==="BODY"||Ce.nodeName==="HTML"?he=Ce:he.appendChild(Ce);else{if(!Pe&&!tt&&!V&&Ue.indexOf("<")===-1)return M&&Pt?M.createHTML(Ue):Ue;if(he=Lo(Ue),!he)return Pe?null:Pt?L:""}he&&_e&&rr(he.firstChild);const Wt=Po(da?Ue:he);for(;wt=Wt.nextNode();)Ia(wt),Uo(wt),wt.content instanceof o&&vi(wt.content);if(da)return Ue;if(Pe){if(tt){he.normalize();let vn=he.innerHTML;qu([ie,ve,J],Dn=>{vn=Zl(vn,Dn," ")}),he.innerHTML=vn}if(Mt)for(mt=I.call(he.ownerDocument);he.firstChild;)mt.appendChild(he.firstChild);else mt=he;return(T.shadowroot||T.shadowrootmode)&&(mt=z.call(a,mt,!0)),mt}let Un=V?he.outerHTML:he.innerHTML;return V&&P["!doctype"]&&he.ownerDocument&&he.ownerDocument.doctype&&he.ownerDocument.doctype.name&&qn(RT,he.ownerDocument.doctype.name)&&(Un="<!DOCTYPE "+he.ownerDocument.doctype.name+`>
|
|
417
|
+
`+Un),tt&&qu([ie,ve,J],vn=>{Un=Zl(Un,vn," ")}),M&&Pt?M.createHTML(Un):Un},t.setConfig=function(){let Ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ar(Ue),pe=!0},t.clearConfig=function(){je=null,pe=!1},t.isValidAttribute=function(Ue,$,he){je||Ar({});const Ce=Zt(Ue),wt=Zt($);return sl(Ce,wt,he)},t.addHook=function(Ue,$){typeof $=="function"&&Zu(K[Ue],$)},t.removeHook=function(Ue,$){if($!==void 0){const he=SK(K[Ue],$);return he===-1?void 0:kK(K[Ue],he,1)[0]}return Jk(K[Ue])},t.removeHooks=function(Ue){K[Ue]=[]},t.removeAllHooks=function(){K=uj()},t}var HK=OT();function qK({option:e,previewFormat:t,selected:n,disabled:a,showCheckmark:s,onToggle:o}){const c=b.useMemo(()=>!e.preview||t!=="html"?null:HK.sanitize(e.preview,{USE_PROFILES:{html:!0}}),[e.preview,t]);return l.jsxs("button",{type:"button",disabled:a,onClick:a?void 0:o,className:ze("w-full text-left rounded-[var(--radius-input)] border transition-colors","flex flex-col",a?"cursor-default opacity-70":"cursor-pointer hover:bg-[color:var(--bg-hover)]"),style:{padding:"var(--sp-2_5) var(--sp-3)",gap:"var(--sp-1_5)",borderColor:n?"var(--accent)":"var(--border)",background:n?"var(--bg-active)":"var(--bg-raised)"},children:[e.preview?t==="html"&&c?l.jsx("div",{dangerouslySetInnerHTML:{__html:c},className:"max-h-[20rem] overflow-auto rounded-[var(--radius-input)] border",style:{padding:"var(--sp-2)",borderColor:"var(--border)",background:"var(--bg-sunken)"}}):t==="markdown"?l.jsx("div",{className:"max-h-[20rem] overflow-auto rounded-[var(--radius-input)] border",style:{padding:"var(--sp-2)",borderColor:"var(--border)",background:"var(--bg-sunken)"},children:l.jsx(Mh,{children:e.preview})}):null:null,l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:n?"var(--accent)":"var(--fg)"},children:e.label}),s&&n?l.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},title:"Selected",children:"✓"}):null]}),e.description?l.jsx("span",{className:"text-caption",style:{color:"var(--fg-3)"},children:e.description}):null]})}const eo="__free_text__";function Qu(){return{picked:[],freeText:""}}function cj(e,t){if(t.picked.includes(eo)){const n=t.freeText.trim();return n.length===0?null:n}return t.picked.length===0?null:e.multiSelect?t.picked.join(", "):t.picked[0]??null}function ZK({chatId:e,questionMessageId:t,content:n,answer:a,status:s}){const o=s==="pending",c=s==="answered",f=s==="superseded",[m,h]=b.useState(()=>{const j={};for(const C of n.questions)j[C.question]=Qu();return j});b.useEffect(()=>{if(!a)return;const j={};for(const C of n.questions){const N=a.answers[C.question];if(!N){j[C.question]=Qu();continue}const R=new Set(C.options.map(O=>O.label)),M=C.multiSelect?N.split(/,\s*/u):[N],L=M.filter(O=>R.has(O));L.length===M.length&&L.length>0?j[C.question]={picked:L,freeText:""}:j[C.question]={picked:[eo],freeText:N}}h(j)},[a,n.questions]);const p=gn(),[g,x]=b.useState(null),w=ht({mutationFn:async j=>vK(e,n.correlationId,j),onSuccess:()=>{x(null),p.invalidateQueries({queryKey:["chat-messages",e]})},onError:j=>{x(j instanceof Error?j.message:String(j))}}),S=b.useCallback(()=>{x(null);const j={};for(const C of n.questions){const N=m[C.question]??Qu(),R=cj(C,N);if(R===null){x(`Please answer "${C.question}" before submitting.`);return}j[C.question]=R}w.mutate(j)},[n.questions,m,w]),k=b.useMemo(()=>n.questions.every(j=>{const C=m[j.question]??Qu();return cj(j,C)!==null}),[n.questions,m]);return l.jsxs("div",{className:ze("rounded-[var(--radius-panel)] border flex flex-col",o?"":"opacity-80"),style:{padding:"var(--sp-3)",gap:"var(--sp-3)",borderColor:o?"var(--accent)":"var(--border)",background:"var(--bg-raised)"},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[l.jsx("span",{className:"mono text-eyebrow font-semibold",style:{color:o?"var(--accent)":"var(--fg-3)"},children:"AGENT QUESTION"}),c?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:"• Answered"}):null,f?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"• Superseded"}):null]}),l.jsx("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:n.questions.map(j=>l.jsx(GK,{question:j,previewFormat:n.previewFormat,selection:m[j.question]??Qu(),allowFreeText:n.allowFreeText,disabled:!o,showAnsweredCheck:c||f,onChange:C=>h(N=>({...N,[j.question]:C}))},j.question))}),o?l.jsxs("div",{className:"flex items-center justify-end",style:{gap:"var(--sp-2)"},children:[g?l.jsx("span",{className:"text-caption",style:{color:"var(--state-danger)"},children:g}):null,l.jsx(ye,{type:"button",disabled:!k||w.isPending,onClick:S,children:w.isPending?"Submitting…":"Submit answer"})]}):null]})}function GK({question:e,previewFormat:t,selection:n,allowFreeText:a,disabled:s,showAnsweredCheck:o,onChange:c}){const f=b.useRef(null),m=n.picked.includes(eo);b.useEffect(()=>{var p;m&&!s&&((p=f.current)==null||p.focus())},[m,s]);const h=b.useCallback(p=>{const g=n.picked.includes(p);let x;e.multiSelect?x=g?n.picked.filter(w=>w!==p):[...n.picked,p]:x=g?[]:[p],c({...n,picked:x})},[e.multiSelect,n,c]);return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[l.jsx("span",{className:"mono text-eyebrow font-semibold",style:{color:"var(--fg-2)"},children:e.header}),e.multiSelect?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"(pick any)"}):null]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg)"},children:e.question}),l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1_5)"},children:[e.options.map(p=>l.jsx(qK,{option:p,previewFormat:t,selected:n.picked.includes(p.label),disabled:s,showCheckmark:o,onToggle:()=>h(p.label)},p.label)),a?l.jsxs("button",{type:"button",disabled:s,onClick:s?void 0:()=>c({picked:e.multiSelect?m?n.picked.filter(p=>p!==eo):[...n.picked,eo]:m?[]:[eo],freeText:n.freeText}),className:ze("w-full text-left rounded-[var(--radius-input)] border transition-colors","flex flex-col",s?"cursor-default opacity-70":"cursor-pointer hover:bg-[color:var(--bg-hover)]"),style:{padding:"var(--sp-2_5) var(--sp-3)",gap:"var(--sp-1_5)",borderColor:m?"var(--accent)":"var(--border)",background:m?"var(--bg-active)":"var(--bg-raised)"},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:m?"var(--accent)":"var(--fg-3)"},children:"Other…"}),l.jsx("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:"Type a free-text answer."}),m?l.jsx("textarea",{ref:f,value:n.freeText,disabled:s,onChange:p=>c({...n,freeText:p.target.value}),onClick:p=>p.stopPropagation(),onKeyDown:p=>{p.key==="Enter"&&!p.metaKey&&!p.ctrlKey&&p.stopPropagation()},rows:2,className:"rounded-[var(--radius-input)] border text-body",style:{padding:"var(--sp-2)",borderColor:"var(--border)",background:"var(--bg-sunken)",color:"var(--fg)",resize:"vertical"}}):null]}):null]})]})}function VK(e){return n9.safeParse(e).success}function zT(e){return r9.safeParse(e).success}function QK(e){let t=-1;for(const s of e)s.kind==="turn_end"&&s.seq>t&&(t=s.seq);const n=e.filter(s=>s.kind==="turn_end"?!1:s.kind==="error"?!0:s.seq>t),a=new Map;for(const s of n){if(s.kind!=="tool_call")continue;const o=dj(s.payload);if(!o)continue;const c=a.get(o)??-1;s.seq>c&&a.set(o,s.seq)}return n.filter(s=>{if(s.kind!=="tool_call")return!0;const o=dj(s.payload);return o?a.get(o)===s.seq:!0})}function dj(e){if(typeof e!="object"||e===null)return;const t=e.toolUseId;return typeof t=="string"?t:void 0}function Io(e){const t=new Date(e),n=new Intl.DateTimeFormat("en-GB",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(t),a=s=>{var o;return((o=n.find(c=>c.type===s))==null?void 0:o.value)??""};return`${a("month")}/${a("day")} ${a("hour")}:${a("minute")}`}function KK(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function fj(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return"…"}}function YK({msg:e,myAgentId:t}){if(!t||e.senderId!==t)return null;const n=e.deliveryStatus??"sent";return n==="acked"?l.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},title:"Agent has started processing",children:"✓✓ read"}):n==="delivered"?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},title:"Delivered to agent inbox",children:"✓✓"}):l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},title:"Sent",children:"✓ sent"})}function XK({event:e}){const t=DD(e.payload);if(!t)return null;const n=t.status==="error",a=t.status==="pending",s=n?"var(--state-error)":a?"var(--state-blocked)":"var(--fg-3)",o=n?"failed":a?"using":"used";return l.jsxs("div",{className:"mono flex items-center text-label",style:{gap:8,padding:"var(--sp-0_5) var(--sp-2)",color:"var(--fg-3)"},children:[a?l.jsx("span",{"aria-hidden":!0,style:{width:6,height:6,borderRadius:"50%",background:s,animation:"heartbeat-pulse 1.2s ease-in-out infinite",flexShrink:0,marginTop:5}}):l.jsx("span",{"aria-hidden":!0,style:{color:s,flexShrink:0},children:n?"⚠":"↳"}),l.jsxs("span",{className:"flex items-baseline",style:{color:"var(--fg-3)",minWidth:0,flex:1},title:t.args!==void 0&&t.args!==null?fj(t.args):void 0,children:[l.jsxs("span",{style:{whiteSpace:"nowrap",flexShrink:0},children:[o," ",l.jsx("span",{style:{color:"var(--fg-2)"},children:t.name})]}),t.args!==void 0&&t.args!==null?l.jsxs("span",{className:"truncate",style:{color:"var(--fg-4)",minWidth:0,flex:1},children:["(",fj(t.args),")"]}):null,t.durationMs!==void 0&&!a?l.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)",marginLeft:6,whiteSpace:"nowrap",flexShrink:0},children:["· ",KK(t.durationMs)]}):null]})]})}function WK({event:e,agentNameFn:t,agentId:n}){const a=LD(e.payload);if(!a||a.text.length===0)return null;const s=t(n);return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1) 0",opacity:.85},children:[l.jsx(Lh,{name:s,isSelf:!1}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-label font-semibold",style:{color:"var(--accent)"},children:s}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Io(e.createdAt)}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"· streaming"})]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg-2)",whiteSpace:"pre-wrap",marginTop:2},children:a.text})]})]})}function JK({event:e}){return l.jsxs("div",{className:"mono flex items-center text-label",style:{gap:8,padding:"var(--sp-0_5) var(--sp-2)",color:"var(--fg-3)"},children:[l.jsx("span",{"aria-hidden":!0,style:{width:6,height:6,borderRadius:"50%",background:"var(--accent)",animation:"heartbeat-pulse 1.2s ease-in-out infinite",flexShrink:0}}),l.jsx("span",{style:{color:"var(--fg-3)"},children:"thinking…"}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Io(e.createdAt)})]})}function eY({event:e}){const t=ID(e.payload),n=Io(e.createdAt);return l.jsxs("div",{style:{padding:"var(--sp-1_5) var(--sp-2_5)",borderLeft:"var(--hairline-bold) solid var(--state-error)",background:"color-mix(in oklch, var(--state-error) 6%, transparent)",borderRadius:"0 var(--radius-input) var(--radius-input) 0"},children:[l.jsxs("div",{className:"mono uppercase text-caption",style:{color:"var(--state-error)"},children:["error · ",(t==null?void 0:t.source)??"unknown"," · ",n]}),l.jsx("div",{className:"text-label",style:{marginTop:2,color:"var(--fg-2)",whiteSpace:"pre-wrap"},children:(t==null?void 0:t.message)??"(invalid error payload)"})]})}function Lh({name:e,isSelf:t}){const n=e.slice(0,2).toUpperCase();return l.jsx("div",{className:"mono text-eyebrow font-bold",style:{width:20,height:20,borderRadius:"var(--radius-input)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,background:t?"linear-gradient(135deg, var(--accent), oklch(0.58 0.14 170))":"var(--bg-active)",border:t?"none":"var(--hairline) solid var(--border-strong)",color:t?"oklch(0.14 0.01 150)":"var(--fg-2)"},children:t?n:l.jsx(Dc,{width:9,height:10,style:{color:"var(--accent)"}})})}function tY({msg:e,myAgentId:t,agentNameFn:n}){const a=n(e.senderId),s=t===e.senderId;return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[l.jsx(Lh,{name:a,isSelf:s}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:s?"var(--fg)":"var(--accent)"},children:a}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Io(e.createdAt)}),l.jsx("span",{style:{marginLeft:"auto"},children:l.jsx(YK,{msg:e,myAgentId:t})})]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg)",marginTop:2},children:e.format==="file"&&nY(e.content)?l.jsx("img",{src:`data:${e.content.mimeType};base64,${e.content.data}`,alt:e.content.filename??"image",style:{maxWidth:320,borderRadius:"var(--radius-panel)",marginTop:4}}):e.format==="file"&&rY(e.content)?l.jsx(aY,{content:e.content}):e.format==="text"?l.jsx(Mh,{children:typeof e.content=="string"?e.content:JSON.stringify(e.content)}):l.jsx("pre",{className:"mono text-label",style:{background:"var(--bg-sunken)",padding:8,borderRadius:"var(--radius-input)",overflow:"auto",maxHeight:160},children:JSON.stringify(e.content,null,2)})})]})]})}function nY(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 rY(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 aY({content:e}){const[t,n]=b.useState({kind:"loading"});return b.useEffect(()=>{let a=!1;return yK(e.imageId).then(s=>{a||n(s?{kind:"hit",src:`data:${s.mimeType};base64,${s.base64}`}:{kind:"miss"})}),()=>{a=!0}},[e.imageId]),t.kind==="hit"?l.jsx("img",{src:t.src,alt:e.filename,style:{maxWidth:320,borderRadius:"var(--radius-panel)",marginTop:4}}):t.kind==="miss"?l.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)",fontStyle:"italic"},children:['[Image "',e.filename,'" not available on this device]']}):l.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:"…"})}function iY({msg:e,chatId:t,content:n,answer:a,status:s,agentNameFn:o}){const c=o(e.senderId);return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[l.jsx(Lh,{name:c,isSelf:!1}),l.jsxs("div",{className:"min-w-0 flex flex-col",style:{gap:"var(--sp-1)"},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:"var(--accent)"},children:c}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Io(e.createdAt)})]}),l.jsx(ZK,{chatId:t,questionMessageId:e.id,content:n,answer:a,status:s})]})]})}function sY({msg:e,agentNameFn:t}){const n=zT(e.content)?e.content:null,a=t(e.senderId),s=n?Object.entries(n.answers).map(([o,c])=>`${o.replace(/\s+\?$/u,"?")}: ${c}`).join(" · "):"(answer)";return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[l.jsx(Lh,{name:a,isSelf:!0}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:"var(--fg)"},children:a}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Io(e.createdAt)}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:"answered question"})]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg-2)",marginTop:2},children:s})]})]})}function lY({metadata:e}){if(!e||e.source!=="github")return null;const t=typeof e.entityUrl=="string"?e.entityUrl:null;return t?l.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",title:"View on GitHub",className:"inline-flex items-center",style:{color:"var(--fg-3)",padding:"0 var(--sp-1)",textDecoration:"none"},children:l.jsx(Nv,{className:"h-3.5 w-3.5"})}):null}function hj({agentId:e,chatId:t,readOnly:n=!1,titleFallback:a,joinAction:s}){var it;const o=gn(),c=gh(),f=Uv(),{agentId:m}=vt(),[h,p]=b.useState(""),[g,x]=b.useState(0),[w,S]=b.useState([]),[k,j]=b.useState(!1),[C,N]=b.useState(null),R=b.useRef(null),M=b.useRef(null),L=b.useRef(null);NT(M,h);const O=b.useRef(!1),B=b.useRef(new Set);b.useEffect(()=>{O.current=!1},[t]);const{data:I}=Ke({queryKey:["chat-messages",t],queryFn:()=>JQ(t,{limit:50}),refetchInterval:5e3}),{data:Y}=Ke({queryKey:["session-events",e,t],queryFn:()=>PD(e,t,{limit:200,direction:"desc"}),refetchInterval:5e3}),{data:z}=Ke({queryKey:["chat-detail",t],queryFn:()=>kT(t),enabled:!!t}),{data:K}=Ke({queryKey:["activity"],queryFn:Oc,refetchInterval:15e3}),ie=ht({mutationFn:V=>jo(t,V),onSuccess:()=>{p(""),o.invalidateQueries({queryKey:["chat-messages",t]}),o.invalidateQueries({queryKey:a1(e)})}}),ve=b.useCallback(V=>{const _e=V.filter(Pt=>Pt.type.startsWith("image/"));if(_e.length===0)return;const Pe=_e.find(Pt=>Pt.size>5242880);if(Pe){N(`Image too large (${(Pe.size/1024/1024).toFixed(1)}MB). Maximum ${5242880/1024/1024}MB per image.`);return}const Mt=_e.map(Pt=>({id:crypto.randomUUID(),file:Pt,previewUrl:URL.createObjectURL(Pt)}));S(Pt=>[...Pt,...Mt]),N(null)},[]),J=b.useCallback(V=>{S(pe=>{const _e=pe.find(Pe=>Pe.id===V);return _e&&URL.revokeObjectURL(_e.previewUrl),pe.filter(Pe=>Pe.id!==V)})},[]),W=async()=>{const V=h.trim(),pe=w;if(!(!V&&pe.length===0)&&!k&&!(Me&&Ie.length===0)){if(St.length>0)try{await ST(t,{participantIds:St}),await o.invalidateQueries({queryKey:["chat-detail",t]})}catch(_e){N(_e instanceof Error?_e.message:"Failed to add participants");return}if(pe.length>0){j(!0),N(null);try{for(const _e of pe){const Pe=await WQ(_e.file),Mt=crypto.randomUUID();await gK({imageId:Mt,base64:Pe,mimeType:_e.file.type}),await XQ(t,{data:Pe,mimeType:_e.file.type,filename:_e.file.name,size:_e.file.size,imageId:Mt}),URL.revokeObjectURL(_e.previewUrl)}S([]),V&&await jo(t,V),p(""),o.invalidateQueries({queryKey:["chat-messages",t]}),o.invalidateQueries({queryKey:a1(e)})}catch(_e){N(_e instanceof Error?_e.message:"Failed to send image")}finally{j(!1)}return}ie.mutate(V)}},[Z,ne]=b.useState(!1),[ke,Ae]=b.useState(""),D=b.useRef(null);b.useEffect(()=>{var V;Z&&((V=D.current)==null||V.focus())},[Z]);const P=ht({mutationFn:V=>YQ(t,V),onSuccess:()=>{ne(!1),o.invalidateQueries({queryKey:["chat-detail",t]}),o.invalidateQueries({queryKey:["agent-sessions",e]}),o.invalidateQueries({queryKey:["session",e,t]})}}),F=()=>{const V=ke.trim();P.mutate(V.length>0?V:null)},T=ht({mutationFn:()=>jT(t,Py.ACTIVE),onSuccess:()=>{o.invalidateQueries({queryKey:["me","chats"]}),o.invalidateQueries({queryKey:["chat-detail",t]})}}),G=b.useMemo(()=>{const V=(I==null?void 0:I.items)??[],pe=QK((Y==null?void 0:Y.items)??[]),_e=[...V.map(Pe=>({kind:"message",at:Pe.createdAt,key:`m-${Pe.id}`,data:Pe})),...pe.map(Pe=>({kind:"event",at:Pe.createdAt,key:`e-${Pe.id}`,data:Pe}))];return _e.sort((Pe,Mt)=>Pe.at.localeCompare(Mt.at)),_e},[I,Y]),q=b.useMemo(()=>{const V=new Map;for(const pe of(I==null?void 0:I.items)??[])pe.format==="question_answer"&&zT(pe.content)&&V.set(pe.content.correlationId,pe.content);return V},[I]),ae=G.length;b.useEffect(()=>{var V;ae>0&&((V=L.current)==null||V.scrollIntoView({behavior:"smooth"}))},[ae]);const be=c(e),we=b.useMemo(()=>{var V;return new Set(((V=z==null?void 0:z.participants)==null?void 0:V.map(pe=>pe.agentId))??[])},[z==null?void 0:z.participants]),me=b.useMemo(()=>{const V=new Set;for(const Pe of(z==null?void 0:z.participants)??[])V.add(Pe.agentId);for(const Pe of(K==null?void 0:K.agents)??[])V.add(Pe.agentId);V.size===0&&V.add(e);const pe=new Map;for(const Pe of(K==null?void 0:K.agents)??[])pe.set(Pe.agentId,Pe.managedByMe);const _e=[];for(const Pe of V){if(Pe===m)continue;const Mt=f(Pe);!Mt||!Mt.name||_e.push({agentId:Pe,name:Mt.name,displayName:Mt.displayName,managedByMe:pe.get(Pe)??!1})}return _e},[z==null?void 0:z.participants,K==null?void 0:K.agents,e,f,m]),Me=b.useMemo(()=>{if(!z)return!1;if(z.type==="group")return!0;const V=z.participants.some(pe=>pe.agentId===m);return z.type==="direct"&&!V&&z.participants.length>=2},[z,m]);b.useEffect(()=>{if(n||B.current.has(t)||!I||!Y||!z||G.length>0||h.length>0||Me||be===e)return;const V=`Hi ${be}! What can you help with?`;p(V),x(V.length),B.current.add(t),requestAnimationFrame(()=>{const pe=M.current;pe&&(pe.focus(),pe.setSelectionRange(V.length,V.length))})},[t,e,I,Y,z,G.length,h.length,be,Me,n]);const Ie=b.useMemo(()=>{const V=me.map(pe=>({agentId:pe.agentId,name:pe.name}));return jN(h,V)},[h,me]),St=b.useMemo(()=>we.size===0?[]:Ie.filter(V=>!we.has(V)),[Ie,we]),tt=ET({value:h,cursor:g,candidates:me,disabled:ie.isPending||k,onSelect:V=>{p(V.text),x(V.cursor),requestAnimationFrame(()=>{const pe=M.current;pe&&(pe.focus(),pe.setSelectionRange(V.cursor,V.cursor))})}});return l.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[l.jsx("div",{className:"shrink-0",style:{padding:"var(--sp-2_5) var(--sp-6)",borderBottom:"var(--hairline) solid var(--border)"},children:l.jsxs("div",{className:"flex items-center",style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%",gap:10},children:[l.jsxs("div",{className:"flex items-center min-w-0",style:{gap:8,flex:1},children:[n?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"truncate text-subtitle min-w-0",style:{color:"var(--fg)"},children:(z==null?void 0:z.title)??a??"…"}),l.jsx("span",{className:"mono uppercase text-eyebrow shrink-0",style:{padding:"var(--hairline) var(--sp-1_25)",borderRadius:2,color:"var(--fg-3)",background:"var(--bg-sunken)"},children:"watching"})]}):Z?l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:D,value:ke,onChange:V=>Ae(V.target.value),onKeyDown:V=>{V.key==="Enter"?(V.preventDefault(),F()):V.key==="Escape"&&(V.preventDefault(),ne(!1))},disabled:P.isPending,maxLength:500,placeholder:(z==null?void 0:z.title)??"Chat name",className:"outline-none text-subtitle",style:{fieldSizing:"content",minWidth:200,maxWidth:480,color:"var(--fg)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",padding:"var(--sp-0_5) var(--sp-1_5)"}}),l.jsx("button",{type:"button",onClick:F,disabled:P.isPending,title:"Save",className:"inline-flex items-center",style:{color:"var(--accent)",padding:2},children:l.jsx(cr,{className:"h-3.5 w-3.5"})}),l.jsx("button",{type:"button",onClick:()=>ne(!1),disabled:P.isPending,title:"Cancel",className:"inline-flex items-center",style:{color:"var(--fg-3)",padding:2},children:l.jsx(os,{className:"h-3.5 w-3.5"})})]}):l.jsx("button",{type:"button",onClick:()=>{Ae((z==null?void 0:z.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:(z==null?void 0:z.title)??"…"}),l.jsx(lY,{metadata:z==null?void 0:z.metadata})]}),l.jsx(oY,{chatId:t,participantIds:((it=z==null?void 0:z.participants)==null?void 0:it.map(V=>V.agentId))??[e],candidates:me,agentIdentity:f,onAdded:()=>o.invalidateQueries({queryKey:["chat-detail",t]}),readOnly:n})]})}),(z==null?void 0:z.engagementStatus)===Py.DELETED&&l.jsxs("div",{className:"shrink-0 flex items-center",style:{gap:"var(--sp-2)",padding:"var(--sp-1_5) var(--sp-6)",background:"var(--bg-sunken)",borderBottom:"var(--hairline) solid var(--border-faint)",color:"var(--fg-2)"},children:[l.jsx("span",{className:"text-body",style:{flex:1},children:"This chat is deleted and won't appear in your conversation list."}),l.jsx("button",{type:"button",disabled:T.isPending,onClick:()=>T.mutate(),className:"text-body",style:{padding:"var(--sp-0_5) var(--sp-2)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:"var(--bg-raised)",color:"var(--fg)",cursor:T.isPending?"default":"pointer",opacity:T.isPending?.6:1},children:T.isPending?"Restoring…":"Restore"})]}),l.jsx("div",{className:"flex-1 overflow-y-auto relative",style:{padding:"var(--sp-2_5) var(--sp-6)"},children:l.jsxs("div",{style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%"},children:[ae===0&&l.jsxs("div",{className:"flex flex-col items-center text-body",style:{color:"var(--fg-3)",padding:"var(--sp-8) 0",gap:6},children:[l.jsx(_v,{className:"h-8 w-8",style:{opacity:.3}}),n?"No messages yet":"Send a message to start the conversation"]}),l.jsx("div",{className:"flex flex-col",style:{gap:4},children:G.map(V=>{if(V.kind==="event"){const _e=V.data;switch(_e.kind){case"tool_call":return l.jsx(XK,{event:_e},V.key);case"assistant_text":return l.jsx(WK,{event:_e,agentId:e,agentNameFn:c},V.key);case"thinking":return l.jsx(JK,{event:_e},V.key);case"error":return l.jsx(eY,{event:_e},V.key);default:return null}}const pe=V.data;if(pe.format==="question"&&VK(pe.content)){const _e=q.get(pe.content.correlationId)??null,Pe=_e?"answered":"pending";return l.jsx(iY,{msg:pe,chatId:t,content:pe.content,answer:_e,status:Pe,agentNameFn:c},V.key)}return pe.format==="question_answer"?l.jsx(sY,{msg:pe,agentNameFn:c},V.key):l.jsx(tY,{msg:pe,myAgentId:m,agentNameFn:c},V.key)})}),l.jsx("div",{ref:L})]})}),l.jsx("div",{className:"shrink-0",style:{padding:"var(--sp-2_5) var(--sp-6) var(--sp-3)"},children:l.jsx("div",{style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%"},children:n?l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-3)",padding:"var(--sp-2) var(--sp-3)",border:"var(--hairline) solid var(--border)",borderRadius:6,background:"var(--bg-sunken)"},children:[l.jsx(SE,{className:"h-4 w-4 shrink-0",style:{color:"var(--fg-3)"}}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-body",style:{color:"var(--fg-2)"},children:"You're watching this chat — read-only."}),(s==null?void 0:s.error)&&l.jsx("div",{className:"mono text-label",style:{color:"var(--state-error)",marginTop:2},children:s.error})]}),s&&l.jsx(ye,{type:"button",variant:"secondary",size:"sm",className:"shrink-0",onClick:s.onJoin,disabled:s.joining,children:s.joining?"Joining…":"Join to reply"})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{position:"relative",border:"var(--hairline) solid var(--border)",borderRadius:6,background:"var(--bg-sunken)"},onDragOver:V=>V.preventDefault(),onDrop:V=>{V.preventDefault(),ve(Array.from(V.dataTransfer.files))},children:[w.length>0&&l.jsx("div",{className:"flex items-center",style:{gap:6,padding:"var(--sp-1_5) var(--sp-2_5) 0",overflowX:"auto"},children:w.map(V=>l.jsxs("div",{style:{position:"relative",flexShrink:0,borderRadius:4,border:"var(--hairline) solid var(--border)",overflow:"hidden"},children:[l.jsx("img",{src:V.previewUrl,alt:V.file.name,style:{height:32,width:"auto",display:"block",objectFit:"cover"}}),l.jsx("button",{type:"button",onClick:()=>J(V.id),style:{position:"absolute",top:1,right:1,width:14,height:14,borderRadius:"50%",background:"var(--color-overlay-scrim)",border:"none",color:"var(--bg-raised)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0},children:l.jsx(os,{className:"h-2 w-2"})})]},V.id))}),l.jsxs("div",{style:{position:"relative"},children:[l.jsx(CT,{trigger:tt.trigger,results:tt.results,highlightIndex:tt.highlightIndex,anchorRef:M,onPick:tt.pick}),l.jsx("textarea",{ref:M,value:h,onChange:V=>{p(V.target.value),x(V.target.selectionStart??V.target.value.length)},onSelect:V=>{x(V.currentTarget.selectionStart??h.length)},onFocus:()=>{Me&&(O.current||h.length>0||me.length===0||(O.current=!0,p("@"),x(1),requestAnimationFrame(()=>{const V=M.current;V&&V.setSelectionRange(1,1)})))},onPaste:V=>{const pe=Array.from(V.clipboardData.files);pe.length>0&&(V.preventDefault(),ve(pe))},placeholder:Me?"Type @ to pick a recipient, then your message":`Message @${be} · / for commands · @ to mention`,rows:2,onKeyDown:V=>{tt.handleKey(V)||V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),W())},disabled:ie.isPending||k,className:"w-full outline-none text-subtitle font-normal",style:{padding:"var(--sp-2_25) var(--sp-3) var(--sp-7_5)",background:"transparent",border:"none",minHeight:"calc(2lh + var(--sp-2_25) + var(--sp-7_5))",maxHeight:"10.5rem",overflowY:"auto",resize:"none",color:"var(--fg)"}})]}),l.jsxs("div",{className:"flex items-center justify-between text-caption",style:{position:"absolute",bottom:6,left:10,right:10,color:"var(--fg-4)"},children:[l.jsxs("span",{className:"mono flex items-center",style:{gap:10},children:[l.jsx("button",{type:"button",onClick:()=>{const V=M.current;if(!V)return;const pe=V.selectionStart??h.length,_e=V.selectionEnd??pe,Pe=`${h.slice(0,pe)}@${h.slice(_e)}`;p(Pe),x(pe+1),requestAnimationFrame(()=>{V.focus(),V.setSelectionRange(pe+1,pe+1)})},title:"Mention an agent (or type @)",style:{background:"none",border:"none",cursor:"pointer",color:"var(--fg-3)",padding:0,display:"inline-flex",alignItems:"center"},children:l.jsx(Hz,{className:"h-3.5 w-3.5"})}),l.jsx("button",{type:"button",onClick:()=>{var V;return(V=R.current)==null?void 0:V.click()},title:"Attach image",style:{background:"none",border:"none",cursor:"pointer",color:"var(--fg-3)",padding:0,display:"inline-flex",alignItems:"center"},children:l.jsx(kM,{className:"h-3.5 w-3.5"})}),l.jsx("input",{ref:R,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:V=>{V.target.files&&(ve(Array.from(V.target.files)),V.target.value="")}})]}),l.jsxs("span",{className:"flex items-center",style:{gap:8},children:[k&&l.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},children:"uploading…"}),l.jsx("button",{type:"button",onClick:W,disabled:ie.isPending||k||!h.trim()&&w.length===0||Me&&Ie.length===0,title:Me&&Ie.length===0?"Pick at least one recipient with @ before sending in a group chat":"Send (Enter)","aria-label":"Send",className:ze("inline-flex items-center justify-center transition-opacity",(ie.isPending||k||!h.trim()&&w.length===0||Me&&Ie.length===0)&&"opacity-40 cursor-not-allowed"),style:{width:28,height:28,borderRadius:"var(--radius-input)",background:"var(--fg)",color:"var(--bg-raised)",border:"none"},children:l.jsx(bE,{className:"h-3.5 w-3.5",strokeWidth:2.5})})]})]})]}),(ie.isError||C)&&l.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)",padding:"var(--sp-1_5) var(--sp-0_5) 0"},children:C??(ie.error instanceof Error?ie.error.message:"Failed to send")})]})})})]})}function oY({chatId:e,participantIds:t,candidates:n,agentIdentity:a,onAdded:s,readOnly:o=!1}){const[c,f]=b.useState(!1),m=b.useRef(null);b.useEffect(()=>{if(!c)return;const g=x=>{m.current&&(m.current.contains(x.target)||f(!1))};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[c]);const h=ht({mutationFn:g=>ST(e,{participantIds:[g]}),onSuccess:()=>{f(!1),s()}}),p=b.useMemo(()=>n.filter(g=>!t.includes(g.agentId)),[n,t]);return l.jsxs("div",{className:"inline-flex items-center flex-wrap",style:{gap:4},children:[t.map(g=>{const x=a(g),w=(x==null?void 0:x.displayName)??(x==null?void 0:x.name)??g.slice(0,8);return l.jsx("span",{className:"inline-flex items-center text-label",style:{padding:"var(--sp-0_5) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"var(--bg-sunken)",color:"var(--fg-2)"},children:w},g)}),!o&&l.jsxs("div",{ref:m,style:{position:"relative"},children:[l.jsx("button",{type:"button",onClick:()=>f(!c),disabled:p.length===0||h.isPending,title:p.length===0?"All available agents are already in this chat":"Add participant","aria-label":"Add participant",className:"inline-flex items-center transition-colors hover:bg-[var(--bg-sunken)]",style:{padding:"var(--sp-0_5) var(--sp-1)",borderRadius:"var(--radius-chip)",border:"var(--hairline) solid var(--border)",background:"transparent",color:p.length===0?"var(--fg-4)":"var(--fg-3)",cursor:p.length===0?"not-allowed":"pointer"},children:l.jsx(xa,{className:"h-3 w-3"})}),c&&p.length>0&&l.jsx("div",{role:"listbox","aria-label":"Add participant",className:"absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg",style:{top:"calc(100% + var(--sp-1))",right:0,minWidth:280,background:"var(--bg-raised)",borderColor:"var(--border)"},children:(()=>{const g=Nb(p);return Tb(p).map(x=>"divider"in x?l.jsx("div",{role:"presentation",style:{height:"var(--hairline)",background:"var(--border-faint)",margin:"var(--sp-0_5) var(--sp-3)"}},"__divider"):l.jsx("button",{type:"button",role:"option","aria-selected":"false",title:x.name?`@${x.name}`:void 0,onClick:()=>h.mutate(x.agentId),disabled:h.isPending,className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:l.jsx(_b,{candidate:x,ambiguous:g})},x.agentId))})()})]})]})}function mj(e,t){return e?e.find(n=>n.chatId===t)??null:null}function uY(e,t){var s;const n=e.filter(o=>o.agentId!==t),a=n.find(o=>o.type!==void 0&&o.type!=="human");return a?a.agentId:((s=n[0])==null?void 0:s.agentId)??null}function cY({chatId:e}){const t=gn(),{agentId:n}=vt(),a=b.useRef(new Map),{data:s}=Ke({queryKey:["chat-detail",e],queryFn:()=>kT(e),enabled:!!e}),{data:o}=Ke({queryKey:["me","chats","all"],queryFn:()=>th({filter:"all"}),refetchInterval:3e4}),{data:c}=Ke({queryKey:["me","chats","watching"],queryFn:()=>th({filter:"watching"}),refetchInterval:3e4}),f=b.useMemo(()=>mj(o==null?void 0:o.rows,e)??mj(c==null?void 0:c.rows,e)??null,[o,c,e]),m=b.useMemo(()=>f?f.participants.map(k=>({agentId:k.agentId,type:k.type})):s?s.participants.map(k=>({agentId:k.agentId,type:void 0})):[],[f,s]),h=b.useMemo(()=>uY(m,n),[m,n]),g=ht({mutationFn:()=>QQ(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]})}}).mutate,x=(f==null?void 0:f.lastMessageAt)??"";b.useEffect(()=>{!f||a.current.get(e)===x||(a.current.set(e,x),g())},[e,f,x,g]);const w=ht({mutationFn:()=>KQ(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]}),t.invalidateQueries({queryKey:["chat-detail",e]})}}),S=(f==null?void 0:f.membershipKind)==="watching";return h?S?l.jsx(hj,{agentId:h,chatId:e,readOnly:!0,titleFallback:(f==null?void 0:f.title)??null,joinAction:{onJoin:()=>w.mutate(),joining:w.isPending,error:w.isError?w.error instanceof Error?w.error.message:"Failed to join":null}}):l.jsx(hj,{agentId:h,chatId:e}):l.jsx("div",{className:"flex-1 flex items-center justify-center",style:{padding:"var(--sp-8)"},children:l.jsxs("div",{className:"text-center",style:{color:"var(--fg-3)"},children:[l.jsx("div",{className:"text-subtitle",style:{color:"var(--fg-2)",marginBottom:6},children:"Loading chat…"}),l.jsx("div",{className:"text-body",children:"Resolving participants."})]})})}function dY(){return l.jsx("div",{className:"flex-1 flex items-center justify-center p-8",children:l.jsxs("div",{className:"text-center max-w-sm",children:[l.jsx(Dc,{width:36,height:40,className:"mx-auto mb-3 text-primary opacity-60"}),l.jsx("div",{className:"text-subtitle mb-1",children:"Select a chat"}),l.jsx("div",{className:"text-body text-muted-foreground",children:"Pick an agent from the roster to view its sessions, or open a chat to start collaborating."})]})})}async function di(e,t){try{await Ee.post("/me/onboarding/events",{event:e,attrs:t})}catch{}}function fY({organizationId:e,onContinue:t}){const[n,a]=b.useState([]),[s,o]=b.useState(""),[c,f]=b.useState(""),[m,h]=b.useState(!1),[p,g]=b.useState(null),[x,w]=b.useState(!1),[S,k]=b.useState(null),j=b.useRef(null);b.useEffect(()=>{(async()=>{try{const M=await Ee.get("/me/organizations");a(M)}catch(M){k(M instanceof Error?M.message:"Failed to load your team")}finally{w(!0)}})()},[]),b.useEffect(()=>{var L;const M=((L=n.find(O=>O.id===e))==null?void 0:L.displayName)??"";o(M),f(M)},[n,e]),b.useEffect(()=>{const M=j.current;if(!M||!c)return;M.focus();const L=M.value.length;M.setSelectionRange(L,L)},[c]);const C=s.trim(),N=C.length>0&&!m&&x&&!S,R=b.useCallback(async M=>{if(M==null||M.preventDefault(),!(!N||!e)){g(null);try{C!==c.trim()&&(h(!0),await Ee.patch(`/orgs/${encodeURIComponent(e)}`,{displayName:C}),di("team_renamed")),t()}catch(L){g(L instanceof Error?L.message:"Failed to rename team")}finally{h(!1)}}},[N,e,C,c,t]);return l.jsxs("form",{onSubmit:R,className:"flex flex-col",style:{gap:"var(--sp-5)"},children:[l.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)"},children:["Name your ",l.jsx("span",{style:{color:"var(--fg-2)"},children:"agent team"})," — where humans and AIs collaborate."]}),l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[l.jsx("label",{htmlFor:"onboarding-team-name",className:"text-label",style:{color:"var(--fg-3)"},children:"Team name"}),l.jsx("input",{ref:j,id:"onboarding-team-name","aria-label":"Team display name",value:s,onChange:M=>o(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)"}})]}),p||S?l.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:p??`Couldn't load your team — ${S}. Refresh the page and try again.`}):null,l.jsx("div",{className:"flex justify-end",children:l.jsxs(ye,{type:"submit",disabled:!N,children:[l.jsx("span",{children:"Continue"}),l.jsx(vE,{className:"h-4 w-4"})]})})]})}function Ab(){return l.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:"var(--sp-5)",bottom:"var(--sp-5)",left:"calc(var(--sp-2_5) - var(--hairline))",width:"var(--hairline)",background:"color-mix(in oklch, var(--border-faint) 56%, transparent)"}})}function ls({number:e,state:t,children:n}){const a=t==="active",s=t==="complete";return l.jsxs("section",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:"var(--sp-3)",marginTop:e==="01"?0:"var(--sp-5)",position:"relative"},children:[l.jsx("div",{className:"mono text-caption flex items-center justify-center",style:{width:"var(--sp-5)",height:"var(--sp-5)",borderRadius:999,background:a||s?"color-mix(in oklch, var(--accent) 8%, var(--bg))":"var(--bg)",border:a||s?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-faint)",color:a||s?"var(--accent)":"var(--fg-4)",zIndex:1},children:s?l.jsx(cr,{className:"h-3 w-3"}):e}),l.jsx("div",{style:{minHeight:"var(--sp-6)",paddingBottom:"var(--sp-1)"},children:n})]})}const hY=3e4,mY=1e3,pY=3e3;function gY(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function yY({organizationId:e,memberId:t,joinPath:n,refreshMe:a}){var be;const s=An(),o=wz(e,t),c=kz(o),f=c!=null&&c.connectToken&&c.connectTokenExpiresAt&&c.connectTokenExpiresAt>Date.now()?c.connectToken:null,m=f?(c==null?void 0:c.connectTokenExpiresAt)??null:null,[h,p]=b.useState(()=>(c==null?void 0:c.displayName)??"Assistant"),[g,x]=b.useState(()=>(c==null?void 0:c.selectedRuntime)??null),[w,S]=b.useState(null),[k,j]=b.useState(null),[C,N]=b.useState(null),[R,M]=b.useState(()=>f),[L,O]=b.useState(()=>m),[B,I]=b.useState([]),[Y,z]=b.useState("form"),[K,ie]=b.useState(null),ve=b.useRef(null),J=b.useRef(null),W=b.useRef(null),Z=b.useRef(0);b.useEffect(()=>()=>{J.current&&(J.current.cancelled=!0)},[]),b.useEffect(()=>{jz(o,{displayName:h,selectedRuntime:g,connectToken:R,connectTokenExpiresAt:L})},[o,h,g,R,L]),b.useEffect(()=>{(async()=>{try{const we=await Ee.get("/me/organizations");I(we)}catch{}})()},[]),b.useEffect(()=>{if(Y!=="form")return;let we=!1;const me=async()=>{const Ie=++Z.current;try{const St=await ci();if(we||Ie!==Z.current)return;const it=St.filter(V=>V.status==="connected").sort((V,pe)=>pe.lastSeenAt.localeCompare(V.lastSeenAt))[0]??null;if(S(V=>(V==null?void 0:V.id)===(it==null?void 0:it.id)?V:it),it){W.current!==it.id&&(W.current=null,N(null),j(null));try{const V=await dh(it.id);if(we||Ie!==Z.current)return;W.current=it.id,N(it.id),j(V.capabilities)}catch{}}else W.current=null,N(null),j(null)}catch{}};me();const Me=setInterval(me,pY);return()=>{we=!0,clearInterval(Me)}},[Y]),b.useEffect(()=>{if(w)return;if(R&&L&&L>Date.now()){const me=Math.max(L-Date.now(),0),Me=window.setTimeout(()=>{M(null),O(null)},me);return()=>window.clearTimeout(Me)}R&&(M(null),O(null));let we=!1;return(async()=>{try{const me=await Ee.post("/me/connect-tokens",{});we||(M(me.token),O(Date.now()+me.expiresIn*1e3))}catch(me){we||ie(me instanceof Error?me.message:"Failed to generate connect token")}})(),()=>{we=!0}},[w,R,L]);const ne=w&&C===w.id?k:null;b.useEffect(()=>{x(we=>{var Me;if(!ne)return we;const me=vY(ne);return we&&me&&Object.keys(ne).includes(we)&&((Me=ne[we])==null?void 0:Me.state)==="ok"?we:me})},[ne]);const ke=ne?Object.entries(ne).filter(([,we])=>we.state==="ok").map(([we])=>we):[],Ae=((be=B.find(we=>we.id===e))==null?void 0:be.displayName)??"",D=h.trim(),P=D||"your agent",F=R?`npm install -g @agent-team-foundation/first-tree-hub
|
|
418
|
+
first-tree-hub connect ${R}`:null,T=b.useCallback(async we=>{J.current&&(J.current.cancelled=!0);const me={cancelled:!1};J.current=me;const Me=Date.now();for(;!me.cancelled;){let Ie=!1;try{const St=await Ee.get(`/agents/${encodeURIComponent(we)}/client-status`);if(me.cancelled)return;Ie=St.online===!0}catch{if(me.cancelled)return}if(Ie){Ez(o);try{await a()}catch{}if(me.cancelled)return;s("/",{replace:!0});return}if(Date.now()-Me>hY){me.cancelled||z("timeout");return}await new Promise(St=>setTimeout(St,mY))}},[o,a,s]),G=!!(D&&w&&g&&ke.includes(g)&&Y==="form"),q=b.useCallback(async()=>{if(!w||!g||!D)return;ie(null),z("creating");const we=Jy(D);let me;try{me=(await Ee.post(Rn("/agents"),{type:"personal_assistant",displayName:D,...we?{name:we}:{},clientId:w.id,runtimeProvider:g,...e?{organizationId:e}:{}})).uuid,ve.current=me,bz(me),di("agent_created",{runtimeProvider:g})}catch(Me){ie(Me instanceof Error?Me.message:"Failed to create agent"),z("form");return}await T(me)},[D,w,g,T,e]),ae=b.useCallback(async()=>{const we=ve.current;we&&(ie(null),z("creating"),await T(we))},[T]);return Y==="creating"?l.jsx(EY,{nameOrFallback:P}):Y==="timeout"?l.jsx(CY,{nameOrFallback:P,hostname:(w==null?void 0:w.hostname)??null,error:K,onRetry:ae}):l.jsx(bY,{joinPath:n,teamName:Ae,displayName:h,setDisplayName:p,trimmedName:D,connectedClient:w,cliCommand:F,capabilitiesLoaded:ne!==null,okRuntimes:ke,selectedRuntime:g,setSelectedRuntime:x,error:K,canCreate:G,onCreate:q})}function vY(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 bY({joinPath:e,teamName:t,displayName:n,setDisplayName:a,trimmedName:s,connectedClient:o,cliCommand:c,capabilitiesLoaded:f,okRuntimes:m,selectedRuntime:h,setSelectedRuntime:p,error:g,canCreate:x,onCreate:w}){const S=b.useRef(null),k=e==="invite"&&t,j=f&&m.length===0&&!!o,C=s?o?j?"Install Claude Code (or Codex) on that computer, then sign in.":h?"Ready to create.":"Detecting installed runtimes…":"Next: connect the computer where they'll work.":"Next: name your agent.";return b.useEffect(()=>{var N;s||(N=S.current)==null||N.focus()},[s]),l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:k?l.jsxs(l.Fragment,{children:["You've joined"," ",l.jsx("span",{className:"font-semibold",style:{color:"var(--fg-2)"},children:t}),". Set up your first agent — it'll run on a computer you connect."]}):l.jsx(l.Fragment,{children:"Set up your first agent — it'll run on a computer you connect."})}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[l.jsx(Ab,{}),l.jsx(ls,{number:"01",state:s?"complete":"active",children:l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)",flexWrap:"wrap"},children:[l.jsx("label",{htmlFor:"onboarding-name",className:"text-body font-normal",style:{color:"var(--fg-2)",whiteSpace:"nowrap"},children:"Name your agent"}),l.jsx("input",{ref:S,id:"onboarding-name","aria-label":"Agent display name",value:n,onChange:N=>a(N.target.value),placeholder:"e.g. Buddy, Helper",maxLength:200,className:"onboarding-name-input text-body font-medium",style:{flex:"0 1 28ch",minWidth:"22ch",maxWidth:"30ch",padding:"var(--sp-0_5) 0",background:"transparent",border:0,borderBottom:"var(--hairline) solid var(--border-faint)",borderRadius:0,boxShadow:"none",color:"var(--fg)",outline:"none",caretColor:"var(--accent)",transition:"border-color 160ms ease, color 160ms ease"},onFocus:N=>{N.currentTarget.style.borderBottomColor="var(--accent)"},onBlur:N=>{N.currentTarget.style.borderBottomColor="var(--border-faint)"}})]})}),l.jsx(ls,{number:"02",state:x?"complete":s?"active":"idle",children:l.jsxs("div",{style:{animation:s?"subtle-fade 200ms ease-out":void 0},children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{color:s?"var(--fg)":"var(--fg-4)",fontWeight:s?600:500},children:"Connect a computer"}),s?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:o?`${s} will run on this computer and stay connected to Hub.`:`${s} needs a computer to run on. Connect one with the command below.`}),!o&&l.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",marginTop:"var(--sp-2)"},children:"Open Terminal on that computer and run this command."}),o?l.jsxs(l.Fragment,{children:[l.jsx(kY,{hostname:o.hostname??o.id}),l.jsx(SY,{runtimes:m,selected:h,onSelect:p,capabilitiesLoaded:f})]}):l.jsxs(l.Fragment,{children:[l.jsx(xY,{command:c}),l.jsx(wY,{})]})]}):null]})})]}),g&&l.jsx("div",{className:"text-body",style:{marginTop:"var(--sp-4)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:g}),s&&l.jsxs("div",{style:{marginTop:x?"var(--sp-4)":"var(--sp-5)",marginLeft:"calc(var(--sp-5) + var(--sp-3))",animation:"subtle-fade 180ms ease-out"},children:[!x&&l.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-4)"},children:C}),x&&l.jsxs(ye,{type:"button",size:"default",style:{marginTop:0,border:"var(--hairline) solid color-mix(in oklch, var(--accent) 32%, transparent)",background:"var(--accent)",boxShadow:"var(--shadow-md)",color:"var(--primary-foreground, var(--color-primary-foreground))",opacity:1,transform:"translateZ(0)",transition:"box-shadow 160ms ease, transform 160ms ease"},onClick:w,onMouseEnter:N=>{N.currentTarget.style.transform="scale(1.01)",N.currentTarget.style.boxShadow="var(--shadow-md)"},onMouseLeave:N=>{N.currentTarget.style.transform="scale(1)",N.currentTarget.style.boxShadow="var(--shadow-md)"},children:[l.jsxs("span",{children:["Create ",s]}),l.jsx(vE,{className:"h-4 w-4"})]}),l.jsx("p",{className:"text-caption",style:{margin:x?"var(--sp-2) 0 0":"var(--sp-0_5) 0 0",color:"var(--fg-4)"},children:"You can customize this agent after setup."})]})]})}function xY({command:e}){const[t,n]=b.useState(!1),s=(e?e.split(`
|
|
419
|
+
`):[]).find(m=>m.startsWith("first-tree-hub"))??"",o="first-tree-hub connect ",c=s.startsWith(o)?`${o}${s.slice(o.length,o.length+22)}…`:s.length>52?`${s.slice(0,52)}…`:s,f=async()=>{e&&(await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500))};return l.jsx("div",{style:{marginTop:"var(--sp-2)"},children:l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[l.jsx("pre",{className:"mono text-label",title:s,style:{flex:1,minHeight:38,margin:0,padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--bg-sunken) 42%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--border-faint) 58%, transparent)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",whiteSpace:"nowrap",overflow:"hidden",minWidth:0},children:c||"Generating token…"}),l.jsxs(ye,{type:"button",variant:"outline",size:"sm",onClick:f,disabled:!e,style:{alignSelf:"stretch",background:"color-mix(in oklch, var(--bg-raised) 48%, transparent)",borderColor:"color-mix(in oklch, var(--border) 58%, transparent)",boxShadow:"none",height:"auto",minHeight:38},children:[t?l.jsx(cr,{className:"h-3.5 w-3.5"}):l.jsx(Cv,{className:"h-3.5 w-3.5"}),t?"Copied":"Copy"]})]})})}function wY(){return l.jsxs("div",{className:"flex items-center text-body",style:{gap:"var(--sp-2)",marginTop:"var(--sp-2_5)",color:"color-mix(in oklch, var(--accent) 24%, var(--fg-3))"},children:[l.jsx(jY,{}),l.jsx("span",{children:"Waiting for your computer…"})]})}function SY({runtimes:e,selected:t,onSelect:n,capabilitiesLoaded:a}){return e.length===0?l.jsx("p",{className:"text-label",style:{marginTop:"var(--sp-3)",color:"var(--fg-3)"},children:a?"No runtime ready on this computer. Install Claude Code or Codex, then check back.":"Detecting installed runtimes…"}):l.jsxs("div",{style:{marginTop:"var(--sp-3)"},children:[l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Powered by"}),l.jsxs("fieldset",{className:"flex",style:{gap:"var(--sp-4)",flexWrap:"wrap",margin:0,padding:0,border:0},children:[l.jsx("legend",{className:"sr-only",children:"Runtime provider"}),e.map((s,o)=>{const c=t===s;return l.jsxs("label",{className:"onboarding-runtime-option inline-flex items-center text-body",style:{gap:"var(--sp-1_5)",padding:"var(--sp-1) 0",cursor:"pointer",color:c?"color-mix(in oklch, var(--accent) 30%, var(--fg))":"var(--fg)",fontWeight:c?600:400,animation:`onboarding-rise 220ms ease-out ${o*80}ms both`,transition:"color 160ms ease, opacity 160ms ease, transform 160ms ease"},children:[l.jsx("input",{type:"radio",name:"onboarding-runtime",value:s,checked:c,onChange:()=>n(s),className:"sr-only"}),l.jsx("span",{"aria-hidden":"true",className:"inline-flex items-center justify-center",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",borderRadius:"50%",border:c?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-strong)",background:c?"color-mix(in oklch, var(--accent) 8%, transparent)":"transparent",boxShadow:c?"0 0 0 var(--sp-0_5) color-mix(in oklch, var(--accent) 10%, transparent)":"none",transition:"border-color 160ms ease, background 160ms ease, box-shadow 160ms ease"},children:c&&l.jsx("span",{style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--accent)"}})}),gY(s)]},s)})]})]})}function kY({hostname:e}){return l.jsxs("div",{className:"inline-flex items-center text-body",style:{gap:"var(--sp-2)",marginTop:"var(--sp-2_5)",padding:"var(--sp-1_5) var(--sp-2_5)",borderRadius:999,background:"color-mix(in oklch, var(--accent) 10%, transparent)",color:"color-mix(in oklch, var(--accent) 26%, var(--fg))",animation:"onboarding-pop 260ms cubic-bezier(0.2, 0.9, 0.2, 1.15)"},children:[l.jsx(cr,{className:"h-3.5 w-3.5"}),l.jsxs("span",{children:[l.jsx("span",{className:"mono font-semibold",children:e})," connected"]})]})}function jY(){return l.jsxs("span",{"aria-hidden":"true",style:{position:"relative",display:"inline-block",width:8,height:8,flexShrink:0},children:[l.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--accent)"}}),l.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--accent)",animation:"ring-pulse 1.8s infinite",opacity:.55}})]})}function EY({nameOrFallback:e}){return l.jsxs("div",{className:"flex flex-col items-center text-center",style:{paddingTop:"var(--sp-12)",gap:"var(--sp-4)"},children:[l.jsxs("p",{className:"text-title",style:{color:"var(--fg)"},children:["Creating ",e,"…"]}),l.jsx(NY,{}),l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Usually takes ~10 seconds"})]})}function CY({nameOrFallback:e,hostname:t,error:n,onRetry:a}){const s=t??"your computer";return l.jsxs("div",{className:"flex flex-col",style:{paddingTop:"var(--sp-8)",gap:"var(--sp-4)"},children:[l.jsxs("p",{className:"text-title",style:{color:"var(--fg)"},children:[e," is taking longer than expected."]}),n?l.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 10%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 25%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:n}):l.jsxs("div",{className:"text-body",style:{color:"var(--fg-2)"},children:[l.jsx("p",{children:"This usually means:"}),l.jsxs("ul",{style:{paddingLeft:"var(--sp-4)",listStyle:"disc",marginTop:"var(--sp-1_5)"},children:[l.jsxs("li",{children:["The runtime can't start on ",s," (missing API key, etc.)"]}),l.jsxs("li",{children:["The connection to ",s," dropped"]})]}),l.jsxs("p",{style:{marginTop:"var(--sp-2)"},children:["Fix it on ",s,", then click ",l.jsx("span",{className:"font-semibold",children:"Try again"}),"."]})]}),l.jsx("div",{className:"flex",style:{gap:"var(--sp-2)"},children:l.jsx(ye,{onClick:a,children:"Try again"})})]})}function NY(){return l.jsxs("span",{className:"flex items-center",style:{gap:6},children:[l.jsx(Gg,{delayMs:0}),l.jsx(Gg,{delayMs:160}),l.jsx(Gg,{delayMs:320})]})}function Gg({delayMs:e}){return l.jsx("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:"50%",background:"var(--accent)",animation:"heartbeat-pulse 1.2s ease-in-out infinite",animationDelay:`${e}ms`,display:"inline-block"}})}async function MT(){return(await Ee.get("/me/github/repos")).repos}const DT="https://github.com/agent-team-foundation/first-tree";function IT(e){return e.length===1?[`Source repo: ${e[0]}`]:["Source repos:",...e.map(t=>`- ${t}`)]}function Rb(e,t){const n=IT(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: ${DT}`].join(`
|
|
420
|
+
`)}function _Y(e){const t=IT(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: ${DT}`].join(`
|
|
421
|
+
`)}function TY(){const{role:e}=vt();return e==="admin"?l.jsx(IY,{}):l.jsx(AY,{})}function AY(){var f,m;const{organizationId:e}=vt(),[t,n]=b.useState({kind:"loading"}),[a,s]=b.useState(0);if(b.useEffect(()=>{if(!e){n({kind:"loaded",tree:null,repos:null});return}let h=!1;return n({kind:"loading"}),(async()=>{try{const[p,g]=await Promise.all([Eb(e),bT(e)]);if(h)return;n({kind:"loaded",tree:p,repos:g})}catch(p){if(h)return;n({kind:"error",message:p instanceof Error?p.message:"Failed to load team setup"})}})(),()=>{h=!0}},[e,a]),t.kind==="loading")return l.jsx(OY,{});if(t.kind==="error")return l.jsx(RY,{message:t.message,onRetry:()=>s(h=>h+1)});const o=((f=t.tree)==null?void 0:f.repo)??"",c=((m=t.repos)==null?void 0:m.repos)??[];return o&&c.length>0?l.jsx(zY,{treeUrl:o,teamRepos:c}):o?l.jsx(MY,{treeUrl:o}):l.jsx(DY,{})}function RY({message:e,onRetry:t}){return l.jsxs("div",{style:{padding:"var(--sp-5) var(--sp-4)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-card)"},children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:"var(--fg)"},children:"Couldn't load your team's setup"}),l.jsxs("p",{className:"text-body",style:{marginTop:"var(--sp-2)",color:"var(--fg-3)"},children:[e,". This is usually a transient network issue."]}),l.jsx("div",{style:{marginTop:"var(--sp-3)"},children:l.jsx(ye,{type:"button",onClick:t,children:"Try again"})})]})}function OY(){return l.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)"},children:"Checking your team's setup…"})}function zY({treeUrl:e,teamRepos:t}){var k;const n=An(),{dismissOnboarding:a}=vt(),{addToast:s}=Ic(),[o,c]=b.useState(!1),[f,m]=b.useState(null),[h,p]=b.useState(()=>t.map(j=>j.url)),g=h.length>0,x=b.useCallback(j=>{p(C=>C.includes(j)?C.filter(N=>N!==j):[...C,j])},[]),w=b.useCallback(async()=>{if(h.length!==0){c(!0),m(null);try{const j=await Ob(),C=await Nh(j.uuid);await _h(j.uuid,{expectedVersion:C.version,payload:{gitRepos:h.map(M=>({url:M}))}});const N=await Cb(j.uuid),R=Rb(h,e);try{await jo(N.id,R)}catch{}di("tree_chat_started",{agentUuid:j.uuid,chatId:N.id,treeMode:"existing",joinPath:"invite"}),a(),n(`/?c=${encodeURIComponent(N.id)}`,{replace:!1})}catch(j){m(j instanceof Error?j.message:"Failed to start the chat"),c(!1)}}},[h,e,n,a]),S=b.useCallback(()=>{di("tree_intro_dismissed",{joinPath:"invite"}),a(),s(zb(n))},[a,s,n]);return l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Your team has already set up its ",l.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"}),". Confirm to bind your agent."]}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[l.jsx(rv,{label:"Tree",value:e}),t.length===1?l.jsx(rv,{label:"Source repo",value:((k=t[0])==null?void 0:k.url)??""}):l.jsxs("fieldset",{disabled:o,style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)",margin:0,padding:0,border:0},children:[l.jsx("legend",{className:"text-label",style:{color:"var(--fg-3)",padding:0,marginBottom:"var(--sp-1)"},children:"Pick the source repos to bind your agent to"}),t.map(j=>{const C=h.includes(j.url);return l.jsxs("label",{className:"text-body",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",background:C?"color-mix(in oklch, var(--accent) 8%, var(--bg))":"var(--bg)",border:C?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",cursor:o?"not-allowed":"pointer",color:C?"var(--fg)":"var(--fg-2)",fontWeight:C?600:400},children:[l.jsx("input",{type:"checkbox",value:j.url,checked:C,onChange:()=>x(j.url),className:"sr-only"}),l.jsx("span",{"aria-hidden":"true",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:C?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border)",borderRadius:"var(--radius-chip)",background:C?"var(--accent)":"transparent",color:"var(--bg)",transition:"background 120ms ease, border-color 120ms ease"},children:C?l.jsx(cr,{className:"h-3 w-3",strokeWidth:3}):null}),l.jsx("span",{className:"mono truncate",style:{minWidth:0,flex:1},children:j.url})]},j.url)})]}),f?l.jsx(Mb,{children:f}):null,l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)"},children:[l.jsx(ye,{type:"button",disabled:!g||o,onClick:()=>void w(),children:o?"Starting…":"Confirm"}),l.jsx(ye,{type:"button",variant:"outline",onClick:S,disabled:o,children:"I'll do it later"})]})]})]})}function MY({treeUrl:e}){const t=An(),{dismissOnboarding:n}=vt(),{addToast:a}=Ic(),[s,o]=b.useState(!1),[c,f]=b.useState(null),[m,h]=b.useState(null),[p,g]=b.useState(null),[x,w]=b.useState([]),S=x.length>0,k=b.useCallback(N=>{w(R=>R.includes(N)?R.filter(M=>M!==N):[...R,N])},[]);b.useEffect(()=>{let N=!1;return(async()=>{try{const R=await MT();if(N)return;h(R)}catch(R){N||g(R instanceof Error?R.message:"Failed to list GitHub repositories")}})(),()=>{N=!0}},[]);const j=b.useCallback(async()=>{if(x.length!==0){o(!0),f(null);try{const N=await Ob(),R=await Nh(N.uuid);await _h(N.uuid,{expectedVersion:R.version,payload:{gitRepos:x.map(O=>({url:O}))}});const M=await Cb(N.uuid),L=Rb(x,e);try{await jo(M.id,L)}catch{}di("tree_chat_started",{agentUuid:N.uuid,chatId:M.id,treeMode:"existing",joinPath:"invite"}),n(),t(`/?c=${encodeURIComponent(M.id)}`,{replace:!1})}catch(N){f(N instanceof Error?N.message:"Failed to start the chat"),o(!1)}}},[x,e,t,n]),C=b.useCallback(()=>{di("tree_intro_dismissed",{joinPath:"invite"}),n(),a(zb(t))},[n,a,t]);return l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Joining your team's ",l.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"}),". Pick the source repos you'll work with."]}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[l.jsx(Ab,{}),l.jsx(ls,{number:"01",state:"complete",children:l.jsx(rv,{label:"Tree",value:e})}),l.jsx(ls,{number:"02",state:S?"complete":"active",children:l.jsx(LT,{disabled:s,repos:m,error:p,selectedRepoUrls:x,onToggle:k})}),l.jsxs(ls,{number:"03",state:S?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:S?"var(--fg)":"var(--fg-4)",fontWeight:S?600:500},children:"Let your agent join the tree"}),S?l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:["It'll install the skill and bind"," ",x.length>1?"each source repo":"your source repo"," to the existing team tree."]}),c?l.jsx(Mb,{style:{marginTop:"var(--sp-3)"},children:c}):null,l.jsxs("div",{className:"flex",style:{marginTop:"var(--sp-3)",gap:"var(--sp-2)"},children:[l.jsx(ye,{type:"button",disabled:!S||s,onClick:()=>void j(),children:s?"Starting…":"Continue"}),l.jsx(ye,{type:"button",variant:"outline",onClick:C,disabled:s,children:"I'll do it later"})]})]}):null]})]})]})}function DY(){const{dismissOnboarding:e}=vt(),{addToast:t}=Ic(),n=b.useRef(!1);return b.useEffect(()=>{n.current||(n.current=!0,di("tree_intro_dismissed",{joinPath:"invite",reason:"team_unconfigured"}),e(),t({title:"Your team admin hasn't finished setup",description:"Ask your admin to bind a context-tree and source repo. You can keep using your agent for general chat in the meantime."}))},[e,t]),l.jsxs("div",{style:{padding:"var(--sp-5) var(--sp-4)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-card)"},children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:"var(--fg)"},children:"Your team admin hasn't finished setup yet"}),l.jsx("p",{className:"text-body",style:{marginTop:"var(--sp-2)",color:"var(--fg-3)"},children:"Once they finish setup, this view will guide your agent to join. For now, your agent can help with anything that doesn't depend on your team's shared knowledge."})]})}function IY(){const e=An(),{dismissOnboarding:t,organizationId:n}=vt(),{addToast:a}=Ic(),[s,o]=b.useState(!1),[c,f]=b.useState(null),[m,h]=b.useState(null),[p,g]=b.useState(""),[x,w]=b.useState([]),[S,k]=b.useState(null),[j,C]=b.useState(null),N=b.useCallback(z=>{w(K=>K.includes(z)?K.filter(ie=>ie!==z):[...K,z])},[]);b.useEffect(()=>{let z=!1;return(async()=>{try{const K=await MT();if(z)return;k(K)}catch(K){z||C(K instanceof Error?K.message:"Failed to list GitHub repositories")}})(),()=>{z=!0}},[]),b.useEffect(()=>{if(!n)return;let z=!1;return(async()=>{try{const K=await Eb(n);if(z)return;K.repo&&(g(K.repo),h(ie=>ie??"existing"))}catch{}})(),()=>{z=!0}},[n]);const R=p.trim(),M=(()=>{if(m!=="existing")return!0;if(!R)return!1;try{return new URL(R).protocol==="https:"}catch{return!1}})(),L=b.useCallback(()=>{di("tree_intro_dismissed"),t(),a(zb(e))},[t,a,e]),O=b.useCallback(async()=>{if(x.length!==0&&m&&!(m==="existing"&&!M)){f(null),o(!0);try{const z=await Ob(),K=await Nh(z.uuid),ie=x.map(W=>({url:W}));if(await _h(z.uuid,{expectedVersion:K.version,payload:{gitRepos:ie}}),n)try{await xT(n,{repos:ie})}catch(W){console.warn("Step 3: PUT source_repos failed; agent gitRepos already saved",W)}if(m==="existing"&&n)try{await vT(n,{repo:R})}catch(W){console.warn("Step 3: PUT context_tree settings failed; agent will still proceed",W),a({title:"Tree binding wasn't saved to Hub yet",description:"Your agent will still proceed. You can re-bind from Team Settings later."})}const ve=await Cb(z.uuid),J=m==="existing"?Rb(x,R):_Y(x);try{await jo(ve.id,J)}catch{}di("tree_chat_started",{agentUuid:z.uuid,chatId:ve.id,treeMode:m}),t(),e(`/?c=${encodeURIComponent(ve.id)}`,{replace:!1})}catch(z){f(z instanceof Error?z.message:"Failed to start the tree-init chat"),o(!1)}}},[x,m,M,R,n,e,t,a]),B=x.length>0,I=B&&m!==null&&!s&&(m==="new"||M),Y=!!m&&(m==="new"||M);return l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Build the ",l.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"})," — your team's shared knowledge that grows with your code."]}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[l.jsx(Ab,{}),l.jsx(ls,{number:"01",state:B?"complete":"active",children:l.jsx(LT,{disabled:s,repos:S,error:j,selectedRepoUrls:x,onToggle:N})}),l.jsxs(ls,{number:"02",state:Y?"complete":B?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:B?"var(--fg)":"var(--fg-4)",fontWeight:B?600:500},children:"Bind or create the tree"}),B?l.jsxs("div",{style:{marginTop:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[l.jsxs("fieldset",{"aria-label":"Bind or create the tree",disabled:s,style:{display:"inline-flex",alignSelf:"flex-start",padding:"var(--sp-0_5)",margin:0,background:"var(--surface-2)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",gap:"var(--sp-0_5)"},children:[l.jsx("legend",{className:"sr-only",children:"Bind or create the tree"}),[{value:"existing",label:"Bind to an existing tree"},{value:"new",label:"Create a new tree"}].map(z=>{const K=m===z.value;return l.jsxs("label",{className:"text-body transition-colors",style:{padding:"var(--sp-1_5) var(--sp-3)",background:K?"var(--bg)":"transparent",borderRadius:"calc(var(--radius-input) - var(--sp-0_5))",color:K?"var(--fg)":"var(--fg-3)",fontWeight:K?600:400,boxShadow:K?"var(--shadow-sm)":"none",cursor:s?"not-allowed":"pointer",userSelect:"none"},children:[l.jsx("input",{type:"radio",name:"tree-mode",value:z.value,checked:K,onChange:()=>h(z.value),className:"sr-only"}),z.label]},z.value)})]}),m==="existing"?l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1)"},children:[l.jsx("label",{htmlFor:"onboarding-existing-tree-url",className:"text-label",style:{color:"var(--fg-3)"},children:"Tree GitHub URL"}),l.jsx("input",{id:"onboarding-existing-tree-url",type:"url",value:p,onChange:z=>g(z.target.value),placeholder:"https://github.com/your-org/your-tree",disabled:s,className:"text-body",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)",outline:"none",fontFamily:"var(--font-mono)"}})]}):null,m==="new"?l.jsxs("p",{className:"text-label",style:{margin:0,color:"var(--fg-3)"},children:["Your agent will scaffold a new GitHub repo for the tree and bind"," ",x.length>1?"each selected source repo":"the source repo"," to it."]}):null]}):null]}),l.jsxs(ls,{number:"03",state:Y?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:Y?"var(--fg)":"var(--fg-4)",fontWeight:Y?600:500},children:"Let your agent build it"}),Y?l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:["It'll install the skill, set up the tree, and open a PR back to"," ",x.length>1?"each source repo":"your source repo","."]}),c?l.jsx(Mb,{style:{marginTop:"var(--sp-3)"},children:c}):null,l.jsxs("div",{className:"flex",style:{marginTop:"var(--sp-3)",gap:"var(--sp-2)"},children:[l.jsx(ye,{type:"button",disabled:!I,onClick:()=>void O(),children:s?"Starting…":"Continue"}),l.jsx(ye,{type:"button",variant:"outline",onClick:L,disabled:s,children:"I'll do it later"})]})]}):null]})]})]})}async function Ob(){const e=vz(),t=await Pv(),n=t.filter(s=>s.type!=="human"),a=(e?t.find(s=>s.uuid===e):void 0)??n.slice().sort((s,o)=>o.uuid.localeCompare(s.uuid))[0]??t[0];if(!a)throw new Error("No agent available to chat with — finish Step 2 first.");return a}function zb(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 rv({label:e,value:t}){return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1)"},children:[l.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:e}),l.jsx("span",{className:"mono text-body truncate",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",minWidth:0},title:t,children:t})]})}function Mb({children:e,style:t}){return l.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)",...t},children:e})}function LT({disabled:e,repos:t,error:n,selectedRepoUrls:a,onToggle:s}){const o=l.jsx("h2",{className:"text-subtitle font-semibold",style:{color:e?"var(--fg-4)":"var(--fg)",fontWeight:e?500:600},children:"Pick source repos"});return e?l.jsx("div",{children:o}):n?l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsxs("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:[n,". Reconnect your GitHub account to grant repo access."]}),l.jsx("div",{style:{marginTop:"var(--sp-2)"},children:l.jsx(ye,{type:"button",variant:"outline",size:"sm",asChild:!0,children:l.jsx("a",{href:"/api/v1/auth/github/start?next=/",children:"Reconnect GitHub"})})})]}):t===null?l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:"Loading your GitHub repositories…"})]}):t.length===0?l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:"No repositories found on your GitHub account. Create one and refresh this page."})]}):l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"The code your tree will organize knowledge about. Pick one or more."}),l.jsx(LY,{repos:t,selectedRepoUrls:a,onToggle:s})]})}function LY({repos:e,selectedRepoUrls:t,onToggle:n}){const[a,s]=b.useState(!1),o=b.useRef(null);b.useEffect(()=>{if(!a)return;const p=x=>{o.current&&!o.current.contains(x.target)&&s(!1)},g=x=>{x.key==="Escape"&&s(!1)};return window.addEventListener("mousedown",p),window.addEventListener("keydown",g),()=>{window.removeEventListener("mousedown",p),window.removeEventListener("keydown",g)}},[a]);const c=b.useMemo(()=>{const p=new Map;for(const g of e){const x=g.fullName.split("/")[0]??"",w=p.get(x);w?w.push(g):p.set(x,[g])}return[...p.entries()].sort(([g],[x])=>g.localeCompare(x))},[e]),f=b.useMemo(()=>new Set(t),[t]),m=b.useMemo(()=>e.filter(p=>f.has(p.cloneUrl)),[e,f]),h=m.length===0?"Select repositories…":"Add another repository";return l.jsxs("div",{ref:o,className:"relative",style:{marginTop:"var(--sp-2)"},children:[m.length>0&&l.jsx("div",{style:{marginBottom:"var(--sp-2)",display:"flex",flexWrap:"wrap",gap:"var(--sp-1_5)"},children:m.map(p=>l.jsx(PY,{fullName:p.fullName,onRemove:()=>n(p.cloneUrl)},p.cloneUrl))}),l.jsxs("button",{type:"button","aria-haspopup":"listbox","aria-expanded":a,onClick:()=>s(p=>!p),className:"text-body",style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg-3)",outline:"none",cursor:"pointer",textAlign:"left"},children:[l.jsx("span",{className:"truncate",style:{minWidth:0,flex:1},children:h}),l.jsx(Ev,{className:"h-4 w-4",style:{color:"var(--fg-3)",transition:"transform 120ms ease",transform:a?"rotate(180deg)":"none",flexShrink:0}})]}),a&&l.jsx("div",{role:"listbox","aria-label":"GitHub repositories","aria-multiselectable":"true",className:"absolute z-30 rounded-md border bg-popover shadow-md",style:{top:"calc(100% + var(--sp-1))",left:0,right:0,maxHeight:"min(56vh, 30rem)",overflowY:"auto",padding:"var(--sp-1) 0"},children:c.map(([p,g],x)=>l.jsxs("div",{children:[l.jsx("div",{className:"text-eyebrow",style:{paddingTop:x>0?"var(--sp-3)":"var(--sp-1)",paddingBottom:"var(--sp-1)",paddingLeft:"calc(var(--sp-3) + var(--sp-3_5) + var(--sp-2))",paddingRight:"var(--sp-3)",color:"var(--fg-2)"},children:p}),g.map(w=>{const S=f.has(w.cloneUrl),k=w.fullName.slice(p.length+1);return l.jsxs("button",{type:"button",role:"option","aria-selected":S,onClick:()=>n(w.cloneUrl),className:"text-body transition-colors w-full",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-1) var(--sp-3)",background:S?"var(--accent-bg)":"transparent",color:S?"var(--accent)":"var(--fg)",border:"none",cursor:"pointer",textAlign:"left"},onMouseEnter:j=>{S||(j.currentTarget.style.background="var(--surface-1)")},onMouseLeave:j=>{S||(j.currentTarget.style.background="transparent")},children:[l.jsx("span",{"aria-hidden":"true",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:S?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border)",borderRadius:"var(--radius-chip)",background:S?"var(--accent)":"transparent",color:"var(--bg)",transition:"background 120ms ease, border-color 120ms ease"},children:S?l.jsx(cr,{className:"h-3 w-3",strokeWidth:3}):null}),l.jsx("span",{className:"truncate",style:{minWidth:0,flex:1},children:k}),w.private&&l.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",color:"var(--fg-4)",border:"var(--hairline) solid var(--border-faint)",background:"var(--bg-sunken)",flexShrink:0},children:"private"})]},w.cloneUrl)})]},p))})]})}function PY({fullName:e,onRemove:t}){return l.jsxs("span",{className:"text-label inline-flex items-center",style:{gap:"var(--sp-1)",paddingLeft:"var(--sp-2)",paddingRight:"var(--sp-0_5)",paddingTop:"var(--sp-0_5)",paddingBottom:"var(--sp-0_5)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-chip)",color:"var(--fg-2)",maxWidth:"20rem"},children:[l.jsx("span",{className:"mono truncate",style:{minWidth:0},children:e}),l.jsx("button",{type:"button","aria-label":`Remove ${e}`,onClick:t,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"var(--sp-4)",height:"var(--sp-4)",border:0,padding:0,background:"transparent",color:"var(--fg-3)",cursor:"pointer",borderRadius:"var(--radius-chip)",flexShrink:0,transition:"background 120ms ease, color 120ms ease"},onMouseEnter:n=>{n.currentTarget.style.background="var(--surface-2)",n.currentTarget.style.color="var(--fg)"},onMouseLeave:n=>{n.currentTarget.style.background="transparent",n.currentTarget.style.color="var(--fg-3)"},children:l.jsx(os,{className:"h-3 w-3"})})]})}function UY(){const{onboardingStep:e,refreshMe:t,organizationId:n,memberId:a,role:s}=vt(),[o,c]=lh(),f=o.get("step"),[m]=b.useState(()=>pE()),[h,p]=b.useState(()=>hE()),g=b.useCallback(k=>{yz(k),p(k)},[]),x=s==="admin",w=b.useMemo(()=>f==="team"&&x?"step1":f==="agent"?"step2":f==="tree"||e==="completed"?"step3-intro":e==="connect"&&!h&&m!=="invite"&&x?"step1":"step2",[f,e,h,m,x]),S=b.useCallback(()=>{g(!0);const k=new URLSearchParams(o);k.delete("step"),c(k,{replace:!0})},[g,o,c]);return l.jsx("div",{className:"flex-1 overflow-auto",style:{display:"flex",justifyContent:"center",padding:"clamp(var(--sp-16), 12vh, var(--sp-45)) var(--sp-4) var(--sp-12)"},children:l.jsx("div",{style:{width:"100%",maxWidth:720},children:w==="step1"?l.jsx(fY,{organizationId:n,onContinue:S}):w==="step2"?l.jsx(yY,{organizationId:n,memberId:a,joinPath:m,refreshMe:t}):l.jsx(TY,{})})})}function BY({selectedChatId:e,onSelectChat:t}){const{onboardingStep:n,onboardingDismissedAt:a}=vt();return e===nh?l.jsx(dK,{onCreated:t}):e?l.jsx(cY,{chatId:e}):n!==null&&!a?l.jsx(UY,{}):l.jsx(dY,{})}const FY={1:"Name your team",2:"Set up your agent",3:"Build your context-tree"};function $Y(){const{onboardingStep:e,onboardingDismissedAt:t,dismissOnboarding:n}=vt(),{addToast:a}=Ic(),s=An(),[o,c]=lh(),f=o.get("c"),m=o.get("step"),h=hE(),g=pE()==="invite",x=b.useMemo(()=>m==="team"?1:m==="agent"?2:m==="tree"||f||e==="completed"?3:e==="create_agent"?2:e==="connect"&&!h&&!g?1:2,[m,f,e,h,g]);if(e===null||t)return null;const w=e==="completed",S=()=>{n(),a({title:"Setup hidden",description:"Resume any time in Settings → Onboarding.",action:{label:"Open settings",onClick:()=>s("/settings/onboarding")}})},k={1:Vg(1,x,e),2:Vg(2,x,e),3:Vg(3,x,e)},j=C=>{if(C!==3)return;const N=new URLSearchParams(o);N.delete("c"),N.set("step","tree"),c(N,{replace:!1})};return l.jsxs("nav",{"aria-label":"Onboarding progress",className:"flex items-center",style:{gap:"var(--sp-3)",padding:"var(--sp-3) var(--sp-4)",borderBottom:"var(--hairline) solid var(--border)",background:"var(--bg)"},children:[l.jsx("ol",{className:"flex items-center justify-center flex-1 min-w-0",style:{gap:0,listStyle:"none",margin:0,padding:0},children:[1,2,3].map((C,N)=>{const R=k[C],M=[1,2,3][N+1],L=M?pj(R)&&pj(k[M]):!1;return l.jsxs("li",{className:"flex items-center",style:{minWidth:0},children:[l.jsx(HY,{index:C,state:R,label:FY[C],onClick:C===3&&R==="active"?()=>j(C):void 0}),M?l.jsx(ZY,{solid:L}):null]},C)})}),l.jsx("button",{type:"button",onClick:S,disabled:!w,title:w?"Hide setup steps":"Finish setting up your agent first","aria-label":"Hide setup steps",className:w?"cursor-pointer":"cursor-not-allowed",style:{flexShrink:0,width:24,height:24,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:0,borderRadius:"var(--rd-1)",color:w?"var(--fg-2)":"var(--fg-4)",fontSize:14,lineHeight:1,opacity:w?1:.5},onMouseEnter:C=>{w&&(C.currentTarget.style.background="var(--surface-2)")},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},children:"✕"})]})}function Vg(e,t,n){return e===t?"active":e===1||e===2&&n==="completed"?"completed":"pending"}function pj(e){return e==="active"||e==="completed"}function HY({index:e,state:t,label:n,onClick:a}){const s=!!a,o=qY(t,e);return l.jsxs("button",{type:"button",onClick:s?a:void 0,disabled:!s,"aria-current":t==="active"?"step":void 0,className:`flex items-center ${s?"cursor-pointer":"cursor-default"}`,style:{gap:"var(--sp-2)",background:"transparent",border:0,padding:0,font:"inherit",color:t==="active"?"var(--fg)":t==="completed"?"var(--fg-2)":"var(--fg-3)",fontWeight:t==="active"?600:500},children:[o,l.jsxs("span",{className:"text-label whitespace-nowrap",style:{textDecoration:s?"none":void 0},children:["Step ",e," · ",n]})]})}function qY(e,t){return e==="completed"?l.jsx("span",{"aria-hidden":"true",style:{width:22,height:22,borderRadius:"50%",background:"var(--accent)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:12,lineHeight:1,flexShrink:0},children:"✓"}):e==="active"?l.jsxs("span",{"aria-hidden":"true",style:{position:"relative",width:22,height:22,flexShrink:0,display:"inline-block"},children:[l.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--accent)",animation:"ring-pulse 1.8s infinite",opacity:.5}}),l.jsx("span",{className:"mono",style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--accent)",border:"var(--hairline-bold) solid var(--accent)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:12,fontWeight:600,lineHeight:1},children:t})]}):e==="error"?l.jsx("span",{"aria-hidden":"true",style:{width:22,height:22,borderRadius:"50%",background:"var(--state-error)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:13,lineHeight:1,flexShrink:0},children:"⊗"}):l.jsx("span",{"aria-hidden":"true",style:{width:22,height:22,borderRadius:"50%",background:"transparent",border:"var(--hairline) solid var(--fg-3)",flexShrink:0,display:"inline-block"}})}function ZY({solid:e}){return l.jsx("span",{"aria-hidden":"true",style:{flex:"0 1 var(--sp-15)",minWidth:24,height:0,margin:"0 var(--sp-2)",borderTop:e?"var(--hairline-bold) solid var(--accent)":"var(--hairline) dashed var(--fg-3)"}})}const GY=BN.catch("active");function VY(){const[e,t]=lh(),n=e.get("c"),a=e.get("a"),s=GY.parse(e.get("engagement"));KN(),b.useEffect(()=>{if(a&&n){t({c:n},{replace:!0});return}a&&!n&&t({},{replace:!0})},[a,n,t]);const o=b.useCallback(m=>{const h=new URLSearchParams(e);h.set("c",m),t(h)},[e,t]),c=b.useCallback(()=>{const m=new URLSearchParams(e);m.set("c",nh),t(m)},[e,t]),f=b.useCallback(m=>{const h=new URLSearchParams(e);m==="active"?h.delete("engagement"):h.set("engagement",m),t(h,{replace:!0})},[e,t]);return l.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[l.jsx(sK,{selectedChatId:n,onSelectChat:o,onNewChat:c,engagement:s,onEngagementChange:f}),l.jsxs("main",{className:"flex-1 flex flex-col overflow-hidden min-w-0",style:{background:"var(--bg)"},children:[l.jsx($Y,{}),l.jsx(BY,{selectedChatId:n,onSelectChat:o})]})]})}const QY=new _R({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});function KY(){return l.jsx(TR,{client:QY,children:l.jsx(_z,{children:l.jsx(M4,{children:l.jsx(az,{children:l.jsxs(zO,{children:[l.jsx(It,{path:"/login",element:l.jsx(xV,{})}),l.jsx(It,{path:"/signup",element:l.jsx(or,{to:"/login",replace:!0})}),l.jsx(It,{path:"/auth/github/complete",element:l.jsx(wV,{})}),l.jsx(It,{path:"/invite/:token",element:l.jsx(gV,{})}),null,l.jsx(It,{element:l.jsx(zz,{}),children:l.jsxs(It,{element:l.jsx(p9,{children:l.jsx(O4,{})}),children:[l.jsx(It,{index:!0,element:l.jsx(VY,{})}),l.jsx(It,{path:"context",element:l.jsx(TG,{})}),l.jsx(It,{path:"agents/:uuid",element:l.jsx(HZ,{})}),l.jsx(It,{path:"team",element:l.jsx(AQ,{})}),l.jsxs(It,{path:"settings",element:l.jsx(oQ,{}),children:[l.jsx(It,{index:!0,element:l.jsx(or,{to:"computers",replace:!0})}),l.jsx(It,{path:"team",element:l.jsx(GQ,{})}),l.jsx(It,{path:"computers",element:l.jsx(IV,{})}),l.jsx(It,{path:"github",element:l.jsx(HV,{})}),l.jsx(It,{path:"integrations",element:l.jsx(iQ,{})}),l.jsx(It,{path:"onboarding",element:l.jsx(sQ,{})}),l.jsx(It,{path:"setup",element:l.jsx(or,{to:"/settings/onboarding",replace:!0})})]}),l.jsx(It,{path:"agents",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(It,{path:"clients",element:l.jsx(or,{to:"/settings/computers",replace:!0})}),l.jsx(It,{path:"integrations",element:l.jsx(or,{to:"/settings/integrations",replace:!0})}),l.jsx(It,{path:"team/members",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(It,{path:"team/agents",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(It,{path:"team/invite",element:l.jsx(or,{to:"/team",replace:!0})}),l.jsx(It,{path:"team/settings",element:l.jsx(or,{to:"/settings/team",replace:!0})}),l.jsx(It,{path:"admin",element:l.jsx(YY,{})})]})})]})})})})})}function YY(){const e=Cr();return e.hash==="#bindings"?l.jsx(or,{to:`/settings/integrations${e.search}`,replace:!0}):l.jsx(or,{to:`/team${e.hash}`,replace:!0})}const PT=document.getElementById("root");if(!PT)throw new Error("Root element not found");nR.createRoot(PT).render(l.jsx(b.StrictMode,{children:l.jsx(KY,{})}));export{vE as A,Dc as F,Rc as L,UM as U,et as c,l as j,b as r};
|