@agent-team-foundation/first-tree-hub 0.13.0 → 0.14.1
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/{bootstrap-Cya2OoHz.mjs → bootstrap-C15ZBOCC.mjs} +1 -0
- package/dist/cli/index.mjs +7 -7
- package/dist/{client-h4KZ3b9o-CQyibXig.mjs → client-CREn8bJ0-C5fHJir6.mjs} +2 -2
- package/dist/{client-BH4CmUL0-CybE3kuP.mjs → client-CzXmweS9-DhUiuQvL.mjs} +59 -6
- package/dist/{dist-C8yStx2L.mjs → dist-1XGLJMOq.mjs} +109 -9
- package/dist/drizzle/0044_agent_avatar_color.sql +11 -0
- package/dist/drizzle/0045_agent_avatar_image.sql +17 -0
- package/dist/drizzle/meta/_journal.json +14 -0
- package/dist/{feishu-D_vnqC6a.mjs → feishu-BGx71p5s.mjs} +1 -1
- package/dist/index.mjs +5 -5
- package/dist/{invitation-CNv7gfFF-D93KQte0.mjs → invitation-CNv7gfFF-DOFZ75wb.mjs} +1 -1
- package/dist/{saas-connect-Bb5LR4y6.mjs → saas-connect-BBRxjmBS.mjs} +635 -113
- package/dist/web/assets/index-BOK7e_td.css +1 -0
- package/dist/web/assets/{index-CJcRUZ8l.js → index-DMqnX4IR.js} +1 -1
- package/dist/web/assets/index-QDcpYpEa.js +416 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-DL_9NFkt.js +0 -421
- package/dist/web/assets/index-DaWEZnjh.css +0 -1
|
@@ -1,421 +0,0 @@
|
|
|
1
|
-
var Tw=e=>{throw TypeError(e)};var Qp=(e,t,n)=>t.has(e)||Tw("Cannot "+n);var B=(e,t,n)=>(Qp(e,t,"read from private field"),n?n.call(e):t.get(e)),Te=(e,t,n)=>t.has(e)?Tw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ke=(e,t,n,a)=>(Qp(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n),Qe=(e,t,n)=>(Qp(e,t,"access private method"),n);var uf=(e,t,n,a)=>({set _(s){ke(e,t,s,n)},get _(){return B(e,t,a)}});function pR(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 oh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Kp={exports:{}},zu={};/**
|
|
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 Aw;function gR(){if(Aw)return zu;Aw=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 zu.Fragment=t,zu.jsx=n,zu.jsxs=n,zu}var Rw;function yR(){return Rw||(Rw=1,Kp.exports=gR()),Kp.exports}var l=yR(),Yp={exports:{}},We={};/**
|
|
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 Ow;function vR(){if(Ow)return We;Ow=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"),S=Symbol.iterator;function x(P){return P===null||typeof P!="object"?null:(P=S&&P[S]||P["@@iterator"],typeof P=="function"?P:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,w={};function C(P,U,T){this.props=P,this.context=U,this.refs=w,this.updater=T||j}C.prototype.isReactComponent={},C.prototype.setState=function(P,U){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,U,"setState")},C.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function _(){}_.prototype=C.prototype;function R(P,U,T){this.props=P,this.context=U,this.refs=w,this.updater=T||j}var z=R.prototype=new _;z.constructor=R,k(z,C.prototype),z.isPureReactComponent=!0;var I=Array.isArray;function O(){}var F={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function W(P,U,T){var G=T.ref;return{$$typeof:e,type:P,key:U,ref:G!==void 0?G:null,props:T}}function L(P,U){return W(P.type,U,P.props)}function V(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function Y(P){var U={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(T){return U[T]})}var me=/\/+/g;function te(P,U){return typeof P=="object"&&P!==null&&P.key!=null?Y(""+P.key):U.toString(36)}function J(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(U){P.status==="pending"&&(P.status="fulfilled",P.value=U)},function(U){P.status==="pending"&&(P.status="rejected",P.reason=U)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function q(P,U,T,G,Z){var ae=typeof P;(ae==="undefined"||ae==="boolean")&&(P=null);var Se=!1;if(P===null)Se=!0;else switch(ae){case"bigint":case"string":case"number":Se=!0;break;case"object":switch(P.$$typeof){case e:case t:Se=!0;break;case p:return Se=P._init,q(Se(P._payload),U,T,G,Z)}}if(Se)return Z=Z(P),Se=G===""?"."+te(P,0):G,I(Z)?(T="",Se!=null&&(T=Se.replace(me,"$&/")+"/"),q(Z,U,T,"",function($e){return $e})):Z!=null&&(V(Z)&&(Z=L(Z,T+(Z.key==null||P&&P.key===Z.key?"":(""+Z.key).replace(me,"$&/")+"/")+Se)),U.push(Z)),1;Se=0;var Re=G===""?".":G+":";if(I(P))for(var je=0;je<P.length;je++)G=P[je],ae=Re+te(G,je),Se+=q(G,U,T,ae,Z);else if(je=x(P),typeof je=="function")for(P=je.call(P),je=0;!(G=P.next()).done;)G=G.value,ae=Re+te(G,je++),Se+=q(G,U,T,ae,Z);else if(ae==="object"){if(typeof P.then=="function")return q(J(P),U,T,G,Z);throw U=String(P),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return Se}function le(P,U,T){if(P==null)return P;var G=[],Z=0;return q(P,G,"","",function(ae){return U.call(T,ae,Z++)}),G}function ee(P){if(P._status===-1){var U=P._result;U=U(),U.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=U)}if(P._status===1)return P._result.default;throw P._result}var ve=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=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(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},M={map:le,forEach:function(P,U,T){le(P,function(){U.apply(this,arguments)},T)},count:function(P){var U=0;return le(P,function(){U++}),U},toArray:function(P){return le(P,function(U){return U})||[]},only:function(P){if(!V(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return We.Activity=g,We.Children=M,We.Component=C,We.Fragment=n,We.Profiler=s,We.PureComponent=R,We.StrictMode=a,We.Suspense=m,We.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=F,We.__COMPILER_RUNTIME={__proto__:null,c:function(P){return F.H.useMemoCache(P)}},We.cache=function(P){return function(){return P.apply(null,arguments)}},We.cacheSignal=function(){return null},We.cloneElement=function(P,U,T){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var G=k({},P.props),Z=P.key;if(U!=null)for(ae in U.key!==void 0&&(Z=""+U.key),U)!D.call(U,ae)||ae==="key"||ae==="__self"||ae==="__source"||ae==="ref"&&U.ref===void 0||(G[ae]=U[ae]);var ae=arguments.length-2;if(ae===1)G.children=T;else if(1<ae){for(var Se=Array(ae),Re=0;Re<ae;Re++)Se[Re]=arguments[Re+2];G.children=Se}return W(P.type,Z,G)},We.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},We.createElement=function(P,U,T){var G,Z={},ae=null;if(U!=null)for(G in U.key!==void 0&&(ae=""+U.key),U)D.call(U,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(Z[G]=U[G]);var Se=arguments.length-2;if(Se===1)Z.children=T;else if(1<Se){for(var Re=Array(Se),je=0;je<Se;je++)Re[je]=arguments[je+2];Z.children=Re}if(P&&P.defaultProps)for(G in Se=P.defaultProps,Se)Z[G]===void 0&&(Z[G]=Se[G]);return W(P,ae,Z)},We.createRef=function(){return{current:null}},We.forwardRef=function(P){return{$$typeof:f,render:P}},We.isValidElement=V,We.lazy=function(P){return{$$typeof:p,_payload:{_status:-1,_result:P},_init:ee}},We.memo=function(P,U){return{$$typeof:h,type:P,compare:U===void 0?null:U}},We.startTransition=function(P){var U=F.T,T={};F.T=T;try{var G=P(),Z=F.S;Z!==null&&Z(T,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(O,ve)}catch(ae){ve(ae)}finally{U!==null&&T.types!==null&&(U.types=T.types),F.T=U}},We.unstable_useCacheRefresh=function(){return F.H.useCacheRefresh()},We.use=function(P){return F.H.use(P)},We.useActionState=function(P,U,T){return F.H.useActionState(P,U,T)},We.useCallback=function(P,U){return F.H.useCallback(P,U)},We.useContext=function(P){return F.H.useContext(P)},We.useDebugValue=function(){},We.useDeferredValue=function(P,U){return F.H.useDeferredValue(P,U)},We.useEffect=function(P,U){return F.H.useEffect(P,U)},We.useEffectEvent=function(P){return F.H.useEffectEvent(P)},We.useId=function(){return F.H.useId()},We.useImperativeHandle=function(P,U,T){return F.H.useImperativeHandle(P,U,T)},We.useInsertionEffect=function(P,U){return F.H.useInsertionEffect(P,U)},We.useLayoutEffect=function(P,U){return F.H.useLayoutEffect(P,U)},We.useMemo=function(P,U){return F.H.useMemo(P,U)},We.useOptimistic=function(P,U){return F.H.useOptimistic(P,U)},We.useReducer=function(P,U,T){return F.H.useReducer(P,U,T)},We.useRef=function(P){return F.H.useRef(P)},We.useState=function(P){return F.H.useState(P)},We.useSyncExternalStore=function(P,U,T){return F.H.useSyncExternalStore(P,U,T)},We.useTransition=function(){return F.H.useTransition()},We.version="19.2.4",We}var Mw;function cv(){return Mw||(Mw=1,Yp.exports=vR()),Yp.exports}var b=cv();const bR=oh(b),dv=pR({__proto__:null,default:bR},[b]);var Xp={exports:{}},Du={},Wp={exports:{}},Jp={};/**
|
|
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 zw;function xR(){return zw||(zw=1,(function(e){function t(q,le){var ee=q.length;q.push(le);e:for(;0<ee;){var ve=ee-1>>>1,M=q[ve];if(0<s(M,le))q[ve]=le,q[ee]=M,ee=ve;else break e}}function n(q){return q.length===0?null:q[0]}function a(q){if(q.length===0)return null;var le=q[0],ee=q.pop();if(ee!==le){q[0]=ee;e:for(var ve=0,M=q.length,P=M>>>1;ve<P;){var U=2*(ve+1)-1,T=q[U],G=U+1,Z=q[G];if(0>s(T,ee))G<M&&0>s(Z,T)?(q[ve]=Z,q[G]=ee,ve=G):(q[ve]=T,q[U]=ee,ve=U);else if(G<M&&0>s(Z,ee))q[ve]=Z,q[G]=ee,ve=G;else break e}}return le}function s(q,le){var ee=q.sortIndex-le.sortIndex;return ee!==0?ee:q.id-le.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,S=3,x=!1,j=!1,k=!1,w=!1,C=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function z(q){for(var le=n(h);le!==null;){if(le.callback===null)a(h);else if(le.startTime<=q)a(h),le.sortIndex=le.expirationTime,t(m,le);else break;le=n(h)}}function I(q){if(k=!1,z(q),!j)if(n(m)!==null)j=!0,O||(O=!0,Y());else{var le=n(h);le!==null&&J(I,le.startTime-q)}}var O=!1,F=-1,D=5,W=-1;function L(){return w?!0:!(e.unstable_now()-W<D)}function V(){if(w=!1,O){var q=e.unstable_now();W=q;var le=!0;try{e:{j=!1,k&&(k=!1,_(F),F=-1),x=!0;var ee=S;try{t:{for(z(q),g=n(m);g!==null&&!(g.expirationTime>q&&L());){var ve=g.callback;if(typeof ve=="function"){g.callback=null,S=g.priorityLevel;var M=ve(g.expirationTime<=q);if(q=e.unstable_now(),typeof M=="function"){g.callback=M,z(q),le=!0;break t}g===n(m)&&a(m),z(q)}else a(m);g=n(m)}if(g!==null)le=!0;else{var P=n(h);P!==null&&J(I,P.startTime-q),le=!1}}break e}finally{g=null,S=ee,x=!1}le=void 0}}finally{le?Y():O=!1}}}var Y;if(typeof R=="function")Y=function(){R(V)};else if(typeof MessageChannel<"u"){var me=new MessageChannel,te=me.port2;me.port1.onmessage=V,Y=function(){te.postMessage(null)}}else Y=function(){C(V,0)};function J(q,le){F=C(function(){q(e.unstable_now())},le)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(q){switch(S){case 1:case 2:case 3:var le=3;break;default:le=S}var ee=S;S=le;try{return q()}finally{S=ee}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(q,le){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var ee=S;S=q;try{return le()}finally{S=ee}},e.unstable_scheduleCallback=function(q,le,ee){var ve=e.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?ve+ee:ve):ee=ve,q){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=ee+M,q={id:p++,callback:le,priorityLevel:q,startTime:ee,expirationTime:M,sortIndex:-1},ee>ve?(q.sortIndex=ee,t(h,q),n(m)===null&&q===n(h)&&(k?(_(F),F=-1):k=!0,J(I,ee-ve))):(q.sortIndex=M,t(m,q),j||x||(j=!0,O||(O=!0,Y()))),q},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(q){var le=S;return function(){var ee=S;S=le;try{return q.apply(this,arguments)}finally{S=ee}}}})(Jp)),Jp}var Dw;function SR(){return Dw||(Dw=1,Wp.exports=xR()),Wp.exports}var eg={exports:{}},Xn={};/**
|
|
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 Iw;function wR(){if(Iw)return Xn;Iw=1;var e=cv();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 Xn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Xn.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)},Xn.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()}},Xn.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))},Xn.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Xn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var p=h.as,g=f(p,h.crossOrigin),S=typeof h.integrity=="string"?h.integrity:void 0,x=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:S,fetchPriority:x}):p==="script"&&a.d.X(m,{crossOrigin:g,integrity:S,fetchPriority:x,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Xn.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)},Xn.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})}},Xn.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)},Xn.requestFormReset=function(m){a.d.r(m)},Xn.unstable_batchedUpdates=function(m,h){return m(h)},Xn.useFormState=function(m,h,p){return c.H.useFormState(m,h,p)},Xn.useFormStatus=function(){return c.H.useHostTransitionStatus()},Xn.version="19.2.4",Xn}var Lw;function Qj(){if(Lw)return eg.exports;Lw=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(),eg.exports=wR(),eg.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 Pw;function kR(){if(Pw)return Du;Pw=1;var e=SR(),t=cv(),n=Qj();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,S=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),R=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function Y(r){return r===null||typeof r!="object"?null:(r=V&&r[V]||r["@@iterator"],typeof r=="function"?r:null)}var me=Symbol.for("react.client.reference");function te(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===me?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case k:return"Fragment";case C:return"Profiler";case w:return"StrictMode";case I:return"Suspense";case O:return"SuspenseList";case W:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case j:return"Portal";case R:return r.displayName||"Context";case _:return(r._context.displayName||"Context")+".Consumer";case z:var i=r.render;return r=r.displayName,r||(r=i.displayName||i.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case F:return i=r.displayName||null,i!==null?i:te(r.type)||"Memo";case D:i=r._payload,r=r._init;try{return te(r(i))}catch{}}return null}var J=Array.isArray,q=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},ve=[],M=-1;function P(r){return{current:r}}function U(r){0>M||(r.current=ve[M],ve[M]=null,M--)}function T(r,i){M++,ve[M]=r.current,r.current=i}var G=P(null),Z=P(null),ae=P(null),Se=P(null);function Re(r,i){switch(T(ae,i),T(Z,r),T(G,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?WS(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=WS(i),r=JS(i,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}U(G),T(G,r)}function je(){U(G),U(Z),U(ae)}function $e(r){r.memoizedState!==null&&T(Se,r);var i=G.current,u=JS(i,r.type);i!==u&&(T(Z,r),T(G,u))}function Ie(r){Z.current===r&&(U(G),U(Z)),Se.current===r&&(U(Se),Au._currentValue=ee)}var Ke,et;function wt(r){if(Ke===void 0)try{throw Error()}catch(u){var i=u.stack.trim().match(/\n( *(at )?)/);Ke=i&&i[1]||"",et=-1<u.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+Ke+r+et}var K=!1;function ge(r,i){if(!r||K)return"";K=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(i){var he=function(){throw Error()};if(Object.defineProperty(he.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(he,[])}catch(oe){var se=oe}Reflect.construct(r,[],he)}else{try{he.call()}catch(oe){se=oe}r.call(he.prototype)}}else{try{throw Error()}catch(oe){se=oe}(he=r())&&typeof he.catch=="function"&&he.catch(function(){})}}catch(oe){if(oe&&se&&typeof oe.stack=="string")return[oe.stack,se.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
|
-
`),re=A.split(`
|
|
45
|
-
`);for(y=d=0;d<H.length&&!H[d].includes("DetermineComponentFrameRoot");)d++;for(;y<re.length&&!re[y].includes("DetermineComponentFrameRoot");)y++;if(d===H.length||y===re.length)for(d=H.length-1,y=re.length-1;1<=d&&0<=y&&H[d]!==re[y];)y--;for(;1<=d&&0<=y;d--,y--)if(H[d]!==re[y]){if(d!==1||y!==1)do if(d--,y--,0>y||H[d]!==re[y]){var ce=`
|
|
46
|
-
`+H[d].replace(" at new "," at ");return r.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",r.displayName)),ce}while(1<=d&&0<=y);break}}}finally{K=!1,Error.prepareStackTrace=u}return(u=r?r.displayName||r.name:"")?wt(u):""}function Ce(r,i){switch(r.tag){case 26:case 27:case 5:return wt(r.type);case 16:return wt("Lazy");case 13:return r.child!==i&&i!==null?wt("Suspense Fallback"):wt("Suspense");case 19:return wt("SuspenseList");case 0:case 15:return ge(r.type,!1);case 11:return ge(r.type.render,!1);case 1:return ge(r.type,!0);case 31:return wt("Activity");default:return""}}function _e(r){try{var i="",u=null;do i+=Ce(r,u),u=r,r=r.return;while(r);return i}catch(d){return`
|
|
47
|
-
Error generating stack: `+d.message+`
|
|
48
|
-
`+d.stack}}var At=Object.prototype.hasOwnProperty,qe=e.unstable_scheduleCallback,Mn=e.unstable_cancelCallback,rn=e.unstable_shouldYield,La=e.unstable_requestPaint,an=e.unstable_now,ma=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,be=e.unstable_UserBlockingPriority,Be=e.unstable_NormalPriority,Xe=e.unstable_LowPriority,yt=e.unstable_IdlePriority,Nn=e.log,pr=e.unstable_setDisableYieldValue,Gt=null,Bt=null;function It(r){if(typeof Nn=="function"&&pr(r),Bt&&typeof Bt.setStrictMode=="function")try{Bt.setStrictMode(Gt,r)}catch{}}var ft=Math.clz32?Math.clz32:$o,gr=Math.log,Un=Math.LN2;function $o(r){return r>>>=0,r===0?32:31-(gr(r)/Un|0)|0}var Ea=256,ir=262144,pa=4194304;function Bn(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 Pa(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=Bn(d):(E&=A,E!==0?y=Bn(E):u||(u=A&~r,u!==0&&(y=Bn(u))))):(A=d&~v,A!==0?y=Bn(A):E!==0?y=Bn(E):u||(u=d&~r,u!==0&&(y=Bn(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 ga(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function Jt(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 Gr(){var r=pa;return pa<<=1,(pa&62914560)===0&&(pa=4194304),r}function bi(r){for(var i=[],u=0;31>u;u++)i.push(r);return i}function ya(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function xi(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,re=r.hiddenUpdates;for(u=E&~u;0<u;){var ce=31-ft(u),he=1<<ce;A[ce]=0,H[ce]=-1;var se=re[ce];if(se!==null)for(re[ce]=null,ce=0;ce<se.length;ce++){var oe=se[ce];oe!==null&&(oe.lane&=-536870913)}u&=~he}d!==0&&Si(r,d,0),v!==0&&y===0&&r.tag!==0&&(r.suspendedLanes|=v&~(E&~i))}function Si(r,i,u){r.pendingLanes|=i,r.suspendedLanes&=~i;var d=31-ft(i);r.entangledLanes|=i,r.entanglements[d]=r.entanglements[d]|1073741824|u&261930}function wi(r,i){var u=r.entangledLanes|=i;for(r=r.entanglements;u;){var d=31-ft(u),y=1<<d;y&i|r[d]&i&&(r[d]|=i),u&=~y}}function ks(r,i){var u=i&-i;return u=(u&42)!==0?1:zn(u),(u&(r.suspendedLanes|i))!==0?0:u}function zn(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 yr(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function ki(){var r=le.p;return r!==0?r:(r=window.event,r===void 0?32:ww(r.type))}function ji(r,i){var u=le.p;try{return le.p=r,i()}finally{le.p=u}}var ye=Math.random().toString(36).slice(2),Ge="__reactFiber$"+ye,ht="__reactProps$"+ye,Fn="__reactContainer$"+ye,Ua="__reactEvents$"+ye,Ho="__reactListeners$"+ye,Qc="__reactHandles$"+ye,qo="__reactResources$"+ye,Ei="__reactMarker$"+ye;function Ue(r){delete r[Ge],delete r[ht],delete r[Ua],delete r[Ho],delete r[Qc]}function $(r){var i=r[Ge];if(i)return i;for(var u=r.parentNode;u;){if(i=u[Fn]||u[Ge]){if(u=i.alternate,i.child!==null||u!==null&&u.child!==null)for(r=sw(r);r!==null;){if(u=r[Ge])return u;r=sw(r)}return i}r=u,u=r.parentNode}return null}function pe(r){if(r=r[Ge]||r[Fn]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function Ne(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(a(33))}function jt(r){var i=r[qo];return i||(i=r[qo]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function vt(r){r[Ei]=!0}var en=new Set,$n={};function yn(r,i){Dn(r,i),Dn(r+"Capture",i)}function Dn(r,i){for($n[r]=i,r=0;r<i.length;r++)en.add(i[r])}var Zo=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),fn={},Go={};function Kc(r){return At.call(Go,r)?!0:At.call(fn,r)?!1:Zo.test(r)?Go[r]=!0:(fn[r]=!0,!1)}function Yc(r,i,u){if(Kc(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 Xc(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 Ba(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 Vr(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function qb(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function oA(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 Fh(r){if(!r._valueTracker){var i=qb(r)?"checked":"value";r._valueTracker=oA(r,i,""+r[i])}}function Zb(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var u=i.getValue(),d="";return r&&(d=qb(r)?r.checked?"true":"false":r.value),r=d,r!==u?(i.setValue(r),!0):!1}function Wc(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 uA=/[\n"\\]/g;function Qr(r){return r.replace(uA,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function $h(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=""+Vr(i)):r.value!==""+Vr(i)&&(r.value=""+Vr(i)):E!=="submit"&&E!=="reset"||r.removeAttribute("value"),i!=null?Hh(r,E,Vr(i)):u!=null?Hh(r,E,Vr(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=""+Vr(A):r.removeAttribute("name")}function Gb(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)){Fh(r);return}u=u!=null?""+Vr(u):"",i=i!=null?""+Vr(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),Fh(r)}function Hh(r,i,u){i==="number"&&Wc(r.ownerDocument)===r||r.defaultValue===""+u||(r.defaultValue=""+u)}function cl(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=""+Vr(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 Vb(r,i,u){if(i!=null&&(i=""+Vr(i),i!==r.value&&(r.value=i),u==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=u!=null?""+Vr(u):""}function Qb(r,i,u,d){if(i==null){if(d!=null){if(u!=null)throw Error(a(92));if(J(d)){if(1<d.length)throw Error(a(93));d=d[0]}u=d}u==null&&(u=""),i=u}u=Vr(i),r.defaultValue=u,d=r.textContent,d===u&&d!==""&&d!==null&&(r.value=d),Fh(r)}function dl(r,i){if(i){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=i;return}}r.textContent=i}var cA=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 Kb(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||cA.has(i)?i==="float"?r.cssFloat=u:r[i]=(""+u).trim():r[i]=u+"px"}function Yb(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&&Kb(r,y,d)}else for(var v in i)i.hasOwnProperty(v)&&Kb(r,v,i[v])}function qh(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 dA=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"]]),fA=/^[\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 Jc(r){return fA.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Fa(){}var Zh=null;function Gh(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var fl=null,hl=null;function Xb(r){var i=pe(r);if(i&&(r=i.stateNode)){var u=r[ht]||null;e:switch(r=i.stateNode,i.type){case"input":if($h(r,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),i=u.name,u.type==="radio"&&i!=null){for(u=r;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Qr(""+i)+'"][type="radio"]'),i=0;i<u.length;i++){var d=u[i];if(d!==r&&d.form===r.form){var y=d[ht]||null;if(!y)throw Error(a(90));$h(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&&Zb(d)}break e;case"textarea":Vb(r,u.value,u.defaultValue);break e;case"select":i=u.value,i!=null&&cl(r,!!u.multiple,i,!1)}}}var Vh=!1;function Wb(r,i,u){if(Vh)return r(i,u);Vh=!0;try{var d=r(i);return d}finally{if(Vh=!1,(fl!==null||hl!==null)&&(Bd(),fl&&(i=fl,r=hl,hl=fl=null,Xb(i),r)))for(i=0;i<r.length;i++)Xb(r[i])}}function Vo(r,i){var u=r.stateNode;if(u===null)return null;var d=u[ht]||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 $a=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qh=!1;if($a)try{var Qo={};Object.defineProperty(Qo,"passive",{get:function(){Qh=!0}}),window.addEventListener("test",Qo,Qo),window.removeEventListener("test",Qo,Qo)}catch{Qh=!1}var Ci=null,Kh=null,ed=null;function Jb(){if(ed)return ed;var r,i=Kh,u=i.length,d,y="value"in Ci?Ci.value:Ci.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 ed=y.slice(r,1<d?1-d:void 0)}function td(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 nd(){return!0}function ex(){return!1}function vr(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)?nd:ex,this.isPropagationStopped=ex,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=nd)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=nd)},persist:function(){},isPersistent:nd}),i}var js={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},rd=vr(js),Ko=g({},js,{view:0,detail:0}),hA=vr(Ko),Yh,Xh,Yo,ad=g({},Ko,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Jh,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!==Yo&&(Yo&&r.type==="mousemove"?(Yh=r.screenX-Yo.screenX,Xh=r.screenY-Yo.screenY):Xh=Yh=0,Yo=r),Yh)},movementY:function(r){return"movementY"in r?r.movementY:Xh}}),tx=vr(ad),mA=g({},ad,{dataTransfer:0}),pA=vr(mA),gA=g({},Ko,{relatedTarget:0}),Wh=vr(gA),yA=g({},js,{animationName:0,elapsedTime:0,pseudoElement:0}),vA=vr(yA),bA=g({},js,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),xA=vr(bA),SA=g({},js,{data:0}),nx=vr(SA),wA={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kA={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"},jA={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function EA(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=jA[r])?!!i[r]:!1}function Jh(){return EA}var CA=g({},Ko,{key:function(r){if(r.key){var i=wA[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=td(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?kA[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Jh,charCode:function(r){return r.type==="keypress"?td(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?td(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),NA=vr(CA),_A=g({},ad,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),rx=vr(_A),TA=g({},Ko,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Jh}),AA=vr(TA),RA=g({},js,{propertyName:0,elapsedTime:0,pseudoElement:0}),OA=vr(RA),MA=g({},ad,{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}),zA=vr(MA),DA=g({},js,{newState:0,oldState:0}),IA=vr(DA),LA=[9,13,27,32],em=$a&&"CompositionEvent"in window,Xo=null;$a&&"documentMode"in document&&(Xo=document.documentMode);var PA=$a&&"TextEvent"in window&&!Xo,ax=$a&&(!em||Xo&&8<Xo&&11>=Xo),ix=" ",sx=!1;function lx(r,i){switch(r){case"keyup":return LA.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ox(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var ml=!1;function UA(r,i){switch(r){case"compositionend":return ox(i);case"keypress":return i.which!==32?null:(sx=!0,ix);case"textInput":return r=i.data,r===ix&&sx?null:r;default:return null}}function BA(r,i){if(ml)return r==="compositionend"||!em&&lx(r,i)?(r=Jb(),ed=Kh=Ci=null,ml=!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 ax&&i.locale!=="ko"?null:i.data;default:return null}}var FA={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 ux(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!FA[r.type]:i==="textarea"}function cx(r,i,u,d){fl?hl?hl.push(d):hl=[d]:fl=d,i=Vd(i,"onChange"),0<i.length&&(u=new rd("onChange","change",null,u,d),r.push({event:u,listeners:i}))}var Wo=null,Jo=null;function $A(r){GS(r,0)}function id(r){var i=Ne(r);if(Zb(i))return r}function dx(r,i){if(r==="change")return i}var fx=!1;if($a){var tm;if($a){var nm="oninput"in document;if(!nm){var hx=document.createElement("div");hx.setAttribute("oninput","return;"),nm=typeof hx.oninput=="function"}tm=nm}else tm=!1;fx=tm&&(!document.documentMode||9<document.documentMode)}function mx(){Wo&&(Wo.detachEvent("onpropertychange",px),Jo=Wo=null)}function px(r){if(r.propertyName==="value"&&id(Jo)){var i=[];cx(i,Jo,r,Gh(r)),Wb($A,i)}}function HA(r,i,u){r==="focusin"?(mx(),Wo=i,Jo=u,Wo.attachEvent("onpropertychange",px)):r==="focusout"&&mx()}function qA(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return id(Jo)}function ZA(r,i){if(r==="click")return id(i)}function GA(r,i){if(r==="input"||r==="change")return id(i)}function VA(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var zr=typeof Object.is=="function"?Object.is:VA;function eu(r,i){if(zr(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(!At.call(i,y)||!zr(r[y],i[y]))return!1}return!0}function gx(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function yx(r,i){var u=gx(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=gx(u)}}function vx(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?vx(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function bx(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=Wc(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=Wc(r.document)}return i}function rm(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 QA=$a&&"documentMode"in document&&11>=document.documentMode,pl=null,am=null,tu=null,im=!1;function xx(r,i,u){var d=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;im||pl==null||pl!==Wc(d)||(d=pl,"selectionStart"in d&&rm(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}),tu&&eu(tu,d)||(tu=d,d=Vd(am,"onSelect"),0<d.length&&(i=new rd("onSelect","select",null,i,u),r.push({event:i,listeners:d}),i.target=pl)))}function Es(r,i){var u={};return u[r.toLowerCase()]=i.toLowerCase(),u["Webkit"+r]="webkit"+i,u["Moz"+r]="moz"+i,u}var gl={animationend:Es("Animation","AnimationEnd"),animationiteration:Es("Animation","AnimationIteration"),animationstart:Es("Animation","AnimationStart"),transitionrun:Es("Transition","TransitionRun"),transitionstart:Es("Transition","TransitionStart"),transitioncancel:Es("Transition","TransitionCancel"),transitionend:Es("Transition","TransitionEnd")},sm={},Sx={};$a&&(Sx=document.createElement("div").style,"AnimationEvent"in window||(delete gl.animationend.animation,delete gl.animationiteration.animation,delete gl.animationstart.animation),"TransitionEvent"in window||delete gl.transitionend.transition);function Cs(r){if(sm[r])return sm[r];if(!gl[r])return r;var i=gl[r],u;for(u in i)if(i.hasOwnProperty(u)&&u in Sx)return sm[r]=i[u];return r}var wx=Cs("animationend"),kx=Cs("animationiteration"),jx=Cs("animationstart"),KA=Cs("transitionrun"),YA=Cs("transitionstart"),XA=Cs("transitioncancel"),Ex=Cs("transitionend"),Cx=new Map,lm="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(" ");lm.push("scrollEnd");function va(r,i){Cx.set(r,i),yn(i,[r])}var sd=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)},Kr=[],yl=0,om=0;function ld(){for(var r=yl,i=om=yl=0;i<r;){var u=Kr[i];Kr[i++]=null;var d=Kr[i];Kr[i++]=null;var y=Kr[i];Kr[i++]=null;var v=Kr[i];if(Kr[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&&Nx(u,y,v)}}function od(r,i,u,d){Kr[yl++]=r,Kr[yl++]=i,Kr[yl++]=u,Kr[yl++]=d,om|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function um(r,i,u,d){return od(r,i,u,d),ud(r)}function Ns(r,i){return od(r,null,null,i),ud(r)}function Nx(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-ft(u),r=v.hiddenUpdates,d=r[y],d===null?r[y]=[i]:d.push(i),i.lane=u|536870912),v):null}function ud(r){if(50<ku)throw ku=0,vp=null,Error(a(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var vl={};function WA(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 Dr(r,i,u,d){return new WA(r,i,u,d)}function cm(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Ha(r,i){var u=r.alternate;return u===null?(u=Dr(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 _x(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 cd(r,i,u,d,y,v){var E=0;if(d=r,typeof r=="function")cm(r)&&(E=1);else if(typeof r=="string")E=rR(r,u,G.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case W:return r=Dr(31,u,i,y),r.elementType=W,r.lanes=v,r;case k:return _s(u.children,y,v,i);case w:E=8,y|=24;break;case C:return r=Dr(12,u,i,y|2),r.elementType=C,r.lanes=v,r;case I:return r=Dr(13,u,i,y),r.elementType=I,r.lanes=v,r;case O:return r=Dr(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 _:E=9;break e;case z:E=11;break e;case F:E=14;break e;case D:E=16,d=null;break e}E=29,u=Error(a(130,r===null?"null":typeof r,"")),d=null}return i=Dr(E,u,i,y),i.elementType=r,i.type=d,i.lanes=v,i}function _s(r,i,u,d){return r=Dr(7,r,d,i),r.lanes=u,r}function dm(r,i,u){return r=Dr(6,r,null,i),r.lanes=u,r}function Tx(r){var i=Dr(18,null,null,0);return i.stateNode=r,i}function fm(r,i,u){return i=Dr(4,r.children!==null?r.children:[],r.key,i),i.lanes=u,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var Ax=new WeakMap;function Yr(r,i){if(typeof r=="object"&&r!==null){var u=Ax.get(r);return u!==void 0?u:(i={value:r,source:i,stack:_e(i)},Ax.set(r,i),i)}return{value:r,source:i,stack:_e(i)}}var bl=[],xl=0,dd=null,nu=0,Xr=[],Wr=0,Ni=null,Ca=1,Na="";function qa(r,i){bl[xl++]=nu,bl[xl++]=dd,dd=r,nu=i}function Rx(r,i,u){Xr[Wr++]=Ca,Xr[Wr++]=Na,Xr[Wr++]=Ni,Ni=r;var d=Ca;r=Na;var y=32-ft(d)-1;d&=~(1<<y),u+=1;var v=32-ft(i)+y;if(30<v){var E=y-y%5;v=(d&(1<<E)-1).toString(32),d>>=E,y-=E,Ca=1<<32-ft(i)+y|u<<y|d,Na=v+r}else Ca=1<<v|u<<y|d,Na=r}function hm(r){r.return!==null&&(qa(r,1),Rx(r,1,0))}function mm(r){for(;r===dd;)dd=bl[--xl],bl[xl]=null,nu=bl[--xl],bl[xl]=null;for(;r===Ni;)Ni=Xr[--Wr],Xr[Wr]=null,Na=Xr[--Wr],Xr[Wr]=null,Ca=Xr[--Wr],Xr[Wr]=null}function Ox(r,i){Xr[Wr++]=Ca,Xr[Wr++]=Na,Xr[Wr++]=Ni,Ca=i.id,Na=i.overflow,Ni=r}var Hn=null,$t=null,bt=!1,_i=null,Jr=!1,pm=Error(a(519));function Ti(r){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ru(Yr(i,r)),pm}function Mx(r){var i=r.stateNode,u=r.type,d=r.memoizedProps;switch(i[Ge]=r,i[ht]=d,u){case"dialog":ct("cancel",i),ct("close",i);break;case"iframe":case"object":case"embed":ct("load",i);break;case"video":case"audio":for(u=0;u<Eu.length;u++)ct(Eu[u],i);break;case"source":ct("error",i);break;case"img":case"image":case"link":ct("error",i),ct("load",i);break;case"details":ct("toggle",i);break;case"input":ct("invalid",i),Gb(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":ct("invalid",i);break;case"textarea":ct("invalid",i),Qb(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||YS(i.textContent,u)?(d.popover!=null&&(ct("beforetoggle",i),ct("toggle",i)),d.onScroll!=null&&ct("scroll",i),d.onScrollEnd!=null&&ct("scrollend",i),d.onClick!=null&&(i.onclick=Fa),i=!0):i=!1,i||Ti(r,!0)}function zx(r){for(Hn=r.return;Hn;)switch(Hn.tag){case 5:case 31:case 13:Jr=!1;return;case 27:case 3:Jr=!0;return;default:Hn=Hn.return}}function Sl(r){if(r!==Hn)return!1;if(!bt)return zx(r),bt=!0,!1;var i=r.tag,u;if((u=i!==3&&i!==27)&&((u=i===5)&&(u=r.type,u=!(u!=="form"&&u!=="button")||Mp(r.type,r.memoizedProps)),u=!u),u&&$t&&Ti(r),zx(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));$t=iw(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));$t=iw(r)}else i===27?(i=$t,Hi(r.type)?(r=Pp,Pp=null,$t=r):$t=i):$t=Hn?ta(r.stateNode.nextSibling):null;return!0}function Ts(){$t=Hn=null,bt=!1}function gm(){var r=_i;return r!==null&&(wr===null?wr=r:wr.push.apply(wr,r),_i=null),r}function ru(r){_i===null?_i=[r]:_i.push(r)}var ym=P(null),As=null,Za=null;function Ai(r,i,u){T(ym,i._currentValue),i._currentValue=u}function Ga(r){r._currentValue=ym.current,U(ym)}function vm(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 bm(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),vm(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),vm(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 wl(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;zr(y.pendingProps.value,E.value)||(r!==null?r.push(A):r=[A])}}else if(y===Se.current){if(E=y.alternate,E===null)throw Error(a(387));E.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(r!==null?r.push(Au):r=[Au])}y=y.return}r!==null&&bm(i,r,u,d),i.flags|=262144}function fd(r){for(r=r.firstContext;r!==null;){if(!zr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Rs(r){As=r,Za=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function qn(r){return Dx(As,r)}function hd(r,i){return As===null&&Rs(r),Dx(r,i)}function Dx(r,i){var u=i._currentValue;if(i={context:i,memoizedValue:u,next:null},Za===null){if(r===null)throw Error(a(308));Za=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else Za=Za.next=i;return u}var JA=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()})}},e2=e.unstable_scheduleCallback,t2=e.unstable_NormalPriority,vn={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function xm(){return{controller:new JA,data:new Map,refCount:0}}function au(r){r.refCount--,r.refCount===0&&e2(t2,function(){r.controller.abort()})}var iu=null,Sm=0,kl=0,jl=null;function n2(r,i){if(iu===null){var u=iu=[];Sm=0,kl=jp(),jl={status:"pending",value:void 0,then:function(d){u.push(d)}}}return Sm++,i.then(Ix,Ix),i}function Ix(){if(--Sm===0&&iu!==null){jl!==null&&(jl.status="fulfilled");var r=iu;iu=null,kl=0,jl=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function r2(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 Lx=q.S;q.S=function(r,i){xS=an(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&n2(r,i),Lx!==null&&Lx(r,i)};var Os=P(null);function wm(){var r=Os.current;return r!==null?r:Lt.pooledCache}function md(r,i){i===null?T(Os,Os.current):T(Os,i.pool)}function Px(){var r=wm();return r===null?null:{parent:vn._currentValue,pool:r}}var El=Error(a(460)),km=Error(a(474)),pd=Error(a(542)),gd={then:function(){}};function Ux(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Bx(r,i,u){switch(u=r[u],u===void 0?r.push(i):u!==i&&(i.then(Fa,Fa),i=u),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,$x(r),r;default:if(typeof i.status=="string")i.then(Fa,Fa);else{if(r=Lt,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=i,r.status="pending",r.then(function(d){if(i.status==="pending"){var y=i;y.status="fulfilled",y.value=d}},function(d){if(i.status==="pending"){var y=i;y.status="rejected",y.reason=d}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,$x(r),r}throw zs=i,El}}function Ms(r){try{var i=r._init;return i(r._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(zs=u,El):u}}var zs=null;function Fx(){if(zs===null)throw Error(a(459));var r=zs;return zs=null,r}function $x(r){if(r===El||r===pd)throw Error(a(483))}var Cl=null,su=0;function yd(r){var i=su;return su+=1,Cl===null&&(Cl=[]),Bx(Cl,r,i)}function lu(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function vd(r,i){throw i.$$typeof===S?Error(a(525)):(r=Object.prototype.toString.call(i),Error(a(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function Hx(r){function i(X,Q){if(r){var ne=X.deletions;ne===null?(X.deletions=[Q],X.flags|=16):ne.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=Ha(X,Q),X.index=0,X.sibling=null,X}function v(X,Q,ne){return X.index=ne,r?(ne=X.alternate,ne!==null?(ne=ne.index,ne<Q?(X.flags|=67108866,Q):ne):(X.flags|=67108866,Q)):(X.flags|=1048576,Q)}function E(X){return r&&X.alternate===null&&(X.flags|=67108866),X}function A(X,Q,ne,fe){return Q===null||Q.tag!==6?(Q=dm(ne,X.mode,fe),Q.return=X,Q):(Q=y(Q,ne),Q.return=X,Q)}function H(X,Q,ne,fe){var Fe=ne.type;return Fe===k?ce(X,Q,ne.props.children,fe,ne.key):Q!==null&&(Q.elementType===Fe||typeof Fe=="object"&&Fe!==null&&Fe.$$typeof===D&&Ms(Fe)===Q.type)?(Q=y(Q,ne.props),lu(Q,ne),Q.return=X,Q):(Q=cd(ne.type,ne.key,ne.props,null,X.mode,fe),lu(Q,ne),Q.return=X,Q)}function re(X,Q,ne,fe){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==ne.containerInfo||Q.stateNode.implementation!==ne.implementation?(Q=fm(ne,X.mode,fe),Q.return=X,Q):(Q=y(Q,ne.children||[]),Q.return=X,Q)}function ce(X,Q,ne,fe,Fe){return Q===null||Q.tag!==7?(Q=_s(ne,X.mode,fe,Fe),Q.return=X,Q):(Q=y(Q,ne),Q.return=X,Q)}function he(X,Q,ne){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Q=dm(""+Q,X.mode,ne),Q.return=X,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case x:return ne=cd(Q.type,Q.key,Q.props,null,X.mode,ne),lu(ne,Q),ne.return=X,ne;case j:return Q=fm(Q,X.mode,ne),Q.return=X,Q;case D:return Q=Ms(Q),he(X,Q,ne)}if(J(Q)||Y(Q))return Q=_s(Q,X.mode,ne,null),Q.return=X,Q;if(typeof Q.then=="function")return he(X,yd(Q),ne);if(Q.$$typeof===R)return he(X,hd(X,Q),ne);vd(X,Q)}return null}function se(X,Q,ne,fe){var Fe=Q!==null?Q.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return Fe!==null?null:A(X,Q,""+ne,fe);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case x:return ne.key===Fe?H(X,Q,ne,fe):null;case j:return ne.key===Fe?re(X,Q,ne,fe):null;case D:return ne=Ms(ne),se(X,Q,ne,fe)}if(J(ne)||Y(ne))return Fe!==null?null:ce(X,Q,ne,fe,null);if(typeof ne.then=="function")return se(X,Q,yd(ne),fe);if(ne.$$typeof===R)return se(X,Q,hd(X,ne),fe);vd(X,ne)}return null}function oe(X,Q,ne,fe,Fe){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return X=X.get(ne)||null,A(Q,X,""+fe,Fe);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case x:return X=X.get(fe.key===null?ne:fe.key)||null,H(Q,X,fe,Fe);case j:return X=X.get(fe.key===null?ne:fe.key)||null,re(Q,X,fe,Fe);case D:return fe=Ms(fe),oe(X,Q,ne,fe,Fe)}if(J(fe)||Y(fe))return X=X.get(ne)||null,ce(Q,X,fe,Fe,null);if(typeof fe.then=="function")return oe(X,Q,ne,yd(fe),Fe);if(fe.$$typeof===R)return oe(X,Q,ne,hd(Q,fe),Fe);vd(Q,fe)}return null}function Ae(X,Q,ne,fe){for(var Fe=null,Et=null,De=Q,tt=Q=0,pt=null;De!==null&&tt<ne.length;tt++){De.index>tt?(pt=De,De=null):pt=De.sibling;var Ct=se(X,De,ne[tt],fe);if(Ct===null){De===null&&(De=pt);break}r&&De&&Ct.alternate===null&&i(X,De),Q=v(Ct,Q,tt),Et===null?Fe=Ct:Et.sibling=Ct,Et=Ct,De=pt}if(tt===ne.length)return u(X,De),bt&&qa(X,tt),Fe;if(De===null){for(;tt<ne.length;tt++)De=he(X,ne[tt],fe),De!==null&&(Q=v(De,Q,tt),Et===null?Fe=De:Et.sibling=De,Et=De);return bt&&qa(X,tt),Fe}for(De=d(De);tt<ne.length;tt++)pt=oe(De,X,tt,ne[tt],fe),pt!==null&&(r&&pt.alternate!==null&&De.delete(pt.key===null?tt:pt.key),Q=v(pt,Q,tt),Et===null?Fe=pt:Et.sibling=pt,Et=pt);return r&&De.forEach(function(Qi){return i(X,Qi)}),bt&&qa(X,tt),Fe}function Ve(X,Q,ne,fe){if(ne==null)throw Error(a(151));for(var Fe=null,Et=null,De=Q,tt=Q=0,pt=null,Ct=ne.next();De!==null&&!Ct.done;tt++,Ct=ne.next()){De.index>tt?(pt=De,De=null):pt=De.sibling;var Qi=se(X,De,Ct.value,fe);if(Qi===null){De===null&&(De=pt);break}r&&De&&Qi.alternate===null&&i(X,De),Q=v(Qi,Q,tt),Et===null?Fe=Qi:Et.sibling=Qi,Et=Qi,De=pt}if(Ct.done)return u(X,De),bt&&qa(X,tt),Fe;if(De===null){for(;!Ct.done;tt++,Ct=ne.next())Ct=he(X,Ct.value,fe),Ct!==null&&(Q=v(Ct,Q,tt),Et===null?Fe=Ct:Et.sibling=Ct,Et=Ct);return bt&&qa(X,tt),Fe}for(De=d(De);!Ct.done;tt++,Ct=ne.next())Ct=oe(De,X,tt,Ct.value,fe),Ct!==null&&(r&&Ct.alternate!==null&&De.delete(Ct.key===null?tt:Ct.key),Q=v(Ct,Q,tt),Et===null?Fe=Ct:Et.sibling=Ct,Et=Ct);return r&&De.forEach(function(mR){return i(X,mR)}),bt&&qa(X,tt),Fe}function Dt(X,Q,ne,fe){if(typeof ne=="object"&&ne!==null&&ne.type===k&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case x:e:{for(var Fe=ne.key;Q!==null;){if(Q.key===Fe){if(Fe=ne.type,Fe===k){if(Q.tag===7){u(X,Q.sibling),fe=y(Q,ne.props.children),fe.return=X,X=fe;break e}}else if(Q.elementType===Fe||typeof Fe=="object"&&Fe!==null&&Fe.$$typeof===D&&Ms(Fe)===Q.type){u(X,Q.sibling),fe=y(Q,ne.props),lu(fe,ne),fe.return=X,X=fe;break e}u(X,Q);break}else i(X,Q);Q=Q.sibling}ne.type===k?(fe=_s(ne.props.children,X.mode,fe,ne.key),fe.return=X,X=fe):(fe=cd(ne.type,ne.key,ne.props,null,X.mode,fe),lu(fe,ne),fe.return=X,X=fe)}return E(X);case j:e:{for(Fe=ne.key;Q!==null;){if(Q.key===Fe)if(Q.tag===4&&Q.stateNode.containerInfo===ne.containerInfo&&Q.stateNode.implementation===ne.implementation){u(X,Q.sibling),fe=y(Q,ne.children||[]),fe.return=X,X=fe;break e}else{u(X,Q);break}else i(X,Q);Q=Q.sibling}fe=fm(ne,X.mode,fe),fe.return=X,X=fe}return E(X);case D:return ne=Ms(ne),Dt(X,Q,ne,fe)}if(J(ne))return Ae(X,Q,ne,fe);if(Y(ne)){if(Fe=Y(ne),typeof Fe!="function")throw Error(a(150));return ne=Fe.call(ne),Ve(X,Q,ne,fe)}if(typeof ne.then=="function")return Dt(X,Q,yd(ne),fe);if(ne.$$typeof===R)return Dt(X,Q,hd(X,ne),fe);vd(X,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,Q!==null&&Q.tag===6?(u(X,Q.sibling),fe=y(Q,ne),fe.return=X,X=fe):(u(X,Q),fe=dm(ne,X.mode,fe),fe.return=X,X=fe),E(X)):u(X,Q)}return function(X,Q,ne,fe){try{su=0;var Fe=Dt(X,Q,ne,fe);return Cl=null,Fe}catch(De){if(De===El||De===pd)throw De;var Et=Dr(29,De,null,X.mode);return Et.lanes=fe,Et.return=X,Et}finally{}}}var Ds=Hx(!0),qx=Hx(!1),Ri=!1;function jm(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Em(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 Oi(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Mi(r,i,u){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(Nt&2)!==0){var y=d.pending;return y===null?i.next=i:(i.next=y.next,y.next=i),d.pending=i,i=ud(r),Nx(r,null,u),i}return od(r,d,i,u),ud(r)}function ou(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,wi(r,u)}}function Cm(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 Nm=!1;function uu(){if(Nm){var r=jl;if(r!==null)throw r}}function cu(r,i,u,d){Nm=!1;var y=r.updateQueue;Ri=!1;var v=y.firstBaseUpdate,E=y.lastBaseUpdate,A=y.shared.pending;if(A!==null){y.shared.pending=null;var H=A,re=H.next;H.next=null,E===null?v=re:E.next=re,E=H;var ce=r.alternate;ce!==null&&(ce=ce.updateQueue,A=ce.lastBaseUpdate,A!==E&&(A===null?ce.firstBaseUpdate=re:A.next=re,ce.lastBaseUpdate=H))}if(v!==null){var he=y.baseState;E=0,ce=re=H=null,A=v;do{var se=A.lane&-536870913,oe=se!==A.lane;if(oe?(mt&se)===se:(d&se)===se){se!==0&&se===kl&&(Nm=!0),ce!==null&&(ce=ce.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Ae=r,Ve=A;se=i;var Dt=u;switch(Ve.tag){case 1:if(Ae=Ve.payload,typeof Ae=="function"){he=Ae.call(Dt,he,se);break e}he=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Ve.payload,se=typeof Ae=="function"?Ae.call(Dt,he,se):Ae,se==null)break e;he=g({},he,se);break e;case 2:Ri=!0}}se=A.callback,se!==null&&(r.flags|=64,oe&&(r.flags|=8192),oe=y.callbacks,oe===null?y.callbacks=[se]:oe.push(se))}else oe={lane:se,tag:A.tag,payload:A.payload,callback:A.callback,next:null},ce===null?(re=ce=oe,H=he):ce=ce.next=oe,E|=se;if(A=A.next,A===null){if(A=y.shared.pending,A===null)break;oe=A,A=oe.next,oe.next=null,y.lastBaseUpdate=oe,y.shared.pending=null}}while(!0);ce===null&&(H=he),y.baseState=H,y.firstBaseUpdate=re,y.lastBaseUpdate=ce,v===null&&(y.shared.lanes=0),Pi|=E,r.lanes=E,r.memoizedState=he}}function Zx(r,i){if(typeof r!="function")throw Error(a(191,r));r.call(i)}function Gx(r,i){var u=r.callbacks;if(u!==null)for(r.callbacks=null,r=0;r<u.length;r++)Zx(u[r],i)}var Nl=P(null),bd=P(0);function Vx(r,i){r=ti,T(bd,r),T(Nl,i),ti=r|i.baseLanes}function _m(){T(bd,ti),T(Nl,Nl.current)}function Tm(){ti=bd.current,U(Nl),U(bd)}var Ir=P(null),ea=null;function zi(r){var i=r.alternate;T(hn,hn.current&1),T(Ir,r),ea===null&&(i===null||Nl.current!==null||i.memoizedState!==null)&&(ea=r)}function Am(r){T(hn,hn.current),T(Ir,r),ea===null&&(ea=r)}function Qx(r){r.tag===22?(T(hn,hn.current),T(Ir,r),ea===null&&(ea=r)):Di()}function Di(){T(hn,hn.current),T(Ir,Ir.current)}function Lr(r){U(Ir),ea===r&&(ea=null),U(hn)}var hn=P(0);function xd(r){for(var i=r;i!==null;){if(i.tag===13){var u=i.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||Ip(u)||Lp(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 Va=0,Je=null,Mt=null,bn=null,Sd=!1,_l=!1,Is=!1,wd=0,du=0,Tl=null,a2=0;function sn(){throw Error(a(321))}function Rm(r,i){if(i===null)return!1;for(var u=0;u<i.length&&u<r.length;u++)if(!zr(r[u],i[u]))return!1;return!0}function Om(r,i,u,d,y,v){return Va=v,Je=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,q.H=r===null||r.memoizedState===null?R0:Vm,Is=!1,v=u(d,y),Is=!1,_l&&(v=Yx(i,u,d,y)),Kx(r),v}function Kx(r){q.H=mu;var i=Mt!==null&&Mt.next!==null;if(Va=0,bn=Mt=Je=null,Sd=!1,du=0,Tl=null,i)throw Error(a(300));r===null||xn||(r=r.dependencies,r!==null&&fd(r)&&(xn=!0))}function Yx(r,i,u,d){Je=r;var y=0;do{if(_l&&(Tl=null),du=0,_l=!1,25<=y)throw Error(a(301));if(y+=1,bn=Mt=null,r.updateQueue!=null){var v=r.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}q.H=O0,v=i(u,d)}while(_l);return v}function i2(){var r=q.H,i=r.useState()[0];return i=typeof i.then=="function"?fu(i):i,r=r.useState()[0],(Mt!==null?Mt.memoizedState:null)!==r&&(Je.flags|=1024),i}function Mm(){var r=wd!==0;return wd=0,r}function zm(r,i,u){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~u}function Dm(r){if(Sd){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Sd=!1}Va=0,bn=Mt=Je=null,_l=!1,du=wd=0,Tl=null}function sr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bn===null?Je.memoizedState=bn=r:bn=bn.next=r,bn}function mn(){if(Mt===null){var r=Je.alternate;r=r!==null?r.memoizedState:null}else r=Mt.next;var i=bn===null?Je.memoizedState:bn.next;if(i!==null)bn=i,Mt=r;else{if(r===null)throw Je.alternate===null?Error(a(467)):Error(a(310));Mt=r,r={memoizedState:Mt.memoizedState,baseState:Mt.baseState,baseQueue:Mt.baseQueue,queue:Mt.queue,next:null},bn===null?Je.memoizedState=bn=r:bn=bn.next=r}return bn}function kd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function fu(r){var i=du;return du+=1,Tl===null&&(Tl=[]),r=Bx(Tl,r,i),i=Je,(bn===null?i.memoizedState:bn.next)===null&&(i=i.alternate,q.H=i===null||i.memoizedState===null?R0:Vm),r}function jd(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return fu(r);if(r.$$typeof===R)return qn(r)}throw Error(a(438,String(r)))}function Im(r){var i=null,u=Je.updateQueue;if(u!==null&&(i=u.memoCache),i==null){var d=Je.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=kd(),Je.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]=L;return i.index++,u}function Qa(r,i){return typeof i=="function"?i(r):i}function Ed(r){var i=mn();return Lm(i,Mt,r)}function Lm(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,re=i,ce=!1;do{var he=re.lane&-536870913;if(he!==re.lane?(mt&he)===he:(Va&he)===he){var se=re.revertLane;if(se===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),he===kl&&(ce=!0);else if((Va&se)===se){re=re.next,se===kl&&(ce=!0);continue}else he={lane:0,revertLane:re.revertLane,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},H===null?(A=H=he,E=v):H=H.next=he,Je.lanes|=se,Pi|=se;he=re.action,Is&&u(v,he),v=re.hasEagerState?re.eagerState:u(v,he)}else se={lane:he,revertLane:re.revertLane,gesture:re.gesture,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},H===null?(A=H=se,E=v):H=H.next=se,Je.lanes|=he,Pi|=he;re=re.next}while(re!==null&&re!==i);if(H===null?E=v:H.next=A,!zr(v,r.memoizedState)&&(xn=!0,ce&&(u=jl,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 Pm(r){var i=mn(),u=i.queue;if(u===null)throw Error(a(311));u.lastRenderedReducer=r;var d=u.dispatch,y=u.pending,v=i.memoizedState;if(y!==null){u.pending=null;var E=y=y.next;do v=r(v,E.action),E=E.next;while(E!==y);zr(v,i.memoizedState)||(xn=!0),i.memoizedState=v,i.baseQueue===null&&(i.baseState=v),u.lastRenderedState=v}return[v,d]}function Xx(r,i,u){var d=Je,y=mn(),v=bt;if(v){if(u===void 0)throw Error(a(407));u=u()}else u=i();var E=!zr((Mt||y).memoizedState,u);if(E&&(y.memoizedState=u,xn=!0),y=y.queue,Fm(e0.bind(null,d,y,r),[r]),y.getSnapshot!==i||E||bn!==null&&bn.memoizedState.tag&1){if(d.flags|=2048,Al(9,{destroy:void 0},Jx.bind(null,d,y,u,i),null),Lt===null)throw Error(a(349));v||(Va&127)!==0||Wx(d,i,u)}return u}function Wx(r,i,u){r.flags|=16384,r={getSnapshot:i,value:u},i=Je.updateQueue,i===null?(i=kd(),Je.updateQueue=i,i.stores=[r]):(u=i.stores,u===null?i.stores=[r]:u.push(r))}function Jx(r,i,u,d){i.value=u,i.getSnapshot=d,t0(i)&&n0(r)}function e0(r,i,u){return u(function(){t0(i)&&n0(r)})}function t0(r){var i=r.getSnapshot;r=r.value;try{var u=i();return!zr(r,u)}catch{return!0}}function n0(r){var i=Ns(r,2);i!==null&&kr(i,r,2)}function Um(r){var i=sr();if(typeof r=="function"){var u=r;if(r=u(),Is){It(!0);try{u()}finally{It(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qa,lastRenderedState:r},i}function r0(r,i,u,d){return r.baseState=u,Lm(r,Mt,typeof d=="function"?d:Qa)}function s2(r,i,u,d,y){if(_d(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)}};q.T!==null?u(!0):v.isTransition=!1,d(v),u=i.pending,u===null?(v.next=i.pending=v,a0(i,v)):(v.next=u.next,i.pending=u.next=v)}}function a0(r,i){var u=i.action,d=i.payload,y=r.state;if(i.isTransition){var v=q.T,E={};q.T=E;try{var A=u(y,d),H=q.S;H!==null&&H(E,A),i0(r,i,A)}catch(re){Bm(r,i,re)}finally{v!==null&&E.types!==null&&(v.types=E.types),q.T=v}}else try{v=u(y,d),i0(r,i,v)}catch(re){Bm(r,i,re)}}function i0(r,i,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(d){s0(r,i,d)},function(d){return Bm(r,i,d)}):s0(r,i,u)}function s0(r,i,u){i.status="fulfilled",i.value=u,l0(i),r.state=u,i=r.pending,i!==null&&(u=i.next,u===i?r.pending=null:(u=u.next,i.next=u,a0(r,u)))}function Bm(r,i,u){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=u,l0(i),i=i.next;while(i!==d)}r.action=null}function l0(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function o0(r,i){return i}function u0(r,i){if(bt){var u=Lt.formState;if(u!==null){e:{var d=Je;if(bt){if($t){t:{for(var y=$t,v=Jr;y.nodeType!==8;){if(!v){y=null;break t}if(y=ta(y.nextSibling),y===null){y=null;break t}}v=y.data,y=v==="F!"||v==="F"?y:null}if(y){$t=ta(y.nextSibling),d=y.data==="F!";break e}}Ti(d)}d=!1}d&&(i=u[0])}}return u=sr(),u.memoizedState=u.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o0,lastRenderedState:i},u.queue=d,u=_0.bind(null,Je,d),d.dispatch=u,d=Um(!1),v=Gm.bind(null,Je,!1,d.queue),d=sr(),y={state:i,dispatch:null,action:r,pending:null},d.queue=y,u=s2.bind(null,Je,y,v,u),y.dispatch=u,d.memoizedState=r,[i,u,!1]}function c0(r){var i=mn();return d0(i,Mt,r)}function d0(r,i,u){if(i=Lm(r,i,o0)[0],r=Ed(Qa)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=fu(i)}catch(E){throw E===El?pd:E}else d=i;i=mn();var y=i.queue,v=y.dispatch;return u!==i.memoizedState&&(Je.flags|=2048,Al(9,{destroy:void 0},l2.bind(null,y,u),null)),[d,v,r]}function l2(r,i){r.action=i}function f0(r){var i=mn(),u=Mt;if(u!==null)return d0(i,u,r);mn(),i=i.memoizedState,u=mn();var d=u.queue.dispatch;return u.memoizedState=r,[i,d,!1]}function Al(r,i,u,d){return r={tag:r,create:u,deps:d,inst:i,next:null},i=Je.updateQueue,i===null&&(i=kd(),Je.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 h0(){return mn().memoizedState}function Cd(r,i,u,d){var y=sr();Je.flags|=r,y.memoizedState=Al(1|i,{destroy:void 0},u,d===void 0?null:d)}function Nd(r,i,u,d){var y=mn();d=d===void 0?null:d;var v=y.memoizedState.inst;Mt!==null&&d!==null&&Rm(d,Mt.memoizedState.deps)?y.memoizedState=Al(i,v,u,d):(Je.flags|=r,y.memoizedState=Al(1|i,v,u,d))}function m0(r,i){Cd(8390656,8,r,i)}function Fm(r,i){Nd(2048,8,r,i)}function o2(r){Je.flags|=4;var i=Je.updateQueue;if(i===null)i=kd(),Je.updateQueue=i,i.events=[r];else{var u=i.events;u===null?i.events=[r]:u.push(r)}}function p0(r){var i=mn().memoizedState;return o2({ref:i,nextImpl:r}),function(){if((Nt&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function g0(r,i){return Nd(4,2,r,i)}function y0(r,i){return Nd(4,4,r,i)}function v0(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 b0(r,i,u){u=u!=null?u.concat([r]):null,Nd(4,4,v0.bind(null,i,r),u)}function $m(){}function x0(r,i){var u=mn();i=i===void 0?null:i;var d=u.memoizedState;return i!==null&&Rm(i,d[1])?d[0]:(u.memoizedState=[r,i],r)}function S0(r,i){var u=mn();i=i===void 0?null:i;var d=u.memoizedState;if(i!==null&&Rm(i,d[1]))return d[0];if(d=r(),Is){It(!0);try{r()}finally{It(!1)}}return u.memoizedState=[d,i],d}function Hm(r,i,u){return u===void 0||(Va&1073741824)!==0&&(mt&261930)===0?r.memoizedState=i:(r.memoizedState=u,r=wS(),Je.lanes|=r,Pi|=r,u)}function w0(r,i,u,d){return zr(u,i)?u:Nl.current!==null?(r=Hm(r,u,d),zr(r,i)||(xn=!0),r):(Va&42)===0||(Va&1073741824)!==0&&(mt&261930)===0?(xn=!0,r.memoizedState=u):(r=wS(),Je.lanes|=r,Pi|=r,i)}function k0(r,i,u,d,y){var v=le.p;le.p=v!==0&&8>v?v:8;var E=q.T,A={};q.T=A,Gm(r,!1,i,u);try{var H=y(),re=q.S;if(re!==null&&re(A,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var ce=r2(H,d);hu(r,i,ce,Br(r))}else hu(r,i,d,Br(r))}catch(he){hu(r,i,{then:function(){},status:"rejected",reason:he},Br())}finally{le.p=v,E!==null&&A.types!==null&&(E.types=A.types),q.T=E}}function u2(){}function qm(r,i,u,d){if(r.tag!==5)throw Error(a(476));var y=j0(r).queue;k0(r,y,i,ee,u===null?u2:function(){return E0(r),u(d)})}function j0(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qa,lastRenderedState:ee},next:null};var u={};return i.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qa,lastRenderedState:u},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function E0(r){var i=j0(r);i.next===null&&(i=r.alternate.memoizedState),hu(r,i.next.queue,{},Br())}function Zm(){return qn(Au)}function C0(){return mn().memoizedState}function N0(){return mn().memoizedState}function c2(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var u=Br();r=Oi(u);var d=Mi(i,r,u);d!==null&&(kr(d,i,u),ou(d,i,u)),i={cache:xm()},r.payload=i;return}i=i.return}}function d2(r,i,u){var d=Br();u={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},_d(r)?T0(i,u):(u=um(r,i,u,d),u!==null&&(kr(u,r,d),A0(u,i,d)))}function _0(r,i,u){var d=Br();hu(r,i,u,d)}function hu(r,i,u,d){var y={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(_d(r))T0(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,zr(A,E))return od(r,i,y,0),Lt===null&&ld(),!1}catch{}finally{}if(u=um(r,i,y,d),u!==null)return kr(u,r,d),A0(u,i,d),!0}return!1}function Gm(r,i,u,d){if(d={lane:2,revertLane:jp(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},_d(r)){if(i)throw Error(a(479))}else i=um(r,u,d,2),i!==null&&kr(i,r,2)}function _d(r){var i=r.alternate;return r===Je||i!==null&&i===Je}function T0(r,i){_l=Sd=!0;var u=r.pending;u===null?i.next=i:(i.next=u.next,u.next=i),r.pending=i}function A0(r,i,u){if((u&4194048)!==0){var d=i.lanes;d&=r.pendingLanes,u|=d,i.lanes=u,wi(r,u)}}var mu={readContext:qn,use:jd,useCallback:sn,useContext:sn,useEffect:sn,useImperativeHandle:sn,useLayoutEffect:sn,useInsertionEffect:sn,useMemo:sn,useReducer:sn,useRef:sn,useState:sn,useDebugValue:sn,useDeferredValue:sn,useTransition:sn,useSyncExternalStore:sn,useId:sn,useHostTransitionStatus:sn,useFormState:sn,useActionState:sn,useOptimistic:sn,useMemoCache:sn,useCacheRefresh:sn};mu.useEffectEvent=sn;var R0={readContext:qn,use:jd,useCallback:function(r,i){return sr().memoizedState=[r,i===void 0?null:i],r},useContext:qn,useEffect:m0,useImperativeHandle:function(r,i,u){u=u!=null?u.concat([r]):null,Cd(4194308,4,v0.bind(null,i,r),u)},useLayoutEffect:function(r,i){return Cd(4194308,4,r,i)},useInsertionEffect:function(r,i){Cd(4,2,r,i)},useMemo:function(r,i){var u=sr();i=i===void 0?null:i;var d=r();if(Is){It(!0);try{r()}finally{It(!1)}}return u.memoizedState=[d,i],d},useReducer:function(r,i,u){var d=sr();if(u!==void 0){var y=u(i);if(Is){It(!0);try{u(i)}finally{It(!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=d2.bind(null,Je,r),[d.memoizedState,r]},useRef:function(r){var i=sr();return r={current:r},i.memoizedState=r},useState:function(r){r=Um(r);var i=r.queue,u=_0.bind(null,Je,i);return i.dispatch=u,[r.memoizedState,u]},useDebugValue:$m,useDeferredValue:function(r,i){var u=sr();return Hm(u,r,i)},useTransition:function(){var r=Um(!1);return r=k0.bind(null,Je,r.queue,!0,!1),sr().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,u){var d=Je,y=sr();if(bt){if(u===void 0)throw Error(a(407));u=u()}else{if(u=i(),Lt===null)throw Error(a(349));(mt&127)!==0||Wx(d,i,u)}y.memoizedState=u;var v={value:u,getSnapshot:i};return y.queue=v,m0(e0.bind(null,d,v,r),[r]),d.flags|=2048,Al(9,{destroy:void 0},Jx.bind(null,d,v,u,i),null),u},useId:function(){var r=sr(),i=Lt.identifierPrefix;if(bt){var u=Na,d=Ca;u=(d&~(1<<32-ft(d)-1)).toString(32)+u,i="_"+i+"R_"+u,u=wd++,0<u&&(i+="H"+u.toString(32)),i+="_"}else u=a2++,i="_"+i+"r_"+u.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:Zm,useFormState:u0,useActionState:u0,useOptimistic:function(r){var i=sr();i.memoizedState=i.baseState=r;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=u,i=Gm.bind(null,Je,!0,u),u.dispatch=i,[r,i]},useMemoCache:Im,useCacheRefresh:function(){return sr().memoizedState=c2.bind(null,Je)},useEffectEvent:function(r){var i=sr(),u={impl:r};return i.memoizedState=u,function(){if((Nt&2)!==0)throw Error(a(440));return u.impl.apply(void 0,arguments)}}},Vm={readContext:qn,use:jd,useCallback:x0,useContext:qn,useEffect:Fm,useImperativeHandle:b0,useInsertionEffect:g0,useLayoutEffect:y0,useMemo:S0,useReducer:Ed,useRef:h0,useState:function(){return Ed(Qa)},useDebugValue:$m,useDeferredValue:function(r,i){var u=mn();return w0(u,Mt.memoizedState,r,i)},useTransition:function(){var r=Ed(Qa)[0],i=mn().memoizedState;return[typeof r=="boolean"?r:fu(r),i]},useSyncExternalStore:Xx,useId:C0,useHostTransitionStatus:Zm,useFormState:c0,useActionState:c0,useOptimistic:function(r,i){var u=mn();return r0(u,Mt,r,i)},useMemoCache:Im,useCacheRefresh:N0};Vm.useEffectEvent=p0;var O0={readContext:qn,use:jd,useCallback:x0,useContext:qn,useEffect:Fm,useImperativeHandle:b0,useInsertionEffect:g0,useLayoutEffect:y0,useMemo:S0,useReducer:Pm,useRef:h0,useState:function(){return Pm(Qa)},useDebugValue:$m,useDeferredValue:function(r,i){var u=mn();return Mt===null?Hm(u,r,i):w0(u,Mt.memoizedState,r,i)},useTransition:function(){var r=Pm(Qa)[0],i=mn().memoizedState;return[typeof r=="boolean"?r:fu(r),i]},useSyncExternalStore:Xx,useId:C0,useHostTransitionStatus:Zm,useFormState:f0,useActionState:f0,useOptimistic:function(r,i){var u=mn();return Mt!==null?r0(u,Mt,r,i):(u.baseState=r,[r,u.queue.dispatch])},useMemoCache:Im,useCacheRefresh:N0};O0.useEffectEvent=p0;function Qm(r,i,u,d){i=r.memoizedState,u=u(d,i),u=u==null?i:g({},i,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var Km={enqueueSetState:function(r,i,u){r=r._reactInternals;var d=Br(),y=Oi(d);y.payload=i,u!=null&&(y.callback=u),i=Mi(r,y,d),i!==null&&(kr(i,r,d),ou(i,r,d))},enqueueReplaceState:function(r,i,u){r=r._reactInternals;var d=Br(),y=Oi(d);y.tag=1,y.payload=i,u!=null&&(y.callback=u),i=Mi(r,y,d),i!==null&&(kr(i,r,d),ou(i,r,d))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var u=Br(),d=Oi(u);d.tag=2,i!=null&&(d.callback=i),i=Mi(r,d,u),i!==null&&(kr(i,r,u),ou(i,r,u))}};function M0(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?!eu(u,d)||!eu(y,v):!0}function z0(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&&Km.enqueueReplaceState(i,i.state,null)}function Ls(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 D0(r){sd(r)}function I0(r){console.error(r)}function L0(r){sd(r)}function Td(r,i){try{var u=r.onUncaughtError;u(i.value,{componentStack:i.stack})}catch(d){setTimeout(function(){throw d})}}function P0(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 Ym(r,i,u){return u=Oi(u),u.tag=3,u.payload={element:null},u.callback=function(){Td(r,i)},u}function U0(r){return r=Oi(r),r.tag=3,r}function B0(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(){P0(i,u,d)}}var E=u.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(r.callback=function(){P0(i,u,d),typeof y!="function"&&(Ui===null?Ui=new Set([this]):Ui.add(this));var A=d.stack;this.componentDidCatch(d.value,{componentStack:A!==null?A:""})})}function f2(r,i,u,d,y){if(u.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(i=u.alternate,i!==null&&wl(i,u,y,!0),u=Ir.current,u!==null){switch(u.tag){case 31:case 13:return ea===null?Fd():u.alternate===null&&ln===0&&(ln=3),u.flags&=-257,u.flags|=65536,u.lanes=y,d===gd?u.flags|=16384:(i=u.updateQueue,i===null?u.updateQueue=new Set([d]):i.add(d),Sp(r,d,y)),!1;case 22:return u.flags|=65536,d===gd?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)),Sp(r,d,y)),!1}throw Error(a(435,u.tag))}return Sp(r,d,y),Fd(),!1}if(bt)return i=Ir.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=y,d!==pm&&(r=Error(a(422),{cause:d}),ru(Yr(r,u)))):(d!==pm&&(i=Error(a(423),{cause:d}),ru(Yr(i,u))),r=r.current.alternate,r.flags|=65536,y&=-y,r.lanes|=y,d=Yr(d,u),y=Ym(r.stateNode,d,y),Cm(r,y),ln!==4&&(ln=2)),!1;var v=Error(a(520),{cause:d});if(v=Yr(v,u),wu===null?wu=[v]:wu.push(v),ln!==4&&(ln=2),i===null)return!0;d=Yr(d,u),u=i;do{switch(u.tag){case 3:return u.flags|=65536,r=y&-y,u.lanes|=r,r=Ym(u.stateNode,d,r),Cm(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"&&(Ui===null||!Ui.has(v))))return u.flags|=65536,y&=-y,u.lanes|=y,y=U0(y),B0(y,r,u,d),Cm(u,y),!1}u=u.return}while(u!==null);return!1}var Xm=Error(a(461)),xn=!1;function Zn(r,i,u,d){i.child=r===null?qx(i,null,u,d):Ds(i,r.child,u,d)}function F0(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 Rs(i),d=Om(r,i,u,E,v,y),A=Mm(),r!==null&&!xn?(zm(r,i,y),Ka(r,i,y)):(bt&&A&&hm(i),i.flags|=1,Zn(r,i,d,y),i.child)}function $0(r,i,u,d,y){if(r===null){var v=u.type;return typeof v=="function"&&!cm(v)&&v.defaultProps===void 0&&u.compare===null?(i.tag=15,i.type=v,H0(r,i,v,d,y)):(r=cd(u.type,null,d,i,i.mode,y),r.ref=i.ref,r.return=i,i.child=r)}if(v=r.child,!ip(r,y)){var E=v.memoizedProps;if(u=u.compare,u=u!==null?u:eu,u(E,d)&&r.ref===i.ref)return Ka(r,i,y)}return i.flags|=1,r=Ha(v,d),r.ref=i.ref,r.return=i,i.child=r}function H0(r,i,u,d,y){if(r!==null){var v=r.memoizedProps;if(eu(v,d)&&r.ref===i.ref)if(xn=!1,i.pendingProps=d=v,ip(r,y))(r.flags&131072)!==0&&(xn=!0);else return i.lanes=r.lanes,Ka(r,i,y)}return Wm(r,i,u,d,y)}function q0(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 Z0(r,i,v,u,d)}if((u&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&md(i,v!==null?v.cachePool:null),v!==null?Vx(i,v):_m(),Qx(i);else return d=i.lanes=536870912,Z0(r,i,v!==null?v.baseLanes|u:u,u,d)}else v!==null?(md(i,v.cachePool),Vx(i,v),Di(),i.memoizedState=null):(r!==null&&md(i,null),_m(),Di());return Zn(r,i,y,u),i.child}function pu(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function Z0(r,i,u,d,y){var v=wm();return v=v===null?null:{parent:vn._currentValue,pool:v},i.memoizedState={baseLanes:u,cachePool:v},r!==null&&md(i,null),_m(),Qx(i),r!==null&&wl(r,i,d,!0),i.childLanes=y,null}function Ad(r,i){return i=Od({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function G0(r,i,u){return Ds(i,r.child,null,u),r=Ad(i,i.pendingProps),r.flags|=2,Lr(i),i.memoizedState=null,r}function h2(r,i,u){var d=i.pendingProps,y=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(bt){if(d.mode==="hidden")return r=Ad(i,d),i.lanes=536870912,pu(null,r);if(Am(i),(r=$t)?(r=aw(r,Jr),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:Ni!==null?{id:Ca,overflow:Na}:null,retryLane:536870912,hydrationErrors:null},u=Tx(r),u.return=i,i.child=u,Hn=i,$t=null)):r=null,r===null)throw Ti(i);return i.lanes=536870912,null}return Ad(i,d)}var v=r.memoizedState;if(v!==null){var E=v.dehydrated;if(Am(i),y)if(i.flags&256)i.flags&=-257,i=G0(r,i,u);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(a(558));else if(xn||wl(r,i,u,!1),y=(u&r.childLanes)!==0,xn||y){if(d=Lt,d!==null&&(E=ks(d,u),E!==0&&E!==v.retryLane))throw v.retryLane=E,Ns(r,E),kr(d,r,E),Xm;Fd(),i=G0(r,i,u)}else r=v.treeContext,$t=ta(E.nextSibling),Hn=i,bt=!0,_i=null,Jr=!1,r!==null&&Ox(i,r),i=Ad(i,d),i.flags|=4096;return i}return r=Ha(r.child,{mode:d.mode,children:d.children}),r.ref=i.ref,i.child=r,r.return=i,r}function Rd(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 Wm(r,i,u,d,y){return Rs(i),u=Om(r,i,u,d,void 0,y),d=Mm(),r!==null&&!xn?(zm(r,i,y),Ka(r,i,y)):(bt&&d&&hm(i),i.flags|=1,Zn(r,i,u,y),i.child)}function V0(r,i,u,d,y,v){return Rs(i),i.updateQueue=null,u=Yx(i,d,u,y),Kx(r),d=Mm(),r!==null&&!xn?(zm(r,i,v),Ka(r,i,v)):(bt&&d&&hm(i),i.flags|=1,Zn(r,i,u,v),i.child)}function Q0(r,i,u,d,y){if(Rs(i),i.stateNode===null){var v=vl,E=u.contextType;typeof E=="object"&&E!==null&&(v=qn(E)),v=new u(d,v),i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Km,i.stateNode=v,v._reactInternals=i,v=i.stateNode,v.props=d,v.state=i.memoizedState,v.refs={},jm(i),E=u.contextType,v.context=typeof E=="object"&&E!==null?qn(E):vl,v.state=i.memoizedState,E=u.getDerivedStateFromProps,typeof E=="function"&&(Qm(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&&Km.enqueueReplaceState(v,v.state,null),cu(i,d,v,y),uu(),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=Ls(u,A);v.props=H;var re=v.context,ce=u.contextType;E=vl,typeof ce=="object"&&ce!==null&&(E=qn(ce));var he=u.getDerivedStateFromProps;ce=typeof he=="function"||typeof v.getSnapshotBeforeUpdate=="function",A=i.pendingProps!==A,ce||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(A||re!==E)&&z0(i,v,d,E),Ri=!1;var se=i.memoizedState;v.state=se,cu(i,d,v,y),uu(),re=i.memoizedState,A||se!==re||Ri?(typeof he=="function"&&(Qm(i,u,he,d),re=i.memoizedState),(H=Ri||M0(i,u,H,d,se,re,E))?(ce||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(i.flags|=4194308)):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=d,i.memoizedState=re),v.props=d,v.state=re,v.context=E,d=H):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{v=i.stateNode,Em(r,i),E=i.memoizedProps,ce=Ls(u,E),v.props=ce,he=i.pendingProps,se=v.context,re=u.contextType,H=vl,typeof re=="object"&&re!==null&&(H=qn(re)),A=u.getDerivedStateFromProps,(re=typeof A=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(E!==he||se!==H)&&z0(i,v,d,H),Ri=!1,se=i.memoizedState,v.state=se,cu(i,d,v,y),uu();var oe=i.memoizedState;E!==he||se!==oe||Ri||r!==null&&r.dependencies!==null&&fd(r.dependencies)?(typeof A=="function"&&(Qm(i,u,A,d),oe=i.memoizedState),(ce=Ri||M0(i,u,ce,d,se,oe,H)||r!==null&&r.dependencies!==null&&fd(r.dependencies))?(re||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(d,oe,H),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(d,oe,H)),typeof v.componentDidUpdate=="function"&&(i.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof v.componentDidUpdate!="function"||E===r.memoizedProps&&se===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&se===r.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=oe),v.props=d,v.state=oe,v.context=H,d=ce):(typeof v.componentDidUpdate!="function"||E===r.memoizedProps&&se===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&se===r.memoizedState||(i.flags|=1024),d=!1)}return v=d,Rd(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=Ds(i,r.child,null,y),i.child=Ds(i,null,u,y)):Zn(r,i,u,y),i.memoizedState=v.state,r=i.child):r=Ka(r,i,y),r}function K0(r,i,u,d){return Ts(),i.flags|=256,Zn(r,i,u,d),i.child}var Jm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ep(r){return{baseLanes:r,cachePool:Px()}}function tp(r,i,u){return r=r!==null?r.childLanes&~u:0,i&&(r|=Ur),r}function Y0(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:(hn.current&2)!==0),E&&(y=!0,i.flags&=-129),E=(i.flags&32)!==0,i.flags&=-33,r===null){if(bt){if(y?zi(i):Di(),(r=$t)?(r=aw(r,Jr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:Ni!==null?{id:Ca,overflow:Na}:null,retryLane:536870912,hydrationErrors:null},u=Tx(r),u.return=i,i.child=u,Hn=i,$t=null)):r=null,r===null)throw Ti(i);return Lp(r)?i.lanes=32:i.lanes=536870912,null}var A=d.children;return d=d.fallback,y?(Di(),y=i.mode,A=Od({mode:"hidden",children:A},y),d=_s(d,y,u,null),A.return=i,d.return=i,A.sibling=d,i.child=A,d=i.child,d.memoizedState=ep(u),d.childLanes=tp(r,E,u),i.memoizedState=Jm,pu(null,d)):(zi(i),np(i,A))}var H=r.memoizedState;if(H!==null&&(A=H.dehydrated,A!==null)){if(v)i.flags&256?(zi(i),i.flags&=-257,i=rp(r,i,u)):i.memoizedState!==null?(Di(),i.child=r.child,i.flags|=128,i=null):(Di(),A=d.fallback,y=i.mode,d=Od({mode:"visible",children:d.children},y),A=_s(A,y,u,null),A.flags|=2,d.return=i,A.return=i,d.sibling=A,i.child=d,Ds(i,r.child,null,u),d=i.child,d.memoizedState=ep(u),d.childLanes=tp(r,E,u),i.memoizedState=Jm,i=pu(null,d));else if(zi(i),Lp(A)){if(E=A.nextSibling&&A.nextSibling.dataset,E)var re=E.dgst;E=re,d=Error(a(419)),d.stack="",d.digest=E,ru({value:d,source:null,stack:null}),i=rp(r,i,u)}else if(xn||wl(r,i,u,!1),E=(u&r.childLanes)!==0,xn||E){if(E=Lt,E!==null&&(d=ks(E,u),d!==0&&d!==H.retryLane))throw H.retryLane=d,Ns(r,d),kr(E,r,d),Xm;Ip(A)||Fd(),i=rp(r,i,u)}else Ip(A)?(i.flags|=192,i.child=r.child,i=null):(r=H.treeContext,$t=ta(A.nextSibling),Hn=i,bt=!0,_i=null,Jr=!1,r!==null&&Ox(i,r),i=np(i,d.children),i.flags|=4096);return i}return y?(Di(),A=d.fallback,y=i.mode,H=r.child,re=H.sibling,d=Ha(H,{mode:"hidden",children:d.children}),d.subtreeFlags=H.subtreeFlags&65011712,re!==null?A=Ha(re,A):(A=_s(A,y,u,null),A.flags|=2),A.return=i,d.return=i,d.sibling=A,i.child=d,pu(null,d),d=i.child,A=r.child.memoizedState,A===null?A=ep(u):(y=A.cachePool,y!==null?(H=vn._currentValue,y=y.parent!==H?{parent:H,pool:H}:y):y=Px(),A={baseLanes:A.baseLanes|u,cachePool:y}),d.memoizedState=A,d.childLanes=tp(r,E,u),i.memoizedState=Jm,pu(r.child,d)):(zi(i),u=r.child,r=u.sibling,u=Ha(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 np(r,i){return i=Od({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function Od(r,i){return r=Dr(22,r,null,i),r.lanes=0,r}function rp(r,i,u){return Ds(i,r.child,null,u),r=np(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function X0(r,i,u){r.lanes|=i;var d=r.alternate;d!==null&&(d.lanes|=i),vm(r.return,i,u)}function ap(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 W0(r,i,u){var d=i.pendingProps,y=d.revealOrder,v=d.tail;d=d.children;var E=hn.current,A=(E&2)!==0;if(A?(E=E&1|2,i.flags|=128):E&=1,T(hn,E),Zn(r,i,d,u),d=bt?nu:0,!A&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&X0(r,u,i);else if(r.tag===19)X0(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&&xd(r)===null&&(y=u),u=u.sibling;u=y,u===null?(y=i.child,i.child=null):(y=u.sibling,u.sibling=null),ap(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&&xd(r)===null){i.child=y;break}r=y.sibling,y.sibling=u,u=y,y=r}ap(i,!0,u,null,v,d);break;case"together":ap(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function Ka(r,i,u){if(r!==null&&(i.dependencies=r.dependencies),Pi|=i.lanes,(u&i.childLanes)===0)if(r!==null){if(wl(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=Ha(r,r.pendingProps),i.child=u,u.return=i;r.sibling!==null;)r=r.sibling,u=u.sibling=Ha(r,r.pendingProps),u.return=i;u.sibling=null}return i.child}function ip(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&fd(r)))}function m2(r,i,u){switch(i.tag){case 3:Re(i,i.stateNode.containerInfo),Ai(i,vn,r.memoizedState.cache),Ts();break;case 27:case 5:$e(i);break;case 4:Re(i,i.stateNode.containerInfo);break;case 10:Ai(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Am(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(zi(i),i.flags|=128,null):(u&i.child.childLanes)!==0?Y0(r,i,u):(zi(i),r=Ka(r,i,u),r!==null?r.sibling:null);zi(i);break;case 19:var y=(r.flags&128)!==0;if(d=(u&i.childLanes)!==0,d||(wl(r,i,u,!1),d=(u&i.childLanes)!==0),y){if(d)return W0(r,i,u);i.flags|=128}if(y=i.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),T(hn,hn.current),d)break;return null;case 22:return i.lanes=0,q0(r,i,u,i.pendingProps);case 24:Ai(i,vn,r.memoizedState.cache)}return Ka(r,i,u)}function J0(r,i,u){if(r!==null)if(r.memoizedProps!==i.pendingProps)xn=!0;else{if(!ip(r,u)&&(i.flags&128)===0)return xn=!1,m2(r,i,u);xn=(r.flags&131072)!==0}else xn=!1,bt&&(i.flags&1048576)!==0&&Rx(i,nu,i.index);switch(i.lanes=0,i.tag){case 16:e:{var d=i.pendingProps;if(r=Ms(i.elementType),i.type=r,typeof r=="function")cm(r)?(d=Ls(r,d),i.tag=1,i=Q0(null,i,r,d,u)):(i.tag=0,i=Wm(null,i,r,d,u));else{if(r!=null){var y=r.$$typeof;if(y===z){i.tag=11,i=F0(null,i,r,d,u);break e}else if(y===F){i.tag=14,i=$0(null,i,r,d,u);break e}}throw i=te(r)||r,Error(a(306,i,""))}}return i;case 0:return Wm(r,i,i.type,i.pendingProps,u);case 1:return d=i.type,y=Ls(d,i.pendingProps),Q0(r,i,d,y,u);case 3:e:{if(Re(i,i.stateNode.containerInfo),r===null)throw Error(a(387));d=i.pendingProps;var v=i.memoizedState;y=v.element,Em(r,i),cu(i,d,null,u);var E=i.memoizedState;if(d=E.cache,Ai(i,vn,d),d!==v.cache&&bm(i,[vn],u,!0),uu(),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=K0(r,i,d,u);break e}else if(d!==y){y=Yr(Error(a(424)),i),ru(y),i=K0(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=ta(r.firstChild),Hn=i,bt=!0,_i=null,Jr=!0,u=qx(i,null,d,u),i.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(Ts(),d===y){i=Ka(r,i,u);break e}Zn(r,i,d,u)}i=i.child}return i;case 26:return Rd(r,i),r===null?(u=cw(i.type,null,i.pendingProps,null))?i.memoizedState=u:bt||(u=i.type,r=i.pendingProps,d=Qd(ae.current).createElement(u),d[Ge]=i,d[ht]=r,Gn(d,u,r),vt(d),i.stateNode=d):i.memoizedState=cw(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return $e(i),r===null&&bt&&(d=i.stateNode=lw(i.type,i.pendingProps,ae.current),Hn=i,Jr=!0,y=$t,Hi(i.type)?(Pp=y,$t=ta(d.firstChild)):$t=y),Zn(r,i,i.pendingProps.children,u),Rd(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&bt&&((y=d=$t)&&(d=q2(d,i.type,i.pendingProps,Jr),d!==null?(i.stateNode=d,Hn=i,$t=ta(d.firstChild),Jr=!1,y=!0):y=!1),y||Ti(i)),$e(i),y=i.type,v=i.pendingProps,E=r!==null?r.memoizedProps:null,d=v.children,Mp(y,v)?d=null:E!==null&&Mp(y,E)&&(i.flags|=32),i.memoizedState!==null&&(y=Om(r,i,i2,null,null,u),Au._currentValue=y),Rd(r,i),Zn(r,i,d,u),i.child;case 6:return r===null&&bt&&((r=u=$t)&&(u=Z2(u,i.pendingProps,Jr),u!==null?(i.stateNode=u,Hn=i,$t=null,r=!0):r=!1),r||Ti(i)),null;case 13:return Y0(r,i,u);case 4:return Re(i,i.stateNode.containerInfo),d=i.pendingProps,r===null?i.child=Ds(i,null,d,u):Zn(r,i,d,u),i.child;case 11:return F0(r,i,i.type,i.pendingProps,u);case 7:return Zn(r,i,i.pendingProps,u),i.child;case 8:return Zn(r,i,i.pendingProps.children,u),i.child;case 12:return Zn(r,i,i.pendingProps.children,u),i.child;case 10:return d=i.pendingProps,Ai(i,i.type,d.value),Zn(r,i,d.children,u),i.child;case 9:return y=i.type._context,d=i.pendingProps.children,Rs(i),y=qn(y),d=d(y),i.flags|=1,Zn(r,i,d,u),i.child;case 14:return $0(r,i,i.type,i.pendingProps,u);case 15:return H0(r,i,i.type,i.pendingProps,u);case 19:return W0(r,i,u);case 31:return h2(r,i,u);case 22:return q0(r,i,u,i.pendingProps);case 24:return Rs(i),d=qn(vn),r===null?(y=wm(),y===null&&(y=Lt,v=xm(),y.pooledCache=v,v.refCount++,v!==null&&(y.pooledCacheLanes|=u),y=v),i.memoizedState={parent:d,cache:y},jm(i),Ai(i,vn,y)):((r.lanes&u)!==0&&(Em(r,i),cu(i,null,null,u),uu()),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),Ai(i,vn,d)):(d=v.cache,Ai(i,vn,d),d!==y.cache&&bm(i,[vn],u,!0))),Zn(r,i,i.pendingProps.children,u),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Ya(r){r.flags|=4}function sp(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(CS())r.flags|=8192;else throw zs=gd,km}else r.flags&=-16777217}function eS(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!pw(i))if(CS())r.flags|=8192;else throw zs=gd,km}function Md(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?Gr():536870912,r.lanes|=i,zl|=i)}function gu(r,i){if(!bt)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 p2(r,i,u){var d=i.pendingProps;switch(mm(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),Ga(vn),je(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(r===null||r.child===null)&&(Sl(i)?Ya(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,gm())),Ht(i),null;case 26:var y=i.type,v=i.memoizedState;return r===null?(Ya(i),v!==null?(Ht(i),eS(i,v)):(Ht(i),sp(i,y,null,d,u))):v?v!==r.memoizedState?(Ya(i),Ht(i),eS(i,v)):(Ht(i),i.flags&=-16777217):(r=r.memoizedProps,r!==d&&Ya(i),Ht(i),sp(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&&Ya(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return Ht(i),null}r=G.current,Sl(i)?Mx(i):(r=lw(y,d,u),i.stateNode=r,Ya(i))}return Ht(i),null;case 5:if(Ie(i),y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Ya(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return Ht(i),null}if(v=G.current,Sl(i))Mx(i);else{var E=Qd(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[Ge]=i,v[ht]=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(Gn(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&&Ya(i)}}return Ht(i),sp(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,u),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==d&&Ya(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(a(166));if(r=ae.current,Sl(i)){if(r=i.stateNode,u=i.memoizedProps,d=null,y=Hn,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}r[Ge]=i,r=!!(r.nodeValue===u||d!==null&&d.suppressHydrationWarning===!0||YS(r.nodeValue,u)),r||Ti(i,!0)}else r=Qd(r).createTextNode(d),r[Ge]=i,i.stateNode=r}return Ht(i),null;case 31:if(u=i.memoizedState,r===null||r.memoizedState!==null){if(d=Sl(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[Ge]=i}else Ts(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ht(i),r=!1}else u=gm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=u),r=!0;if(!r)return i.flags&256?(Lr(i),i):(Lr(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=Sl(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[Ge]=i}else Ts(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ht(i),y=!1}else y=gm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=y),y=!0;if(!y)return i.flags&256?(Lr(i),i):(Lr(i),null)}return Lr(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),Md(i,i.updateQueue),Ht(i),null);case 4:return je(),r===null&&_p(i.stateNode.containerInfo),Ht(i),null;case 10:return Ga(i.type),Ht(i),null;case 19:if(U(hn),d=i.memoizedState,d===null)return Ht(i),null;if(y=(i.flags&128)!==0,v=d.rendering,v===null)if(y)gu(d,!1);else{if(ln!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(v=xd(r),v!==null){for(i.flags|=128,gu(d,!1),r=v.updateQueue,i.updateQueue=r,Md(i,r),i.subtreeFlags=0,r=u,u=i.child;u!==null;)_x(u,r),u=u.sibling;return T(hn,hn.current&1|2),bt&&qa(i,d.treeForkCount),i.child}r=r.sibling}d.tail!==null&&an()>Pd&&(i.flags|=128,y=!0,gu(d,!1),i.lanes=4194304)}else{if(!y)if(r=xd(v),r!==null){if(i.flags|=128,y=!0,r=r.updateQueue,i.updateQueue=r,Md(i,r),gu(d,!0),d.tail===null&&d.tailMode==="hidden"&&!v.alternate&&!bt)return Ht(i),null}else 2*an()-d.renderingStartTime>Pd&&u!==536870912&&(i.flags|=128,y=!0,gu(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=an(),r.sibling=null,u=hn.current,T(hn,y?u&1|2:u&1),bt&&qa(i,d.treeForkCount),r):(Ht(i),null);case 22:case 23:return Lr(i),Tm(),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&&Md(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&&U(Os),null;case 24:return u=null,r!==null&&(u=r.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),Ga(vn),Ht(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function g2(r,i){switch(mm(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return Ga(vn),je(),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(Lr(i),i.alternate===null)throw Error(a(340));Ts()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(Lr(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Ts()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return U(hn),null;case 4:return je(),null;case 10:return Ga(i.type),null;case 22:case 23:return Lr(i),Tm(),r!==null&&U(Os),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return Ga(vn),null;case 25:return null;default:return null}}function tS(r,i){switch(mm(i),i.tag){case 3:Ga(vn),je();break;case 26:case 27:case 5:Ie(i);break;case 4:je();break;case 31:i.memoizedState!==null&&Lr(i);break;case 13:Lr(i);break;case 19:U(hn);break;case 10:Ga(i.type);break;case 22:case 23:Lr(i),Tm(),r!==null&&U(Os);break;case 24:Ga(vn)}}function yu(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){Ot(i,i.return,A)}}function Ii(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,re=A;try{re()}catch(ce){Ot(y,H,ce)}}}d=d.next}while(d!==v)}}catch(ce){Ot(i,i.return,ce)}}function nS(r){var i=r.updateQueue;if(i!==null){var u=r.stateNode;try{Gx(i,u)}catch(d){Ot(r,r.return,d)}}}function rS(r,i,u){u.props=Ls(r.type,r.memoizedProps),u.state=r.memoizedState;try{u.componentWillUnmount()}catch(d){Ot(r,i,d)}}function vu(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){Ot(r,i,y)}}function _a(r,i){var u=r.ref,d=r.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(y){Ot(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){Ot(r,i,y)}else u.current=null}function aS(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){Ot(r,r.return,y)}}function lp(r,i,u){try{var d=r.stateNode;P2(d,r.type,u,i),d[ht]=i}catch(y){Ot(r,r.return,y)}}function iS(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&Hi(r.type)||r.tag===4}function op(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||iS(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&&Hi(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 up(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=Fa));else if(d!==4&&(d===27&&Hi(r.type)&&(u=r.stateNode,i=null),r=r.child,r!==null))for(up(r,i,u),r=r.sibling;r!==null;)up(r,i,u),r=r.sibling}function zd(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&&Hi(r.type)&&(u=r.stateNode),r=r.child,r!==null))for(zd(r,i,u),r=r.sibling;r!==null;)zd(r,i,u),r=r.sibling}function sS(r){var i=r.stateNode,u=r.memoizedProps;try{for(var d=r.type,y=i.attributes;y.length;)i.removeAttributeNode(y[0]);Gn(i,d,u),i[Ge]=r,i[ht]=u}catch(v){Ot(r,r.return,v)}}var Xa=!1,Sn=!1,cp=!1,lS=typeof WeakSet=="function"?WeakSet:Set,In=null;function y2(r,i){if(r=r.containerInfo,Rp=tf,r=bx(r),rm(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,re=0,ce=0,he=r,se=null;t:for(;;){for(var oe;he!==u||y!==0&&he.nodeType!==3||(A=E+y),he!==v||d!==0&&he.nodeType!==3||(H=E+d),he.nodeType===3&&(E+=he.nodeValue.length),(oe=he.firstChild)!==null;)se=he,he=oe;for(;;){if(he===r)break t;if(se===u&&++re===y&&(A=E),se===v&&++ce===d&&(H=E),(oe=he.nextSibling)!==null)break;he=se,se=he.parentNode}he=oe}u=A===-1||H===-1?null:{start:A,end:H}}else u=null}u=u||{start:0,end:0}}else u=null;for(Op={focusedElem:r,selectionRange:u},tf=!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 Ae=Ls(u.type,y);r=d.getSnapshotBeforeUpdate(Ae,v),d.__reactInternalSnapshotBeforeUpdate=r}catch(Ve){Ot(u,u.return,Ve)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,u=r.nodeType,u===9)Dp(r);else if(u===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Dp(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 oS(r,i,u){var d=u.flags;switch(u.tag){case 0:case 11:case 15:Ja(r,u),d&4&&yu(5,u);break;case 1:if(Ja(r,u),d&4)if(r=u.stateNode,i===null)try{r.componentDidMount()}catch(E){Ot(u,u.return,E)}else{var y=Ls(u.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(y,i,r.__reactInternalSnapshotBeforeUpdate)}catch(E){Ot(u,u.return,E)}}d&64&&nS(u),d&512&&vu(u,u.return);break;case 3:if(Ja(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{Gx(r,i)}catch(E){Ot(u,u.return,E)}}break;case 27:i===null&&d&4&&sS(u);case 26:case 5:Ja(r,u),i===null&&d&4&&aS(u),d&512&&vu(u,u.return);break;case 12:Ja(r,u);break;case 31:Ja(r,u),d&4&&dS(r,u);break;case 13:Ja(r,u),d&4&&fS(r,u),d&64&&(r=u.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(u=C2.bind(null,u),G2(r,u))));break;case 22:if(d=u.memoizedState!==null||Xa,!d){i=i!==null&&i.memoizedState!==null||Sn,y=Xa;var v=Sn;Xa=d,(Sn=i)&&!v?ei(r,u,(u.subtreeFlags&8772)!==0):Ja(r,u),Xa=y,Sn=v}break;case 30:break;default:Ja(r,u)}}function uS(r){var i=r.alternate;i!==null&&(r.alternate=null,uS(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,br=!1;function Wa(r,i,u){for(u=u.child;u!==null;)cS(r,i,u),u=u.sibling}function cS(r,i,u){if(Bt&&typeof Bt.onCommitFiberUnmount=="function")try{Bt.onCommitFiberUnmount(Gt,u)}catch{}switch(u.tag){case 26:Sn||_a(u,i),Wa(r,i,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:Sn||_a(u,i);var d=Vt,y=br;Hi(u.type)&&(Vt=u.stateNode,br=!1),Wa(r,i,u),Nu(u.stateNode),Vt=d,br=y;break;case 5:Sn||_a(u,i);case 6:if(d=Vt,y=br,Vt=null,Wa(r,i,u),Vt=d,br=y,Vt!==null)if(br)try{(Vt.nodeType===9?Vt.body:Vt.nodeName==="HTML"?Vt.ownerDocument.body:Vt).removeChild(u.stateNode)}catch(v){Ot(u,i,v)}else try{Vt.removeChild(u.stateNode)}catch(v){Ot(u,i,v)}break;case 18:Vt!==null&&(br?(r=Vt,nw(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,u.stateNode),$l(r)):nw(Vt,u.stateNode));break;case 4:d=Vt,y=br,Vt=u.stateNode.containerInfo,br=!0,Wa(r,i,u),Vt=d,br=y;break;case 0:case 11:case 14:case 15:Ii(2,u,i),Sn||Ii(4,u,i),Wa(r,i,u);break;case 1:Sn||(_a(u,i),d=u.stateNode,typeof d.componentWillUnmount=="function"&&rS(u,i,d)),Wa(r,i,u);break;case 21:Wa(r,i,u);break;case 22:Sn=(d=Sn)||u.memoizedState!==null,Wa(r,i,u),Sn=d;break;default:Wa(r,i,u)}}function dS(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{$l(r)}catch(u){Ot(i,i.return,u)}}}function fS(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{$l(r)}catch(u){Ot(i,i.return,u)}}function v2(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new lS),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new lS),i;default:throw Error(a(435,r.tag))}}function Dd(r,i){var u=v2(r);i.forEach(function(d){if(!u.has(d)){u.add(d);var y=N2.bind(null,r,d);d.then(y,y)}})}function xr(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(Hi(A.type)){Vt=A.stateNode,br=!1;break e}break;case 5:Vt=A.stateNode,br=!1;break e;case 3:case 4:Vt=A.stateNode.containerInfo,br=!0;break e}A=A.return}if(Vt===null)throw Error(a(160));cS(v,E,y),Vt=null,br=!1,v=y.alternate,v!==null&&(v.return=null),y.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)hS(i,r),i=i.sibling}var ba=null;function hS(r,i){var u=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:xr(i,r),Sr(r),d&4&&(Ii(3,r,r.return),yu(3,r),Ii(5,r,r.return));break;case 1:xr(i,r),Sr(r),d&512&&(Sn||u===null||_a(u,u.return)),d&64&&Xa&&(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=ba;if(xr(i,r),Sr(r),d&512&&(Sn||u===null||_a(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[Ei]||v[Ge]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=y.createElement(d),y.head.insertBefore(v,y.querySelector("head > title"))),Gn(v,d,u),v[Ge]=r,vt(v),d=v;break e;case"link":var E=hw("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),Gn(v,d,u),y.head.appendChild(v);break;case"meta":if(E=hw("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),Gn(v,d,u),y.head.appendChild(v);break;default:throw Error(a(468,d))}v[Ge]=r,vt(v),d=v}r.stateNode=d}else mw(y,r.type,r.stateNode);else r.stateNode=fw(y,d,r.memoizedProps);else v!==d?(v===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):v.count--,d===null?mw(y,r.type,r.stateNode):fw(y,d,r.memoizedProps)):d===null&&r.stateNode!==null&&lp(r,r.memoizedProps,u.memoizedProps)}break;case 27:xr(i,r),Sr(r),d&512&&(Sn||u===null||_a(u,u.return)),u!==null&&d&4&&lp(r,r.memoizedProps,u.memoizedProps);break;case 5:if(xr(i,r),Sr(r),d&512&&(Sn||u===null||_a(u,u.return)),r.flags&32){y=r.stateNode;try{dl(y,"")}catch(Ae){Ot(r,r.return,Ae)}}d&4&&r.stateNode!=null&&(y=r.memoizedProps,lp(r,y,u!==null?u.memoizedProps:y)),d&1024&&(cp=!0);break;case 6:if(xr(i,r),Sr(r),d&4){if(r.stateNode===null)throw Error(a(162));d=r.memoizedProps,u=r.stateNode;try{u.nodeValue=d}catch(Ae){Ot(r,r.return,Ae)}}break;case 3:if(Xd=null,y=ba,ba=Kd(i.containerInfo),xr(i,r),ba=y,Sr(r),d&4&&u!==null&&u.memoizedState.isDehydrated)try{$l(i.containerInfo)}catch(Ae){Ot(r,r.return,Ae)}cp&&(cp=!1,mS(r));break;case 4:d=ba,ba=Kd(r.stateNode.containerInfo),xr(i,r),Sr(r),ba=d;break;case 12:xr(i,r),Sr(r);break;case 31:xr(i,r),Sr(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Dd(r,d)));break;case 13:xr(i,r),Sr(r),r.child.flags&8192&&r.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(Ld=an()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Dd(r,d)));break;case 22:y=r.memoizedState!==null;var H=u!==null&&u.memoizedState!==null,re=Xa,ce=Sn;if(Xa=re||y,Sn=ce||H,xr(i,r),Sn=ce,Xa=re,Sr(r),d&8192)e:for(i=r.stateNode,i._visibility=y?i._visibility&-2:i._visibility|1,y&&(u===null||H||Xa||Sn||Ps(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 he=H.memoizedProps.style,se=he!=null&&he.hasOwnProperty("display")?he.display:null;A.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Ae){Ot(H,H.return,Ae)}}}else if(i.tag===6){if(u===null){H=i;try{H.stateNode.nodeValue=y?"":H.memoizedProps}catch(Ae){Ot(H,H.return,Ae)}}}else if(i.tag===18){if(u===null){H=i;try{var oe=H.stateNode;y?rw(oe,!0):rw(H.stateNode,!1)}catch(Ae){Ot(H,H.return,Ae)}}}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,Dd(r,u))));break;case 19:xr(i,r),Sr(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Dd(r,d)));break;case 30:break;case 21:break;default:xr(i,r),Sr(r)}}function Sr(r){var i=r.flags;if(i&2){try{for(var u,d=r.return;d!==null;){if(iS(d)){u=d;break}d=d.return}if(u==null)throw Error(a(160));switch(u.tag){case 27:var y=u.stateNode,v=op(r);zd(r,v,y);break;case 5:var E=u.stateNode;u.flags&32&&(dl(E,""),u.flags&=-33);var A=op(r);zd(r,A,E);break;case 3:case 4:var H=u.stateNode.containerInfo,re=op(r);up(r,re,H);break;default:throw Error(a(161))}}catch(ce){Ot(r,r.return,ce)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function mS(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;mS(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function Ja(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)oS(r,i.alternate,i),i=i.sibling}function Ps(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:Ii(4,i,i.return),Ps(i);break;case 1:_a(i,i.return);var u=i.stateNode;typeof u.componentWillUnmount=="function"&&rS(i,i.return,u),Ps(i);break;case 27:Nu(i.stateNode);case 26:case 5:_a(i,i.return),Ps(i);break;case 22:i.memoizedState===null&&Ps(i);break;case 30:Ps(i);break;default:Ps(i)}r=r.sibling}}function ei(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:ei(y,v,u),yu(4,v);break;case 1:if(ei(y,v,u),d=v,y=d.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(re){Ot(d,d.return,re)}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++)Zx(H[y],A)}catch(re){Ot(d,d.return,re)}}u&&E&64&&nS(v),vu(v,v.return);break;case 27:sS(v);case 26:case 5:ei(y,v,u),u&&d===null&&E&4&&aS(v),vu(v,v.return);break;case 12:ei(y,v,u);break;case 31:ei(y,v,u),u&&E&4&&dS(y,v);break;case 13:ei(y,v,u),u&&E&4&&fS(y,v);break;case 22:v.memoizedState===null&&ei(y,v,u),vu(v,v.return);break;case 30:break;default:ei(y,v,u)}i=i.sibling}}function dp(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&&au(u))}function fp(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&au(r))}function xa(r,i,u,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)pS(r,i,u,d),i=i.sibling}function pS(r,i,u,d){var y=i.flags;switch(i.tag){case 0:case 11:case 15:xa(r,i,u,d),y&2048&&yu(9,i);break;case 1:xa(r,i,u,d);break;case 3:xa(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&&au(r)));break;case 12:if(y&2048){xa(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){Ot(i,i.return,H)}}else xa(r,i,u,d);break;case 31:xa(r,i,u,d);break;case 13:xa(r,i,u,d);break;case 23:break;case 22:v=i.stateNode,E=i.alternate,i.memoizedState!==null?v._visibility&2?xa(r,i,u,d):bu(r,i):v._visibility&2?xa(r,i,u,d):(v._visibility|=2,Rl(r,i,u,d,(i.subtreeFlags&10256)!==0||!1)),y&2048&&dp(E,i);break;case 24:xa(r,i,u,d),y&2048&&fp(i.alternate,i);break;default:xa(r,i,u,d)}}function Rl(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,re=E.flags;switch(E.tag){case 0:case 11:case 15:Rl(v,E,A,H,y),yu(8,E);break;case 23:break;case 22:var ce=E.stateNode;E.memoizedState!==null?ce._visibility&2?Rl(v,E,A,H,y):bu(v,E):(ce._visibility|=2,Rl(v,E,A,H,y)),y&&re&2048&&dp(E.alternate,E);break;case 24:Rl(v,E,A,H,y),y&&re&2048&&fp(E.alternate,E);break;default:Rl(v,E,A,H,y)}i=i.sibling}}function bu(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:bu(u,d),y&2048&&dp(d.alternate,d);break;case 24:bu(u,d),y&2048&&fp(d.alternate,d);break;default:bu(u,d)}i=i.sibling}}var xu=8192;function Ol(r,i,u){if(r.subtreeFlags&xu)for(r=r.child;r!==null;)gS(r,i,u),r=r.sibling}function gS(r,i,u){switch(r.tag){case 26:Ol(r,i,u),r.flags&xu&&r.memoizedState!==null&&aR(u,ba,r.memoizedState,r.memoizedProps);break;case 5:Ol(r,i,u);break;case 3:case 4:var d=ba;ba=Kd(r.stateNode.containerInfo),Ol(r,i,u),ba=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=xu,xu=16777216,Ol(r,i,u),xu=d):Ol(r,i,u));break;default:Ol(r,i,u)}}function yS(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 Su(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,bS(d,r)}yS(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)vS(r),r=r.sibling}function vS(r){switch(r.tag){case 0:case 11:case 15:Su(r),r.flags&2048&&Ii(9,r,r.return);break;case 3:Su(r);break;case 12:Su(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,Id(r)):Su(r);break;default:Su(r)}}function Id(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,bS(d,r)}yS(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:Ii(8,i,i.return),Id(i);break;case 22:u=i.stateNode,u._visibility&2&&(u._visibility&=-3,Id(i));break;default:Id(i)}r=r.sibling}}function bS(r,i){for(;In!==null;){var u=In;switch(u.tag){case 0:case 11:case 15:Ii(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:au(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(uS(d),d===u){In=null;break e}if(y!==null){y.return=v,In=y;break e}In=v}}}var b2={getCacheForType:function(r){var i=qn(vn),u=i.data.get(r);return u===void 0&&(u=r(),i.data.set(r,u)),u},cacheSignal:function(){return qn(vn).controller.signal}},x2=typeof WeakMap=="function"?WeakMap:Map,Nt=0,Lt=null,ut=null,mt=0,Rt=0,Pr=null,Li=!1,Ml=!1,hp=!1,ti=0,ln=0,Pi=0,Us=0,mp=0,Ur=0,zl=0,wu=null,wr=null,pp=!1,Ld=0,xS=0,Pd=1/0,Ud=null,Ui=null,_n=0,Bi=null,Dl=null,ni=0,gp=0,yp=null,SS=null,ku=0,vp=null;function Br(){return(Nt&2)!==0&&mt!==0?mt&-mt:q.T!==null?jp():ki()}function wS(){if(Ur===0)if((mt&536870912)===0||bt){var r=ir;ir<<=1,(ir&3932160)===0&&(ir=262144),Ur=r}else Ur=536870912;return r=Ir.current,r!==null&&(r.flags|=32),Ur}function kr(r,i,u){(r===Lt&&(Rt===2||Rt===9)||r.cancelPendingCommit!==null)&&(Il(r,0),Fi(r,mt,Ur,!1)),ya(r,u),((Nt&2)===0||r!==Lt)&&(r===Lt&&((Nt&2)===0&&(Us|=u),ln===4&&Fi(r,mt,Ur,!1)),Ta(r))}function kS(r,i,u){if((Nt&6)!==0)throw Error(a(327));var d=!u&&(i&127)===0&&(i&r.expiredLanes)===0||ga(r,i),y=d?k2(r,i):xp(r,i,!0),v=d;do{if(y===0){Ml&&!d&&Fi(r,i,0,!1);break}else{if(u=r.current.alternate,v&&!S2(u)){y=xp(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=wu;var H=A.current.memoizedState.isDehydrated;if(H&&(Il(A,E).flags|=256),E=xp(A,E,!1),E!==2){if(hp&&!H){A.errorRecoveryDisabledLanes|=v,Us|=v,y=4;break e}v=wr,wr=y,v!==null&&(wr===null?wr=v:wr.push.apply(wr,v))}y=E}if(v=!1,y!==2)continue}}if(y===1){Il(r,0),Fi(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:Fi(d,i,Ur,!Li);break e;case 2:wr=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(y=Ld+300-an(),10<y)){if(Fi(d,i,Ur,!Li),Pa(d,0,!0)!==0)break e;ni=i,d.timeoutHandle=ew(jS.bind(null,d,u,wr,Ud,pp,i,Ur,Us,zl,Li,v,"Throttled",-0,0),y);break e}jS(d,u,wr,Ud,pp,i,Ur,Us,zl,Li,v,null,-0,0)}}break}while(!0);Ta(r)}function jS(r,i,u,d,y,v,E,A,H,re,ce,he,se,oe){if(r.timeoutHandle=-1,he=i.subtreeFlags,he&8192||(he&16785408)===16785408){he={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fa},gS(i,v,he);var Ae=(v&62914560)===v?Ld-an():(v&4194048)===v?xS-an():0;if(Ae=iR(he,Ae),Ae!==null){ni=v,r.cancelPendingCommit=Ae(OS.bind(null,r,i,v,u,d,y,E,A,H,ce,he,null,se,oe)),Fi(r,v,E,!re);return}}OS(r,i,v,u,d,y,E,A,H)}function S2(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(!zr(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 Fi(r,i,u,d){i&=~mp,i&=~Us,r.suspendedLanes|=i,r.pingedLanes&=~i,d&&(r.warmLanes|=i),d=r.expirationTimes;for(var y=i;0<y;){var v=31-ft(y),E=1<<v;d[v]=-1,y&=~E}u!==0&&Si(r,u,i)}function Bd(){return(Nt&6)===0?(ju(0),!1):!0}function bp(){if(ut!==null){if(Rt===0)var r=ut.return;else r=ut,Za=As=null,Dm(r),Cl=null,su=0,r=ut;for(;r!==null;)tS(r.alternate,r),r=r.return;ut=null}}function Il(r,i){var u=r.timeoutHandle;u!==-1&&(r.timeoutHandle=-1,F2(u)),u=r.cancelPendingCommit,u!==null&&(r.cancelPendingCommit=null,u()),ni=0,bp(),Lt=r,ut=u=Ha(r.current,null),mt=i,Rt=0,Pr=null,Li=!1,Ml=ga(r,i),hp=!1,zl=Ur=mp=Us=Pi=ln=0,wr=wu=null,pp=!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-ft(d),v=1<<y;i|=r[y],d&=~v}return ti=i,ld(),u}function ES(r,i){Je=null,q.H=mu,i===El||i===pd?(i=Fx(),Rt=3):i===km?(i=Fx(),Rt=4):Rt=i===Xm?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Pr=i,ut===null&&(ln=1,Td(r,Yr(i,r.current)))}function CS(){var r=Ir.current;return r===null?!0:(mt&4194048)===mt?ea===null:(mt&62914560)===mt||(mt&536870912)!==0?r===ea:!1}function NS(){var r=q.H;return q.H=mu,r===null?mu:r}function _S(){var r=q.A;return q.A=b2,r}function Fd(){ln=4,Li||(mt&4194048)!==mt&&Ir.current!==null||(Ml=!0),(Pi&134217727)===0&&(Us&134217727)===0||Lt===null||Fi(Lt,mt,Ur,!1)}function xp(r,i,u){var d=Nt;Nt|=2;var y=NS(),v=_S();(Lt!==r||mt!==i)&&(Ud=null,Il(r,i)),i=!1;var E=ln;e:do try{if(Rt!==0&&ut!==null){var A=ut,H=Pr;switch(Rt){case 8:bp(),E=6;break e;case 3:case 2:case 9:case 6:Ir.current===null&&(i=!0);var re=Rt;if(Rt=0,Pr=null,Ll(r,A,H,re),u&&Ml){E=0;break e}break;default:re=Rt,Rt=0,Pr=null,Ll(r,A,H,re)}}w2(),E=ln;break}catch(ce){ES(r,ce)}while(!0);return i&&r.shellSuspendCounter++,Za=As=null,Nt=d,q.H=y,q.A=v,ut===null&&(Lt=null,mt=0,ld()),E}function w2(){for(;ut!==null;)TS(ut)}function k2(r,i){var u=Nt;Nt|=2;var d=NS(),y=_S();Lt!==r||mt!==i?(Ud=null,Pd=an()+500,Il(r,i)):Ml=ga(r,i);e:do try{if(Rt!==0&&ut!==null){i=ut;var v=Pr;t:switch(Rt){case 1:Rt=0,Pr=null,Ll(r,i,v,1);break;case 2:case 9:if(Ux(v)){Rt=0,Pr=null,AS(i);break}i=function(){Rt!==2&&Rt!==9||Lt!==r||(Rt=7),Ta(r)},v.then(i,i);break e;case 3:Rt=7;break e;case 4:Rt=5;break e;case 7:Ux(v)?(Rt=0,Pr=null,AS(i)):(Rt=0,Pr=null,Ll(r,i,v,7));break;case 5:var E=null;switch(ut.tag){case 26:E=ut.memoizedState;case 5:case 27:var A=ut;if(E?pw(E):A.stateNode.complete){Rt=0,Pr=null;var H=A.sibling;if(H!==null)ut=H;else{var re=A.return;re!==null?(ut=re,$d(re)):ut=null}break t}}Rt=0,Pr=null,Ll(r,i,v,5);break;case 6:Rt=0,Pr=null,Ll(r,i,v,6);break;case 8:bp(),ln=6;break e;default:throw Error(a(462))}}j2();break}catch(ce){ES(r,ce)}while(!0);return Za=As=null,q.H=d,q.A=y,Nt=u,ut!==null?0:(Lt=null,mt=0,ld(),ln)}function j2(){for(;ut!==null&&!rn();)TS(ut)}function TS(r){var i=J0(r.alternate,r,ti);r.memoizedProps=r.pendingProps,i===null?$d(r):ut=i}function AS(r){var i=r,u=i.alternate;switch(i.tag){case 15:case 0:i=V0(u,i,i.pendingProps,i.type,void 0,mt);break;case 11:i=V0(u,i,i.pendingProps,i.type.render,i.ref,mt);break;case 5:Dm(i);default:tS(u,i),i=ut=_x(i,ti),i=J0(u,i,ti)}r.memoizedProps=r.pendingProps,i===null?$d(r):ut=i}function Ll(r,i,u,d){Za=As=null,Dm(i),Cl=null,su=0;var y=i.return;try{if(f2(r,y,i,u,mt)){ln=1,Td(r,Yr(u,r.current)),ut=null;return}}catch(v){if(y!==null)throw ut=y,v;ln=1,Td(r,Yr(u,r.current)),ut=null;return}i.flags&32768?(bt||d===1?r=!0:Ml||(mt&536870912)!==0?r=!1:(Li=r=!0,(d===2||d===9||d===3||d===6)&&(d=Ir.current,d!==null&&d.tag===13&&(d.flags|=16384))),RS(i,r)):$d(i)}function $d(r){var i=r;do{if((i.flags&32768)!==0){RS(i,Li);return}r=i.return;var u=p2(i.alternate,i,ti);if(u!==null){ut=u;return}if(i=i.sibling,i!==null){ut=i;return}ut=i=r}while(i!==null);ln===0&&(ln=5)}function RS(r,i){do{var u=g2(r.alternate,r);if(u!==null){u.flags&=32767,ut=u;return}if(u=r.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!i&&(r=r.sibling,r!==null)){ut=r;return}ut=r=u}while(r!==null);ln=6,ut=null}function OS(r,i,u,d,y,v,E,A,H){r.cancelPendingCommit=null;do Hd();while(_n!==0);if((Nt&6)!==0)throw Error(a(327));if(i!==null){if(i===r.current)throw Error(a(177));if(v=i.lanes|i.childLanes,v|=om,xi(r,u,v,E,A,H),r===Lt&&(ut=Lt=null,mt=0),Dl=i,Bi=r,ni=u,gp=v,yp=y,SS=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,_2(Be,function(){return LS(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=q.T,q.T=null,y=le.p,le.p=2,E=Nt,Nt|=4;try{y2(r,i,u)}finally{Nt=E,le.p=y,q.T=d}}_n=1,MS(),zS(),DS()}}function MS(){if(_n===1){_n=0;var r=Bi,i=Dl,u=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||u){u=q.T,q.T=null;var d=le.p;le.p=2;var y=Nt;Nt|=4;try{hS(i,r);var v=Op,E=bx(r.containerInfo),A=v.focusedElem,H=v.selectionRange;if(E!==A&&A&&A.ownerDocument&&vx(A.ownerDocument.documentElement,A)){if(H!==null&&rm(A)){var re=H.start,ce=H.end;if(ce===void 0&&(ce=re),"selectionStart"in A)A.selectionStart=re,A.selectionEnd=Math.min(ce,A.value.length);else{var he=A.ownerDocument||document,se=he&&he.defaultView||window;if(se.getSelection){var oe=se.getSelection(),Ae=A.textContent.length,Ve=Math.min(H.start,Ae),Dt=H.end===void 0?Ve:Math.min(H.end,Ae);!oe.extend&&Ve>Dt&&(E=Dt,Dt=Ve,Ve=E);var X=yx(A,Ve),Q=yx(A,Dt);if(X&&Q&&(oe.rangeCount!==1||oe.anchorNode!==X.node||oe.anchorOffset!==X.offset||oe.focusNode!==Q.node||oe.focusOffset!==Q.offset)){var ne=he.createRange();ne.setStart(X.node,X.offset),oe.removeAllRanges(),Ve>Dt?(oe.addRange(ne),oe.extend(Q.node,Q.offset)):(ne.setEnd(Q.node,Q.offset),oe.addRange(ne))}}}}for(he=[],oe=A;oe=oe.parentNode;)oe.nodeType===1&&he.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<he.length;A++){var fe=he[A];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}tf=!!Rp,Op=Rp=null}finally{Nt=y,le.p=d,q.T=u}}r.current=i,_n=2}}function zS(){if(_n===2){_n=0;var r=Bi,i=Dl,u=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||u){u=q.T,q.T=null;var d=le.p;le.p=2;var y=Nt;Nt|=4;try{oS(r,i.alternate,i)}finally{Nt=y,le.p=d,q.T=u}}_n=3}}function DS(){if(_n===4||_n===3){_n=0,La();var r=Bi,i=Dl,u=ni,d=SS;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?_n=5:(_n=0,Dl=Bi=null,IS(r,r.pendingLanes));var y=r.pendingLanes;if(y===0&&(Ui=null),yr(u),i=i.stateNode,Bt&&typeof Bt.onCommitFiberRoot=="function")try{Bt.onCommitFiberRoot(Gt,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=q.T,y=le.p,le.p=2,q.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{q.T=i,le.p=y}}(ni&3)!==0&&Hd(),Ta(r),y=r.pendingLanes,(u&261930)!==0&&(y&42)!==0?r===vp?ku++:(ku=0,vp=r):ku=0,ju(0)}}function IS(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,au(i)))}function Hd(){return MS(),zS(),DS(),LS()}function LS(){if(_n!==5)return!1;var r=Bi,i=gp;gp=0;var u=yr(ni),d=q.T,y=le.p;try{le.p=32>u?32:u,q.T=null,u=yp,yp=null;var v=Bi,E=ni;if(_n=0,Dl=Bi=null,ni=0,(Nt&6)!==0)throw Error(a(331));var A=Nt;if(Nt|=4,vS(v.current),pS(v,v.current,E,u),Nt=A,ju(0,!1),Bt&&typeof Bt.onPostCommitFiberRoot=="function")try{Bt.onPostCommitFiberRoot(Gt,v)}catch{}return!0}finally{le.p=y,q.T=d,IS(r,i)}}function PS(r,i,u){i=Yr(u,i),i=Ym(r.stateNode,i,2),r=Mi(r,i,2),r!==null&&(ya(r,2),Ta(r))}function Ot(r,i,u){if(r.tag===3)PS(r,r,u);else for(;i!==null;){if(i.tag===3){PS(i,r,u);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Ui===null||!Ui.has(d))){r=Yr(u,r),u=U0(2),d=Mi(i,u,2),d!==null&&(B0(u,d,i,r),ya(d,2),Ta(d));break}}i=i.return}}function Sp(r,i,u){var d=r.pingCache;if(d===null){d=r.pingCache=new x2;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)||(hp=!0,y.add(u),r=E2.bind(null,r,i,u),i.then(r,r))}function E2(r,i,u){var d=r.pingCache;d!==null&&d.delete(i),r.pingedLanes|=r.suspendedLanes&u,r.warmLanes&=~u,Lt===r&&(mt&u)===u&&(ln===4||ln===3&&(mt&62914560)===mt&&300>an()-Ld?(Nt&2)===0&&Il(r,0):mp|=u,zl===mt&&(zl=0)),Ta(r)}function US(r,i){i===0&&(i=Gr()),r=Ns(r,i),r!==null&&(ya(r,i),Ta(r))}function C2(r){var i=r.memoizedState,u=0;i!==null&&(u=i.retryLane),US(r,u)}function N2(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),US(r,u)}function _2(r,i){return qe(r,i)}var qd=null,Pl=null,wp=!1,Zd=!1,kp=!1,$i=0;function Ta(r){r!==Pl&&r.next===null&&(Pl===null?qd=Pl=r:Pl=Pl.next=r),Zd=!0,wp||(wp=!0,A2())}function ju(r,i){if(!kp&&Zd){kp=!0;do for(var u=!1,d=qd;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-ft(42|r)+1)-1,v&=y&~(E&~A),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(u=!0,HS(d,v))}else v=mt,v=Pa(d,d===Lt?v:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(v&3)===0||ga(d,v)||(u=!0,HS(d,v));d=d.next}while(u);kp=!1}}function T2(){BS()}function BS(){Zd=wp=!1;var r=0;$i!==0&&B2()&&(r=$i);for(var i=an(),u=null,d=qd;d!==null;){var y=d.next,v=FS(d,i);v===0?(d.next=null,u===null?qd=y:u.next=y,y===null&&(Pl=u)):(u=d,(r!==0||(v&3)!==0)&&(Zd=!0)),d=y}_n!==0&&_n!==5||ju(r),$i!==0&&($i=0)}function FS(r,i){for(var u=r.suspendedLanes,d=r.pingedLanes,y=r.expirationTimes,v=r.pendingLanes&-62914561;0<v;){var E=31-ft(v),A=1<<E,H=y[E];H===-1?((A&u)===0||(A&d)!==0)&&(y[E]=Jt(A,i)):H<=i&&(r.expiredLanes|=A),v&=~A}if(i=Lt,u=mt,u=Pa(r,r===i?u:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,u===0||r===i&&(Rt===2||Rt===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&Mn(d),r.callbackNode=null,r.callbackPriority=0;if((u&3)===0||ga(r,u)){if(i=u&-u,i===r.callbackPriority)return i;switch(d!==null&&Mn(d),yr(u)){case 2:case 8:u=be;break;case 32:u=Be;break;case 268435456:u=yt;break;default:u=Be}return d=$S.bind(null,r),u=qe(u,d),r.callbackPriority=i,r.callbackNode=u,i}return d!==null&&d!==null&&Mn(d),r.callbackPriority=2,r.callbackNode=null,2}function $S(r,i){if(_n!==0&&_n!==5)return r.callbackNode=null,r.callbackPriority=0,null;var u=r.callbackNode;if(Hd()&&r.callbackNode!==u)return null;var d=mt;return d=Pa(r,r===Lt?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(kS(r,d,i),FS(r,an()),r.callbackNode!=null&&r.callbackNode===u?$S.bind(null,r):null)}function HS(r,i){if(Hd())return null;kS(r,i,!0)}function A2(){$2(function(){(Nt&6)!==0?qe(ue,T2):BS()})}function jp(){if($i===0){var r=kl;r===0&&(r=Ea,Ea<<=1,(Ea&261888)===0&&(Ea=256)),$i=r}return $i}function qS(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Jc(""+r)}function ZS(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 R2(r,i,u,d,y){if(i==="submit"&&u&&u.stateNode===y){var v=qS((y[ht]||null).action),E=d.submitter;E&&(i=(i=E[ht]||null)?qS(i.formAction):E.getAttribute("formAction"),i!==null&&(v=i,E=null));var A=new rd("action","action",null,d,y);r.push({event:A,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if($i!==0){var H=E?ZS(y,E):new FormData(y);qm(u,{pending:!0,data:H,method:y.method,action:v},null,H)}}else typeof v=="function"&&(A.preventDefault(),H=E?ZS(y,E):new FormData(y),qm(u,{pending:!0,data:H,method:y.method,action:v},v,H))},currentTarget:y}]})}}for(var Ep=0;Ep<lm.length;Ep++){var Cp=lm[Ep],O2=Cp.toLowerCase(),M2=Cp[0].toUpperCase()+Cp.slice(1);va(O2,"on"+M2)}va(wx,"onAnimationEnd"),va(kx,"onAnimationIteration"),va(jx,"onAnimationStart"),va("dblclick","onDoubleClick"),va("focusin","onFocus"),va("focusout","onBlur"),va(KA,"onTransitionRun"),va(YA,"onTransitionStart"),va(XA,"onTransitionCancel"),va(Ex,"onTransitionEnd"),Dn("onMouseEnter",["mouseout","mouseover"]),Dn("onMouseLeave",["mouseout","mouseover"]),Dn("onPointerEnter",["pointerout","pointerover"]),Dn("onPointerLeave",["pointerout","pointerover"]),yn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),yn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),yn("onBeforeInput",["compositionend","keypress","textInput","paste"]),yn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),yn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),yn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Eu="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(" "),z2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Eu));function GS(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,re=A.currentTarget;if(A=A.listener,H!==v&&y.isPropagationStopped())break e;v=A,y.currentTarget=re;try{v(y)}catch(ce){sd(ce)}y.currentTarget=null,v=H}else for(E=0;E<d.length;E++){if(A=d[E],H=A.instance,re=A.currentTarget,A=A.listener,H!==v&&y.isPropagationStopped())break e;v=A,y.currentTarget=re;try{v(y)}catch(ce){sd(ce)}y.currentTarget=null,v=H}}}}function ct(r,i){var u=i[Ua];u===void 0&&(u=i[Ua]=new Set);var d=r+"__bubble";u.has(d)||(VS(i,r,2,!1),u.add(d))}function Np(r,i,u){var d=0;i&&(d|=4),VS(u,r,d,i)}var Gd="_reactListening"+Math.random().toString(36).slice(2);function _p(r){if(!r[Gd]){r[Gd]=!0,en.forEach(function(u){u!=="selectionchange"&&(z2.has(u)||Np(u,!1,r),Np(u,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[Gd]||(i[Gd]=!0,Np("selectionchange",!1,i))}}function VS(r,i,u,d){switch(ww(i)){case 2:var y=oR;break;case 8:y=uR;break;default:y=Hp}u=y.bind(null,i,u,r),y=void 0,!Qh||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(y=!0),d?y!==void 0?r.addEventListener(i,u,{capture:!0,passive:y}):r.addEventListener(i,u,!0):y!==void 0?r.addEventListener(i,u,{passive:y}):r.addEventListener(i,u,!1)}function Tp(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}Wb(function(){var re=v,ce=Gh(u),he=[];e:{var se=Cx.get(r);if(se!==void 0){var oe=rd,Ae=r;switch(r){case"keypress":if(td(u)===0)break e;case"keydown":case"keyup":oe=NA;break;case"focusin":Ae="focus",oe=Wh;break;case"focusout":Ae="blur",oe=Wh;break;case"beforeblur":case"afterblur":oe=Wh;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":oe=tx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":oe=pA;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":oe=AA;break;case wx:case kx:case jx:oe=vA;break;case Ex:oe=OA;break;case"scroll":case"scrollend":oe=hA;break;case"wheel":oe=zA;break;case"copy":case"cut":case"paste":oe=xA;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":oe=rx;break;case"toggle":case"beforetoggle":oe=IA}var Ve=(i&4)!==0,Dt=!Ve&&(r==="scroll"||r==="scrollend"),X=Ve?se!==null?se+"Capture":null:se;Ve=[];for(var Q=re,ne;Q!==null;){var fe=Q;if(ne=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||ne===null||X===null||(fe=Vo(Q,X),fe!=null&&Ve.push(Cu(Q,fe,ne))),Dt)break;Q=Q.return}0<Ve.length&&(se=new oe(se,Ae,null,u,ce),he.push({event:se,listeners:Ve}))}}if((i&7)===0){e:{if(se=r==="mouseover"||r==="pointerover",oe=r==="mouseout"||r==="pointerout",se&&u!==Zh&&(Ae=u.relatedTarget||u.fromElement)&&($(Ae)||Ae[Fn]))break e;if((oe||se)&&(se=ce.window===ce?ce:(se=ce.ownerDocument)?se.defaultView||se.parentWindow:window,oe?(Ae=u.relatedTarget||u.toElement,oe=re,Ae=Ae?$(Ae):null,Ae!==null&&(Dt=o(Ae),Ve=Ae.tag,Ae!==Dt||Ve!==5&&Ve!==27&&Ve!==6)&&(Ae=null)):(oe=null,Ae=re),oe!==Ae)){if(Ve=tx,fe="onMouseLeave",X="onMouseEnter",Q="mouse",(r==="pointerout"||r==="pointerover")&&(Ve=rx,fe="onPointerLeave",X="onPointerEnter",Q="pointer"),Dt=oe==null?se:Ne(oe),ne=Ae==null?se:Ne(Ae),se=new Ve(fe,Q+"leave",oe,u,ce),se.target=Dt,se.relatedTarget=ne,fe=null,$(ce)===re&&(Ve=new Ve(X,Q+"enter",Ae,u,ce),Ve.target=ne,Ve.relatedTarget=Dt,fe=Ve),Dt=fe,oe&&Ae)t:{for(Ve=D2,X=oe,Q=Ae,ne=0,fe=X;fe;fe=Ve(fe))ne++;fe=0;for(var Fe=Q;Fe;Fe=Ve(Fe))fe++;for(;0<ne-fe;)X=Ve(X),ne--;for(;0<fe-ne;)Q=Ve(Q),fe--;for(;ne--;){if(X===Q||Q!==null&&X===Q.alternate){Ve=X;break t}X=Ve(X),Q=Ve(Q)}Ve=null}else Ve=null;oe!==null&&QS(he,se,oe,Ve,!1),Ae!==null&&Dt!==null&&QS(he,Dt,Ae,Ve,!0)}}e:{if(se=re?Ne(re):window,oe=se.nodeName&&se.nodeName.toLowerCase(),oe==="select"||oe==="input"&&se.type==="file")var Et=dx;else if(ux(se))if(fx)Et=GA;else{Et=qA;var De=HA}else oe=se.nodeName,!oe||oe.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?re&&qh(re.elementType)&&(Et=dx):Et=ZA;if(Et&&(Et=Et(r,re))){cx(he,Et,u,ce);break e}De&&De(r,se,re),r==="focusout"&&re&&se.type==="number"&&re.memoizedProps.value!=null&&Hh(se,"number",se.value)}switch(De=re?Ne(re):window,r){case"focusin":(ux(De)||De.contentEditable==="true")&&(pl=De,am=re,tu=null);break;case"focusout":tu=am=pl=null;break;case"mousedown":im=!0;break;case"contextmenu":case"mouseup":case"dragend":im=!1,xx(he,u,ce);break;case"selectionchange":if(QA)break;case"keydown":case"keyup":xx(he,u,ce)}var tt;if(em)e:{switch(r){case"compositionstart":var pt="onCompositionStart";break e;case"compositionend":pt="onCompositionEnd";break e;case"compositionupdate":pt="onCompositionUpdate";break e}pt=void 0}else ml?lx(r,u)&&(pt="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(pt="onCompositionStart");pt&&(ax&&u.locale!=="ko"&&(ml||pt!=="onCompositionStart"?pt==="onCompositionEnd"&&ml&&(tt=Jb()):(Ci=ce,Kh="value"in Ci?Ci.value:Ci.textContent,ml=!0)),De=Vd(re,pt),0<De.length&&(pt=new nx(pt,r,null,u,ce),he.push({event:pt,listeners:De}),tt?pt.data=tt:(tt=ox(u),tt!==null&&(pt.data=tt)))),(tt=PA?UA(r,u):BA(r,u))&&(pt=Vd(re,"onBeforeInput"),0<pt.length&&(De=new nx("onBeforeInput","beforeinput",null,u,ce),he.push({event:De,listeners:pt}),De.data=tt)),R2(he,r,re,u,ce)}GS(he,i)})}function Cu(r,i,u){return{instance:r,listener:i,currentTarget:u}}function Vd(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=Vo(r,u),y!=null&&d.unshift(Cu(r,y,v)),y=Vo(r,i),y!=null&&d.push(Cu(r,y,v))),r.tag===3)return d;r=r.return}return[]}function D2(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function QS(r,i,u,d,y){for(var v=i._reactName,E=[];u!==null&&u!==d;){var A=u,H=A.alternate,re=A.stateNode;if(A=A.tag,H!==null&&H===d)break;A!==5&&A!==26&&A!==27||re===null||(H=re,y?(re=Vo(u,v),re!=null&&E.unshift(Cu(u,re,H))):y||(re=Vo(u,v),re!=null&&E.push(Cu(u,re,H)))),u=u.return}E.length!==0&&r.push({event:i,listeners:E})}var I2=/\r\n?/g,L2=/\u0000|\uFFFD/g;function KS(r){return(typeof r=="string"?r:""+r).replace(I2,`
|
|
49
|
-
`).replace(L2,"")}function YS(r,i){return i=KS(i),KS(r)===i}function zt(r,i,u,d,y,v){switch(u){case"children":typeof d=="string"?i==="body"||i==="textarea"&&d===""||dl(r,d):(typeof d=="number"||typeof d=="bigint")&&i!=="body"&&dl(r,""+d);break;case"className":Xc(r,"class",d);break;case"tabIndex":Xc(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Xc(r,u,d);break;case"style":Yb(r,d,v);break;case"data":if(i!=="object"){Xc(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=Jc(""+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"&&zt(r,i,"name",y.name,y,null),zt(r,i,"formEncType",y.formEncType,y,null),zt(r,i,"formMethod",y.formMethod,y,null),zt(r,i,"formTarget",y.formTarget,y,null)):(zt(r,i,"encType",y.encType,y,null),zt(r,i,"method",y.method,y,null),zt(r,i,"target",y.target,y,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(u);break}d=Jc(""+d),r.setAttribute(u,d);break;case"onClick":d!=null&&(r.onclick=Fa);break;case"onScroll":d!=null&&ct("scroll",r);break;case"onScrollEnd":d!=null&&ct("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=Jc(""+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":ct("beforetoggle",r),ct("toggle",r),Yc(r,"popover",d);break;case"xlinkActuate":Ba(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Ba(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Ba(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Ba(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Ba(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Ba(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Ba(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Ba(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Ba(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Yc(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=dA.get(u)||u,Yc(r,u,d))}}function Ap(r,i,u,d,y,v){switch(u){case"style":Yb(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"?dl(r,d):(typeof d=="number"||typeof d=="bigint")&&dl(r,""+d);break;case"onScroll":d!=null&&ct("scroll",r);break;case"onScrollEnd":d!=null&&ct("scrollend",r);break;case"onClick":d!=null&&(r.onclick=Fa);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!$n.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[ht]||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,""):Yc(r,u,d)}}}function Gn(r,i,u){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ct("error",r),ct("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:zt(r,i,v,E,u,null)}}y&&zt(r,i,"srcSet",u.srcSet,u,null),d&&zt(r,i,"src",u.src,u,null);return;case"input":ct("invalid",r);var A=v=E=y=null,H=null,re=null;for(d in u)if(u.hasOwnProperty(d)){var ce=u[d];if(ce!=null)switch(d){case"name":y=ce;break;case"type":E=ce;break;case"checked":H=ce;break;case"defaultChecked":re=ce;break;case"value":v=ce;break;case"defaultValue":A=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(a(137,i));break;default:zt(r,i,d,ce,u,null)}}Gb(r,v,A,H,re,E,y,!1);return;case"select":ct("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:zt(r,i,y,A,u,null)}i=v,u=E,r.multiple=!!d,i!=null?cl(r,!!d,i,!1):u!=null&&cl(r,!!d,u,!0);return;case"textarea":ct("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:zt(r,i,E,A,u,null)}Qb(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:zt(r,i,H,d,u,null)}return;case"dialog":ct("beforetoggle",r),ct("toggle",r),ct("cancel",r),ct("close",r);break;case"iframe":case"object":ct("load",r);break;case"video":case"audio":for(d=0;d<Eu.length;d++)ct(Eu[d],r);break;case"image":ct("error",r),ct("load",r);break;case"details":ct("toggle",r);break;case"embed":case"source":case"link":ct("error",r),ct("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(re in u)if(u.hasOwnProperty(re)&&(d=u[re],d!=null))switch(re){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:zt(r,i,re,d,u,null)}return;default:if(qh(i)){for(ce in u)u.hasOwnProperty(ce)&&(d=u[ce],d!==void 0&&Ap(r,i,ce,d,u,void 0));return}}for(A in u)u.hasOwnProperty(A)&&(d=u[A],d!=null&&zt(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,re=null,ce=null;for(oe in u){var he=u[oe];if(u.hasOwnProperty(oe)&&he!=null)switch(oe){case"checked":break;case"value":break;case"defaultValue":H=he;default:d.hasOwnProperty(oe)||zt(r,i,oe,null,d,he)}}for(var se in d){var oe=d[se];if(he=u[se],d.hasOwnProperty(se)&&(oe!=null||he!=null))switch(se){case"type":v=oe;break;case"name":y=oe;break;case"checked":re=oe;break;case"defaultChecked":ce=oe;break;case"value":E=oe;break;case"defaultValue":A=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(a(137,i));break;default:oe!==he&&zt(r,i,se,oe,d,he)}}$h(r,E,A,H,re,ce,v,y);return;case"select":oe=E=A=se=null;for(v in u)if(H=u[v],u.hasOwnProperty(v)&&H!=null)switch(v){case"value":break;case"multiple":oe=H;default:d.hasOwnProperty(v)||zt(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":se=v;break;case"defaultValue":A=v;break;case"multiple":E=v;default:v!==H&&zt(r,i,y,v,d,H)}i=A,u=E,d=oe,se!=null?cl(r,!!u,se,!1):!!d!=!!u&&(i!=null?cl(r,!!u,i,!0):cl(r,!!u,u?[]:"",!1));return;case"textarea":oe=se=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:zt(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":se=y;break;case"defaultValue":oe=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(a(91));break;default:y!==v&&zt(r,i,E,y,d,v)}Vb(r,se,oe);return;case"option":for(var Ae in u)if(se=u[Ae],u.hasOwnProperty(Ae)&&se!=null&&!d.hasOwnProperty(Ae))switch(Ae){case"selected":r.selected=!1;break;default:zt(r,i,Ae,null,d,se)}for(H in d)if(se=d[H],oe=u[H],d.hasOwnProperty(H)&&se!==oe&&(se!=null||oe!=null))switch(H){case"selected":r.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:zt(r,i,H,se,d,oe)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ve in u)se=u[Ve],u.hasOwnProperty(Ve)&&se!=null&&!d.hasOwnProperty(Ve)&&zt(r,i,Ve,null,d,se);for(re in d)if(se=d[re],oe=u[re],d.hasOwnProperty(re)&&se!==oe&&(se!=null||oe!=null))switch(re){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(a(137,i));break;default:zt(r,i,re,se,d,oe)}return;default:if(qh(i)){for(var Dt in u)se=u[Dt],u.hasOwnProperty(Dt)&&se!==void 0&&!d.hasOwnProperty(Dt)&&Ap(r,i,Dt,void 0,d,se);for(ce in d)se=d[ce],oe=u[ce],!d.hasOwnProperty(ce)||se===oe||se===void 0&&oe===void 0||Ap(r,i,ce,se,d,oe);return}}for(var X in u)se=u[X],u.hasOwnProperty(X)&&se!=null&&!d.hasOwnProperty(X)&&zt(r,i,X,null,d,se);for(he in d)se=d[he],oe=u[he],!d.hasOwnProperty(he)||se===oe||se==null&&oe==null||zt(r,i,he,se,d,oe)}function XS(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function U2(){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&&XS(E)){for(E=0,A=y.responseEnd,d+=1;d<u.length;d++){var H=u[d],re=H.startTime;if(re>A)break;var ce=H.transferSize,he=H.initiatorType;ce&&XS(he)&&(H=H.responseEnd,E+=ce*(H<A?1:(A-re)/(H-re)))}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 Rp=null,Op=null;function Qd(r){return r.nodeType===9?r:r.ownerDocument}function WS(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 JS(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 Mp(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 zp=null;function B2(){var r=window.event;return r&&r.type==="popstate"?r===zp?!1:(zp=r,!0):(zp=null,!1)}var ew=typeof setTimeout=="function"?setTimeout:void 0,F2=typeof clearTimeout=="function"?clearTimeout:void 0,tw=typeof Promise=="function"?Promise:void 0,$2=typeof queueMicrotask=="function"?queueMicrotask:typeof tw<"u"?function(r){return tw.resolve(null).then(r).catch(H2)}:ew;function H2(r){setTimeout(function(){throw r})}function Hi(r){return r==="head"}function nw(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),$l(i);return}d--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")d++;else if(u==="html")Nu(r.ownerDocument.documentElement);else if(u==="head"){u=r.ownerDocument.head,Nu(u);for(var v=u.firstChild;v;){var E=v.nextSibling,A=v.nodeName;v[Ei]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&v.rel.toLowerCase()==="stylesheet"||u.removeChild(v),v=E}}else u==="body"&&Nu(r.ownerDocument.body);u=y}while(u);$l(i)}function rw(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 Dp(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":Dp(u),Ue(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}r.removeChild(u)}}function q2(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[Ei])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=ta(r.nextSibling),r===null)break}return null}function Z2(r,i,u){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!u||(r=ta(r.nextSibling),r===null))return null;return r}function aw(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=ta(r.nextSibling),r===null))return null;return r}function Ip(r){return r.data==="$?"||r.data==="$~"}function Lp(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function G2(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 ta(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 Pp=null;function iw(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var u=r.data;if(u==="/$"||u==="/&"){if(i===0)return ta(r.nextSibling);i--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||i++}r=r.nextSibling}return null}function sw(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 lw(r,i,u){switch(i=Qd(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 Nu(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);Ue(r)}var na=new Map,ow=new Set;function Kd(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var ri=le.d;le.d={f:V2,r:Q2,D:K2,C:Y2,L:X2,m:W2,X:eR,S:J2,M:tR};function V2(){var r=ri.f(),i=Bd();return r||i}function Q2(r){var i=pe(r);i!==null&&i.tag===5&&i.type==="form"?E0(i):ri.r(r)}var Ul=typeof document>"u"?null:document;function uw(r,i,u){var d=Ul;if(d&&typeof i=="string"&&i){var y=Qr(i);y='link[rel="'+r+'"][href="'+y+'"]',typeof u=="string"&&(y+='[crossorigin="'+u+'"]'),ow.has(y)||(ow.add(y),r={rel:r,crossOrigin:u,href:i},d.querySelector(y)===null&&(i=d.createElement("link"),Gn(i,"link",r),vt(i),d.head.appendChild(i)))}}function K2(r){ri.D(r),uw("dns-prefetch",r,null)}function Y2(r,i){ri.C(r,i),uw("preconnect",r,i)}function X2(r,i,u){ri.L(r,i,u);var d=Ul;if(d&&r&&i){var y='link[rel="preload"][as="'+Qr(i)+'"]';i==="image"&&u&&u.imageSrcSet?(y+='[imagesrcset="'+Qr(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(y+='[imagesizes="'+Qr(u.imageSizes)+'"]')):y+='[href="'+Qr(r)+'"]';var v=y;switch(i){case"style":v=Bl(r);break;case"script":v=Fl(r)}na.has(v)||(r=g({rel:"preload",href:i==="image"&&u&&u.imageSrcSet?void 0:r,as:i},u),na.set(v,r),d.querySelector(y)!==null||i==="style"&&d.querySelector(_u(v))||i==="script"&&d.querySelector(Tu(v))||(i=d.createElement("link"),Gn(i,"link",r),vt(i),d.head.appendChild(i)))}}function W2(r,i){ri.m(r,i);var u=Ul;if(u&&r){var d=i&&typeof i.as=="string"?i.as:"script",y='link[rel="modulepreload"][as="'+Qr(d)+'"][href="'+Qr(r)+'"]',v=y;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Fl(r)}if(!na.has(v)&&(r=g({rel:"modulepreload",href:r},i),na.set(v,r),u.querySelector(y)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Tu(v)))return}d=u.createElement("link"),Gn(d,"link",r),vt(d),u.head.appendChild(d)}}}function J2(r,i,u){ri.S(r,i,u);var d=Ul;if(d&&r){var y=jt(d).hoistableStyles,v=Bl(r);i=i||"default";var E=y.get(v);if(!E){var A={loading:0,preload:null};if(E=d.querySelector(_u(v)))A.loading=5;else{r=g({rel:"stylesheet",href:r,"data-precedence":i},u),(u=na.get(v))&&Up(r,u);var H=E=d.createElement("link");vt(H),Gn(H,"link",r),H._p=new Promise(function(re,ce){H.onload=re,H.onerror=ce}),H.addEventListener("load",function(){A.loading|=1}),H.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Yd(E,i,d)}E={type:"stylesheet",instance:E,count:1,state:A},y.set(v,E)}}}function eR(r,i){ri.X(r,i);var u=Ul;if(u&&r){var d=jt(u).hoistableScripts,y=Fl(r),v=d.get(y);v||(v=u.querySelector(Tu(y)),v||(r=g({src:r,async:!0},i),(i=na.get(y))&&Bp(r,i),v=u.createElement("script"),vt(v),Gn(v,"link",r),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(y,v))}}function tR(r,i){ri.M(r,i);var u=Ul;if(u&&r){var d=jt(u).hoistableScripts,y=Fl(r),v=d.get(y);v||(v=u.querySelector(Tu(y)),v||(r=g({src:r,async:!0,type:"module"},i),(i=na.get(y))&&Bp(r,i),v=u.createElement("script"),vt(v),Gn(v,"link",r),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(y,v))}}function cw(r,i,u,d){var y=(y=ae.current)?Kd(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=Bl(u.href),u=jt(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=Bl(u.href);var v=jt(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(_u(r)))&&!v._p&&(E.instance=v,E.state.loading=5),na.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},na.set(r,u),v||nR(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=Fl(u),u=jt(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 Bl(r){return'href="'+Qr(r)+'"'}function _u(r){return'link[rel="stylesheet"]['+r+"]"}function dw(r){return g({},r,{"data-precedence":r.precedence,precedence:null})}function nR(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}),Gn(i,"link",u),vt(i),r.head.appendChild(i))}function Fl(r){return'[src="'+Qr(r)+'"]'}function Tu(r){return"script[async]"+r}function fw(r,i,u){if(i.count++,i.instance===null)switch(i.type){case"style":var d=r.querySelector('style[data-href~="'+Qr(u.href)+'"]');if(d)return i.instance=d,vt(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"),vt(d),Gn(d,"style",y),Yd(d,u.precedence,r),i.instance=d;case"stylesheet":y=Bl(u.href);var v=r.querySelector(_u(y));if(v)return i.state.loading|=4,i.instance=v,vt(v),v;d=dw(u),(y=na.get(y))&&Up(d,y),v=(r.ownerDocument||r).createElement("link"),vt(v);var E=v;return E._p=new Promise(function(A,H){E.onload=A,E.onerror=H}),Gn(v,"link",d),i.state.loading|=4,Yd(v,u.precedence,r),i.instance=v;case"script":return v=Fl(u.src),(y=r.querySelector(Tu(v)))?(i.instance=y,vt(y),y):(d=u,(y=na.get(v))&&(d=g({},u),Bp(d,y)),r=r.ownerDocument||r,y=r.createElement("script"),vt(y),Gn(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,Yd(d,u.precedence,r));return i.instance}function Yd(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 Up(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function Bp(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var Xd=null;function hw(r,i,u){if(Xd===null){var d=new Map,y=Xd=new Map;y.set(u,d)}else y=Xd,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[Ei]||v[Ge]||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 mw(r,i,u){r=r.ownerDocument||r,r.head.insertBefore(u,i==="title"?r.querySelector("head > title"):null)}function rR(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 pw(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function aR(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=Bl(d.href),v=i.querySelector(_u(y));if(v){i=v._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=Wd.bind(r),i.then(r,r)),u.state.loading|=4,u.instance=v,vt(v);return}v=i.ownerDocument||i,d=dw(d),(y=na.get(y))&&Up(d,y),v=v.createElement("link"),vt(v);var E=v;E._p=new Promise(function(A,H){E.onload=A,E.onerror=H}),Gn(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=Wd.bind(r),i.addEventListener("load",u),i.addEventListener("error",u))}}var Fp=0;function iR(r,i){return r.stylesheets&&r.count===0&&ef(r,r.stylesheets),0<r.count||0<r.imgCount?function(u){var d=setTimeout(function(){if(r.stylesheets&&ef(r,r.stylesheets),r.unsuspend){var v=r.unsuspend;r.unsuspend=null,v()}},6e4+i);0<r.imgBytes&&Fp===0&&(Fp=62500*U2());var y=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&ef(r,r.stylesheets),r.unsuspend)){var v=r.unsuspend;r.unsuspend=null,v()}},(r.imgBytes>Fp?50:800)+i);return r.unsuspend=u,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(y)}}:null}function Wd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ef(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Jd=null;function ef(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Jd=new Map,i.forEach(sR,r),Jd=null,Wd.call(r))}function sR(r,i){if(!(i.state.loading&4)){var u=Jd.get(r);if(u)var d=u.get(null);else{u=new Map,Jd.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=Wd.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 Au={$$typeof:R,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function lR(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=bi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bi(0),this.hiddenUpdates=bi(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 gw(r,i,u,d,y,v,E,A,H,re,ce,he){return r=new lR(r,i,u,E,H,re,ce,he,A),i=1,v===!0&&(i|=24),v=Dr(3,null,null,i),r.current=v,v.stateNode=r,i=xm(),i.refCount++,r.pooledCache=i,i.refCount++,v.memoizedState={element:d,isDehydrated:u,cache:i},jm(v),r}function yw(r){return r?(r=vl,r):vl}function vw(r,i,u,d,y,v){y=yw(y),d.context===null?d.context=y:d.pendingContext=y,d=Oi(i),d.payload={element:u},v=v===void 0?null:v,v!==null&&(d.callback=v),u=Mi(r,d,i),u!==null&&(kr(u,r,i),ou(u,r,i))}function bw(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<i?u:i}}function $p(r,i){bw(r,i),(r=r.alternate)&&bw(r,i)}function xw(r){if(r.tag===13||r.tag===31){var i=Ns(r,67108864);i!==null&&kr(i,r,67108864),$p(r,67108864)}}function Sw(r){if(r.tag===13||r.tag===31){var i=Br();i=zn(i);var u=Ns(r,i);u!==null&&kr(u,r,i),$p(r,i)}}var tf=!0;function oR(r,i,u,d){var y=q.T;q.T=null;var v=le.p;try{le.p=2,Hp(r,i,u,d)}finally{le.p=v,q.T=y}}function uR(r,i,u,d){var y=q.T;q.T=null;var v=le.p;try{le.p=8,Hp(r,i,u,d)}finally{le.p=v,q.T=y}}function Hp(r,i,u,d){if(tf){var y=qp(d);if(y===null)Tp(r,i,d,nf,u),kw(r,d);else if(dR(y,r,i,u,d))d.stopPropagation();else if(kw(r,d),i&4&&-1<cR.indexOf(r)){for(;y!==null;){var v=pe(y);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var E=Bn(v.pendingLanes);if(E!==0){var A=v;for(A.pendingLanes|=2,A.entangledLanes|=2;E;){var H=1<<31-ft(E);A.entanglements[1]|=H,E&=~H}Ta(v),(Nt&6)===0&&(Pd=an()+500,ju(0))}}break;case 31:case 13:A=Ns(v,2),A!==null&&kr(A,v,2),Bd(),$p(v,2)}if(v=qp(d),v===null&&Tp(r,i,d,nf,u),v===y)break;y=v}y!==null&&d.stopPropagation()}else Tp(r,i,d,null,u)}}function qp(r){return r=Gh(r),Zp(r)}var nf=null;function Zp(r){if(nf=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 nf=r,null}function ww(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(ma()){case ue:return 2;case be:return 8;case Be:case Xe:return 32;case yt:return 268435456;default:return 32}default:return 32}}var Gp=!1,qi=null,Zi=null,Gi=null,Ru=new Map,Ou=new Map,Vi=[],cR="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 kw(r,i){switch(r){case"focusin":case"focusout":qi=null;break;case"dragenter":case"dragleave":Zi=null;break;case"mouseover":case"mouseout":Gi=null;break;case"pointerover":case"pointerout":Ru.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ou.delete(i.pointerId)}}function Mu(r,i,u,d,y,v){return r===null||r.nativeEvent!==v?(r={blockedOn:i,domEventName:u,eventSystemFlags:d,nativeEvent:v,targetContainers:[y]},i!==null&&(i=pe(i),i!==null&&xw(i)),r):(r.eventSystemFlags|=d,i=r.targetContainers,y!==null&&i.indexOf(y)===-1&&i.push(y),r)}function dR(r,i,u,d,y){switch(i){case"focusin":return qi=Mu(qi,r,i,u,d,y),!0;case"dragenter":return Zi=Mu(Zi,r,i,u,d,y),!0;case"mouseover":return Gi=Mu(Gi,r,i,u,d,y),!0;case"pointerover":var v=y.pointerId;return Ru.set(v,Mu(Ru.get(v)||null,r,i,u,d,y)),!0;case"gotpointercapture":return v=y.pointerId,Ou.set(v,Mu(Ou.get(v)||null,r,i,u,d,y)),!0}return!1}function jw(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,ji(r.priority,function(){Sw(u)});return}}else if(i===31){if(i=f(u),i!==null){r.blockedOn=i,ji(r.priority,function(){Sw(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 rf(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var u=qp(r.nativeEvent);if(u===null){u=r.nativeEvent;var d=new u.constructor(u.type,u);Zh=d,u.target.dispatchEvent(d),Zh=null}else return i=pe(u),i!==null&&xw(i),r.blockedOn=u,!1;i.shift()}return!0}function Ew(r,i,u){rf(r)&&u.delete(i)}function fR(){Gp=!1,qi!==null&&rf(qi)&&(qi=null),Zi!==null&&rf(Zi)&&(Zi=null),Gi!==null&&rf(Gi)&&(Gi=null),Ru.forEach(Ew),Ou.forEach(Ew)}function af(r,i){r.blockedOn===i&&(r.blockedOn=null,Gp||(Gp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,fR)))}var sf=null;function Cw(r){sf!==r&&(sf=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){sf===r&&(sf=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(Zp(d||u)===null)continue;break}var v=pe(u);v!==null&&(r.splice(i,3),i-=3,qm(v,{pending:!0,data:y,method:u.method,action:d},d,y))}}))}function $l(r){function i(H){return af(H,r)}qi!==null&&af(qi,r),Zi!==null&&af(Zi,r),Gi!==null&&af(Gi,r),Ru.forEach(i),Ou.forEach(i);for(var u=0;u<Vi.length;u++){var d=Vi[u];d.blockedOn===r&&(d.blockedOn=null)}for(;0<Vi.length&&(u=Vi[0],u.blockedOn===null);)jw(u),u.blockedOn===null&&Vi.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[ht]||null;if(typeof v=="function")E||Cw(u);else if(E){var A=null;if(v&&v.hasAttribute("formAction")){if(y=v,E=v[ht]||null)A=E.formAction;else if(Zp(y)!==null)continue}else A=E.action;typeof A=="function"?u[d+1]=A:(u.splice(d,3),d-=3),Cw(u)}}}function Nw(){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 Vp(r){this._internalRoot=r}lf.prototype.render=Vp.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(a(409));var u=i.current,d=Br();vw(u,d,r,i,null,null)},lf.prototype.unmount=Vp.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;vw(r.current,2,null,r,null,null),Bd(),i[Fn]=null}};function lf(r){this._internalRoot=r}lf.prototype.unstable_scheduleHydration=function(r){if(r){var i=ki();r={blockedOn:null,target:r,priority:i};for(var u=0;u<Vi.length&&i!==0&&i<Vi[u].priority;u++);Vi.splice(u,0,r),u===0&&jw(r)}};var _w=t.version;if(_w!=="19.2.4")throw Error(a(527,_w,"19.2.4"));le.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 hR={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var of=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!of.isDisabled&&of.supportsFiber)try{Gt=of.inject(hR),Bt=of}catch{}}return Du.createRoot=function(r,i){if(!s(r))throw Error(a(299));var u=!1,d="",y=D0,v=I0,E=L0;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=gw(r,1,!1,null,null,u,d,null,y,v,E,Nw),r[Fn]=i.current,_p(r),new Vp(i)},Du.hydrateRoot=function(r,i,u){if(!s(r))throw Error(a(299));var d=!1,y="",v=D0,E=I0,A=L0,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=gw(r,1,!0,i,u??null,d,y,H,v,E,A,Nw),i.context=yw(null),u=i.current,d=Br(),d=zn(d),y=Oi(d),y.callback=null,Mi(u,y,d),u=d,i.current.lanes=u,ya(i,u),Ta(i),r[Fn]=i.current,_p(r),new lf(i)},Du.version="19.2.4",Du}var Uw;function jR(){if(Uw)return Xp.exports;Uw=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(),Xp.exports=kR(),Xp.exports}var ER=jR(),rl=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(){}},qs,ts,uo,Ij,CR=(Ij=class extends rl{constructor(){super();Te(this,qs);Te(this,ts);Te(this,uo);ke(this,uo,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){B(this,ts)||this.setEventListener(B(this,uo))}onUnsubscribe(){var t;this.hasListeners()||((t=B(this,ts))==null||t.call(this),ke(this,ts,void 0))}setEventListener(t){var n;ke(this,uo,t),(n=B(this,ts))==null||n.call(this),ke(this,ts,t(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(t){B(this,qs)!==t&&(ke(this,qs,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof B(this,qs)=="boolean"?B(this,qs):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},qs=new WeakMap,ts=new WeakMap,uo=new WeakMap,Ij),fv=new CR,NR={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ns,uv,Lj,_R=(Lj=class{constructor(){Te(this,ns,NR);Te(this,uv,!1)}setTimeoutProvider(e){ke(this,ns,e)}setTimeout(e,t){return B(this,ns).setTimeout(e,t)}clearTimeout(e){B(this,ns).clearTimeout(e)}setInterval(e,t){return B(this,ns).setInterval(e,t)}clearInterval(e){B(this,ns).clearInterval(e)}},ns=new WeakMap,uv=new WeakMap,Lj),$s=new _R;function TR(e){setTimeout(e,0)}var AR=typeof window>"u"||"Deno"in globalThis;function er(){}function RR(e,t){return typeof e=="function"?e(t):e}function Wg(e){return typeof e=="number"&&e>=0&&e!==1/0}function Kj(e,t){return Math.max(e+(t||0)-Date.now(),0)}function fs(e,t){return typeof e=="function"?e(t):e}function sa(e,t){return typeof e=="function"?e(t):e}function Bw(e,t){const{type:n="all",exact:a,fetchStatus:s,predicate:o,queryKey:c,stale:f}=e;if(c){if(a){if(t.queryHash!==hv(c,t.options))return!1}else if(!oc(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 Fw(e,t){const{exact:n,status:a,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Js(t.options.mutationKey)!==Js(o))return!1}else if(!oc(t.options.mutationKey,o))return!1}return!(a&&t.state.status!==a||s&&!s(t))}function hv(e,t){return((t==null?void 0:t.queryKeyHashFn)||Js)(e)}function Js(e){return JSON.stringify(e,(t,n)=>Jg(n)?Object.keys(n).sort().reduce((a,s)=>(a[s]=n[s],a),{}):n)}function oc(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>oc(e[n],t[n])):!1}var OR=Object.prototype.hasOwnProperty;function mv(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=$w(e)&&$w(t);if(!a&&!(Jg(e)&&Jg(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],S=e[g],x=t[g];if(S===x){m[g]=S,(a?p<o:OR.call(e,g))&&h++;continue}if(S===null||x===null||typeof S!="object"||typeof x!="object"){m[g]=x;continue}const j=mv(S,x,n+1);m[g]=j,j===S&&h++}return o===f&&h===o?e:m}function uc(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 $w(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Jg(e){if(!Hw(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Hw(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Hw(e){return Object.prototype.toString.call(e)==="[object Object]"}function MR(e){return new Promise(t=>{$s.setTimeout(t,e)})}function ey(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?mv(e,t):t}function zR(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function DR(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var pv=Symbol();function Yj(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===pv?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function gv(e,t){return typeof e=="function"?e(...t):!!e}function IR(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 cc=(()=>{let e=()=>AR;return{isServer(){return e()},setIsServer(t){e=t}}})();function ty(){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 LR=TR;function PR(){let e=[],t=0,n=f=>{f()},a=f=>{f()},s=LR;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 cn=PR(),co,rs,fo,Pj,UR=(Pj=class extends rl{constructor(){super();Te(this,co,!0);Te(this,rs);Te(this,fo);ke(this,fo,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),a=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",a)}}})}onSubscribe(){B(this,rs)||this.setEventListener(B(this,fo))}onUnsubscribe(){var t;this.hasListeners()||((t=B(this,rs))==null||t.call(this),ke(this,rs,void 0))}setEventListener(t){var n;ke(this,fo,t),(n=B(this,rs))==null||n.call(this),ke(this,rs,t(this.setOnline.bind(this)))}setOnline(t){B(this,co)!==t&&(ke(this,co,t),this.listeners.forEach(a=>{a(t)}))}isOnline(){return B(this,co)}},co=new WeakMap,rs=new WeakMap,fo=new WeakMap,Pj),Ff=new UR;function BR(e){return Math.min(1e3*2**e,3e4)}function Xj(e){return(e??"online")==="online"?Ff.isOnline():!0}var ny=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Wj(e){let t=!1,n=0,a;const s=ty(),o=()=>s.status!=="pending",c=k=>{var w;if(!o()){const C=new ny(k);S(C),(w=e.onCancel)==null||w.call(e,C)}},f=()=>{t=!0},m=()=>{t=!1},h=()=>fv.isFocused()&&(e.networkMode==="always"||Ff.isOnline())&&e.canRun(),p=()=>Xj(e.networkMode)&&e.canRun(),g=k=>{o()||(a==null||a(),s.resolve(k))},S=k=>{o()||(a==null||a(),s.reject(k))},x=()=>new Promise(k=>{var w;a=C=>{(o()||h())&&k(C)},(w=e.onPause)==null||w.call(e)}).then(()=>{var k;a=void 0,o()||(k=e.onContinue)==null||k.call(e)}),j=()=>{if(o())return;let k;const w=n===0?e.initialPromise:void 0;try{k=w??e.fn()}catch(C){k=Promise.reject(C)}Promise.resolve(k).then(g).catch(C=>{var O;if(o())return;const _=e.retry??(cc.isServer()?0:3),R=e.retryDelay??BR,z=typeof R=="function"?R(n,C):R,I=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,C);if(t||!I){S(C);return}n++,(O=e.onFail)==null||O.call(e,n,C),MR(z).then(()=>h()?void 0:x()).then(()=>{t?S(C):j()})})};return{promise:s,status:()=>s.status,cancel:c,continue:()=>(a==null||a(),s),cancelRetry:f,continueRetry:m,canStart:p,start:()=>(p()?j():x().then(j),s)}}var Zs,Uj,Jj=(Uj=class{constructor(){Te(this,Zs)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Wg(this.gcTime)&&ke(this,Zs,$s.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(cc.isServer()?1/0:300*1e3))}clearGcTimeout(){B(this,Zs)&&($s.clearTimeout(B(this,Zs)),ke(this,Zs,void 0))}},Zs=new WeakMap,Uj),Gs,ho,aa,Vs,Ln,Cc,Qs,Hr,eE,ii,Bj,FR=(Bj=class extends Jj{constructor(t){super();Te(this,Hr);Te(this,Gs);Te(this,ho);Te(this,aa);Te(this,Vs);Te(this,Ln);Te(this,Cc);Te(this,Qs);ke(this,Qs,!1),ke(this,Cc,t.defaultOptions),this.setOptions(t.options),this.observers=[],ke(this,Vs,t.client),ke(this,aa,B(this,Vs).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ke(this,Gs,Zw(this.options)),this.state=t.state??B(this,Gs),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=B(this,Ln))==null?void 0:t.promise}setOptions(t){if(this.options={...B(this,Cc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Zw(this.options);n.data!==void 0&&(this.setState(qw(n.data,n.dataUpdatedAt)),ke(this,Gs,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&B(this,aa).remove(this)}setData(t,n){const a=ey(this.state.data,t,this.options);return Qe(this,Hr,ii).call(this,{data:a,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),a}setState(t,n){Qe(this,Hr,ii).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var a,s;const n=(a=B(this,Ln))==null?void 0:a.promise;return(s=B(this,Ln))==null||s.cancel(t),n?n.then(er).catch(er):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return B(this,Gs)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>sa(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===pv||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>fs(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:!Kj(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(a=>a.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=B(this,Ln))==null||n.continue()}onOnline(){var n;const t=this.observers.find(a=>a.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=B(this,Ln))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),B(this,aa).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(B(this,Ln)&&(B(this,Qs)||Qe(this,Hr,eE).call(this)?B(this,Ln).cancel({revert:!0}):B(this,Ln).cancelRetry()),this.scheduleGc()),B(this,aa).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Qe(this,Hr,ii).call(this,{type:"invalidate"})}async fetch(t,n){var m,h,p,g,S,x,j,k,w,C,_,R;if(this.state.fetchStatus!=="idle"&&((m=B(this,Ln))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(B(this,Ln))return B(this,Ln).continueRetry(),B(this,Ln).promise}if(t&&this.setOptions(t),!this.options.queryFn){const z=this.observers.find(I=>I.options.queryFn);z&&this.setOptions(z.options)}const a=new AbortController,s=z=>{Object.defineProperty(z,"signal",{enumerable:!0,get:()=>(ke(this,Qs,!0),a.signal)})},o=()=>{const z=Yj(this.options,n),O=(()=>{const F={client:B(this,Vs),queryKey:this.queryKey,meta:this.meta};return s(F),F})();return ke(this,Qs,!1),this.options.persister?this.options.persister(z,O,this):z(O)},f=(()=>{const z={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:B(this,Vs),state:this.state,fetchFn:o};return s(z),z})();(h=this.options.behavior)==null||h.onFetch(f,this),ke(this,ho,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=f.fetchOptions)==null?void 0:p.meta))&&Qe(this,Hr,ii).call(this,{type:"fetch",meta:(g=f.fetchOptions)==null?void 0:g.meta}),ke(this,Ln,Wj({initialPromise:n==null?void 0:n.initialPromise,fn:f.fetchFn,onCancel:z=>{z instanceof ny&&z.revert&&this.setState({...B(this,ho),fetchStatus:"idle"}),a.abort()},onFail:(z,I)=>{Qe(this,Hr,ii).call(this,{type:"failed",failureCount:z,error:I})},onPause:()=>{Qe(this,Hr,ii).call(this,{type:"pause"})},onContinue:()=>{Qe(this,Hr,ii).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0}));try{const z=await B(this,Ln).start();if(z===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(z),(x=(S=B(this,aa).config).onSuccess)==null||x.call(S,z,this),(k=(j=B(this,aa).config).onSettled)==null||k.call(j,z,this.state.error,this),z}catch(z){if(z instanceof ny){if(z.silent)return B(this,Ln).promise;if(z.revert){if(this.state.data===void 0)throw z;return this.state.data}}throw Qe(this,Hr,ii).call(this,{type:"error",error:z}),(C=(w=B(this,aa).config).onError)==null||C.call(w,z,this),(R=(_=B(this,aa).config).onSettled)==null||R.call(_,this.state.data,z,this),z}finally{this.scheduleGc()}}},Gs=new WeakMap,ho=new WeakMap,aa=new WeakMap,Vs=new WeakMap,Ln=new WeakMap,Cc=new WeakMap,Qs=new WeakMap,Hr=new WeakSet,eE=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ii=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,...tE(a.data,this.options),fetchMeta:t.meta??null};case"success":const s={...a,...qw(t.data,t.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ke(this,ho,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),cn.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),B(this,aa).notify({query:this,type:"updated",action:t})})},Bj);function tE(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Xj(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function qw(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Zw(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 Cr,xt,Nc,ur,Ks,mo,si,as,_c,po,go,Ys,Xs,is,yo,Tt,Ju,ry,ay,iy,sy,ly,oy,uy,nE,Fj,yv=(Fj=class extends rl{constructor(t,n){super();Te(this,Tt);Te(this,Cr);Te(this,xt);Te(this,Nc);Te(this,ur);Te(this,Ks);Te(this,mo);Te(this,si);Te(this,as);Te(this,_c);Te(this,po);Te(this,go);Te(this,Ys);Te(this,Xs);Te(this,is);Te(this,yo,new Set);this.options=n,ke(this,Cr,t),ke(this,as,null),ke(this,si,ty()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(B(this,xt).addObserver(this),Gw(B(this,xt),this.options)?Qe(this,Tt,Ju).call(this):this.updateResult(),Qe(this,Tt,sy).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return cy(B(this,xt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return cy(B(this,xt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Qe(this,Tt,ly).call(this),Qe(this,Tt,oy).call(this),B(this,xt).removeObserver(this)}setOptions(t){const n=this.options,a=B(this,xt);if(this.options=B(this,Cr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof sa(this.options.enabled,B(this,xt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Qe(this,Tt,uy).call(this),B(this,xt).setOptions(this.options),n._defaulted&&!uc(this.options,n)&&B(this,Cr).getQueryCache().notify({type:"observerOptionsUpdated",query:B(this,xt),observer:this});const s=this.hasListeners();s&&Vw(B(this,xt),a,this.options,n)&&Qe(this,Tt,Ju).call(this),this.updateResult(),s&&(B(this,xt)!==a||sa(this.options.enabled,B(this,xt))!==sa(n.enabled,B(this,xt))||fs(this.options.staleTime,B(this,xt))!==fs(n.staleTime,B(this,xt)))&&Qe(this,Tt,ry).call(this);const o=Qe(this,Tt,ay).call(this);s&&(B(this,xt)!==a||sa(this.options.enabled,B(this,xt))!==sa(n.enabled,B(this,xt))||o!==B(this,is))&&Qe(this,Tt,iy).call(this,o)}getOptimisticResult(t){const n=B(this,Cr).getQueryCache().build(B(this,Cr),t),a=this.createResult(n,t);return HR(this,a)&&(ke(this,ur,a),ke(this,mo,this.options),ke(this,Ks,B(this,xt).state)),a}getCurrentResult(){return B(this,ur)}trackResult(t,n){return new Proxy(t,{get:(a,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&B(this,si).status==="pending"&&B(this,si).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,s))})}trackProp(t){B(this,yo).add(t)}getCurrentQuery(){return B(this,xt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=B(this,Cr).defaultQueryOptions(t),a=B(this,Cr).getQueryCache().build(B(this,Cr),n);return a.fetch().then(()=>this.createResult(a,n))}fetch(t){return Qe(this,Tt,Ju).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),B(this,ur)))}createResult(t,n){var W;const a=B(this,xt),s=this.options,o=B(this,ur),c=B(this,Ks),f=B(this,mo),h=t!==a?t.state:B(this,Nc),{state:p}=t;let g={...p},S=!1,x;if(n._optimisticResults){const L=this.hasListeners(),V=!L&&Gw(t,n),Y=L&&Vw(t,a,n,s);(V||Y)&&(g={...g,...tE(p.data,t.options)}),n._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:j,errorUpdatedAt:k,status:w}=g;x=g.data;let C=!1;if(n.placeholderData!==void 0&&x===void 0&&w==="pending"){let L;o!=null&&o.isPlaceholderData&&n.placeholderData===(f==null?void 0:f.placeholderData)?(L=o.data,C=!0):L=typeof n.placeholderData=="function"?n.placeholderData((W=B(this,go))==null?void 0:W.state.data,B(this,go)):n.placeholderData,L!==void 0&&(w="success",x=ey(o==null?void 0:o.data,L,n),S=!0)}if(n.select&&x!==void 0&&!C)if(o&&x===(c==null?void 0:c.data)&&n.select===B(this,_c))x=B(this,po);else try{ke(this,_c,n.select),x=n.select(x),x=ey(o==null?void 0:o.data,x,n),ke(this,po,x),ke(this,as,null)}catch(L){ke(this,as,L)}B(this,as)&&(j=B(this,as),x=B(this,po),k=Date.now(),w="error");const _=g.fetchStatus==="fetching",R=w==="pending",z=w==="error",I=R&&_,O=x!==void 0,D={status:w,fetchStatus:g.fetchStatus,isPending:R,isSuccess:w==="success",isError:z,isInitialLoading:I,isLoading:I,data:x,dataUpdatedAt:g.dataUpdatedAt,error:j,errorUpdatedAt:k,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>h.dataUpdateCount||g.errorUpdateCount>h.errorUpdateCount,isFetching:_,isRefetching:_&&!R,isLoadingError:z&&!O,isPaused:g.fetchStatus==="paused",isPlaceholderData:S,isRefetchError:z&&O,isStale:vv(t,n),refetch:this.refetch,promise:B(this,si),isEnabled:sa(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const L=D.data!==void 0,V=D.status==="error"&&!L,Y=J=>{V?J.reject(D.error):L&&J.resolve(D.data)},me=()=>{const J=ke(this,si,D.promise=ty());Y(J)},te=B(this,si);switch(te.status){case"pending":t.queryHash===a.queryHash&&Y(te);break;case"fulfilled":(V||D.data!==te.value)&&me();break;case"rejected":(!V||D.error!==te.reason)&&me();break}}return D}updateResult(){const t=B(this,ur),n=this.createResult(B(this,xt),this.options);if(ke(this,Ks,B(this,xt).state),ke(this,mo,this.options),B(this,Ks).data!==void 0&&ke(this,go,B(this,xt)),uc(n,t))return;ke(this,ur,n);const a=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!B(this,yo).size)return!0;const c=new Set(o??B(this,yo));return this.options.throwOnError&&c.add("error"),Object.keys(B(this,ur)).some(f=>{const m=f;return B(this,ur)[m]!==t[m]&&c.has(m)})};Qe(this,Tt,nE).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Qe(this,Tt,sy).call(this)}},Cr=new WeakMap,xt=new WeakMap,Nc=new WeakMap,ur=new WeakMap,Ks=new WeakMap,mo=new WeakMap,si=new WeakMap,as=new WeakMap,_c=new WeakMap,po=new WeakMap,go=new WeakMap,Ys=new WeakMap,Xs=new WeakMap,is=new WeakMap,yo=new WeakMap,Tt=new WeakSet,Ju=function(t){Qe(this,Tt,uy).call(this);let n=B(this,xt).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(er)),n},ry=function(){Qe(this,Tt,ly).call(this);const t=fs(this.options.staleTime,B(this,xt));if(cc.isServer()||B(this,ur).isStale||!Wg(t))return;const a=Kj(B(this,ur).dataUpdatedAt,t)+1;ke(this,Ys,$s.setTimeout(()=>{B(this,ur).isStale||this.updateResult()},a))},ay=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(B(this,xt)):this.options.refetchInterval)??!1},iy=function(t){Qe(this,Tt,oy).call(this),ke(this,is,t),!(cc.isServer()||sa(this.options.enabled,B(this,xt))===!1||!Wg(B(this,is))||B(this,is)===0)&&ke(this,Xs,$s.setInterval(()=>{(this.options.refetchIntervalInBackground||fv.isFocused())&&Qe(this,Tt,Ju).call(this)},B(this,is)))},sy=function(){Qe(this,Tt,ry).call(this),Qe(this,Tt,iy).call(this,Qe(this,Tt,ay).call(this))},ly=function(){B(this,Ys)&&($s.clearTimeout(B(this,Ys)),ke(this,Ys,void 0))},oy=function(){B(this,Xs)&&($s.clearInterval(B(this,Xs)),ke(this,Xs,void 0))},uy=function(){const t=B(this,Cr).getQueryCache().build(B(this,Cr),this.options);if(t===B(this,xt))return;const n=B(this,xt);ke(this,xt,t),ke(this,Nc,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},nE=function(t){cn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(B(this,ur))}),B(this,Cr).getQueryCache().notify({query:B(this,xt),type:"observerResultsUpdated"})})},Fj);function $R(e,t){return sa(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Gw(e,t){return $R(e,t)||e.state.data!==void 0&&cy(e,t,t.refetchOnMount)}function cy(e,t,n){if(sa(t.enabled,e)!==!1&&fs(t.staleTime,e)!=="static"){const a=typeof n=="function"?n(e):n;return a==="always"||a!==!1&&vv(e,t)}return!1}function Vw(e,t,n,a){return(e!==t||sa(a.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&vv(e,n)}function vv(e,t){return sa(t.enabled,e)!==!1&&e.isStaleByTime(fs(t.staleTime,e))}function HR(e,t){return!uc(e.getCurrentResult(),t)}function Qw(e){return{onFetch:(t,n)=>{var p,g,S,x,j;const a=t.options,s=(S=(g=(p=t.fetchOptions)==null?void 0:p.meta)==null?void 0:g.fetchMore)==null?void 0:S.direction,o=((x=t.state.data)==null?void 0:x.pages)||[],c=((j=t.state.data)==null?void 0:j.pageParams)||[];let f={pages:[],pageParams:[]},m=0;const h=async()=>{let k=!1;const w=R=>{IR(R,()=>t.signal,()=>k=!0)},C=Yj(t.options,t.fetchOptions),_=async(R,z,I)=>{if(k)return Promise.reject();if(z==null&&R.pages.length)return Promise.resolve(R);const F=(()=>{const V={client:t.client,queryKey:t.queryKey,pageParam:z,direction:I?"backward":"forward",meta:t.options.meta};return w(V),V})(),D=await C(F),{maxPages:W}=t.options,L=I?DR:zR;return{pages:L(R.pages,D,W),pageParams:L(R.pageParams,z,W)}};if(s&&o.length){const R=s==="backward",z=R?qR:Kw,I={pages:o,pageParams:c},O=z(a,I);f=await _(I,O,R)}else{const R=e??o.length;do{const z=m===0?c[0]??a.initialPageParam:Kw(a,f);if(m>0&&z==null)break;f=await _(f,z),m++}while(m<R)}return f};t.options.persister?t.fetchFn=()=>{var k,w;return(w=(k=t.options).persister)==null?void 0:w.call(k,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=h}}}function Kw(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 qR(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 Tc,Ra,Wn,Ws,Oa,Wi,$j,ZR=($j=class extends Jj{constructor(t){super();Te(this,Oa);Te(this,Tc);Te(this,Ra);Te(this,Wn);Te(this,Ws);ke(this,Tc,t.client),this.mutationId=t.mutationId,ke(this,Wn,t.mutationCache),ke(this,Ra,[]),this.state=t.state||rE(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){B(this,Ra).includes(t)||(B(this,Ra).push(t),this.clearGcTimeout(),B(this,Wn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ke(this,Ra,B(this,Ra).filter(n=>n!==t)),this.scheduleGc(),B(this,Wn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){B(this,Ra).length||(this.state.status==="pending"?this.scheduleGc():B(this,Wn).remove(this))}continue(){var t;return((t=B(this,Ws))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var c,f,m,h,p,g,S,x,j,k,w,C,_,R,z,I,O,F;const n=()=>{Qe(this,Oa,Wi).call(this,{type:"continue"})},a={client:B(this,Tc),meta:this.options.meta,mutationKey:this.options.mutationKey};ke(this,Ws,Wj({fn:()=>this.options.mutationFn?this.options.mutationFn(t,a):Promise.reject(new Error("No mutationFn found")),onFail:(D,W)=>{Qe(this,Oa,Wi).call(this,{type:"failed",failureCount:D,error:W})},onPause:()=>{Qe(this,Oa,Wi).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>B(this,Wn).canRun(this)}));const s=this.state.status==="pending",o=!B(this,Ws).canStart();try{if(s)n();else{Qe(this,Oa,Wi).call(this,{type:"pending",variables:t,isPaused:o}),B(this,Wn).config.onMutate&&await B(this,Wn).config.onMutate(t,this,a);const W=await((f=(c=this.options).onMutate)==null?void 0:f.call(c,t,a));W!==this.state.context&&Qe(this,Oa,Wi).call(this,{type:"pending",context:W,variables:t,isPaused:o})}const D=await B(this,Ws).start();return await((h=(m=B(this,Wn).config).onSuccess)==null?void 0:h.call(m,D,t,this.state.context,this,a)),await((g=(p=this.options).onSuccess)==null?void 0:g.call(p,D,t,this.state.context,a)),await((x=(S=B(this,Wn).config).onSettled)==null?void 0:x.call(S,D,null,this.state.variables,this.state.context,this,a)),await((k=(j=this.options).onSettled)==null?void 0:k.call(j,D,null,t,this.state.context,a)),Qe(this,Oa,Wi).call(this,{type:"success",data:D}),D}catch(D){try{await((C=(w=B(this,Wn).config).onError)==null?void 0:C.call(w,D,t,this.state.context,this,a))}catch(W){Promise.reject(W)}try{await((R=(_=this.options).onError)==null?void 0:R.call(_,D,t,this.state.context,a))}catch(W){Promise.reject(W)}try{await((I=(z=B(this,Wn).config).onSettled)==null?void 0:I.call(z,void 0,D,this.state.variables,this.state.context,this,a))}catch(W){Promise.reject(W)}try{await((F=(O=this.options).onSettled)==null?void 0:F.call(O,void 0,D,t,this.state.context,a))}catch(W){Promise.reject(W)}throw Qe(this,Oa,Wi).call(this,{type:"error",error:D}),D}finally{B(this,Wn).runNext(this)}}},Tc=new WeakMap,Ra=new WeakMap,Wn=new WeakMap,Ws=new WeakMap,Oa=new WeakSet,Wi=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),cn.batch(()=>{B(this,Ra).forEach(a=>{a.onMutationUpdate(t)}),B(this,Wn).notify({mutation:this,type:"updated",action:t})})},$j);function rE(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var li,Sa,Ac,Hj,GR=(Hj=class extends rl{constructor(t={}){super();Te(this,li);Te(this,Sa);Te(this,Ac);this.config=t,ke(this,li,new Set),ke(this,Sa,new Map),ke(this,Ac,0)}build(t,n,a){const s=new ZR({client:t,mutationCache:this,mutationId:++uf(this,Ac)._,options:t.defaultMutationOptions(n),state:a});return this.add(s),s}add(t){B(this,li).add(t);const n=cf(t);if(typeof n=="string"){const a=B(this,Sa).get(n);a?a.push(t):B(this,Sa).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(B(this,li).delete(t)){const n=cf(t);if(typeof n=="string"){const a=B(this,Sa).get(n);if(a)if(a.length>1){const s=a.indexOf(t);s!==-1&&a.splice(s,1)}else a[0]===t&&B(this,Sa).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=cf(t);if(typeof n=="string"){const a=B(this,Sa).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=cf(t);if(typeof n=="string"){const s=(a=B(this,Sa).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(){cn.batch(()=>{B(this,li).forEach(t=>{this.notify({type:"removed",mutation:t})}),B(this,li).clear(),B(this,Sa).clear()})}getAll(){return Array.from(B(this,li))}find(t){const n={exact:!0,...t};return this.getAll().find(a=>Fw(n,a))}findAll(t={}){return this.getAll().filter(n=>Fw(t,n))}notify(t){cn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return cn.batch(()=>Promise.all(t.map(n=>n.continue().catch(er))))}},li=new WeakMap,Sa=new WeakMap,Ac=new WeakMap,Hj);function cf(e){var t;return(t=e.options.scope)==null?void 0:t.id}var oi,ss,Nr,ui,fi,Of,dy,qj,VR=(qj=class extends rl{constructor(n,a){super();Te(this,fi);Te(this,oi);Te(this,ss);Te(this,Nr);Te(this,ui);ke(this,oi,n),this.setOptions(a),this.bindMethods(),Qe(this,fi,Of).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const a=this.options;this.options=B(this,oi).defaultMutationOptions(n),uc(this.options,a)||B(this,oi).getMutationCache().notify({type:"observerOptionsUpdated",mutation:B(this,Nr),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&Js(a.mutationKey)!==Js(this.options.mutationKey)?this.reset():((s=B(this,Nr))==null?void 0:s.state.status)==="pending"&&B(this,Nr).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=B(this,Nr))==null||n.removeObserver(this)}onMutationUpdate(n){Qe(this,fi,Of).call(this),Qe(this,fi,dy).call(this,n)}getCurrentResult(){return B(this,ss)}reset(){var n;(n=B(this,Nr))==null||n.removeObserver(this),ke(this,Nr,void 0),Qe(this,fi,Of).call(this),Qe(this,fi,dy).call(this)}mutate(n,a){var s;return ke(this,ui,a),(s=B(this,Nr))==null||s.removeObserver(this),ke(this,Nr,B(this,oi).getMutationCache().build(B(this,oi),this.options)),B(this,Nr).addObserver(this),B(this,Nr).execute(n)}},oi=new WeakMap,ss=new WeakMap,Nr=new WeakMap,ui=new WeakMap,fi=new WeakSet,Of=function(){var a;const n=((a=B(this,Nr))==null?void 0:a.state)??rE();ke(this,ss,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},dy=function(n){cn.batch(()=>{var a,s,o,c,f,m,h,p;if(B(this,ui)&&this.hasListeners()){const g=B(this,ss).variables,S=B(this,ss).context,x={client:B(this,oi),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(a=B(this,ui)).onSuccess)==null||s.call(a,n.data,g,S,x)}catch(j){Promise.reject(j)}try{(c=(o=B(this,ui)).onSettled)==null||c.call(o,n.data,null,g,S,x)}catch(j){Promise.reject(j)}}else if((n==null?void 0:n.type)==="error"){try{(m=(f=B(this,ui)).onError)==null||m.call(f,n.error,g,S,x)}catch(j){Promise.reject(j)}try{(p=(h=B(this,ui)).onSettled)==null||p.call(h,void 0,n.error,g,S,x)}catch(j){Promise.reject(j)}}}this.listeners.forEach(g=>{g(B(this,ss))})})},qj);function Yw(e,t){const n=new Set(t);return e.filter(a=>!n.has(a))}function QR(e,t,n){const a=e.slice(0);return a[t]=n,a}var vo,$r,bo,xo,ia,ls,Rc,Oc,Mc,zc,Yn,fy,hy,my,py,gy,Zj,KR=(Zj=class extends rl{constructor(t,n,a){super();Te(this,Yn);Te(this,vo);Te(this,$r);Te(this,bo);Te(this,xo);Te(this,ia);Te(this,ls);Te(this,Rc);Te(this,Oc);Te(this,Mc);Te(this,zc,[]);ke(this,vo,t),ke(this,xo,a),ke(this,bo,[]),ke(this,ia,[]),ke(this,$r,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&B(this,ia).forEach(t=>{t.subscribe(n=>{Qe(this,Yn,py).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,B(this,ia).forEach(t=>{t.destroy()})}setQueries(t,n){ke(this,bo,t),ke(this,xo,n),cn.batch(()=>{const a=B(this,ia),s=Qe(this,Yn,my).call(this,B(this,bo));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,S)=>g!==a[S]),h=f||m,p=h?!0:c.some((g,S)=>{const x=B(this,$r)[S];return!x||!uc(g,x)});!h&&!p||(h&&(ke(this,zc,s),ke(this,ia,o)),ke(this,$r,c),this.hasListeners()&&(h&&(Yw(a,o).forEach(g=>{g.destroy()}),Yw(o,a).forEach(g=>{g.subscribe(S=>{Qe(this,Yn,py).call(this,g,S)})})),Qe(this,Yn,gy).call(this)))})}getCurrentResult(){return B(this,$r)}getQueries(){return B(this,ia).map(t=>t.getCurrentQuery())}getObservers(){return B(this,ia)}getOptimisticResult(t,n){const a=Qe(this,Yn,my).call(this,t),s=a.map(c=>c.observer.getOptimisticResult(c.defaultedQueryOptions)),o=a.map(c=>c.defaultedQueryOptions.queryHash);return[s,c=>Qe(this,Yn,hy).call(this,c??s,n,o),()=>Qe(this,Yn,fy).call(this,s,a)]}},vo=new WeakMap,$r=new WeakMap,bo=new WeakMap,xo=new WeakMap,ia=new WeakMap,ls=new WeakMap,Rc=new WeakMap,Oc=new WeakMap,Mc=new WeakMap,zc=new WeakMap,Yn=new WeakSet,fy=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)})})})},hy=function(t,n,a){if(n){const s=B(this,Mc),o=a!==void 0&&s!==void 0&&(s.length!==a.length||a.some((c,f)=>c!==s[f]));return(!B(this,ls)||B(this,$r)!==B(this,Oc)||o||n!==B(this,Rc))&&(ke(this,Rc,n),ke(this,Oc,B(this,$r)),a!==void 0&&ke(this,Mc,a),ke(this,ls,mv(B(this,ls),n(t)))),B(this,ls)}return t},my=function(t){const n=new Map;B(this,ia).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=B(this,vo).defaultQueryOptions(s),f=((m=n.get(o.queryHash))==null?void 0:m.shift())??new yv(B(this,vo),o);a.push({defaultedQueryOptions:o,observer:f})}),a},py=function(t,n){const a=B(this,ia).indexOf(t);a!==-1&&(ke(this,$r,QR(B(this,$r),a,n)),Qe(this,Yn,gy).call(this))},gy=function(){var t;if(this.hasListeners()){const n=B(this,ls),a=Qe(this,Yn,fy).call(this,B(this,$r),B(this,zc)),s=Qe(this,Yn,hy).call(this,a,(t=B(this,xo))==null?void 0:t.combine);n!==s&&cn.batch(()=>{this.listeners.forEach(o=>{o(B(this,$r))})})}},Zj),Ma,Gj,YR=(Gj=class extends rl{constructor(t={}){super();Te(this,Ma);this.config=t,ke(this,Ma,new Map)}build(t,n,a){const s=n.queryKey,o=n.queryHash??hv(s,n);let c=this.get(o);return c||(c=new FR({client:t,queryKey:s,queryHash:o,options:t.defaultQueryOptions(n),state:a,defaultOptions:t.getQueryDefaults(s)}),this.add(c)),c}add(t){B(this,Ma).has(t.queryHash)||(B(this,Ma).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=B(this,Ma).get(t.queryHash);n&&(t.destroy(),n===t&&B(this,Ma).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){cn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return B(this,Ma).get(t)}getAll(){return[...B(this,Ma).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(a=>Bw(n,a))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(a=>Bw(t,a)):n}notify(t){cn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){cn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){cn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ma=new WeakMap,Gj),un,os,us,So,wo,cs,ko,jo,Vj,XR=(Vj=class{constructor(e={}){Te(this,un);Te(this,os);Te(this,us);Te(this,So);Te(this,wo);Te(this,cs);Te(this,ko);Te(this,jo);ke(this,un,e.queryCache||new YR),ke(this,os,e.mutationCache||new GR),ke(this,us,e.defaultOptions||{}),ke(this,So,new Map),ke(this,wo,new Map),ke(this,cs,0)}mount(){uf(this,cs)._++,B(this,cs)===1&&(ke(this,ko,fv.subscribe(async e=>{e&&(await this.resumePausedMutations(),B(this,un).onFocus())})),ke(this,jo,Ff.subscribe(async e=>{e&&(await this.resumePausedMutations(),B(this,un).onOnline())})))}unmount(){var e,t;uf(this,cs)._--,B(this,cs)===0&&((e=B(this,ko))==null||e.call(this),ke(this,ko,void 0),(t=B(this,jo))==null||t.call(this),ke(this,jo,void 0))}isFetching(e){return B(this,un).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return B(this,os).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=B(this,un).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=B(this,un).build(this,t),a=n.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(fs(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return B(this,un).findAll(e).map(({queryKey:t,state:n})=>{const a=n.data;return[t,a]})}setQueryData(e,t,n){const a=this.defaultQueryOptions({queryKey:e}),s=B(this,un).get(a.queryHash),o=s==null?void 0:s.state.data,c=RR(t,o);if(c!==void 0)return B(this,un).build(this,a).setData(c,{...n,manual:!0})}setQueriesData(e,t,n){return cn.batch(()=>B(this,un).findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=B(this,un).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=B(this,un);cn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=B(this,un);return cn.batch(()=>(n.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},a=cn.batch(()=>B(this,un).findAll(e).map(s=>s.cancel(n)));return Promise.all(a).then(er).catch(er)}invalidateQueries(e,t={}){return cn.batch(()=>(B(this,un).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=cn.batch(()=>B(this,un).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,n);return n.throwOnError||(o=o.catch(er)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(a).then(er)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=B(this,un).build(this,t);return n.isStaleByTime(fs(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(er).catch(er)}fetchInfiniteQuery(e){return e.behavior=Qw(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(er).catch(er)}ensureInfiniteQueryData(e){return e.behavior=Qw(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ff.isOnline()?B(this,os).resumePausedMutations():Promise.resolve()}getQueryCache(){return B(this,un)}getMutationCache(){return B(this,os)}getDefaultOptions(){return B(this,us)}setDefaultOptions(e){ke(this,us,e)}setQueryDefaults(e,t){B(this,So).set(Js(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...B(this,So).values()],n={};return t.forEach(a=>{oc(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){B(this,wo).set(Js(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...B(this,wo).values()],n={};return t.forEach(a=>{oc(e,a.mutationKey)&&Object.assign(n,a.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...B(this,us).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=hv(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===pv&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...B(this,us).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){B(this,un).clear(),B(this,os).clear()}},un=new WeakMap,os=new WeakMap,us=new WeakMap,So=new WeakMap,wo=new WeakMap,cs=new WeakMap,ko=new WeakMap,jo=new WeakMap,Vj),aE=b.createContext(void 0),pn=e=>{const t=b.useContext(aE);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},WR=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(aE.Provider,{value:e,children:t})),iE=b.createContext(!1),sE=()=>b.useContext(iE);iE.Provider;function JR(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var eO=b.createContext(JR()),lE=()=>b.useContext(eO),oE=(e,t,n)=>{const a=n!=null&&n.state.error&&typeof e.throwOnError=="function"?gv(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(t.isReset()||(e.retryOnMount=!1))},uE=e=>{b.useEffect(()=>{e.clearReset()},[e])},cE=({result:e,errorResetBoundary:t,throwOnError:n,query:a,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&a&&(s&&e.data===void 0||gv(n,[e.error,a])),dE=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))}},tO=(e,t)=>e.isLoading&&e.isFetching&&!t,yy=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,vy=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function nO({queries:e,...t},n){const a=pn(),s=sE(),o=lE(),c=b.useMemo(()=>e.map(k=>{const w=a.defaultQueryOptions(k);return w._optimisticResults=s?"isRestoring":"optimistic",w}),[e,a,s]);c.forEach(k=>{dE(k);const w=a.getQueryCache().get(k.queryHash);oE(k,o,w)}),uE(o);const[f]=b.useState(()=>new KR(a,c,t)),[m,h,p]=f.getOptimisticResult(c,t.combine),g=!s&&t.subscribed!==!1;b.useSyncExternalStore(b.useCallback(k=>g?f.subscribe(cn.batchCalls(k)):er,[f,g]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),b.useEffect(()=>{f.setQueries(c,t)},[c,t,f]);const x=m.some((k,w)=>yy(c[w],k))?m.flatMap((k,w)=>{const C=c[w];if(C&&yy(C,k)){const _=new yv(a,C);return vy(C,_,o)}return[]}):[];if(x.length>0)throw Promise.all(x);const j=m.find((k,w)=>{const C=c[w];return C&&cE({result:k,errorResetBoundary:o,throwOnError:C.throwOnError,query:a.getQueryCache().get(C.queryHash),suspense:C.suspense})});if(j!=null&&j.error)throw j.error;return h(p())}function rO(e,t,n){var S,x,j,k;const a=sE(),s=lE(),o=pn(),c=o.defaultQueryOptions(e);(x=(S=o.getDefaultOptions().queries)==null?void 0:S._experimental_beforeQuery)==null||x.call(S,c);const f=o.getQueryCache().get(c.queryHash);c._optimisticResults=a?"isRestoring":"optimistic",dE(c),oE(c,s,f),uE(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(w=>{const C=g?h.subscribe(cn.batchCalls(w)):er;return h.updateResult(),C},[h,g]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),b.useEffect(()=>{h.setOptions(c)},[c,h]),yy(c,p))throw vy(c,h,s);if(cE({result:p,errorResetBoundary:s,throwOnError:c.throwOnError,query:f,suspense:c.suspense}))throw p.error;if((k=(j=o.getDefaultOptions().queries)==null?void 0:j._experimental_afterQuery)==null||k.call(j,c,p),c.experimental_prefetchInRender&&!cc.isServer()&&tO(p,a)){const w=m?vy(c,h,s):f==null?void 0:f.promise;w==null||w.catch(er).finally(()=>{h.updateResult()})}return c.notifyOnChangeProps?p:h.trackResult(p)}function Ye(e,t){return rO(e,yv)}function gt(e,t){const n=pn(),[a]=b.useState(()=>new VR(n,e));b.useEffect(()=>{a.setOptions(e)},[a,e]);const s=b.useSyncExternalStore(b.useCallback(c=>a.subscribe(cn.batchCalls(c)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),o=b.useCallback((c,f)=>{a.mutate(c,f).catch(er)},[a]);if(s.error&&gv(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 Xw="popstate";function Ww(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function aO(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 by("",{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:dc(s)}return sO(t,n,null,e)}function Kt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function oa(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function iO(){return Math.random().toString(36).substring(2,10)}function Jw(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 by(e,t,n=null,a,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ro(t):t,state:n,key:t&&t.key||a||iO(),unstable_mask:s}}function dc({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 Ro(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 sO(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 w=p(),C=w==null?null:w-h;h=w,m&&m({action:f,location:k.location,delta:C})}function S(w,C){f="PUSH";let _=Ww(w)?w:by(k.location,w,C);h=p()+1;let R=Jw(_,h),z=k.createHref(_.unstable_mask||_);try{c.pushState(R,"",z)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;s.location.assign(z)}o&&m&&m({action:f,location:k.location,delta:1})}function x(w,C){f="REPLACE";let _=Ww(w)?w:by(k.location,w,C);h=p();let R=Jw(_,h),z=k.createHref(_.unstable_mask||_);c.replaceState(R,"",z),o&&m&&m({action:f,location:k.location,delta:0})}function j(w){return lO(w)}let k={get action(){return f},get location(){return e(s,c)},listen(w){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener(Xw,g),m=w,()=>{s.removeEventListener(Xw,g),m=null}},createHref(w){return t(s,w)},createURL:j,encodeLocation(w){let C=j(w);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:S,replace:x,go(w){return c.go(w)}};return k}function lO(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Kt(n,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:dc(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=n+a),new URL(a,n)}function fE(e,t,n="/"){return oO(e,t,n,!1)}function oO(e,t,n,a){let s=typeof t=="string"?Ro(t):t,o=hi(s.pathname||"/",n);if(o==null)return null;let c=hE(e);uO(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let h=xO(o);f=vO(c[m],h,a)}return f}function hE(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;Kt(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=Da([a,p.relativePath]),S=n.concat(p);c.children&&c.children.length>0&&(Kt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),hE(c.children,t,S,g,m)),!(c.path==null&&!c.index)&&t.push({path:g,score:gO(g,c.index),routesMeta:S})};return e.forEach((c,f)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))o(c,f);else for(let h of mE(c.path))o(c,f,!0,h)}),t}function mE(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=mE(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 uO(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:yO(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var cO=/^:[\w-]+$/,dO=3,fO=2,hO=1,mO=10,pO=-2,e1=e=>e==="*";function gO(e,t){let n=e.split("/"),a=n.length;return n.some(e1)&&(a+=pO),t&&(a+=fO),n.filter(s=>!e1(s)).reduce((s,o)=>s+(cO.test(o)?dO:o===""?hO:mO),a)}function yO(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 vO(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=$f({path:m.relativePath,caseSensitive:m.caseSensitive,end:h},p),S=m.route;if(!g&&h&&n&&!a[a.length-1].route.index&&(g=$f({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},p)),!g)return null;Object.assign(s,g.params),c.push({params:s,pathname:Da([o,g.pathname]),pathnameBase:jO(Da([o,g.pathnameBase])),route:S}),g.pathnameBase!=="/"&&(o=Da([o,g.pathnameBase]))}return c}function $f(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=bO(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},S)=>{if(p==="*"){let j=f[S]||"";c=o.slice(0,o.length-j.length).replace(/(.)\/+$/,"$1")}const x=f[S];return g&&!x?h[p]=void 0:h[p]=(x||"").replace(/%2F/g,"/"),h},{}),pathname:o,pathnameBase:c,pattern:e}}function bO(e,t=!1,n=!0){oa(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 xO(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return oa(!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 hi(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 SO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function wO(e,t="/"){let{pathname:n,search:a="",hash:s=""}=typeof e=="string"?Ro(e):e,o;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?o=t1(n.substring(1),"/"):o=t1(n,t)):o=t,{pathname:o,search:EO(a),hash:CO(s)}}function t1(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 tg(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 kO(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function bv(e){let t=kO(e);return t.map((n,a)=>a===t.length-1?n.pathname:n.pathnameBase)}function uh(e,t,n,a=!1){let s;typeof e=="string"?s=Ro(e):(s={...e},Kt(!s.pathname||!s.pathname.includes("?"),tg("?","pathname","search",s)),Kt(!s.pathname||!s.pathname.includes("#"),tg("#","pathname","hash",s)),Kt(!s.search||!s.search.includes("#"),tg("#","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 S=c.split("/");for(;S[0]==="..";)S.shift(),g-=1;s.pathname=S.join("/")}f=g>=0?t[g]:"/"}let m=wO(s,f),h=c&&c!=="/"&&c.endsWith("/"),p=(o||c===".")&&n.endsWith("/");return!m.pathname.endsWith("/")&&(h||p)&&(m.pathname+="/"),m}var Da=e=>e.join("/").replace(/\/\/+/g,"/"),jO=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),EO=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,CO=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,NO=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 _O(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function TO(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var pE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function gE(e,t){let n=e;if(typeof n!="string"||!SO.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,s=!1;if(pE)try{let o=new URL(window.location.href),c=n.startsWith("//")?new URL(o.protocol+n):new URL(n),f=hi(c.pathname,t);c.origin===o.origin&&f!=null?n=f+c.search+c.hash:s=!0}catch{oa(!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 yE=["POST","PUT","PATCH","DELETE"];new Set(yE);var AO=["GET",...yE];new Set(AO);var Oo=b.createContext(null);Oo.displayName="DataRouter";var ch=b.createContext(null);ch.displayName="DataRouterState";var RO=b.createContext(!1),vE=b.createContext({isTransitioning:!1});vE.displayName="ViewTransition";var OO=b.createContext(new Map);OO.displayName="Fetchers";var MO=b.createContext(null);MO.displayName="Await";var Zr=b.createContext(null);Zr.displayName="Navigation";var Dc=b.createContext(null);Dc.displayName="Location";var ca=b.createContext({outlet:null,matches:[],isDataRoute:!1});ca.displayName="Route";var xv=b.createContext(null);xv.displayName="RouteError";var bE="REACT_ROUTER_ERROR",zO="REDIRECT",DO="ROUTE_ERROR_RESPONSE";function IO(e){if(e.startsWith(`${bE}:${zO}:{`))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 LO(e){if(e.startsWith(`${bE}:${DO}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new NO(t.status,t.statusText,t.data)}catch{}}function PO(e,{relative:t}={}){Kt(Mo(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=b.useContext(Zr),{hash:s,pathname:o,search:c}=Ic(e,{relative:t}),f=o;return n!=="/"&&(f=o==="/"?n:Da([n,o])),a.createHref({pathname:f,search:c,hash:s})}function Mo(){return b.useContext(Dc)!=null}function Ar(){return Kt(Mo(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(Dc).location}var xE="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function SE(e){b.useContext(Zr).static||b.useLayoutEffect(e)}function An(){let{isDataRoute:e}=b.useContext(ca);return e?JO():UO()}function UO(){Kt(Mo(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(Oo),{basename:t,navigator:n}=b.useContext(Zr),{matches:a}=b.useContext(ca),{pathname:s}=Ar(),o=JSON.stringify(bv(a)),c=b.useRef(!1);return SE(()=>{c.current=!0}),b.useCallback((m,h={})=>{if(oa(c.current,xE),!c.current)return;if(typeof m=="number"){n.go(m);return}let p=uh(m,JSON.parse(o),s,h.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:Da([t,p.pathname])),(h.replace?n.replace:n.push)(p,h.state,h)},[t,n,o,s,e])}var BO=b.createContext(null);function FO(e){let t=b.useContext(ca).outlet;return b.useMemo(()=>t&&b.createElement(BO.Provider,{value:e},t),[t,e])}function wE(){let{matches:e}=b.useContext(ca),t=e[e.length-1];return t?t.params:{}}function Ic(e,{relative:t}={}){let{matches:n}=b.useContext(ca),{pathname:a}=Ar(),s=JSON.stringify(bv(n));return b.useMemo(()=>uh(e,JSON.parse(s),a,t==="path"),[e,s,a,t])}function $O(e,t){return kE(e,t)}function kE(e,t,n){var w;Kt(Mo(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=b.useContext(Zr),{matches:s}=b.useContext(ca),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||"";EE(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=Ar(),g;if(t){let C=typeof t=="string"?Ro(t):t;Kt(m==="/"||((w=C.pathname)==null?void 0:w.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 S=g.pathname||"/",x=S;if(m!=="/"){let C=m.replace(/^\//,"").split("/");x="/"+S.replace(/^\//,"").split("/").slice(C.length).join("/")}let j=fE(e,{pathname:x});oa(h||j!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),oa(j==null||j[j.length-1].route.element!==void 0||j[j.length-1].route.Component!==void 0||j[j.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=VO(j&&j.map(C=>Object.assign({},C,{params:Object.assign({},c,C.params),pathname:Da([m,a.encodeLocation?a.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?m:Da([m,a.encodeLocation?a.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),s,n);return t&&k?b.createElement(Dc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},k):k}function HO(){let e=WO(),t=_O(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 qO=b.createElement(HO,null),jE=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=LO(e.digest);n&&(e=n)}let t=e!==void 0?b.createElement(ca.Provider,{value:this.props.routeContext},b.createElement(xv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(ZO,{error:e},t):t}};jE.contextType=RO;var ng=new WeakMap;function ZO({children:e,error:t}){let{basename:n}=b.useContext(Zr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=IO(t.digest);if(a){let s=ng.get(t);if(s)throw s;let o=gE(a.location,n);if(pE&&!ng.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 ng.set(t,c),c}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function GO({routeContext:e,match:t,children:n}){let a=b.useContext(Oo);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),b.createElement(ca.Provider,{value:e},n)}function VO(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);Kt(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:S,errors:x}=a,j=g.route.loader&&!S.hasOwnProperty(g.route.id)&&(!x||x[g.route.id]===void 0);if(g.route.lazy||j){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 S,x;m(p,{location:a.location,params:((x=(S=a.matches)==null?void 0:S[0])==null?void 0:x.params)??{},unstable_pattern:TO(a.matches),errorInfo:g})}:void 0;return s.reduceRight((p,g,S)=>{let x,j=!1,k=null,w=null;a&&(x=o&&g.route.id?o[g.route.id]:void 0,k=g.route.errorElement||qO,c&&(f<0&&S===0?(EE("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),j=!0,w=null):f===S&&(j=!0,w=g.route.hydrateFallbackElement||null)));let C=t.concat(s.slice(0,S+1)),_=()=>{let R;return x?R=k:j?R=w:g.route.Component?R=b.createElement(g.route.Component,null):g.route.element?R=g.route.element:R=p,b.createElement(GO,{match:g,routeContext:{outlet:p,matches:C,isDataRoute:a!=null},children:R})};return a&&(g.route.ErrorBoundary||g.route.errorElement||S===0)?b.createElement(jE,{location:a.location,revalidation:a.revalidation,component:k,error:x,children:_(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:h}):_()},null)}function Sv(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function QO(e){let t=b.useContext(Oo);return Kt(t,Sv(e)),t}function KO(e){let t=b.useContext(ch);return Kt(t,Sv(e)),t}function YO(e){let t=b.useContext(ca);return Kt(t,Sv(e)),t}function wv(e){let t=YO(e),n=t.matches[t.matches.length-1];return Kt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function XO(){return wv("useRouteId")}function WO(){var a;let e=b.useContext(xv),t=KO("useRouteError"),n=wv("useRouteError");return e!==void 0?e:(a=t.errors)==null?void 0:a[n]}function JO(){let{router:e}=QO("useNavigate"),t=wv("useNavigate"),n=b.useRef(!1);return SE(()=>{n.current=!0}),b.useCallback(async(s,o={})=>{oa(n.current,xE),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var n1={};function EE(e,t,n){!t&&!n1[e]&&(n1[e]=!0,oa(!1,n))}b.memo(eM);function eM({routes:e,future:t,state:n,isStatic:a,onError:s}){return kE(e,void 0,{state:n,isStatic:a,onError:s})}function Jn({to:e,replace:t,state:n,relative:a}){Kt(Mo(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=b.useContext(Zr);oa(!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(ca),{pathname:c}=Ar(),f=An(),m=uh(e,bv(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 Hf(e){return FO(e.context)}function Pt(e){Kt(!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 tM({basename:e="/",children:t=null,location:n,navigationType:a="POP",navigator:s,static:o=!1,unstable_useTransitions:c}){Kt(!Mo(),"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=Ro(n));let{pathname:h="/",search:p="",hash:g="",state:S=null,key:x="default",unstable_mask:j}=n,k=b.useMemo(()=>{let w=hi(h,f);return w==null?null:{location:{pathname:w,search:p,hash:g,state:S,key:x,unstable_mask:j},navigationType:a}},[f,h,p,g,S,x,a,j]);return oa(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(Zr.Provider,{value:m},b.createElement(Dc.Provider,{children:t,value:k}))}function nM({children:e,location:t}){return $O(xy(e),t)}function xy(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,xy(a.props.children,o));return}Kt(a.type===Pt,`[${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>`),Kt(!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=xy(a.props.children,o)),n.push(c)}),n}var Mf="get",zf="application/x-www-form-urlencoded";function dh(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function rM(e){return dh(e)&&e.tagName.toLowerCase()==="button"}function aM(e){return dh(e)&&e.tagName.toLowerCase()==="form"}function iM(e){return dh(e)&&e.tagName.toLowerCase()==="input"}function sM(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function lM(e,t){return e.button===0&&(!t||t==="_self")&&!sM(e)}function Sy(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 oM(e,t){let n=Sy(e);return t&&t.forEach((a,s)=>{n.has(s)||t.getAll(s).forEach(o=>{n.append(s,o)})}),n}var df=null;function uM(){if(df===null)try{new FormData(document.createElement("form"),0),df=!1}catch{df=!0}return df}var cM=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function rg(e){return e!=null&&!cM.has(e)?(oa(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${zf}"`),null):e}function dM(e,t){let n,a,s,o,c;if(aM(e)){let f=e.getAttribute("action");a=f?hi(f,t):null,n=e.getAttribute("method")||Mf,s=rg(e.getAttribute("enctype"))||zf,o=new FormData(e)}else if(rM(e)||iM(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?hi(m,t):null,n=e.getAttribute("formmethod")||f.getAttribute("method")||Mf,s=rg(e.getAttribute("formenctype"))||rg(f.getAttribute("enctype"))||zf,o=new FormData(f,e),!uM()){let{name:h,type:p,value:g}=e;if(p==="image"){let S=h?`${h}.`:"";o.append(`${S}x`,"0"),o.append(`${S}y`,"0")}else h&&o.append(h,g)}}else{if(dh(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Mf,a=null,s=zf,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 kv(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function fM(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&&hi(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${a}`,s}async function hM(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 mM(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 pM(e,t,n){let a=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let c=await hM(o,n);return c.links?c.links():[]}return[]}));return bM(a.flat(1).filter(mM).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function r1(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 S=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 S=="boolean")return S}return!0}):[]}function gM(e,t,{includeHydrateFallback:n}={}){return yM(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 yM(e){return[...new Set(e)]}function vM(e){let t={},n=Object.keys(e).sort();for(let a of n)t[a]=e[a];return t}function bM(e,t){let n=new Set;return new Set(t),e.reduce((a,s)=>{let o=JSON.stringify(vM(s));return n.has(o)||(n.add(o),a.push({key:o,link:s})),a},[])}function CE(){let e=b.useContext(Oo);return kv(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function xM(){let e=b.useContext(ch);return kv(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var jv=b.createContext(void 0);jv.displayName="FrameworkContext";function NE(){let e=b.useContext(jv);return kv(e,"You must render this element inside a <HydratedRouter> element"),e}function SM(e,t){let n=b.useContext(jv),[a,s]=b.useState(!1),[o,c]=b.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:h,onMouseLeave:p,onTouchStart:g}=t,S=b.useRef(null);b.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let k=C=>{C.forEach(_=>{c(_.isIntersecting)})},w=new IntersectionObserver(k,{threshold:.5});return S.current&&w.observe(S.current),()=>{w.disconnect()}}},[e]),b.useEffect(()=>{if(a){let k=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(k)}}},[a]);let x=()=>{s(!0)},j=()=>{s(!1),c(!1)};return n?e!=="intent"?[o,S,{}]:[o,S,{onFocus:Iu(f,x),onBlur:Iu(m,j),onMouseEnter:Iu(h,x),onMouseLeave:Iu(p,j),onTouchStart:Iu(g,x)}]:[!1,S,{}]}function Iu(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function wM({page:e,...t}){let{router:n}=CE(),a=b.useMemo(()=>fE(n.routes,e,n.basename),[n.routes,e,n.basename]);return a?b.createElement(jM,{page:e,matches:a,...t}):null}function kM(e){let{manifest:t,routeModules:n}=NE(),[a,s]=b.useState([]);return b.useEffect(()=>{let o=!1;return pM(e,t,n).then(c=>{o||s(c)}),()=>{o=!0}},[e,t,n]),a}function jM({page:e,matches:t,...n}){let a=Ar(),{future:s,manifest:o,routeModules:c}=NE(),{basename:f}=CE(),{loaderData:m,matches:h}=xM(),p=b.useMemo(()=>r1(e,t,h,o,a,"data"),[e,t,h,o,a]),g=b.useMemo(()=>r1(e,t,h,o,a,"assets"),[e,t,h,o,a]),S=b.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let k=new Set,w=!1;if(t.forEach(_=>{var z;let R=o.routes[_.route.id];!R||!R.hasLoader||(!p.some(I=>I.route.id===_.route.id)&&_.route.id in m&&((z=c[_.route.id])!=null&&z.shouldRevalidate)||R.hasClientLoader?w=!0:k.add(_.route.id))}),k.size===0)return[];let C=fM(e,f,s.unstable_trailingSlashAwareDataRequests,"data");return w&&k.size>0&&C.searchParams.set("_routes",t.filter(_=>k.has(_.route.id)).map(_=>_.route.id).join(",")),[C.pathname+C.search]},[f,s.unstable_trailingSlashAwareDataRequests,m,a,o,p,t,e,c]),x=b.useMemo(()=>gM(g,o),[g,o]),j=kM(g);return b.createElement(b.Fragment,null,S.map(k=>b.createElement("link",{key:k,rel:"prefetch",as:"fetch",href:k,...n})),x.map(k=>b.createElement("link",{key:k,rel:"modulepreload",href:k,...n})),j.map(({key:k,link:w})=>b.createElement("link",{key:k,nonce:n.nonce,...w,crossOrigin:w.crossOrigin??n.crossOrigin})))}function EM(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var CM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{CM&&(window.__reactRouterVersion="7.13.1")}catch{}function NM({basename:e,children:t,unstable_useTransitions:n,window:a}){let s=b.useRef();s.current==null&&(s.current=aO({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(tM,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,unstable_useTransitions:n})}var _E=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Lc=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:S,unstable_defaultShouldRevalidate:x,...j},k){let{basename:w,navigator:C,unstable_useTransitions:_}=b.useContext(Zr),R=typeof p=="string"&&_E.test(p),z=gE(p,w);p=z.to;let I=PO(p,{relative:s}),O=Ar(),F=null;if(f){let J=uh(f,[],O.unstable_mask?O.unstable_mask.pathname:"/",!0);w!=="/"&&(J.pathname=J.pathname==="/"?w:Da([w,J.pathname])),F=C.createHref(J)}let[D,W,L]=SM(a,j),V=AM(p,{replace:c,unstable_mask:f,state:m,target:h,preventScrollReset:g,relative:s,viewTransition:S,unstable_defaultShouldRevalidate:x,unstable_useTransitions:_});function Y(J){t&&t(J),J.defaultPrevented||V(J)}let me=!(z.isExternal||o),te=b.createElement("a",{...j,...L,href:(me?F:void 0)||z.absoluteURL||I,onClick:me?Y:t,ref:EM(k,W),target:h,"data-discover":!R&&n==="render"?"true":void 0});return D&&!R?b.createElement(b.Fragment,null,te,b.createElement(wM,{page:I})):te});Lc.displayName="Link";var Ev=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=Ic(c,{relative:h.relative}),S=Ar(),x=b.useContext(ch),{navigator:j,basename:k}=b.useContext(Zr),w=x!=null&&DM(g)&&f===!0,C=j.encodeLocation?j.encodeLocation(g).pathname:g.pathname,_=S.pathname,R=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;n||(_=_.toLowerCase(),R=R?R.toLowerCase():null,C=C.toLowerCase()),R&&k&&(R=hi(R,k)||R);const z=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let I=_===C||!s&&_.startsWith(C)&&_.charAt(z)==="/",O=R!=null&&(R===C||!s&&R.startsWith(C)&&R.charAt(C.length)==="/"),F={isActive:I,isPending:O,isTransitioning:w},D=I?t:void 0,W;typeof a=="function"?W=a(F):W=[a,I?"active":null,O?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let L=typeof o=="function"?o(F):o;return b.createElement(Lc,{...h,"aria-current":D,className:W,ref:p,style:L,to:c,viewTransition:f},typeof m=="function"?m(F):m)});Ev.displayName="NavLink";var _M=b.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:s,state:o,method:c=Mf,action:f,onSubmit:m,relative:h,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:S,...x},j)=>{let{unstable_useTransitions:k}=b.useContext(Zr),w=MM(),C=zM(f,{relative:h}),_=c.toLowerCase()==="get"?"get":"post",R=typeof f=="string"&&_E.test(f),z=I=>{if(m&&m(I),I.defaultPrevented)return;I.preventDefault();let O=I.nativeEvent.submitter,F=(O==null?void 0:O.getAttribute("formmethod"))||c,D=()=>w(O||I.currentTarget,{fetcherKey:t,method:F,navigate:n,replace:s,state:o,relative:h,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:S});k&&n!==!1?b.startTransition(()=>D()):D()};return b.createElement("form",{ref:j,method:_,action:C,onSubmit:a?m:z,...x,"data-discover":!R&&e==="render"?"true":void 0})});_M.displayName="Form";function TM(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function TE(e){let t=b.useContext(Oo);return Kt(t,TM(e)),t}function AM(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=Ar(),S=Ic(e,{relative:c});return b.useCallback(x=>{if(lM(x,t)){x.preventDefault();let j=n!==void 0?n:dc(g)===dc(S),k=()=>p(e,{replace:j,unstable_mask:a,state:s,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});h?b.startTransition(()=>k()):k()}},[g,p,S,n,a,s,t,e,o,c,f,m,h])}function fh(e){oa(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(Sy(e)),n=b.useRef(!1),a=Ar(),s=b.useMemo(()=>oM(a.search,n.current?null:t.current),[a.search]),o=An(),c=b.useCallback((f,m)=>{const h=Sy(typeof f=="function"?f(new URLSearchParams(s)):f);n.current=!0,o("?"+h,m)},[o,s]);return[s,c]}var RM=0,OM=()=>`__${String(++RM)}__`;function MM(){let{router:e}=TE("useSubmit"),{basename:t}=b.useContext(Zr),n=XO(),a=e.fetch,s=e.navigate;return b.useCallback(async(o,c={})=>{let{action:f,method:m,encType:h,formData:p,body:g}=dM(o,t);if(c.navigate===!1){let S=c.fetcherKey||OM();await a(S,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 zM(e,{relative:t}={}){let{basename:n}=b.useContext(Zr),a=b.useContext(ca);Kt(a,"useFormAction must be used inside a RouteContext");let[s]=a.matches.slice(-1),o={...Ic(e||".",{relative:t})},c=Ar();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:Da([n,o.pathname])),dc(o)}function DM(e,{relative:t}={}){let n=b.useContext(vE);Kt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=TE("useViewTransitionState"),s=Ic(e,{relative:t});if(!n.isTransitioning)return!1;let o=hi(n.currentLocation.pathname,a)||n.currentLocation.pathname,c=hi(n.nextLocation.pathname,a)||n.nextLocation.pathname;return $f(s.pathname,c)!=null||$f(s.pathname,o)!=null}const IM="/api/v1";async function LM(e,t){const n=await fetch(`${IM}/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 AE="/api/v1",Cv="first-tree-hub:tokens";let wy=null;function Lu(e){wy=e}function gn(e){if(!wy)throw new Error(`withOrg("${e}") called before an organization is selected`);return`/orgs/${encodeURIComponent(wy)}${e}`}function ky(e,t){return`/orgs/${encodeURIComponent(e)}${t}`}function hh(){const e=localStorage.getItem(Cv);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function jy(e){localStorage.setItem(Cv,JSON.stringify(e))}function RE(){localStorage.removeItem(Cv)}class al extends Error{constructor(t,n,a){super(n),this.status=t,this.issues=a,this.name="ApiError"}}let Pu=null;async function PM(){const e=hh();return e!=null&&e.refreshToken?OE(e.refreshToken):null}async function OE(e){return Pu||(Pu=(async()=>{try{const t=await fetch(`${AE}/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 jy(a),a}catch{return null}finally{Pu=null}})(),Pu)}async function Uu(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(`${AE}${e}`,{method:n,headers:m,body:a!==void 0?JSON.stringify(a):void 0})},o=hh();let c=await s(o==null?void 0:o.accessToken);if(c.status===401&&(o!=null&&o.refreshToken)){const f=await OE(o.refreshToken);f&&(c=await s(f.accessToken))}if(!c.ok){c.status===401&&(RE(),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 al(c.status,m,h)}if(c.status!==204)return await c.json()}const Ee={get:e=>Uu(e),post:(e,t)=>Uu(e,{method:"POST",body:t}),patch:(e,t)=>Uu(e,{method:"PATCH",body:t}),put:(e,t)=>Uu(e,{method:"PUT",body:t}),delete:e=>Uu(e,{method:"DELETE"})};async function mi(e,t){try{await Ee.post("/me/onboarding/events",{event:e,attrs:t})}catch{}}async function UM(){try{await Ee.post("/me/onboarding-completed",{})}catch{}}const Nv="onboarding:joinPath",BM="onboarding:draft",Ey="onboarding:step1Confirmed";function ME(){return typeof window>"u"?!1:window.sessionStorage.getItem(Ey)==="1"}function FM(e){typeof window>"u"||(e?window.sessionStorage.setItem(Ey,"1"):window.sessionStorage.removeItem(Ey))}const Cy="onboarding:agentUuid";function $M(){return typeof window>"u"?null:window.sessionStorage.getItem(Cy)}function HM(e){typeof window>"u"||(e?window.sessionStorage.setItem(Cy,e):window.sessionStorage.removeItem(Cy))}function zE(e){typeof window>"u"||window.sessionStorage.setItem(Nv,e)}function DE(){if(typeof window>"u")return null;const e=window.sessionStorage.getItem(Nv);return e==="solo"||e==="invite"?e:null}function qM(){typeof window>"u"||window.sessionStorage.removeItem(Nv)}function ZM(e,t){return`${e??"unknown-org"}:${t??"unknown-member"}`}function _v(e){return`${BM}:${e}`}function GM(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;if(a!==null&&typeof a!="number")return null;const s="visibility"in e?e.visibility:null,o=s==="private"||s==="organization"?s:null;return{displayName:e.displayName,selectedRuntime:t,connectToken:n,connectTokenExpiresAt:a,visibility:o}}function VM(e){if(typeof window>"u")return null;const t=window.sessionStorage.getItem(_v(e));if(!t)return null;try{return GM(JSON.parse(t))}catch{return null}}function QM(e,t){typeof window>"u"||window.sessionStorage.setItem(_v(e),JSON.stringify(t))}function KM(e){typeof window>"u"||window.sessionStorage.removeItem(_v(e))}function YM(){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 IE=b.createContext(null),Ny="first-tree-hub:selectedOrganizationId";function XM(){try{return localStorage.getItem(Ny)}catch{return null}}function ag(e){try{e===null?localStorage.removeItem(Ny):localStorage.setItem(Ny,e)}catch{}}function WM({children:e}){const t=pn(),[n,a]=b.useState(()=>!!hh()),[s,o]=b.useState(null),[c,f]=b.useState([]),[m,h]=b.useState(()=>{const Y=XM();return Lu(Y),Y}),[p,g]=b.useState(null),[S,x]=b.useState(null),[j,k]=b.useState(null),[w,C]=b.useState(!1),_=b.useCallback(()=>{RE(),ag(null),Lu(null),t.clear(),YM(),a(!1),o(null),f([]),h(null),g(null),x(null),k(null),C(!1)},[t]),R=b.useCallback(async()=>{var Y,me,te;try{const J=await Ee.get("/me");o(J.user??null);const q=J.memberships??[];f(q);const le=((Y=J.onboarding)==null?void 0:Y.step)??null;g(le),x(((me=J.onboarding)==null?void 0:me.dismissedAt)??null),k(((te=J.onboarding)==null?void 0:te.completedAt)??null),le==="completed"&&qM(),h(ee=>{var P;const ve=ee&&q.some(U=>U.organizationId===ee)?ee:null;if(ve)return Lu(ve),ve;const M=J.defaultOrganizationId??((P=q[0])==null?void 0:P.organizationId)??null;return ag(M),Lu(M),M})}catch{}finally{C(!0)}},[]),z=b.useCallback(async(Y,me)=>{const te=await LM(Y,me);jy({accessToken:te.accessToken,refreshToken:te.refreshToken}),a(!0),await R()},[R]),I=b.useCallback(async Y=>{jy(Y),a(!0),await R()},[R]),O=b.useCallback(async Y=>{ag(Y),Lu(Y),t.clear(),h(Y),await R()},[R,t]),F=b.useRef(null);b.useEffect(()=>{F.current=S},[S]);const D=b.useCallback(async()=>{const Y=F.current;x(new Date().toISOString());try{const me=await Ee.patch("/me/onboarding",{dismissed:!0});me!=null&&me.dismissedAt&&x(me.dismissedAt)}catch{x(Y)}},[]),W=b.useCallback(async()=>{const Y=F.current;x(null);try{await Ee.patch("/me/onboarding",{dismissed:!1})}catch{x(Y)}},[]),L=b.useCallback(async()=>{k(Y=>Y??new Date().toISOString()),await UM()},[]);b.useEffect(()=>{n&&!s&&R()},[n,s,R]),b.useEffect(()=>{const Y=()=>_();return window.addEventListener("auth:logout",Y),()=>window.removeEventListener("auth:logout",Y)},[_]);const V=b.useMemo(()=>c.length===0?null:c.find(me=>me.organizationId===m)??c[0]??null,[c,m]);return l.jsx(IE.Provider,{value:{isAuthenticated:n,meLoaded:w,user:s,memberships:c,currentMembership:V,organizationId:(V==null?void 0:V.organizationId)??null,memberId:(V==null?void 0:V.id)??null,role:(V==null?void 0:V.role)??null,agentId:(V==null?void 0:V.agentId)??null,onboardingStep:p,onboardingDismissedAt:S,onboardingCompletedAt:j,dismissOnboarding:D,restoreOnboarding:W,markOnboardingCompleted:L,login:z,adoptTokens:I,selectOrganization:O,refreshMe:R,logout:_},children:e})}function lt(){const e=b.useContext(IE);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const JM="modulepreload",e3=function(e){return"/"+e},a1={},t3=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=e3(h),h in a1)return;a1[h]=!0;const p=h.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const S=document.createElement("link");if(S.rel=p?"stylesheet":JM,p||(S.as="script"),S.crossOrigin="",S.href=h,m&&S.setAttribute("nonce",m),document.head.appendChild(S),p)return new Promise((x,j)=>{S.addEventListener("load",x),S.addEventListener("error",()=>j(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)})},n3=b.lazy(()=>t3(()=>import("./index-CJcRUZ8l.js"),[]).then(e=>({default:e.LandingPage}))),i1=()=>l.jsx("div",{className:"landing-marketing min-h-screen bg-background"});function r3(){const{isAuthenticated:e,meLoaded:t}=lt(),n=Ar();return e?t?l.jsx(Hf,{}):l.jsx(i1,{}):n.pathname==="/"?l.jsx(b.Suspense,{fallback:l.jsx(i1,{}),children:l.jsx(n3,{})}):l.jsx(Jn,{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 LE=(...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 a3=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 i3=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 s1=e=>{const t=i3(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 s3={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 l3=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 o3=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,...s3,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:LE("lucide",s),...!o&&!l3(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 at=(e,t)=>{const n=b.forwardRef(({className:a,...s},o)=>b.createElement(o3,{ref:o,iconNode:t,className:LE(`lucide-${a3(s1(e))}`,`lucide-${e}`,a),...s}));return n.displayName=s1(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 u3=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Tv=at("arrow-left",u3);/**
|
|
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 c3=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],PE=at("arrow-right",c3);/**
|
|
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 d3=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],UE=at("arrow-up",d3);/**
|
|
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 f3=[["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"}]],h3=at("at-sign",f3);/**
|
|
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 m3=[["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"}]],p3=at("bell",m3);/**
|
|
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 g3=[["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"}]],BE=at("bot",g3);/**
|
|
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 y3=[["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"}]],v3=at("building-2",y3);/**
|
|
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 b3=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],fr=at("check",b3);/**
|
|
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 x3=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Av=at("chevron-down",x3);/**
|
|
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 S3=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],FE=at("chevron-right",S3);/**
|
|
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 w3=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],k3=at("circle-check",w3);/**
|
|
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 j3=[["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"}]],E3=at("circle-pause",j3);/**
|
|
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 C3=[["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"}]],Rv=at("copy",C3);/**
|
|
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 N3=[["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"}]],_3=at("ellipsis",N3);/**
|
|
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 T3=[["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"}]],Ov=at("external-link",T3);/**
|
|
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 A3=[["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"}]],R3=at("eye-off",A3);/**
|
|
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 O3=[["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"}]],$E=at("eye",O3);/**
|
|
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 M3=[["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"}]],z3=at("folder-tree",M3);/**
|
|
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 D3=[["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"}]],HE=at("github",D3);/**
|
|
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 I3=[["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"}]],L3=at("layout-dashboard",I3);/**
|
|
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 P3=[["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"}]],_y=at("link-2",P3);/**
|
|
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 U3=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ty=at("loader-circle",U3);/**
|
|
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 B3=[["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"}]],mh=at("lock",B3);/**
|
|
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 F3=[["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"}]],$3=at("log-out",F3);/**
|
|
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 H3=[["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"}]],Mv=at("message-square",H3);/**
|
|
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 q3=[["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"}]],Z3=at("moon",q3);/**
|
|
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 G3=[["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"}]],V3=at("paperclip",G3);/**
|
|
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 Q3=[["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"}]],zv=at("pencil",Q3);/**
|
|
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 K3=[["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"}]],qE=at("play",K3);/**
|
|
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 Y3=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ka=at("plus",Y3);/**
|
|
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 X3=[["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"}]],W3=at("refresh-cw",X3);/**
|
|
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 J3=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Dv=at("search",J3);/**
|
|
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 ez=[["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"}]],tz=at("sun",ez);/**
|
|
266
|
-
* @license lucide-react v0.577.0 - ISC
|
|
267
|
-
*
|
|
268
|
-
* This source code is licensed under the ISC license.
|
|
269
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
270
|
-
*/const nz=[["path",{d:"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"}]],qf=at("trash-2",nz);/**
|
|
271
|
-
* @license lucide-react v0.577.0 - ISC
|
|
272
|
-
*
|
|
273
|
-
* This source code is licensed under the ISC license.
|
|
274
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
275
|
-
*/const rz=[["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"}]],zo=at("triangle-alert",rz);/**
|
|
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 az=[["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"}]],iz=at("undo-2",az);/**
|
|
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 sz=[["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"}]],ZE=at("user-plus",sz);/**
|
|
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 lz=[["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"}]],Iv=at("user",lz);/**
|
|
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 oz=[["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"}]],GE=at("users",oz);/**
|
|
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 uz=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ms=at("x",uz);/**
|
|
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 cz=[["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"}]],dz=at("zap",cz);function VE(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=VE(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function QE(){for(var e,t,n=0,a="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=VE(e))&&(a&&(a+=" "),a+=t);return a}const fz=(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},hz=(e,t)=>({classGroupId:e,validator:t}),KE=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Zf="-",l1=[],mz="arbitrary..",pz=e=>{const t=yz(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return gz(c);const f=c.split(Zf),m=f[0]===""&&f.length>1?1:0;return YE(f,m,t)},getConflictingClassGroupIds:(c,f)=>{if(f){const m=a[c],h=n[c];return m?h?fz(h,m):m:h||l1}return n[c]||l1}}},YE=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const h=YE(e,t+1,o);if(h)return h}const c=n.validators;if(c===null)return;const f=t===0?e.join(Zf):e.slice(t).join(Zf),m=c.length;for(let h=0;h<m;h++){const p=c[h];if(p.validator(f))return p.classGroupId}},gz=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?mz+a:void 0})(),yz=e=>{const{theme:t,classGroups:n}=e;return vz(n,t)},vz=(e,t)=>{const n=KE();for(const a in e){const s=e[a];Lv(s,n,a,t)}return n},Lv=(e,t,n,a)=>{const s=e.length;for(let o=0;o<s;o++){const c=e[o];bz(c,t,n,a)}},bz=(e,t,n,a)=>{if(typeof e=="string"){xz(e,t,n);return}if(typeof e=="function"){Sz(e,t,n,a);return}wz(e,t,n,a)},xz=(e,t,n)=>{const a=e===""?t:XE(t,e);a.classGroupId=n},Sz=(e,t,n,a)=>{if(kz(e)){Lv(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(hz(n,e))},wz=(e,t,n,a)=>{const s=Object.entries(e),o=s.length;for(let c=0;c<o;c++){const[f,m]=s[c];Lv(m,XE(t,f),n,a)}},XE=(e,t)=>{let n=e;const a=t.split(Zf),s=a.length;for(let o=0;o<s;o++){const c=a[o];let f=n.nextPart.get(c);f||(f=KE(),n.nextPart.set(c,f)),n=f}return n},kz=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,jz=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)}}},Ay="!",o1=":",Ez=[],u1=(e,t,n,a,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:s}),Cz=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 w=s[k];if(c===0&&f===0){if(w===o1){o.push(s.slice(m,k)),m=k+1;continue}if(w==="/"){h=k;continue}}w==="["?c++:w==="]"?c--:w==="("?f++:w===")"&&f--}const g=o.length===0?s:s.slice(m);let S=g,x=!1;g.endsWith(Ay)?(S=g.slice(0,-1),x=!0):g.startsWith(Ay)&&(S=g.slice(1),x=!0);const j=h&&h>m?h-m:void 0;return u1(o,x,S,j)};if(t){const s=t+o1,o=a;a=c=>c.startsWith(s)?o(c.slice(s.length)):u1(Ez,!1,c,void 0,!0)}if(n){const s=a;a=o=>n({className:o,parseClassName:s})}return a},Nz=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}},_z=e=>({cache:jz(e.cacheSize),parseClassName:Cz(e),sortModifiers:Nz(e),...pz(e)}),Tz=/\s+/,Az=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:s,sortModifiers:o}=t,c=[],f=e.trim().split(Tz);let m="";for(let h=f.length-1;h>=0;h-=1){const p=f[h],{isExternal:g,modifiers:S,hasImportantModifier:x,baseClassName:j,maybePostfixModifierPosition:k}=n(p);if(g){m=p+(m.length>0?" "+m:m);continue}let w=!!k,C=a(w?j.substring(0,k):j);if(!C){if(!w){m=p+(m.length>0?" "+m:m);continue}if(C=a(j),!C){m=p+(m.length>0?" "+m:m);continue}w=!1}const _=S.length===0?"":S.length===1?S[0]:o(S).join(":"),R=x?_+Ay:_,z=R+C;if(c.indexOf(z)>-1)continue;c.push(z);const I=s(C,w);for(let O=0;O<I.length;++O){const F=I[O];c.push(R+F)}m=p+(m.length>0?" "+m:m)}return m},Rz=(...e)=>{let t=0,n,a,s="";for(;t<e.length;)(n=e[t++])&&(a=WE(n))&&(s&&(s+=" "),s+=a);return s},WE=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=WE(e[a]))&&(n&&(n+=" "),n+=t);return n},Oz=(e,...t)=>{let n,a,s,o;const c=m=>{const h=t.reduce((p,g)=>g(p),e());return n=_z(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=Az(m,n);return s(m,p),p};return o=c,(...m)=>o(Rz(...m))},Mz=[],Tn=e=>{const t=n=>n[e]||Mz;return t.isThemeGetter=!0,t},JE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,eC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zz=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Dz=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Iz=/\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$/,Lz=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Pz=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Uz=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ki=e=>zz.test(e),st=e=>!!e&&!Number.isNaN(Number(e)),Yi=e=>!!e&&Number.isInteger(Number(e)),ig=e=>e.endsWith("%")&&st(e.slice(0,-1)),ai=e=>Dz.test(e),tC=()=>!0,Bz=e=>Iz.test(e)&&!Lz.test(e),Pv=()=>!1,Fz=e=>Pz.test(e),$z=e=>Uz.test(e),Hz=e=>!Oe(e)&&!Me(e),qz=e=>bs(e,aC,Pv),Oe=e=>JE.test(e),Bs=e=>bs(e,iC,Bz),c1=e=>bs(e,Wz,st),Zz=e=>bs(e,lC,tC),Gz=e=>bs(e,sC,Pv),d1=e=>bs(e,nC,Pv),Vz=e=>bs(e,rC,$z),ff=e=>bs(e,oC,Fz),Me=e=>eC.test(e),Bu=e=>il(e,iC),Qz=e=>il(e,sC),f1=e=>il(e,nC),Kz=e=>il(e,aC),Yz=e=>il(e,rC),hf=e=>il(e,oC,!0),Xz=e=>il(e,lC,!0),bs=(e,t,n)=>{const a=JE.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},il=(e,t,n=!1)=>{const a=eC.exec(e);return a?a[1]?t(a[1]):n:!1},nC=e=>e==="position"||e==="percentage",rC=e=>e==="image"||e==="url",aC=e=>e==="length"||e==="size"||e==="bg-size",iC=e=>e==="length",Wz=e=>e==="number",sC=e=>e==="family-name",lC=e=>e==="number"||e==="weight",oC=e=>e==="shadow",Jz=()=>{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"),S=Tn("text-shadow"),x=Tn("drop-shadow"),j=Tn("blur"),k=Tn("perspective"),w=Tn("aspect"),C=Tn("ease"),_=Tn("animate"),R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],z=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],I=()=>[...z(),Me,Oe],O=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],D=()=>[Me,Oe,m],W=()=>[Ki,"full","auto",...D()],L=()=>[Yi,"none","subgrid",Me,Oe],V=()=>["auto",{span:["full",Yi,Me,Oe]},Yi,Me,Oe],Y=()=>[Yi,"auto",Me,Oe],me=()=>["auto","min","max","fr",Me,Oe],te=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...D()],le=()=>[Ki,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],ee=()=>[Ki,"screen","full","dvw","lvw","svw","min","max","fit",...D()],ve=()=>[Ki,"screen","full","lh","dvh","lvh","svh","min","max","fit",...D()],M=()=>[e,Me,Oe],P=()=>[...z(),f1,d1,{position:[Me,Oe]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],T=()=>["auto","cover","contain",Kz,qz,{size:[Me,Oe]}],G=()=>[ig,Bu,Bs],Z=()=>["","none","full",h,Me,Oe],ae=()=>["",st,Bu,Bs],Se=()=>["solid","dashed","dotted","double"],Re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],je=()=>[st,ig,f1,d1],$e=()=>["","none",j,Me,Oe],Ie=()=>["none",st,Me,Oe],Ke=()=>["none",st,Me,Oe],et=()=>[st,Me,Oe],wt=()=>[Ki,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ai],breakpoint:[ai],color:[tC],container:[ai],"drop-shadow":[ai],ease:["in","out","in-out"],font:[Hz],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ai],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ai],shadow:[ai],spacing:["px",st],text:[ai],"text-shadow":[ai],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ki,Oe,Me,w]}],container:["container"],columns:[{columns:[st,Oe,Me,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:I()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:W()}],"inset-x":[{"inset-x":W()}],"inset-y":[{"inset-y":W()}],start:[{"inset-s":W(),start:W()}],end:[{"inset-e":W(),end:W()}],"inset-bs":[{"inset-bs":W()}],"inset-be":[{"inset-be":W()}],top:[{top:W()}],right:[{right:W()}],bottom:[{bottom:W()}],left:[{left:W()}],visibility:["visible","invisible","collapse"],z:[{z:[Yi,"auto",Me,Oe]}],basis:[{basis:[Ki,"full","auto",f,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[st,Ki,"auto","initial","none",Oe]}],grow:[{grow:["",st,Me,Oe]}],shrink:[{shrink:["",st,Me,Oe]}],order:[{order:[Yi,"first","last","none",Me,Oe]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:V()}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:V()}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":me()}],"auto-rows":[{"auto-rows":me()}],gap:[{gap:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"justify-content":[{justify:[...te(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...te()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":te()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],p:[{p:D()}],px:[{px:D()}],py:[{py:D()}],ps:[{ps:D()}],pe:[{pe:D()}],pbs:[{pbs:D()}],pbe:[{pbe:D()}],pt:[{pt:D()}],pr:[{pr:D()}],pb:[{pb:D()}],pl:[{pl:D()}],m:[{m:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":D()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":D()}],"space-y-reverse":["space-y-reverse"],size:[{size:le()}],"inline-size":[{inline:["auto",...ee()]}],"min-inline-size":[{"min-inline":["auto",...ee()]}],"max-inline-size":[{"max-inline":["none",...ee()]}],"block-size":[{block:["auto",...ve()]}],"min-block-size":[{"min-block":["auto",...ve()]}],"max-block-size":[{"max-block":["none",...ve()]}],w:[{w:[f,"screen",...le()]}],"min-w":[{"min-w":[f,"screen","none",...le()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[c]},...le()]}],h:[{h:["screen","lh",...le()]}],"min-h":[{"min-h":["screen","lh","none",...le()]}],"max-h":[{"max-h":["screen","lh",...le()]}],"font-size":[{text:["base",n,Bu,Bs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,Xz,Zz]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ig,Oe]}],"font-family":[{font:[Qz,Gz,t]}],"font-features":[{"font-features":[Oe]}],"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,Me,Oe]}],"line-clamp":[{"line-clamp":[st,"none",Me,c1]}],leading:[{leading:[o,...D()]}],"list-image":[{"list-image":["none",Me,Oe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Me,Oe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Se(),"wavy"]}],"text-decoration-thickness":[{decoration:[st,"from-font","auto",Me,Bs]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[st,"auto",Me,Oe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Me,Oe]}],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",Me,Oe]}],"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:U()}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Yi,Me,Oe],radial:["",Me,Oe],conic:[Yi,Me,Oe]},Yz,Vz]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:Z()}],"rounded-s":[{"rounded-s":Z()}],"rounded-e":[{"rounded-e":Z()}],"rounded-t":[{"rounded-t":Z()}],"rounded-r":[{"rounded-r":Z()}],"rounded-b":[{"rounded-b":Z()}],"rounded-l":[{"rounded-l":Z()}],"rounded-ss":[{"rounded-ss":Z()}],"rounded-se":[{"rounded-se":Z()}],"rounded-ee":[{"rounded-ee":Z()}],"rounded-es":[{"rounded-es":Z()}],"rounded-tl":[{"rounded-tl":Z()}],"rounded-tr":[{"rounded-tr":Z()}],"rounded-br":[{"rounded-br":Z()}],"rounded-bl":[{"rounded-bl":Z()}],"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:[...Se(),"hidden","none"]}],"divide-style":[{divide:[...Se(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...Se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[st,Me,Oe]}],"outline-w":[{outline:["",st,Bu,Bs]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",p,hf,ff]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",g,hf,ff]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[st,Bs]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",S,hf,ff]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[st,Me,Oe]}],"mix-blend":[{"mix-blend":[...Re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Re()}],"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":[st]}],"mask-image-linear-from-pos":[{"mask-linear-from":je()}],"mask-image-linear-to-pos":[{"mask-linear-to":je()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":je()}],"mask-image-t-to-pos":[{"mask-t-to":je()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":je()}],"mask-image-r-to-pos":[{"mask-r-to":je()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":je()}],"mask-image-b-to-pos":[{"mask-b-to":je()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":je()}],"mask-image-l-to-pos":[{"mask-l-to":je()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":je()}],"mask-image-x-to-pos":[{"mask-x-to":je()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":je()}],"mask-image-y-to-pos":[{"mask-y-to":je()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Me,Oe]}],"mask-image-radial-from-pos":[{"mask-radial-from":je()}],"mask-image-radial-to-pos":[{"mask-radial-to":je()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":z()}],"mask-image-conic-pos":[{"mask-conic":[st]}],"mask-image-conic-from-pos":[{"mask-conic-from":je()}],"mask-image-conic-to-pos":[{"mask-conic-to":je()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Me,Oe]}],filter:[{filter:["","none",Me,Oe]}],blur:[{blur:$e()}],brightness:[{brightness:[st,Me,Oe]}],contrast:[{contrast:[st,Me,Oe]}],"drop-shadow":[{"drop-shadow":["","none",x,hf,ff]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",st,Me,Oe]}],"hue-rotate":[{"hue-rotate":[st,Me,Oe]}],invert:[{invert:["",st,Me,Oe]}],saturate:[{saturate:[st,Me,Oe]}],sepia:[{sepia:["",st,Me,Oe]}],"backdrop-filter":[{"backdrop-filter":["","none",Me,Oe]}],"backdrop-blur":[{"backdrop-blur":$e()}],"backdrop-brightness":[{"backdrop-brightness":[st,Me,Oe]}],"backdrop-contrast":[{"backdrop-contrast":[st,Me,Oe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",st,Me,Oe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[st,Me,Oe]}],"backdrop-invert":[{"backdrop-invert":["",st,Me,Oe]}],"backdrop-opacity":[{"backdrop-opacity":[st,Me,Oe]}],"backdrop-saturate":[{"backdrop-saturate":[st,Me,Oe]}],"backdrop-sepia":[{"backdrop-sepia":["",st,Me,Oe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":D()}],"border-spacing-x":[{"border-spacing-x":D()}],"border-spacing-y":[{"border-spacing-y":D()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Me,Oe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[st,"initial",Me,Oe]}],ease:[{ease:["linear","initial",C,Me,Oe]}],delay:[{delay:[st,Me,Oe]}],animate:[{animate:["none",_,Me,Oe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,Me,Oe]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:Ie()}],"rotate-x":[{"rotate-x":Ie()}],"rotate-y":[{"rotate-y":Ie()}],"rotate-z":[{"rotate-z":Ie()}],scale:[{scale:Ke()}],"scale-x":[{"scale-x":Ke()}],"scale-y":[{"scale-y":Ke()}],"scale-z":[{"scale-z":Ke()}],"scale-3d":["scale-3d"],skew:[{skew:et()}],"skew-x":[{"skew-x":et()}],"skew-y":[{"skew-y":et()}],transform:[{transform:[Me,Oe,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:wt()}],"translate-x":[{"translate-x":wt()}],"translate-y":[{"translate-y":wt()}],"translate-z":[{"translate-z":wt()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Me,Oe]}],"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":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mbs":[{"scroll-mbs":D()}],"scroll-mbe":[{"scroll-mbe":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pbs":[{"scroll-pbs":D()}],"scroll-pbe":[{"scroll-pbe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"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",Me,Oe]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[st,Bu,Bs,c1]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},eD=Oz(Jz);function ze(...e){return eD(QE(e))}function fc(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 uC(e){return e?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(e)):"—"}function tD(e){return Ee.delete(`/clients/${encodeURIComponent(e)}`)}function Pc(){return Ee.get(gn("/activity"))}function pi(){return Ee.get("/me/clients")}function nD(){return Ee.get(gn("/clients"))}function ph(e){return Ee.get(`/clients/${e}`)}function rD(e){return Ee.post(`/clients/${e}/disconnect`)}function aD(){return Ee.post("/me/connect-tokens")}const h1=e=>["agent-sessions",e];function iD(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 sD(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 cC(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 oD(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 m1=1,uD=.9,cD=.8,dD=.17,sg=.1,lg=.999,fD=.9999,hD=.99,mD=/[\\\/_+.#"@\[\(\{&]/,pD=/[\\\/_+.#"@\[\(\{&]/g,gD=/[\s-]/,dC=/[\s-]/g;function Ry(e,t,n,a,s,o,c){if(o===t.length)return s===e.length?m1: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,S,x,j;h>=0;)g=Ry(e,t,n,a,h+1,o+1,c),g>p&&(h===s?g*=m1:mD.test(e.charAt(h-1))?(g*=cD,x=e.slice(s,h-1).match(pD),x&&s>0&&(g*=Math.pow(lg,x.length))):gD.test(e.charAt(h-1))?(g*=uD,j=e.slice(s,h-1).match(dC),j&&s>0&&(g*=Math.pow(lg,j.length))):(g*=dD,s>0&&(g*=Math.pow(lg,h-s))),e.charAt(h)!==t.charAt(o)&&(g*=fD)),(g<sg&&n.charAt(h-1)===a.charAt(o+1)||a.charAt(o+1)===a.charAt(o)&&n.charAt(h-1)!==a.charAt(o))&&(S=Ry(e,t,n,a,h+1,o+2,c),S*sg>g&&(g=S*sg)),g>p&&(p=g),h=n.indexOf(m,h+1);return c[f]=p,p}function p1(e){return e.toLowerCase().replace(dC," ")}function yD(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Ry(e,t,p1(e),p1(t),0,0,{})}function hs(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 g1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ps(...e){return t=>{let n=!1;const a=e.map(s=>{const o=g1(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():g1(e[s],null)}}}}function sl(...e){return b.useCallback(ps(...e),e)}function vD(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 bD(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:S,children:x,...j}=g,k=((C=S==null?void 0:S[e])==null?void 0:C[m])||f,w=b.useMemo(()=>j,Object.values(j));return l.jsx(k.Provider,{value:w,children:x})};h.displayName=o+"Provider";function p(g,S){var k;const x=((k=S==null?void 0:S[e])==null?void 0:k[m])||f,j=b.useContext(x);if(j)return j;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,xD(s,...t)]}function xD(...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 hc=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},SD=dv[" useId ".trim().toString()]||(()=>{}),wD=0;function ci(e){const[t,n]=b.useState(SD());return hc(()=>{n(a=>a??String(wD++))},[e]),t?`radix-${t}`:""}var kD=dv[" useInsertionEffect ".trim().toString()]||hc;function jD({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[s,o,c]=ED({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 S=CD(p)?p(e):p;S!==e&&((g=c.current)==null||g.call(c,S))}else o(p)},[f,e,o,c]);return[m,h]}function ED({defaultProp:e,onChange:t}){const[n,a]=b.useState(e),s=b.useRef(n),o=b.useRef(t);return kD(()=>{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 CD(e){return typeof e=="function"}var Uv=Qj();const ND=oh(Uv);function fC(e){const t=_D(e),n=b.forwardRef((a,s)=>{const{children:o,...c}=a,f=b.Children.toArray(o),m=f.find(AD);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 _D(e){const t=b.forwardRef((n,a)=>{const{children:s,...o}=n;if(b.isValidElement(s)){const c=OD(s),f=RD(o,s.props);return s.type!==b.Fragment&&(f.ref=a?ps(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 TD=Symbol("radix.slottable");function AD(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===TD}function RD(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 OD(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 MD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],gi=MD.reduce((e,t)=>{const n=fC(`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 zD(e,t){e&&Uv.flushSync(()=>e.dispatchEvent(t))}function mc(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 DD(e,t=globalThis==null?void 0:globalThis.document){const n=mc(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 ID="DismissableLayer",Oy="dismissableLayer.update",LD="dismissableLayer.pointerDownOutside",PD="dismissableLayer.focusOutside",y1,hC=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),mC=b.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:c,onDismiss:f,...m}=e,h=b.useContext(hC),[p,g]=b.useState(null),S=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=b.useState({}),j=sl(t,F=>g(F)),k=Array.from(h.layers),[w]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),C=k.indexOf(w),_=p?k.indexOf(p):-1,R=h.layersWithOutsidePointerEventsDisabled.size>0,z=_>=C,I=FD(F=>{const D=F.target,W=[...h.branches].some(L=>L.contains(D));!z||W||(s==null||s(F),c==null||c(F),F.defaultPrevented||f==null||f())},S),O=$D(F=>{const D=F.target;[...h.branches].some(L=>L.contains(D))||(o==null||o(F),c==null||c(F),F.defaultPrevented||f==null||f())},S);return DD(F=>{_===h.layers.size-1&&(a==null||a(F),!F.defaultPrevented&&f&&(F.preventDefault(),f()))},S),b.useEffect(()=>{if(p)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(y1=S.body.style.pointerEvents,S.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(p)),h.layers.add(p),v1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(S.body.style.pointerEvents=y1)}},[p,S,n,h]),b.useEffect(()=>()=>{p&&(h.layers.delete(p),h.layersWithOutsidePointerEventsDisabled.delete(p),v1())},[p,h]),b.useEffect(()=>{const F=()=>x({});return document.addEventListener(Oy,F),()=>document.removeEventListener(Oy,F)},[]),l.jsx(gi.div,{...m,ref:j,style:{pointerEvents:R?z?"auto":"none":void 0,...e.style},onFocusCapture:hs(e.onFocusCapture,O.onFocusCapture),onBlurCapture:hs(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:hs(e.onPointerDownCapture,I.onPointerDownCapture)})});mC.displayName=ID;var UD="DismissableLayerBranch",BD=b.forwardRef((e,t)=>{const n=b.useContext(hC),a=b.useRef(null),s=sl(t,a);return b.useEffect(()=>{const o=a.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),l.jsx(gi.div,{...e,ref:s})});BD.displayName=UD;function FD(e,t=globalThis==null?void 0:globalThis.document){const n=mc(e),a=b.useRef(!1),s=b.useRef(()=>{});return b.useEffect(()=>{const o=f=>{if(f.target&&!a.current){let m=function(){pC(LD,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 $D(e,t=globalThis==null?void 0:globalThis.document){const n=mc(e),a=b.useRef(!1);return b.useEffect(()=>{const s=o=>{o.target&&!a.current&&pC(PD,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 v1(){const e=new CustomEvent(Oy);document.dispatchEvent(e)}function pC(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?zD(s,o):s.dispatchEvent(o)}var og="focusScope.autoFocusOnMount",ug="focusScope.autoFocusOnUnmount",b1={bubbles:!1,cancelable:!0},HD="FocusScope",gC=b.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...c}=e,[f,m]=b.useState(null),h=mc(s),p=mc(o),g=b.useRef(null),S=sl(t,k=>m(k)),x=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(a){let k=function(R){if(x.paused||!f)return;const z=R.target;f.contains(z)?g.current=z:Ji(g.current,{select:!0})},w=function(R){if(x.paused||!f)return;const z=R.relatedTarget;z!==null&&(f.contains(z)||Ji(g.current,{select:!0}))},C=function(R){if(document.activeElement===document.body)for(const I of R)I.removedNodes.length>0&&Ji(f)};document.addEventListener("focusin",k),document.addEventListener("focusout",w);const _=new MutationObserver(C);return f&&_.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",k),document.removeEventListener("focusout",w),_.disconnect()}}},[a,f,x.paused]),b.useEffect(()=>{if(f){S1.add(x);const k=document.activeElement;if(!f.contains(k)){const C=new CustomEvent(og,b1);f.addEventListener(og,h),f.dispatchEvent(C),C.defaultPrevented||(qD(KD(yC(f)),{select:!0}),document.activeElement===k&&Ji(f))}return()=>{f.removeEventListener(og,h),setTimeout(()=>{const C=new CustomEvent(ug,b1);f.addEventListener(ug,p),f.dispatchEvent(C),C.defaultPrevented||Ji(k??document.body,{select:!0}),f.removeEventListener(ug,p),S1.remove(x)},0)}}},[f,h,p,x]);const j=b.useCallback(k=>{if(!n&&!a||x.paused)return;const w=k.key==="Tab"&&!k.altKey&&!k.ctrlKey&&!k.metaKey,C=document.activeElement;if(w&&C){const _=k.currentTarget,[R,z]=ZD(_);R&&z?!k.shiftKey&&C===z?(k.preventDefault(),n&&Ji(R,{select:!0})):k.shiftKey&&C===R&&(k.preventDefault(),n&&Ji(z,{select:!0})):C===_&&k.preventDefault()}},[n,a,x.paused]);return l.jsx(gi.div,{tabIndex:-1,...c,ref:S,onKeyDown:j})});gC.displayName=HD;function qD(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(Ji(a,{select:t}),document.activeElement!==n)return}function ZD(e){const t=yC(e),n=x1(t,e),a=x1(t.reverse(),e);return[n,a]}function yC(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 x1(e,t){for(const n of e)if(!GD(n,{upTo:t}))return n}function GD(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 VD(e){return e instanceof HTMLInputElement&&"select"in e}function Ji(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&VD(e)&&t&&e.select()}}var S1=QD();function QD(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=w1(e,t),e.unshift(t)},remove(t){var n;e=w1(e,t),(n=e[0])==null||n.resume()}}}function w1(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function KD(e){return e.filter(t=>t.tagName!=="A")}var YD="Portal",vC=b.forwardRef((e,t)=>{var f;const{container:n,...a}=e,[s,o]=b.useState(!1);hc(()=>o(!0),[]);const c=n||s&&((f=globalThis==null?void 0:globalThis.document)==null?void 0:f.body);return c?ND.createPortal(l.jsx(gi.div,{...a,ref:t}),c):null});vC.displayName=YD;function XD(e,t){return b.useReducer((n,a)=>t[n][a]??n,e)}var gh=e=>{const{present:t,children:n}=e,a=WD(t),s=typeof n=="function"?n({present:a.isPresent}):b.Children.only(n),o=sl(a.ref,JD(s));return typeof n=="function"||a.isPresent?b.cloneElement(s,{ref:o}):null};gh.displayName="Presence";function WD(e){const[t,n]=b.useState(),a=b.useRef(null),s=b.useRef(e),o=b.useRef("none"),c=e?"mounted":"unmounted",[f,m]=XD(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=mf(a.current);o.current=f==="mounted"?h:"none"},[f]),hc(()=>{const h=a.current,p=s.current;if(p!==e){const S=o.current,x=mf(h);e?m("MOUNT"):x==="none"||(h==null?void 0:h.display)==="none"?m("UNMOUNT"):m(p&&S!==x?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,m]),hc(()=>{if(t){let h;const p=t.ownerDocument.defaultView??window,g=x=>{const k=mf(a.current).includes(CSS.escape(x.animationName));if(x.target===t&&k&&(m("ANIMATION_END"),!s.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",h=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},S=x=>{x.target===t&&(o.current=mf(a.current))};return t.addEventListener("animationstart",S),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{p.clearTimeout(h),t.removeEventListener("animationstart",S),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 mf(e){return(e==null?void 0:e.animationName)||"none"}function JD(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 cg=0;function eI(){b.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??k1()),document.body.insertAdjacentElement("beforeend",e[1]??k1()),cg++,()=>{cg===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),cg--}},[])}function k1(){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 za=function(){return za=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},za.apply(this,arguments)};function bC(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 tI(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 Df="right-scroll-bar-position",If="width-before-scroll-bar",nI="with-scroll-bars-hidden",rI="--removed-body-scroll-bar-size";function dg(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function aI(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 iI=typeof window<"u"?b.useLayoutEffect:b.useEffect,j1=new WeakMap;function sI(e,t){var n=aI(null,function(a){return e.forEach(function(s){return dg(s,a)})});return iI(function(){var a=j1.get(n);if(a){var s=new Set(a),o=new Set(e),c=n.current;s.forEach(function(f){o.has(f)||dg(f,null)}),o.forEach(function(f){s.has(f)||dg(f,c)})}j1.set(n,e)},[e]),n}function lI(e){return e}function oI(e,t){t===void 0&&(t=lI);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 uI(e){e===void 0&&(e={});var t=oI(null);return t.options=za({async:!0,ssr:!1},e),t}var xC=function(e){var t=e.sideCar,n=bC(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,za({},n))};xC.isSideCarExport=!0;function cI(e,t){return e.useMedium(t),xC}var SC=uI(),fg=function(){},yh=b.forwardRef(function(e,t){var n=b.useRef(null),a=b.useState({onScrollCapture:fg,onWheelCapture:fg,onTouchMoveCapture:fg}),s=a[0],o=a[1],c=e.forwardProps,f=e.children,m=e.className,h=e.removeScrollBar,p=e.enabled,g=e.shards,S=e.sideCar,x=e.noRelative,j=e.noIsolation,k=e.inert,w=e.allowPinchZoom,C=e.as,_=C===void 0?"div":C,R=e.gapMode,z=bC(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),I=S,O=sI([n,t]),F=za(za({},z),s);return b.createElement(b.Fragment,null,p&&b.createElement(I,{sideCar:SC,removeScrollBar:h,shards:g,noRelative:x,noIsolation:j,inert:k,setCallbacks:o,allowPinchZoom:!!w,lockRef:n,gapMode:R}),c?b.cloneElement(b.Children.only(f),za(za({},F),{ref:O})):b.createElement(_,za({},F,{className:m,ref:O}),f))});yh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};yh.classNames={fullWidth:If,zeroRight:Df};var dI=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function fI(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=dI();return t&&e.setAttribute("nonce",t),e}function hI(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function mI(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var pI=function(){var e=0,t=null;return{add:function(n){e==0&&(t=fI())&&(hI(t,n),mI(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},gI=function(){var e=pI();return function(t,n){b.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},wC=function(){var e=gI(),t=function(n){var a=n.styles,s=n.dynamic;return e(a,s),null};return t},yI={left:0,top:0,right:0,gap:0},hg=function(e){return parseInt(e||"",10)||0},vI=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[hg(n),hg(a),hg(s)]},bI=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return yI;var t=vI(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])}},xI=wC(),io="data-scroll-locked",SI=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(nI,` {
|
|
307
|
-
overflow: hidden `).concat(a,`;
|
|
308
|
-
padding-right: `).concat(f,"px ").concat(a,`;
|
|
309
|
-
}
|
|
310
|
-
body[`).concat(io,`] {
|
|
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(Df,` {
|
|
324
|
-
right: `).concat(f,"px ").concat(a,`;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
.`).concat(If,` {
|
|
328
|
-
margin-right: `).concat(f,"px ").concat(a,`;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
.`).concat(Df," .").concat(Df,` {
|
|
332
|
-
right: 0 `).concat(a,`;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
.`).concat(If," .").concat(If,` {
|
|
336
|
-
margin-right: 0 `).concat(a,`;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
body[`).concat(io,`] {
|
|
340
|
-
`).concat(rI,": ").concat(f,`px;
|
|
341
|
-
}
|
|
342
|
-
`)},E1=function(){var e=parseInt(document.body.getAttribute(io)||"0",10);return isFinite(e)?e:0},wI=function(){b.useEffect(function(){return document.body.setAttribute(io,(E1()+1).toString()),function(){var e=E1()-1;e<=0?document.body.removeAttribute(io):document.body.setAttribute(io,e.toString())}},[])},kI=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,s=a===void 0?"margin":a;wI();var o=b.useMemo(function(){return bI(s)},[s]);return b.createElement(xI,{styles:SI(o,!t,s,n?"":"!important")})},My=!1;if(typeof window<"u")try{var pf=Object.defineProperty({},"passive",{get:function(){return My=!0,!0}});window.addEventListener("test",pf,pf),window.removeEventListener("test",pf,pf)}catch{My=!1}var Hl=My?{passive:!1}:!1,jI=function(e){return e.tagName==="TEXTAREA"},kC=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!jI(e)&&n[t]==="visible")},EI=function(e){return kC(e,"overflowY")},CI=function(e){return kC(e,"overflowX")},C1=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var s=jC(e,a);if(s){var o=EC(e,a),c=o[1],f=o[2];if(c>f)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},NI=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},_I=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},jC=function(e,t){return e==="v"?EI(t):CI(t)},EC=function(e,t){return e==="v"?NI(t):_I(t)},TI=function(e,t){return e==="h"&&t==="rtl"?-1:1},AI=function(e,t,n,a,s){var o=TI(e,window.getComputedStyle(t).direction),c=o*a,f=n.target,m=t.contains(f),h=!1,p=c>0,g=0,S=0;do{if(!f)break;var x=EC(e,f),j=x[0],k=x[1],w=x[2],C=k-w-o*j;(j||C)&&jC(e,f)&&(g+=C,S+=j);var _=f.parentNode;f=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!m&&f!==document.body||m&&(t.contains(f)||t===f));return(p&&Math.abs(g)<1||!p&&Math.abs(S)<1)&&(h=!0),h},gf=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},N1=function(e){return[e.deltaX,e.deltaY]},_1=function(e){return e&&"current"in e?e.current:e},RI=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
|
-
`)},MI=0,ql=[];function zI(e){var t=b.useRef([]),n=b.useRef([0,0]),a=b.useRef(),s=b.useState(MI++)[0],o=b.useState(wC)[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=tI([e.lockRef.current],(e.shards||[]).map(_1),!0).filter(Boolean);return k.forEach(function(w){return w.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),k.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var f=b.useCallback(function(k,w){if("touches"in k&&k.touches.length===2||k.type==="wheel"&&k.ctrlKey)return!c.current.allowPinchZoom;var C=gf(k),_=n.current,R="deltaX"in k?k.deltaX:_[0]-C[0],z="deltaY"in k?k.deltaY:_[1]-C[1],I,O=k.target,F=Math.abs(R)>Math.abs(z)?"h":"v";if("touches"in k&&F==="h"&&O.type==="range")return!1;var D=window.getSelection(),W=D&&D.anchorNode,L=W?W===O||W.contains(O):!1;if(L)return!1;var V=C1(F,O);if(!V)return!0;if(V?I=F:(I=F==="v"?"h":"v",V=C1(F,O)),!V)return!1;if(!a.current&&"changedTouches"in k&&(R||z)&&(a.current=I),!I)return!0;var Y=a.current||I;return AI(Y,w,k,Y==="h"?R:z)},[]),m=b.useCallback(function(k){var w=k;if(!(!ql.length||ql[ql.length-1]!==o)){var C="deltaY"in w?N1(w):gf(w),_=t.current.filter(function(I){return I.name===w.type&&(I.target===w.target||w.target===I.shadowParent)&&RI(I.delta,C)})[0];if(_&&_.should){w.cancelable&&w.preventDefault();return}if(!_){var R=(c.current.shards||[]).map(_1).filter(Boolean).filter(function(I){return I.contains(w.target)}),z=R.length>0?f(w,R[0]):!c.current.noIsolation;z&&w.cancelable&&w.preventDefault()}}},[]),h=b.useCallback(function(k,w,C,_){var R={name:k,delta:w,target:C,should:_,shadowParent:DI(C)};t.current.push(R),setTimeout(function(){t.current=t.current.filter(function(z){return z!==R})},1)},[]),p=b.useCallback(function(k){n.current=gf(k),a.current=void 0},[]),g=b.useCallback(function(k){h(k.type,N1(k),k.target,f(k,e.lockRef.current))},[]),S=b.useCallback(function(k){h(k.type,gf(k),k.target,f(k,e.lockRef.current))},[]);b.useEffect(function(){return ql.push(o),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:S}),document.addEventListener("wheel",m,Hl),document.addEventListener("touchmove",m,Hl),document.addEventListener("touchstart",p,Hl),function(){ql=ql.filter(function(k){return k!==o}),document.removeEventListener("wheel",m,Hl),document.removeEventListener("touchmove",m,Hl),document.removeEventListener("touchstart",p,Hl)}},[]);var x=e.removeScrollBar,j=e.inert;return b.createElement(b.Fragment,null,j?b.createElement(o,{styles:OI(s)}):null,x?b.createElement(kI,{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 II=cI(SC,zI);var CC=b.forwardRef(function(e,t){return b.createElement(yh,za({},e,{ref:t,sideCar:II}))});CC.classNames=yh.classNames;var LI=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Zl=new WeakMap,yf=new WeakMap,vf={},mg=0,NC=function(e){return e&&(e.host||NC(e.parentNode))},PI=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=NC(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})},UI=function(e,t,n,a){var s=PI(t,Array.isArray(e)?e:[e]);vf[n]||(vf[n]=new WeakMap);var o=vf[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(S){if(f.has(S))p(S);else try{var x=S.getAttribute(a),j=x!==null&&x!=="false",k=(Zl.get(S)||0)+1,w=(o.get(S)||0)+1;Zl.set(S,k),o.set(S,w),c.push(S),k===1&&j&&yf.set(S,!0),w===1&&S.setAttribute(n,"true"),j||S.setAttribute(a,"true")}catch(C){console.error("aria-hidden: cannot operate on ",S,C)}})};return p(t),f.clear(),mg++,function(){c.forEach(function(g){var S=Zl.get(g)-1,x=o.get(g)-1;Zl.set(g,S),o.set(g,x),S||(yf.has(g)||g.removeAttribute(a),yf.delete(g)),x||g.removeAttribute(n)}),mg--,mg||(Zl=new WeakMap,Zl=new WeakMap,yf=new WeakMap,vf={})}},BI=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),s=LI(e);return s?(a.push.apply(a,Array.from(s.querySelectorAll("[aria-live], script"))),UI(a,s,n,"aria-hidden")):function(){return null}},vh="Dialog",[_C]=bD(vh),[FI,ja]=_C(vh),TC=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:s,onOpenChange:o,modal:c=!0}=e,f=b.useRef(null),m=b.useRef(null),[h,p]=jD({prop:a,defaultProp:s??!1,onChange:o,caller:vh});return l.jsx(FI,{scope:t,triggerRef:f,contentRef:m,contentId:ci(),titleId:ci(),descriptionId:ci(),open:h,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(g=>!g),[p]),modal:c,children:n})};TC.displayName=vh;var AC="DialogTrigger",$I=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=ja(AC,n),o=sl(t,s.triggerRef);return l.jsx(gi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":$v(s.open),...a,ref:o,onClick:hs(e.onClick,s.onOpenToggle)})});$I.displayName=AC;var Bv="DialogPortal",[HI,RC]=_C(Bv,{forceMount:void 0}),OC=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:s}=e,o=ja(Bv,t);return l.jsx(HI,{scope:t,forceMount:n,children:b.Children.map(a,c=>l.jsx(gh,{present:n||o.open,children:l.jsx(vC,{asChild:!0,container:s,children:c})}))})};OC.displayName=Bv;var Gf="DialogOverlay",MC=b.forwardRef((e,t)=>{const n=RC(Gf,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,o=ja(Gf,e.__scopeDialog);return o.modal?l.jsx(gh,{present:a||o.open,children:l.jsx(ZI,{...s,ref:t})}):null});MC.displayName=Gf;var qI=fC("DialogOverlay.RemoveScroll"),ZI=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=ja(Gf,n);return l.jsx(CC,{as:qI,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(gi.div,{"data-state":$v(s.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),el="DialogContent",zC=b.forwardRef((e,t)=>{const n=RC(el,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,o=ja(el,e.__scopeDialog);return l.jsx(gh,{present:a||o.open,children:o.modal?l.jsx(GI,{...s,ref:t}):l.jsx(VI,{...s,ref:t})})});zC.displayName=el;var GI=b.forwardRef((e,t)=>{const n=ja(el,e.__scopeDialog),a=b.useRef(null),s=sl(t,n.contentRef,a);return b.useEffect(()=>{const o=a.current;if(o)return BI(o)},[]),l.jsx(DC,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:hs(e.onCloseAutoFocus,o=>{var c;o.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:hs(e.onPointerDownOutside,o=>{const c=o.detail.originalEvent,f=c.button===0&&c.ctrlKey===!0;(c.button===2||f)&&o.preventDefault()}),onFocusOutside:hs(e.onFocusOutside,o=>o.preventDefault())})}),VI=b.forwardRef((e,t)=>{const n=ja(el,e.__scopeDialog),a=b.useRef(!1),s=b.useRef(!1);return l.jsx(DC,{...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()}})}),DC=b.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:o,...c}=e,f=ja(el,n),m=b.useRef(null),h=sl(t,m);return eI(),l.jsxs(l.Fragment,{children:[l.jsx(gC,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(mC,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":$v(f.open),...c,ref:h,onDismiss:()=>f.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(QI,{titleId:f.titleId}),l.jsx(YI,{contentRef:m,descriptionId:f.descriptionId})]})]})}),Fv="DialogTitle",IC=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=ja(Fv,n);return l.jsx(gi.h2,{id:s.titleId,...a,ref:t})});IC.displayName=Fv;var LC="DialogDescription",PC=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=ja(LC,n);return l.jsx(gi.p,{id:s.descriptionId,...a,ref:t})});PC.displayName=LC;var UC="DialogClose",BC=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=ja(UC,n);return l.jsx(gi.button,{type:"button",...a,ref:t,onClick:hs(e.onClick,()=>s.onOpenChange(!1))})});BC.displayName=UC;function $v(e){return e?"open":"closed"}var FC="DialogTitleWarning",[rW,$C]=vD(FC,{contentName:el,titleName:Fv,docsSlug:"dialog"}),QI=({titleId:e})=>{const t=$C(FC),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},KI="DialogDescriptionWarning",YI=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$C(KI).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},HC=TC,qC=OC,ZC=MC,GC=zC,XI=IC,WI=PC,JI=BC,e4=Symbol.for("react.lazy"),Vf=dv[" use ".trim().toString()];function t4(e){return typeof e=="object"&&e!==null&&"then"in e}function VC(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===e4&&"_payload"in e&&t4(e._payload)}function QC(e){const t=r4(e),n=b.forwardRef((a,s)=>{let{children:o,...c}=a;VC(o)&&typeof Vf=="function"&&(o=Vf(o._payload));const f=b.Children.toArray(o),m=f.find(i4);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 n4=QC("Slot");function r4(e){const t=b.forwardRef((n,a)=>{let{children:s,...o}=n;if(VC(s)&&typeof Vf=="function"&&(s=Vf(s._payload)),b.isValidElement(s)){const c=l4(s),f=s4(o,s.props);return s.type!==b.Fragment&&(f.ref=a?ps(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 a4=Symbol("radix.slottable");function i4(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===a4}function s4(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 l4(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 o4=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],yi=o4.reduce((e,t)=>{const n=QC(`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}},{}),Fu='[cmdk-group=""]',pg='[cmdk-group-items=""]',u4='[cmdk-group-heading=""]',KC='[cmdk-item=""]',T1=`${KC}:not([aria-disabled="true"])`,zy="cmdk-item-select",Kl="data-value",c4=(e,t,n)=>yD(e,t,n),YC=b.createContext(void 0),Uc=()=>b.useContext(YC),XC=b.createContext(void 0),Hv=()=>b.useContext(XC),WC=b.createContext(void 0),JC=b.forwardRef((e,t)=>{let n=Yl(()=>{var U,T;return{search:"",value:(T=(U=e.value)!=null?U:e.defaultValue)!=null?T:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=Yl(()=>new Set),s=Yl(()=>new Map),o=Yl(()=>new Map),c=Yl(()=>new Set),f=eN(e),{label:m,children:h,value:p,onValueChange:g,filter:S,shouldFilter:x,loop:j,disablePointerSelection:k=!1,vimBindings:w=!0,...C}=e,_=ci(),R=ci(),z=ci(),I=b.useRef(null),O=S4();tl(()=>{if(p!==void 0){let U=p.trim();n.current.value=U,F.emit()}},[p]),tl(()=>{O(6,me)},[]);let F=b.useMemo(()=>({subscribe:U=>(c.current.add(U),()=>c.current.delete(U)),snapshot:()=>n.current,setState:(U,T,G)=>{var Z,ae,Se,Re;if(!Object.is(n.current[U],T)){if(n.current[U]=T,U==="search")Y(),L(),O(1,V);else if(U==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let je=document.getElementById(z);je?je.focus():(Z=document.getElementById(_))==null||Z.focus()}if(O(7,()=>{var je;n.current.selectedItemId=(je=te())==null?void 0:je.id,F.emit()}),G||O(5,me),((ae=f.current)==null?void 0:ae.value)!==void 0){let je=T??"";(Re=(Se=f.current).onValueChange)==null||Re.call(Se,je);return}}F.emit()}},emit:()=>{c.current.forEach(U=>U())}}),[]),D=b.useMemo(()=>({value:(U,T,G)=>{var Z;T!==((Z=o.current.get(U))==null?void 0:Z.value)&&(o.current.set(U,{value:T,keywords:G}),n.current.filtered.items.set(U,W(T,G)),O(2,()=>{L(),F.emit()}))},item:(U,T)=>(a.current.add(U),T&&(s.current.has(T)?s.current.get(T).add(U):s.current.set(T,new Set([U]))),O(3,()=>{Y(),L(),n.current.value||V(),F.emit()}),()=>{o.current.delete(U),a.current.delete(U),n.current.filtered.items.delete(U);let G=te();O(4,()=>{Y(),(G==null?void 0:G.getAttribute("id"))===U&&V(),F.emit()})}),group:U=>(s.current.has(U)||s.current.set(U,new Set),()=>{o.current.delete(U),s.current.delete(U)}),filter:()=>f.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>f.current.disablePointerSelection,listId:_,inputId:z,labelId:R,listInnerRef:I}),[]);function W(U,T){var G,Z;let ae=(Z=(G=f.current)==null?void 0:G.filter)!=null?Z:c4;return U?ae(U,n.current.search,T):0}function L(){if(!n.current.search||f.current.shouldFilter===!1)return;let U=n.current.filtered.items,T=[];n.current.filtered.groups.forEach(Z=>{let ae=s.current.get(Z),Se=0;ae.forEach(Re=>{let je=U.get(Re);Se=Math.max(je,Se)}),T.push([Z,Se])});let G=I.current;J().sort((Z,ae)=>{var Se,Re;let je=Z.getAttribute("id"),$e=ae.getAttribute("id");return((Se=U.get($e))!=null?Se:0)-((Re=U.get(je))!=null?Re:0)}).forEach(Z=>{let ae=Z.closest(pg);ae?ae.appendChild(Z.parentElement===ae?Z:Z.closest(`${pg} > *`)):G.appendChild(Z.parentElement===G?Z:Z.closest(`${pg} > *`))}),T.sort((Z,ae)=>ae[1]-Z[1]).forEach(Z=>{var ae;let Se=(ae=I.current)==null?void 0:ae.querySelector(`${Fu}[${Kl}="${encodeURIComponent(Z[0])}"]`);Se==null||Se.parentElement.appendChild(Se)})}function V(){let U=J().find(G=>G.getAttribute("aria-disabled")!=="true"),T=U==null?void 0:U.getAttribute(Kl);F.setState("value",T||void 0)}function Y(){var U,T,G,Z;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 Se of a.current){let Re=(T=(U=o.current.get(Se))==null?void 0:U.value)!=null?T:"",je=(Z=(G=o.current.get(Se))==null?void 0:G.keywords)!=null?Z:[],$e=W(Re,je);n.current.filtered.items.set(Se,$e),$e>0&&ae++}for(let[Se,Re]of s.current)for(let je of Re)if(n.current.filtered.items.get(je)>0){n.current.filtered.groups.add(Se);break}n.current.filtered.count=ae}function me(){var U,T,G;let Z=te();Z&&(((U=Z.parentElement)==null?void 0:U.firstChild)===Z&&((G=(T=Z.closest(Fu))==null?void 0:T.querySelector(u4))==null||G.scrollIntoView({block:"nearest"})),Z.scrollIntoView({block:"nearest"}))}function te(){var U;return(U=I.current)==null?void 0:U.querySelector(`${KC}[aria-selected="true"]`)}function J(){var U;return Array.from(((U=I.current)==null?void 0:U.querySelectorAll(T1))||[])}function q(U){let T=J()[U];T&&F.setState("value",T.getAttribute(Kl))}function le(U){var T;let G=te(),Z=J(),ae=Z.findIndex(Re=>Re===G),Se=Z[ae+U];(T=f.current)!=null&&T.loop&&(Se=ae+U<0?Z[Z.length-1]:ae+U===Z.length?Z[0]:Z[ae+U]),Se&&F.setState("value",Se.getAttribute(Kl))}function ee(U){let T=te(),G=T==null?void 0:T.closest(Fu),Z;for(;G&&!Z;)G=U>0?b4(G,Fu):x4(G,Fu),Z=G==null?void 0:G.querySelector(T1);Z?F.setState("value",Z.getAttribute(Kl)):le(U)}let ve=()=>q(J().length-1),M=U=>{U.preventDefault(),U.metaKey?ve():U.altKey?ee(1):le(1)},P=U=>{U.preventDefault(),U.metaKey?q(0):U.altKey?ee(-1):le(-1)};return b.createElement(yi.div,{ref:t,tabIndex:-1,...C,"cmdk-root":"",onKeyDown:U=>{var T;(T=C.onKeyDown)==null||T.call(C,U);let G=U.nativeEvent.isComposing||U.keyCode===229;if(!(U.defaultPrevented||G))switch(U.key){case"n":case"j":{w&&U.ctrlKey&&M(U);break}case"ArrowDown":{M(U);break}case"p":case"k":{w&&U.ctrlKey&&P(U);break}case"ArrowUp":{P(U);break}case"Home":{U.preventDefault(),q(0);break}case"End":{U.preventDefault(),ve();break}case"Enter":{U.preventDefault();let Z=te();if(Z){let ae=new Event(zy);Z.dispatchEvent(ae)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:D.inputId,id:D.labelId,style:k4},m),bh(e,U=>b.createElement(XC.Provider,{value:F},b.createElement(YC.Provider,{value:D},U))))}),d4=b.forwardRef((e,t)=>{var n,a;let s=ci(),o=b.useRef(null),c=b.useContext(WC),f=Uc(),m=eN(e),h=(a=(n=m.current)==null?void 0:n.forceMount)!=null?a:c==null?void 0:c.forceMount;tl(()=>{if(!h)return f.item(s,c==null?void 0:c.id)},[h]);let p=tN(s,o,[e.value,e.children,o],e.keywords),g=Hv(),S=gs(O=>O.value&&O.value===p.current),x=gs(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(zy,j),()=>O.removeEventListener(zy,j)},[x,e.onSelect,e.disabled]);function j(){var O,F;k(),(F=(O=m.current).onSelect)==null||F.call(O,p.current)}function k(){g.setState("value",p.current,!0)}if(!x)return null;let{disabled:w,value:C,onSelect:_,forceMount:R,keywords:z,...I}=e;return b.createElement(yi.div,{ref:ps(o,t),...I,id:s,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!S,"data-disabled":!!w,"data-selected":!!S,onPointerMove:w||f.getDisablePointerSelection()?void 0:k,onClick:w?void 0:j},e.children)}),f4=b.forwardRef((e,t)=>{let{heading:n,children:a,forceMount:s,...o}=e,c=ci(),f=b.useRef(null),m=b.useRef(null),h=ci(),p=Uc(),g=gs(x=>s||p.filter()===!1?!0:x.search?x.filtered.groups.has(c):!0);tl(()=>p.group(c),[]),tN(c,f,[e.value,e.heading,m]);let S=b.useMemo(()=>({id:c,forceMount:s}),[s]);return b.createElement(yi.div,{ref:ps(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),bh(e,x=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},b.createElement(WC.Provider,{value:S},x))))}),h4=b.forwardRef((e,t)=>{let{alwaysRender:n,...a}=e,s=b.useRef(null),o=gs(c=>!c.search);return!n&&!o?null:b.createElement(yi.div,{ref:ps(s,t),...a,"cmdk-separator":"",role:"separator"})}),m4=b.forwardRef((e,t)=>{let{onValueChange:n,...a}=e,s=e.value!=null,o=Hv(),c=gs(h=>h.search),f=gs(h=>h.selectedItemId),m=Uc();return b.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),b.createElement(yi.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)}})}),p4=b.forwardRef((e,t)=>{let{children:n,label:a="Suggestions",...s}=e,o=b.useRef(null),c=b.useRef(null),f=gs(h=>h.selectedItemId),m=Uc();return b.useEffect(()=>{if(c.current&&o.current){let h=c.current,p=o.current,g,S=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let x=h.offsetHeight;p.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return S.observe(h),()=>{cancelAnimationFrame(g),S.unobserve(h)}}},[]),b.createElement(yi.div,{ref:ps(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":f,"aria-label":a,id:m.listId},bh(e,h=>b.createElement("div",{ref:ps(c,m.listInnerRef),"cmdk-list-sizer":""},h)))}),g4=b.forwardRef((e,t)=>{let{open:n,onOpenChange:a,overlayClassName:s,contentClassName:o,container:c,...f}=e;return b.createElement(HC,{open:n,onOpenChange:a},b.createElement(qC,{container:c},b.createElement(ZC,{"cmdk-overlay":"",className:s}),b.createElement(GC,{"aria-label":e.label,"cmdk-dialog":"",className:o},b.createElement(JC,{ref:t,...f}))))}),y4=b.forwardRef((e,t)=>gs(n=>n.filtered.count===0)?b.createElement(yi.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),v4=b.forwardRef((e,t)=>{let{progress:n,children:a,label:s="Loading...",...o}=e;return b.createElement(yi.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},bh(e,c=>b.createElement("div",{"aria-hidden":!0},c)))}),Rr=Object.assign(JC,{List:p4,Item:d4,Input:m4,Group:f4,Separator:h4,Dialog:g4,Empty:y4,Loading:v4});function b4(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function x4(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function eN(e){let t=b.useRef(e);return tl(()=>{t.current=e}),t}var tl=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Yl(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function gs(e){let t=Hv(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function tN(e,t,n,a=[]){let s=b.useRef(),o=Uc();return tl(()=>{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(Kl,f),s.current=f}),s}var S4=()=>{let[e,t]=b.useState(),n=Yl(()=>new Map);return tl(()=>{n.current.forEach(a=>a()),n.current=new Map},[e]),(a,s)=>{n.current.set(a,s),t({})}};function w4(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function bh({asChild:e,children:t},n){return e&&b.isValidElement(t)?b.cloneElement(w4(t),{ref:t.ref},n(t.props.children)):n(t)}var k4={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Rn=HC,j4=qC,nN=b.forwardRef(({className:e,...t},n)=>l.jsx(ZC,{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}));nN.displayName="DialogOverlay";const Cn=b.forwardRef(({className:e,children:t,...n},a)=>l.jsxs(j4,{children:[l.jsx(nN,{}),l.jsxs(GC,{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(JI,{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(ms,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Cn.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 mr({className:e,...t}){return l.jsx("div",{className:ze("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t})}const On=b.forwardRef(({className:e,...t},n)=>l.jsx(XI,{ref:n,className:ze("text-subtitle leading-none tracking-tight",e),...t}));On.displayName="DialogTitle";const qv=b.forwardRef(({className:e,...t},n)=>l.jsx(WI,{ref:n,className:ze("text-body text-muted-foreground",e),...t}));qv.displayName="DialogDescription";const rN=b.forwardRef(({className:e,...t},n)=>l.jsx(Rr,{ref:n,className:ze("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));rN.displayName=Rr.displayName;function E4({open:e,onOpenChange:t,children:n}){return l.jsx(Rn,{open:e,onOpenChange:t,children:l.jsx(Cn,{className:"overflow-hidden p-0 shadow-lg",children:l.jsx(rN,{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 aN=b.forwardRef(({className:e,...t},n)=>l.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[l.jsx(Dv,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),l.jsx(Rr.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})]}));aN.displayName=Rr.Input.displayName;const iN=b.forwardRef(({className:e,...t},n)=>l.jsx(Rr.List,{ref:n,className:ze("max-h-[var(--sp-75)] overflow-y-auto overflow-x-hidden",e),...t}));iN.displayName=Rr.List.displayName;const sN=b.forwardRef((e,t)=>l.jsx(Rr.Empty,{ref:t,className:"py-6 text-center text-body",...e}));sN.displayName=Rr.Empty.displayName;const Lf=b.forwardRef(({className:e,...t},n)=>l.jsx(Rr.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}));Lf.displayName=Rr.Group.displayName;const Dy=b.forwardRef(({className:e,...t},n)=>l.jsx(Rr.Separator,{ref:n,className:ze("-mx-1 h-px bg-border",e),...t}));Dy.displayName=Rr.Separator.displayName;const Pf=b.forwardRef(({className:e,...t},n)=>l.jsx(Rr.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}));Pf.displayName=Rr.Item.displayName;function Bc(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(gn(`/agents${n?`?${n}`:""}`))}function C4(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(gn(`/agents/all${n?`?${n}`:""}`))}function Zv(){return Ee.get("/me/managed-agents")}function N4(e){return Ee.get(`/agents/${encodeURIComponent(e)}`)}function _4(e){return Ee.post(gn("/agents"),e)}function T4(e){return Ee.get(gn(`/agents/names/${encodeURIComponent(e)}/availability`))}function Iy(e,t){return Ee.patch(`/agents/${encodeURIComponent(e)}`,t)}function A4(e,t){return Ee.patch(`/agents/${encodeURIComponent(e)}/rebind`,t)}function lN(e){return Ee.delete(`/agents/${encodeURIComponent(e)}`)}function oN(e){return Ee.post(`/agents/${encodeURIComponent(e)}/suspend`,{})}function uN(e){return Ee.post(`/agents/${encodeURIComponent(e)}/reactivate`,{})}function R4(e){return Ee.post(`/agents/${encodeURIComponent(e)}/test`,{})}function xh(){const{data:e}=Ye({queryKey:["agents","name-map"],queryFn:()=>Bc({limit:100}),staleTime:3e4}),{data:t}=Ye({queryKey:["managed-agents","name-map"],queryFn:Zv,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 Gv(){const{data:e}=Ye({queryKey:["agents","name-map"],queryFn:()=>Bc({limit:100}),staleTime:3e4}),{data:t}=Ye({queryKey:["managed-agents","name-map"],queryFn:Zv,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 M4({open:e,onOpenChange:t}){const n=An(),a=xh(),{data:s}=Ye({queryKey:["activity"],queryFn:Pc,enabled:e,staleTime:3e4}),o=(s==null?void 0:s.agents)??[],f=Ye({queryKey:["palette-sessions",o.map(h=>h.agentId).join(",")],queryFn:async()=>{const h=[];for(const p of o)try{const g=await cC(p.agentId);for(const S of g)h.push({agentId:p.agentId,session:S})}catch{}return h},enabled:e&&o.length>0,staleTime:3e4}).data??[],m=h=>{t(!1),n(h)};return l.jsxs(E4,{open:e,onOpenChange:t,children:[l.jsx(aN,{placeholder:"Jump to agent, chat, or page…"}),l.jsxs(iN,{children:[l.jsx(sN,{children:"No results"}),o.length>0&&l.jsx(Lf,{heading:"Agents",children:o.map(h=>{const p=a(h.agentId);return l.jsxs(Pf,{value:`agent ${p} ${h.agentId}`,onSelect:()=>m(`/?a=${h.agentId}`),children:[l.jsx(BE,{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(Dy,{}),l.jsx(Lf,{heading:"Chats",children:f.map(({agentId:h,session:p})=>{const g=a(h);return l.jsxs(Pf,{value:`chat ${g} ${p.chatId}`,onSelect:()=>m(`/?a=${h}&c=${p.chatId}`),children:[l.jsx(Mv,{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(Dy,{}),l.jsx(Lf,{heading:"Pages",children:O4.map(h=>l.jsxs(Pf,{value:`page ${h.label}`,onSelect:()=>m(h.path),children:[l.jsx(L3,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),l.jsx("span",{children:h.label})]},h.path))})]})]})}function z4(e,t){return t?e.filter(n=>n.userId===t&&n.status==="disconnected"&&n.agentCount>0):[]}function D4(){var a;const{user:e}=lt(),{data:t}=Ye({queryKey:["clients"],queryFn:pi,refetchInterval:1e4,enabled:!!e});if(!t||!e)return{rows:[],firstHostname:null};const n=z4(t,e.id);return{rows:n,firstHostname:((a=n[0])==null?void 0:a.hostname)??null}}const I4=160;function L4(){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(P4,{}),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:I4,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 P4(){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 Fc(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 U4(e){const t=new URLSearchParams;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(gn(`/notifications${n?`?${n}`:""}`))}function B4(e){return Ee.post(gn(`/notifications/${e}/read`))}function F4(){return Ee.post(gn("/notifications/read-all"))}function $4(){return Ee.get(gn("/notifications/unread-count"))}const H4={agent_error:"Error",agent_blocked:"Blocked",agent_stale:"Stale"};function q4(e){switch(e){case"high":return"var(--state-error)";case"medium":return"var(--state-blocked)";default:return"var(--accent-dim)"}}function Z4({notification:e,onClick:t,clickable:n}){const a=(H4[e.type]??e.type).toString(),s=q4(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:fc(e.createdAt)})]}),l.jsx("div",{style:{color:"var(--fg-2)",marginTop:1,wordBreak:"break-word"},children:e.message})]})}function G4(){const[e,t]=b.useState(!1),[n,a]=b.useState(null),s=b.useRef(null),o=An(),c=pn(),{data:f}=Ye({queryKey:["notifications","bell"],queryFn:()=>U4({limit:8})}),{data:m}=Ye({queryKey:["notifications","unread-count"],queryFn:()=>$4()}),h=(m==null?void 0:m.count)??0,p=h>0,g=b.useCallback(async x=>{x.read||(B4(x.id).catch(()=>{}),c.invalidateQueries({queryKey:["notifications"]})),t(!1),x.chatId?o(`/?c=${x.chatId}`):x.agentId&&o(`/agents/${x.agentId}`)},[o,c]),S=b.useCallback(async()=>{a(null);try{await F4(),await c.invalidateQueries({queryKey:["notifications"]})}catch(x){a(x instanceof Error?x.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(p3,{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:S,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(x=>l.jsx(Z4,{notification:x,clickable:!!x.chatId||!!x.agentId,onClick:()=>g(x)},x.id))})]})]})]})}function V4(){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 Q4(){const[e,t]=b.useState(V4);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(tz,{className:"h-4 w-4"}):l.jsx(Z3,{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 A1({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 R1=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,O1=QE,Y4=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return O1(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 S=R1(p)||R1(g);return s[h][S]}),f=n&&Object.entries(n).reduce((h,p)=>{let[g,S]=p;return S===void 0||(h[g]=S),h},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((h,p)=>{let{class:g,className:S,...x}=p;return Object.entries(x).every(j=>{let[k,w]=j;return Array.isArray(w)?w.includes({...o,...f}[k]):{...o,...f}[k]===w})?[...h,g,S]:h},[]);return O1(e,c,m,n==null?void 0:n.class,n==null?void 0:n.className)},X4=Y4("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"}}),xe=b.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...s},o)=>{const c=a?n4:"button";return l.jsx(c,{className:ze(X4({variant:t,size:n,className:e})),ref:o,...s})});xe.displayName="Button";const qt=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}));qt.displayName="Input";function W4({action:e,onClose:t}){const n=e!==null;return l.jsx(Rn,{open:n,onOpenChange:a=>!a&&t(),children:l.jsxs(Cn,{children:[l.jsxs(Pn,{children:[l.jsx(On,{children:e==="join"?"Join a team":"Create a new team"}),l.jsx(qv,{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(e5,{onDone:t}),e==="join"&&l.jsx(t5,{onDone:t})]})})}function J4(e){return e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"team"}function e5({onDone:e}){const{adoptTokens:t}=lt(),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 S=await Ee.post("/me/organizations",{name:J4(g),displayName:g});await t(S.tokens),e(),n("/",{replace:!0})}catch(S){c(S instanceof Error?S.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(qt,{id:"team-display-name","aria-label":"Team name",value:a,onChange:p=>s(p.target.value),placeholder:"Acme Robotics",autoFocus:!0}),l.jsx(xe,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Creating…":"Create team"})]})}function t5({onDone:e}){const{adoptTokens:t}=lt(),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(),S=/\/invite\/([^/?#]+)/.exec(g),x=(S==null?void 0:S[1])??g,j=await Ee.post("/me/organizations/join",{token:x});await t(j.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(qt,{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(xe,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Joining…":"Join team"})]})}function n5(){var I,O;const{organizationId:e,role:t,user:n,selectOrganization:a,logout:s}=lt(),o=An(),[c,f]=b.useState([]),[m,h]=b.useState(!1),[p,g]=b.useState(null),S=b.useRef(null);b.useEffect(()=>{(async()=>{try{const F=await Ee.get("/me/organizations");f(F)}catch{}})()},[]),b.useEffect(()=>{const F=W=>{m&&S.current&&!S.current.contains(W.target)&&h(!1)},D=W=>{m&&W.key==="Escape"&&h(!1)};return window.addEventListener("mousedown",F),window.addEventListener("keydown",D),()=>{window.removeEventListener("mousedown",F),window.removeEventListener("keydown",D)}},[m]);const x=(n==null?void 0:n.displayName)??"User",j=(n==null?void 0:n.username)??"",k=(n==null?void 0:n.avatarUrl)??null,w=c.find(F=>F.id===e)??null,C=(w==null?void 0:w.role)??(t==="admin"||t==="member"?t:null),_=async F=>{if(F===e){h(!1);return}try{await a(F),h(!1),o("/",{replace:!0})}catch{}},R=()=>{h(!1),g("create")},z=()=>{h(!1),g("join")};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{ref:S,className:"relative","data-testid":"user-menu",children:[l.jsx("button",{type:"button","aria-label":`User menu, ${x}`,"aria-haspopup":"menu","aria-expanded":m,onClick:()=>h(F=>!F),className:"inline-flex items-center justify-center rounded-full focus:outline-none focus:ring-2 focus:ring-ring transition-shadow",style:{background:"transparent",border:m?"var(--hairline) solid var(--border)":"var(--hairline) solid transparent",padding:1,cursor:"pointer"},children:l.jsx(A1,{src:k,name:x,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(A1,{src:k,name:x,size:32}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-subtitle font-medium truncate",style:{color:"var(--fg)"},children:x}),j&&j!==x&&l.jsxs("div",{className:"text-label text-muted-foreground truncate",children:["@",j]})]})]}),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(fr,{className:"h-3.5 w-3.5"})}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:(I=c[0])==null?void 0:I.displayName}),l.jsx(M1,{role:((O=c[0])==null?void 0:O.role)??C})]}):l.jsx("div",{children:c.map(F=>l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>void _(F.id),className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[l.jsx("span",{style:{width:14,display:"inline-flex"},children:F.id===e?l.jsx(fr,{className:"h-3.5 w-3.5"}):null}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:F.displayName}),l.jsx(M1,{role:F.role})]},F.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(ka,{className:"h-3.5 w-3.5"}),l.jsx("span",{children:"Create new team"})]}),l.jsxs("button",{type:"button",role:"menuitem",onClick:z,className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[l.jsx(ZE,{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($3,{className:"h-3.5 w-3.5"}),l.jsx("span",{children:"Sign out"})]})})]})]}),l.jsx(W4,{action:p,onClose:()=>g(null)})]})}function M1({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 r5=[{to:"/",label:"Workspace",end:!0},{to:"/context",label:"Context",end:!1},{to:"/team",label:"Team",end:!1},{to:"/settings",label:"Settings",end:!1}];function a5(){const[e,t]=b.useState(!1),n=Ar(),a=n.pathname==="/"||n.search.includes("a=");return 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(Fc,{width:16,height:18,style:{color:"var(--fg)"}}),l.jsx("span",{className:"text-title",style:{color:"var(--fg)"},children:"First Tree"})]}),l.jsx(L4,{})]}),l.jsx("nav",{className:"flex",style:{gap:2,pointerEvents:"none",justifySelf:"center"},children:r5.map(s=>l.jsx(Ev,{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.jsx("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})},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-3)",minWidth:200,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(Dv,{className:"h-4 w-4"}),l.jsx("span",{children:"Jump to…"})]}),l.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),l.jsx(G4,{}),l.jsx(Q4,{}),l.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),l.jsx(n5,{})]})]}),l.jsx(M4,{open:e,onOpenChange:t}),a?l.jsx(Hf,{}):l.jsx("main",{className:"flex-1 overflow-auto",children:l.jsx("div",{className:"p-6 mx-auto",style:{maxWidth:1280},children:l.jsx(Hf,{})})})]})}const cN=b.createContext(null),i5=5e3;function s5({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(cN.Provider,{value:o,children:[e,l.jsx(l5,{toasts:t,onDismiss:a})]})}function $c(){const e=b.useContext(cN);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function l5({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(o5,{toast:n,onDismiss:()=>t(n.id)},n.id))})}function o5({toast:e,onDismiss:t}){const n=b.useRef(t);return n.current=t,b.useEffect(()=>{if(e.durationMs===null)return;const a=e.durationMs??i5,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(ms,{className:"h-4 w-4"})})]})}function de(e,t,n){function a(f,m){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:m,constr:c,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,m);const h=c.prototype,p=Object.keys(h);for(let g=0;g<p.length;g++){const S=p[g];S in f||(f[S]=h[S].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 so extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class dN extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const fN={};function ys(e){return fN}function hN(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 Ly(e,t){return typeof t=="bigint"?t.toString():t}function Sh(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Vv(e){return e==null}function Qv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function u5(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 z1=Symbol("evaluating");function _t(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==z1)return a===void 0&&(a=z1,a=n()),a},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function ll(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function xs(...e){const t={};for(const n of e){const a=Object.getOwnPropertyDescriptors(n);Object.assign(t,a)}return Object.defineProperties({},t)}function D1(e){return JSON.stringify(e)}function c5(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const mN="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function pc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const d5=Sh(()=>{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 Eo(e){if(pc(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(pc(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function pN(e){return Eo(e)?{...e}:Array.isArray(e)?[...e]:e}const f5=new Set(["string","number","symbol"]);function Co(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ss(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 Pe(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 h5(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const m5={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 p5(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=xs(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 ll(this,"shape",c),c},checks:[]});return Ss(e,o)}function g5(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=xs(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 ll(this,"shape",c),c},checks:[]});return Ss(e,o)}function y5(e,t){if(!Eo(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=xs(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return ll(this,"shape",o),o}});return Ss(e,s)}function v5(e,t){if(!Eo(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=xs(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return ll(this,"shape",a),a}});return Ss(e,n)}function b5(e,t){const n=xs(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return ll(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:[]});return Ss(e,n)}function x5(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=xs(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 ll(this,"shape",m),m},checks:[]});return Ss(t,c)}function S5(e,t,n){const a=xs(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 ll(this,"shape",o),o}});return Ss(t,a)}function to(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 no(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function bf(e){return typeof e=="string"?e:e==null?void 0:e.message}function vs(e,t,n){var s,o,c,f,m,h;const a={...e,path:e.path??[]};if(!e.message){const p=bf((c=(o=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:o.error)==null?void 0:c.call(o,e))??bf((f=t==null?void 0:t.error)==null?void 0:f.call(t,e))??bf((m=n.customError)==null?void 0:m.call(n,e))??bf((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 Kv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function gc(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}const gN=(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,Ly,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},yN=de("$ZodError",gN),vN=de("$ZodError",gN,{Parent:Error});function w5(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 k5(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 Yv=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 so;if(c.issues.length){const f=new((s==null?void 0:s.Err)??e)(c.issues.map(m=>vs(m,o,ys())));throw mN(f,s==null?void 0:s.callee),f}return c.value},Xv=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=>vs(m,o,ys())));throw mN(f,s==null?void 0:s.callee),f}return c.value},wh=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 so;return o.issues.length?{success:!1,error:new(e??yN)(o.issues.map(c=>vs(c,s,ys())))}:{success:!0,data:o.value}},j5=wh(vN),kh=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=>vs(c,s,ys())))}:{success:!0,data:o.value}},E5=kh(vN),C5=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Yv(e)(t,n,s)},N5=e=>(t,n,a)=>Yv(e)(t,n,a),_5=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Xv(e)(t,n,s)},T5=e=>async(t,n,a)=>Xv(e)(t,n,a),A5=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return wh(e)(t,n,s)},R5=e=>(t,n,a)=>wh(e)(t,n,a),O5=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return kh(e)(t,n,s)},M5=e=>async(t,n,a)=>kh(e)(t,n,a),z5=/^[cC][^\s-]{8,}$/,D5=/^[0-9a-z]+$/,I5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,L5=/^[0-9a-vA-V]{20}$/,P5=/^[A-Za-z0-9]{27}$/,U5=/^[a-zA-Z0-9_-]{21}$/,B5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,F5=/^([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})$/,I1=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)$/,$5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,H5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function q5(){return new RegExp(H5,"u")}const Z5=/^(?:(?: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])$/,G5=/^(([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}|:))$/,V5=/^((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])$/,Q5=/^(([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}=))?$/,bN=/^[A-Za-z0-9_-]*$/,Y5=/^\+[1-9]\d{6,14}$/,xN="(?:(?:\\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])))",X5=new RegExp(`^${xN}$`);function SN(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 W5(e){return new RegExp(`^${SN(e)}$`)}function J5(e){const t=SN({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(`^${xN}T(?:${a})$`)}const eL=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}$`)},tL=/^-?\d+$/,wN=/^-?\d+(?:\.\d+)?$/,nL=/^(?:true|false)$/i,rL=/^null$/i,aL=/^[^A-Z]*$/,iL=/^[^a-z]*$/,Or=de("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),kN={number:"number",bigint:"bigint",object:"date"},jN=de("$ZodCheckLessThan",(e,t)=>{Or.init(e,t);const n=kN[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})}}),EN=de("$ZodCheckGreaterThan",(e,t)=>{Or.init(e,t);const n=kN[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})}}),sL=de("$ZodCheckMultipleOf",(e,t)=>{Or.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):u5(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})}}),lL=de("$ZodCheckNumberFormat",(e,t)=>{var c;Or.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]=m5[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=tL)}),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})}}),oL=de("$ZodCheckMaxLength",(e,t)=>{var n;Or.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Vv(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=Kv(s);a.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),uL=de("$ZodCheckMinLength",(e,t)=>{var n;Or.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Vv(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=Kv(s);a.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),cL=de("$ZodCheckLengthEquals",(e,t)=>{var n;Or.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Vv(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=Kv(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})}}),jh=de("$ZodCheckStringFormat",(e,t)=>{var n,a;Or.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=()=>{})}),dL=de("$ZodCheckRegex",(e,t)=>{jh.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})}}),fL=de("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=aL),jh.init(e,t)}),hL=de("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=iL),jh.init(e,t)}),mL=de("$ZodCheckIncludes",(e,t)=>{Or.init(e,t);const n=Co(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})}}),pL=de("$ZodCheckStartsWith",(e,t)=>{Or.init(e,t);const n=new RegExp(`^${Co(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})}}),gL=de("$ZodCheckEndsWith",(e,t)=>{Or.init(e,t);const n=new RegExp(`.*${Co(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})}}),yL=de("$ZodCheckOverwrite",(e,t)=>{Or.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class vL{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 bL={major:4,minor:3,patch:6},Yt=de("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=bL;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=to(f),g;for(const S of m){if(S._zod.def.when){if(!S._zod.def.when(f))continue}else if(p)continue;const x=f.issues.length,j=S._zod.check(f);if(j instanceof Promise&&(h==null?void 0:h.async)===!1)throw new so;if(g||j instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await j,f.issues.length!==x&&(p||(p=to(f,x)))});else{if(f.issues.length===x)continue;p||(p=to(f,x))}}return g?g.then(()=>f):f},c=(f,m,h)=>{if(to(f))return f.aborted=!0,f;const p=o(m,a,h);if(p instanceof Promise){if(h.async===!1)throw new so;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 so;return h.then(p=>o(p,a,m))}return o(h,a,m)}}_t(e,"~standard",()=>({validate:o=>{var c;try{const f=j5(e,o);return f.success?{value:f.data}:{issues:(c=f.error)==null?void 0:c.issues}}catch{return E5(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}))}),Wv=de("$ZodString",(e,t)=>{var n;Yt.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??eL(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}}),Xt=de("$ZodStringFormat",(e,t)=>{jh.init(e,t),Wv.init(e,t)}),xL=de("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=F5),Xt.init(e,t)}),SL=de("$ZodUUID",(e,t)=>{if(t.version){const a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(a===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=I1(a))}else t.pattern??(t.pattern=I1());Xt.init(e,t)}),wL=de("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=$5),Xt.init(e,t)}),kL=de("$ZodURL",(e,t)=>{Xt.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})}}}),jL=de("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=q5()),Xt.init(e,t)}),EL=de("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=U5),Xt.init(e,t)}),CL=de("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=z5),Xt.init(e,t)}),NL=de("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=D5),Xt.init(e,t)}),_L=de("$ZodULID",(e,t)=>{t.pattern??(t.pattern=I5),Xt.init(e,t)}),TL=de("$ZodXID",(e,t)=>{t.pattern??(t.pattern=L5),Xt.init(e,t)}),AL=de("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=P5),Xt.init(e,t)}),RL=de("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=J5(t)),Xt.init(e,t)}),OL=de("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=X5),Xt.init(e,t)}),ML=de("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=W5(t)),Xt.init(e,t)}),zL=de("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=B5),Xt.init(e,t)}),DL=de("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Z5),Xt.init(e,t),e._zod.bag.format="ipv4"}),IL=de("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=G5),Xt.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})}}}),LL=de("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=V5),Xt.init(e,t)}),PL=de("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Q5),Xt.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 CN(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const UL=de("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=K5),Xt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{CN(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function BL(e){if(!bN.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return CN(n)}const FL=de("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=bN),Xt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{BL(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),$L=de("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Y5),Xt.init(e,t)});function HL(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 qL=de("$ZodJWT",(e,t)=>{Xt.init(e,t),e._zod.check=n=>{HL(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),NN=de("$ZodNumber",(e,t)=>{Yt.init(e,t),e._zod.pattern=e._zod.bag.pattern??wN,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}}),ZL=de("$ZodNumberFormat",(e,t)=>{lL.init(e,t),NN.init(e,t)}),GL=de("$ZodBoolean",(e,t)=>{Yt.init(e,t),e._zod.pattern=nL,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}}),VL=de("$ZodNull",(e,t)=>{Yt.init(e,t),e._zod.pattern=rL,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}}),QL=de("$ZodUnknown",(e,t)=>{Yt.init(e,t),e._zod.parse=n=>n}),KL=de("$ZodNever",(e,t)=>{Yt.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function L1(e,t,n){e.issues.length&&t.issues.push(...no(n,e.issues)),t.value[n]=e.value}const YL=de("$ZodArray",(e,t)=>{Yt.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=>L1(h,n,c))):L1(m,n,c)}return o.length?Promise.all(o).then(()=>n):n}});function Qf(e,t,n,a,s){if(e.issues.length){if(s&&!(n in a))return;t.issues.push(...no(n,e.issues))}e.value===void 0?n in a&&(t.value[n]=void 0):t.value[n]=e.value}function _N(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=h5(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function TN(e,t,n,a,s,o){const c=[],f=s.keySet,m=s.catchall._zod,h=m.def.type,p=m.optout==="optional";for(const g in t){if(f.has(g))continue;if(h==="never"){c.push(g);continue}const S=m.run({value:t[g],issues:[]},a);S instanceof Promise?e.push(S.then(x=>Qf(x,n,g,t,p))):Qf(S,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 XL=de("$ZodObject",(e,t)=>{Yt.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=Sh(()=>_N(t));_t(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=pc,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 S of c.keys){const x=g[S],j=x._zod.optout==="optional",k=x._zod.run({value:h[S],issues:[]},m);k instanceof Promise?p.push(k.then(w=>Qf(w,f,S,h,j))):Qf(k,f,S,h,j)}return o?TN(p,h,f,m,a.value,e):p.length?Promise.all(p).then(()=>f):f}}),WL=de("$ZodObjectJIT",(e,t)=>{XL.init(e,t);const n=e._zod.parse,a=Sh(()=>_N(t)),s=S=>{var R;const x=new vL(["shape","payload","ctx"]),j=a.value,k=z=>{const I=D1(z);return`shape[${I}]._zod.run({ value: input[${I}], issues: [] }, ctx)`};x.write("const input = payload.value;");const w=Object.create(null);let C=0;for(const z of j.keys)w[z]=`key_${C++}`;x.write("const newResult = {};");for(const z of j.keys){const I=w[z],O=D1(z),F=S[z],D=((R=F==null?void 0:F._zod)==null?void 0:R.optout)==="optional";x.write(`const ${I} = ${k(z)};`),D?x.write(`
|
|
352
|
-
if (${I}.issues.length) {
|
|
353
|
-
if (${O} in input) {
|
|
354
|
-
payload.issues = payload.issues.concat(${I}.issues.map(iss => ({
|
|
355
|
-
...iss,
|
|
356
|
-
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
357
|
-
})));
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
if (${I}.value === undefined) {
|
|
362
|
-
if (${O} in input) {
|
|
363
|
-
newResult[${O}] = undefined;
|
|
364
|
-
}
|
|
365
|
-
} else {
|
|
366
|
-
newResult[${O}] = ${I}.value;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
`):x.write(`
|
|
370
|
-
if (${I}.issues.length) {
|
|
371
|
-
payload.issues = payload.issues.concat(${I}.issues.map(iss => ({
|
|
372
|
-
...iss,
|
|
373
|
-
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
374
|
-
})));
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
if (${I}.value === undefined) {
|
|
378
|
-
if (${O} in input) {
|
|
379
|
-
newResult[${O}] = undefined;
|
|
380
|
-
}
|
|
381
|
-
} else {
|
|
382
|
-
newResult[${O}] = ${I}.value;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
`)}x.write("payload.value = newResult;"),x.write("return payload;");const _=x.compile();return(z,I)=>_(S,z,I)};let o;const c=pc,f=!fN.jitless,h=f&&d5.value,p=t.catchall;let g;e._zod.parse=(S,x)=>{g??(g=a.value);const j=S.value;return c(j)?f&&h&&(x==null?void 0:x.async)===!1&&x.jitless!==!0?(o||(o=s(t.shape)),S=o(S,x),p?TN([],j,S,x,g,e):S):n(S,x):(S.issues.push({expected:"object",code:"invalid_type",input:j,inst:e}),S)}});function P1(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=>!to(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=>vs(c,a,ys())))}),t)}const AN=de("$ZodUnion",(e,t)=>{Yt.init(e,t),_t(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),_t(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),_t(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),_t(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=>Qv(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=>P1(m,s,e,o)):P1(f,s,e,o)}}),JL=de("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,AN.init(e,t);const n=e._zod.parse;_t(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=Sh(()=>{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(!pc(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)}}),eP=de("$ZodIntersection",(e,t)=>{Yt.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])=>U1(n,m,h)):U1(n,o,c)}});function Py(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(Eo(e)&&Eo(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=Py(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=Py(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 U1(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}),to(e))return e;const c=Py(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 tP=de("$ZodRecord",(e,t)=>{Yt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value;if(!Eo(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(...no(h,g.issues)),n.value[h]=g.value})):(p.issues.length&&n.issues.push(...no(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"&&wN.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=>vs(g,a,ys())),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(...no(f,g.issues)),n.value[m.value]=g.value})):(p.issues.length&&n.issues.push(...no(f,p.issues)),n.value[m.value]=p.value)}}return o.length?Promise.all(o).then(()=>n):n}}),nP=de("$ZodEnum",(e,t)=>{Yt.init(e,t);const n=hN(t.entries),a=new Set(n);e._zod.values=a,e._zod.pattern=new RegExp(`^(${n.filter(s=>f5.has(typeof s)).map(s=>typeof s=="string"?Co(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}}),rP=de("$ZodLiteral",(e,t)=>{if(Yt.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"?Co(a):a?Co(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}}),aP=de("$ZodTransform",(e,t)=>{Yt.init(e,t),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new dN(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 so;return n.value=s,n}});function B1(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const RN=de("$ZodOptional",(e,t)=>{Yt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",_t(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),_t(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Qv(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=>B1(o,n.value)):B1(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,a)}}),iP=de("$ZodExactOptional",(e,t)=>{RN.init(e,t),_t(e._zod,"values",()=>t.innerType._zod.values),_t(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,a)=>t.innerType._zod.run(n,a)}),sP=de("$ZodNullable",(e,t)=>{Yt.init(e,t),_t(e._zod,"optin",()=>t.innerType._zod.optin),_t(e._zod,"optout",()=>t.innerType._zod.optout),_t(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Qv(n.source)}|null)$`):void 0}),_t(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)}),lP=de("$ZodDefault",(e,t)=>{Yt.init(e,t),e._zod.optin="optional",_t(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=>F1(o,t)):F1(s,t)}});function F1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const oP=de("$ZodPrefault",(e,t)=>{Yt.init(e,t),e._zod.optin="optional",_t(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))}),uP=de("$ZodNonOptional",(e,t)=>{Yt.init(e,t),_t(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=>$1(o,e)):$1(s,e)}});function $1(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 cP=de("$ZodCatch",(e,t)=>{Yt.init(e,t),_t(e._zod,"optin",()=>t.innerType._zod.optin),_t(e._zod,"optout",()=>t.innerType._zod.optout),_t(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=>vs(c,a,ys()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(o=>vs(o,a,ys()))},input:n.value}),n.issues=[]),n)}}),dP=de("$ZodPipe",(e,t)=>{Yt.init(e,t),_t(e._zod,"values",()=>t.in._zod.values),_t(e._zod,"optin",()=>t.in._zod.optin),_t(e._zod,"optout",()=>t.out._zod.optout),_t(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=>xf(c,t.in,a)):xf(o,t.in,a)}const s=t.in._zod.run(n,a);return s instanceof Promise?s.then(o=>xf(o,t.out,a)):xf(s,t.out,a)}});function xf(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const fP=de("$ZodReadonly",(e,t)=>{Yt.init(e,t),_t(e._zod,"propValues",()=>t.innerType._zod.propValues),_t(e._zod,"values",()=>t.innerType._zod.values),_t(e._zod,"optin",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optin}),_t(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(H1):H1(s)}});function H1(e){return e.value=Object.freeze(e.value),e}const hP=de("$ZodCustom",(e,t)=>{Or.init(e,t),Yt.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=>q1(o,n,a,e));q1(s,n,a,e)}});function q1(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(gc(s))}}var Z1;class mP{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 pP(){return new mP}(Z1=globalThis).__zod_globalRegistry??(Z1.__zod_globalRegistry=pP());const ec=globalThis.__zod_globalRegistry;function gP(e,t){return new e({type:"string",...Pe(t)})}function yP(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Pe(t)})}function G1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Pe(t)})}function vP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Pe(t)})}function bP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Pe(t)})}function xP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Pe(t)})}function SP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Pe(t)})}function wP(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Pe(t)})}function kP(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Pe(t)})}function jP(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Pe(t)})}function EP(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Pe(t)})}function CP(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Pe(t)})}function NP(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Pe(t)})}function _P(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Pe(t)})}function TP(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Pe(t)})}function AP(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Pe(t)})}function RP(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Pe(t)})}function OP(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Pe(t)})}function MP(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Pe(t)})}function zP(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Pe(t)})}function DP(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Pe(t)})}function IP(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Pe(t)})}function LP(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Pe(t)})}function PP(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Pe(t)})}function UP(e,t){return new e({type:"string",format:"date",check:"string_format",...Pe(t)})}function BP(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Pe(t)})}function FP(e,t){return new e({type:"string",format:"duration",check:"string_format",...Pe(t)})}function $P(e,t){return new e({type:"number",checks:[],...Pe(t)})}function HP(e,t){return new e({type:"number",coerce:!0,checks:[],...Pe(t)})}function qP(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Pe(t)})}function ZP(e,t){return new e({type:"boolean",...Pe(t)})}function GP(e,t){return new e({type:"null",...Pe(t)})}function VP(e){return new e({type:"unknown"})}function QP(e,t){return new e({type:"never",...Pe(t)})}function V1(e,t){return new jN({check:"less_than",...Pe(t),value:e,inclusive:!1})}function gg(e,t){return new jN({check:"less_than",...Pe(t),value:e,inclusive:!0})}function Q1(e,t){return new EN({check:"greater_than",...Pe(t),value:e,inclusive:!1})}function yg(e,t){return new EN({check:"greater_than",...Pe(t),value:e,inclusive:!0})}function K1(e,t){return new sL({check:"multiple_of",...Pe(t),value:e})}function ON(e,t){return new oL({check:"max_length",...Pe(t),maximum:e})}function Kf(e,t){return new uL({check:"min_length",...Pe(t),minimum:e})}function MN(e,t){return new cL({check:"length_equals",...Pe(t),length:e})}function KP(e,t){return new dL({check:"string_format",format:"regex",...Pe(t),pattern:e})}function YP(e){return new fL({check:"string_format",format:"lowercase",...Pe(e)})}function XP(e){return new hL({check:"string_format",format:"uppercase",...Pe(e)})}function WP(e,t){return new mL({check:"string_format",format:"includes",...Pe(t),includes:e})}function JP(e,t){return new pL({check:"string_format",format:"starts_with",...Pe(t),prefix:e})}function eU(e,t){return new gL({check:"string_format",format:"ends_with",...Pe(t),suffix:e})}function Do(e){return new yL({check:"overwrite",tx:e})}function tU(e){return Do(t=>t.normalize(e))}function nU(){return Do(e=>e.trim())}function rU(){return Do(e=>e.toLowerCase())}function aU(){return Do(e=>e.toUpperCase())}function iU(){return Do(e=>c5(e))}function sU(e,t,n){return new e({type:"array",element:t,...Pe(n)})}function lU(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Pe(n)})}function oU(e){const t=uU(n=>(n.addIssue=a=>{if(typeof a=="string")n.issues.push(gc(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(gc(s))}},e(n.value,n)));return t}function uU(e,t){const n=new Or({check:"custom",...Pe(t)});return n._zod.check=e,n}function zN(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)??ec,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function kn(e,t,n={path:[],schemaPath:[]}){var 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 S={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,S);else{const j=c.schema,k=t.processors[s.type];if(!k)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);k(e,t,j,S)}const x=e._zod.parent;x&&(c.ref||(c.ref=x),kn(x,t,S),t.seen.get(x).isParent=!0)}const m=t.metadataRegistry.get(e);return m&&Object.assign(c.schema,m),t.io==="input"&&lr(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 DN(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 S=a.get(g);if(S&&S!==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 w=(k=e.external.registry.get(p[0]))==null?void 0:k.id,C=e.external.uri??(R=>R);if(w)return{ref:C(w)};const _=p[1].defId??p[1].schema.id??`schema${e.counter++}`;return p[1].defId=_,{defId:_,ref:`${C("__shared")}#/${g}/${_}`}}if(p[1]===n)return{ref:"#"};const x=`#/${g}/`,j=p[1].schema.id??`__schema${e.counter++}`;return{defId:j,ref:x+j}},o=p=>{if(p[1].schema.$ref)return;const g=p[1],{ref:S,defId:x}=s(p);g.def={...g.schema},x&&(g.defId=x);const j=g.schema;for(const k in j)delete j[k];j.$ref=S};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 x=(m=e.external.registry.get(p[0]))==null?void 0:m.id;if(t!==p[0]&&x){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 IN(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,S={...g},x=p.ref;if(p.ref=null,x){a(x);const k=e.seen.get(x),w=k.schema;if(w.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(w)):Object.assign(g,w),Object.assign(g,S),h._zod.parent===x)for(const _ in g)_==="$ref"||_==="allOf"||_ in S||delete g[_];if(w.$ref&&k.def)for(const _ in g)_==="$ref"||_==="allOf"||_ in k.def&&JSON.stringify(g[_])===JSON.stringify(k.def[_])&&delete g[_]}const j=h._zod.parent;if(j&&j!==x){a(j);const k=e.seen.get(j);if(k!=null&&k.schema.$ref&&(g.$ref=k.schema.$ref,k.def))for(const w in g)w==="$ref"||w==="allOf"||w in k.def&&JSON.stringify(g[w])===JSON.stringify(k.def[w])&&delete g[w]}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:Yf(t,"input",e.processors),output:Yf(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function lr(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 lr(a.element,n);if(a.type==="set")return lr(a.valueType,n);if(a.type==="lazy")return lr(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 lr(a.innerType,n);if(a.type==="intersection")return lr(a.left,n)||lr(a.right,n);if(a.type==="record"||a.type==="map")return lr(a.keyType,n)||lr(a.valueType,n);if(a.type==="pipe")return lr(a.in,n)||lr(a.out,n);if(a.type==="object"){for(const s in a.shape)if(lr(a.shape[s],n))return!0;return!1}if(a.type==="union"){for(const s of a.options)if(lr(s,n))return!0;return!1}if(a.type==="tuple"){for(const s of a.items)if(lr(s,n))return!0;return!!(a.rest&&lr(a.rest,n))}return!1}const cU=(e,t={})=>n=>{const a=zN({...n,processors:t});return kn(e,a),DN(a,e),IN(a,e)},Yf=(e,t,n={})=>a=>{const{libraryOptions:s,target:o}=a??{},c=zN({...s??{},target:o,io:t,processors:n});return kn(e,c),DN(c,e),IN(c,e)},dU={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},fU=(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=dU[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}))])}},hU=(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)},mU=(e,t,n,a)=>{n.type="boolean"},pU=(e,t,n,a)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},gU=(e,t,n,a)=>{n.not={}},yU=(e,t,n,a)=>{},vU=(e,t,n,a)=>{const s=e._zod.def,o=hN(s.entries);o.every(c=>typeof c=="number")&&(n.type="number"),o.every(c=>typeof c=="string")&&(n.type="string"),n.enum=o},bU=(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},xU=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},SU=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},wU=(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=kn(o.element,t,{...a,path:[...a.path,"items"]})},kU=(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]=kn(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=kn(o.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},jU=(e,t,n,a)=>{const s=e._zod.def,o=s.inclusive===!1,c=s.options.map((f,m)=>kn(f,t,{...a,path:[...a.path,o?"oneOf":"anyOf",m]}));o?n.oneOf=c:n.anyOf=c},EU=(e,t,n,a)=>{const s=e._zod.def,o=kn(s.left,t,{...a,path:[...a.path,"allOf",0]}),c=kn(s.right,t,{...a,path:[...a.path,"allOf",1]}),f=h=>"allOf"in h&&Object.keys(h).length===1,m=[...f(o)?o.allOf:[o],...f(c)?c.allOf:[c]];n.allOf=m},CU=(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=kn(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=kn(o.keyType,t,{...a,path:[...a.path,"propertyNames"]})),s.additionalProperties=kn(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)}},NU=(e,t,n,a)=>{const s=e._zod.def,o=kn(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"}]},_U=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType},TU=(e,t,n,a)=>{const s=e._zod.def;kn(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;kn(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)))},RU=(e,t,n,a)=>{const s=e._zod.def;kn(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},OU=(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;kn(o,t,a);const c=t.seen.get(e);c.ref=o},MU=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,n.readOnly=!0},LN=(e,t,n,a)=>{const s=e._zod.def;kn(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType},zU=de("ZodISODateTime",(e,t)=>{RL.init(e,t),nn.init(e,t)});function DU(e){return PP(zU,e)}const IU=de("ZodISODate",(e,t)=>{OL.init(e,t),nn.init(e,t)});function LU(e){return UP(IU,e)}const PU=de("ZodISOTime",(e,t)=>{ML.init(e,t),nn.init(e,t)});function UU(e){return BP(PU,e)}const BU=de("ZodISODuration",(e,t)=>{zL.init(e,t),nn.init(e,t)});function FU(e){return FP(BU,e)}const $U=(e,t)=>{yN.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>k5(e,n)},flatten:{value:n=>w5(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Ly,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Ly,2)}},isEmpty:{get(){return e.issues.length===0}}})},da=de("ZodError",$U,{Parent:Error}),HU=Yv(da),qU=Xv(da),ZU=wh(da),GU=kh(da),VU=C5(da),QU=N5(da),KU=_5(da),YU=T5(da),XU=A5(da),WU=R5(da),JU=O5(da),e6=M5(da),Wt=de("ZodType",(e,t)=>(Yt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Yf(e,"input"),output:Yf(e,"output")}}),e.toJSONSchema=cU(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(xs(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)=>Ss(e,n,a),e.brand=()=>e,e.register=((n,a)=>(n.add(e,a),e)),e.parse=(n,a)=>HU(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>ZU(e,n,a),e.parseAsync=async(n,a)=>qU(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>GU(e,n,a),e.spa=e.safeParseAsync,e.encode=(n,a)=>VU(e,n,a),e.decode=(n,a)=>QU(e,n,a),e.encodeAsync=async(n,a)=>KU(e,n,a),e.decodeAsync=async(n,a)=>YU(e,n,a),e.safeEncode=(n,a)=>XU(e,n,a),e.safeDecode=(n,a)=>WU(e,n,a),e.safeEncodeAsync=async(n,a)=>JU(e,n,a),e.safeDecodeAsync=async(n,a)=>e6(e,n,a),e.refine=(n,a)=>e.check(Q6(n,a)),e.superRefine=n=>e.check(K6(n)),e.overwrite=n=>e.check(Do(n)),e.optional=()=>W1(e),e.exactOptional=()=>D6(e),e.nullable=()=>J1(e),e.nullish=()=>W1(J1(e)),e.nonoptional=n=>F6(e,n),e.array=()=>ot(e),e.or=n=>Eh([e,n]),e.and=n=>A6(e,n),e.transform=n=>By(e,BN(n)),e.default=n=>P6(e,n),e.prefault=n=>B6(e,n),e.catch=n=>H6(e,n),e.pipe=n=>By(e,n),e.readonly=()=>G6(e),e.describe=n=>{const a=e.clone();return ec.add(a,{description:n}),a},Object.defineProperty(e,"description",{get(){var n;return(n=ec.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return ec.get(e);const a=e.clone();return ec.add(a,n[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),PN=de("_ZodString",(e,t)=>{Wv.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>fU(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(WP(...a)),e.startsWith=(...a)=>e.check(JP(...a)),e.endsWith=(...a)=>e.check(eU(...a)),e.min=(...a)=>e.check(Kf(...a)),e.max=(...a)=>e.check(ON(...a)),e.length=(...a)=>e.check(MN(...a)),e.nonempty=(...a)=>e.check(Kf(1,...a)),e.lowercase=a=>e.check(YP(a)),e.uppercase=a=>e.check(XP(a)),e.trim=()=>e.check(nU()),e.normalize=(...a)=>e.check(tU(...a)),e.toLowerCase=()=>e.check(rU()),e.toUpperCase=()=>e.check(aU()),e.slugify=()=>e.check(iU())}),t6=de("ZodString",(e,t)=>{Wv.init(e,t),PN.init(e,t),e.email=n=>e.check(yP(n6,n)),e.url=n=>e.check(wP(r6,n)),e.jwt=n=>e.check(LP(v6,n)),e.emoji=n=>e.check(kP(a6,n)),e.guid=n=>e.check(G1(Y1,n)),e.uuid=n=>e.check(vP(Sf,n)),e.uuidv4=n=>e.check(bP(Sf,n)),e.uuidv6=n=>e.check(xP(Sf,n)),e.uuidv7=n=>e.check(SP(Sf,n)),e.nanoid=n=>e.check(jP(i6,n)),e.guid=n=>e.check(G1(Y1,n)),e.cuid=n=>e.check(EP(s6,n)),e.cuid2=n=>e.check(CP(l6,n)),e.ulid=n=>e.check(NP(o6,n)),e.base64=n=>e.check(zP(p6,n)),e.base64url=n=>e.check(DP(g6,n)),e.xid=n=>e.check(_P(u6,n)),e.ksuid=n=>e.check(TP(c6,n)),e.ipv4=n=>e.check(AP(d6,n)),e.ipv6=n=>e.check(RP(f6,n)),e.cidrv4=n=>e.check(OP(h6,n)),e.cidrv6=n=>e.check(MP(m6,n)),e.e164=n=>e.check(IP(y6,n)),e.datetime=n=>e.check(DU(n)),e.date=n=>e.check(LU(n)),e.time=n=>e.check(UU(n)),e.duration=n=>e.check(FU(n))});function N(e){return gP(t6,e)}const nn=de("ZodStringFormat",(e,t)=>{Xt.init(e,t),PN.init(e,t)}),n6=de("ZodEmail",(e,t)=>{wL.init(e,t),nn.init(e,t)}),Y1=de("ZodGUID",(e,t)=>{xL.init(e,t),nn.init(e,t)}),Sf=de("ZodUUID",(e,t)=>{SL.init(e,t),nn.init(e,t)}),r6=de("ZodURL",(e,t)=>{kL.init(e,t),nn.init(e,t)}),a6=de("ZodEmoji",(e,t)=>{jL.init(e,t),nn.init(e,t)}),i6=de("ZodNanoID",(e,t)=>{EL.init(e,t),nn.init(e,t)}),s6=de("ZodCUID",(e,t)=>{CL.init(e,t),nn.init(e,t)}),l6=de("ZodCUID2",(e,t)=>{NL.init(e,t),nn.init(e,t)}),o6=de("ZodULID",(e,t)=>{_L.init(e,t),nn.init(e,t)}),u6=de("ZodXID",(e,t)=>{TL.init(e,t),nn.init(e,t)}),c6=de("ZodKSUID",(e,t)=>{AL.init(e,t),nn.init(e,t)}),d6=de("ZodIPv4",(e,t)=>{DL.init(e,t),nn.init(e,t)}),f6=de("ZodIPv6",(e,t)=>{IL.init(e,t),nn.init(e,t)}),h6=de("ZodCIDRv4",(e,t)=>{LL.init(e,t),nn.init(e,t)}),m6=de("ZodCIDRv6",(e,t)=>{PL.init(e,t),nn.init(e,t)}),p6=de("ZodBase64",(e,t)=>{UL.init(e,t),nn.init(e,t)}),g6=de("ZodBase64URL",(e,t)=>{FL.init(e,t),nn.init(e,t)}),y6=de("ZodE164",(e,t)=>{$L.init(e,t),nn.init(e,t)}),v6=de("ZodJWT",(e,t)=>{qL.init(e,t),nn.init(e,t)}),Jv=de("ZodNumber",(e,t)=>{NN.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>hU(e,a,s),e.gt=(a,s)=>e.check(Q1(a,s)),e.gte=(a,s)=>e.check(yg(a,s)),e.min=(a,s)=>e.check(yg(a,s)),e.lt=(a,s)=>e.check(V1(a,s)),e.lte=(a,s)=>e.check(gg(a,s)),e.max=(a,s)=>e.check(gg(a,s)),e.int=a=>e.check(X1(a)),e.safe=a=>e.check(X1(a)),e.positive=a=>e.check(Q1(0,a)),e.nonnegative=a=>e.check(yg(0,a)),e.negative=a=>e.check(V1(0,a)),e.nonpositive=a=>e.check(gg(0,a)),e.multipleOf=(a,s)=>e.check(K1(a,s)),e.step=(a,s)=>e.check(K1(a,s)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function He(e){return $P(Jv,e)}const b6=de("ZodNumberFormat",(e,t)=>{ZL.init(e,t),Jv.init(e,t)});function X1(e){return qP(b6,e)}const x6=de("ZodBoolean",(e,t)=>{GL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>mU(e,n,a)});function Kn(e){return ZP(x6,e)}const S6=de("ZodNull",(e,t)=>{VL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>pU(e,n,a)});function w6(e){return GP(S6,e)}const k6=de("ZodUnknown",(e,t)=>{QL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>yU()});function tn(){return VP(k6)}const j6=de("ZodNever",(e,t)=>{KL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>gU(e,n,a)});function E6(e){return QP(j6,e)}const C6=de("ZodArray",(e,t)=>{YL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>wU(e,n,a,s),e.element=t.element,e.min=(n,a)=>e.check(Kf(n,a)),e.nonempty=n=>e.check(Kf(1,n)),e.max=(n,a)=>e.check(ON(n,a)),e.length=(n,a)=>e.check(MN(n,a)),e.unwrap=()=>e.element});function ot(e,t){return sU(C6,e,t)}const N6=de("ZodObject",(e,t)=>{WL.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>kU(e,n,a,s),_t(e,"shape",()=>t.shape),e.keyof=()=>Le(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:tn()}),e.loose=()=>e.clone({...e._zod.def,catchall:tn()}),e.strict=()=>e.clone({...e._zod.def,catchall:E6()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>y5(e,n),e.safeExtend=n=>v5(e,n),e.merge=n=>b5(e,n),e.pick=n=>p5(e,n),e.omit=n=>g5(e,n),e.partial=(...n)=>x5(FN,e,n[0]),e.required=(...n)=>S5($N,e,n[0])});function ie(e,t){const n={type:"object",shape:e??{},...Pe(t)};return new N6(n)}const UN=de("ZodUnion",(e,t)=>{AN.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>jU(e,n,a,s),e.options=t.options});function Eh(e,t){return new UN({type:"union",options:e,...Pe(t)})}const _6=de("ZodDiscriminatedUnion",(e,t)=>{UN.init(e,t),JL.init(e,t)});function Ch(e,t,n){return new _6({type:"union",options:t,discriminator:e,...Pe(n)})}const T6=de("ZodIntersection",(e,t)=>{eP.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>EU(e,n,a,s)});function A6(e,t){return new T6({type:"intersection",left:e,right:t})}const R6=de("ZodRecord",(e,t)=>{tP.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>CU(e,n,a,s),e.keyType=t.keyType,e.valueType=t.valueType});function dn(e,t,n){return new R6({type:"record",keyType:e,valueType:t,...Pe(n)})}const Uy=de("ZodEnum",(e,t)=>{nP.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>vU(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 Uy({...t,checks:[],...Pe(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 Uy({...t,checks:[],...Pe(s),entries:o})}});function Le(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new Uy({type:"enum",entries:n,...Pe(t)})}const O6=de("ZodLiteral",(e,t)=>{rP.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>bU(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 Zt(e,t){return new O6({type:"literal",values:Array.isArray(e)?e:[e],...Pe(t)})}const M6=de("ZodTransform",(e,t)=>{aP.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>SU(e,n),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new dN(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(gc(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(gc(c))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(o=>(n.value=o,n)):(n.value=s,n)}});function BN(e){return new M6({type:"transform",transform:e})}const FN=de("ZodOptional",(e,t)=>{RN.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>LN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function W1(e){return new FN({type:"optional",innerType:e})}const z6=de("ZodExactOptional",(e,t)=>{iP.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>LN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function D6(e){return new z6({type:"optional",innerType:e})}const I6=de("ZodNullable",(e,t)=>{sP.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>NU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function J1(e){return new I6({type:"nullable",innerType:e})}const L6=de("ZodDefault",(e,t)=>{lP.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>TU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function P6(e,t){return new L6({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():pN(t)}})}const U6=de("ZodPrefault",(e,t)=>{oP.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>AU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function B6(e,t){return new U6({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():pN(t)}})}const $N=de("ZodNonOptional",(e,t)=>{uP.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>_U(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function F6(e,t){return new $N({type:"nonoptional",innerType:e,...Pe(t)})}const $6=de("ZodCatch",(e,t)=>{cP.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>RU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function H6(e,t){return new $6({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const q6=de("ZodPipe",(e,t)=>{dP.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>OU(e,n,a,s),e.in=t.in,e.out=t.out});function By(e,t){return new q6({type:"pipe",in:e,out:t})}const Z6=de("ZodReadonly",(e,t)=>{fP.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>MU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function G6(e){return new Z6({type:"readonly",innerType:e})}const V6=de("ZodCustom",(e,t)=>{hP.init(e,t),Wt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>xU(e,n)});function Q6(e,t={}){return lU(V6,e,t)}function K6(e){return oU(e)}function Y6(e,t){return By(BN(e),t)}const ds={custom:"custom"};function Nh(e){return HP(Jv,e)}const X6=new RegExp("(?<![A-Za-z0-9_.@-])@([A-Za-z0-9][A-Za-z0-9_-]{0,63})\\b","g");function W6(e){return e.replace(/```[\s\S]*?```/g,"").replace(/~~~[\s\S]*?~~~/g,"").replace(/`[^`\n]+`/g,"")}function HN(e,t){const n=W6(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(X6)){const c=o[1];if(!c)continue;const f=a.get(c.toLowerCase());f&&s.add(f)}return[...s]}const J6=/^\/(?![/\\])[A-Za-z0-9_\-./?=&%#]*$/,ek="/";function qN(e){return!e||typeof e!="string"||e.length>256||!J6.test(e)?"/":e}const eB={FEISHU:"feishu",SLACK:"slack",KAEL:"kael"},ZN=Le(["feishu","slack","kael"]),GN=Le(["active","inactive"]);ie({platform:ZN,agentId:N().min(1),credentials:dn(N(),tn()),status:GN.default("active")});ie({agentId:N().min(1).optional(),credentials:dn(N(),tn()).optional(),status:GN.optional()});ie({id:He(),platform:N(),agentId:N(),hasCredentials:Kn(),status:N(),createdAt:N(),updatedAt:N()});const tB=Le(["code","reverse_token","oauth","manual"]);ie({appId:N().min(1),appSecret:N().min(1)});ie({platform:ZN,externalUserId:N().min(1),agentId:N().min(1),boundVia:tB.default("manual"),displayName:N().max(200).optional()});ie({id:He(),platform:N(),externalUserId:N(),agentId:N(),boundVia:N().nullable(),displayName:N().nullable(),createdAt:N()});ie({feishuUserId:N().min(1),displayName:N().max(200).optional()});ie({configId:He(),platform:N(),agentId:N(),appId:N(),connected:Kn(),lastActiveAt:N().nullable()});const nB=32e3,eb=/^[a-z0-9][a-z0-9_-]{0,63}$/i,rB=/^[A-Z][A-Z0-9_]*$/,aB=/^[A-Za-z]:/,VN=ie({append:N().max(nB).default("")}),iB=ie({name:N().regex(eb,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Zt("stdio"),command:N().min(1),args:ot(N()).optional()}),sB=ie({name:N().regex(eb,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Zt("http"),url:N().url(),headers:dn(N(),N()).optional()}),lB=ie({name:N().regex(eb,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Zt("sse"),url:N().url(),headers:dn(N(),N()).optional()}),QN=Ch("transport",[iB,sB,lB]),KN=ie({key:N().regex(rB,"Env key must match /^[A-Z][A-Z0-9_]*$/"),value:N(),sensitive:Kn().default(!1)});function oB(e){for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<=31||n===127)return!0}return!1}function uB(e){if(e.length===0)return"Git repo local path must not be empty";if(e.trim()!==e)return"Git repo local path must not have leading or trailing whitespace";if(oB(e))return"Git repo local path must not contain control characters";if(e.includes("\\"))return"Git repo local path must use forward slashes";if(e.startsWith("/")||aB.test(e))return"Git repo local path must be relative";const t=e.split("/");for(const n of t){if(!n)return"Git repo local path must not contain empty path segments";if(n==="."||n==="..")return"Git repo local path must not contain dot segments";if(n.trim()!==n)return"Git repo local path segments must not have leading or trailing whitespace"}return null}const tb=ie({url:N().min(1),ref:N().min(1).optional(),localPath:N().min(1).superRefine((e,t)=>{const n=uB(e);n&&t.addIssue({code:ds.custom,message:n})}).optional()}),YN=ie({prompt:VN.default({append:""}),model:N().default("opus"),mcpServers:ot(QN).default([]),env:ot(KN).default([]),gitRepos:ot(tb).default([])}),cB=YN.extend({kind:Zt("claude-code")}),dB=YN.extend({kind:Zt("codex")}),fB=Ch("kind",[cB,dB]),hB=(e,t)=>{const n=new Set;e.mcpServers.forEach((o,c)=>{const f=o.name.toLowerCase();n.has(f)&&t.addIssue({code:ds.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:ds.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??Xf(o.url);f&&(s.has(f)&&t.addIssue({code:ds.custom,path:["gitRepos",c,"localPath"],message:`Duplicate git repo local path "${f}"`}),s.add(f))})},XN=Y6(e=>e&&typeof e=="object"&&!Array.isArray(e)&&!("kind"in e)?{...e,kind:"claude-code"}:e,fB).superRefine((e,t)=>{hB(e,t)}),mB=ie({agentId:N(),version:He().int().positive(),payload:XN,updatedAt:N(),updatedBy:N()}),WN=ie({prompt:VN,model:N(),mcpServers:ot(QN),env:ot(KN),gitRepos:ot(tb)}).partial();ie({expectedVersion:He().int().positive(),payload:WN});ie({payload:WN});ie({current:mB,next:XN,diff:ot(ie({path:N(),op:Le(["add","remove","replace"]),before:tn().optional(),after:tn().optional()}))});const yc="***";function Xf(e){const t=e.trim();return t?((t.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,""):""}const JN=Le(["online","offline"]),e_=Le(["idle","working","blocked","error"]);Le(["active","suspended","evicted","errored"]);const pB=Le(["active","suspended","errored"]);ie({chatId:N().min(1),state:pB});ie({runtimeState:e_});ie({agentId:N().min(1),runtimeType:N().max(50),runtimeVersion:N().max(50).optional()});Le(["wrong_client","not_owned","agent_suspended","wrong_org","unknown_agent","runtime_provider_mismatch"]);ie({agentId:N(),status:JN,connectedAt:N().nullable(),lastSeenAt:N(),clientId:N().nullable().optional(),runtimeType:N().nullable().optional(),runtimeVersion:N().nullable().optional(),runtimeState:e_.nullable().optional(),activeSessions:He().int().nullable().optional(),totalSessions:He().int().nullable().optional(),runtimeUpdatedAt:N().nullable().optional()});ie({total:He().int(),running:He().int(),byState:ie({idle:He().int(),working:He().int(),blocked:He().int(),error:He().int()}),clients:He().int()});const Wf={CLAUDE_CODE:"claude-code",CODEX:"codex"},_h=Le(["claude-code","codex"]),Th=Le(["human","personal_assistant","autonomous_agent"]),tk={PRIVATE:"private",ORGANIZATION:"organization"},nb=Le(["private","organization"]),gB=Le(["admin-api","portal"]);Le(["active","suspended"]);const Fy=/^[a-z0-9][a-z0-9_-]{0,63}$/,ro=64,yB=["admin","agent","first-tree","hub","me","null","system","undefined"],vB=new Set(yB);function $y(e){return vB.has(e)}ie({name:N().min(1).max(64).regex(Fy,"Must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_). Max 64 chars.").refine(e=>!$y(e),{message:"That agent name is reserved — pick a different one."}).optional(),type:Th,displayName:N().min(1).max(200).optional(),delegateMention:N().max(100).optional(),organizationId:N().min(1).max(100).optional(),source:gB.optional(),visibility:nb.optional(),metadata:dn(N(),tn()).optional(),managerId:N().optional(),clientId:N().min(1).max(100).optional(),runtimeProvider:_h.optional(),gitRepos:ot(tb).optional()});ie({type:Th.optional(),displayName:N().min(1).max(200).optional(),delegateMention:N().max(100).nullable().optional(),visibility:nb.optional(),metadata:dn(N(),tn()).optional(),managerId:N().nullable().optional(),clientId:N().min(1).max(100).nullable().optional()});ie({clientId:N().min(1).max(100),runtimeProvider:_h,force:Kn().optional()});ie({uuid:N(),name:N().nullable(),organizationId:N(),type:Th,displayName:N(),delegateMention:N().nullable(),inboxId:N(),status:N(),source:N().nullable().optional(),visibility:nb,metadata:dn(N(),tn()),managerId:N().nullable(),clientId:N().nullable(),runtimeProvider:_h,presenceStatus:JN.optional(),createdAt:N(),updatedAt:N()});ie({repo:N().nullable(),branch:N().nullable()});ie({type:Zt("agent:pinned"),agentId:N(),name:N().nullable(),displayName:N(),agentType:Th,runtimeProvider:_h});ie({username:N().min(1),password:N().min(1)});ie({accessToken:N(),refreshToken:N()});ie({refreshToken:N().min(1)});ie({token:N().min(1)});ie({token:N(),expiresIn:He(),command:N()});const bB=["issue","pull_request","discussion","commit"],rb=Le(bB),xB=ie({source:Zt("github"),entityType:rb,entityKey:N().min(1),entityUrl:N().url().optional()}),SB=ie({source:Zt("feishu"),externalChannelId:N().min(1)}),wB=Ch("source",[xB,SB]),kB=Eh([ie({}).strict(),wB]),jB=Le(["direct","group"]),Hy={ACTIVE:"active",ARCHIVED:"archived",DELETED:"deleted"},ab=Le(["active","archived","deleted"]);ie({status:ab});ie({type:jB,topic:N().max(500).optional(),participantIds:ot(N()).min(1),metadata:kB.optional()});const t_=ie({agentId:N(),role:N(),mode:N(),joinedAt:N()});t_.extend({name:N().nullable(),displayName:N(),type:N()});const EB=ie({id:N(),organizationId:N(),type:N(),topic:N().nullable(),lifecyclePolicy:N().nullable().optional(),metadata:dn(N(),tn()),createdAt:N(),updatedAt:N()});EB.extend({participants:ot(t_),title:N(),firstMessagePreview:N().nullable(),engagementStatus:ab});ie({topic:N().trim().max(500).nullable()});ie({agentId:N().min(1)});ie({agentId:N().min(1)});const CB=Le(["connected","disconnected"]),NB=Le(["ok","expired"]);ie({id:N(),userId:N().nullable(),status:CB,authState:NB,sdkVersion:N().max(50).nullable(),hostname:N().max(100).nullable(),os:N().max(50).nullable(),agentCount:He().int().min(0),connectedAt:N().nullable(),lastSeenAt:N(),metadata:dn(N(),tn()).nullable()});const _B=ie({wsInboxDeliver:Kn().default(!1)}).partial();ie({clientId:N().min(1).max(100),hostname:N().max(100).optional(),os:N().max(50).optional(),sdkVersion:N().max(50).optional(),wireCapabilities:_B.optional()});ie({clientId:N(),previousUserId:N().nullable(),unpinnedAgentCount:He().int().nonnegative()});const TB=Le(["ok","missing","unauthenticated","error"]),AB=Le(["api_key","oauth","auth_json","none"]),RB=ie({state:TB,available:Kn(),authenticated:Kn(),sdkVersion:N().nullable().optional(),authMethod:AB,error:N().nullable().optional(),detectedAt:N()}),OB=dn(N(),RB);ie({capabilities:OB});ie({limit:Nh().int().min(1).max(100).default(20),cursor:N().optional()});const MB=Le(["active","stale","unavailable"]),zB=Le(["ok","warning","error"]),DB=ie({label:N(),detail:N().nullable(),severity:zB}),IB=Le(["root","domain","subdomain","leaf"]),ib=Le(["added","edited","removed"]),LB=Le(["parent","soft_link","markdown_link"]),PB=Le(["low","medium","high"]),UB=ie({id:N(),path:N(),sourcePath:N().nullable(),title:N(),kind:IB,owners:ot(N()),parentId:N().nullable(),preview:N().nullable(),relatedNodeIds:ot(N()),affectedContextArea:N(),changeType:ib.nullable(),changedAtCommit:N().nullable()}),BB=ie({source:N(),target:N(),kind:LB}),FB=ie({path:N(),nodeId:N().nullable(),type:ib,commit:N().nullable(),changedAt:N().nullable(),changedBy:N().nullable(),summary:N().nullable()}),$B=ie({id:N(),nodeId:N().nullable(),path:N(),title:N(),changeType:ib,affectedContextArea:N(),reason:N(),summary:N(),changedBy:N().nullable(),owners:ot(N()),relatedNodeIds:ot(N()),sourceCommit:N().nullable(),riskLevel:PB}),HB=ie({addedCount:He().int().nonnegative(),editedCount:He().int().nonnegative(),removedCount:He().int().nonnegative(),changedNodeCount:He().int().nonnegative()});ie({repo:N().nullable(),branch:N().nullable(),headCommit:N().nullable(),syncedAt:N().nullable(),snapshotStatus:MB,contextStatus:DB,summary:HB,updates:ot($B),nodes:ot(UB),edges:ot(BB),changes:ot(FB)});const qB=["User","Organization"],ZB=Le(qB),GB=["read","write","admin"],VB=Le(GB),QB=dn(N(),VB),KB=ot(N());ie({login:N().optional(),accessToken:N().optional(),accessTokenExpiresAt:N().datetime({offset:!0}).optional(),refreshToken:N().optional(),refreshTokenExpiresAt:N().datetime({offset:!0}).optional()});ie({installationId:He().int().positive()});ie({installationId:He().int().positive(),accountType:ZB,accountLogin:N(),accountGithubId:He().int().positive(),permissions:QB,events:KB,suspended:Kn(),manageUrl:N().url(),createdAt:N().datetime({offset:!0}),updatedAt:N().datetime({offset:!0})});const YB=["image/png","image/jpeg","image/gif","image/webp"],sb=Le(YB);ie({data:N().min(1),mimeType:sb,filename:N().min(1),size:He().int().nonnegative().optional(),imageId:N().uuid().optional()});ie({imageId:N().uuid(),mimeType:sb,filename:N().min(1),size:He().int().nonnegative().optional()});ie({type:Zt("image_payload"),imageId:N().uuid(),chatId:N(),base64:N().min(1),mimeType:sb,filename:N().min(1),size:He().int().nonnegative().optional()});const lb=Le(["hub_ui","cli","feishu","github","api"]),n_=Le(["text","markdown","card","reference","file","question","question_answer"]);ie({format:n_.default("text"),content:tn(),metadata:dn(N(),tn()).optional(),inReplyTo:N().optional(),replyToInbox:N().optional(),replyToChat:N().optional(),source:lb.optional()});ie({format:n_.default("text"),content:tn(),metadata:dn(N(),tn()).optional(),replyToInbox:N().optional(),replyToChat:N().optional(),source:lb.optional()});const XB=ie({id:N(),chatId:N(),senderId:N(),format:N(),content:tn(),metadata:dn(N(),tn()),replyToInbox:N().nullable(),replyToChat:N().nullable(),inReplyTo:N().nullable(),source:lb.nullable(),createdAt:N()}),WB=ie({senderId:N(),chatId:N(),replyToChat:N().nullable()}).nullable(),JB=Le(["full","mention_only"]),eF=ie({id:N(),senderId:N(),format:N(),content:tn(),metadata:dn(N(),tn()).default({}),createdAt:N()}),r_=XB.extend({configVersion:He().int().positive(),recipientMode:JB.default("full"),inReplyToSnapshot:WB.default(null),precedingMessages:ot(eF).default([])});Le(["pending","delivered","acked","failed"]);const tF=ie({id:He(),inboxId:N(),messageId:N(),chatId:N().nullable(),status:N(),retryCount:He(),createdAt:N(),deliveredAt:N().nullable(),ackedAt:N().nullable()});tF.extend({message:r_});ie({limit:Nh().int().min(1).max(50).default(10)});ie({type:Zt("inbox:deliver"),entryId:He().int().nonnegative(),inboxId:N().min(1),chatId:N().nullable(),message:r_}).passthrough();ie({type:Zt("inbox:ack"),entryId:He().int().nonnegative()});const nF=7;ie({organizationId:N(),organizationName:N(),organizationDisplayName:N(),role:N(),expiresAt:N().nullable()});ie({id:N(),organizationId:N(),token:N(),inviteUrl:N(),role:N(),createdAt:N(),expiresAt:N().nullable()});ie({token:N().min(1)});ie({}).optional();const rF=["all","unread","watching"],aF=Le(rF),a_=Le(["participant","watching"]),iF=["active","archived","all"],i_=Le(iF);ie({cursor:N().optional(),limit:Nh().int().min(1).max(200).default(50),filter:aF.default("all"),engagement:i_.default("active")});const sF=ie({agentId:N(),displayName:N(),type:N()}),lF=Le(["tool_call","thinking","assistant_text"]),oF=ie({agentId:N(),kind:lF,label:N(),startedAt:N()}),uF=ie({chatId:N(),type:N(),membershipKind:a_,title:N(),topic:N().nullable(),participants:ot(sF),participantCount:He().int(),lastMessageAt:N().nullable(),lastMessagePreview:N().nullable(),unreadMentionCount:He().int(),canReply:Kn(),engagementStatus:ab,engagedAgentIds:ot(N()),liveActivity:oF.nullable()});ie({rows:ot(uF),nextCursor:N().nullable()});ie({participantIds:ot(N().min(1)).min(1),topic:N().trim().max(500).optional().nullable()});ie({participantIds:ot(N().min(1)).min(1)});ie({chatId:N(),lastReadAt:N(),unreadMentionCount:He().int()});ie({chatId:N(),membershipKind:a_.nullable()});ie({type:Zt("chat:message"),chatId:N()});Le(["connect","create_agent","completed"]);ie({id:N(),name:N(),displayName:N(),role:Le(["admin","member"])});ie({name:N().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/),displayName:N().min(1).max(200)});ie({dismissed:Kn().optional()});const cF=Le(["team_renamed","agent_created","tree_chat_started","tree_intro_dismissed"]);ie({event:cF,attrs:dn(N(),Eh([N(),He(),Kn(),w6()])).optional()});ie({id:N(),organizationId:N(),organizationName:N(),role:Le(["admin","member"]),agentId:N()});const dF={ADMIN:"admin",MEMBER:"member"},ob=Le(["admin","member"]),fF=ie({id:N(),userId:N(),organizationId:N(),agentId:N(),role:ob,createdAt:N()});ie({username:N().min(1).max(100),displayName:N().min(1).max(200),role:ob.default("member")});ie({role:ob.optional(),displayName:N().min(1).max(200).optional()});fF.extend({username:N(),displayName:N(),password:N()});const hF=ie({kind:Zt("github-app-installation"),installationId:He().int(),organizationId:N().min(1)}),mF=["mentioned","review_requested","assigned"],pF=Le(mF),gF=["opened","edited","closed","merged","reopened","commented","review_requested","reviewed","review_comment","synchronized","commit_commented","assigned","other"],s_=Le(gF),yF=ie({type:rb,repo:N().min(1),key:N().min(1),title:N().optional(),url:N().optional()}),vF=ie({githubLogin:N().min(1),isBot:Kn()}),bF=ie({githubLogin:N().min(1),reason:pF}),xF=ie({title:N(),body:N(),url:N()}),SF=ie({type:Zt("issue"),key:N().min(1)});ie({source:hF,deliveryId:N().nullable(),rawEventType:N().min(1),rawAction:N().nullable(),entity:yF,actor:vF,kind:s_,involves:ot(bF),surface:xF,relatedRefs:ot(SF)});const wF=["mentioned","review_requested","assigned","subscribed"],kF=Le(wF);ie({type:Zt("github_event"),reason:kF,event:N().min(1),action:N().nullable(),kind:s_,repository:N(),sender:N(),title:N(),body:N(),url:N(),entity:ie({type:rb,key:N().min(1),url:N().nullable()}),mentionedUser:N().optional()});const jF=Le(["agent_error","agent_blocked","agent_stale"]),l_=Le(["high","medium","low"]);ie({id:N(),organizationId:N(),type:jF,severity:l_,agentId:N().nullable(),chatId:N().nullable(),message:N(),read:Kn(),createdAt:N()});ie({limit:Nh().int().min(1).max(100).default(20),cursor:N().optional(),severity:l_.optional(),read:Le(["true","false"]).transform(e=>e==="true").optional(),agentId:N().optional()});ie({next:N().max(256).optional()});ie({code:N().min(1),state:N().min(1),installation_id:N().regex(/^\d+$/).optional(),setup_action:Le(["install","update","request"]).optional()});ie({githubId:N().min(1),login:N().min(1),email:N().email().optional(),displayName:N().optional(),next:N().max(256).optional(),installationId:N().regex(/^\d+$/).optional(),installationAccountType:Le(["User","Organization"]).optional(),installationAccountLogin:N().min(1).optional(),installationAccountGithubId:N().regex(/^\d+$/).optional()});const EF=/^(?:[A-Za-z0-9_.-]+@)?[A-Za-z0-9.-]+:(?!\d+(?:\/|$))[^/:@\s][^:@\s]*$/;function CF(e){return e.includes("://")?!1:EF.test(e)}const Ah=N().min(1).superRefine((e,t)=>{if(CF(e))return;let n;try{n=new URL(e)}catch{t.addIssue({code:ds.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:ds.custom,message:"Repo URL must use HTTPS or SSH."});return}if(n.password.length>0){t.addIssue({code:ds.custom,message:"Repo URL must not include credentials."});return}if(n.protocol==="https:"&&n.username.length>0){t.addIssue({code:ds.custom,message:"Repo URL must not include credentials."});return}}),NF=ie({repo:Ah.optional(),branch:N().default("main")}),_F=ie({repo:Ah.nullish(),branch:N().min(1).nullish()}),TF=ie({repo:N().optional(),branch:N().optional()}),AF=ie({repos:ot(ie({url:Ah,defaultBranch:N().optional()})).default([])}),RF=ie({repos:ot(ie({url:Ah,defaultBranch:N().min(1).optional()})).optional()}),OF=ie({repos:ot(ie({url:N(),defaultBranch:N().optional()}))}),MF={context_tree:{storage:NF,input:_F,output:TF,readPolicy:"member"},source_repos:{storage:AF,input:RF,output:OF,readPolicy:"member"}},zF=Object.keys(MF);Le(zF);const o_=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;ie({name:N().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/,"Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine(e=>!o_.test(e),"Name must not be a UUID format"),displayName:N().min(1).max(200),maxAgents:He().int().min(0).default(0),maxMessagesPerMinute:He().int().min(0).default(0),features:dn(N(),tn()).default({})});ie({name:N().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/,"Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine(e=>!o_.test(e),"Name must not be a UUID format").optional(),displayName:N().min(1).max(200).optional(),maxAgents:He().int().min(0).optional(),maxMessagesPerMinute:He().int().min(0).optional(),features:dn(N(),tn()).optional()});ie({id:N(),name:N(),displayName:N(),maxAgents:He(),maxMessagesPerMinute:He(),features:dn(N(),tn()),createdAt:N(),updatedAt:N()});const DF=ie({workingCount:He().int().nonnegative(),errorMask:Kn()}),IF=ie({type:Zt("pulse:tick"),organizationId:N(),agents:dn(N(),ot(DF).length(32))}),LF=ie({label:N().min(1),description:N(),preview:N().nullable().optional()}),PF=ie({question:N().min(1),header:N().min(1).max(24),options:ot(LF).min(2).max(4),multiSelect:Kn()}),UF=Le(["html","markdown"]).nullable(),BF=ie({correlationId:N().min(1),questions:ot(PF).min(1).max(4),previewFormat:UF,allowFreeText:Kn()}),FF=ie({correlationId:N().min(1),answers:dn(N().min(1),N())});ie({answers:dn(N().min(1),N())});Le(["pending","answered","superseded"]);const $F=Le(["tool_call","error","assistant_text","thinking","turn_end"]),u_=ie({toolUseId:N(),name:N(),args:tn(),status:Le(["pending","ok","error"]),durationMs:He().int().nonnegative().optional(),resultPreview:N().max(400).optional()}),c_=ie({source:Le(["sdk","runtime","tool"]),message:N().max(2e3)}),d_=ie({text:N().max(8e3)}),f_=ie({}),h_=ie({status:Le(["success","error"])}),HF=Ch("kind",[ie({kind:Zt("tool_call"),payload:u_}),ie({kind:Zt("error"),payload:c_}),ie({kind:Zt("assistant_text"),payload:d_}),ie({kind:Zt("thinking"),payload:f_}),ie({kind:Zt("turn_end"),payload:h_})]);ie({id:N(),agentId:N(),chatId:N(),seq:He().int().positive(),kind:$F,payload:Eh([u_,c_,d_,f_,h_]),createdAt:N()});ie({agentId:N(),chatId:N(),event:HF});ie({type:Zt("session:reconcile"),agentId:N().min(1),chatIds:ot(N().min(1)).max(500)});ie({type:Zt("session:reconcile:result"),agentId:N().min(1),staleChatIds:ot(N().min(1))});const qF=ie({organizationId:N(),agentCount:He(),chatCount:He(),messageCount:He()});ie({totalAgents:He(),totalChats:He(),totalMessages:He(),byOrganization:ot(qF)});const ZF=Le(["active","suspended"]);ie({id:N(),username:N(),displayName:N(),avatarUrl:N().nullable(),status:ZF,createdAt:N(),updatedAt:N()});ie({username:N().min(1).max(100),displayName:N().min(1).max(200),password:N().min(8).max(200)});ie({displayName:N().min(1).max(200).optional(),password:N().min(8).max(200).optional()});ie({type:Zt("auth"),token:N().min(1)});const GF=ie({wsInboxDeliver:Kn().default(!1)}).partial();ie({type:Zt("server:welcome"),serverCommandVersion:N().min(1),serverTimeMs:He().int().nonnegative(),capabilities:GF.optional()}).passthrough();const m_=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));function VF(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 QF=2e3,KF=3e4;let es=null,vc=!1,Jf=0,rc=null;const qy=new Set;let Qn=null,Hs=0;const nk=500;let vg=0,lo=null;function rk(e){const t=Date.now(),n=t-vg;if(n>=nk){vg=t,e.invalidateQueries({queryKey:["me","chats"]});return}lo===null&&(lo=setTimeout(()=>{lo=null,vg=Date.now(),Qn&&Qn.invalidateQueries({queryKey:["me","chats"]})},nk-n))}function YF(e){for(const t of qy)try{t(e)}catch{}if(Qn){if(e.type==="notification")Qn.invalidateQueries({queryKey:["notifications"]});else if(e.type==="session:state")Qn.invalidateQueries({queryKey:["activity"]}),Qn.invalidateQueries({queryKey:["sessions"]}),rk(Qn);else if(e.type==="session:event")rk(Qn);else if(e.type==="chat:message"){const t=typeof e.chatId=="string"?e.chatId:null;Qn.invalidateQueries({queryKey:["me","chats"]}),t&&(Qn.invalidateQueries({queryKey:["chat-messages",t]}),Qn.invalidateQueries({queryKey:["chat-detail",t]}))}}}function ub(){const e=hh();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);es=s,s.onmessage=o=>{if(s===es)try{const c=JSON.parse(o.data);YF(c)}catch{}},s.onopen=()=>{s===es&&(Jf=0,Qn&&(Qn.invalidateQueries({queryKey:["notifications"]}),Qn.invalidateQueries({queryKey:["activity"]}),Qn.invalidateQueries({queryKey:["sessions"]}),Qn.invalidateQueries({queryKey:["me","chats"]})))},s.onclose=o=>{if(s===es&&(es=null,!(vc||Hs===0))){if(o.code===4001){PM().then(c=>{vc||Hs===0||(c?(Jf=0,ub()):ak())});return}ak()}}}function ak(){Jf++;const e=Math.min(QF*2**(Jf-1),KF);rc=setTimeout(()=>{rc=null,!vc&&Hs>0&&ub()},e)}function XF(){vc=!0,rc&&(clearTimeout(rc),rc=null),lo&&(clearTimeout(lo),lo=null),es&&(es.close(1e3,"unmount"),es=null)}function p_(e){const{onMessage:t,enabled:n=!0}=e??{},a=pn(),s=b.useRef(t);s.current=t,b.useEffect(()=>{Qn=a},[a]),b.useEffect(()=>{if(!n)return;const o=c=>{var f;return(f=s.current)==null?void 0:f.call(s,c)};return qy.add(o),Hs++,Hs===1&&(vc=!1,ub()),()=>{qy.delete(o),Hs--,Hs===0&&XF()}},[n])}const WF=b.createContext({aggregated:m_,agents:{},receivedAtMs:null,stale:!0});function JF({children:e}){const[t,n]=b.useState({aggregated:m_,agents:{},receivedAtMs:null}),[a,s]=b.useState(()=>Date.now());p_({onMessage:c=>{const f=IF.safeParse(c);f.success&&n({aggregated:VF(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(WF.Provider,{value:o,children:e})}function bc(e){return Ee.get(`/agents/${e}/config`)}function Rh(e,t){return Ee.patch(`/agents/${e}/config`,t)}function e$(e,t){return Ee.post(`/agents/${e}/config/dry-run`,{payload:t})}function t$(e){return Ee.get(`/agents/${e}/client-status`)}function n$({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 r$({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 a$(){return l.jsx("span",{style:{color:"var(--fg-4)"},children:"/"})}function i$({children:e,mono:t}){return l.jsx("span",{className:ze("font-medium",t&&"mono"),style:{color:"var(--fg)"},children:e})}const s$={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 dr({tone:e="neutral",className:t,style:n,...a}){const s=s$[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 Zy({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 cb({className:e,style:t,...n}){return l.jsx("span",{className:ze("mono uppercase text-caption",e),style:{color:"var(--fg-3)",...t},...n})}function ac({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 l$(e){return e==="idle"||e==="working"||e==="blocked"||e==="error"||e==="offline"}function xc({state:e,className:t}){const n=e!==null&&l$(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(ac,{state:n,size:7}),n]})}function wf({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 o$(e,t,n){return e?n==="admin"||!!t&&e.managerId===t:!1}function u$(e){var t;return e.agentStatus!=="active"?{disabled:!0,title:"Only active agents can be tested."}:e.clientStatusLoading?{disabled:!0,title:"Checking the bound computer before testing."}:(t=e.clientStatus)!=null&&t.clientId?e.clientStatus.online?e.testPending?{disabled:!0,title:"Test in progress."}:{disabled:!1,title:"Send a test message to verify this agent can respond."}:{disabled:!0,title:"The bound computer is offline."}:{disabled:!0,title:"Bind a computer before testing this agent."}}function ik(e){return e.status==="connected"}function c$({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 d$(e){const{agent:t}=e,[n,a]=b.useState(!1),[s,o]=b.useState(!1),c=t.displayName||t.name||t.uuid,f=t.status==="suspended";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(zo,{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(bg,{title:"Suspend agent",body:"Pause all active sessions. You can reactivate later; tokens stay revoked until then.",action:l.jsx(xe,{variant:"outline",size:"xs",onClick:()=>o(!0),disabled:e.suspendPending,children:e.suspendPending?"Suspending…":"Suspend"})}):l.jsx(bg,{title:"Reactivate agent",body:"Resume sessions. Tokens must be recreated — they are not restored.",action:l.jsx(xe,{variant:"outline",size:"xs",onClick:e.onReactivate,disabled:e.reactivatePending,children:e.reactivatePending?"Reactivating…":"Reactivate"})}),l.jsx(bg,{title:"Delete agent",body:f?"Permanent. Configuration, bindings, tokens, and session history are all dropped.":"Suspend this agent before deleting it.",action:l.jsxs(xe,{variant:"destructive",size:"xs",onClick:()=>{f&&a(!0)},disabled:e.deletePending||!f,title:f?void 0:"Suspend this agent before deleting it",children:[l.jsx(qf,{className:"h-3 w-3"}),"Delete"]})})]}),e.errorMessage&&l.jsx("div",{className:"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)",color:"var(--state-error)"},children:e.errorMessage}),l.jsx(f$,{open:s,onOpenChange:o,label:c,onConfirm:()=>{o(!1),e.onSuspend()},pending:e.suspendPending}),l.jsx(h$,{open:n,onOpenChange:a,expected:c,onDelete:()=>{a(!1),e.onDelete()},deleting:e.deletePending})]})}function bg(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 f$({open:e,onOpenChange:t,label:n,onConfirm:a,pending:s}){return l.jsx(Rn,{open:e,onOpenChange:t,children:l.jsxs(Cn,{children:[l.jsx(Pn,{children:l.jsxs(On,{children:['Suspend "',n,'"?']})}),l.jsx("div",{className:"space-y-3",children:l.jsx("p",{className:"text-body",style:{color:"var(--fg-2)"},children:"Runtime binds and HTTP calls will be refused while the agent is suspended. Active sessions end on their next message. You can reactivate later from this same page."})}),l.jsxs(mr,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),l.jsx(xe,{type:"button",variant:"destructive",onClick:a,disabled:s,children:s?"Suspending…":"Suspend"})]})]})})}function h$({open:e,onOpenChange:t,expected:n,onDelete:a,deleting:s}){const[o,c]=b.useState("");function f(m){m.preventDefault(),o===n&&a()}return l.jsx(Rn,{open:e,onOpenChange:m=>{t(m),m||c("")},children:l.jsxs(Cn,{children:[l.jsx(Pn,{children:l.jsxs(On,{children:['Delete "',n,'"?']})}),l.jsxs("form",{onSubmit:f,className:"space-y-4",children:[l.jsxs("p",{className:"text-body text-muted-foreground",children:["This action cannot be undone. Type ",l.jsx("span",{className:"font-mono font-medium text-foreground",children:n})," ","to confirm."]}),l.jsx(qt,{value:o,onChange:m=>c(m.target.value),autoFocus:!0,placeholder:n,className:"font-mono"}),l.jsxs(mr,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),l.jsx(xe,{type:"submit",variant:"destructive",disabled:o!==n||s,children:s?"Deleting…":"Delete"})]})]})]})})}var m$="Label",g_=b.forwardRef((e,t)=>l.jsx(yi.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())}}));g_.displayName=m$;var p$=g_;const St=b.forwardRef(({className:e,...t},n)=>l.jsx(p$,{ref:n,className:ze("text-label leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));St.displayName="Label";const jn=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}));jn.displayName="Panel";const fa=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}));fa.displayName="PanelHeader";const ha=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}));ha.displayName="PanelTitle";const rr=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}));rr.displayName="PanelBody";const g$={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 db({status:e,onEdit:t,onDelete:n,onUndo:a,children:s,disabled:o}){const c=g$[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(xe,{size:"sm",variant:"ghost",onClick:a,children:[l.jsx(iz,{className:"h-3.5 w-3.5 mr-1"}),"Undo"]}):l.jsxs("div",{className:"flex gap-1 shrink-0",children:[l.jsxs(xe,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:t,title:"Edit",children:[l.jsx(zv,{className:"h-3.5 w-3.5"}),l.jsx("span",{className:"sr-only",children:"Edit"})]}),l.jsxs(xe,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:n,title:"Delete",children:[l.jsx(qf,{className:"h-3.5 w-3.5"}),l.jsx("span",{className:"sr-only",children:"Delete"})]})]}))]})}function y$(e){var f;const[t,n]=b.useState(null),[a,s]=b.useState(()=>new Set),o=m=>s(h=>{const p=new Set(h);return p.has(m)?p.delete(m):p.add(m),p}),c=e.items.filter(m=>m.status!=="deleted").length;return l.jsxs(jn,{children:[l.jsxs(fa,{children:[l.jsxs(ha,{children:["Environment variables (",c,")"]}),!e.disabled&&l.jsxs(xe,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(ka,{className:"h-3 w-3"})," Add"]})]}),l.jsx(rr,{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(m=>{const h=m.value.sensitive,p=m.value.value===yc,g=h&&!p&&!!m.value.value,S=a.has(m.key);let x;return h?g&&S?x=m.value.value:x="••••••":x=m.value.value||l.jsx("em",{children:"(empty)"}),l.jsxs(db,{status:m.status,onEdit:()=>n({mode:"edit",key:m.key,initial:m.value}),onDelete:()=>e.onDelete(m.key),onUndo:()=>e.onUndoDelete(m.key),disabled:e.disabled,children:[l.jsx("span",{className:"font-mono font-medium",children:m.value.key}),l.jsx("span",{className:"font-mono text-caption text-muted-foreground truncate max-w-xs",children:x}),h&&l.jsx(mh,{className:"h-3 w-3 text-muted-foreground","aria-hidden":!0}),h&&l.jsx("button",{type:"button",onClick:()=>g&&o(m.key),className:"bg-transparent border-0 cursor-pointer inline-flex items-center text-muted-foreground",title:g?S?"Hide value":"Reveal value":"Saved sensitive values can't be revealed. Edit to set a new value.","aria-label":S?"Hide value":"Reveal value",disabled:!g,style:{padding:0,opacity:g?1:.4},children:S?l.jsx(R3,{className:"h-3.5 w-3.5"}):l.jsx($E,{className:"h-3.5 w-3.5"})})]},m.key)})}),t&&l.jsx(x$,{open:!!t,onOpenChange:m=>!m&&n(null),initial:t.mode==="edit"?t.initial:null,allowKeepExisting:t.mode==="edit"&&v$(t.initial,(f=e.items.find(m=>m.key===t.key))==null?void 0:f.status),forbiddenKeys:e.otherKeys(t.mode==="edit"?t.key:null),onSubmit:m=>{t.mode==="edit"?e.onUpdate(t.key,m):e.onAdd(m),n(null)}})]})}function v$(e,t){return e.sensitive&&e.value===yc&&t!==void 0&&t!=="added"}function sk(e,t){return!e||t?"":e.value}function b$(e){return e.sensitive&&e.allowKeepExisting&&!e.value?{ok:!0,value:yc}:e.sensitive&&!e.value?{ok:!1,error:"Value is required for sensitive entries."}:{ok:!0,value:e.value}}function x$({open:e,onOpenChange:t,initial:n,allowKeepExisting:a,forbiddenKeys:s,onSubmit:o}){const[c,f]=b.useState((n==null?void 0:n.key)??""),[m,h]=b.useState(sk(n,a)),[p,g]=b.useState((n==null?void 0:n.sensitive)??!1),[S,x]=b.useState(null);b.useEffect(()=>{e&&(f((n==null?void 0:n.key)??""),h(sk(n,a)),g((n==null?void 0:n.sensitive)??!1),x(null))},[e,n,a]);function j(k){if(k.preventDefault(),!c.match(/^[A-Z][A-Z0-9_]*$/)){x("Key must match /^[A-Z][A-Z0-9_]*$/.");return}if(s.has(c)){x(`Another entry already uses key "${c}".`);return}const w=b$({value:m,sensitive:p,allowKeepExisting:a});if(!w.ok){x(w.error);return}if(!p&&!n&&!m){x("Value is required for non-sensitive entries.");return}o({key:c,value:w.value,sensitive:p})}return l.jsx(Rn,{open:e,onOpenChange:t,children:l.jsxs(Cn,{children:[l.jsx(Pn,{children:l.jsx(On,{children:n?"Edit environment variable":"Add environment variable"})}),l.jsxs("form",{onSubmit:j,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{htmlFor:"env-key",children:"Key"}),l.jsx(qt,{id:"env-key",value:c,onChange:k=>f(k.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(St,{htmlFor:"env-value",children:"Value"}),l.jsx(qt,{id:"env-value",type:p?"password":"text",autoComplete:"new-password",value:m,onChange:k=>h(k.target.value),placeholder:a?"Leave empty to keep existing value":p?"new secret":"value",className:"font-mono"})]}),l.jsxs("label",{className:"flex items-center gap-2 text-body",children:[l.jsx("input",{type:"checkbox",checked:p,onChange:k=>g(k.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."}),S&&l.jsx("p",{className:"text-body text-destructive",children:S}),l.jsxs(mr,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(xe,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function S$(e){const[t,n]=b.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return l.jsxs(jn,{children:[l.jsxs(fa,{children:[l.jsxs(ha,{children:["Git repositories (",a,")"]}),!e.disabled&&l.jsxs(xe,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(ka,{className:"h-3 w-3"})," Add"]})]}),l.jsx(rr,{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??Xf(s.value.url);return l.jsxs(db,{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(w$,{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 w$({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,S]=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)??""),S(null))},[e,n]);function x(j){j.preventDefault();const k=o.trim();if(!k){S("URL is required.");return}const w=h.trim()||Xf(k);if(w&&a.has(w)){S(`Another repo already occupies local path "${w}".`);return}const C={url:k,...f.trim()?{ref:f.trim()}:{},...h.trim()?{localPath:h.trim()}:{}};s(C)}return l.jsx(Rn,{open:e,onOpenChange:t,children:l.jsxs(Cn,{children:[l.jsx(Pn,{children:l.jsx(On,{children:n?"Edit Git repository":"Add Git repository"})}),l.jsxs("form",{onSubmit:x,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{htmlFor:"git-url",children:"URL"}),l.jsx(qt,{id:"git-url",value:o,onChange:j=>c(j.target.value),placeholder:"git@github.com:org/repo.git",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{htmlFor:"git-ref",children:"Ref (branch / tag / sha, optional)"}),l.jsx(qt,{id:"git-ref",value:f,onChange:j=>m(j.target.value),placeholder:"main",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{htmlFor:"git-path",children:"Local path (optional)"}),l.jsx(qt,{id:"git-path",value:h,onChange:j=>p(j.target.value),placeholder:Xf(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(mr,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(xe,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function y_({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,S=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:S},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:S},children:["@",e]})]})}function fb(){return Ee.get(gn("/members"))}function k$(e,t){return Ee.patch(gn(`/members/${encodeURIComponent(e)}`),t)}function j$(e){return Ee.delete(gn(`/members/${encodeURIComponent(e)}`))}function v_(){const{data:e}=Ye({queryKey:["members","name-map"],queryFn:fb,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 E$({agent:e,canEdit:t=!0,onSave:n}){const[a,s]=b.useState(!1),o=Gv(),c=v_(),f=e.metadata,m=f==null?void 0:f.tree,h=typeof(m==null?void 0:m.role)=="string"?m.role:null,p=Array.isArray(m==null?void 0:m.domains)?(m==null?void 0:m.domains).filter(x=>typeof x=="string"):[],g=e.managerId?c(e.managerId):null,S=e.delegateMention?o(e.delegateMention):null;return l.jsxs(jn,{children:[l.jsxs(fa,{children:[l.jsx(ha,{children:"Profile"}),t&&e.status==="active"&&l.jsxs(xe,{size:"xs",variant:"outline",onClick:()=>s(!0),children:[l.jsx(zv,{className:"h-3 w-3"})," Edit"]})]}),l.jsxs(rr,{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]}),S&&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(y_,{name:S.name,displayName:S.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:g??"—"})]}),h&&l.jsxs("span",{children:["role ",l.jsx("span",{className:"text-foreground",children:h})]}),l.jsxs("span",{children:["type ",l.jsx(dr,{tone:e.type==="autonomous_agent"?"accent":"neutral",children:e.type})]}),l.jsxs("span",{children:["visibility"," ",l.jsx(dr,{tone:e.visibility==="organization"?"accent":"outline",children:e.visibility})]}),p.length>0&&l.jsxs("span",{children:["domains"," ",l.jsx("span",{className:"inline-flex flex-wrap gap-1 align-middle",children:p.map(x=>l.jsx(dr,{tone:"outline",children:x},x))})]})]})]}),t&&l.jsx(C$,{agent:e,open:a,onOpenChange:s,onSave:n})]})}function C$({agent:e,open:t,onOpenChange:n,onSave:a}){var z;const{memberId:s,role:o}=lt(),[c,f]=b.useState(e.displayName),[m,h]=b.useState(e.delegateMention??""),[p,g]=b.useState(e.visibility),[S,x]=b.useState(!1),[j,k]=b.useState(null);b.useEffect(()=>{t&&(f(e.displayName),h(e.delegateMention??""),g(e.visibility),k(null))},[t,e]);const w=e.type==="human",C=o==="admin"||e.managerId===s,_=Ye({queryKey:["agents-for-delegate"],queryFn:async()=>(await Bc({limit:100})).items.filter(O=>O.type==="personal_assistant"&&O.status==="active"),enabled:t&&w});async function R(I){I.preventDefault(),k(null);const O=c.trim();if(!O){k("Display name is required.");return}x(!0);try{const F={displayName:O,delegateMention:m||null};p!==e.visibility&&(F.visibility=p),await a(F),n(!1)}catch(F){k(F instanceof Error?F.message:String(F))}finally{x(!1)}}return l.jsx(Rn,{open:t,onOpenChange:n,children:l.jsxs(Cn,{children:[l.jsx(Pn,{children:l.jsx(On,{children:"Edit Identity"})}),l.jsxs("form",{onSubmit:R,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{children:"Agent name"}),l.jsx(qt,{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(St,{htmlFor:"id-display",children:"Display Name"}),l.jsx(qt,{id:"id-display",value:c,onChange:I=>f(I.target.value),placeholder:"How teammates see this agent",maxLength:200})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{htmlFor:"id-visibility",children:"Visibility"}),l.jsxs("select",{id:"id-visibility",value:p,onChange:I=>g(I.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:tk.PRIVATE,children:"Private — only the manager"}),l.jsx("option",{value:tk.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."})]}),w&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{htmlFor:"id-delegate",children:"Delegate Mention"}),l.jsxs("select",{id:"id-delegate",value:m,onChange:I=>h(I.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"",children:"None"}),(z=_.data)==null?void 0:z.map(I=>l.jsx("option",{value:I.uuid,children:I.displayName?`${I.displayName} (@${I.name??I.uuid})`:I.name?`@${I.name}`:I.uuid},I.uuid))]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Assistant that acts on behalf of this agent."})]}),j&&l.jsx("p",{className:"text-body text-destructive",children:j}),l.jsxs(mr,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>n(!1),disabled:S,children:"Cancel"}),l.jsx(xe,{type:"submit",disabled:S,children:S?"Saving…":"Save"})]})]})]})})}function N$(e){return e==="working"?"accent":e==="error"?"error":"outline"}function _$(e){const[t,n]=b.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return l.jsxs(jn,{children:[l.jsxs(fa,{children:[l.jsxs(ha,{children:["MCP servers (",a,")"]}),!e.disabled&&l.jsxs(xe,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(ka,{className:"h-3 w-3"})," Add"]})]}),l.jsx(rr,{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=e.toolHealth?s.status==="deleted"?"unknown":e.toolHealth(s.value.name):null;return l.jsxs(db,{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}),o&&l.jsx(dr,{tone:N$(o),children:o}),l.jsx("span",{className:"text-caption text-muted-foreground truncate",children:T$(s.value)})]},s.key)})}),t&&l.jsx(O$,{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 T$(e){var t;if(e.transport==="stdio"){const n=(t=e.args)!=null&&t.length?` ${e.args.map(a=>/[\s"']/.test(a)?JSON.stringify(a):a).join(" ")}`:"";return`${e.command}${n}`}return e.url}function lk(e){return e!=null&&e.length?JSON.stringify(e,null,2):""}function A$(e){const t=e.trim();if(!t)return{ok:!0,value:void 0};let n;try{n=JSON.parse(t)}catch{return{ok:!1,error:"Args must be a JSON array of strings."}}return!Array.isArray(n)||n.some(a=>typeof a!="string")?{ok:!1,error:"Args must be a JSON array of strings."}:{ok:!0,value:n}}function ok(e){return e&&Object.keys(e).length>0?JSON.stringify(e,null,2):""}function R$(e){const t=e.trim();if(!t)return{ok:!0,value:void 0};let n;try{n=JSON.parse(t)}catch{return{ok:!1,error:"Headers must be a JSON object with string values."}}if(!n||typeof n!="object"||Array.isArray(n))return{ok:!1,error:"Headers must be a JSON object with string values."};const a=Object.entries(n);return a.some(([s,o])=>!s||typeof o!="string")?{ok:!1,error:"Headers must be a JSON object with string values."}:{ok:!0,value:a.length>0?Object.fromEntries(a):void 0}}function O$({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,S]=b.useState(lk((n==null?void 0:n.transport)==="stdio"?n.args:void 0)),[x,j]=b.useState(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),[k,w]=b.useState(ok(n&&(n.transport==="http"||n.transport==="sse")?n.headers:void 0)),[C,_]=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:""),S(lk((n==null?void 0:n.transport)==="stdio"?n.args:void 0)),j(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),w(ok(n&&(n.transport==="http"||n.transport==="sse")?n.headers:void 0)),_(null))},[e,n]);function R(z){if(z.preventDefault(),!f.match(/^[a-z0-9][a-z0-9_-]{0,63}$/i)){_("Name must start alphanumeric and contain only a-z0-9_-.");return}if(a.has(f.toLowerCase())){_(`Another MCP server is already named "${f}".`);return}let I;if(o==="stdio"){if(!h.trim()){_("stdio transport requires a command.");return}const O=A$(g);if(!O.ok){_(O.error);return}I={name:f,transport:"stdio",command:h.trim(),...O.value?{args:O.value}:{}}}else{const O=x.trim();try{new URL(O)}catch{_("URL is not valid.");return}const F=R$(k);if(!F.ok){_(F.error);return}I={name:f,transport:o,url:O,...F.value?{headers:F.value}:{}}}s(I)}return l.jsx(Rn,{open:e,onOpenChange:t,children:l.jsxs(Cn,{children:[l.jsx(Pn,{children:l.jsx(On,{children:n?"Edit MCP server":"Add MCP server"})}),l.jsxs("form",{onSubmit:R,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{htmlFor:"mcp-transport",children:"Transport"}),l.jsxs("select",{id:"mcp-transport",value:o,onChange:z=>c(z.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(St,{htmlFor:"mcp-name",children:"Name"}),l.jsx(qt,{id:"mcp-name",value:f,onChange:z=>m(z.target.value),placeholder:"playwright",className:"font-mono"})]}),o==="stdio"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{htmlFor:"mcp-command",children:"Command"}),l.jsx(qt,{id:"mcp-command",value:h,onChange:z=>p(z.target.value),placeholder:"/usr/local/bin/playwright-mcp",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{htmlFor:"mcp-args",children:"Args (JSON array, optional)"}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Each arg as a separate JSON string. Use this when an arg contains spaces or quotes."}),l.jsx("textarea",{id:"mcp-args",value:g,onChange:z=>S(z.target.value),placeholder:'["--port", "3000"]',className:"flex min-h-24 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-2 text-body font-mono shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{htmlFor:"mcp-url",children:"URL"}),l.jsx(qt,{id:"mcp-url",value:x,onChange:z=>j(z.target.value),placeholder:"https://internal.api/mcp",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{htmlFor:"mcp-headers",children:"Headers (JSON object, optional)"}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"JSON object of request headers, for example auth headers required by the MCP server."}),l.jsx("textarea",{id:"mcp-headers",value:k,onChange:z=>w(z.target.value),placeholder:'{"Authorization": "Bearer ..."}',className:"flex min-h-24 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-2 text-body font-mono shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"})]})]}),C&&l.jsx("p",{className:"text-body text-destructive",children:C}),l.jsxs(mr,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(xe,{type:"submit",children:n?"Done":"Add"})]})]})]})})}const M$=[{value:"opus",label:"opus",hint:"most capable"},{value:"sonnet",label:"sonnet",hint:"balanced"},{value:"haiku",label:"haiku",hint:"fastest"}],z$=[{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"}],D$={"claude-code":M$,codex:z$},I$={"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."},L$={value:"",label:"(unset — inherits local)"};function P$({value:e,baseline:t,onChange:n,onRevert:a,disabled:s,provider:o="claude-code"}){const c=e!==t,f=D$[o],m=b.useMemo(()=>{const h=[L$,...f];return e!==""&&!f.some(p=>p.value===e)&&h.push({value:e,label:e,hint:"custom"}),h},[f,e]);return l.jsxs(jn,{style:{borderColor:c?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[l.jsxs(fa,{children:[l.jsxs(ha,{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(xe,{size:"xs",variant:"ghost",onClick:a,disabled:s,children:"Revert"})]}),l.jsxs(rr,{className:"space-y-2",children:[l.jsx(U$,{items:m,value:e,onChange:n,disabled:s}),l.jsx("p",{className:"text-caption text-muted-foreground",children:I$[o]})]})]})}function U$({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(S=>S.value===t)??e[0],g=b.useCallback(()=>{const S=m.current;if(!S)return;const x=S.getBoundingClientRect();f({top:x.bottom+4,left:x.left,width:x.width})},[]);return b.useLayoutEffect(()=>{s&&g()},[s,g]),b.useEffect(()=>{if(!s)return;const S=k=>{var C,_;const w=k.target;(C=m.current)!=null&&C.contains(w)||(_=h.current)!=null&&_.contains(w)||o(!1)},x=k=>{var w;k.key==="Escape"&&(o(!1),(w=m.current)==null||w.focus())},j=()=>g();return document.addEventListener("pointerdown",S),document.addEventListener("keydown",x),window.addEventListener("scroll",j,!0),window.addEventListener("resize",j),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("keydown",x),window.removeEventListener("scroll",j,!0),window.removeEventListener("resize",j)}},[s,g]),l.jsxs("div",{className:"max-w-md",children:[l.jsxs("button",{ref:m,type:"button",disabled:a,onClick:()=>o(S=>!S),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(Av,{className:"ml-2 h-3.5 w-3.5 transition-transform",style:{color:"var(--fg-3)",transform:s?"rotate(180deg)":void 0}})]}),s&&c&&Uv.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(S=>{const x=S.value===t;return l.jsxs("button",{type:"button",onClick:()=>{n(S.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:x?"var(--bg-hover)":void 0,color:S.value===""?"var(--fg-3)":void 0},children:[l.jsx(fr,{className:"h-3.5 w-3.5 flex-shrink-0",style:{visibility:x?"visible":"hidden",color:"var(--state-idle)"}}),l.jsx("span",{className:"flex-1 truncate",children:S.label}),S.hint&&l.jsx("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:S.hint})]},S.value||"__unset")})}),document.body)]})}function B$(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const F$=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$$=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,H$={};function uk(e,t){return(H$.jsx?$$:F$).test(e)}const q$=/[ \t\n\f\r]/g;function Z$(e){return typeof e=="object"?e.type==="text"?ck(e.value):!1:ck(e)}function ck(e){return e.replace(q$,"")===""}class Hc{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}}Hc.prototype.normal={};Hc.prototype.property={};Hc.prototype.space=void 0;function b_(e,t){const n={},a={};for(const s of e)Object.assign(n,s.property),Object.assign(a,s.normal);return new Hc(n,a,t)}function Gy(e){return e.toLowerCase()}class Mr{constructor(t,n){this.attribute=n,this.property=t}}Mr.prototype.attribute="";Mr.prototype.booleanish=!1;Mr.prototype.boolean=!1;Mr.prototype.commaOrSpaceSeparated=!1;Mr.prototype.commaSeparated=!1;Mr.prototype.defined=!1;Mr.prototype.mustUseProperty=!1;Mr.prototype.number=!1;Mr.prototype.overloadedBoolean=!1;Mr.prototype.property="";Mr.prototype.spaceSeparated=!1;Mr.prototype.space=void 0;let G$=0;const rt=ol(),wn=ol(),Vy=ol(),we=ol(),Ft=ol(),oo=ol(),Fr=ol();function ol(){return 2**++G$}const Qy=Object.freeze(Object.defineProperty({__proto__:null,boolean:rt,booleanish:wn,commaOrSpaceSeparated:Fr,commaSeparated:oo,number:we,overloadedBoolean:Vy,spaceSeparated:Ft},Symbol.toStringTag,{value:"Module"})),xg=Object.keys(Qy);class hb extends Mr{constructor(t,n,a,s){let o=-1;if(super(t,n),dk(this,"space",s),typeof a=="number")for(;++o<xg.length;){const c=xg[o];dk(this,xg[o],(a&Qy[c])===Qy[c])}}}hb.prototype.defined=!0;function dk(e,t,n){n&&(e[t]=n)}function Io(e){const t={},n={};for(const[a,s]of Object.entries(e.properties)){const o=new hb(a,e.transform(e.attributes||{},a),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(o.mustUseProperty=!0),t[a]=o,n[Gy(a)]=a,n[Gy(o.attribute)]=a}return new Hc(t,n,e.space)}const x_=Io({properties:{ariaActiveDescendant:null,ariaAtomic:wn,ariaAutoComplete:null,ariaBusy:wn,ariaChecked:wn,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:Ft,ariaCurrent:null,ariaDescribedBy:Ft,ariaDetails:null,ariaDisabled:wn,ariaDropEffect:Ft,ariaErrorMessage:null,ariaExpanded:wn,ariaFlowTo:Ft,ariaGrabbed:wn,ariaHasPopup:null,ariaHidden:wn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ft,ariaLevel:we,ariaLive:null,ariaModal:wn,ariaMultiLine:wn,ariaMultiSelectable:wn,ariaOrientation:null,ariaOwns:Ft,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:wn,ariaReadOnly:wn,ariaRelevant:null,ariaRequired:wn,ariaRoleDescription:Ft,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:wn,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function S_(e,t){return t in e?e[t]:t}function w_(e,t){return S_(e,t.toLowerCase())}const V$=Io({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:oo,acceptCharset:Ft,accessKey:Ft,action:null,allow:null,allowFullScreen:rt,allowPaymentRequest:rt,allowUserMedia:rt,alt:null,as:null,async:rt,autoCapitalize:null,autoComplete:Ft,autoFocus:rt,autoPlay:rt,blocking:Ft,capture:null,charSet:null,checked:rt,cite:null,className:Ft,cols:we,colSpan:null,content:null,contentEditable:wn,controls:rt,controlsList:Ft,coords:we|oo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:rt,defer:rt,dir:null,dirName:null,disabled:rt,download:Vy,draggable:wn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:rt,formTarget:null,headers:Ft,height:we,hidden:Vy,high:we,href:null,hrefLang:null,htmlFor:Ft,httpEquiv:Ft,id:null,imageSizes:null,imageSrcSet:null,inert:rt,inputMode:null,integrity:null,is:null,isMap:rt,itemId:null,itemProp:Ft,itemRef:Ft,itemScope:rt,itemType:Ft,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:rt,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:rt,muted:rt,name:null,nonce:null,noModule:rt,noValidate:rt,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:rt,optimum:we,pattern:null,ping:Ft,placeholder:null,playsInline:rt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:rt,referrerPolicy:null,rel:Ft,required:rt,reversed:rt,rows:we,rowSpan:we,sandbox:Ft,scope:null,scoped:rt,seamless:rt,selected:rt,shadowRootClonable:rt,shadowRootDelegatesFocus:rt,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:wn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:rt,useMap:null,value:wn,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ft,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:rt,declare:rt,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:rt,noHref:rt,noShade:rt,noWrap:rt,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:wn,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:rt,disableRemotePlayback:rt,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:w_}),Q$=Io({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:Fr,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:Ft,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:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:rt,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,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:oo,g2:oo,glyphName:oo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:Fr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,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:we,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:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ft,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Fr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Fr,rev:Fr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Fr,requiredFeatures:Fr,requiredFonts:Fr,requiredFormats:Fr,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:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:Fr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Fr,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Fr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:S_}),k_=Io({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()}}),j_=Io({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:w_}),E_=Io({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),K$={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"},Y$=/[A-Z]/g,fk=/-[a-z]/g,X$=/^data[-\w.:]+$/i;function W$(e,t){const n=Gy(t);let a=t,s=Mr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&X$.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(fk,e9);a="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!fk.test(o)){let c=o.replace(Y$,J$);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}s=hb}return new s(a,t)}function J$(e){return"-"+e.toLowerCase()}function e9(e){return e.charAt(1).toUpperCase()}const t9=b_([x_,V$,k_,j_,E_],"html"),mb=b_([x_,Q$,k_,j_,E_],"svg");function n9(e){return e.join(" ").trim()}var Gl={},Sg,hk;function r9(){if(hk)return Sg;hk=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="",S="comment",x="declaration";function j(w,C){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];C=C||{};var _=1,R=1;function z(te){var J=te.match(t);J&&(_+=J.length);var q=te.lastIndexOf(m);R=~q?te.length-q:R+te.length}function I(){var te={line:_,column:R};return function(J){return J.position=new O(te),W(),J}}function O(te){this.start=te,this.end={line:_,column:R},this.source=C.source}O.prototype.content=w;function F(te){var J=new Error(C.source+":"+_+":"+R+": "+te);if(J.reason=te,J.filename=C.source,J.line=_,J.column=R,J.source=w,!C.silent)throw J}function D(te){var J=te.exec(w);if(J){var q=J[0];return z(q),w=w.slice(q.length),J}}function W(){D(n)}function L(te){var J;for(te=te||[];J=V();)J!==!1&&te.push(J);return te}function V(){var te=I();if(!(h!=w.charAt(0)||p!=w.charAt(1))){for(var J=2;g!=w.charAt(J)&&(p!=w.charAt(J)||h!=w.charAt(J+1));)++J;if(J+=2,g===w.charAt(J-1))return F("End of comment missing");var q=w.slice(2,J-2);return R+=2,z(q),w=w.slice(J),R+=2,te({type:S,comment:q})}}function Y(){var te=I(),J=D(a);if(J){if(V(),!D(s))return F("property missing ':'");var q=D(o),le=te({type:x,property:k(J[0].replace(e,g)),value:q?k(q[0].replace(e,g)):g});return D(c),le}}function me(){var te=[];L(te);for(var J;J=Y();)J!==!1&&(te.push(J),L(te));return te}return W(),me()}function k(w){return w?w.replace(f,g):g}return Sg=j,Sg}var mk;function a9(){if(mk)return Gl;mk=1;var e=Gl&&Gl.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Gl,"__esModule",{value:!0}),Gl.default=n;const t=e(r9());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 Gl}var $u={},pk;function i9(){if(pk)return $u;pk=1,Object.defineProperty($u,"__esModule",{value:!0}),$u.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 $u.camelCase=m,$u}var Hu,gk;function s9(){if(gk)return Hu;gk=1;var e=Hu&&Hu.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(a9()),n=i9();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,Hu=a,Hu}var l9=s9();const o9=oh(l9),C_=N_("end"),pb=N_("start");function N_(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 u9(e){const t=pb(e),n=C_(e);if(t&&n)return{start:t,end:n}}function ic(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?yk(e.position):"start"in e||"end"in e?yk(e):"line"in e||"column"in e?Ky(e):""}function Ky(e){return vk(e&&e.line)+":"+vk(e&&e.column)}function yk(e){return Ky(e&&e.start)+"-"+Ky(e&&e.end)}function vk(e){return e&&typeof e=="number"?e:1}class ar 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=ic(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}}ar.prototype.file="";ar.prototype.name="";ar.prototype.reason="";ar.prototype.message="";ar.prototype.stack="";ar.prototype.column=void 0;ar.prototype.line=void 0;ar.prototype.ancestors=void 0;ar.prototype.cause=void 0;ar.prototype.fatal=void 0;ar.prototype.place=void 0;ar.prototype.ruleId=void 0;ar.prototype.source=void 0;const gb={}.hasOwnProperty,c9=new Map,d9=/[A-Z]/g,f9=new Set(["table","tbody","thead","tfoot","tr"]),h9=new Set(["td","th"]),__="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function m9(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=w9(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=S9(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"?mb:t9,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=T_(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function T_(e,t,n){if(t.type==="element")return p9(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return g9(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return v9(e,t,n);if(t.type==="mdxjsEsm")return y9(e,t);if(t.type==="root")return b9(e,t,n);if(t.type==="text")return x9(e,t)}function p9(e,t,n){const a=e.schema;let s=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(s=mb,e.schema=s),e.ancestors.push(t);const o=R_(e,t.tagName,!1),c=k9(e,t);let f=vb(e,t);return f9.has(t.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!Z$(m):!0})),A_(e,c,o,t),yb(c,f),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function g9(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)}Sc(e,t.position)}function y9(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Sc(e,t.position)}function v9(e,t,n){const a=e.schema;let s=a;t.name==="svg"&&a.space==="html"&&(s=mb,e.schema=s),e.ancestors.push(t);const o=t.name===null?e.Fragment:R_(e,t.name,!0),c=j9(e,t),f=vb(e,t);return A_(e,c,o,t),yb(c,f),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function b9(e,t,n){const a={};return yb(a,vb(e,t)),e.create(t,e.Fragment,a,n)}function x9(e,t){return t.value}function A_(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function yb(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function S9(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 w9(e,t){return n;function n(a,s,o,c){const f=Array.isArray(o.children),m=pb(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 k9(e,t){const n={};let a,s;for(s in t.properties)if(s!=="children"&&gb.call(t.properties,s)){const o=E9(e,s,t.properties[s]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&h9.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 j9(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 Sc(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 Sc(e,t.position);else o=a.value===null?!0:a.value;n[s]=o}return n}function vb(e,t){const n=[];let a=-1;const s=e.passKeys?new Map:c9;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=T_(e,o,c);f!==void 0&&n.push(f)}return n}function E9(e,t,n){const a=W$(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=a.commaSeparated?B$(n):n9(n)),a.property==="style"){let s=typeof n=="object"?n:C9(e,String(n));return e.stylePropertyNameCase==="css"&&(s=N9(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&a.space?K$[a.property]||a.property:a.attribute,n]}}function C9(e,t){try{return o9(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const a=n,s=new ar("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=__+"#cannot-parse-style-attribute",s}}function R_(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=uk(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=uk(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const s=a.value;return gb.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(a);Sc(e)}function Sc(e,t){const n=new ar("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=__+"#cannot-handle-mdx-estrees-without-createevaluater",n}function N9(e){const t={};let n;for(n in e)gb.call(e,n)&&(t[_9(n)]=e[n]);return t}function _9(e){let t=e.replace(d9,T9);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function T9(e){return"-"+e.toLowerCase()}const wg={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"]},A9={};function bb(e,t){const n=A9,a=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return O_(e,a,s)}function O_(e,t,n){if(R9(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 bk(e.children,t,n)}return Array.isArray(e)?bk(e,t,n):""}function bk(e,t,n){const a=[];let s=-1;for(;++s<e.length;)a[s]=O_(e[s],t,n);return a.join("")}function R9(e){return!!(e&&typeof e=="object")}const xk=document.createElement("i");function xb(e){const t="&"+e+";";xk.innerHTML=t;const n=xk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function qr(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 la(e,t){return e.length>0?(qr(e,e.length,0,t),e):t}const Sk={}.hasOwnProperty;function M_(e){const t={};let n=-1;for(;++n<e.length;)O9(t,e[n]);return t}function O9(e,t){let n;for(n in t){const s=(Sk.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let c;if(o)for(c in o){Sk.call(s,c)||(s[c]=[]);const f=o[c];M9(s[c],Array.isArray(f)?f:f?[f]:[])}}}function M9(e,t){let n=-1;const a=[];for(;++n<t.length;)(t[n].add==="after"?e:a).push(t[n]);qr(e,0,0,a)}function z_(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 wa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const cr=ws(/[A-Za-z]/),nr=ws(/[\dA-Za-z]/),z9=ws(/[#-'*+\--9=?A-Z^-~]/);function eh(e){return e!==null&&(e<32||e===127)}const Yy=ws(/\d/),D9=ws(/[\dA-Fa-f]/),I9=ws(/[!-/:-@[-`{-~]/);function Ze(e){return e!==null&&e<-2}function Ut(e){return e!==null&&(e<0||e===32)}function dt(e){return e===-2||e===-1||e===32}const Oh=ws(new RegExp("\\p{P}|\\p{S}","u")),nl=ws(/\s/);function ws(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Lo(e){const t=[];let n=-1,a=0,s=0;for(;++n<e.length;){const o=e.charCodeAt(n);let c="";if(o===37&&nr(e.charCodeAt(n+1))&&nr(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 kt(e,t,n,a){const s=a?a-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(m){return dt(m)?(e.enter(n),f(m)):t(m)}function f(m){return dt(m)&&o++<s?(e.consume(m),f):(e.exit(n),t(m))}}const L9={tokenize:P9};function P9(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"),kt(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 Ze(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const U9={tokenize:B9},wk={tokenize:F9};function B9(e){const t=this,n=[];let a=0,s,o,c;return f;function f(R){if(a<n.length){const z=n[a];return t.containerState=z[1],e.attempt(z[0].continuation,m,h)(R)}return h(R)}function m(R){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&_();const z=t.events.length;let I=z,O;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){O=t.events[I][1].end;break}C(a);let F=z;for(;F<t.events.length;)t.events[F][1].end={...O},F++;return qr(t.events,I+1,0,t.events.slice(z)),t.events.length=F,h(R)}return f(R)}function h(R){if(a===n.length){if(!s)return S(R);if(s.currentConstruct&&s.currentConstruct.concrete)return j(R);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(wk,p,g)(R)}function p(R){return s&&_(),C(a),S(R)}function g(R){return t.parser.lazy[t.now().line]=a!==n.length,c=t.now().offset,j(R)}function S(R){return t.containerState={},e.attempt(wk,x,j)(R)}function x(R){return a++,n.push([t.currentConstruct,t.containerState]),S(R)}function j(R){if(R===null){s&&_(),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){w(e.exit("chunkFlow"),!0),C(0),e.consume(R);return}return Ze(R)?(e.consume(R),w(e.exit("chunkFlow")),a=0,t.interrupt=void 0,f):(e.consume(R),k)}function w(R,z){const I=t.sliceStream(R);if(z&&I.push(null),R.previous=o,o&&(o.next=R),o=R,s.defineSkip(R.start),s.write(I),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 F=t.events.length;let D=F,W,L;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){if(W){L=t.events[D][1].end;break}W=!0}for(C(a),O=F;O<t.events.length;)t.events[O][1].end={...L},O++;qr(t.events,D+1,0,t.events.slice(F)),t.events.length=O}}function C(R){let z=n.length;for(;z-- >R;){const I=n[z];t.containerState=I[1],I[0].exit.call(t,e)}n.length=R}function _(){s.write([null]),o=void 0,s=void 0,t.containerState._closeFlow=void 0}}function F9(e,t,n){return kt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function No(e){if(e===null||Ut(e)||nl(e))return 1;if(Oh(e))return 2}function Mh(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 Xy={name:"attention",resolveAll:$9,tokenize:H9};function $9(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},S={...e[n][1].start};kk(g,-m),kk(S,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:S},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=la(h,[["enter",e[a][1],t],["exit",e[a][1],t]])),h=la(h,[["enter",s,t],["enter",c,t],["exit",c,t],["enter",o,t]]),h=la(h,Mh(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),h=la(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=la(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,qr(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 H9(e,t){const n=this.parser.constructs.attentionMarkers.null,a=this.previous,s=No(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=No(m),g=!p||p===2&&s||n.includes(m),S=!s||s===2&&p||n.includes(a);return h._open=!!(o===42?g:g&&(s||!S)),h._close=!!(o===42?S:S&&(p||!g)),t(m)}}function kk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const q9={name:"autolink",tokenize:Z9};function Z9(e,t,n){let a=0;return s;function s(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(x){return cr(x)?(e.consume(x),c):x===64?n(x):h(x)}function c(x){return x===43||x===45||x===46||nr(x)?(a=1,f(x)):h(x)}function f(x){return x===58?(e.consume(x),a=0,m):(x===43||x===45||x===46||nr(x))&&a++<32?(e.consume(x),f):(a=0,h(x))}function m(x){return x===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):x===null||x===32||x===60||eh(x)?n(x):(e.consume(x),m)}function h(x){return x===64?(e.consume(x),p):z9(x)?(e.consume(x),h):n(x)}function p(x){return nr(x)?g(x):n(x)}function g(x){return x===46?(e.consume(x),a=0,p):x===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):S(x)}function S(x){if((x===45||nr(x))&&a++<63){const j=x===45?S:g;return e.consume(x),j}return n(x)}}const qc={partial:!0,tokenize:G9};function G9(e,t,n){return a;function a(o){return dt(o)?kt(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||Ze(o)?t(o):n(o)}}const D_={continuation:{tokenize:Q9},exit:K9,name:"blockQuote",tokenize:V9};function V9(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 dt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function Q9(e,t,n){const a=this;return s;function s(c){return dt(c)?kt(e,o,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(D_,t,n)(c)}}function K9(e){e.exit("blockQuote")}const I_={name:"characterEscape",tokenize:Y9};function Y9(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 I9(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const L_={name:"characterReference",tokenize:X9};function X9(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=nr,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=D9,p):(e.enter("characterReferenceValue"),o=7,c=Yy,p(g))}function p(g){if(g===59&&s){const S=e.exit("characterReferenceValue");return c===nr&&!xb(a.sliceSerialize(S))?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 jk={partial:!0,tokenize:J9},Ek={concrete:!0,name:"codeFenced",tokenize:W9};function W9(e,t,n){const a=this,s={partial:!0,tokenize:I};let o=0,c=0,f;return m;function m(O){return h(O)}function h(O){const F=a.events[a.events.length-1];return o=F&&F[1].type==="linePrefix"?F[2].sliceSerialize(F[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"),dt(O)?kt(e,g,"whitespace")(O):g(O))}function g(O){return O===null||Ze(O)?(e.exit("codeFencedFence"),a.interrupt?t(O):e.check(jk,k,z)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),S(O))}function S(O){return O===null||Ze(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(O)):dt(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),kt(e,x,"whitespace")(O)):O===96&&O===f?n(O):(e.consume(O),S)}function x(O){return O===null||Ze(O)?g(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),j(O))}function j(O){return O===null||Ze(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(O)):O===96&&O===f?n(O):(e.consume(O),j)}function k(O){return e.attempt(s,z,w)(O)}function w(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),C}function C(O){return o>0&&dt(O)?kt(e,_,"linePrefix",o+1)(O):_(O)}function _(O){return O===null||Ze(O)?e.check(jk,k,z)(O):(e.enter("codeFlowValue"),R(O))}function R(O){return O===null||Ze(O)?(e.exit("codeFlowValue"),_(O)):(e.consume(O),R)}function z(O){return e.exit("codeFenced"),t(O)}function I(O,F,D){let W=0;return L;function L(J){return O.enter("lineEnding"),O.consume(J),O.exit("lineEnding"),V}function V(J){return O.enter("codeFencedFence"),dt(J)?kt(O,Y,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(J):Y(J)}function Y(J){return J===f?(O.enter("codeFencedFenceSequence"),me(J)):D(J)}function me(J){return J===f?(W++,O.consume(J),me):W>=c?(O.exit("codeFencedFenceSequence"),dt(J)?kt(O,te,"whitespace")(J):te(J)):D(J)}function te(J){return J===null||Ze(J)?(O.exit("codeFencedFence"),F(J)):D(J)}}}function J9(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 kg={name:"codeIndented",tokenize:t8},e8={partial:!0,tokenize:n8};function t8(e,t,n){const a=this;return s;function s(h){return e.enter("codeIndented"),kt(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):Ze(h)?e.attempt(e8,c,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Ze(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),t(h)}}function n8(e,t,n){const a=this;return s;function s(c){return a.parser.lazy[a.now().line]?n(c):Ze(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),s):kt(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):Ze(c)?s(c):n(c)}}const r8={name:"codeText",previous:i8,resolve:a8,tokenize:s8};function a8(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 i8(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function s8(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)):Ze(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||Ze(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 l8{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&&qu(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),qu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),qu(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);qu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);qu(this.left,n.reverse())}}}function qu(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 P_(e){const t={};let n=-1,a,s,o,c,f,m,h;const p=new l8(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,o8(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 qr(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!h}function o8(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,S=-1,x=n,j=0,k=0;const w=[k];for(;x;){for(;e.get(++s)[1]!==x;);o.push(s),x._tokenizer||(p=a.sliceStream(x),x.next||p.push(null),g&&c.defineSkip(x.start),x._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(p),x._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=x,x=x.next}for(x=n;++S<f.length;)f[S][0]==="exit"&&f[S-1][0]==="enter"&&f[S][1].type===f[S-1][1].type&&f[S][1].start.line!==f[S][1].end.line&&(k=S+1,w.push(k),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(c.events=[],x?(x._tokenizer=void 0,x.previous=void 0):w.pop(),S=w.length;S--;){const C=f.slice(w[S],w[S+1]),_=o.pop();m.push([_,_+C.length-1]),e.splice(_,2,C)}for(m.reverse(),S=-1;++S<m.length;)h[j+m[S][0]]=j+m[S][1],j+=m[S][1]-m[S][0]-1;return h}const u8={resolve:d8,tokenize:f8},c8={partial:!0,tokenize:h8};function d8(e){return P_(e),e}function f8(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):Ze(f)?e.check(c8,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 h8(e,t,n){const a=this;return s;function s(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),kt(e,o,"linePrefix")}function o(c){if(c===null||Ze(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 U_(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),S):C===null||C===32||C===41||eh(C)?n(C):(e.enter(a),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),k(C))}function S(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"}),x(C))}function x(C){return C===62?(e.exit("chunkString"),e.exit(f),S(C)):C===null||C===60||Ze(C)?n(C):(e.consume(C),C===92?j:x)}function j(C){return C===60||C===62||C===92?(e.consume(C),x):x(C)}function k(C){return!p&&(C===null||C===41||Ut(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||eh(C)?n(C):(e.consume(C),C===92?w:k)}function w(C){return C===40||C===41||C===92?(e.consume(C),k):k(C)}}function B_(e,t,n,a,s,o){const c=this;let f=0,m;return h;function h(x){return e.enter(a),e.enter(s),e.consume(x),e.exit(s),e.enter(o),p}function p(x){return f>999||x===null||x===91||x===93&&!m||x===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?n(x):x===93?(e.exit(o),e.enter(s),e.consume(x),e.exit(s),e.exit(a),t):Ze(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===null||x===91||x===93||Ze(x)||f++>999?(e.exit("chunkString"),p(x)):(e.consume(x),m||(m=!dt(x)),x===92?S:g)}function S(x){return x===91||x===92||x===93?(e.consume(x),f++,g):g(x)}}function F_(e,t,n,a,s,o){let c;return f;function f(S){return S===34||S===39||S===40?(e.enter(a),e.enter(s),e.consume(S),e.exit(s),c=S===40?41:S,m):n(S)}function m(S){return S===c?(e.enter(s),e.consume(S),e.exit(s),e.exit(a),t):(e.enter(o),h(S))}function h(S){return S===c?(e.exit(o),m(c)):S===null?n(S):Ze(S)?(e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),kt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(S))}function p(S){return S===c||S===null||Ze(S)?(e.exit("chunkString"),h(S)):(e.consume(S),S===92?g:p)}function g(S){return S===c||S===92?(e.consume(S),p):p(S)}}function sc(e,t){let n;return a;function a(s){return Ze(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,a):dt(s)?kt(e,a,n?"linePrefix":"lineSuffix")(s):t(s)}}const m8={name:"definition",tokenize:g8},p8={partial:!0,tokenize:y8};function g8(e,t,n){const a=this;let s;return o;function o(x){return e.enter("definition"),c(x)}function c(x){return B_.call(a,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function f(x){return s=wa(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),m):n(x)}function m(x){return Ut(x)?sc(e,h)(x):h(x)}function h(x){return U_(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function p(x){return e.attempt(p8,g,g)(x)}function g(x){return dt(x)?kt(e,S,"whitespace")(x):S(x)}function S(x){return x===null||Ze(x)?(e.exit("definition"),a.parser.defined.push(s),t(x)):n(x)}}function y8(e,t,n){return a;function a(f){return Ut(f)?sc(e,s)(f):n(f)}function s(f){return F_(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return dt(f)?kt(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Ze(f)?t(f):n(f)}}const v8={name:"hardBreakEscape",tokenize:b8};function b8(e,t,n){return a;function a(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return Ze(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const x8={name:"headingAtx",resolve:S8,tokenize:w8};function S8(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"},qr(e,a,n-a+1,[["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t]])),e}function w8(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||Ut(p)?(e.exit("atxHeadingSequence"),f(p)):n(p)}function f(p){return p===35?(e.enter("atxHeadingSequence"),m(p)):p===null||Ze(p)?(e.exit("atxHeading"),t(p)):dt(p)?kt(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||Ut(p)?(e.exit("atxHeadingText"),f(p)):(e.consume(p),h)}}const k8=["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"],Ck=["pre","script","style","textarea"],j8={concrete:!0,name:"htmlFlow",resolveTo:N8,tokenize:_8},E8={partial:!0,tokenize:A8},C8={partial:!0,tokenize:T8};function N8(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 _8(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),S):T===47?(e.consume(T),o=!0,k):T===63?(e.consume(T),s=3,a.interrupt?t:M):cr(T)?(e.consume(T),c=String.fromCharCode(T),w):n(T)}function S(T){return T===45?(e.consume(T),s=2,x):T===91?(e.consume(T),s=5,f=0,j):cr(T)?(e.consume(T),s=4,a.interrupt?t:M):n(T)}function x(T){return T===45?(e.consume(T),a.interrupt?t:M):n(T)}function j(T){const G="CDATA[";return T===G.charCodeAt(f++)?(e.consume(T),f===G.length?a.interrupt?t:Y:j):n(T)}function k(T){return cr(T)?(e.consume(T),c=String.fromCharCode(T),w):n(T)}function w(T){if(T===null||T===47||T===62||Ut(T)){const G=T===47,Z=c.toLowerCase();return!G&&!o&&Ck.includes(Z)?(s=1,a.interrupt?t(T):Y(T)):k8.includes(c.toLowerCase())?(s=6,G?(e.consume(T),C):a.interrupt?t(T):Y(T)):(s=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(T):o?_(T):R(T))}return T===45||nr(T)?(e.consume(T),c+=String.fromCharCode(T),w):n(T)}function C(T){return T===62?(e.consume(T),a.interrupt?t:Y):n(T)}function _(T){return dt(T)?(e.consume(T),_):L(T)}function R(T){return T===47?(e.consume(T),L):T===58||T===95||cr(T)?(e.consume(T),z):dt(T)?(e.consume(T),R):L(T)}function z(T){return T===45||T===46||T===58||T===95||nr(T)?(e.consume(T),z):I(T)}function I(T){return T===61?(e.consume(T),O):dt(T)?(e.consume(T),I):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,F):dt(T)?(e.consume(T),O):D(T)}function F(T){return T===m?(e.consume(T),m=null,W):T===null||Ze(T)?n(T):(e.consume(T),F)}function D(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||Ut(T)?I(T):(e.consume(T),D)}function W(T){return T===47||T===62||dt(T)?R(T):n(T)}function L(T){return T===62?(e.consume(T),V):n(T)}function V(T){return T===null||Ze(T)?Y(T):dt(T)?(e.consume(T),V):n(T)}function Y(T){return T===45&&s===2?(e.consume(T),q):T===60&&s===1?(e.consume(T),le):T===62&&s===4?(e.consume(T),P):T===63&&s===3?(e.consume(T),M):T===93&&s===5?(e.consume(T),ve):Ze(T)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(E8,U,me)(T)):T===null||Ze(T)?(e.exit("htmlFlowData"),me(T)):(e.consume(T),Y)}function me(T){return e.check(C8,te,U)(T)}function te(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),J}function J(T){return T===null||Ze(T)?me(T):(e.enter("htmlFlowData"),Y(T))}function q(T){return T===45?(e.consume(T),M):Y(T)}function le(T){return T===47?(e.consume(T),c="",ee):Y(T)}function ee(T){if(T===62){const G=c.toLowerCase();return Ck.includes(G)?(e.consume(T),P):Y(T)}return cr(T)&&c.length<8?(e.consume(T),c+=String.fromCharCode(T),ee):Y(T)}function ve(T){return T===93?(e.consume(T),M):Y(T)}function M(T){return T===62?(e.consume(T),P):T===45&&s===2?(e.consume(T),M):Y(T)}function P(T){return T===null||Ze(T)?(e.exit("htmlFlowData"),U(T)):(e.consume(T),P)}function U(T){return e.exit("htmlFlow"),t(T)}}function T8(e,t,n){const a=this;return s;function s(c){return Ze(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 A8(e,t,n){return a;function a(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(qc,t,n)}}const R8={name:"htmlText",tokenize:O8};function O8(e,t,n){const a=this;let s,o,c;return f;function f(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),m}function m(M){return M===33?(e.consume(M),h):M===47?(e.consume(M),I):M===63?(e.consume(M),R):cr(M)?(e.consume(M),D):n(M)}function h(M){return M===45?(e.consume(M),p):M===91?(e.consume(M),o=0,j):cr(M)?(e.consume(M),_):n(M)}function p(M){return M===45?(e.consume(M),x):n(M)}function g(M){return M===null?n(M):M===45?(e.consume(M),S):Ze(M)?(c=g,le(M)):(e.consume(M),g)}function S(M){return M===45?(e.consume(M),x):g(M)}function x(M){return M===62?q(M):M===45?S(M):g(M)}function j(M){const P="CDATA[";return M===P.charCodeAt(o++)?(e.consume(M),o===P.length?k:j):n(M)}function k(M){return M===null?n(M):M===93?(e.consume(M),w):Ze(M)?(c=k,le(M)):(e.consume(M),k)}function w(M){return M===93?(e.consume(M),C):k(M)}function C(M){return M===62?q(M):M===93?(e.consume(M),C):k(M)}function _(M){return M===null||M===62?q(M):Ze(M)?(c=_,le(M)):(e.consume(M),_)}function R(M){return M===null?n(M):M===63?(e.consume(M),z):Ze(M)?(c=R,le(M)):(e.consume(M),R)}function z(M){return M===62?q(M):R(M)}function I(M){return cr(M)?(e.consume(M),O):n(M)}function O(M){return M===45||nr(M)?(e.consume(M),O):F(M)}function F(M){return Ze(M)?(c=F,le(M)):dt(M)?(e.consume(M),F):q(M)}function D(M){return M===45||nr(M)?(e.consume(M),D):M===47||M===62||Ut(M)?W(M):n(M)}function W(M){return M===47?(e.consume(M),q):M===58||M===95||cr(M)?(e.consume(M),L):Ze(M)?(c=W,le(M)):dt(M)?(e.consume(M),W):q(M)}function L(M){return M===45||M===46||M===58||M===95||nr(M)?(e.consume(M),L):V(M)}function V(M){return M===61?(e.consume(M),Y):Ze(M)?(c=V,le(M)):dt(M)?(e.consume(M),V):W(M)}function Y(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),s=M,me):Ze(M)?(c=Y,le(M)):dt(M)?(e.consume(M),Y):(e.consume(M),te)}function me(M){return M===s?(e.consume(M),s=void 0,J):M===null?n(M):Ze(M)?(c=me,le(M)):(e.consume(M),me)}function te(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||Ut(M)?W(M):(e.consume(M),te)}function J(M){return M===47||M===62||Ut(M)?W(M):n(M)}function q(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function le(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),ee}function ee(M){return dt(M)?kt(e,ve,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):ve(M)}function ve(M){return e.enter("htmlTextData"),c(M)}}const Sb={name:"labelEnd",resolveAll:I8,resolveTo:L8,tokenize:P8},M8={tokenize:U8},z8={tokenize:B8},D8={tokenize:F8};function I8(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&&qr(e,0,e.length,n),e}function L8(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=la(f,e.slice(o+1,o+a+3)),f=la(f,[["enter",p,t]]),f=la(f,Mh(t.parser.constructs.insideSpan.null,e.slice(o+a+4,c-3),t)),f=la(f,[["exit",p,t],e[c-2],e[c-1],["exit",h,t]]),f=la(f,e.slice(c+1)),f=la(f,[["exit",m,t]]),qr(e,o,e.length,f),e}function P8(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(S){return o?o._inactive?g(S):(c=a.parser.defined.includes(wa(a.sliceSerialize({start:o.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(S),e.exit("labelMarker"),e.exit("labelEnd"),m):n(S)}function m(S){return S===40?e.attempt(M8,p,c?p:g)(S):S===91?e.attempt(z8,p,c?h:g)(S):c?p(S):g(S)}function h(S){return e.attempt(D8,p,g)(S)}function p(S){return t(S)}function g(S){return o._balanced=!0,n(S)}}function U8(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 Ut(g)?sc(e,o)(g):o(g)}function o(g){return g===41?p(g):U_(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Ut(g)?sc(e,m)(g):p(g)}function f(g){return n(g)}function m(g){return g===34||g===39||g===40?F_(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):p(g)}function h(g){return Ut(g)?sc(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 B8(e,t,n){const a=this;return s;function s(f){return B_.call(a,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return a.parser.defined.includes(wa(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function c(f){return n(f)}}function F8(e,t,n){return a;function a(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),s}function s(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const $8={name:"labelStartImage",resolveAll:Sb.resolveAll,tokenize:H8};function H8(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 q8={name:"labelStartLink",resolveAll:Sb.resolveAll,tokenize:Z8};function Z8(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 jg={name:"lineEnding",tokenize:G8};function G8(e,t){return n;function n(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),kt(e,t,"linePrefix")}}const Uf={name:"thematicBreak",tokenize:V8};function V8(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||Ze(h))?(e.exit("thematicBreak"),t(h)):n(h)}function m(h){return h===s?(e.consume(h),a++,m):(e.exit("thematicBreakSequence"),dt(h)?kt(e,f,"whitespace")(h):f(h))}}const jr={continuation:{tokenize:X8},exit:J8,name:"list",tokenize:Y8},Q8={partial:!0,tokenize:eH},K8={partial:!0,tokenize:W8};function Y8(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(x){const j=a.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(j==="listUnordered"?!a.containerState.marker||x===a.containerState.marker:Yy(x)){if(a.containerState.type||(a.containerState.type=j,e.enter(j,{_container:!0})),j==="listUnordered")return e.enter("listItemPrefix"),x===42||x===45?e.check(Uf,n,h)(x):h(x);if(!a.interrupt||x===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(x)}return n(x)}function m(x){return Yy(x)&&++c<10?(e.consume(x),m):(!a.interrupt||c<2)&&(a.containerState.marker?x===a.containerState.marker:x===41||x===46)?(e.exit("listItemValue"),h(x)):n(x)}function h(x){return e.enter("listItemMarker"),e.consume(x),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||x,e.check(qc,a.interrupt?n:p,e.attempt(Q8,S,g))}function p(x){return a.containerState.initialBlankLine=!0,o++,S(x)}function g(x){return dt(x)?(e.enter("listItemPrefixWhitespace"),e.consume(x),e.exit("listItemPrefixWhitespace"),S):n(x)}function S(x){return a.containerState.size=o+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(x)}}function X8(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(qc,s,o);function s(f){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,kt(e,t,"listItemIndent",a.containerState.size+1)(f)}function o(f){return a.containerState.furtherBlankLines||!dt(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(K8,t,c)(f))}function c(f){return a.containerState._closeFlow=!0,a.interrupt=void 0,kt(e,e.attempt(jr,t,n),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function W8(e,t,n){const a=this;return kt(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 J8(e){e.exit(this.containerState.type)}function eH(e,t,n){const a=this;return kt(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!dt(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const Nk={name:"setextUnderline",resolveTo:tH,tokenize:nH};function tH(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 nH(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"),dt(h)?kt(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Ze(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const rH={tokenize:aH};function aH(e){const t=this,n=e.attempt(qc,a,e.attempt(this.parser.constructs.flowInitial,s,kt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(u8,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 iH={resolveAll:H_()},sH=$_("string"),lH=$_("text");function $_(e){return{resolveAll:H_(e==="text"?oH: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 S=-1;if(g)for(;++S<g.length;){const x=g[S];if(!x.previous||x.previous.call(a,a.previous))return!0}return!1}}}function H_(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 oH(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 uH={42:jr,43:jr,45:jr,48:jr,49:jr,50:jr,51:jr,52:jr,53:jr,54:jr,55:jr,56:jr,57:jr,62:D_},cH={91:m8},dH={[-2]:kg,[-1]:kg,32:kg},fH={35:x8,42:Uf,45:[Nk,Uf],60:j8,61:Nk,95:Uf,96:Ek,126:Ek},hH={38:L_,92:I_},mH={[-5]:jg,[-4]:jg,[-3]:jg,33:$8,38:L_,42:Xy,60:[q9,R8],91:q8,92:[v8,I_],93:Sb,95:Xy,96:r8},pH={null:[Xy,iH]},gH={null:[42,95]},yH={null:[]},vH=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:gH,contentInitial:cH,disable:yH,document:uH,flow:fH,flowInitial:dH,insideSpan:pH,string:hH,text:mH},Symbol.toStringTag,{value:"Module"}));function bH(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:F(I),check:F(O),consume:_,enter:R,exit:z,interrupt:F(O,{interrupt:!0})},h={code:null,containerState:{},defineSkip:k,events:[],now:j,parser:e,previous:null,sliceSerialize:S,sliceStream:x,write:g};let p=t.tokenize.call(h,m);return t.resolveAll&&o.push(t),h;function g(V){return c=la(c,V),w(),c[c.length-1]!==null?[]:(D(t,0),h.events=Mh(o,h.events,h),h.events)}function S(V,Y){return SH(x(V),Y)}function x(V){return xH(c,V)}function j(){const{_bufferIndex:V,_index:Y,line:me,column:te,offset:J}=a;return{_bufferIndex:V,_index:Y,line:me,column:te,offset:J}}function k(V){s[V.line]=V.column,L()}function w(){let V;for(;a._index<c.length;){const Y=c[a._index];if(typeof Y=="string")for(V=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===V&&a._bufferIndex<Y.length;)C(Y.charCodeAt(a._bufferIndex));else C(Y)}}function C(V){p=p(V)}function _(V){Ze(V)?(a.line++,a.column=1,a.offset+=V===-3?2:1,L()):V!==-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=V}function R(V,Y){const me=Y||{};return me.type=V,me.start=j(),h.events.push(["enter",me,h]),f.push(me),me}function z(V){const Y=f.pop();return Y.end=j(),h.events.push(["exit",Y,h]),Y}function I(V,Y){D(V,Y.from)}function O(V,Y){Y.restore()}function F(V,Y){return me;function me(te,J,q){let le,ee,ve,M;return Array.isArray(te)?U(te):"tokenize"in te?U([te]):P(te);function P(ae){return Se;function Se(Re){const je=Re!==null&&ae[Re],$e=Re!==null&&ae.null,Ie=[...Array.isArray(je)?je:je?[je]:[],...Array.isArray($e)?$e:$e?[$e]:[]];return U(Ie)(Re)}}function U(ae){return le=ae,ee=0,ae.length===0?q:T(ae[ee])}function T(ae){return Se;function Se(Re){return M=W(),ve=ae,ae.partial||(h.currentConstruct=ae),ae.name&&h.parser.constructs.disable.null.includes(ae.name)?Z():ae.tokenize.call(Y?Object.assign(Object.create(h),Y):h,m,G,Z)(Re)}}function G(ae){return V(ve,M),J}function Z(ae){return M.restore(),++ee<le.length?T(le[ee]):q}}}function D(V,Y){V.resolveAll&&!o.includes(V)&&o.push(V),V.resolve&&qr(h.events,Y,h.events.length-Y,V.resolve(h.events.slice(Y),h)),V.resolveTo&&(h.events=V.resolveTo(h.events,h))}function W(){const V=j(),Y=h.previous,me=h.currentConstruct,te=h.events.length,J=Array.from(f);return{from:te,restore:q};function q(){a=V,h.previous=Y,h.currentConstruct=me,h.events.length=te,f=J,L()}}function L(){a.line in s&&a.column<2&&(a.column=s[a.line],a.offset+=s[a.line]-1)}}function xH(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 SH(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 wH(e){const a={constructs:M_([vH,...(e||{}).extensions||[]]),content:s(L9),defined:[],document:s(U9),flow:s(rH),lazy:{},string:s(sH),text:s(lH)};return a;function s(o){return c;function c(f){return bH(a,o,f)}}}function kH(e){for(;!P_(e););return e}const _k=/[\0\t\n\r]/g;function jH(){let e=1,t="",n=!0,a;return s;function s(o,c,f){const m=[];let h,p,g,S,x;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(_k.lastIndex=g,h=_k.exec(o),S=h&&h.index!==void 0?h.index:o.length,x=o.charCodeAt(S),!h){t=o.slice(g);break}if(x===10&&g===S&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),g<S&&(m.push(o.slice(g,S)),e+=S-g),x){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=S+1}return f&&(a&&m.push(-5),t&&m.push(t),m.push(null)),m}}const EH=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function CH(e){return e.replace(EH,NH)}function NH(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),o=s===120||s===88;return z_(n.slice(o?2:1),o?16:10)}return xb(n)||e}const q_={}.hasOwnProperty;function _H(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),TH(n)(kH(wH(n).document().write(jH()(e,t,!0))))}function TH(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(At),autolinkProtocol:W,autolinkEmail:W,atxHeading:o(K),blockQuote:o($e),characterEscape:W,characterReference:W,codeFenced:o(Ie),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(Ie,c),codeText:o(Ke,c),codeTextData:W,data:W,codeFlowValue:W,definition:o(et),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(wt),hardBreakEscape:o(ge),hardBreakTrailing:o(ge),htmlFlow:o(Ce,c),htmlFlowData:W,htmlText:o(Ce,c),htmlTextData:W,image:o(_e),label:c,link:o(At),listItem:o(Mn),listItemValue:S,listOrdered:o(qe,g),listUnordered:o(qe),paragraph:o(rn),reference:T,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(K),strong:o(La),thematicBreak:o(ma)},exit:{atxHeading:m(),atxHeadingSequence:I,autolink:m(),autolinkEmail:je,autolinkProtocol:Re,blockQuote:m(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:Z,characterReferenceMarkerNumeric:Z,characterReferenceValue:ae,characterReference:Se,codeFenced:m(w),codeFencedFence:k,codeFencedFenceInfo:x,codeFencedFenceMeta:j,codeFlowValue:L,codeIndented:m(C),codeText:m(J),codeTextData:L,data:L,definition:m(),definitionDestinationString:z,definitionLabelString:_,definitionTitleString:R,emphasis:m(),hardBreakEscape:m(Y),hardBreakTrailing:m(Y),htmlFlow:m(me),htmlFlowData:L,htmlText:m(te),htmlTextData:L,image:m(le),label:ve,labelText:ee,lineEnding:V,link:m(q),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:G,resourceDestinationString:M,resourceTitleString:P,resource:U,setextHeading:m(D),setextHeadingLineSequence:F,setextHeadingText:O,strong:m(),thematicBreak:m()}};Z_(t,(e||{}).mdastExtensions||[]);const n={};return a;function a(ue){let be={type:"root",children:[]};const Be={stack:[be],tokenStack:[],config:t,enter:f,exit:h,buffer:c,resume:p,data:n},Xe=[];let yt=-1;for(;++yt<ue.length;)if(ue[yt][1].type==="listOrdered"||ue[yt][1].type==="listUnordered")if(ue[yt][0]==="enter")Xe.push(yt);else{const Nn=Xe.pop();yt=s(ue,Nn,yt)}for(yt=-1;++yt<ue.length;){const Nn=t[ue[yt][0]];q_.call(Nn,ue[yt][1].type)&&Nn[ue[yt][1].type].call(Object.assign({sliceSerialize:ue[yt][2].sliceSerialize},Be),ue[yt][1])}if(Be.tokenStack.length>0){const Nn=Be.tokenStack[Be.tokenStack.length-1];(Nn[1]||Tk).call(Be,void 0,Nn[0])}for(be.position={start:Xi(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:Xi(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},yt=-1;++yt<t.transforms.length;)be=t.transforms[yt](be)||be;return be}function s(ue,be,Be){let Xe=be-1,yt=-1,Nn=!1,pr,Gt,Bt,It;for(;++Xe<=Be;){const ft=ue[Xe];switch(ft[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ft[0]==="enter"?yt++:yt--,It=void 0;break}case"lineEndingBlank":{ft[0]==="enter"&&(pr&&!It&&!yt&&!Bt&&(Bt=Xe),It=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:It=void 0}if(!yt&&ft[0]==="enter"&&ft[1].type==="listItemPrefix"||yt===-1&&ft[0]==="exit"&&(ft[1].type==="listUnordered"||ft[1].type==="listOrdered")){if(pr){let gr=Xe;for(Gt=void 0;gr--;){const Un=ue[gr];if(Un[1].type==="lineEnding"||Un[1].type==="lineEndingBlank"){if(Un[0]==="exit")continue;Gt&&(ue[Gt][1].type="lineEndingBlank",Nn=!0),Un[1].type="lineEnding",Gt=gr}else if(!(Un[1].type==="linePrefix"||Un[1].type==="blockQuotePrefix"||Un[1].type==="blockQuotePrefixWhitespace"||Un[1].type==="blockQuoteMarker"||Un[1].type==="listItemIndent"))break}Bt&&(!Gt||Bt<Gt)&&(pr._spread=!0),pr.end=Object.assign({},Gt?ue[Gt][1].start:ft[1].end),ue.splice(Gt||Xe,0,["exit",pr,ft[2]]),Xe++,Be++}if(ft[1].type==="listItemPrefix"){const gr={type:"listItem",_spread:!1,start:Object.assign({},ft[1].start),end:void 0};pr=gr,ue.splice(Xe,0,["enter",gr,ft[2]]),Xe++,Be++,Bt=void 0,It=!0}}}return ue[be][1]._spread=Nn,Be}function o(ue,be){return Be;function Be(Xe){f.call(this,ue(Xe),Xe),be&&be.call(this,Xe)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(ue,be,Be){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([be,Be||void 0]),ue.position={start:Xi(be.start),end:void 0}}function m(ue){return be;function be(Be){ue&&ue.call(this,Be),h.call(this,Be)}}function h(ue,be){const Be=this.stack.pop(),Xe=this.tokenStack.pop();if(Xe)Xe[0].type!==ue.type&&(be?be.call(this,ue,Xe[0]):(Xe[1]||Tk).call(this,ue,Xe[0]));else throw new Error("Cannot close `"+ue.type+"` ("+ic({start:ue.start,end:ue.end})+"): it’s not open");Be.position.end=Xi(ue.end)}function p(){return bb(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function S(ue){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function x(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.lang=ue}function j(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.meta=ue}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue.replace(/(\r?\n|\r)$/g,"")}function _(ue){const be=this.resume(),Be=this.stack[this.stack.length-1];Be.label=be,Be.identifier=wa(this.sliceSerialize(ue)).toLowerCase()}function R(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.title=ue}function z(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.url=ue}function I(ue){const be=this.stack[this.stack.length-1];if(!be.depth){const Be=this.sliceSerialize(ue).length;be.depth=Be}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function F(ue){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function D(){this.data.setextHeadingSlurpLineEnding=void 0}function W(ue){const Be=this.stack[this.stack.length-1].children;let Xe=Be[Be.length-1];(!Xe||Xe.type!=="text")&&(Xe=an(),Xe.position={start:Xi(ue.start),end:void 0},Be.push(Xe)),this.stack.push(Xe)}function L(ue){const be=this.stack.pop();be.value+=this.sliceSerialize(ue),be.position.end=Xi(ue.end)}function V(ue){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Be=be.children[be.children.length-1];Be.position.end=Xi(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(be.type)&&(W.call(this,ue),L.call(this,ue))}function Y(){this.data.atHardBreak=!0}function me(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue}function te(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue}function J(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue}function q(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=be,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function le(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=be,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function ee(ue){const be=this.sliceSerialize(ue),Be=this.stack[this.stack.length-2];Be.label=CH(be),Be.identifier=wa(be).toLowerCase()}function ve(){const ue=this.stack[this.stack.length-1],be=this.resume(),Be=this.stack[this.stack.length-1];if(this.data.inReference=!0,Be.type==="link"){const Xe=ue.children;Be.children=Xe}else Be.alt=be}function M(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.url=ue}function P(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.title=ue}function U(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function G(ue){const be=this.resume(),Be=this.stack[this.stack.length-1];Be.label=be,Be.identifier=wa(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function Z(ue){this.data.characterReferenceType=ue.type}function ae(ue){const be=this.sliceSerialize(ue),Be=this.data.characterReferenceType;let Xe;Be?(Xe=z_(be,Be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Xe=xb(be);const yt=this.stack[this.stack.length-1];yt.value+=Xe}function Se(ue){const be=this.stack.pop();be.position.end=Xi(ue.end)}function Re(ue){L.call(this,ue);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(ue)}function je(ue){L.call(this,ue);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(ue)}function $e(){return{type:"blockquote",children:[]}}function Ie(){return{type:"code",lang:null,meta:null,value:""}}function Ke(){return{type:"inlineCode",value:""}}function et(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function wt(){return{type:"emphasis",children:[]}}function K(){return{type:"heading",depth:0,children:[]}}function ge(){return{type:"break"}}function Ce(){return{type:"html",value:""}}function _e(){return{type:"image",title:null,url:"",alt:null}}function At(){return{type:"link",title:null,url:"",children:[]}}function qe(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function Mn(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function rn(){return{type:"paragraph",children:[]}}function La(){return{type:"strong",children:[]}}function an(){return{type:"text",value:""}}function ma(){return{type:"thematicBreak"}}}function Xi(e){return{line:e.line,column:e.column,offset:e.offset}}function Z_(e,t){let n=-1;for(;++n<t.length;){const a=t[n];Array.isArray(a)?Z_(e,a):AH(e,a)}}function AH(e,t){let n;for(n in t)if(q_.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 Tk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ic({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ic({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ic({start:t.start,end:t.end})+") is still open")}function RH(e){const t=this;t.parser=n;function n(a){return _H(a,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function OH(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 MH(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
391
|
-
`}]}function zH(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 DH(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function IH(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function LH(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),s=Lo(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 PH(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 UH(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function G_(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 BH(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return G_(e,t);const s={src:Lo(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 FH(e,t){const n={src:Lo(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 $H(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 HH(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return G_(e,t);const s={href:Lo(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 qH(e,t){const n={href:Lo(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 ZH(e,t,n){const a=e.all(t),s=n?GH(n):V_(t),o={},c=[];if(typeof t.checked=="boolean"){const p=a[0];let g;p&&p.type==="element"&&p.tagName==="p"?g=p:(g={type:"element",tagName:"p",properties:{},children:[]},a.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let f=-1;for(;++f<a.length;){const p=a[f];(s||f!==0||p.type!=="element"||p.tagName!=="p")&&c.push({type:"text",value:`
|
|
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 GH(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let a=-1;for(;!t&&++a<n.length;)t=V_(n[a])}return t}function V_(e){const t=e.spread;return t??e.children.length>1}function VH(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 QH(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function KH(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function YH(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function XH(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=pb(t.children[1]),m=C_(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 WH(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],S={},x=c?c[m]:void 0;x&&(S.align=x);let j={type:"element",tagName:o,properties:S,children:[]};g&&(j.children=e.all(g),e.patch(g,j),j=e.applyData(g,j)),h.push(j)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,p),e.applyData(t,p)}function JH(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Ak=9,Rk=32;function eq(e){const t=String(e),n=/\r?\n|\r/g;let a=n.exec(t),s=0;const o=[];for(;a;)o.push(Ok(t.slice(s,a.index),s>0,!0),a[0]),s=a.index+a[0].length,a=n.exec(t);return o.push(Ok(t.slice(s),s>0,!1)),o.join("")}function Ok(e,t,n){let a=0,s=e.length;if(t){let o=e.codePointAt(a);for(;o===Ak||o===Rk;)a++,o=e.codePointAt(a)}if(n){let o=e.codePointAt(s-1);for(;o===Ak||o===Rk;)s--,o=e.codePointAt(s-1)}return s>a?e.slice(a,s):""}function tq(e,t){const n={type:"text",value:eq(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function nq(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const rq={blockquote:OH,break:MH,code:zH,delete:DH,emphasis:IH,footnoteReference:LH,heading:PH,html:UH,imageReference:BH,image:FH,inlineCode:$H,linkReference:HH,link:qH,listItem:ZH,list:VH,paragraph:QH,root:KH,strong:YH,table:XH,tableCell:JH,tableRow:WH,text:tq,thematicBreak:nq,toml:kf,yaml:kf,definition:kf,footnoteDefinition:kf};function kf(){}const Q_=-1,zh=0,lc=1,th=2,wb=3,kb=4,jb=5,Eb=6,K_=7,Y_=8,Mk=typeof self=="object"?self:globalThis,aq=(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 zh:case Q_:return n(c,s);case lc:{const f=n([],s);for(const m of c)f.push(a(m));return f}case th:{const f=n({},s);for(const[m,h]of c)f[a(m)]=a(h);return f}case wb:return n(new Date(c),s);case kb:{const{source:f,flags:m}=c;return n(new RegExp(f,m),s)}case jb:{const f=n(new Map,s);for(const[m,h]of c)f.set(a(m),a(h));return f}case Eb:{const f=n(new Set,s);for(const m of c)f.add(a(m));return f}case K_:{const{name:f,message:m}=c;return n(new Mk[f](m),s)}case Y_:return n(BigInt(c),s);case"BigInt":return n(Object(BigInt(c)),s);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:f}=new Uint8Array(c);return n(new DataView(f),c)}}return n(new Mk[o](c),s)};return a},zk=e=>aq(new Map,e)(0),Vl="",{toString:iq}={},{keys:sq}=Object,Zu=e=>{const t=typeof e;if(t!=="object"||!e)return[zh,t];const n=iq.call(e).slice(8,-1);switch(n){case"Array":return[lc,Vl];case"Object":return[th,Vl];case"Date":return[wb,Vl];case"RegExp":return[kb,Vl];case"Map":return[jb,Vl];case"Set":return[Eb,Vl];case"DataView":return[lc,n]}return n.includes("Array")?[lc,n]:n.includes("Error")?[K_,n]:[th,n]},jf=([e,t])=>e===zh&&(t==="function"||t==="symbol"),lq=(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]=Zu(c);switch(f){case zh:{let p=c;switch(m){case"bigint":f=Y_,p=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);p=null;break;case"undefined":return s([Q_],c)}return s([f,p],c)}case lc:{if(m){let S=c;return m==="DataView"?S=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(S=new Uint8Array(c)),s([m,[...S]],c)}const p=[],g=s([f,p],c);for(const S of c)p.push(o(S));return g}case th:{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 S of sq(c))(e||!jf(Zu(c[S])))&&p.push([o(S),o(c[S])]);return g}case wb:return s([f,c.toISOString()],c);case kb:{const{source:p,flags:g}=c;return s([f,{source:p,flags:g}],c)}case jb:{const p=[],g=s([f,p],c);for(const[S,x]of c)(e||!(jf(Zu(S))||jf(Zu(x))))&&p.push([o(S),o(x)]);return g}case Eb:{const p=[],g=s([f,p],c);for(const S of c)(e||!jf(Zu(S)))&&p.push(o(S));return g}}const{message:h}=c;return s([f,{name:m,message:h}],c)};return o},Dk=(e,{json:t,lossy:n}={})=>{const a=[];return lq(!(t||n),!!t,new Map,a)(e),a},nh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?zk(Dk(e,t)):structuredClone(e):(e,t)=>zk(Dk(e,t));function oq(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 uq(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function cq(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||oq,a=e.options.footnoteBackLabel||uq,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(),S=Lo(g.toLowerCase());let x=0;const j=[],k=e.footnoteCounts.get(g);for(;k!==void 0&&++x<=k;){j.length>0&&j.push({type:"text",value:" "});let _=typeof n=="string"?n:n(m,x);typeof _=="string"&&(_={type:"text",value:_}),j.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+S+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,x),className:["data-footnote-backref"]},children:Array.isArray(_)?_:[_]})}const w=p[p.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const _=w.children[w.children.length-1];_&&_.type==="text"?_.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...j)}else p.push(...j);const C={type:"element",tagName:"li",properties:{id:t+"fn-"+S},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:{...nh(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 Dh=(function(e){if(e==null)return mq;if(typeof e=="function")return Ih(e);if(typeof e=="object")return Array.isArray(e)?dq(e):fq(e);if(typeof e=="string")return hq(e);throw new Error("Expected function, string, or object as test")});function dq(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Dh(e[n]);return Ih(a);function a(...s){let o=-1;for(;++o<t.length;)if(t[o].apply(this,s))return!0;return!1}}function fq(e){const t=e;return Ih(n);function n(a){const s=a;let o;for(o in e)if(s[o]!==t[o])return!1;return!0}}function hq(e){return Ih(t);function t(n){return n&&n.type===e}}function Ih(e){return t;function t(n,a,s){return!!(pq(n)&&e.call(this,n,typeof a=="number"?a:void 0,s||void 0))}}function mq(){return!0}function pq(e){return e!==null&&typeof e=="object"&&"type"in e}const X_=[],gq=!0,Wy=!1,yq="skip";function W_(e,t,n,a){let s;typeof t=="function"&&typeof n!="function"?(a=n,n=t):s=t;const o=Dh(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 x=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(S,"name",{value:"node ("+(m.type+(x?"<"+x+">":""))+")"})}return S;function S(){let x=X_,j,k,w;if((!t||o(m,h,p[p.length-1]||void 0))&&(x=vq(n(m,p)),x[0]===Wy))return x;if("children"in m&&m.children){const C=m;if(C.children&&x[0]!==yq)for(k=(a?C.children.length:-1)+c,w=p.concat(C);k>-1&&k<C.children.length;){const _=C.children[k];if(j=f(_,k,w)(),j[0]===Wy)return j;k=typeof j[1]=="number"?j[1]:k+c}}return x}}}function vq(e){return Array.isArray(e)?e:typeof e=="number"?[gq,e]:e==null?X_:[e]}function Cb(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),W_(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 Jy={}.hasOwnProperty,bq={};function xq(e,t){const n=t||bq,a=new Map,s=new Map,o=new Map,c={...rq,...n.handlers},f={all:h,applyData:wq,definitionById:a,footnoteById:s,footnoteCounts:o,footnoteOrder:[],handlers:c,one:m,options:n,patch:Sq,wrap:jq};return Cb(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const g=p.type==="definition"?a:s,S=String(p.identifier).toUpperCase();g.has(S)||g.set(S,p)}}),f;function m(p,g){const S=p.type,x=f.handlers[S];if(Jy.call(f.handlers,S)&&x)return x(f,p,g);if(f.options.passThrough&&f.options.passThrough.includes(S)){if("children"in p){const{children:k,...w}=p,C=nh(w);return C.children=f.all(p),C}return nh(p)}return(f.options.unknownHandler||kq)(f,p,g)}function h(p){const g=[];if("children"in p){const S=p.children;let x=-1;for(;++x<S.length;){const j=f.one(S[x],p);if(j){if(x&&S[x-1].type==="break"&&(!Array.isArray(j)&&j.type==="text"&&(j.value=Ik(j.value)),!Array.isArray(j)&&j.type==="element")){const k=j.children[0];k&&k.type==="text"&&(k.value=Ik(k.value))}Array.isArray(j)?g.push(...j):g.push(j)}}}return g}}function Sq(e,t){e.position&&(t.position=u9(e))}function wq(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,nh(o)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function kq(e,t){const n=t.data||{},a="value"in t&&!(Jy.call(n,"hProperties")||Jy.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 jq(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 Ik(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Lk(e,t){const n=xq(e,t),a=n.one(e,void 0),s=cq(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 Eq(e,t){return e&&"run"in e?async function(n,a){const s=Lk(n,{file:a,...t});await e.run(s,a)}:function(n,a){return Lk(n,{file:a,...e||t})}}function Pk(e){if(e)throw e}var Eg,Uk;function Cq(){if(Uk)return Eg;Uk=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 S;for(S in h);return typeof S>"u"||e.call(h,S)},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 Eg=function m(){var h,p,g,S,x,j,k=arguments[0],w=1,C=arguments.length,_=!1;for(typeof k=="boolean"&&(_=k,k=arguments[1]||{},w=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});w<C;++w)if(h=arguments[w],h!=null)for(p in h)g=f(k,p),S=f(h,p),k!==S&&(_&&S&&(o(S)||(x=s(S)))?(x?(x=!1,j=g&&s(g)?g:[]):j=g&&o(g)?g:{},c(k,{name:p,newValue:m(_,j,S)})):typeof S<"u"&&c(k,{name:p,newValue:S}));return k},Eg}var Nq=Cq();const Cg=oh(Nq);function ev(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 _q(){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?Tq(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 Tq(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 Aa={basename:Aq,dirname:Rq,extname:Oq,join:Mq,sep:"/"};function Aq(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Zc(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 Rq(e){if(Zc(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 Oq(e){Zc(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 Mq(...e){let t=-1,n;for(;++t<e.length;)Zc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":zq(n)}function zq(e){Zc(e);const t=e.codePointAt(0)===47;let n=Dq(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Dq(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 Zc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Iq={cwd:Lq};function Lq(){return"/"}function tv(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Pq(e){if(typeof e=="string")e=new URL(e);else if(!tv(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 Uq(e)}function Uq(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 Ng=["history","path","basename","stem","extname","dirname"];class J_{constructor(t){let n;t?tv(t)?n={path:t}:typeof t=="string"||Bq(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Iq.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<Ng.length;){const o=Ng[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)Ng.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Aa.basename(this.path):void 0}set basename(t){Tg(t,"basename"),_g(t,"basename"),this.path=Aa.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Aa.dirname(this.path):void 0}set dirname(t){Bk(this.basename,"dirname"),this.path=Aa.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Aa.extname(this.path):void 0}set extname(t){if(_g(t,"extname"),Bk(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Aa.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){tv(t)&&(t=Pq(t)),Tg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Aa.basename(this.path,this.extname):void 0}set stem(t){Tg(t,"stem"),_g(t,"stem"),this.path=Aa.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 ar(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 _g(e,t){if(e&&e.includes(Aa.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Aa.sep+"`")}function Tg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Bk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Bq(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Fq=(function(e){const a=this.constructor.prototype,s=a[e],o=function(){return s.apply(o,arguments)};return Object.setPrototypeOf(o,a),o}),$q={}.hasOwnProperty;class Nb extends Fq{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=_q()}copy(){const t=new Nb;let n=-1;for(;++n<this.attachers.length;){const a=this.attachers[n];t.use(...a)}return t.data(Cg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Og("data",this.frozen),this.namespace[t]=n,this):$q.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Og("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=Ef(t),a=this.parser||this.Parser;return Ag("parse",a),a(String(n),n)}process(t,n){const a=this;return this.freeze(),Ag("process",this.parser||this.Parser),Rg("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(o,c){const f=Ef(t),m=a.parse(f);a.run(m,f,function(p,g,S){if(p||!g||!S)return h(p);const x=g,j=a.stringify(x,S);Zq(j)?S.value=j:S.result=j,h(p,S)});function h(p,g){p||!g?c(p):o?o(g):n(void 0,g)}}}processSync(t){let n=!1,a;return this.freeze(),Ag("processSync",this.parser||this.Parser),Rg("processSync",this.compiler||this.Compiler),this.process(t,s),$k("processSync","process",n),a;function s(o,c){n=!0,Pk(o),a=c}}run(t,n,a){Fk(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=Ef(n);s.run(t,m,h);function h(p,g,S){const x=g||t;p?f(p):c?c(x):a(void 0,x,S)}}}runSync(t,n){let a=!1,s;return this.run(t,n,o),$k("runSync","run",a),s;function o(c,f){Pk(c),s=f,a=!0}}stringify(t,n){this.freeze();const a=Ef(n),s=this.compiler||this.Compiler;return Rg("stringify",s),Fk(t),s(t,a)}use(t,...n){const a=this.attachers,s=this.namespace;if(Og("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=Cg(!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,S=-1;for(;++g<a.length;)if(a[g][0]===h){S=g;break}if(S===-1)a.push([h,...p]);else if(p.length>0){let[x,...j]=p;const k=a[S][1];ev(k)&&ev(x)&&(x=Cg(!0,k,x)),a[S]=[h,x,...j]}}}}const Hq=new Nb().freeze();function Ag(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Rg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Og(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 Fk(e){if(!ev(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 Ef(e){return qq(e)?e:new J_(e)}function qq(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Zq(e){return typeof e=="string"||Gq(e)}function Gq(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Vq="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Hk=[],qk={allowDangerousHtml:!0},Qq=/^(https?|ircs?|mailto|xmpp)$/i,Kq=[{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 Yq(e){const t=Xq(e),n=Wq(e);return Jq(t.runSync(t.parse(n),n),e)}function Xq(e){const t=e.rehypePlugins||Hk,n=e.remarkPlugins||Hk,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...qk}:qk;return Hq().use(RH).use(n).use(Eq,a).use(t)}function Wq(e){const t=e.children||"",n=new J_;return typeof t=="string"&&(n.value=t),n}function Jq(e,t){const n=t.allowedElements,a=t.allowElement,s=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,m=t.urlTransform||e7;for(const p of Kq)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+Vq+p.id,void 0);return Cb(e,h),m9(e,{Fragment:l.Fragment,components:s,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function h(p,g,S){if(p.type==="raw"&&S&&typeof g=="number")return c?S.children.splice(g,1):S.children[g]={type:"text",value:p.value},g;if(p.type==="element"){let x;for(x in wg)if(Object.hasOwn(wg,x)&&Object.hasOwn(p.properties,x)){const j=p.properties[x],k=wg[x];(k===null||k.includes(p.tagName))&&(p.properties[x]=m(String(j||""),x,p))}}if(p.type==="element"){let x=n?!n.includes(p.tagName):o?o.includes(p.tagName):!1;if(!x&&a&&typeof g=="number"&&(x=!a(p,g,S)),x&&S&&typeof g=="number")return f&&p.children?S.children.splice(g,1,...p.children):S.children.splice(g,1),g}}}function e7(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||Qq.test(e.slice(0,t))?e:""}function t7(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function eT(e,t,n){const s=Dh((n||{}).ignore||[]),o=n7(t);let c=-1;for(;++c<o.length;)W_(e,"text",f);function f(h,p){let g=-1,S;for(;++g<p.length;){const x=p[g],j=S?S.children:void 0;if(s(x,j?j.indexOf(x):void 0,S))return;S=x}if(S)return m(h,p)}function m(h,p){const g=p[p.length-1],S=o[c][0],x=o[c][1];let j=0;const w=g.children.indexOf(h);let C=!1,_=[];S.lastIndex=0;let R=S.exec(h.value);for(;R;){const z=R.index,I={index:R.index,input:R.input,stack:[...p,h]};let O=x(...R,I);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?S.lastIndex=z+1:(j!==z&&_.push({type:"text",value:h.value.slice(j,z)}),Array.isArray(O)?_.push(...O):O&&_.push(O),j=z+R[0].length,C=!0),!S.global)break;R=S.exec(h.value)}return C?(j<h.value.length&&_.push({type:"text",value:h.value.slice(j)}),g.children.splice(w,1,..._)):_=[h],w+_.length}}function n7(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([r7(s[0]),a7(s[1])])}return t}function r7(e){return typeof e=="string"?new RegExp(t7(e),"g"):e}function a7(e){return typeof e=="function"?e:function(){return e}}function i7(e){eT(e,[/\r?\n|\r/g,s7])}function s7(){return{type:"break"}}function l7(){return function(e){i7(e)}}function Zk(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 Mg="phrasing",zg=["autolink","link","image","label"];function o7(){return{transforms:[p7],enter:{literalAutolink:c7,literalAutolinkEmail:Dg,literalAutolinkHttp:Dg,literalAutolinkWww:Dg},exit:{literalAutolink:m7,literalAutolinkEmail:h7,literalAutolinkHttp:d7,literalAutolinkWww:f7}}}function u7(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Mg,notInConstruct:zg},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Mg,notInConstruct:zg},{character:":",before:"[ps]",after:"\\/",inConstruct:Mg,notInConstruct:zg}]}}function c7(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Dg(e){this.config.enter.autolinkProtocol.call(this,e)}function d7(e){this.config.exit.autolinkProtocol.call(this,e)}function f7(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 h7(e){this.config.exit.autolinkEmail.call(this,e)}function m7(e){this.exit(e)}function p7(e){eT(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,g7],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),y7]],{ignore:["link","linkReference"]})}function g7(e,t,n,a,s){let o="";if(!tT(s)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!v7(n)))return!1;const c=b7(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 y7(e,t,n,a){return!tT(a,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function v7(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 b7(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=Zk(e,"(");let o=Zk(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 tT(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||nl(n)||Oh(n))&&(!t||n!==47)}nT.peek=_7;function x7(){this.buffer()}function S7(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function w7(){this.buffer()}function k7(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function j7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=wa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function E7(e){this.exit(e)}function C7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=wa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function N7(e){this.exit(e)}function _7(){return"["}function nT(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 T7(){return{enter:{gfmFootnoteCallString:x7,gfmFootnoteCall:S7,gfmFootnoteDefinitionLabelString:w7,gfmFootnoteDefinition:k7},exit:{gfmFootnoteCallString:j7,gfmFootnoteCall:E7,gfmFootnoteDefinitionLabelString:C7,gfmFootnoteDefinition:N7}}}function A7(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:nT},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?rT:R7))),h(),m}}function R7(e,t,n){return t===0?e:rT(e,t,n)}function rT(e,t,n){return(n?"":" ")+e}const O7=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];aT.peek=L7;function M7(){return{canContainEols:["delete"],enter:{strikethrough:D7},exit:{strikethrough:I7}}}function z7(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:O7}],handlers:{delete:aT}}}function D7(e){this.enter({type:"delete",children:[]},e)}function I7(e){this.exit(e)}function aT(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 L7(){return"~"}function P7(e){return e.length}function U7(e,t){const n=t||{},a=(n.align||[]).concat(),s=n.stringLength||P7,o=[],c=[],f=[],m=[];let h=0,p=-1;for(;++p<e.length;){const k=[],w=[];let C=-1;for(e[p].length>h&&(h=e[p].length);++C<e[p].length;){const _=B7(e[p][C]);if(n.alignDelimiters!==!1){const R=s(_);w[C]=R,(m[C]===void 0||R>m[C])&&(m[C]=R)}k.push(_)}c[p]=k,f[p]=w}let g=-1;if(typeof a=="object"&&"length"in a)for(;++g<h;)o[g]=Gk(a[g]);else{const k=Gk(a);for(;++g<h;)o[g]=k}g=-1;const S=[],x=[];for(;++g<h;){const k=o[g];let w="",C="";k===99?(w=":",C=":"):k===108?w=":":k===114&&(C=":");let _=n.alignDelimiters===!1?1:Math.max(1,m[g]-w.length-C.length);const R=w+"-".repeat(_)+C;n.alignDelimiters!==!1&&(_=w.length+_+C.length,_>m[g]&&(m[g]=_),x[g]=_),S[g]=R}c.splice(1,0,S),f.splice(1,0,x),p=-1;const j=[];for(;++p<c.length;){const k=c[p],w=f[p];g=-1;const C=[];for(;++g<h;){const _=k[g]||"";let R="",z="";if(n.alignDelimiters!==!1){const I=m[g]-(w[g]||0),O=o[g];O===114?R=" ".repeat(I):O===99?I%2?(R=" ".repeat(I/2+.5),z=" ".repeat(I/2-.5)):(R=" ".repeat(I/2),z=R):z=" ".repeat(I)}n.delimiterStart!==!1&&!g&&C.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&_==="")&&(n.delimiterStart!==!1||g)&&C.push(" "),n.alignDelimiters!==!1&&C.push(R),C.push(_),n.alignDelimiters!==!1&&C.push(z),n.padding!==!1&&C.push(" "),(n.delimiterEnd!==!1||g!==h-1)&&C.push("|")}j.push(n.delimiterEnd===!1?C.join("").replace(/ +$/,""):C.join(""))}return j.join(`
|
|
402
|
-
`)}function B7(e){return e==null?"":String(e)}function Gk(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 F7(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()),$7);return s(),c}function $7(e,t,n){return">"+(n?"":" ")+e}function H7(e,t){return Vk(e,t.inConstruct,!0)&&!Vk(e,t.notInConstruct,!1)}function Vk(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 Qk(e,t,n,a){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
|
|
403
|
-
`&&H7(n.stack,n.unsafe[s]))return/[ \t]/.test(a.before)?"":" ";return`\\
|
|
404
|
-
`}function q7(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 Z7(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 G7(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 V7(e,t,n,a){const s=G7(n),o=e.value||"",c=s==="`"?"GraveAccent":"Tilde";if(Z7(e,n)){const g=n.enter("codeIndented"),S=n.indentLines(o,Q7);return g(),S}const f=n.createTracker(a),m=s.repeat(Math.max(q7(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 Q7(e,t,n){return(n?"":" ")+e}function _b(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 K7(e,t,n,a){const s=_b(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 Y7(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 wc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function rh(e,t,n){const a=No(e),s=No(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}}iT.peek=X7;function iT(e,t,n,a){const s=Y7(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=rh(a.before.charCodeAt(a.before.length-1),h,s);p.inside&&(m=wc(h)+m.slice(1));const g=m.charCodeAt(m.length-1),S=rh(a.after.charCodeAt(0),g,s);S.inside&&(m=m.slice(0,-1)+wc(g));const x=c.move(s);return o(),n.attentionEncodeSurroundingInfo={after:S.outside,before:p.outside},f+m+x}function X7(e,t,n){return n.options.emphasis||"*"}function W7(e,t){let n=!1;return Cb(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,Wy}),!!((!e.depth||e.depth<3)&&bb(e)&&(t.options.setext||n))}function J7(e,t,n,a){const s=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(a);if(W7(e,n)){const p=n.enter("headingSetext"),g=n.enter("phrasing"),S=n.containerPhrasing(e,{...o.current(),before:`
|
|
409
|
-
`,after:`
|
|
410
|
-
`});return g(),p(),S+`
|
|
411
|
-
`+(s===1?"=":"-").repeat(S.length-(Math.max(S.lastIndexOf("\r"),S.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=wc(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,n.options.closeAtx&&(h+=" "+c),m(),f(),h}sT.peek=eZ;function sT(e){return e.value||""}function eZ(){return"<"}lT.peek=tZ;function lT(e,t,n,a){const s=_b(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 tZ(){return"!"}oT.peek=nZ;function oT(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 nZ(){return"!"}uT.peek=rZ;function uT(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 rZ(){return"`"}function cT(e,t){const n=bb(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))}dT.peek=aZ;function dT(e,t,n,a){const s=_b(n),o=s==='"'?"Quote":"Apostrophe",c=n.createTracker(a);let f,m;if(cT(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 aZ(e,t,n){return cT(e,n)?"<":"["}fT.peek=iZ;function fT(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 iZ(){return"["}function Tb(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 sZ(e){const t=Tb(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 lZ(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 hT(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 oZ(e,t,n,a){const s=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?lZ(n):Tb(n);const f=e.ordered?c==="."?")":".":sZ(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),hT(n)===c&&p){let g=-1;for(;++g<e.children.length;){const S=e.children[g];if(S&&S.type==="listItem"&&S.children&&S.children[0]&&S.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 uZ(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 cZ(e,t,n,a){const s=uZ(n);let o=n.bulletCurrent||Tb(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,S,x){return S?(x?"":" ".repeat(c))+g:(x?o:o+" ".repeat(c-o.length))+g}}function dZ(e,t,n,a){const s=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,a);return o(),s(),c}const fZ=Dh(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function hZ(e,t,n,a){return(e.children.some(function(c){return fZ(c)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function mZ(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}mT.peek=pZ;function mT(e,t,n,a){const s=mZ(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=rh(a.before.charCodeAt(a.before.length-1),h,s);p.inside&&(m=wc(h)+m.slice(1));const g=m.charCodeAt(m.length-1),S=rh(a.after.charCodeAt(0),g,s);S.inside&&(m=m.slice(0,-1)+wc(g));const x=c.move(s+s);return o(),n.attentionEncodeSurroundingInfo={after:S.outside,before:p.outside},f+m+x}function pZ(e,t,n){return n.options.strong||"*"}function gZ(e,t,n,a){return n.safe(e.value,a)}function yZ(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 vZ(e,t,n){const a=(hT(n)+(n.options.ruleSpaces?" ":"")).repeat(yZ(n));return n.options.ruleSpaces?a.slice(0,-1):a}const pT={blockquote:F7,break:Qk,code:V7,definition:K7,emphasis:iT,hardBreak:Qk,heading:J7,html:sT,image:lT,imageReference:oT,inlineCode:uT,link:dT,linkReference:fT,list:oZ,listItem:cZ,paragraph:dZ,root:hZ,strong:mT,text:gZ,thematicBreak:vZ};function bZ(){return{enter:{table:xZ,tableData:Kk,tableHeader:Kk,tableRow:wZ},exit:{codeText:kZ,table:SZ,tableData:Ig,tableHeader:Ig,tableRow:Ig}}}function xZ(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 SZ(e){this.exit(e),this.data.inTable=void 0}function wZ(e){this.enter({type:"tableRow",children:[]},e)}function Ig(e){this.exit(e)}function Kk(e){this.enter({type:"tableCell",children:[]},e)}function kZ(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,jZ));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function jZ(e,t){return t==="|"?t:e}function EZ(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:S,table:c,tableCell:m,tableRow:f}};function c(x,j,k,w){return h(p(x,k,w),x.align)}function f(x,j,k,w){const C=g(x,k,w),_=h([C]);return _.slice(0,_.indexOf(`
|
|
415
|
-
`))}function m(x,j,k,w){const C=k.enter("tableCell"),_=k.enter("phrasing"),R=k.containerPhrasing(x,{...w,before:o,after:o});return _(),C(),R}function h(x,j){return U7(x,{align:j,alignDelimiters:a,padding:n,stringLength:s})}function p(x,j,k){const w=x.children;let C=-1;const _=[],R=j.enter("table");for(;++C<w.length;)_[C]=g(w[C],j,k);return R(),_}function g(x,j,k){const w=x.children;let C=-1;const _=[],R=j.enter("tableRow");for(;++C<w.length;)_[C]=m(w[C],x,j,k);return R(),_}function S(x,j,k){let w=pT.inlineCode(x,j,k);return k.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function CZ(){return{exit:{taskListCheckValueChecked:Yk,taskListCheckValueUnchecked:Yk,paragraph:_Z}}}function NZ(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:TZ}}}function Yk(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function _Z(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 TZ(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=pT.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 AZ(){return[o7(),T7(),M7(),bZ(),CZ()]}function RZ(e){return{extensions:[u7(),A7(e),z7(),EZ(e),NZ()]}}const OZ={tokenize:PZ,partial:!0},gT={tokenize:UZ,partial:!0},yT={tokenize:BZ,partial:!0},vT={tokenize:FZ,partial:!0},MZ={tokenize:$Z,partial:!0},bT={name:"wwwAutolink",tokenize:IZ,previous:ST},xT={name:"protocolAutolink",tokenize:LZ,previous:wT},vi={name:"emailAutolink",tokenize:DZ,previous:kT},Ia={};function zZ(){return{text:Ia}}let Fs=48;for(;Fs<123;)Ia[Fs]=vi,Fs++,Fs===58?Fs=65:Fs===91&&(Fs=97);Ia[43]=vi;Ia[45]=vi;Ia[46]=vi;Ia[95]=vi;Ia[72]=[vi,xT];Ia[104]=[vi,xT];Ia[87]=[vi,bT];Ia[119]=[vi,bT];function DZ(e,t,n){const a=this;let s,o;return c;function c(g){return!nv(g)||!kT.call(a,a.previous)||Ab(a.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return nv(g)?(e.consume(g),f):g===64?(e.consume(g),m):n(g)}function m(g){return g===46?e.check(MZ,p,h)(g):g===45||g===95||nr(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&&cr(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function IZ(e,t,n){const a=this;return s;function s(c){return c!==87&&c!==119||!ST.call(a,a.previous)||Ab(a.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(OZ,e.attempt(gT,e.attempt(yT,o),n),n)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function LZ(e,t,n){const a=this;let s="",o=!1;return c;function c(g){return(g===72||g===104)&&wT.call(a,a.previous)&&!Ab(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(g),e.consume(g),f):n(g)}function f(g){if(cr(g)&&s.length<5)return s+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const S=s.toLowerCase();if(S==="http"||S==="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||eh(g)||Ut(g)||nl(g)||Oh(g)?n(g):e.attempt(gT,e.attempt(yT,p),n)(g)}function p(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function PZ(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 UZ(e,t,n){let a,s,o;return c;function c(h){return h===46||h===95?e.check(vT,m,f)(h):h===null||Ut(h)||nl(h)||h!==45&&Oh(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 BZ(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(vT,t,o)(c):c===null||Ut(c)||nl(c)?t(c):(e.consume(c),s)}function o(c){return c===41&&a++,e.consume(c),s}}function FZ(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||Ut(f)||nl(f)?t(f):n(f)}function s(f){return f===null||f===40||f===91||Ut(f)||nl(f)?t(f):a(f)}function o(f){return cr(f)?c(f):n(f)}function c(f){return f===59?(e.consume(f),a):cr(f)?(e.consume(f),c):n(f)}}function $Z(e,t,n){return a;function a(o){return e.consume(o),s}function s(o){return nr(o)?n(o):t(o)}}function ST(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ut(e)}function wT(e){return!cr(e)}function kT(e){return!(e===47||nv(e))}function nv(e){return e===43||e===45||e===46||e===95||nr(e)}function Ab(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 HZ={tokenize:XZ,partial:!0};function qZ(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:QZ,continuation:{tokenize:KZ},exit:YZ}},text:{91:{name:"gfmFootnoteCall",tokenize:VZ},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ZZ,resolveTo:GZ}}}}function ZZ(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=wa(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 GZ(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 VZ(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||Ut(g))return n(g);if(g===93){e.exit("chunkString");const S=e.exit("gfmFootnoteCallString");return s.includes(wa(a.sliceSerialize(S)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return Ut(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 QZ(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o,c=0,f;return m;function m(j){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(j),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(j){return j===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(j),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(j)}function p(j){if(c>999||j===93&&!f||j===null||j===91||Ut(j))return n(j);if(j===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=wa(a.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(j),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),S}return Ut(j)||(f=!0),c++,e.consume(j),j===92?g:p}function g(j){return j===91||j===92||j===93?(e.consume(j),c++,p):p(j)}function S(j){return j===58?(e.enter("definitionMarker"),e.consume(j),e.exit("definitionMarker"),s.includes(o)||s.push(o),kt(e,x,"gfmFootnoteDefinitionWhitespace")):n(j)}function x(j){return t(j)}}function KZ(e,t,n){return e.check(qc,t,e.attempt(HZ,t,n))}function YZ(e){e.exit("gfmFootnoteDefinition")}function XZ(e,t,n){const a=this;return kt(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 WZ(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)},S=[["enter",p,f],["enter",c[h][1],f],["exit",c[h][1],f],["enter",g,f]],x=f.parser.constructs.insideSpan.null;x&&qr(S,S.length,0,Mh(x,c.slice(h+1,m),f)),qr(S,S.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",p,f]]),qr(c,h-1,m-h+3,S),m=h+S.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 S;function S(j){return h===126&&p[p.length-1][1].type!=="characterEscape"?m(j):(c.enter("strikethroughSequenceTemporary"),x(j))}function x(j){const k=No(h);if(j===126)return g>1?m(j):(c.consume(j),g++,x);if(g<2&&!n)return m(j);const w=c.exit("strikethroughSequenceTemporary"),C=No(j);return w._open=!C||C===2&&!!k,w._close=!k||k===2&&!!C,f(j)}}}class JZ{constructor(){this.map=[]}add(t,n,a){eG(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 eG(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 tG(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 nG(){return{flow:{null:{name:"table",tokenize:rG,resolveAll:aG}}}}function rG(e,t,n){const a=this;let s=0,o=0,c;return f;function f(L){let V=a.events.length-1;for(;V>-1;){const te=a.events[V][1].type;if(te==="lineEnding"||te==="linePrefix")V--;else break}const Y=V>-1?a.events[V][1].type:null,me=Y==="tableHead"||Y==="tableRow"?O:m;return me===O&&a.parser.lazy[a.now().line]?n(L):me(L)}function m(L){return e.enter("tableHead"),e.enter("tableRow"),h(L)}function h(L){return L===124||(c=!0,o+=1),p(L)}function p(L){return L===null?n(L):Ze(L)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),x):n(L):dt(L)?kt(e,p,"whitespace")(L):(o+=1,c&&(c=!1,s+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),c=!0,p):(e.enter("data"),g(L)))}function g(L){return L===null||L===124||Ut(L)?(e.exit("data"),p(L)):(e.consume(L),L===92?S:g)}function S(L){return L===92||L===124?(e.consume(L),g):g(L)}function x(L){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(L):(e.enter("tableDelimiterRow"),c=!1,dt(L)?kt(e,j,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):j(L))}function j(L){return L===45||L===58?w(L):L===124?(c=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),k):I(L)}function k(L){return dt(L)?kt(e,w,"whitespace")(L):w(L)}function w(L){return L===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),C):L===45?(o+=1,C(L)):L===null||Ze(L)?z(L):I(L)}function C(L){return L===45?(e.enter("tableDelimiterFiller"),_(L)):I(L)}function _(L){return L===45?(e.consume(L),_):L===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),R):(e.exit("tableDelimiterFiller"),R(L))}function R(L){return dt(L)?kt(e,z,"whitespace")(L):z(L)}function z(L){return L===124?j(L):L===null||Ze(L)?!c||s!==o?I(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(L)):I(L)}function I(L){return n(L)}function O(L){return e.enter("tableRow"),F(L)}function F(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),F):L===null||Ze(L)?(e.exit("tableRow"),t(L)):dt(L)?kt(e,F,"whitespace")(L):(e.enter("data"),D(L))}function D(L){return L===null||L===124||Ut(L)?(e.exit("data"),F(L)):(e.consume(L),L===92?W:D)}function W(L){return L===92||L===124?(e.consume(L),D):D(L)}}function aG(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 S=new JZ;for(;++n<e.length;){const x=e[n],j=x[1];x[0]==="enter"?j.type==="tableHead"?(f=!1,m!==0&&(Xk(S,t,m,h,p),p=void 0,m=0),h={type:"table",start:Object.assign({},j.start),end:Object.assign({},j.end)},S.add(n,0,[["enter",h,t]])):j.type==="tableRow"||j.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({},j.start),end:Object.assign({},j.end)},S.add(n,0,[["enter",p,t]])),s=j.type==="tableDelimiterRow"?2:p?3:1):s&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")?(a=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],g=Cf(S,t,o,s,void 0,g),o=[0,0,0,0]),c[2]=n)):j.type==="tableCellDivider"&&(a?a=!1:(o[1]!==0&&(c[0]=c[1],g=Cf(S,t,o,s,void 0,g)),o=c,c=[o[1],n,0,0])):j.type==="tableHead"?(f=!0,m=n):j.type==="tableRow"||j.type==="tableDelimiterRow"?(m=n,o[1]!==0?(c[0]=c[1],g=Cf(S,t,o,s,n,g)):c[1]!==0&&(g=Cf(S,t,c,s,n,g)),s=0):s&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")&&(c[3]=n)}for(m!==0&&Xk(S,t,m,h,p),S.consume(t.events),n=-1;++n<t.events.length;){const x=t.events[n];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=tG(t.events,n))}return e}function Cf(e,t,n,a,s,o){const c=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},Xl(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const m=Xl(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=Xl(t.events,n[2]),p=Xl(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 S=t.events[n[2]],x=t.events[n[3]];if(S[1].end=Object.assign({},x[1].end),S[1].type="chunkText",S[1].contentType="text",n[3]>n[2]+1){const j=n[2]+1,k=n[3]-n[2]-1;e.add(j,k,[])}}e.add(n[3]+1,0,[["exit",g,t]])}return s!==void 0&&(o.end=Object.assign({},Xl(t.events,s)),e.add(s,0,[["exit",o,t]]),o=void 0),o}function Xk(e,t,n,a,s){const o=[],c=Xl(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 Xl(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const iG={name:"tasklistCheck",tokenize:lG};function sG(){return{text:{91:iG}}}function lG(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 Ut(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 Ze(m)?t(m):dt(m)?e.check({tokenize:oG},t,n)(m):n(m)}}function oG(e,t,n){return kt(e,a,"whitespace");function a(s){return s===null?n(s):t(s)}}function uG(e){return M_([zZ(),qZ(),WZ(e),nG(),sG()])}const cG={};function dG(e){const t=this,n=e||cG,a=t.data(),s=a.micromarkExtensions||(a.micromarkExtensions=[]),o=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);s.push(uG(n)),o.push(AZ()),c.push(RZ(n))}function Lh({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(Yq,{remarkPlugins:[dG,l7],components:{a:({node:n,...a})=>l.jsx("a",{...a,target:"_blank",rel:"noopener noreferrer"})},children:e})})}function fG({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(jn,{style:{borderColor:m?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[l.jsxs(fa,{children:[l.jsxs(ha,{children:["System prompt append",m&&l.jsx(hG,{})]}),!o&&!s&&l.jsxs(xe,{size:"xs",variant:"outline",onClick:()=>c(!0),children:[l.jsx(zv,{className:"h-3 w-3"})," Edit"]})]}),l.jsx(rr,{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(xe,{size:"xs",variant:"ghost",onClick:()=>{a(),c(!1)},disabled:!m,children:"Revert"}),l.jsx(xe,{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(Lh,{children:e}):l.jsx("span",{className:"text-muted-foreground italic",children:"No prompt append."})})})]})}function hG(){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 jT={"claude-code":"Claude Code",codex:"Codex"},mG=[Wf.CLAUDE_CODE,Wf.CODEX];function pG({open:e,onOpenChange:t,agent:n}){const a=pn(),s=n.clientId,o=n.runtimeProvider,[c,f]=b.useState(s),[m,h]=b.useState(o),[p,g]=b.useState(!1),x=Ye({queryKey:["clients-rebind"],queryFn:pi,enabled:e}).data??[],j=nO({queries:x.map(D=>({queryKey:["client-capabilities",D.id],queryFn:()=>ph(D.id),enabled:e}))}),k=b.useMemo(()=>{const D=new Map;return j.forEach((W,L)=>{const V=x[L];if(!V)return;const Y=W.data;Y!=null&&Y.capabilities&&D.set(V.id,Y.capabilities)}),D},[j,x]);b.useEffect(()=>{e||(f(s),h(o),g(!1))},[e,s,o]);const w=c?k.get(c)??null:null,C=(w==null?void 0:w[m])??null,_=!C||C.state==="missing"||C.state==="error",R=!!c&&(c!==s||m!==o)&&(!_||p),z=m!==o,I=c!==s,O=gt({mutationFn:()=>{if(!c)throw new Error("clientId required");return A4(n.uuid,{clientId:c,runtimeProvider:m,force:_&&p?!0:void 0})},onSuccess:()=>{a.invalidateQueries({queryKey:["agent",n.uuid]}),a.invalidateQueries({queryKey:["agents"]}),t(!1)}}),F=O.error instanceof al||O.error instanceof Error?O.error.message:null;return l.jsx(Rn,{open:e,onOpenChange:t,children:l.jsxs(Cn,{className:"max-w-lg",children:[l.jsx(Pn,{children:l.jsx(On,{children:"Re-bind agent"})}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:["Currently:"," ",l.jsx("span",{className:"mono",children:yG(s,x,o)})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{children:"Computer"}),l.jsx("select",{value:c??"",onChange:D=>f(D.target.value||null),className:"w-full rounded-[var(--radius-input)] border border-input bg-background px-3 py-2 text-body",children:x.map(D=>l.jsx("option",{value:D.id,children:gG(D)},D.id))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{children:"Runtime"}),l.jsx("div",{className:"space-y-2",children:mG.map(D=>{const W=(w==null?void 0:w[D])??null,L=!!W&&W.state!=="missing",V=m===D;return l.jsxs("label",{className:V?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":L?"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:V,onChange:()=>h(D),className:"mt-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-body font-medium",children:jT[D]}),l.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:bG(W,D)})]})]},D)})})]}),(I||z)&&l.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-caption space-y-1",children:[l.jsxs("p",{children:[l.jsx("span",{className:"font-medium",children:"Heads up:"})," active sessions on the previous computer are suspended at re-bind. Chat history is preserved."]}),z&&l.jsx("p",{children:"Some configuration fields don't transfer between providers (e.g. claude permission_mode is dropped; codex sandboxMode resets to default)."})]}),_&&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:D=>g(D.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."})]}),F&&l.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:F})]}),l.jsxs(mr,{children:[l.jsx(xe,{variant:"outline",onClick:()=>t(!1),disabled:O.isPending,children:"Cancel"}),l.jsx(xe,{onClick:()=>O.mutate(),disabled:!R||O.isPending,children:O.isPending?"Re-binding…":"Re-bind"})]})]})})}function gG(e){return`${e.hostname??e.id} · ${e.status}`}function yG(e,t,n){const a=e?t.find(o=>o.id===e):null;return`${(a==null?void 0:a.hostname)??e??"(unbound)"} · ${jT[n]}`}const vG={"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 bG(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. ${vG[t]}`;case"missing":return"SDK not installed on this computer.";case"error":return e.error?`Probe error: ${e.error}`:"Probe error."}}const xG={prompt:"Prompt",model:"Model",mcp:"MCP",env:"Env",git:"Git"};function SG(e){if(!e.summary.anyDirty&&!e.conflictMessage&&!e.errorMessage&&!e.justSaved)return null;const t=e.summary.dirtySections.length,n=e.summary.anyDirty||e.saving;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(ac,{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(a=>l.jsx("button",{type:"button",onClick:()=>e.onJumpTo(a),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:xG[a]},a))})]}),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(fr,{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(xe,{variant:"outline",size:"sm",onClick:e.onReloadRemote,disabled:!!e.reloadingRemote,children:e.reloadingRemote?l.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[l.jsx(Ty,{className:"h-3 w-3 animate-spin","aria-hidden":!0}),"Loading latest…"]}):"Discard mine, load latest"}),n&&l.jsxs(l.Fragment,{children:[l.jsx(xe,{variant:"ghost",size:"sm",onClick:e.onDiscard,disabled:e.saving,children:"Discard changes"}),l.jsx(xe,{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(Ty,{className:"h-3 w-3 animate-spin","aria-hidden":!0}),"Saving…"]}):"Save"})]})]})]})})}function ah(e){return`agent-cfg-${e}`}function Wl({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 wG(){return l.jsx("hr",{"aria-hidden":!0,style:{border:0,borderTop:"var(--hairline) solid var(--border)",margin:"var(--sp-2) 0"}})}const kG={"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 jG(e){const t=kG[e.runtimeProvider];return l.jsxs("div",{className:"space-y-3",children:[l.jsx(EG,{name:t.name,caption:t.caption,locked:!0}),l.jsx(CG,{computerLabel:e.computerLabel,statusLoading:e.computerStatusLoading??!1,statusError:e.computerStatusError??null,canBindComputer:e.canBindComputer,bindPending:e.bindComputerPending??!1,onBindComputer:e.onBindComputer,onRebind:e.onRebind}),e.modelSlot]})}function EG({name:e,caption:t,locked:n}){return l.jsxs(jn,{children:[l.jsx(fa,{children:l.jsxs(ha,{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(mh,{className:"h-3 w-3","aria-hidden":!0})," locked"]})]})}),l.jsxs(rr,{className:"space-y-1 text-body",children:[l.jsxs("div",{className:"inline-flex items-center gap-2",children:[l.jsx(qE,{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 CG(e){const t=!!e.computerLabel,n=!e.statusLoading&&!e.statusError;return l.jsxs(jn,{children:[l.jsxs(fa,{children:[l.jsx(ha,{children:"Bound computer"}),n&&e.canBindComputer&&e.onBindComputer&&!t&&l.jsxs(xe,{size:"xs",variant:"outline",onClick:e.onBindComputer,disabled:e.bindPending,title:e.bindPending?"Binding computer…":"Pick a connected computer for this agent",children:[l.jsx(_y,{className:"h-3 w-3"}),e.bindPending?"Binding…":"Bind computer"]}),n&&t&&e.onRebind&&l.jsxs(xe,{size:"xs",variant:"outline",onClick:e.onRebind,title:"Move this agent to another computer",children:[l.jsx(_y,{className:"h-3 w-3"}),"Re-bind"]})]}),l.jsx(rr,{className:"text-body",children:e.statusLoading?l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Checking computer binding…"}):e.statusError?l.jsxs("p",{className:"text-caption",style:{color:"var(--state-error)"},children:["Could not verify computer binding: ",e.statusError]}):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 NG(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 _G(e,t){let n=t.size+1;for(;t.has(`${e}-${n}`);)n++;return`${e}-${n}`}function TG(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Lg(e,t){return e.map((n,a)=>({key:`${t}-${a+1}`,value:n,baseline:n,status:"unchanged"}))}function Wk(e){return e.map(t=>t.status==="deleted"?t:t.baseline==null?{...t,status:"added"}:TG(t.value,t.baseline)?{...t,status:"unchanged"}:{...t,status:"modified"})}function Pg(e,t){const n=e;return{add:a=>t(s=>{const o=s[e],c=new Set(o.map(h=>h.key)),f=_G(n,c),m=[...o,{key:f,value:a,baseline:null,status:"added"}];return{...s,[e]:Wk(m)}}),update:(a,s)=>t(o=>{const f=o[e].map(m=>m.key===a?{...m,value:s}:m);return{...o,[e]:Wk(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 Jk(e){return{promptAppend:e.payload.prompt.append,model:e.payload.model,mcp:Lg(e.payload.mcpServers,"mcp"),env:Lg(e.payload.env,"env"),git:Lg(e.payload.gitRepos,"git")}}function AG(e){const[t,n]=b.useState(null),[a,s]=b.useState(null);b.useEffect(()=>{e&&a===null&&(n(e),s(Jk(e)))},[e,a]);const o=a??{promptAppend:"",model:"",mcp:[],env:[],git:[]},c=(t==null?void 0:t.payload.prompt.append)??"",f=(t==null?void 0:t.payload.model)??"",m=o.promptAppend!==c,h=o.model!==f,p=b.useMemo(()=>{const O=[],F=V=>V.reduce((Y,me)=>me.status==="unchanged"?Y:Y+1,0),D=F(o.mcp),W=F(o.env),L=F(o.git);return m&&O.push("prompt"),h&&O.push("model"),D>0&&O.push("mcp"),W>0&&O.push("env"),L>0&&O.push("git"),{anyDirty:O.length>0,dirtySections:O,counts:{prompt:m?1:0,model:h?1:0,mcp:D,env:W,git:L}}},[o,m,h]),g=b.useCallback(O=>{s(F=>F&&O(F))},[]),S=b.useCallback(O=>g(F=>({...F,promptAppend:O})),[g]),x=b.useCallback(()=>g(O=>({...O,promptAppend:c})),[g,c]),j=b.useCallback(O=>g(F=>({...F,model:O})),[g]),k=b.useCallback(()=>g(O=>({...O,model:f})),[g,f]),w=b.useMemo(()=>Pg("mcp",g),[g]),C=b.useMemo(()=>Pg("env",g),[g]),_=b.useMemo(()=>Pg("git",g),[g]),R=b.useCallback(()=>{n(null),s(null)},[]),z=b.useCallback(O=>{n(O),s(Jk(O))},[]),I=b.useCallback(()=>{if(!a||!t)return{};const O={};m&&(O.prompt={append:a.promptAppend}),h&&(O.model=a.model);const F=p.counts.mcp>0,D=p.counts.env>0,W=p.counts.git>0;return F&&(O.mcpServers=a.mcp.filter(L=>L.status!=="deleted").map(L=>L.value)),D&&(O.env=a.env.filter(L=>L.status!=="deleted").map(L=>{const V=L.value;return V.sensitive&&V.value===yc?{key:V.key,value:yc,sensitive:!0}:V})),W&&(O.gitRepos=a.git.filter(L=>L.status!=="deleted").map(L=>L.value)),O},[a,t,m,h,p]);return{draft:o,summary:p,promptDirty:m,modelDirty:h,setPromptAppend:S,revertPrompt:x,setModel:j,revertModel:k,addMcp:w.add,updateMcp:w.update,deleteMcp:w.remove,undoDeleteMcp:w.undo,addEnv:C.add,updateEnv:C.update,deleteEnv:C.remove,undoDeleteEnv:C.undo,addGit:_.add,updateGit:_.update,deleteGit:_.remove,undoDeleteGit:_.undo,resetAll:R,resetToConfig:z,buildPayloadPatch:I}}const tr={overview:"ad-overview",setup:"ad-setup",prompt:ah("prompt"),tools:ah("mcp"),advanced:"ad-advanced",danger:"ad-danger"};function ej(e){return e==="model"?tr.setup:e==="mcp"?tr.tools:e==="env"||e==="git"?tr.advanced:tr.prompt}function RG(e,t){const n=[{key:"overview",label:"Profile",anchor:tr.overview}];return!e&&t&&n.push({key:"setup",label:"Setup",anchor:tr.setup},{key:"prompt",label:"Prompt",anchor:tr.prompt},{key:"tools",label:"Tools",anchor:tr.tools},{key:"advanced",label:"Advanced",anchor:tr.advanced}),t&&n.push({key:"danger",label:"Danger zone",anchor:tr.danger,divider:!0,danger:!0}),n}function OG(){var Gr,bi,ya,xi,Si,wi,ks,zn,yr,ki,ji;const t=wE().uuid??"",n=An(),a=pn(),{memberId:s,role:o}=lt(),c=Ye({queryKey:["agent",t],queryFn:()=>N4(t),enabled:!!t}),f=o$(c.data,s,o),m=((Gr=c.data)==null?void 0:Gr.type)!=="human"&&f,h=Ye({queryKey:["agent-config",t],queryFn:()=>bc(t),enabled:!!t&&m}),p=Ye({queryKey:["agent-client-status",t],queryFn:()=>t$(t),enabled:!!t&&((bi=c.data)==null?void 0:bi.type)!=="human"}),g=Ye({queryKey:["agent-sessions-active",t],queryFn:()=>cC(t,{state:"active"}),enabled:!!t&&((ya=c.data)==null?void 0:ya.type)!=="human"}),S=Ye({queryKey:["clients"],queryFn:pi,enabled:!!t&&m,refetchInterval:3e4}),x=AG(h.data),[j,k]=b.useState(null),[w,C]=b.useState(null),[_,R]=b.useState(null),[z,I]=b.useState(!1),[O,F]=b.useState(!1),D=gt({mutationFn:async()=>{if(!h.data)throw new Error("config not loaded");const ye=x.buildPayloadPatch();return Rh(t,{expectedVersion:h.data.version,payload:ye})},onSuccess:ye=>{a.setQueryData(["agent-config",t],ye),x.resetToConfig(ye),k(null),C(null),F(!0)},onError:ye=>{if(F(!1),ye instanceof al&&ye.status===409){C("Someone else saved a newer version while you were editing."),k(null);return}k(ye instanceof Error?ye.message:String(ye))}});b.useEffect(()=>{if(!O)return;const ye=setTimeout(()=>F(!1),2500);return()=>clearTimeout(ye)},[O]),b.useEffect(()=>{x.summary.anyDirty&&F(!1)},[x.summary.anyDirty]);const W=x.resetToConfig,L=b.useCallback(async()=>{k(null),I(!0);try{const ye=await a.fetchQuery({queryKey:["agent-config",t],queryFn:()=>bc(t),staleTime:0});W(ye)}catch(ye){k(ye instanceof Error?ye.message:String(ye))}finally{I(!1),C(null)}},[a,t,W]),V=b.useCallback(ye=>{const Ge=document.getElementById(ye);Ge&&Ge.scrollIntoView({behavior:"smooth",block:"start"})},[]),Y=gt({mutationFn:ye=>Iy(t,ye),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agents"]})}}),me=gt({mutationFn:()=>oN(t),onMutate:()=>R(null),onSuccess:()=>{R(null),a.invalidateQueries({queryKey:["agent",t]})},onError:ye=>R(ye instanceof Error?ye.message:String(ye))}),te=gt({mutationFn:()=>uN(t),onMutate:()=>R(null),onSuccess:()=>{R(null),a.invalidateQueries({queryKey:["agent",t]})},onError:ye=>R(ye instanceof Error?ye.message:String(ye))}),J=gt({mutationFn:()=>lN(t),onMutate:()=>R(null),onSuccess:()=>n("/team"),onError:ye=>R(ye instanceof Error?ye.message:String(ye))}),q=gt({mutationFn:()=>R4(t)}),[le,ee]=b.useState(!1),[ve,M]=b.useState(""),[P,U]=b.useState(null),[T,G]=b.useState(!1),Z=Ye({queryKey:["clients"],queryFn:pi,enabled:le}),ae=gt({mutationFn:ye=>Iy(t,{clientId:ye}),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agent-client-status",t]}),a.invalidateQueries({queryKey:["agents"]}),ee(!1),M(""),U(null)},onError:ye=>U(ye instanceof Error?ye.message:String(ye))}),[Se,Re]=b.useState(!1),[je,$e]=b.useState(null),Ie=gt({mutationFn:()=>e$(t,x.buildPayloadPatch()),onSuccess:ye=>{const Ge=ye.diff.length?ye.diff.map(ht=>`${ht.op} ${ht.path}`).join(`
|
|
416
|
-
`):"(no changes)";$e(Ge)},onError:ye=>$e(`Dry run failed: ${ye instanceof Error?ye.message:String(ye)}`)});b.useEffect(()=>{if(!x.summary.anyDirty)return;const ye=Ge=>{Ge.preventDefault(),Ge.returnValue=""};return window.addEventListener("beforeunload",ye),()=>window.removeEventListener("beforeunload",ye)},[x.summary.anyDirty]);const Ke=((xi=c.data)==null?void 0:xi.type)==="human",et=b.useMemo(()=>RG(Ke,f),[Ke,f]),wt=b.useRef(null),[K,ge]=b.useState(!1);b.useEffect(()=>{if(Ke)return;const ye=wt.current;if(!ye||typeof IntersectionObserver>"u")return;const Ge=new IntersectionObserver(ht=>{const Fn=ht[0];Fn&&ge(!Fn.isIntersecting&&Fn.boundingClientRect.top<0)},{threshold:0});return Ge.observe(ye),()=>Ge.disconnect()},[Ke]);const[Ce,_e]=b.useState(tr.overview);b.useEffect(()=>{if(typeof IntersectionObserver>"u")return;const ye=[];for(const Ge of et){const ht=document.getElementById(Ge.anchor);if(!ht)continue;const Fn=new IntersectionObserver(Ua=>{for(const Ho of Ua)Ho.isIntersecting&&_e(Ge.anchor)},{rootMargin:"0% 0% -70% 0%",threshold:0});Fn.observe(ht),ye.push(Fn)}return()=>{for(const Ge of ye)Ge.disconnect()}},[et]);const At=b.useMemo(()=>{const ye=new Set;for(const Ge of x.summary.dirtySections)ye.add(ej(Ge));return ye},[x.summary.dirtySections]);if(c.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(c.error)return l.jsxs("div",{className:"-m-6 p-6 text-body",style:{color:"var(--state-error)"},children:["Failed to load agent: ",c.error instanceof Error?c.error.message:"Unknown error"]});const qe=c.data;if(!qe)return l.jsx("div",{className:"-m-6 p-6 text-body",style:{color:"var(--fg-3)"},children:"Agent not found"});const Mn=qe.type==="human",rn=p.data,La=((Si=g.data)==null?void 0:Si.length)??0,an=!Mn&&!rn&&p.isLoading,ma=p.error instanceof Error?p.error.message:p.error?"Unknown":null,ue=!Mn&&p.isSuccess&&!(rn!=null&&rn.clientId),be=!Mn&&rn?!rn.online&&!!rn.clientId:!1,Be=u$({agentStatus:qe.status,clientStatus:rn,clientStatusLoading:an,testPending:q.isPending}),Xe=qe,yt=Xe.runtimeState??null,Nn=Xe.runtimeType??null,pr=Xe.totalSessions??null,Gt=qe.uuid.slice(0,8),Bt=NG({activeSessions:La,isUnclaimed:ue,isOffline:be}),It=x.draft.mcp.filter(ye=>ye.status!=="deleted"),ft=x.draft.env.filter(ye=>ye.status!=="deleted"),gr=x.draft.git.filter(ye=>ye.status!=="deleted"),Un=ye=>new Set(It.filter(Ge=>Ge.key!==ye).map(Ge=>Ge.value.name.toLowerCase())),$o=ye=>new Set(ft.filter(Ge=>Ge.key!==ye).map(Ge=>Ge.value.key)),Ea=ye=>new Set(gr.filter(Ge=>Ge.key!==ye).map(Ge=>{const{value:ht}=Ge;return ht.localPath?ht.localPath:((ht.url.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,"")}).filter(Boolean)),ir={sessions:pr??"—",active:La,runtime:Nn??(Mn?"human":"—"),model:((ks=(wi=h.data)==null?void 0:wi.payload.model)==null?void 0:ks.trim())||"—"},pa=(rn==null?void 0:rn.clientId)??null,Bn=pa?((zn=S.data)==null?void 0:zn.find(ye=>ye.id===pa))??null:null,Pa=pa&&m?(Bn==null?void 0:Bn.hostname)??pa:null,ga=qe.runtimeProvider??"claude-code",Jt=ga==="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(cb,{style:{display:"block",padding:"var(--sp-1) var(--sp-4) var(--sp-2)"},children:"Agent"}),et.map(ye=>l.jsxs("div",{children:[ye.divider&&l.jsx("div",{"aria-hidden":!0,style:{margin:"var(--sp-2) var(--sp-3_5)",borderTop:"var(--hairline) solid var(--border)"}}),l.jsx(zG,{label:ye.label,active:Ce===ye.anchor,danger:ye.danger??!1,dirty:At.has(ye.anchor),onClick:()=>V(ye.anchor)})]},ye.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(n$,{style:{marginBottom:"var(--sp-2)"},children:[l.jsx(r$,{onClick:()=>n("/team"),children:"Agents"}),l.jsx(a$,{}),l.jsx(i$,{mono:!0,children:qe.name??Gt})]}),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(Fc,{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_${Gt}`,children:qe.displayName}),l.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:["@",qe.name??Gt]})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-caption",style:{color:"var(--fg-4)"},children:[l.jsx(dr,{tone:qe.type==="autonomous_agent"?"accent":"neutral",children:qe.type}),qe.visibility&&l.jsx(dr,{tone:qe.visibility==="organization"?"accent":"outline",children:qe.visibility}),(rn==null?void 0:rn.offlineSince)&&l.jsxs("span",{className:"mono",children:["offline since ",fc(rn.offlineSince)]})]})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l.jsx(xc,{state:yt}),l.jsxs(xe,{variant:"ghost",size:"xs",onClick:()=>n(`/?a=${qe.uuid}`),children:[l.jsx(Mv,{className:"h-3 w-3"})," Open chat"]}),!Mn&&f&&qe.status==="active"&&l.jsxs(xe,{variant:"outline",size:"xs",onClick:()=>{q.reset(),q.mutate()},disabled:Be.disabled,title:Be.title,children:[l.jsx(qE,{className:"h-3 w-3"}),q.isPending?"Testing…":"Test"]})]})]}),l.jsxs("div",{className:"grid gap-1.5 mt-3",style:{gridTemplateColumns:"repeat(4, 1fr)"},children:[l.jsx(wf,{label:"sessions",value:ir.sessions}),l.jsx(wf,{label:"active",value:ir.active,accent:typeof ir.active=="number"&&ir.active>0?"var(--accent)":void 0}),l.jsx(wf,{label:"runtime",value:ir.runtime}),l.jsx(wf,{label:"model",value:ir.model})]})]}),l.jsx("div",{ref:wt,"aria-hidden":!0,style:{height:0}}),!Mn&&l.jsx(c$,{runtimeLabel:Jt,computerLabel:Pa,visible:K}),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:[(q.data||q.error)&&l.jsx(BG,{result:q.data??{status:"error",message:"Failed to reach server"},onDismiss:()=>q.reset()}),l.jsx(Wl,{anchorId:tr.overview,title:"Profile",right:f?l.jsxs(xe,{variant:"outline",size:"xs",onClick:()=>n(`/settings/integrations?agent=${qe.uuid}`),title:"Manage platform bindings in Integrations",children:[l.jsx(_y,{className:"h-3 w-3"}),"Manage bindings"]}):null,children:l.jsx(E$,{agent:qe,canEdit:f,onSave:async ye=>{await Y.mutateAsync(ye)}})}),!Mn&&!f&&l.jsx(MG,{}),m&&l.jsxs(l.Fragment,{children:[l.jsxs(Wl,{anchorId:tr.setup,title:"Setup",caption:((yr=h.data)==null?void 0:yr.version)!=null?l.jsxs("span",{className:"mono",children:["config v",h.data.version,x.summary.anyDirty&&l.jsxs(l.Fragment,{children:[" · ",l.jsx("span",{style:{color:"var(--state-blocked)"},children:"draft"})]})]}):null,children:[h.isLoading&&l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading configuration…"}),h.error&&l.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load configuration: ",String(h.error)]}),h.data&&l.jsx(jG,{runtimeProvider:ga,computerLabel:Pa,computerStatusLoading:an,computerStatusError:ma,canBindComputer:ue&&qe.status==="active",bindComputerPending:ae.isPending,onBindComputer:()=>ee(!0),onRebind:qe.clientId?()=>G(!0):void 0,modelSlot:l.jsx(P$,{value:x.draft.model,baseline:((ki=h.data)==null?void 0:ki.payload.model)??"",onChange:x.setModel,onRevert:x.revertModel,disabled:qe.status!=="active",provider:ga})})]}),l.jsx(Wl,{anchorId:tr.prompt,title:"Prompt",children:h.data?l.jsx(fG,{value:x.draft.promptAppend,baseline:((ji=h.data)==null?void 0:ji.payload.prompt.append)??"",onChange:x.setPromptAppend,onRevert:x.revertPrompt,disabled:qe.status!=="active"}):null}),l.jsx(Wl,{anchorId:tr.tools,title:"Tools",caption:"MCP servers available to this agent",children:h.data?l.jsx(_$,{items:x.draft.mcp,otherNames:Un,onAdd:x.addMcp,onUpdate:x.updateMcp,onDelete:x.deleteMcp,onUndoDelete:x.undoDeleteMcp,disabled:qe.status!=="active"}):null}),l.jsx(Wl,{anchorId:tr.advanced,title:"Advanced",caption:"Environment variables and git repositories the runtime clones into each session.",children:h.data&&l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{id:ah("env"),children:l.jsx(y$,{items:x.draft.env,otherKeys:$o,onAdd:x.addEnv,onUpdate:x.updateEnv,onDelete:x.deleteEnv,onUndoDelete:x.undoDeleteEnv,disabled:qe.status!=="active"})}),l.jsx("div",{id:ah("git"),children:l.jsx(S$,{items:x.draft.git,otherPaths:Ea,onAdd:x.addGit,onUpdate:x.updateGit,onDelete:x.deleteGit,onUndoDelete:x.undoDeleteGit,disabled:qe.status!=="active"})}),je&&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:je}),x.summary.anyDirty&&l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)"},children:l.jsx("button",{type:"button",onClick:()=>Ie.mutate(),className:"underline bg-transparent border-0 cursor-pointer",style:{color:"var(--fg-3)"},disabled:Ie.isPending,children:Ie.isPending?"Computing dry-run…":"Preview server-side diff"})})]})})]}),f&&l.jsxs(l.Fragment,{children:[l.jsx(wG,{}),l.jsx(d$,{agent:qe,suspendPending:me.isPending,reactivatePending:te.isPending,deletePending:J.isPending,errorMessage:_,onSuspend:()=>me.mutate(),onReactivate:()=>te.mutate(),onDelete:()=>J.mutate()})]})]}),m&&l.jsx(SG,{summary:x.summary,saveHint:Bt,conflictMessage:w,errorMessage:j,saving:D.isPending,reloadingRemote:z,justSaved:O,onSave:()=>D.mutate(),onDiscard:()=>{x.summary.anyDirty&&Re(!0)},onReloadRemote:()=>{L()},onJumpTo:ye=>V(ej(ye))})]}),l.jsx(DG,{open:Se,onOpenChange:Re,title:"Discard unsaved changes?",description:"Your edits to Prompt / Model / Tools / Advanced will be reverted to the last saved baseline.",confirmLabel:"Discard changes",destructive:!0,onConfirm:()=>{x.resetAll(),k(null),C(null),Re(!1)}}),l.jsx(Rn,{open:le,onOpenChange:ye=>{ee(ye),ye||(M(""),U(null),ae.reset())},children:l.jsxs(Cn,{children:[l.jsx(Pn,{children:l.jsx(On,{children:"Bind computer"})}),l.jsxs("div",{className:"space-y-4",children:[l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Pick a computer you own to pin this agent to. The bind is one-shot — once set, moving the agent requires deleting and re-creating it on the target computer."}),Z.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading computers…"}):Z.error?l.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load computers: ",Z.error instanceof Error?Z.error.message:"Unknown"]}):l.jsx(IG,{clients:Z.data??[],selected:ve,onSelect:M}),P&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:P})]}),l.jsxs(mr,{children:[l.jsx(xe,{variant:"outline",onClick:()=>ee(!1),children:"Cancel"}),l.jsx(xe,{disabled:!ve||ae.isPending,onClick:()=>{U(null),ae.mutate(ve)},children:ae.isPending?"Binding…":"Bind"})]})]})}),l.jsx(pG,{open:T,onOpenChange:G,agent:qe})]})}function MG(){return l.jsx(Wl,{anchorId:"ad-runtime-readonly",title:"Runtime configuration",children:l.jsx("div",{className:"text-body",style:{padding:"var(--sp-3)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-panel)",background:"var(--bg-raised)",color:"var(--fg-3)"},children:"You can view this shared agent profile. Runtime configuration, bindings, testing, and lifecycle controls are limited to the agent manager or an organization admin."})})}function zG({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 DG(e){return l.jsx(Rn,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(Cn,{children:[l.jsx(Pn,{children:l.jsx(On,{children:e.title})}),l.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),l.jsxs(mr,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(xe,{type:"button",variant:e.destructive?"destructive":"default",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function IG({clients:e,selected:t,onSelect:n}){const a=e.filter(ik);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 connect <token>"})," 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;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:ik(s)?"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 LG={success:"Connected",timeout:"Timed out",offline:"Offline",stale:"Stale",error:"Error"},PG={success:"var(--state-idle)",timeout:"var(--state-blocked)",offline:"var(--state-offline)",stale:"var(--state-blocked)",error:"var(--state-error)"},UG={success:"accent",timeout:"warn",stale:"warn",error:"error",offline:"neutral"};function BG({result:e,onDismiss:t}){const n=PG[e.status],a=UG[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(dr,{tone:a,children:LG[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(xe,{variant:"ghost",size:"sm",onClick:t,children:"Dismiss"})]})})}function FG(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 $G(){return this.eachAfter(FG)}function HG(e,t){let n=-1;for(const a of this)e.call(t,a,++n,this);return this}function qG(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 ZG(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 GG(e,t){let n=-1;for(const a of this)if(e.call(t,a,++n,this))return a}function VG(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 QG(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function KG(e){for(var t=this,n=YG(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 YG(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 XG(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function WG(){return Array.from(this)}function JG(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function eV(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*tV(){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 ET(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=aV)):t===void 0&&(t=rV);for(var n=new _o(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 _o(c[f])),o.parent=a,o.depth=a.depth+1;return n.eachBefore(CT)}function nV(){return ET(this).eachBefore(iV)}function rV(e){return e.children}function aV(e){return Array.isArray(e)?e[1]:null}function iV(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function CT(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function _o(e){this.data=e,this.depth=this.height=0,this.parent=null}_o.prototype=ET.prototype={constructor:_o,count:$G,each:HG,eachAfter:ZG,eachBefore:qG,find:GG,sum:VG,sort:QG,path:KG,ancestors:XG,descendants:WG,leaves:JG,links:eV,copy:nV,[Symbol.iterator]:tV};function Ug(e){return e==null?null:sV(e)}function sV(e){if(typeof e!="function")throw new Error;return e}var lV={depth:-1},tj={},Bg={};function oV(e){return e.id}function uV(e){return e.parentId}function cV(){var e=oV,t=uV,n;function a(s){var o=Array.from(s),c=e,f=t,m,h,p,g,S,x,j,k,w=new Map;if(n!=null){const C=o.map((z,I)=>dV(n(z,I,s))),_=C.map(nj),R=new Set(C).add("");for(const z of _)R.has(z)||(R.add(z),C.push(z),_.push(nj(z)),o.push(Bg));c=(z,I)=>C[I],f=(z,I)=>_[I]}for(p=0,m=o.length;p<m;++p)h=o[p],x=o[p]=new _o(h),(j=c(h,p,s))!=null&&(j+="")&&(k=x.id=j,w.set(k,w.has(k)?tj:x)),(j=f(h,p,s))!=null&&(j+="")&&(x.parent=j);for(p=0;p<m;++p)if(x=o[p],j=x.parent){if(S=w.get(j),!S)throw new Error("missing: "+j);if(S===tj)throw new Error("ambiguous: "+j);S.children?S.children.push(x):S.children=[x],x.parent=S}else{if(g)throw new Error("multiple roots");g=x}if(!g)throw new Error("no root");if(n!=null){for(;g.data===Bg&&g.children.length===1;)g=g.children[0],--m;for(let C=o.length-1;C>=0&&(x=o[C],x.data===Bg);--C)x.data=null}if(g.parent=lV,g.eachBefore(function(C){C.depth=C.parent.depth+1,--m}).eachBefore(CT),g.parent=null,m>0)throw new Error("cycle");return g}return a.id=function(s){return arguments.length?(e=Ug(s),a):e},a.parentId=function(s){return arguments.length?(t=Ug(s),a):t},a.path=function(s){return arguments.length?(n=Ug(s),a):n},a}function dV(e){e=`${e}`;let t=e.length;return rv(e,t-1)&&!rv(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function nj(e){let t=e.length;if(t<2)return"";for(;--t>1&&!rv(e,t););return e.slice(0,t)}function rv(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if((n&1)===0)return!0}return!1}function fV(e,t){return e.parent===t.parent?1:2}function Fg(e){var t=e.children;return t?t[0]:e.t}function $g(e){var t=e.children;return t?t[t.length-1]:e.t}function hV(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 mV(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 pV(e,t,n){return e.a.parent===t.parent?e.a:n}function Bf(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}Bf.prototype=Object.create(_o.prototype);function gV(e){for(var t=new Bf(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 Bf(o[c],c)),s.parent=n;return(t.parent=new Bf(null,0)).children=[t],t}function yV(){var e=fV,t=1,n=1,a=null;function s(h){var p=gV(h);if(p.eachAfter(o),p.parent.m=-p.z,p.eachBefore(c),a)h.eachBefore(m);else{var g=h,S=h,x=h;h.eachBefore(function(_){_.x<g.x&&(g=_),_.x>S.x&&(S=_),_.depth>x.depth&&(x=_)});var j=g===S?1:e(g,S)/2,k=j-g.x,w=t/(S.x+j+k),C=n/(x.depth||1);h.eachBefore(function(_){_.x=(_.x+k)*w,_.y=_.depth*C})}return h}function o(h){var p=h.children,g=h.parent.children,S=h.i?g[h.i-1]:null;if(p){mV(h);var x=(p[0].z+p[p.length-1].z)/2;S?(h.z=S.z+e(h._,S._),h.m=h.z-x):h.z=x}else S&&(h.z=S.z+e(h._,S._));h.parent.A=f(h,S,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 S=h,x=h,j=p,k=S.parent.children[0],w=S.m,C=x.m,_=j.m,R=k.m,z;j=$g(j),S=Fg(S),j&&S;)k=Fg(k),x=$g(x),x.a=h,z=j.z+_-S.z-w+e(j._,S._),z>0&&(hV(pV(j,h,g),h,z),w+=z,C+=z),_+=j.m,w+=S.m,R+=k.m,C+=x.m;j&&!$g(x)&&(x.t=j,x.m+=_-C),S&&!Fg(k)&&(k.t=S,k.m+=w-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 vV(e,t){const n=`?window=${encodeURIComponent(t)}`;return Ee.get(ky(e,`/context-tree/snapshot${n}`))}function ih({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 ul({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 NT=[{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 bV({previewSnapshot:e}={}){const{organizationId:t}=lt(),[n,a]=b.useState("7d"),[s,o]=b.useState(null),[c,f]=b.useState(null),m=e!==void 0,h=Ye({queryKey:["context-tree-snapshot",t,n,m],queryFn:()=>{if(!t)throw new Error("No organization selected");return vV(t,n)},enabled:!m&&!!t}),p=e??h.data,g=b.useMemo(()=>p?p.updates.find(j=>j.id===s)??p.updates[0]??null:null,[s,p]),S=b.useMemo(()=>p&&g!=null&&g.nodeId?p.nodes.find(j=>j.id===g.nodeId)??null:null,[g,p]),x=c??(g==null?void 0:g.nodeId)??(S==null?void 0:S.id)??null;return b.useEffect(()=>{var j;p&&(s&&p.updates.some(k=>k.id===s)||o(((j=p.updates[0])==null?void 0:j.id)??null))},[s,p]),l.jsxs(l.Fragment,{children:[l.jsx(ul,{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(TV,{}):null,!m&&h.error?l.jsx(AV,{message:h.error instanceof Error?h.error.message:"Failed to load"}):null,p&&(m||!h.isLoading)?p.snapshotStatus==="unavailable"?l.jsx(TT,{snapshot:p}):l.jsxs(l.Fragment,{children:[l.jsx(xV,{snapshot:p}),l.jsx(SV,{snapshot:p,window:n,onWindowChange:a}),l.jsx(wV,{snapshot:p,selectedUpdate:g,selectedUpdateNode:S,selectedOverviewNodeId:x,onSelectUpdate:j=>{o(j.id),f(j.nodeId)},onSelectOverviewNode:f})]}):null]})]})}function xV({snapshot:e}){const t=e.contextStatus.severity==="ok"?l.jsx(k3,{size:18}):l.jsx(zo,{size:18}),n=e.contextStatus.label,a=qV(e);return l.jsx(jn,{children:l.jsx(rr,{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:HV(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 SV({snapshot:e,window:t,onWindowChange:n}){const a=$V(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"}),NT.map(s=>l.jsx(ih,{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(Nf,{value:e.summary.changedNodeCount,label:`updates in the ${a}`}),l.jsx(Nf,{value:e.summary.addedCount,label:"added",tone:"added"}),l.jsx(Nf,{value:e.summary.editedCount,label:"edited",tone:"edited"}),l.jsx(Nf,{value:e.summary.removedCount,label:"removed",tone:"removed"})]})]})}function wV({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(jn,{className:"flex h-full flex-col",style:{maxHeight:"min(52vh, 30rem)"},children:[l.jsx(fa,{children:l.jsx(ha,{children:"Context Updates"})}),l.jsx(rr,{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(AT,{})}):e.updates.map((f,m)=>l.jsx(kV,{update:f,selected:f.id===(t==null?void 0:t.id),isLast:m===e.updates.length-1,onClick:()=>s(f)},f.id))})]}),l.jsx(jV,{update:t,node:n,snapshot:e},(t==null?void 0:t.id)??"empty")]}),l.jsx(EV,{snapshot:e,selectedNodeId:a,onSelectNode:c})]})}function kV({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(_T,{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:QV(e)})]}),l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["In ",OT(e.path)," · ",eQ(e.owners),e.relatedNodeIds.length>0?` · ${tQ(e.relatedNodeIds.length)}`:""]})]})})})}function jV({update:e,node:t,snapshot:n}){const[a,s]=b.useState(!1),o=t==null?void 0:t.relatedNodeIds.map(g=>n.nodes.find(S=>S.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?JV(e.owners):"No owner",h=o&&o.length>0?o.map(g=>g.title||g.path||"root"):[],p=e?nQ(e.path)||OT(e.path):"root";return l.jsxs(jn,{className:"flex h-full flex-col",style:{maxHeight:"min(52vh, 30rem)"},children:[l.jsxs(fa,{children:[l.jsx(ha,{children:"Selected Change"}),e?l.jsx(_T,{type:e.changeType}):null]}),l.jsx(rr,{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:[KV(e)," · ",GV(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(NV,{value:YV(e),impact:VV(e)}),l.jsx(_V,{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(AT,{})})]})}function EV({snapshot:e,selectedNodeId:t,onSelectNode:n}){const[a,s]=b.useState(()=>new Set),o=b.useMemo(()=>FV(e.nodes),[e.nodes]),c=b.useMemo(()=>zV(e.nodes,t,o,a),[t,e.nodes,o,a]),f=b.useRef(null),m=b.useCallback(w=>{if(!w)return;const C=f.current;if(!C)return;const _=w.getBoundingClientRect(),R=C.getBoundingClientRect();if(_.top>=R.top&&_.bottom<=R.bottom)return;const z=_.top-R.top-(R.height-_.height)/2;C.scrollBy({top:z})},[]),h=b.useCallback(w=>{s(C=>{const _=new Set(C);return _.has(w)?_.delete(w):_.add(w),_})},[]),p=Math.max(760,...c.map(w=>w.x+280)),g=Math.max(280,...c.map(w=>w.y+48)),S=g+24,x=560,j=S>x,k=PV(e.nodes,t);return l.jsxs(jn,{children:[l.jsx(fa,{children:l.jsxs("div",{children:[l.jsxs(ha,{children:[l.jsx(z3,{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(rr,{children:c.length===0?l.jsx(TT,{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(Gu,{color:"var(--accent)",label:"Selected path"}),l.jsx(Gu,{color:"var(--ok)",label:"Added"}),l.jsx(Gu,{color:"var(--warn)",label:"Edited"}),l.jsx(Gu,{color:"var(--danger)",label:"Removed"}),l.jsx(Gu,{color:"var(--bg-raised)",label:"Quiet"})]})]}),l.jsx("div",{ref:f,style:{overflow:j?"auto":"hidden",maxHeight:j?`${x}px`:void 0,minHeight:`${Math.min(S,x)}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:`${S}px`},children:[c.map(w=>!w.parent||w.isSummary&&w.isExpanded?null:l.jsx("line",{x1:w.parent.x,y1:w.parent.y,x2:w.x,y2:w.y,stroke:w.selectedPath&&w.parent.selectedPath?"var(--accent)":"var(--border)",strokeOpacity:w.muted?.34:w.selectedPath?.72:.56,strokeWidth:w.selectedPath&&w.parent.selectedPath?1.6:1},`edge:${w.id}`)),c.map(w=>{const C=w.isSummary||w.sourceNodeId!==null,_=()=>{w.isSummary&&w.parentId?h(w.parentId):w.sourceNodeId&&n(w.sourceNodeId)};return l.jsx("foreignObject",{x:w.x-10,y:w.y-15,width:p-w.x-8,height:30,children:l.jsxs("button",{ref:w.selected?m:void 0,type:"button",disabled:!C,"aria-expanded":w.isSummary?w.isExpanded:void 0,onClick:_,className:"flex w-full items-center text-left text-label transition-colors",style:{background:"transparent",color:w.muted?"var(--fg-3)":"var(--fg)",cursor:C?"pointer":"default",gap:"var(--sp-2)",opacity:w.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:[w.isSummary?l.jsx(FE,{size:12,style:{color:"var(--fg-4)",flex:"0 0 auto",transform:w.isExpanded?"rotate(90deg)":void 0,transition:"transform 120ms"}}):l.jsx("span",{"aria-hidden":"true",style:{width:w.selected?"var(--sp-4)":"var(--sp-3)",height:w.selected?"var(--sp-4)":"var(--sp-3)",borderRadius:"50%",background:rQ(w),border:`${w.selected?"var(--hairline-bold)":"var(--hairline)"} solid ${w.selected?"var(--accent)":aQ(w)}`,flex:"0 0 auto"}}),l.jsx("span",{className:w.selectedPath?"font-semibold":"font-medium",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w.title}),w.updateCount>0&&!w.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:w.updateCount}):null]})},w.id)})]})})]})})]})}function Gu({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 Nf({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?Ph(n):"var(--fg)"},children:e}),l.jsx("span",{children:t})]})}function CV({label:e,tone:t,strong:n}){return l.jsx("span",{className:`text-label ${n?"font-semibold":"font-medium"}`,style:{color:t?Ph(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 _T({type:e}){return l.jsx(CV,{label:ZV(e),tone:e})}function NV({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 _V({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(xe,{variant:"outline",size:"xs",onClick:c,children:o?"Hide source":"Preview source"}),l.jsxs(xe,{variant:"ghost",size:"xs",onClick:()=>void navigator.clipboard.writeText(e),children:[l.jsx(Rv,{size:14}),"Copy path"]})]}),o?l.jsx("div",{style:{marginTop:"var(--sp-3)"},children:s?l.jsx(Lh,{children:s}):l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No source preview available."})}):null]})}function TV(){return l.jsx(jn,{children:l.jsx(rr,{children:l.jsxs("div",{className:"flex items-center text-body",style:{color:"var(--fg-2)",gap:"var(--sp-2)"},children:[l.jsx(W3,{size:17}),"Loading team context..."]})})})}function AV({message:e}){return l.jsx(jn,{children:l.jsx(rr,{children:l.jsxs("div",{className:"flex items-center text-body",style:{color:"var(--danger)",gap:"var(--sp-2)"},children:[l.jsx(zo,{size:17}),e]})})})}function TT({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?RV(e.repo):null;return l.jsx(jn,{children:l.jsx(rr,{children:l.jsxs("div",{className:"flex items-start text-body",style:{color:"var(--fg-2)",gap:"var(--sp-2)"},children:[l.jsx(zo,{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 RV(e){return e.replace(/(https?:\/\/)[^/@\s]+@/g,"$1[redacted]@")}function AT(){return l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No context updates in this time window."})}const OV=1,MV=3;function zV(e,t,n,a){const s=DV(e,t,n,a);if(s.length===0)return[];const o=cV().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=yV().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,S)=>({...p,parent:p.parentId?S.find(x=>x.id===p.parentId)??null:null}))}function DV(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,w)=>k.path.localeCompare(w.path));if(o.length===0)return[];const c=IV(o),f=LV(t,s),m=new Set,h=new Map;for(const k of o){const w=RT(k,s,h),C=n.get(k.id)??0;(w<=OV||f.has(k.id)||C>0&&w<=MV)&&UV(k.id,s,m)}let p=!0;for(;p;){p=!1;for(const k of[...m]){const w=(c.get(k)??[]).filter(C=>!m.has(C.id));if(w.length===1){const C=w[0];C&&(m.add(C.id),p=!0)}}}const g=new Set(m);for(const k of a)if(g.has(k))for(const w of c.get(k)??[])g.add(w.id);const S=f.size>0,x=o.filter(k=>g.has(k.id)).map(k=>{const w=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:w,isSummary:!1,isExpanded:!1,selected:t===k.id,selectedPath:C,muted:S&&!C&&w===0}}),j=[];for(const k of o){if(!g.has(k.id))continue;const w=(c.get(k.id)??[]).filter(R=>!m.has(R.id));if(w.length===0)continue;const C=a.has(k.id),_=w.filter(R=>(n.get(R.id)??0)>0).length;j.push({id:`summary:${k.id}`,parentId:k.id,sourceNodeId:null,title:C?"Show less":BV(w.length,_),path:`${k.path}/~summary`,changeType:null,updateCount:_,isSummary:!0,isExpanded:C,selected:!1,selectedPath:f.has(k.id),muted:S&&!f.has(k.id)})}return[...x,...j]}function IV(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 LV(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 PV(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 UV(e,t,n){let a=t.get(e);for(;a;)n.add(a.id),a=a.parentId?t.get(a.parentId):void 0}function RT(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?RT(s,t,n)+1:0;return n.set(e.id,o),o}function BV(e,t){return t>0?`Show ${e} more · ${t} changed`:`Show ${e} more`}function FV(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 $V(e){var t;return((t=NT.find(n=>n.value===e))==null?void 0:t.summary)??"last 7 days"}function HV(e){return e==="ok"?"var(--ok)":e==="warning"?"var(--warn)":"var(--danger)"}function qV(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 ZV(e){return e==="added"?"New":e==="removed"?"Removed":"Updated"}function GV(e){return e==="added"?"New knowledge":e==="removed"?"Removed knowledge":"Updated knowledge"}function VV(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 QV(e){const t=e.changedBy??"Someone",n=e.changeType==="added"?"added":e.changeType==="removed"?"removed":"updated";return`${t} ${n} ${e.title}`}function KV(e){const t=e.changedBy??"Someone";return`${e.changeType==="added"?"Added":e.changeType==="removed"?"Removed":"Updated"} by ${t}`}function YV(e){const t=e.changedBy??"Someone",n=e.changeType==="added"?"added":e.changeType==="removed"?"removed":"updated",a=WV(e);return a?`${t} ${n} ${e.title}: ${a}`:`${t} ${n} ${e.title}.`}function XV(e){return e.summary.replace(/^updated:\s*/i,"")}function WV(e){const t=XV(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 JV(e){return e.length===0?"No owner":e.length===1?e[0]??"No owner":e.join(", ")}function eQ(e){return e.length===0?"Owner not set":e.length===1?`Owner: ${e[0]??"Unknown"}`:`Owners: ${e.join(", ")}`}function tQ(e){return`${e} linked context${e===1?"":"s"}`}function nQ(e){const t=e.split("/").filter(Boolean);return t.length<=1?null:t.slice(0,-1).map(MT).join(" / ")}function OT(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 Ph(e){return e==="added"?"var(--ok)":e==="edited"?"var(--warn)":"var(--danger)"}function rQ(e){return e.isSummary?"var(--bg-sunken)":e.selected?"var(--accent)":e.changeType?Ph(e.changeType):e.updateCount>0?"var(--accent-bg)":"var(--bg-raised)"}function aQ(e){return e.changeType?Ph(e.changeType):"var(--border-strong)"}const Po=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}));Po.displayName="Card";const Uo=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("flex flex-col space-y-1.5 p-6",e),...t}));Uo.displayName="CardHeader";const Gc=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("text-subtitle leading-none",e),...t}));Gc.displayName="CardTitle";const zT=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("text-body text-muted-foreground",e),...t}));zT.displayName="CardDescription";const Bo=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("p-6 pt-0",e),...t}));Bo.displayName="CardContent";const iQ=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:ze("flex items-center p-6 pt-0",e),...t}));iQ.displayName="CardFooter";function sQ(){const{token:e}=wE(),t=An(),{isAuthenticated:n,adoptTokens:a}=lt(),[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 w=await fetch(`/api/v1/invitations/${encodeURIComponent(e)}/preview`);if(!w.ok){f("This invitation is no longer valid");return}o(await w.json())}catch{f("Network error while loading invitation")}})()},[e]),b.useEffect(()=>{n&&(async()=>{try{const w=await Ee.get("/me/organizations"),C=await Ee.get("/me"),_=w.find(R=>R.id===C.member.organizationId);g((_==null?void 0:_.displayName)??null)}catch{}})()},[n]),!e)return l.jsx(rj,{message:"Bad invitation URL"});if(c)return l.jsx(rj,{message:"This invitation is no longer valid"});if(!s)return l.jsx(lQ,{});const S=async()=>{h(!0);try{const w=await Ee.post("/me/organizations/join",{token:e});await a(w.tokens),zE("invite"),t("/",{replace:!0})}catch(w){f(w instanceof Error?w.message:"Failed to join team")}finally{h(!1)}},x=`/api/v1/auth/github/start?next=${encodeURIComponent(`/invite/${e}`)}`,j=n&&p&&p!==s.organizationDisplayName,k=oQ(s.expiresAt);return l.jsx(Rb,{children:l.jsxs(Po,{className:"w-full max-w-sm",children:[l.jsx(Uo,{className:"text-center",children:l.jsxs(Gc,{className:"text-title",children:["You're invited to join",l.jsx("br",{}),s.organizationDisplayName]})}),l.jsxs(Bo,{className:"space-y-4",children:[j&&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(zo,{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(xe,{className:"w-full",disabled:m,onClick:S,children:m?"Joining…":`Join ${s.organizationDisplayName}`}):l.jsx(xe,{asChild:!0,className:"w-full",children:l.jsxs("a",{href:x,children:[l.jsx(HE,{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 Rb({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(Lc,{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(Tv,{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 lQ(){return l.jsx(Rb,{children:l.jsxs(Po,{className:"w-full max-w-sm",children:[l.jsxs(Uo,{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(Bo,{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 rj({message:e}){return l.jsx(Rb,{children:l.jsxs(Po,{className:"w-full max-w-sm",children:[l.jsxs(Uo,{className:"text-center",children:[l.jsx("div",{className:"mb-2 flex justify-center text-fg-3",children:l.jsx(zo,{className:"h-6 w-6"})}),l.jsx(Gc,{className:"text-title",children:e})]}),l.jsxs(Bo,{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(xe,{asChild:!0,variant:"outline",className:"w-full",children:l.jsxs(Lc,{to:"/",children:[l.jsx(Tv,{className:"h-3.5 w-3.5"}),"Back to home"]})})]})]})})}function oQ(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 uQ(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=qN(s);return o===ek&&s!==ek?null:o}function cQ(){const{isAuthenticated:e}=lt(),t=Ar(),n=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),a=uQ(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(Jn,{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(Lc,{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(Tv,{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(Po,{className:"w-full max-w-sm",children:[l.jsxs(Uo,{className:"text-center",children:[l.jsx("div",{className:"mb-2 flex justify-center text-foreground",children:l.jsx(Fc,{width:28,height:32})}),l.jsxs(Gc,{className:"text-title",children:["First Tree ",l.jsx("span",{className:"font-normal text-muted-foreground",children:"Hub"})]})]}),l.jsxs(Bo,{className:"space-y-4",children:[l.jsx(xe,{asChild:!0,className:"w-full",children:l.jsxs("a",{href:s,children:[l.jsx(HE,{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(xe,{asChild:!0,variant:"outline",className:"w-full",children:l.jsxs("a",{href:o,children:[l.jsx(dz,{className:"h-4 w-4"}),"Dev: skip GitHub"]})})]})]})]})})]})}function dQ(){const e=An(),{adoptTokens:t}=lt(),[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=qN(o.get("next")),h=o.get("joinPath");if(!c||!f){a("Sign-in did not complete. Please try again.");return}(h==="solo"||h==="invite")&&zE(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 kc=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}));kc.displayName="DenseTable";const jc=b.forwardRef(({className:e,...t},n)=>l.jsx("thead",{ref:n,className:e,...t}));jc.displayName="DenseTableHeader";const Ec=b.forwardRef(({className:e,...t},n)=>l.jsx("tbody",{ref:n,className:e,...t}));Ec.displayName="DenseTableBody";const Tr=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}));Tr.displayName="DenseTableRow";const Qt=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}));Qt.displayName="DenseTableHead";const it=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}));it.displayName="DenseTableCell";const fQ=1500;function hQ({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),fQ))},S=t!==void 0?Math.max(1,Math.round(t/60)):null,x=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,S!==null&&l.jsxs("span",{style:{color:"var(--fg-4)"},children:[" # expires in ",S,"m"]})]}):"Generating token…"}),j=l.jsxs(xe,{type:"button",variant:"outline",size:"sm",onClick:g,disabled:!e,style:{alignSelf:"flex-start"},children:[h?l.jsx(fr,{className:"h-3.5 w-3.5"}):l.jsx(Rv,{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:[x,j]}):l.jsxs(l.Fragment,{children:[x,j]}),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(mQ,{}),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(fr,{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 mQ(){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 pQ=3e3,gQ=1200;function yQ({open:e,onOpenChange:t}){const n=pn(),{user:a}=lt(),[s,o]=b.useState("loading"),[c,f]=b.useState(null),[m,h]=b.useState(null),[p,g]=b.useState(null),S=b.useRef(new Set);return b.useEffect(()=>{if(!e){o("loading"),f(null),h(null),g(null),S.current=new Set;return}let x=!1;const j=(n.getQueryData(["clients"])??[]).map(k=>k.id);return S.current=new Set(j),(async()=>{try{const k=await aD();if(x)return;f(k),o("waiting")}catch(k){if(x)return;h(k instanceof Error?k.message:"Failed to generate connect token"),o("error")}})(),()=>{x=!0}},[e,n]),b.useEffect(()=>{if(!e||s!=="waiting"||!a)return;const j=setInterval(async()=>{try{const k=await n.fetchQuery({queryKey:["clients"],queryFn:pi}),w=S.current,C=k.find(_=>!w.has(_.id)&&_.status==="connected"&&_.userId===a.id);C&&(g(C.hostname??null),o("success"))}catch{}},pQ);return()=>clearInterval(j)},[e,s,n,a]),b.useEffect(()=>{if(s!=="success")return;const x=setTimeout(()=>{n.invalidateQueries({queryKey:["clients"]}),t(!1)},gQ);return()=>clearTimeout(x)},[s,t,n]),l.jsx(Rn,{open:e,onOpenChange:t,children:l.jsxs(Cn,{children:[l.jsxs(Pn,{children:[l.jsx(On,{children:"Connect computer"}),l.jsx(qv,{children:"Run this command on the machine you want to pair with this Hub."})]}),l.jsx(hQ,{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(xe,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"})})]})})}function vQ({embedded:e=!1}={}){const t=pn(),n=xh(),{role:a,user:s}=lt(),o=a==="admin",[c,f]=b.useState(()=>new Set),[m,h]=b.useState(null),[p,g]=b.useState(null),[S,x]=b.useState(null),[j,k]=b.useState(!1),w=Ye({queryKey:["clients","org"],queryFn:nD,enabled:o,refetchInterval:1e4}),C=Ye({queryKey:["clients","me"],queryFn:pi,enabled:!o||w.isError,refetchInterval:1e4}),_=Ye({queryKey:["members"],queryFn:fb,enabled:o,staleTime:6e4}),R=o&&!w.isError,z=o&&w.isError,I=R?w.data:C.data,{data:O}=Ye({queryKey:["activity"],queryFn:Pc,refetchInterval:1e4}),F=gt({mutationFn:rD,onSuccess:()=>{h(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})}}),D=gt({mutationFn:tD,onSuccess:()=>{g(null),x(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})},onError:ee=>{ee instanceof al?x(ee.message):x(ee instanceof Error?ee.message:String(ee))}}),W=b.useMemo(()=>{const ee=new Map;for(const ve of(O==null?void 0:O.agents)??[]){if(!ve.clientId)continue;const M=ee.get(ve.clientId)??[];M.push(ve),ee.set(ve.clientId,M)}return ee},[O==null?void 0:O.agents]),L=ee=>W.get(ee)??[],V=b.useMemo(()=>!R||!w.data||!s?[]:[...w.data].filter(ee=>ee.userId===s.id).sort((ee,ve)=>ee.lastSeenAt>ve.lastSeenAt?-1:ee.lastSeenAt<ve.lastSeenAt?1:0),[R,w.data,s]),Y=b.useMemo(()=>!R||!w.data||!s?[]:[...w.data].filter(ee=>ee.userId!==s.id).sort((ee,ve)=>ee.lastSeenAt>ve.lastSeenAt?-1:ee.lastSeenAt<ve.lastSeenAt?1:0),[R,w.data,s]),me=b.useMemo(()=>{const ee=new Map;for(const ve of _.data??[])ee.set(ve.userId,ve.displayName);return ee},[_.data]),te=ee=>{if(ee.userId===null)return{text:"—"};if(ee.userId===(s==null?void 0:s.id)){const M=me.get(ee.userId);return{text:M?`${M} (you)`:"you"}}const ve=me.get(ee.userId);return ve?{text:ve}:{text:ee.userId.slice(0,8),title:ee.userId}},J=(I??[]).filter(ee=>ee.status==="connected").length,q=(I??[]).reduce((ee,ve)=>ee+ve.agentCount,0),le=(I??[]).filter(ee=>ee.authState!=="ok").length;return l.jsxs("div",{className:e?"":"-m-6",children:[l.jsx(ul,{title:"Computers",subtitle:I&&I.length>0?l.jsxs(l.Fragment,{children:[I.length," total · ",J," connected · ",q," agents bound",le>0&&l.jsxs(l.Fragment,{children:[" · ",l.jsxs("span",{style:{color:"var(--state-error)"},children:[le," need re-auth"]})]})]}):null,right:l.jsx("div",{className:"flex items-center gap-1.5",children:l.jsxs(xe,{size:"xs",onClick:()=>k(!0),children:[l.jsx(ka,{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(yQ,{open:j,onOpenChange:k}),p&&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:p.hostname??p.id.slice(0,8)}),". Retire refuses if any agent is still pinned to this computer — you must delete those agents first (reassign is not available in this milestone)."]}),L(p.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:L(p.id).map(ee=>l.jsx("li",{className:"font-medium",children:n(ee.agentId)},ee.agentId))})]}),S&&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:S}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(xe,{variant:"outline",size:"sm",onClick:()=>{g(null),x(null)},children:"Cancel"}),l.jsx(xe,{variant:"destructive",size:"sm",onClick:()=>D.mutate(p.id),disabled:D.isPending,children:D.isPending?"Retiring…":"Retire"})]})]})}),m&&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:m.hostname??m.id.slice(0,8)})," ","and affect all bound agents:"]}),l.jsx("ul",{className:"mb-4 space-y-1",children:L(m.id).length===0?l.jsx("li",{className:"text-body",style:{color:"var(--fg-3)"},children:"No bound agents"}):L(m.id).map(ee=>l.jsxs("li",{className:"text-body flex items-center gap-2",children:[l.jsx("span",{className:"font-medium",children:n(ee.agentId)}),l.jsx(xc,{state:ee.runtimeState})]},ee.agentId))}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(xe,{variant:"outline",size:"sm",onClick:()=>h(null),children:"Cancel"}),l.jsx(xe,{variant:"destructive",size:"sm",onClick:()=>F.mutate(m.id),disabled:F.isPending,children:F.isPending?"Disconnecting…":"Disconnect"})]})]})}),!I||I.length===0?l.jsxs(jn,{children:[z&&l.jsx(ij,{}),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(jn,{children:[z&&l.jsx(ij,{}),l.jsxs(Zy,{children:["Registered · ",I.length]}),l.jsxs(kc,{children:[l.jsx(jc,{children:l.jsxs(Tr,{children:[l.jsx(Qt,{style:{width:16}}),l.jsx(Qt,{children:"Hostname"}),R&&l.jsx(Qt,{children:"Owner"}),l.jsx(Qt,{children:"OS"}),l.jsx(Qt,{children:"SDK"}),l.jsx(Qt,{children:"Agents"}),l.jsx(Qt,{children:"Connected"}),l.jsx(Qt,{children:"Status"}),l.jsx(Qt,{"aria-hidden":!0})]})}),l.jsx(Ec,{children:R?l.jsxs(l.Fragment,{children:[l.jsx(sj,{icon:Iv,title:"Your computers",count:V.length,colSpan:tc}),V.length===0?l.jsx(lj,{colSpan:tc,message:"No computers of your own."}):V.map(ee=>{const ve=!c.has(ee.id),M=L(ee.id);return l.jsx(Hg,{client:ee,boundAgents:M,isExpanded:ve,agentName:n,onToggle:()=>f(P=>{const U=new Set(P);return U.has(ee.id)?U.delete(ee.id):U.add(ee.id),U}),onDisconnect:()=>h(ee),onRetire:()=>{x(null),g(ee)},onReconnect:()=>k(!0),showOwner:!0,ownerLabel:te(ee)},ee.id)}),l.jsx(sj,{icon:GE,title:"Team computers",count:Y.length,colSpan:tc}),Y.length===0?l.jsx(lj,{colSpan:tc,message:"No other team computers."}):Y.map(ee=>{const ve=!c.has(ee.id),M=L(ee.id);return l.jsx(Hg,{client:ee,boundAgents:M,isExpanded:ve,agentName:n,onToggle:()=>f(P=>{const U=new Set(P);return U.has(ee.id)?U.delete(ee.id):U.add(ee.id),U}),onDisconnect:()=>{},onRetire:()=>{},onReconnect:()=>{},showOwner:!0,ownerLabel:te(ee),restricted:!0},ee.id)})]}):I.map(ee=>{const ve=!c.has(ee.id),M=L(ee.id);return l.jsx(Hg,{client:ee,boundAgents:M,isExpanded:ve,agentName:n,onToggle:()=>f(P=>{const U=new Set(P);return U.has(ee.id)?U.delete(ee.id):U.add(ee.id),U}),onDisconnect:()=>h(ee),onRetire:()=>{x(null),g(ee)},onReconnect:()=>k(!0)},ee.id)})})]})]})]})]})}const bQ={"claude-code":"Claude Code",codex:"Codex"},xQ=[Wf.CLAUDE_CODE,Wf.CODEX],aj={"claude-code":"Run `npm install -g @anthropic-ai/claude-code` on this computer.",codex:"Install the OpenAI Codex CLI on this computer."},SQ={"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 wQ({clientId:e,enabled:t}){const{data:n,isLoading:a}=Ye({queryKey:["client-capabilities",e],queryFn:()=>ph(e),enabled:t}),s=(n==null?void 0:n.capabilities)??null;return l.jsxs(l.Fragment,{children:[l.jsx(cb,{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:xQ.map(o=>l.jsx(kQ,{provider:o,entry:s?s[o]??null:null},o))})]})}function kQ({provider:e,entry:t}){const n=bQ[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 · ",aj[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 ·"," ",SQ[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 · ",aj[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 jQ(){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"]})}const DT=8,tc=DT+1;function ij(){return l.jsx("div",{className:"text-body",style:{margin:"var(--sp-3) var(--sp-3) 0",padding:"var(--sp-2_5) var(--sp-3)",borderRadius:"var(--radius-panel)",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:"Failed to load team computers. Showing only your computers."})}function sj({icon:e,title:t,count:n,colSpan:a}){return l.jsx(Tr,{children:l.jsx("td",{colSpan:a,style:{padding:"var(--sp-6) var(--sp-3_5) var(--sp-2) 0"},children:l.jsxs("span",{className:"inline-flex items-center",style:{gap:"var(--sp-2)"},children:[l.jsx(e,{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:t}),l.jsx(dr,{tone:"outline",children:n})]})})})}function lj({colSpan:e,message:t}){return l.jsx(Tr,{children:l.jsx("td",{colSpan:e,className:"text-body",style:{padding:"var(--sp-3) var(--sp-3_5)",color:"var(--fg-4)"},children:t})})}function Hg({client:e,boundAgents:t,isExpanded:n,agentName:a,onToggle:s,onDisconnect:o,onRetire:c,onReconnect:f,showOwner:m=!1,ownerLabel:h,restricted:p=!1}){const g=m?tc:DT,S=e.status!=="connected",x=p?!1:n,j=e.authState!=="ok",k=e.status==="connected"?"idle":"offline";return l.jsxs(l.Fragment,{children:[l.jsxs(Tr,{interactive:!p,selected:x,onClick:p?void 0:s,children:[l.jsx(it,{style:{width:16},children:p?null:l.jsx("span",{style:{color:"var(--fg-4)",display:"inline-flex"},children:x?l.jsx(Av,{className:"h-3.5 w-3.5"}):l.jsx(FE,{className:"h-3.5 w-3.5"})})}),l.jsx(it,{className:"font-medium",children:e.hostname??"—"}),m&&l.jsx(it,{style:{color:"var(--fg-3)"},title:h==null?void 0:h.title,children:(h==null?void 0:h.text)??"—"}),l.jsx(it,{style:{color:"var(--fg-3)"},children:e.os??"—"}),l.jsx(it,{className:"mono text-label",style:{color:"var(--fg-3)"},children:e.sdkVersion??"—"}),l.jsx(it,{children:l.jsx("span",{className:"mono tnum text-label",children:e.agentCount})}),l.jsx(it,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:e.connectedAt?fc(e.connectedAt):"—"}),l.jsx(it,{children:j?l.jsx(jQ,{}):l.jsx(xc,{state:k})}),l.jsx(it,{style:{width:1,whiteSpace:"nowrap"},children:p?null:l.jsxs("div",{className:"flex items-center justify-end text-label",style:{gap:"var(--sp-3_5)"},children:[S&&l.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:j?"var(--state-error)":"var(--fg-2)"},onClick:w=>{w.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:w=>{w.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:w=>{w.stopPropagation(),c()},children:"Retire"})]})})]}),x&&l.jsxs("tr",{style:{background:"var(--bg-sunken)"},children:[l.jsx(it,{}),l.jsxs(it,{colSpan:g-1,style:{padding:"var(--sp-2_5) var(--sp-3) var(--sp-3_5)"},children:[l.jsx(wQ,{clientId:e.id,enabled:x}),t.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs(cb,{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(w=>l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:a(w.agentId)}),l.jsx(xc,{state:w.runtimeState}),w.activeSessions!==null&&l.jsxs("span",{className:"mono tnum text-caption",style:{color:"var(--fg-3)"},children:[w.activeSessions," / ",w.totalSessions??0," sessions"]})]},w.agentId))})]})]})]})]})}function EQ(){return l.jsx(vQ,{embedded:!0})}async function CQ(e){try{return await Ee.get(`/orgs/${e}/github-app-installation`)}catch(t){if(t instanceof al&&t.status===404)return null;throw t}}async function NQ(e){const{installUrl:t}=await Ee.get(`/orgs/${e}/github-app-installation/install-url`);return t}function Vc({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 _Q({isFirst:e=!1}){const{organizationId:t}=lt(),n=Ye({queryKey:["github-app-installation",t],queryFn:()=>t?CQ(t):Promise.reject(new Error("no org")),enabled:!!t});return l.jsx(Vc,{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(TQ,{organizationId:t}):l.jsx(AQ,{data:n.data})})}function TQ({organizationId:e}){const t=gt({mutationFn:()=>{if(!e)throw new Error("No organization selected");return NQ(e)},onSuccess:o=>{window.location.assign(o)}}),n=t.error instanceof al&&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(Ov,{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 AQ({data:e}){const t=e.accountType==="Organization"?v3:Iv,n=Object.entries(e.permissions);return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[e.suspended&&l.jsx(RQ,{}),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(Ov,{className:"h-3 w-3"})]}),l.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)"},children:["Installation #",e.installationId]})]})]})}function RQ(){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(E3,{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 OQ(){const{role:e}=lt();return e===null?l.jsx("div",{className:"text-body",style:{padding:"var(--sp-5)",color:"var(--fg-3)"},children:"Loading..."}):e!=="admin"?l.jsx(Jn,{to:"/settings/computers",replace:!0}):l.jsxs(l.Fragment,{children:[l.jsx(ul,{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(_Q,{isFirst:!0})})]})}function MQ(){return Ee.get(gn("/adapter-mappings"))}function zQ(e){return Ee.post(gn("/adapter-mappings"),e)}function DQ(e){return Ee.delete(`/adapter-mappings/${e}`)}function IQ(){return Ee.get(gn("/adapters/status"))}function LQ(){return Ee.get(gn("/adapters"))}function PQ(e){return Ee.post(gn("/adapters"),e)}function UQ(e,t){return Ee.patch(`/adapters/${e}`,t)}function BQ(e){return Ee.delete(`/adapters/${e}`)}const FQ=Object.values(eB),oj={platform:"feishu",feishuAppId:"",feishuAppSecret:"",credentialsJson:"{}",status:"active",externalUserId:"",displayName:"",kaelUserId:"",kaelProjectId:""};function uj(e){const[t,n]=b.useState(oj),[a,s]=b.useState("");b.useEffect(()=>{e.open&&(n({...oj,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=$Q(t);if(!e.editingId&&!m){s("Credentials are required");return}if(e.editingId)e.onSubmit({kind:"bot-update",status:t.status,...m?{credentials:m}:{}});else{if(!m)return;e.onSubmit({kind:"bot-create",draft:{platform:t.platform,status:t.status,credentials:m}})}}const c=e.kind==="user"?`Bind external user → ${e.agentLabel}`:e.editingId?`Edit bot binding · ${e.agentLabel}`:`Bind bot → ${e.agentLabel}`;return l.jsx(Rn,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(Cn,{children:[l.jsx(Pn,{children:l.jsx(On,{children:c})}),l.jsxs("form",{onSubmit:o,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{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:FQ.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(St,{htmlFor:"binding-ext-id",children:"External user ID"}),l.jsx(qt,{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(St,{htmlFor:"binding-name",children:"Display name (optional)"}),l.jsx(qt,{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(St,{htmlFor:"feishu-app-id",children:["App ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(qt,{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(St,{htmlFor:"feishu-app-secret",children:["App Secret",e.editingId?" — leave empty to keep existing":""]}),l.jsx(qt,{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(St,{htmlFor:"kael-user-id",children:["User ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(qt,{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(St,{htmlFor:"kael-project-id",children:["Project ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(qt,{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(St,{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(St,{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(mr,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(xe,{type:"submit",disabled:e.pending,children:e.pending?"Saving…":e.editingId?"Update":"Create"})]})]})]})})}function $Q(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 HQ(){var T;const e=An(),t=pn(),[n,a]=fh(),s=n.get("agent"),o=xh(),c=Ye({queryKey:["adapters"],queryFn:LQ}),f=Ye({queryKey:["adapter-mappings"],queryFn:MQ}),m=Ye({queryKey:["adapter-statuses"],queryFn:IQ,refetchInterval:15e3}),p=((T=Ye({queryKey:["agents","name-map"],queryFn:()=>Bc({limit:100}),staleTime:3e4}).data)==null?void 0:T.items)??[],g=b.useMemo(()=>{const G=new Map;for(const Z of m.data??[])G.set(Z.configId,Z);return G},[m.data]),S=b.useMemo(()=>{const G=c.data??[];return s?G.filter(Z=>Z.agentId===s):G},[c.data,s]),x=b.useMemo(()=>{const G=f.data??[];return s?G.filter(Z=>Z.agentId===s):G},[f.data,s]),j=S.reduce((G,Z)=>{var ae;return G+((ae=g.get(Z.id))!=null&&ae.connected?1:0)},0),k=S.length-j,w=c.isLoading||f.isLoading,[C,_]=b.useState(null),[R,z]=b.useState(""),[I,O]=b.useState(null),[F,D]=b.useState(null),[W,L]=b.useState(null),[V,Y]=b.useState(null),me=gt({mutationFn:G=>PQ({platform:G.platform,agentId:G.agentId,credentials:G.credentials,status:G.status}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),O(null)}}),te=gt({mutationFn:G=>{const Z={status:G.status};return G.credentials&&(Z.credentials=G.credentials),UQ(G.id,Z)},onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),O(null)}}),J=gt({mutationFn:BQ,onSuccess:()=>t.invalidateQueries({queryKey:["adapters"]})}),q=gt({mutationFn:G=>zQ({platform:G.platform,externalUserId:G.externalUserId,agentId:G.agentId,boundVia:"manual",displayName:G.displayName??void 0}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapter-mappings"]}),D(null)}}),le=gt({mutationFn:DQ,onSuccess:()=>t.invalidateQueries({queryKey:["adapter-mappings"]})});function ee(G){if(s){G==="bot"?O({agentId:s,editingId:null}):D({agentId:s});return}z(""),_({kind:G})}function ve(){!C||!R||(C.kind==="bot"?O({agentId:R,editingId:null}):D({agentId:R}),_(null))}function M(G){if(I){if(G.kind==="bot-create")me.mutate({agentId:I.agentId,platform:G.draft.platform,status:G.draft.status,credentials:G.draft.credentials});else if(G.kind==="bot-update"){if(!I.editingId)return;te.mutate({id:I.editingId,status:G.status,credentials:G.credentials})}}}function P(G){!F||G.kind!=="user-create"||q.mutate({agentId:F.agentId,platform:G.draft.platform,externalUserId:G.draft.externalUserId,displayName:G.draft.displayName})}const U=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:[(U==null?void 0:U.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(ms,{className:"h-3 w-3"})})]})]}),l.jsxs(jn,{className:"mb-3.5",children:[l.jsxs(Zy,{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(ac,{state:"idle",size:6})," ",j," online"]}),l.jsxs("span",{className:"mono inline-flex items-center gap-1",style:{color:"var(--fg-4)"},children:[l.jsx(ac,{state:"offline",size:6})," ",k," offline"]})]}),l.jsxs(xe,{size:"xs",variant:"outline",onClick:()=>ee("bot"),children:[l.jsx(ka,{className:"h-3 w-3"})," Bot binding"]})]}),children:["Bot bindings · ",S.length]}),w?l.jsx(_f,{children:"Loading…"}):S.length?l.jsxs(kc,{children:[l.jsx(jc,{children:l.jsxs(Tr,{children:[l.jsx(Qt,{children:"Agent"}),l.jsx(Qt,{children:"Platform"}),l.jsx(Qt,{children:"Status"}),l.jsx(Qt,{children:"Connection"}),l.jsx(Qt,{children:"Created"}),l.jsx(Qt,{style:{width:96,textAlign:"right"}})]})}),l.jsx(Ec,{children:S.map(G=>{var ae;const Z=((ae=g.get(G.id))==null?void 0:ae.connected)??!1;return l.jsxs(Tr,{interactive:!0,onClick:()=>e(`/agents/${G.agentId}`),children:[l.jsx(it,{children:l.jsx("span",{className:"mono font-medium",children:o(G.agentId)})}),l.jsx(it,{children:l.jsx(dr,{children:G.platform})}),l.jsx(it,{children:l.jsx(dr,{tone:G.status==="active"?"accent":"outline",children:G.status})}),l.jsx(it,{children:l.jsxs("span",{className:"inline-flex items-center gap-1.5 text-label",children:[l.jsx(ac,{state:Z?"idle":"offline",size:7}),l.jsx("span",{style:{color:"var(--fg-3)"},children:Z?"Online":"Offline"})]})}),l.jsx(it,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:fc(G.createdAt)}),l.jsxs(it,{style:{textAlign:"right",whiteSpace:"nowrap"},onClick:Se=>Se.stopPropagation(),children:[l.jsx(xe,{variant:"ghost",size:"xs",className:"text-label",onClick:()=>O({agentId:G.agentId,editingId:G.id,initialPlatform:qQ(G.platform),initialStatus:ZQ(G.status)}),children:"Edit"}),l.jsx(xe,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>L(G.id),disabled:J.isPending,title:"Delete",children:l.jsx(qf,{className:"h-3.5 w-3.5"})})]})]},G.id)})})]}):l.jsx(_f,{children:s?"No bot bindings for this agent yet.":"No bot bindings"})]}),l.jsxs(jn,{children:[l.jsxs(Zy,{right:l.jsxs(xe,{size:"xs",variant:"outline",onClick:()=>ee("user"),children:[l.jsx(ka,{className:"h-3 w-3"})," User binding"]}),children:["User bindings · ",x.length]}),w?l.jsx(_f,{children:"Loading…"}):x.length?l.jsxs(kc,{children:[l.jsx(jc,{children:l.jsxs(Tr,{children:[l.jsx(Qt,{children:"Agent"}),l.jsx(Qt,{children:"Platform"}),l.jsx(Qt,{children:"External user ID"}),l.jsx(Qt,{children:"Display name"}),l.jsx(Qt,{children:"Bound via"}),l.jsx(Qt,{children:"Created"}),l.jsx(Qt,{style:{width:32}})]})}),l.jsx(Ec,{children:x.map(G=>l.jsxs(Tr,{interactive:!0,onClick:()=>e(`/agents/${G.agentId}`),children:[l.jsx(it,{children:l.jsx("span",{className:"mono font-medium",style:{color:"var(--accent-dim)"},children:o(G.agentId)})}),l.jsx(it,{children:l.jsx(dr,{children:G.platform})}),l.jsx(it,{children:l.jsx("span",{className:"mono text-label",style:{color:"var(--fg-2)"},children:G.externalUserId})}),l.jsx(it,{style:{color:"var(--fg-2)"},children:G.displayName??"—"}),l.jsx(it,{children:l.jsx(dr,{tone:"outline",children:G.boundVia??"—"})}),l.jsx(it,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:fc(G.createdAt)}),l.jsx(it,{onClick:Z=>Z.stopPropagation(),children:l.jsx(xe,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>Y(G.id),disabled:le.isPending,title:"Delete",children:l.jsx(qf,{className:"h-3.5 w-3.5"})})})]},G.id))})]}):l.jsx(_f,{children:s?"No user bindings for this agent yet.":"No user bindings"})]}),l.jsx(GQ,{open:C!=null,kind:(C==null?void 0:C.kind)??"bot",agents:p,agentId:R,onAgentChange:z,onCancel:()=>_(null),onConfirm:ve}),l.jsx(uj,{open:I!=null,kind:"bot",editingId:(I==null?void 0:I.editingId)??null,initialPlatform:I==null?void 0:I.initialPlatform,initialStatus:I==null?void 0:I.initialStatus,agentLabel:I?o(I.agentId):"",pending:me.isPending||te.isPending,errorMessage:(me.error??te.error)instanceof Error?(me.error??te.error).message:null,onOpenChange:G=>{G||(O(null),me.reset(),te.reset())},onSubmit:M}),l.jsx(uj,{open:F!=null,kind:"user",editingId:null,agentLabel:F?o(F.agentId):"",pending:q.isPending,errorMessage:q.error instanceof Error?q.error.message:null,onOpenChange:G=>{G||(D(null),q.reset())},onSubmit:P}),l.jsx(cj,{open:W!=null,onOpenChange:G=>!G&&L(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:J.isPending,onConfirm:()=>{W!=null&&(J.mutate(W),L(null))}}),l.jsx(cj,{open:V!=null,onOpenChange:G=>!G&&Y(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:le.isPending,onConfirm:()=>{V!=null&&(le.mutate(V),Y(null))}})]})}function qQ(e){return e==="feishu"||e==="slack"||e==="kael"?e:"feishu"}function ZQ(e){return e==="inactive"?"inactive":"active"}function _f({children:e}){return l.jsx("div",{className:"text-center py-6 text-body",style:{color:"var(--fg-3)"},children:e})}function GQ(e){const t=e.kind==="user"?e.agents.filter(n=>n.type==="human"&&n.status==="active"):e.agents.filter(n=>n.type!=="human"&&n.status==="active");return l.jsx(Rn,{open:e.open,onOpenChange:n=>!n&&e.onCancel(),children:l.jsxs(Cn,{children:[l.jsx(Pn,{children:l.jsx(On,{children:e.kind==="bot"?"Bind a bot":"Bind an external user"})}),l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Pick the agent this binding routes to."}),l.jsxs("select",{value:e.agentId,onChange:n=>e.onAgentChange(n.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"",children:"Select an agent…"}),t.map(n=>l.jsxs("option",{value:n.uuid,children:[n.displayName," ",n.name?`(@${n.name})`:""]},n.uuid))]})]}),l.jsxs(mr,{children:[l.jsx(xe,{variant:"ghost",onClick:e.onCancel,children:"Cancel"}),l.jsx(xe,{onClick:e.onConfirm,disabled:!e.agentId,children:"Continue"})]})]})})}function cj(e){return l.jsx(Rn,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(Cn,{children:[l.jsx(Pn,{children:l.jsx(On,{children:e.title})}),l.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),l.jsxs(mr,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(xe,{type:"button",variant:"destructive",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function VQ({embedded:e=!1}={}){return l.jsxs("div",{className:e?"":"-m-6",children:[l.jsx(ul,{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(HQ,{})})]})}function QQ(){return l.jsx(VQ,{embedded:!0})}function KQ(){const{onboardingStep:e,onboardingDismissedAt:t,onboardingCompletedAt:n,dismissOnboarding:a,restoreOnboarding:s}=lt();if(n)return l.jsx(Jn,{to:"/settings/team",replace:!0});const o=!!t,c=e==="completed";return l.jsxs(l.Fragment,{children:[l.jsx(ul,{title:"Onboarding",subtitle:"Guided setup controls"}),l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:l.jsx(Vc,{title:"Onboarding guide",description:o?"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:o?null:l.jsx(YQ,{}),isFirst:!0,children:o?l.jsx(xe,{type:"button",size:"sm",onClick:()=>void s(),children:"Resume onboarding"}):l.jsx(xe,{type:"button",size:"sm",variant:"outline",onClick:()=>void a(),disabled:!c,title:c?void 0:"Finish setting up your agent first",children:"Hide onboarding guide"})})})]})}function YQ(){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(fr,{className:"h-3 w-3"}),"Active"]})}function XQ(){const{role:e,onboardingCompletedAt:t}=lt(),n=e==="admin",a=t!==null;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(Vu,{to:"/settings/team",label:"Team"}),l.jsx(Vu,{to:"/settings/computers",label:"Computers"}),n&&l.jsx(Vu,{to:"/settings/github",label:"GitHub"}),l.jsx(Vu,{to:"/settings/integrations",label:"Messaging"}),!a&&l.jsx(Vu,{to:"/settings/onboarding",label:"Onboarding"})]}),l.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:l.jsx(Hf,{})})]})}function Vu({to:e,label:t}){return l.jsx(Ev,{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 av(e){return e.normalize("NFKD").replace(new RegExp("\\p{M}+","gu"),"").toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+|[-_]+$/g,"").slice(0,ro)}const qg=200;function WQ(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 JQ(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+/,"").slice(0,ro)}function IT(e){return e==="claude-code"||e==="codex"?e:null}function eK(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=IT(a);if(o)return o}return null}function tK(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function nK(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 rK({open:e,onOpenChange:t,onCreated:n}){const a=pn(),{refreshMe:s,organizationId:o}=lt(),[c,f]=b.useState(""),[m,h]=b.useState(""),[p,g]=b.useState(!1),[S,x]=b.useState("private"),[j,k]=b.useState("claude-code"),[w,C]=b.useState(!1),[_,R]=b.useState([]),[z,I]=b.useState(!1),[O,F]=b.useState(null),[D,W]=b.useState(null),[L,V]=b.useState(null),[Y,me]=b.useState(null),[te,J]=b.useState(null),[q,le]=b.useState(null),[ee,ve]=b.useState(!1),[M,P]=b.useState({}),[U,T]=b.useState({status:"idle"});b.useEffect(()=>{e&&(f(""),h(""),g(!1),x("private"),k("claude-code"),C(!1),R([]),I(!1),F(null),W(null),V(null),me(null),J(null),le(null),ve(!1),P({}),T({status:"idle"}))},[e]),b.useEffect(()=>{p||h(av(c))},[c,p]);const G=b.useRef(0);b.useEffect(()=>{if(!e||!m){T({status:"idle"});return}if(!Fy.test(m)){T({status:"bad",reason:"invalid"});return}if($y(m)){T({status:"bad",reason:"reserved"});return}const K=++G.current;T({status:"checking"});const ge=window.setTimeout(()=>{T4(m).then(Ce=>{K===G.current&&(Ce.available?T({status:"ok"}):T({status:"bad",reason:Ce.reason}))}).catch(()=>{K===G.current&&T({status:"idle"})})},300);return()=>window.clearTimeout(ge)},[m,e]),b.useEffect(()=>{if(!e)return;let K=!1;const ge=async()=>{try{const _e=await pi();if(K)return;const At=_e.filter(qe=>qe.status==="connected").sort((qe,Mn)=>Mn.lastSeenAt.localeCompare(qe.lastSeenAt));R(At),I(!0)}catch{K||I(!0)}};ge();const Ce=window.setInterval(ge,3e3);return()=>{K=!0,window.clearInterval(Ce)}},[e]),b.useEffect(()=>{if(_.length===0){F(null);return}F(K=>{var ge;return K&&_.some(Ce=>Ce.id===K)?K:((ge=_[0])==null?void 0:ge.id)??null})},[_]),b.useEffect(()=>{if(!O){W(null),V(null);return}let K=!1;const ge=async()=>{try{const _e=await ph(O);if(K)return;W(_e.capabilities),V(O)}catch{}};ge();const Ce=window.setInterval(ge,3e3);return()=>{K=!0,window.clearInterval(Ce)}},[O]),b.useEffect(()=>{if(!e||_.length>0)return;if(Y&&q&&q>Date.now()){const ge=Math.max(q-Date.now(),0),Ce=window.setTimeout(()=>{me(null),le(null)},ge);return()=>window.clearTimeout(Ce)}Y&&(me(null),J(null),le(null));let K=!1;return(async()=>{try{const ge=await Ee.post("/me/connect-tokens",{});if(K)return;me(ge.token),J(ge.command),le(Date.now()+ge.expiresIn*1e3)}catch{}})(),()=>{K=!0}},[e,_.length,Y,q]);const Z=O&&L===O?D:null,ae=b.useMemo(()=>{if(!Z)return[];const K=[];for(const[ge,Ce]of Object.entries(Z)){if(Ce.state!=="ok")continue;const _e=IT(ge);_e&&K.push(_e)}return K},[Z]);b.useEffect(()=>{Z&&k(K=>{var ge;return((ge=Z[K])==null?void 0:ge.state)==="ok"?K:eK(Z)??K})},[Z]);const Se=gt({mutationFn:async K=>{const ge=c.trim()||m.trim()||"Untitled assistant";return _4({name:m||void 0,type:"personal_assistant",displayName:ge,clientId:K.clientId,runtimeProvider:j,visibility:S,...o?{organizationId:o}:{}})},onSuccess:K=>{a.invalidateQueries({queryKey:["agents"]}),a.invalidateQueries({queryKey:["activity"]}),s(),n(K,j)}}),Re=b.useMemo(()=>{const K=Se.error;if(!K)return{};if(K instanceof al){const ge=WQ(K.issues);return Object.keys(ge).length>0?ge:K.status===409?{name:"That agent name is already in use in this organization. Pick a different one."}:{_root:K.message}}return K instanceof Error?{_root:K.message}:{}},[Se.error]),je=U.status==="bad"?nK(U.reason):void 0,$e={...je?{name:je}:{},...Re,...M};function Ie(){const K={};return m?m.length>ro?K.name=`Agent name must be at most ${ro} characters (got ${m.length}).`:Fy.test(m)?$y(m)&&(K.name="That agent name is reserved — pick a different one."):K.name="Agent name must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_).":c.trim().length>0&&(K.name="Agent name must contain at least one letter or digit (e.g. a-z, 0-9)."),c.length>qg&&(K.displayName=`Display name must be at most ${qg} characters (got ${c.length}).`),K}function Ke(K){K.preventDefault();const ge=Ie();P(ge),!(Object.keys(ge).length>0)&&U.status!=="bad"&&O&&(ae.length===0||!ae.includes(j)||Se.mutate({clientId:O}))}const et=U.status==="bad",wt=c.trim().length>0&&!et&&!Se.isPending&&!!O&&ae.length>0&&ae.includes(j);return l.jsx(Rn,{open:e,onOpenChange:t,children:l.jsxs(Cn,{className:"max-w-lg",children:[l.jsx(Pn,{children:l.jsx(On,{children:"New Agent"})}),l.jsxs("form",{onSubmit:Ke,className:"space-y-5 min-w-0",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{htmlFor:"new-agent-display-name",children:"Display name"}),l.jsx(qt,{id:"new-agent-display-name",value:c,onChange:K=>{f(K.target.value),M.displayName&&P(ge=>({...ge,displayName:void 0}))},placeholder:"My Dev Assistant",autoFocus:!0,maxLength:qg,"aria-invalid":$e.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."}),$e.displayName&&l.jsx("p",{id:"new-agent-display-name-error",className:"text-caption text-destructive",children:$e.displayName}),!w&&(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"})]}),!w&&$e.name&&l.jsx("p",{className:"text-caption text-destructive",children:$e.name})]}),w&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[l.jsx(St,{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(qt,{id:"new-agent-name",value:m,autoFocus:!0,onChange:K=>{const ge=JQ(K.target.value);h(ge),g(!0),M.name&&P(Ce=>({...Ce,name:void 0}))},onBlur:K=>{const ge=av(K.target.value);ge!==m&&h(ge)},placeholder:"my-dev-assistant",className:"rounded-l-none font-mono",maxLength:ro,"aria-invalid":$e.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"," ",ro," characters. Permanent after creation."]}),m&&!$e.name&&U.status!=="idle"&&l.jsxs("p",{id:"new-agent-name-status",className:"text-caption",style:{color:U.status==="ok"?"var(--state-idle)":U.status==="checking"?"var(--fg-3)":"var(--fg-4)"},children:[U.status==="checking"&&"Checking availability…",U.status==="ok"&&"Available."]}),$e.name&&l.jsx("p",{id:"new-agent-name-error",className:"text-caption text-destructive",children:$e.name})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{children:"Visibility"}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{className:S==="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:S==="organization",onChange:()=>x("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:S==="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:S==="private",onChange:()=>x("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(St,{children:"Where it runs"}),z?_.length===0?l.jsx(aK,{command:te,copied:ee,onCopy:async()=>{te&&(await navigator.clipboard.writeText(te),ve(!0),window.setTimeout(()=>ve(!1),1500))}}):_.length===1?l.jsx(iK,{client:_[0]}):l.jsx("div",{className:"space-y-2",children:_.map(K=>{const ge=O===K.id;return l.jsxs("label",{className:ge?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"picked-client",checked:ge,onChange:()=>F(K.id),className:"mt-1"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-body font-medium truncate",children:K.hostname??K.id}),l.jsxs("div",{className:"text-caption text-muted-foreground",children:[K.os??"unknown OS"," · last seen ",new Date(K.lastSeenAt).toLocaleString()]})]})]},K.id)})}):l.jsx(sK,{label:"Detecting connected computers…"}),(O||!z)&&l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("div",{className:"text-caption text-muted-foreground",children:"Powered by"}),!O||Z===null?l.jsx(lK,{}):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(K=>{const ge=j===K;return l.jsxs("label",{className:ge?"inline-flex items-center gap-2 rounded-md border border-primary bg-primary/5 px-3 py-1.5 cursor-pointer":"inline-flex items-center gap-2 rounded-md border border-border px-3 py-1.5 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"runtime",checked:ge,onChange:()=>k(K)}),l.jsx("span",{className:"text-body",children:tK(K)})]},K)})})]}),$e.clientId&&l.jsx("p",{className:"text-caption text-destructive",children:$e.clientId})]}),$e._root&&l.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:$e._root}),l.jsx(mr,{children:l.jsx(xe,{type:"submit",disabled:!wt,children:Se.isPending?"Creating…":"Create"})})]})]})})}function aK({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 iK({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 sK({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 lK(){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 oK(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 uK(){const{organizationId:e}=lt(),[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(ky(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(ky(e,"/invitations/rotate"));n(p)}catch(p){s(p instanceof Error?p.message:"Failed to rotate invite link")}finally{c(!1)}}};return l.jsxs(Po,{children:[l.jsxs(Uo,{children:[l.jsx(Gc,{children:"Invite link"}),l.jsxs(zT,{children:["Anyone with this link can join your team as a member. Links expire after ",nF," days; rotating revokes the old link instantly and resets the timer."]})]}),l.jsxs(Bo,{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(xe,{size:"sm",variant:"outline",onClick:()=>{navigator.clipboard.writeText(t.inviteUrl),m(!0),setTimeout(()=>m(!1),1500)},children:f?"Copied!":"Copy"}),l.jsx(xe,{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?` · ${oK(t.expiresAt)}`:" · no expiry"]})]}):l.jsx("p",{className:"text-label text-muted-foreground",children:"Loading…"})]})]})}function Ob({actions:e,ariaLabel:t,triggerClassName:n,icon:a=_3}){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=S=>{m.current&&!m.current.contains(S.target)&&o(!1)},g=S=>{S.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,S=h.current.getBoundingClientRect(),x=window.innerHeight-S.bottom,j=e.length*p+g;f(x>=j?"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 Mb=[{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 _r(e,t){return e?{...t,borderBottom:0}:t}function cK({groups:e,runtimeMap:t,clientHostMap:n,onAgentClick:a,getHumanActions:s,getAgentActions:o}){return l.jsxs(kc,{className:"table-fixed",children:[l.jsx(jc,{children:l.jsx(Tr,{children:Mb.map(c=>l.jsx(Qt,{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(dK,{group:c,runtimeMap:t,clientHostMap:n,onAgentClick:a,getHumanActions:s,getAgentActions:o},c.key))]})}function dK({group:e,runtimeMap:t,clientHostMap:n,onAgentClick:a,getHumanActions:s,getAgentActions:o}){const[c,f]=b.useState(!e.collapsible);return l.jsxs(Ec,{children:[l.jsx(hK,{group:e,open:c,onToggle:()=>f(m=>!m)}),c&&e.rows.length===0&&e.emptyMessage&&l.jsx(Tr,{children:l.jsx(it,{colSpan:Mb.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(mK,{row:m,actions:s(m),isLast:p},`h:${m.id}`):l.jsx(gK,{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 fK(e){switch(e){case"humans":return Iv;case"yours":case"team":return BE;case"other-private":return mh;default:return null}}function hK({group:e,open:t,onToggle:n}){const a=fK(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(dr,{tone:"outline",children:e.count})]});return l.jsx(Tr,{children:l.jsx("td",{colSpan:Mb.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 mK({row:e,actions:t,isLast:n}){return l.jsxs(Tr,{children:[l.jsx(it,{style:_r(n,{paddingLeft:"var(--sp-6)"}),children:l.jsx(LT,{displayName:e.displayName,handle:`@${e.username}`,selfTag:e.isSelf})}),l.jsx(it,{style:_r(n),children:l.jsx(pK,{row:e})}),l.jsx(it,{className:"text-label",style:_r(n,{color:"var(--fg-4)"}),children:"—"}),l.jsx(it,{className:"text-label",style:_r(n,{color:"var(--fg-4)"}),children:"—"}),l.jsx(it,{className:"text-label",style:_r(n,{color:"var(--fg-4)"}),children:"—"}),l.jsx(it,{className:"mono text-caption",style:_r(n,{color:"var(--fg-4)"}),children:uC(e.createdAt)}),l.jsx(it,{style:_r(n,{padding:0,textAlign:"right"}),children:l.jsx(Ob,{actions:t,ariaLabel:`Actions for ${e.displayName}`})})]})}function pK({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(y_,{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 gK({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(Tr,{interactive:!0,onClick:s,children:[l.jsx(it,{style:_r(o,{paddingLeft:"var(--sp-6)"}),children:l.jsx(LT,{displayName:c.displayName,handle:c.name?`@${c.name}`:null,visibility:h?c.visibility:null})}),l.jsx(it,{className:"text-label",style:_r(o,{color:"var(--fg-4)"}),children:"—"}),l.jsx(it,{className:"text-label",style:_r(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(it,{className:"mono text-caption",style:_r(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(it,{style:_r(o),children:l.jsx(xc,{state:(t==null?void 0:t.runtimeState)??null})}),l.jsx(it,{className:"mono text-caption",style:_r(o,{color:"var(--fg-4)"}),children:uC(c.createdAt)}),l.jsx(it,{style:_r(o,{padding:0,textAlign:"right"}),onClick:p=>p.stopPropagation(),children:l.jsx(Ob,{actions:a,ariaLabel:`Actions for ${c.displayName}`})})]})}function LT({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(yK,{visibility:a})]}),t&&l.jsx("div",{className:"mono text-caption truncate",style:{color:"var(--fg-4)"},title:t,children:t})]})}function yK({visibility:e}){return e==="private"?l.jsxs(dr,{tone:"outline",title:"Private — only you can see this agent",className:"shrink-0",children:[l.jsx(mh,{className:"h-2.5 w-2.5","aria-hidden":!0,style:{marginRight:3}}),"Private"]}):l.jsxs(dr,{tone:"accent",title:"Shared — anyone in the team can @mention this agent",className:"shrink-0",children:[l.jsx(GE,{className:"h-2.5 w-2.5","aria-hidden":!0,style:{marginRight:3}}),"Shared"]})}const dj=100,fj=100;async function vK(e){const t=[];let n;for(let a=0;a<fj;a++){const s=await e(n?{limit:dj,cursor:n}:{limit:dj});if(t.push(...s.items),!s.nextCursor)return t;n=s.nextCursor}throw new Error(`fetchAllAgents exceeded ${fj} pages; server cursor pagination may be broken`)}function bK(){const{role:e,memberId:t}=lt(),n=e==="admin",a=An(),s=pn(),o=v_(),[c,f]=b.useState(!1),[m,h]=b.useState(!1),[p,g]=b.useState(null),[S,x]=b.useState(null),[j,k]=b.useState("all"),[w,C]=b.useState(""),_=Ye({queryKey:["members"],queryFn:fb}),R=Ye({queryKey:["agents","team-page",n?"admin":"member"],queryFn:()=>vK(Z=>n?C4(Z):Bc(Z))}),{data:z}=Ye({queryKey:["activity"],queryFn:Pc,refetchInterval:1e4}),I=b.useMemo(()=>{const Z=new Map;for(const ae of(z==null?void 0:z.agents)??[])Z.set(ae.agentId,ae);return Z},[z==null?void 0:z.agents]),{data:O}=Ye({queryKey:["clients","team-page"],queryFn:pi,staleTime:3e4}),F=b.useMemo(()=>{const Z=new Map;for(const ae of O??[])ae.hostname&&Z.set(ae.id,ae.hostname);return Z},[O]),D=b.useMemo(()=>_.data??[],[_.data]),W=b.useMemo(()=>R.data??[],[R.data]),L=b.useMemo(()=>{const Z=new Map;for(const ae of W)Z.set(ae.uuid,ae);return Z},[W]),V=b.useMemo(()=>W.filter(Z=>Z.type!=="human"),[W]),Y=b.useMemo(()=>V.filter(Z=>Z.managerId===t),[V,t]),me=b.useMemo(()=>V.filter(Z=>Z.visibility==="organization"&&Z.managerId!==t),[V,t]),te=b.useMemo(()=>V.filter(Z=>Z.visibility==="private"&&Z.managerId!==t),[V,t]),J=gt({mutationFn:async Z=>k$(Z.id,Z.patch),onSuccess:()=>s.invalidateQueries({queryKey:["members"]})}),q=gt({mutationFn:j$,onSuccess:()=>{s.invalidateQueries({queryKey:["members"]}),s.invalidateQueries({queryKey:["agents"]})}}),le=gt({mutationFn:lN,onSuccess:()=>{s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}}),ee=gt({mutationFn:oN,onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),ve=gt({mutationFn:uN,onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),M=gt({mutationFn:async Z=>Iy(Z.humanAgentId,{delegateMention:Z.delegateMention}),onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),P=w.trim().toLowerCase(),U=b.useMemo(()=>wK({filter:j,search:P,isAdmin:n,selfMemberId:t,members:D,yourAgents:Y,teamAgents:me,otherPrivateAgents:te,resolveMember:o,agentByUuid:L,openDelegate:(Z,ae)=>{var Se;return x({humanAgentId:Z,humanDisplayName:ae,currentDelegate:((Se=L.get(Z))==null?void 0:Se.delegateMention)??null})}}),[j,P,n,t,D,Y,me,te,o,L]);function T(Z){const ae=[];return n&&ae.push({key:"edit",label:"Edit profile",onSelect:()=>g({id:Z.id,username:Z.username,displayName:Z.displayName,role:Z.role})}),n&&!Z.isSelf&&ae.push({key:"remove",label:"Remove from org",destructive:!0,onSelect:()=>{window.confirm(`Remove ${Z.displayName} from the org? The human agent will be deactivated.`)&&q.mutate(Z.id)}}),ae}function G(Z){const{agent:ae,isOwnedBySelf:Se}=Z,Re=n||Se,je=[{key:"open",label:"Open",onSelect:()=>a(`/agents/${encodeURIComponent(ae.uuid)}`)}];return Re&&(ae.status==="suspended"?je.push({key:"reactivate",label:"Reactivate",onSelect:()=>ve.mutate(ae.uuid)}):je.push({key:"suspend",label:"Suspend",onSelect:()=>ee.mutate(ae.uuid)}),je.push({key:"delete",label:"Delete",destructive:!0,onSelect:()=>{window.confirm(`Delete agent ${ae.displayName}? This cannot be undone.`)&&le.mutate(ae.uuid)}})),je}return l.jsxs(l.Fragment,{children:[l.jsx(ul,{title:"Team",right:l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)"},children:[l.jsxs(xe,{size:"xs",onClick:()=>h(!0),children:[l.jsx(ka,{className:"h-3 w-3"}),"New agent"]}),n&&l.jsxs(xe,{size:"xs",variant:"ghost",onClick:()=>f(!0),children:[l.jsx(ZE,{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(SK,{filter:j,onFilter:k,query:w,onQuery:C,counts:{yours:Y.length,humans:D.length,team:me.length}}),R.isLoading||_.isLoading?l.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):R.error||_.error?l.jsxs("div",{className:"text-center py-8 text-body",style:{color:"var(--state-error)"},children:["Failed to load: ",xK(R.error??_.error)]}):l.jsx(cK,{groups:U,runtimeMap:I,clientHostMap:F,onAgentClick:Z=>a(`/agents/${encodeURIComponent(Z)}`),getHumanActions:T,getAgentActions:G})]}),l.jsx(Rn,{open:c,onOpenChange:f,children:l.jsxs(Cn,{children:[l.jsx(Pn,{children:l.jsx(On,{children:"Invite link"})}),l.jsx(uK,{})]})}),l.jsx(rK,{open:m,onOpenChange:h,onCreated:(Z,ae)=>{h(!1),s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}}),l.jsx(EK,{target:p,isAdmin:n,isSaving:J.isPending,onClose:()=>g(null),onSave:async Z=>{p&&(await J.mutateAsync({id:p.id,patch:Z}),g(null))}}),l.jsx(CK,{target:S,candidates:kK(W),isSaving:M.isPending,onClose:()=>x(null),onSave:async Z=>{S&&(await M.mutateAsync({humanAgentId:S.humanAgentId,delegateMention:Z}),x(null))}})]})}function xK(e){return e instanceof Error?e.message:String(e)}function SK({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(ih,{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(Dv,{"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(qt,{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 wK(e){const{filter:t,search:n,isAdmin:a,selfMemberId:s,members:o,yourAgents:c,teamAgents:f,otherPrivateAgents:m,agentByUuid:h,openDelegate:p}=e,g=D=>{const W=h.get(D);if(!(W!=null&&W.delegateMention))return null;const L=h.get(W.delegateMention);return L?{name:L.name,displayName:L.displayName}:null},S=D=>!n||D.displayName.toLowerCase().includes(n)||D.username.toLowerCase().includes(n),x=D=>!n||D.displayName.toLowerCase().includes(n)||(D.name??"").toLowerCase().includes(n),j=t==="all"||t==="yours",k=t==="all"||t==="humans",w=t==="all"||t==="team",C=a&&t==="all",_=o.filter(S).map(D=>{const W=s===D.id;return{kind:"human",id:D.id,agentId:D.agentId,username:D.username,displayName:D.displayName,role:D.role,createdAt:D.createdAt,isSelf:W,delegate:g(D.agentId),canEditDelegate:W||a,onEditDelegate:()=>p(D.agentId,D.displayName)}}).sort((D,W)=>Number(W.isSelf)-Number(D.isSelf)),R=(D,W)=>({kind:"agent",agent:D,managerLabel:D.managerId?e.resolveMember(D.managerId):null,isOwnedBySelf:D.managerId===s,showVisibilityChip:(W==null?void 0:W.showVisibilityChip)??!1}),z=c.filter(x).map(D=>R(D,{showVisibilityChip:!0})).sort((D,W)=>{const L=D.agent.visibility==="private"?0:1,V=W.agent.visibility==="private"?0:1;return L!==V?L-V:D.agent.displayName.localeCompare(W.agent.displayName,void 0,{sensitivity:"base"})}),I=f.filter(x).map(D=>R(D)),O=m.filter(x).map(D=>R(D)),F=[];return j&&F.push({key:"yours",title:"Your agents",count:z.length,rows:z,emptyMessage:n?"No agents match this search.":"You haven't created any agents yet. Click New agent above to add one."}),k&&F.push({key:"humans",title:"Humans",count:_.length,rows:_,emptyMessage:n?"No humans match this search.":void 0}),w&&F.push({key:"team",title:"Team agents",count:I.length,rows:I,emptyMessage:n?"No team agents match this search.":"No shared agents from other team members yet."}),C&&O.length>0&&F.push({key:"other-private",title:"Other members' private agents",count:O.length,rows:O,collapsible:!0}),F}function kK(e){return e.filter(t=>t.type==="personal_assistant"&&t.status==="active")}const jK=Object.values(dF);function EK({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(x){if(x.preventDefault(),!e)return;const j={};if(o.trim()&&o!==e.displayName&&(j.displayName=o.trim()),t&&f!==e.role&&(j.role=f),Object.keys(j).length===0){a();return}try{await s(j)}catch(k){p(k instanceof Error?k.message:String(k))}}const S=e!==null;return l.jsx(Rn,{open:S,onOpenChange:x=>x?void 0:a(),children:l.jsxs(Cn,{children:[l.jsx(Pn,{children:l.jsx(On,{children:"Edit profile"})}),e&&l.jsxs("form",{onSubmit:g,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{children:"Username"}),l.jsx(qt,{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(St,{htmlFor:"edit-member-display",children:"Display name"}),l.jsx(qt,{id:"edit-member-display",value:o,onChange:x=>c(x.target.value),required:!0,maxLength:200})]}),t&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{htmlFor:"edit-member-role",children:"Role"}),l.jsx("select",{id:"edit-member-role",value:f,onChange:x=>m(x.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:jK.map(x=>l.jsx("option",{value:x,children:x},x))}),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(mr,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:a,disabled:n,children:"Cancel"}),l.jsx(xe,{type:"submit",disabled:n,children:n?"Saving…":"Save"})]})]})]})})}function CK({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(S){m(S instanceof Error?S.message:String(S))}}}const p=e!==null;return l.jsx(Rn,{open:p,onOpenChange:g=>g?void 0:a(),children:l.jsxs(Cn,{children:[l.jsx(Pn,{children:l.jsx(On,{children:"Set delegate"})}),e&&l.jsxs("form",{onSubmit:h,className:"space-y-4",children:[l.jsxs("p",{className:"text-body",style:{color:"var(--fg-2)"},children:["Pick a personal assistant to act on behalf of ",l.jsx("strong",{children:e.humanDisplayName}),". When teammates @mention this human, the assistant receives the message and can reply in their place."]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(St,{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(mr,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:a,disabled:n,children:"Cancel"}),l.jsx(xe,{type:"submit",disabled:n,children:n?"Saving…":"Save"})]})]})]})})}function Uh(e,t){return`/orgs/${encodeURIComponent(e)}/settings/${encodeURIComponent(t)}`}function zb(e){return Ee.get(Uh(e,"context_tree"))}function PT(e,t){return Ee.put(Uh(e,"context_tree"),t)}function UT(e){return Ee.get(Uh(e,"source_repos"))}function BT(e,t){return Ee.put(Uh(e,"source_repos"),t)}function iv({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(),S=`flex-1 min-w-0 outline-none text-body focus-visible:ring-1 focus-visible:ring-ring ${o?"mono":""}`,x={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(NK,{})]}),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:S,style:{...x,color:"var(--fg-2)"}}):l.jsx("input",{id:g,value:n,onChange:j=>a==null?void 0:a(j.target.value),type:c,placeholder:f,pattern:p,className:S,style:x}),m]})]})}function NK(){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(fr,{className:"h-3 w-3"}),"Saved"]})}function FT({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(Ty,{className:"h-4 w-4 animate-spin"}):l.jsx(fr,{className:"h-4 w-4"})})}function _K({isFirst:e=!1}){const{organizationId:t}=lt(),n=pn(),a=Ye({queryKey:["org-setting",t,"context_tree"],queryFn:()=>t?zb(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=gt({mutationFn:()=>{if(!t)throw new Error("organization not loaded");return PT(t,{repo:s.trim()?s.trim():null,branch:c.trim()?c.trim():null})},onSuccess:S=>{n.setQueryData(["org-setting",t,"context_tree"],S),h(!0),setTimeout(()=>h(!1),2e3)}}),g=S=>{S.preventDefault(),p.mutate()};return l.jsx(Vc,{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(iv,{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(iv,{label:"Branch",hint:"Branch checked out by client agents on startup.",value:c,onChange:f,mono:!0,placeholder:"main",saved:m,rightSlot:l.jsx(FT,{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 TK({isFirst:e=!1}){var h;const{organizationId:t,role:n}=lt(),a=n==="admin",s=pn(),o=Ye({queryKey:["org-setting",t,"source_repos"],queryFn:()=>t?UT(t):Promise.reject(new Error("no org")),enabled:!!t}),c=gt({mutationFn:async p=>{var x;if(!t)throw new Error("organization not loaded");const S=(((x=o.data)==null?void 0:x.repos)??[]).filter(j=>j.url!==p);return BT(t,{repos:S})},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(Vc,{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(AK,{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 AK({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(ms,{className:"h-3.5 w-3.5"})})]})}function RK(e){return Ee.get(`/orgs/${encodeURIComponent(e)}`)}function OK(e,t){return Ee.patch(`/orgs/${encodeURIComponent(e)}`,t)}function MK({isFirst:e=!1}){const{organizationId:t}=lt(),n=pn(),a=Ye({queryKey:["organization",t],queryFn:()=>t?RK(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=gt({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):OK(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(Vc,{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(iv,{label:"Team name",hint:"Shown in the team switcher and dashboard header.",value:s,onChange:o,saved:c,rightSlot:l.jsx(FT,{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 zK(){const{role:e}=lt(),t=e==="admin";return l.jsxs("div",{children:[t&&l.jsx(MK,{isFirst:!0}),t&&l.jsx(_K,{}),l.jsx(TK,{isFirst:!t})]})}function DK(){const{role:e}=lt();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(ul,{title:"Team settings",subtitle:t}),l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:l.jsx(zK,{})})]})}function sh(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(gn(`/chats${n?`?${n}`:""}`))}function IK(e){return Ee.post(gn("/chats"),e)}function LK(e){return Ee.post(`/chats/${encodeURIComponent(e)}/read`)}function $T(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/participants`,t)}function PK(e){return Ee.post(`/chats/${encodeURIComponent(e)}/workspace-join`)}function HT(e){var t;return((t=e.trim()[0])==null?void 0:t.toUpperCase())??"?"}const UK=8,BK="var(--avatar-hue-0)";function qT(e){if(e.length===0)return BK;let t=5381;for(let a=0;a<e.length;a++)t=t*33^e.charCodeAt(a);return`var(--avatar-hue-${Math.abs(t)%UK})`}function FK(e){return e<=1?"single":e===2?"n2":e===3?"n3":e===4?"n4":"n5+"}function $K(e){return e<=0?null:e>99?"99+":String(e)}function HK(e){const t=[];return e.engaged&&t.push("engaged"),e.unread>0&&t.push(`${e.unread} unread`),t.length>0?t.join(", "):null}function qK({title:e,type:t,participants:n,selfAgentId:a,engagedAgentIds:s,unreadCount:o,size:c=36}){const f=t==="direct",m=n.filter(x=>x.agentId!==a),h=m[0],p=m.some(x=>s.includes(x.agentId)),g=HK({engaged:p,unread:o}),S=g===null?{"aria-hidden":!0}:{role:"img","aria-label":g};return l.jsxs("span",{...S,style:{position:"relative",width:c,height:c,flexShrink:0,display:"inline-block"},children:[f||m.length<=1?l.jsx(ZK,{size:c,name:(h==null?void 0:h.displayName)??e,hueSeed:(h==null?void 0:h.agentId)??e}):l.jsx(GK,{size:c,peers:m}),p&&l.jsx(QK,{size:c}),o>0&&l.jsx(KK,{count:o})]})}function ZK({size:e,name:t,hueSeed:n}){return l.jsx("span",{"aria-hidden":"true",style:{width:e,height:e,borderRadius:"50%",background:qT(n),color:"var(--fg-on-vivid)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:Math.round(e*.42),fontWeight:700,lineHeight:1,letterSpacing:"-0.02em",userSelect:"none"},children:HT(t)})}function GK({size:e,peers:t}){var m,h,p,g,S,x,j,k,w,C,_,R,z,I,O,F,D,W,L,V,Y,me,te,J;const n=t.length,a=FK(n),s=Math.round(e*(n===2?.36:.28)),o=Math.round(e*.32),c=Math.round(e*.26),f=a==="n2"?{gridTemplateColumns:"1fr 1fr"}:{gridTemplateColumns:"1fr 1fr",gridTemplateRows:"1fr 1fr"};return l.jsxs("div",{"aria-hidden":"true",style:{width:e,height:e,borderRadius:"50%",overflow:"hidden",display:"grid",gap:"var(--hairline)",background:"var(--bg-raised)",userSelect:"none",...f},children:[a==="n2"&&l.jsxs(l.Fragment,{children:[l.jsx(ra,{name:((m=t[0])==null?void 0:m.displayName)??"?",hueSeed:((h=t[0])==null?void 0:h.agentId)??"0",fontSize:s}),l.jsx(ra,{name:((p=t[1])==null?void 0:p.displayName)??"?",hueSeed:((g=t[1])==null?void 0:g.agentId)??"1",fontSize:s})]}),a==="n3"&&l.jsxs(l.Fragment,{children:[l.jsx(ra,{name:((S=t[0])==null?void 0:S.displayName)??"?",hueSeed:((x=t[0])==null?void 0:x.agentId)??"0",fontSize:o,fullWidth:!0}),l.jsx(ra,{name:((j=t[1])==null?void 0:j.displayName)??"?",hueSeed:((k=t[1])==null?void 0:k.agentId)??"1",fontSize:s}),l.jsx(ra,{name:((w=t[2])==null?void 0:w.displayName)??"?",hueSeed:((C=t[2])==null?void 0:C.agentId)??"2",fontSize:s})]}),a==="n4"&&l.jsxs(l.Fragment,{children:[l.jsx(ra,{name:((_=t[0])==null?void 0:_.displayName)??"?",hueSeed:((R=t[0])==null?void 0:R.agentId)??"0",fontSize:s}),l.jsx(ra,{name:((z=t[1])==null?void 0:z.displayName)??"?",hueSeed:((I=t[1])==null?void 0:I.agentId)??"1",fontSize:s}),l.jsx(ra,{name:((O=t[2])==null?void 0:O.displayName)??"?",hueSeed:((F=t[2])==null?void 0:F.agentId)??"2",fontSize:s}),l.jsx(ra,{name:((D=t[3])==null?void 0:D.displayName)??"?",hueSeed:((W=t[3])==null?void 0:W.agentId)??"3",fontSize:s})]}),a==="n5+"&&l.jsxs(l.Fragment,{children:[l.jsx(ra,{name:((L=t[0])==null?void 0:L.displayName)??"?",hueSeed:((V=t[0])==null?void 0:V.agentId)??"0",fontSize:s}),l.jsx(ra,{name:((Y=t[1])==null?void 0:Y.displayName)??"?",hueSeed:((me=t[1])==null?void 0:me.agentId)??"1",fontSize:s}),l.jsx(ra,{name:((te=t[2])==null?void 0:te.displayName)??"?",hueSeed:((J=t[2])==null?void 0:J.agentId)??"2",fontSize:s}),l.jsx(VK,{count:n-3,fontSize:c})]})]})}function ra({name:e,hueSeed:t,fontSize:n,fullWidth:a}){return l.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",background:qT(t),color:"var(--fg-on-vivid)",fontSize:n,fontWeight:700,lineHeight:1,letterSpacing:"-0.02em",...a?{gridColumn:"1 / -1"}:null},children:HT(e)})}function VK({count:e,fontSize:t}){return l.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",background:"var(--bg-sunken)",color:"var(--fg-3)",fontSize:t,fontWeight:600,lineHeight:1,userSelect:"none"},children:`+${e}`})}function QK({size:e}){return l.jsx("span",{"aria-hidden":"true",className:"chat-row-avatar__working-ring",style:{position:"absolute",inset:-3,width:e+6,height:e+6,borderRadius:"50%",border:"var(--hairline-bold) solid var(--state-working)",pointerEvents:"none",zIndex:1}})}function KK({count:e}){const t=$K(e);return t===null?null:l.jsx("span",{"aria-hidden":"true",style:{position:"absolute",bottom:-3,right:-3,minWidth:"var(--sp-4)",height:"var(--sp-4)",padding:"0 var(--sp-1)",borderRadius:"var(--sp-2)",background:"var(--state-error)",color:"var(--fg-on-vivid)",fontSize:"var(--text-caption)",fontWeight:700,lineHeight:"var(--sp-4)",textAlign:"center",border:"var(--hairline-bold) solid var(--bg-raised)",boxSizing:"content-box",zIndex:3,userSelect:"none"},children:t})}const YK=1e3;function XK(e){if(e<0)return"0s";if(e<1e3)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),a=t%60;return`${n}m${a.toString().padStart(2,"0")}s`}function WK({activity:e}){const t=new Date(e.startedAt).getTime(),[n,a]=b.useState(()=>Date.now());b.useEffect(()=>{const o=setInterval(()=>a(Date.now()),YK);return()=>clearInterval(o)},[]);const s=XK(n-t);return l.jsxs("span",{role:"status","aria-label":`${e.label}, ${s}`,className:"mono text-caption shrink-0 inline-flex items-center",style:{gap:6,color:"var(--state-working)"},children:[l.jsx("span",{"aria-hidden":"true",className:"chat-row-live-chip__dot",style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:"var(--state-working)"}}),l.jsx("span",{className:"truncate",style:{maxWidth:96},children:e.label}),l.jsx("span",{style:{color:"var(--fg-4)"},children:s})]})}function ZT(e){return Ee.get(`/chats/${encodeURIComponent(e)}`)}function JK(e,t){return Ee.patch(`/chats/${encodeURIComponent(e)}`,{topic:t})}function GT(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/engagement`,{status:t})}function To(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"text",content:t})}function eY(e,t){return Ee.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"file",content:t})}function tY(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 Db(e){return Ee.post(`/agents/${encodeURIComponent(e)}/chats`,{})}function nY(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:hj,ARCHIVED:mj,DELETED:pj}=Hy;function rY(e,t){return e===hj?[{key:"archive",label:"Archive",onSelect:()=>t(mj)},{key:"delete",label:"Delete",destructive:!0,onSelect:()=>t(pj)}]:e===mj?[{key:"unarchive",label:"Unarchive",onSelect:()=>t(hj)},{key:"delete",label:"Delete",destructive:!0,onSelect:()=>t(pj)}]:[]}const aY="opacity-0 group-hover:opacity-100 focus-visible:opacity-100 aria-expanded:opacity-100";function iY({chatId:e,status:t}){const n=pn(),a=gt({mutationFn:o=>GT(e,o),onSuccess:()=>{n.invalidateQueries({queryKey:["me","chats"]}),n.invalidateQueries({queryKey:["chat-detail",e]})}}),s=rY(t,o=>a.mutate(o));return l.jsx(Ob,{actions:s,ariaLabel:"Manage chat",triggerClassName:aY})}const lh="draft",sY=[{value:"active",label:"Active"},{value:"archived",label:"Archived"},{value:"all",label:"All"}];function lY(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 oY(e){return e.membershipKind==="watching"?e.lastMessagePreview?`Watching · ${e.lastMessagePreview}`:"Watching":e.lastMessagePreview??""}function uY({selectedChatId:e,onSelectChat:t,onNewChat:n,engagement:a,onEngagementChange:s}){const{agentId:o}=lt(),[c,f]=b.useState("all"),[m,h]=b.useState([]),[p,g]=b.useState(!1),[S,x]=b.useState(null),{data:j,isLoading:k}=Ye({queryKey:["me","chats",c,a],queryFn:()=>sh({filter:c,engagement:a}),refetchInterval:15e3}),w=()=>{m.length>0&&h([]),x(null)},C=(j==null?void 0:j.rows)??[],_=b.useMemo(()=>[...C,...m],[C,m]),R=async()=>{if(p)return;const D=j==null?void 0:j.nextCursor;if(D){g(!0),x(null);try{const W=await sh({filter:c,engagement:a,cursor:D});h(L=>[...L,...W.rows]),I(W.nextCursor)}catch(W){x(W instanceof Error?W.message:"Failed to load more")}finally{g(!1)}}},[z,I]=b.useState(null),O=(j==null?void 0:j.nextCursor)??null;b.useEffect(()=>{I(O)},[O]);const F=b.useMemo(()=>_.reduce((D,W)=>D+(W.unreadMentionCount>0?1:0),0),[_]);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===lh?"var(--bg-active)":"transparent",color:e===lh?"var(--accent)":"var(--fg)",cursor:"pointer",fontWeight:500},title:"New chat",children:[l.jsx(ka,{className:"h-3.5 w-3.5",strokeWidth:2}),"New chat"]}),l.jsx("div",{className:"flex items-center",style:{gap:4},children:sY.map(D=>l.jsx(ih,{active:a===D.value,onClick:()=>{a!==D.value&&(s(D.value),w())},children:D.label},D.value))}),F>0&&l.jsx("div",{className:"flex items-center gap-1 shrink-0",children:l.jsx(ih,{active:c==="unread",count:F,onClick:()=>{f(c==="unread"?"all":"unread"),w()},children:"unread"})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto",children:[k&&_.length===0&&l.jsx("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:"Loading…"}),!k&&_.length===0&&l.jsxs("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},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."})]}),_.map(D=>{const W=e===D.chatId,L=oY(D),V=L&&L!==D.title?L:"",Y=D.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(D.chatId),className:ze("w-full text-left transition-colors flex items-center","hover:bg-[var(--bg-hover)]"),style:{padding:"var(--sp-2) var(--sp-3)",gap:"var(--sp-2_5)",background:W?"var(--bg-active)":"transparent",borderLeft:`var(--hairline-bold) solid ${W?"var(--accent)":"transparent"}`},children:[l.jsx(qK,{title:D.title,type:D.type,participants:D.participants,selfAgentId:o??"",engagedAgentIds:D.engagedAgentIds,unreadCount:D.unreadMentionCount}),l.jsxs("div",{className:"flex flex-col",style:{flex:1,minWidth:0},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:6},children:[l.jsx("span",{className:"truncate text-subtitle",style:{color:Y?"var(--fg)":"var(--fg-2)",fontWeight:Y?700:500,flex:1,minWidth:0},children:D.title}),(()=>{const me=D.liveActivity?l.jsx(WK,{activity:D.liveActivity}):D.lastMessageAt?l.jsx("span",{className:"mono text-caption shrink-0",style:{color:"var(--fg-4)"},children:lY(D.lastMessageAt)}):null;return me?l.jsx("span",{className:"shrink-0 transition-opacity group-hover:opacity-0 group-has-aria-expanded:opacity-0",children:me}):null})()]}),l.jsx("div",{className:"truncate text-body",style:{color:Y?"var(--fg-2)":"var(--fg-3)",marginTop:2},children:V||"—"})]})]}),l.jsx("div",{className:"absolute",style:{top:"var(--sp-2)",right:"var(--sp-3)"},children:l.jsx(iY,{chatId:D.chatId,status:D.engagementStatus})})]},D.chatId)}),z&&_.length>0&&l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3)"},children:[l.jsx("button",{type:"button",onClick:R,disabled:p,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:p?"default":"pointer",opacity:p?.6:1},children:p?"Loading…":"Load more"}),S&&l.jsx("p",{className:"mono text-caption",style:{color:"var(--state-error)",marginTop:4},children:S})]})]})]})}function Ib(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 cY(e,t){return!e.name||!e.displayName?!1:e.displayName!==e.name?!0:t.has(e.displayName)}function Lb({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}),cY(e,t)&&l.jsxs("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:["@",e.name]})]})}function dY(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 gj(e,t){return(e.displayName??e.name??"").localeCompare(t.displayName??t.name??"")}function Pb(e){const t=e.filter(a=>a.managedByMe).sort(gj),n=e.filter(a=>!a.managedByMe).sort(gj);return t.length>0&&n.length>0?[...t,{divider:!0},...n]:[...t,...n]}function fY(e,t){if(!t)return Pb(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 hY(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 VT({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:dY(e,t),[e,t,s]),p=b.useMemo(()=>h?fY(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 S=f!==null&&h!==null&&f===h.triggerIndex,x=h!==null&&p.length>0&&!S;function j(){m((h==null?void 0:h.triggerIndex)??null)}function k(C){if(!h)return;const _=hY(e,h,t,C);_&&a(_)}return{trigger:x?h:null,results:x?p:[],highlightIndex:o,handleKey:C=>{if(!x||!h)return!1;if(C.key==="ArrowDown")return C.preventDefault(),c(_=>p.length===0?0:(_+1)%p.length),!0;if(C.key==="ArrowUp")return C.preventDefault(),c(_=>p.length===0?0:(_-1+p.length)%p.length),!0;if(C.key==="Enter"||C.key==="Tab"){const _=p[o]??p[0];return _?(C.preventDefault(),k(_),!0):!1}return C.key==="Escape"?(C.preventDefault(),j(),!0):!1},pick:k,dismiss:j}}function QT({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=Ib(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(Lb,{candidate:m,ambiguous:f})},m.agentId)})})()})}function KT(e,t){b.useLayoutEffect(()=>{const n=e.current;n&&(n.style.height="auto",n.style.height=`${n.scrollHeight}px`)},[e,t])}function mY({onCreated:e}){const t=pn(),{agentId:n}=lt(),a=Gv(),[s,o]=b.useState([]),[c,f]=b.useState(""),[m,h]=b.useState(0),[p,g]=b.useState(null),[S,x]=b.useState(!1),[j,k]=b.useState(!1),w=b.useRef(null),C=b.useRef(!1),_=b.useRef(null);KT(w,c);const{data:R}=Ye({queryKey:["activity"],queryFn:Pc,refetchInterval:15e3}),z=b.useMemo(()=>{const te=(R==null?void 0:R.agents)??[],J=[];for(const q of te){if(n&&q.agentId===n)continue;const le=a(q.agentId);!le||!le.name||J.push({agentId:q.agentId,name:le.name,displayName:le.displayName,managedByMe:q.managedByMe})}return J},[R,a,n]);b.useEffect(()=>{if(C.current||s.length>0||z.length===0)return;const te=gY(z,(R==null?void 0:R.agents)??[]);te&&(o([te]),C.current=!0)},[z,R,s.length]);const I=b.useMemo(()=>{const te=z.map(J=>({agentId:J.agentId,name:J.name}));return HN(c,te)},[c,z]),O=VT({value:c,cursor:m,candidates:z,disabled:S,onSelect:te=>{f(te.text),h(te.cursor),requestAnimationFrame(()=>{const J=w.current;J&&(J.focus(),J.setSelectionRange(te.cursor,te.cursor))})}});b.useEffect(()=>{I.length!==0&&o(te=>{const J=new Set(te);let q=!1;for(const le of I)J.has(le)||(J.add(le),q=!0);return q?[...J]:te})},[I]),b.useEffect(()=>{if(!j)return;const te=J=>{_.current&&(_.current.contains(J.target)||k(!1))};return document.addEventListener("mousedown",te),()=>document.removeEventListener("mousedown",te)},[j]);const F=gt({mutationFn:async({participantIds:te,text:J})=>{const q=await IK({participantIds:te}),le=J.trim();return le.length>0&&await To(q.chatId,le),q.chatId},onSuccess:te=>{f(""),o([]),C.current=!1,t.invalidateQueries({queryKey:["me","chats"]}),e(te)},onError:te=>{g(te instanceof Error?te.message:"Failed to create chat")}}),D=b.useMemo(()=>!(S||F.isPending||s.length===0||c.trim().length===0||s.length>=2&&I.length===0),[S,F.isPending,s.length,c,I.length]),W=b.useMemo(()=>s.length===0?"Add at least one participant":c.trim().length===0?null:s.length>=2&&I.length===0?"Group chats need an @ to wake at least one participant":null,[s.length,c,I.length]),L=async()=>{if(!D)return;const te=Array.from(new Set([...s,...I]));g(null),x(!0);try{await F.mutateAsync({participantIds:te,text:c})}finally{x(!1)}},V=te=>{o(J=>J.filter(q=>q!==te))},Y=te=>{o(J=>J.includes(te)?J:[...J,te]),k(!1)},me=b.useMemo(()=>z.filter(te=>!s.includes(te.agentId)),[z,s]);return l.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",style:{background:"var(--bg-base)"},children:l.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",style:{padding:"var(--sp-6)"},children:l.jsxs("div",{style:{width:"100%",maxWidth:"clamp(55rem, 75%, 70rem)"},children:[l.jsx("p",{className:"text-title",style:{color:"var(--fg)",textAlign:"center",marginBottom:"var(--sp-5)"},children:"What's the task?"}),l.jsxs("div",{style:{borderRadius:10,background:"var(--bg-raised)",boxShadow:"var(--shadow-md)",overflow:"visible"},children:[l.jsx(pY,{chips:s,candidates:z,chipCandidates:me,pickerOpen:j,setPickerOpen:k,pickerContainerRef:_,onAdd:Y,onRemove:V}),l.jsxs("div",{style:{position:"relative"},children:[l.jsx(QT,{trigger:O.trigger,results:O.results,highlightIndex:O.highlightIndex,anchorRef:w,onPick:O.pick}),l.jsx("textarea",{ref:w,value:c,onChange:te=>{f(te.target.value),h(te.target.selectionStart??te.target.value.length)},onSelect:te=>{h(te.currentTarget.selectionStart??c.length)},placeholder:s.length>=2?"Describe the task. Use @ to address one or more.":"Describe the task…",rows:1,onKeyDown:te=>{te.nativeEvent.isComposing||O.handleKey(te)||te.key==="Enter"&&!te.shiftKey&&(te.preventDefault(),L())},disabled:S||F.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&&I.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 L(),disabled:!D,title:W??"Send (Enter)","aria-label":"Send",className:ze("inline-flex items-center justify-center transition-opacity",!D&&"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(UE,{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 pY({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(ms,{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(ka,{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=Ib(n);return Pb(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(Lb,{candidate:h,ambiguous:m})},h.agentId))})()})]})]})}function gY(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 yY="first-tree-hub-images",vY=1,Ao="images";let Tf=null;function YT(){return Tf||(Tf=new Promise(e=>{if(typeof indexedDB>"u"){e(null);return}const t=indexedDB.open(yY,vY);t.onupgradeneeded=()=>{const n=t.result;n.objectStoreNames.contains(Ao)||n.createObjectStore(Ao,{keyPath:"imageId"})},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null),t.onblocked=()=>e(null)}),Tf)}async function bY(e){const t=await YT();if(!t)throw new Error("Image storage unavailable (IndexedDB disabled or blocked)");await new Promise((n,a)=>{const s=t.transaction(Ao,"readwrite"),o=s.objectStore(Ao),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 xY(e){const t=await YT();return t?new Promise(n=>{const o=t.transaction(Ao,"readonly").objectStore(Ao).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 SY(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:XT,setPrototypeOf:yj,isFrozen:wY,getPrototypeOf:kY,getOwnPropertyDescriptor:jY}=Object;let{freeze:hr,seal:ua,create:Jl}=Object,{apply:sv,construct:lv}=typeof Reflect<"u"&&Reflect;hr||(hr=function(t){return t});ua||(ua=function(t){return t});sv||(sv=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)});lv||(lv=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=En(Array.prototype.forEach),EY=En(Array.prototype.lastIndexOf),vj=En(Array.prototype.pop),Ku=En(Array.prototype.push),CY=En(Array.prototype.splice),or=Array.isArray,nc=En(String.prototype.toLowerCase),Zg=En(String.prototype.toString),bj=En(String.prototype.match),Ql=En(String.prototype.replace),xj=En(String.prototype.indexOf),NY=En(String.prototype.trim),_Y=En(Number.prototype.toString),TY=En(Boolean.prototype.toString),Sj=typeof BigInt>"u"?null:En(BigInt.prototype.toString),wj=typeof Symbol>"u"?null:En(Symbol.prototype.toString),on=En(Object.prototype.hasOwnProperty),Yu=En(Object.prototype.toString),Vn=En(RegExp.prototype.test),Af=AY(TypeError);function En(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];return sv(e,t,a)}}function AY(e){return function(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return lv(e,n)}}function nt(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:nc;if(yj&&yj(e,null),!or(t))return e;let a=t.length;for(;a--;){let s=t[a];if(typeof s=="string"){const o=n(s);o!==s&&(wY(t)||(t[a]=o),s=o)}e[s]=!0}return e}function RY(e){for(let t=0;t<e.length;t++)on(e,t)||(e[t]=null);return e}function Er(e){const t=Jl(null);for(const[n,a]of XT(e))on(e,n)&&(or(a)?t[n]=RY(a):a&&typeof a=="object"&&a.constructor===Object?t[n]=Er(a):t[n]=a);return t}function OY(e){switch(typeof e){case"string":return e;case"number":return _Y(e);case"boolean":return TY(e);case"bigint":return Sj?Sj(e):"0";case"symbol":return wj?wj(e):"Symbol()";case"undefined":return Yu(e);case"function":case"object":{if(e===null)return Yu(e);const t=e,n=eo(t,"toString");if(typeof n=="function"){const a=n(t);return typeof a=="string"?a:Yu(a)}return Yu(e)}default:return Yu(e)}}function eo(e,t){for(;e!==null;){const a=jY(e,t);if(a){if(a.get)return En(a.get);if(typeof a.value=="function")return En(a.value)}e=kY(e)}function n(){return null}return n}function MY(e){try{return Vn(e,""),!0}catch{return!1}}const kj=hr(["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"]),Gg=hr(["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"]),Vg=hr(["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"]),zY=hr(["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=hr(["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"]),DY=hr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),jj=hr(["#text"]),Ej=hr(["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"]),Kg=hr(["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"]),Cj=hr(["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"]),Rf=hr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),IY=ua(/\{\{[\w\W]*|[\w\W]*\}\}/gm),LY=ua(/<%[\w\W]*|[\w\W]*%>/gm),PY=ua(/\$\{[\w\W]*/gm),UY=ua(/^data-[\-\w.\u00B7-\uFFFF]+$/),BY=ua(/^aria-[\-\w]+$/),WT=ua(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),FY=ua(/^(?:\w+script|data):/i),$Y=ua(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),JT=ua(/^html$/i),HY=ua(/^[a-z][.\w]*(-[.\w]+)+$/i);var Nj=Object.freeze({__proto__:null,ARIA_ATTR:BY,ATTR_WHITESPACE:$Y,CUSTOM_ELEMENT:HY,DATA_ATTR:UY,DOCTYPE_NAME:JT,ERB_EXPR:LY,IS_ALLOWED_URI:WT,IS_SCRIPT_OR_DATA:FY,MUSTACHE_EXPR:IY,TMPLIT_EXPR:PY});const Xu={element:1,text:3,progressingInstruction:7,comment:8,document:9},qY=function(){return typeof window>"u"?null:window},ZY=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}},_j=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function eA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:qY();const t=Ue=>eA(Ue);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Xu.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:S,trustedTypes:x}=e,j=m.prototype,k=eo(j,"cloneNode"),w=eo(j,"remove"),C=eo(j,"nextSibling"),_=eo(j,"childNodes"),R=eo(j,"parentNode");if(typeof c=="function"){const Ue=n.createElement("template");Ue.content&&Ue.content.ownerDocument&&(n=Ue.content.ownerDocument)}let z,I="";const{implementation:O,createNodeIterator:F,createDocumentFragment:D,getElementsByTagName:W}=n,{importNode:L}=a;let V=_j();t.isSupported=typeof XT=="function"&&typeof R=="function"&&O&&O.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Y,ERB_EXPR:me,TMPLIT_EXPR:te,DATA_ATTR:J,ARIA_ATTR:q,IS_SCRIPT_OR_DATA:le,ATTR_WHITESPACE:ee,CUSTOM_ELEMENT:ve}=Nj;let{IS_ALLOWED_URI:M}=Nj,P=null;const U=nt({},[...kj,...Gg,...Vg,...Qg,...jj]);let T=null;const G=nt({},[...Ej,...Kg,...Cj,...Rf]);let Z=Object.seal(Jl(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,Se=null;const Re=Object.seal(Jl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let je=!0,$e=!0,Ie=!1,Ke=!0,et=!1,wt=!0,K=!1,ge=!1,Ce=!1,_e=!1,At=!1,qe=!1,Mn=!0,rn=!1;const La="user-content-";let an=!0,ma=!1,ue={},be=null;const Be=nt({},["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 Xe=null;const yt=nt({},["audio","video","img","source","image","track"]);let Nn=null;const pr=nt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Gt="http://www.w3.org/1998/Math/MathML",Bt="http://www.w3.org/2000/svg",It="http://www.w3.org/1999/xhtml";let ft=It,gr=!1,Un=null;const $o=nt({},[Gt,Bt,It],Zg);let Ea=nt({},["mi","mo","mn","ms","mtext"]),ir=nt({},["annotation-xml"]);const pa=nt({},["title","style","font","a","script"]);let Bn=null;const Pa=["application/xhtml+xml","text/html"],ga="text/html";let Jt=null,Gr=null;const bi=n.createElement("form"),ya=function($){return $ instanceof RegExp||$ instanceof Function},xi=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Gr&&Gr===$)return;(!$||typeof $!="object")&&($={}),$=Er($),Bn=Pa.indexOf($.PARSER_MEDIA_TYPE)===-1?ga:$.PARSER_MEDIA_TYPE,Jt=Bn==="application/xhtml+xml"?Zg:nc,P=on($,"ALLOWED_TAGS")&&or($.ALLOWED_TAGS)?nt({},$.ALLOWED_TAGS,Jt):U,T=on($,"ALLOWED_ATTR")&&or($.ALLOWED_ATTR)?nt({},$.ALLOWED_ATTR,Jt):G,Un=on($,"ALLOWED_NAMESPACES")&&or($.ALLOWED_NAMESPACES)?nt({},$.ALLOWED_NAMESPACES,Zg):$o,Nn=on($,"ADD_URI_SAFE_ATTR")&&or($.ADD_URI_SAFE_ATTR)?nt(Er(pr),$.ADD_URI_SAFE_ATTR,Jt):pr,Xe=on($,"ADD_DATA_URI_TAGS")&&or($.ADD_DATA_URI_TAGS)?nt(Er(yt),$.ADD_DATA_URI_TAGS,Jt):yt,be=on($,"FORBID_CONTENTS")&&or($.FORBID_CONTENTS)?nt({},$.FORBID_CONTENTS,Jt):Be,ae=on($,"FORBID_TAGS")&&or($.FORBID_TAGS)?nt({},$.FORBID_TAGS,Jt):Er({}),Se=on($,"FORBID_ATTR")&&or($.FORBID_ATTR)?nt({},$.FORBID_ATTR,Jt):Er({}),ue=on($,"USE_PROFILES")?$.USE_PROFILES&&typeof $.USE_PROFILES=="object"?Er($.USE_PROFILES):$.USE_PROFILES:!1,je=$.ALLOW_ARIA_ATTR!==!1,$e=$.ALLOW_DATA_ATTR!==!1,Ie=$.ALLOW_UNKNOWN_PROTOCOLS||!1,Ke=$.ALLOW_SELF_CLOSE_IN_ATTR!==!1,et=$.SAFE_FOR_TEMPLATES||!1,wt=$.SAFE_FOR_XML!==!1,K=$.WHOLE_DOCUMENT||!1,_e=$.RETURN_DOM||!1,At=$.RETURN_DOM_FRAGMENT||!1,qe=$.RETURN_TRUSTED_TYPE||!1,Ce=$.FORCE_BODY||!1,Mn=$.SANITIZE_DOM!==!1,rn=$.SANITIZE_NAMED_PROPS||!1,an=$.KEEP_CONTENT!==!1,ma=$.IN_PLACE||!1,M=MY($.ALLOWED_URI_REGEXP)?$.ALLOWED_URI_REGEXP:WT,ft=typeof $.NAMESPACE=="string"?$.NAMESPACE:It,Ea=on($,"MATHML_TEXT_INTEGRATION_POINTS")&&$.MATHML_TEXT_INTEGRATION_POINTS&&typeof $.MATHML_TEXT_INTEGRATION_POINTS=="object"?Er($.MATHML_TEXT_INTEGRATION_POINTS):nt({},["mi","mo","mn","ms","mtext"]),ir=on($,"HTML_INTEGRATION_POINTS")&&$.HTML_INTEGRATION_POINTS&&typeof $.HTML_INTEGRATION_POINTS=="object"?Er($.HTML_INTEGRATION_POINTS):nt({},["annotation-xml"]);const pe=on($,"CUSTOM_ELEMENT_HANDLING")&&$.CUSTOM_ELEMENT_HANDLING&&typeof $.CUSTOM_ELEMENT_HANDLING=="object"?Er($.CUSTOM_ELEMENT_HANDLING):Jl(null);if(Z=Jl(null),on(pe,"tagNameCheck")&&ya(pe.tagNameCheck)&&(Z.tagNameCheck=pe.tagNameCheck),on(pe,"attributeNameCheck")&&ya(pe.attributeNameCheck)&&(Z.attributeNameCheck=pe.attributeNameCheck),on(pe,"allowCustomizedBuiltInElements")&&typeof pe.allowCustomizedBuiltInElements=="boolean"&&(Z.allowCustomizedBuiltInElements=pe.allowCustomizedBuiltInElements),et&&($e=!1),At&&(_e=!0),ue&&(P=nt({},jj),T=Jl(null),ue.html===!0&&(nt(P,kj),nt(T,Ej)),ue.svg===!0&&(nt(P,Gg),nt(T,Kg),nt(T,Rf)),ue.svgFilters===!0&&(nt(P,Vg),nt(T,Kg),nt(T,Rf)),ue.mathMl===!0&&(nt(P,Qg),nt(T,Cj),nt(T,Rf))),Re.tagCheck=null,Re.attributeCheck=null,on($,"ADD_TAGS")&&(typeof $.ADD_TAGS=="function"?Re.tagCheck=$.ADD_TAGS:or($.ADD_TAGS)&&(P===U&&(P=Er(P)),nt(P,$.ADD_TAGS,Jt))),on($,"ADD_ATTR")&&(typeof $.ADD_ATTR=="function"?Re.attributeCheck=$.ADD_ATTR:or($.ADD_ATTR)&&(T===G&&(T=Er(T)),nt(T,$.ADD_ATTR,Jt))),on($,"ADD_URI_SAFE_ATTR")&&or($.ADD_URI_SAFE_ATTR)&&nt(Nn,$.ADD_URI_SAFE_ATTR,Jt),on($,"FORBID_CONTENTS")&&or($.FORBID_CONTENTS)&&(be===Be&&(be=Er(be)),nt(be,$.FORBID_CONTENTS,Jt)),on($,"ADD_FORBID_CONTENTS")&&or($.ADD_FORBID_CONTENTS)&&(be===Be&&(be=Er(be)),nt(be,$.ADD_FORBID_CONTENTS,Jt)),an&&(P["#text"]=!0),K&&nt(P,["html","head","body"]),P.table&&(nt(P,["tbody"]),delete ae.tbody),$.TRUSTED_TYPES_POLICY){if(typeof $.TRUSTED_TYPES_POLICY.createHTML!="function")throw Af('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof $.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Af('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');z=$.TRUSTED_TYPES_POLICY,I=z.createHTML("")}else z===void 0&&(z=ZY(x,s)),z!==null&&typeof I=="string"&&(I=z.createHTML(""));hr&&hr($),Gr=$},Si=nt({},[...Gg,...Vg,...zY]),wi=nt({},[...Qg,...DY]),ks=function($){let pe=R($);(!pe||!pe.tagName)&&(pe={namespaceURI:ft,tagName:"template"});const Ne=nc($.tagName),jt=nc(pe.tagName);return Un[$.namespaceURI]?$.namespaceURI===Bt?pe.namespaceURI===It?Ne==="svg":pe.namespaceURI===Gt?Ne==="svg"&&(jt==="annotation-xml"||Ea[jt]):!!Si[Ne]:$.namespaceURI===Gt?pe.namespaceURI===It?Ne==="math":pe.namespaceURI===Bt?Ne==="math"&&ir[jt]:!!wi[Ne]:$.namespaceURI===It?pe.namespaceURI===Bt&&!ir[jt]||pe.namespaceURI===Gt&&!Ea[jt]?!1:!wi[Ne]&&(pa[Ne]||!Si[Ne]):!!(Bn==="application/xhtml+xml"&&Un[$.namespaceURI]):!1},zn=function($){Ku(t.removed,{element:$});try{R($).removeChild($)}catch{w($)}},yr=function($,pe){try{Ku(t.removed,{attribute:pe.getAttributeNode($),from:pe})}catch{Ku(t.removed,{attribute:null,from:pe})}if(pe.removeAttribute($),$==="is")if(_e||At)try{zn(pe)}catch{}else try{pe.setAttribute($,"")}catch{}},ki=function($){let pe=null,Ne=null;if(Ce)$="<remove></remove>"+$;else{const en=bj($,/^[\r\n\t ]+/);Ne=en&&en[0]}Bn==="application/xhtml+xml"&&ft===It&&($='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+$+"</body></html>");const jt=z?z.createHTML($):$;if(ft===It)try{pe=new S().parseFromString(jt,Bn)}catch{}if(!pe||!pe.documentElement){pe=O.createDocument(ft,"template",null);try{pe.documentElement.innerHTML=gr?I:jt}catch{}}const vt=pe.body||pe.documentElement;return $&&Ne&&vt.insertBefore(n.createTextNode(Ne),vt.childNodes[0]||null),ft===It?W.call(pe,K?"html":"body")[0]:K?pe.documentElement:vt},ji=function($){return F.call($.ownerDocument||$,$,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},ye=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")},Ge=function($){return typeof f=="function"&&$ instanceof f};function ht(Ue,$,pe){Qu(Ue,Ne=>{Ne.call(t,$,pe,Gr)})}const Fn=function($){let pe=null;if(ht(V.beforeSanitizeElements,$,null),ye($))return zn($),!0;const Ne=Jt($.nodeName);if(ht(V.uponSanitizeElement,$,{tagName:Ne,allowedTags:P}),wt&&$.hasChildNodes()&&!Ge($.firstElementChild)&&Vn(/<[/\w!]/g,$.innerHTML)&&Vn(/<[/\w!]/g,$.textContent)||wt&&$.namespaceURI===It&&Ne==="style"&&Ge($.firstElementChild)||$.nodeType===Xu.progressingInstruction||wt&&$.nodeType===Xu.comment&&Vn(/<[/\w]/g,$.data))return zn($),!0;if(ae[Ne]||!(Re.tagCheck instanceof Function&&Re.tagCheck(Ne))&&!P[Ne]){if(!ae[Ne]&&Qc(Ne)&&(Z.tagNameCheck instanceof RegExp&&Vn(Z.tagNameCheck,Ne)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(Ne)))return!1;if(an&&!be[Ne]){const jt=R($)||$.parentNode,vt=_($)||$.childNodes;if(vt&&jt){const en=vt.length;for(let $n=en-1;$n>=0;--$n){const yn=k(vt[$n],!0);jt.insertBefore(yn,C($))}}}return zn($),!0}return $ instanceof m&&!ks($)||(Ne==="noscript"||Ne==="noembed"||Ne==="noframes")&&Vn(/<\/no(script|embed|frames)/i,$.innerHTML)?(zn($),!0):(et&&$.nodeType===Xu.text&&(pe=$.textContent,Qu([Y,me,te],jt=>{pe=Ql(pe,jt," ")}),$.textContent!==pe&&(Ku(t.removed,{element:$.cloneNode()}),$.textContent=pe)),ht(V.afterSanitizeElements,$,null),!1)},Ua=function($,pe,Ne){if(Se[pe]||Mn&&(pe==="id"||pe==="name")&&(Ne in n||Ne in bi))return!1;const jt=T[pe]||Re.attributeCheck instanceof Function&&Re.attributeCheck(pe,$);if(!($e&&!Se[pe]&&Vn(J,pe))){if(!(je&&Vn(q,pe))){if(!jt||Se[pe]){if(!(Qc($)&&(Z.tagNameCheck instanceof RegExp&&Vn(Z.tagNameCheck,$)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck($))&&(Z.attributeNameCheck instanceof RegExp&&Vn(Z.attributeNameCheck,pe)||Z.attributeNameCheck instanceof Function&&Z.attributeNameCheck(pe,$))||pe==="is"&&Z.allowCustomizedBuiltInElements&&(Z.tagNameCheck instanceof RegExp&&Vn(Z.tagNameCheck,Ne)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(Ne))))return!1}else if(!Nn[pe]){if(!Vn(M,Ql(Ne,ee,""))){if(!((pe==="src"||pe==="xlink:href"||pe==="href")&&$!=="script"&&xj(Ne,"data:")===0&&Xe[$])){if(!(Ie&&!Vn(le,Ql(Ne,ee,"")))){if(Ne)return!1}}}}}}return!0},Ho=nt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Qc=function($){return!Ho[nc($)]&&Vn(ve,$)},qo=function($){ht(V.beforeSanitizeAttributes,$,null);const{attributes:pe}=$;if(!pe||ye($))return;const Ne={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:T,forceKeepAttr:void 0};let jt=pe.length;for(;jt--;){const vt=pe[jt],{name:en,namespaceURI:$n,value:yn}=vt,Dn=Jt(en),Zo=yn;let fn=en==="value"?Zo:NY(Zo);if(Ne.attrName=Dn,Ne.attrValue=fn,Ne.keepAttr=!0,Ne.forceKeepAttr=void 0,ht(V.uponSanitizeAttribute,$,Ne),fn=Ne.attrValue,rn&&(Dn==="id"||Dn==="name")&&xj(fn,La)!==0&&(yr(en,$),fn=La+fn),wt&&Vn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,fn)){yr(en,$);continue}if(Dn==="attributename"&&bj(fn,"href")){yr(en,$);continue}if(Ne.forceKeepAttr)continue;if(!Ne.keepAttr){yr(en,$);continue}if(!Ke&&Vn(/\/>/i,fn)){yr(en,$);continue}et&&Qu([Y,me,te],Kc=>{fn=Ql(fn,Kc," ")});const Go=Jt($.nodeName);if(!Ua(Go,Dn,fn)){yr(en,$);continue}if(z&&typeof x=="object"&&typeof x.getAttributeType=="function"&&!$n)switch(x.getAttributeType(Go,Dn)){case"TrustedHTML":{fn=z.createHTML(fn);break}case"TrustedScriptURL":{fn=z.createScriptURL(fn);break}}if(fn!==Zo)try{$n?$.setAttributeNS($n,en,fn):$.setAttribute(en,fn),ye($)?zn($):vj(t.removed)}catch{yr(en,$)}}ht(V.afterSanitizeAttributes,$,null)},Ei=function($){let pe=null;const Ne=ji($);for(ht(V.beforeSanitizeShadowDOM,$,null);pe=Ne.nextNode();)ht(V.uponSanitizeShadowNode,pe,null),Fn(pe),qo(pe),pe.content instanceof o&&Ei(pe.content);ht(V.afterSanitizeShadowDOM,$,null)};return t.sanitize=function(Ue){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},pe=null,Ne=null,jt=null,vt=null;if(gr=!Ue,gr&&(Ue="<!-->"),typeof Ue!="string"&&!Ge(Ue)&&(Ue=OY(Ue),typeof Ue!="string"))throw Af("dirty is not a string, aborting");if(!t.isSupported)return Ue;if(ge||xi($),t.removed=[],typeof Ue=="string"&&(ma=!1),ma){const yn=Ue.nodeName;if(typeof yn=="string"){const Dn=Jt(yn);if(!P[Dn]||ae[Dn])throw Af("root node is forbidden and cannot be sanitized in-place")}}else if(Ue instanceof f)pe=ki("<!---->"),Ne=pe.ownerDocument.importNode(Ue,!0),Ne.nodeType===Xu.element&&Ne.nodeName==="BODY"||Ne.nodeName==="HTML"?pe=Ne:pe.appendChild(Ne);else{if(!_e&&!et&&!K&&Ue.indexOf("<")===-1)return z&&qe?z.createHTML(Ue):Ue;if(pe=ki(Ue),!pe)return _e?null:qe?I:""}pe&&Ce&&zn(pe.firstChild);const en=ji(ma?Ue:pe);for(;jt=en.nextNode();)Fn(jt),qo(jt),jt.content instanceof o&&Ei(jt.content);if(ma)return Ue;if(_e){if(et){pe.normalize();let yn=pe.innerHTML;Qu([Y,me,te],Dn=>{yn=Ql(yn,Dn," ")}),pe.innerHTML=yn}if(At)for(vt=D.call(pe.ownerDocument);pe.firstChild;)vt.appendChild(pe.firstChild);else vt=pe;return(T.shadowroot||T.shadowrootmode)&&(vt=L.call(a,vt,!0)),vt}let $n=K?pe.outerHTML:pe.innerHTML;return K&&P["!doctype"]&&pe.ownerDocument&&pe.ownerDocument.doctype&&pe.ownerDocument.doctype.name&&Vn(JT,pe.ownerDocument.doctype.name)&&($n="<!DOCTYPE "+pe.ownerDocument.doctype.name+`>
|
|
417
|
-
`+$n),et&&Qu([Y,me,te],yn=>{$n=Ql($n,yn," ")}),z&&qe?z.createHTML($n):$n},t.setConfig=function(){let Ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};xi(Ue),ge=!0},t.clearConfig=function(){Gr=null,ge=!1},t.isValidAttribute=function(Ue,$,pe){Gr||xi({});const Ne=Jt(Ue),jt=Jt($);return Ua(Ne,jt,pe)},t.addHook=function(Ue,$){typeof $=="function"&&Ku(V[Ue],$)},t.removeHook=function(Ue,$){if($!==void 0){const pe=EY(V[Ue],$);return pe===-1?void 0:CY(V[Ue],pe,1)[0]}return vj(V[Ue])},t.removeHooks=function(Ue){V[Ue]=[]},t.removeAllHooks=function(){V=_j()},t}var tA=eA();let Tj=!1;function GY(){Tj||(Tj=!0,tA.addHook("afterSanitizeAttributes",e=>{e.tagName==="A"&&(e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer"))}))}function VY({option:e,previewFormat:t,selected:n,disabled:a,showCheckmark:s,onToggle:o}){const c=b.useMemo(()=>!e.preview||t!=="html"?null:(GY(),tA.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(Lh,{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 ao="__free_text__";function Wu(){return{picked:[],freeText:""}}function Aj(e,t){if(t.picked.includes(ao)){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 QY({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 w={};for(const C of n.questions)w[C.question]=Wu();return w});b.useEffect(()=>{if(!a)return;const w={};for(const C of n.questions){const _=a.answers[C.question];if(!_){w[C.question]=Wu();continue}const R=new Set(C.options.map(O=>O.label)),z=C.multiSelect?_.split(/,\s*/u):[_],I=z.filter(O=>R.has(O));I.length===z.length&&I.length>0?w[C.question]={picked:I,freeText:""}:w[C.question]={picked:[ao],freeText:_}}h(w)},[a,n.questions]);const p=pn(),[g,S]=b.useState(null),x=gt({mutationFn:async w=>SY(e,n.correlationId,w),onSuccess:()=>{S(null),p.invalidateQueries({queryKey:["chat-messages",e]})},onError:w=>{S(w instanceof Error?w.message:String(w))}}),j=b.useCallback(()=>{S(null);const w={};for(const C of n.questions){const _=m[C.question]??Wu(),R=Aj(C,_);if(R===null){S(`Please answer "${C.question}" before submitting.`);return}w[C.question]=R}x.mutate(w)},[n.questions,m,x]),k=b.useMemo(()=>n.questions.every(w=>{const C=m[w.question]??Wu();return Aj(w,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(w=>l.jsx(KY,{question:w,previewFormat:n.previewFormat,selection:m[w.question]??Wu(),allowFreeText:n.allowFreeText,disabled:!o,showAnsweredCheck:c||f,onChange:C=>h(_=>({..._,[w.question]:C}))},w.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(xe,{type:"button",disabled:!k||x.isPending,onClick:j,children:x.isPending?"Submitting…":"Submit answer"})]}):null]})}function KY({question:e,previewFormat:t,selection:n,allowFreeText:a,disabled:s,showAnsweredCheck:o,onChange:c}){const f=b.useRef(null),m=n.picked.includes(ao);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 S;e.multiSelect?S=g?n.picked.filter(x=>x!==p):[...n.picked,p]:S=g?[]:[p],c({...n,picked:S})},[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(VY,{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!==ao):[...n.picked,ao]:m?[]:[ao],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 YY(e){return BF.safeParse(e).success}function nA(e){return FF.safeParse(e).success}function XY(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=Rj(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=Rj(s.payload);return o?a.get(o)===s.seq:!0})}function Rj(e){if(typeof e!="object"||e===null)return;const t=e.toolUseId;return typeof t=="string"?t:void 0}function Fo(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 WY(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function Oj(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return"…"}}function JY({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 eX({event:e}){const t=iD(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?Oj(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:["(",Oj(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:["· ",WY(t.durationMs)]}):null]})]})}function tX({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(Bh,{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:Fo(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 nX({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:Fo(e.createdAt)})]})}function rX({event:e}){const t=sD(e.payload),n=Fo(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 Bh({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(Fc,{width:9,height:10,style:{color:"var(--accent)"}})})}function aX({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(Bh,{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:Fo(e.createdAt)}),l.jsx("span",{style:{marginLeft:"auto"},children:l.jsx(JY,{msg:e,myAgentId:t})})]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg)",marginTop:2},children:e.format==="file"&&iX(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"&&sX(e.content)?l.jsx(lX,{content:e.content}):e.format==="text"?l.jsx(Lh,{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 iX(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 sX(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 lX({content:e}){const[t,n]=b.useState({kind:"loading"});return b.useEffect(()=>{let a=!1;return xY(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 oX({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(Bh,{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:Fo(e.createdAt)})]}),l.jsx(QY,{chatId:t,questionMessageId:e.id,content:n,answer:a,status:s})]})]})}function uX({msg:e,agentNameFn:t}){const n=nA(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(Bh,{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:Fo(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 cX({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(Ov,{className:"h-3.5 w-3.5"})}):null}function Mj({agentId:e,chatId:t,readOnly:n=!1,titleFallback:a,joinAction:s}){var wt;const o=pn(),c=xh(),f=Gv(),{agentId:m}=lt(),[h,p]=b.useState(""),[g,S]=b.useState(0),[x,j]=b.useState([]),[k,w]=b.useState(!1),[C,_]=b.useState(null),R=b.useRef(null),z=b.useRef(null),I=b.useRef(null);KT(z,h);const O=b.useRef(!1),F=b.useRef(new Set);b.useEffect(()=>{O.current=!1},[t]);const{data:D}=Ye({queryKey:["chat-messages",t],queryFn:()=>nY(t,{limit:50}),refetchInterval:5e3}),{data:W}=Ye({queryKey:["session-events",e,t],queryFn:()=>oD(e,t,{limit:200,direction:"desc"}),refetchInterval:5e3}),{data:L}=Ye({queryKey:["chat-detail",t],queryFn:()=>ZT(t),enabled:!!t}),{data:V}=Ye({queryKey:["activity"],queryFn:Pc,refetchInterval:15e3}),Y=gt({mutationFn:K=>To(t,K),onSuccess:()=>{p(""),o.invalidateQueries({queryKey:["chat-messages",t]}),o.invalidateQueries({queryKey:h1(e)})}}),me=b.useCallback(K=>{const Ce=K.filter(qe=>qe.type.startsWith("image/"));if(Ce.length===0)return;const _e=Ce.find(qe=>qe.size>5242880);if(_e){_(`Image too large (${(_e.size/1024/1024).toFixed(1)}MB). Maximum ${5242880/1024/1024}MB per image.`);return}const At=Ce.map(qe=>({id:crypto.randomUUID(),file:qe,previewUrl:URL.createObjectURL(qe)}));j(qe=>[...qe,...At]),_(null)},[]),te=b.useCallback(K=>{j(ge=>{const Ce=ge.find(_e=>_e.id===K);return Ce&&URL.revokeObjectURL(Ce.previewUrl),ge.filter(_e=>_e.id!==K)})},[]),J=async()=>{const K=h.trim(),ge=x;if(!(!K&&ge.length===0)&&!k&&!($e&&Ie.length===0)){if(Ke.length>0)try{await $T(t,{participantIds:Ke}),await o.invalidateQueries({queryKey:["chat-detail",t]})}catch(Ce){_(Ce instanceof Error?Ce.message:"Failed to add participants");return}if(ge.length>0){w(!0),_(null);try{for(const Ce of ge){const _e=await tY(Ce.file),At=crypto.randomUUID();await bY({imageId:At,base64:_e,mimeType:Ce.file.type}),await eY(t,{data:_e,mimeType:Ce.file.type,filename:Ce.file.name,size:Ce.file.size,imageId:At}),URL.revokeObjectURL(Ce.previewUrl)}j([]),K&&await To(t,K),p(""),o.invalidateQueries({queryKey:["chat-messages",t]}),o.invalidateQueries({queryKey:h1(e)})}catch(Ce){_(Ce instanceof Error?Ce.message:"Failed to send image")}finally{w(!1)}return}Y.mutate(K)}},[q,le]=b.useState(!1),[ee,ve]=b.useState(""),M=b.useRef(null);b.useEffect(()=>{var K;q&&((K=M.current)==null||K.focus())},[q]);const P=gt({mutationFn:K=>JK(t,K),onSuccess:()=>{le(!1),o.invalidateQueries({queryKey:["chat-detail",t]}),o.invalidateQueries({queryKey:["agent-sessions",e]}),o.invalidateQueries({queryKey:["session",e,t]})}}),U=()=>{const K=ee.trim();P.mutate(K.length>0?K:null)},T=gt({mutationFn:()=>GT(t,Hy.ACTIVE),onSuccess:()=>{o.invalidateQueries({queryKey:["me","chats"]}),o.invalidateQueries({queryKey:["chat-detail",t]})}}),G=b.useMemo(()=>{const K=(D==null?void 0:D.items)??[],ge=XY((W==null?void 0:W.items)??[]),Ce=[...K.map(_e=>({kind:"message",at:_e.createdAt,key:`m-${_e.id}`,data:_e})),...ge.map(_e=>({kind:"event",at:_e.createdAt,key:`e-${_e.id}`,data:_e}))];return Ce.sort((_e,At)=>_e.at.localeCompare(At.at)),Ce},[D,W]),Z=b.useMemo(()=>{const K=new Map;for(const ge of(D==null?void 0:D.items)??[])ge.format==="question_answer"&&nA(ge.content)&&K.set(ge.content.correlationId,ge.content);return K},[D]),ae=G.length;b.useEffect(()=>{var K;ae>0&&((K=I.current)==null||K.scrollIntoView({behavior:"smooth"}))},[ae]);const Se=c(e),Re=b.useMemo(()=>{var K;return new Set(((K=L==null?void 0:L.participants)==null?void 0:K.map(ge=>ge.agentId))??[])},[L==null?void 0:L.participants]),je=b.useMemo(()=>{const K=new Set;for(const _e of(L==null?void 0:L.participants)??[])K.add(_e.agentId);for(const _e of(V==null?void 0:V.agents)??[])K.add(_e.agentId);K.size===0&&K.add(e);const ge=new Map;for(const _e of(V==null?void 0:V.agents)??[])ge.set(_e.agentId,_e.managedByMe);const Ce=[];for(const _e of K){if(_e===m)continue;const At=f(_e);!At||!At.name||Ce.push({agentId:_e,name:At.name,displayName:At.displayName,managedByMe:ge.get(_e)??!1})}return Ce},[L==null?void 0:L.participants,V==null?void 0:V.agents,e,f,m]),$e=b.useMemo(()=>{if(!L)return!1;if(L.type==="group")return!0;const K=L.participants.some(ge=>ge.agentId===m);return L.type==="direct"&&!K&&L.participants.length>=2},[L,m]);b.useEffect(()=>{if(n||F.current.has(t)||!D||!W||!L||G.length>0||h.length>0||$e||Se===e)return;const K=`Hi ${Se}! What can you help with?`;p(K),S(K.length),F.current.add(t),requestAnimationFrame(()=>{const ge=z.current;ge&&(ge.focus(),ge.setSelectionRange(K.length,K.length))})},[t,e,D,W,L,G.length,h.length,Se,$e,n]);const Ie=b.useMemo(()=>{const K=je.map(ge=>({agentId:ge.agentId,name:ge.name}));return HN(h,K)},[h,je]),Ke=b.useMemo(()=>Re.size===0?[]:Ie.filter(K=>!Re.has(K)),[Ie,Re]),et=VT({value:h,cursor:g,candidates:je,disabled:Y.isPending||k,onSelect:K=>{p(K.text),S(K.cursor),requestAnimationFrame(()=>{const ge=z.current;ge&&(ge.focus(),ge.setSelectionRange(K.cursor,K.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:(L==null?void 0:L.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"})]}):q?l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:M,value:ee,onChange:K=>ve(K.target.value),onKeyDown:K=>{K.nativeEvent.isComposing||(K.key==="Enter"?(K.preventDefault(),U()):K.key==="Escape"&&(K.preventDefault(),le(!1)))},disabled:P.isPending,maxLength:500,placeholder:(L==null?void 0:L.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:U,disabled:P.isPending,title:"Save",className:"inline-flex items-center",style:{color:"var(--accent)",padding:2},children:l.jsx(fr,{className:"h-3.5 w-3.5"})}),l.jsx("button",{type:"button",onClick:()=>le(!1),disabled:P.isPending,title:"Cancel",className:"inline-flex items-center",style:{color:"var(--fg-3)",padding:2},children:l.jsx(ms,{className:"h-3.5 w-3.5"})})]}):l.jsx("button",{type:"button",onClick:()=>{ve((L==null?void 0:L.topic)??""),le(!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:(L==null?void 0:L.title)??"…"}),l.jsx(cX,{metadata:L==null?void 0:L.metadata})]}),l.jsx(dX,{chatId:t,participantIds:((wt=L==null?void 0:L.participants)==null?void 0:wt.map(K=>K.agentId))??[e],candidates:je,agentIdentity:f,onAdded:()=>o.invalidateQueries({queryKey:["chat-detail",t]}),readOnly:n})]})}),(L==null?void 0:L.engagementStatus)===Hy.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(Mv,{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(K=>{if(K.kind==="event"){const Ce=K.data;switch(Ce.kind){case"tool_call":return l.jsx(eX,{event:Ce},K.key);case"assistant_text":return l.jsx(tX,{event:Ce,agentId:e,agentNameFn:c},K.key);case"thinking":return l.jsx(nX,{event:Ce},K.key);case"error":return l.jsx(rX,{event:Ce},K.key);default:return null}}const ge=K.data;if(ge.format==="question"&&YY(ge.content)){const Ce=Z.get(ge.content.correlationId)??null,_e=Ce?"answered":"pending";return l.jsx(oX,{msg:ge,chatId:t,content:ge.content,answer:Ce,status:_e,agentNameFn:c},K.key)}return ge.format==="question_answer"?l.jsx(uX,{msg:ge,agentNameFn:c},K.key):l.jsx(aX,{msg:ge,myAgentId:m,agentNameFn:c},K.key)})}),l.jsx("div",{ref:I})]})}),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($E,{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(xe,{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:K=>K.preventDefault(),onDrop:K=>{K.preventDefault(),me(Array.from(K.dataTransfer.files))},children:[x.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:x.map(K=>l.jsxs("div",{style:{position:"relative",flexShrink:0,borderRadius:4,border:"var(--hairline) solid var(--border)",overflow:"hidden"},children:[l.jsx("img",{src:K.previewUrl,alt:K.file.name,style:{height:32,width:"auto",display:"block",objectFit:"cover"}}),l.jsx("button",{type:"button",onClick:()=>te(K.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(ms,{className:"h-2 w-2"})})]},K.id))}),l.jsxs("div",{style:{position:"relative"},children:[l.jsx(QT,{trigger:et.trigger,results:et.results,highlightIndex:et.highlightIndex,anchorRef:z,onPick:et.pick}),l.jsx("textarea",{ref:z,value:h,onChange:K=>{p(K.target.value),S(K.target.selectionStart??K.target.value.length)},onSelect:K=>{S(K.currentTarget.selectionStart??h.length)},onFocus:()=>{$e&&(O.current||h.length>0||je.length===0||(O.current=!0,p("@"),S(1),requestAnimationFrame(()=>{const K=z.current;K&&K.setSelectionRange(1,1)})))},onPaste:K=>{const ge=Array.from(K.clipboardData.files);ge.length>0&&(K.preventDefault(),me(ge))},placeholder:$e?"Type @ to pick a recipient, then your message":`Message @${Se} · / for commands · @ to mention`,rows:2,onKeyDown:K=>{K.nativeEvent.isComposing||et.handleKey(K)||K.key==="Enter"&&!K.shiftKey&&(K.preventDefault(),J())},disabled:Y.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 K=z.current;if(!K)return;const ge=K.selectionStart??h.length,Ce=K.selectionEnd??ge,_e=`${h.slice(0,ge)}@${h.slice(Ce)}`;p(_e),S(ge+1),requestAnimationFrame(()=>{K.focus(),K.setSelectionRange(ge+1,ge+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(h3,{className:"h-3.5 w-3.5"})}),l.jsx("button",{type:"button",onClick:()=>{var K;return(K=R.current)==null?void 0:K.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(V3,{className:"h-3.5 w-3.5"})}),l.jsx("input",{ref:R,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:K=>{K.target.files&&(me(Array.from(K.target.files)),K.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:J,disabled:Y.isPending||k||!h.trim()&&x.length===0||$e&&Ie.length===0,title:$e&&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",(Y.isPending||k||!h.trim()&&x.length===0||$e&&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(UE,{className:"h-3.5 w-3.5",strokeWidth:2.5})})]})]})]}),(Y.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??(Y.error instanceof Error?Y.error.message:"Failed to send")})]})})})]})}function dX({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=S=>{m.current&&(m.current.contains(S.target)||f(!1))};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[c]);const h=gt({mutationFn:g=>$T(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 S=a(g),x=(S==null?void 0:S.displayName)??(S==null?void 0:S.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:x},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(ka,{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=Ib(p);return Pb(p).map(S=>"divider"in S?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:S.name?`@${S.name}`:void 0,onClick:()=>h.mutate(S.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(Lb,{candidate:S,ambiguous:g})},S.agentId))})()})]})]})}function zj(e,t){return e?e.find(n=>n.chatId===t)??null:null}function fX(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 hX({chatId:e}){const t=pn(),{agentId:n}=lt(),a=b.useRef(new Map),{data:s}=Ye({queryKey:["chat-detail",e],queryFn:()=>ZT(e),enabled:!!e}),{data:o}=Ye({queryKey:["me","chats","all"],queryFn:()=>sh({filter:"all"}),refetchInterval:3e4}),{data:c}=Ye({queryKey:["me","chats","watching"],queryFn:()=>sh({filter:"watching"}),refetchInterval:3e4}),f=b.useMemo(()=>zj(o==null?void 0:o.rows,e)??zj(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(()=>fX(m,n),[m,n]),g=gt({mutationFn:()=>LK(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]})}}).mutate,S=(f==null?void 0:f.lastMessageAt)??"";b.useEffect(()=>{!f||a.current.get(e)===S||(a.current.set(e,S),g())},[e,f,S,g]);const x=gt({mutationFn:()=>PK(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]}),t.invalidateQueries({queryKey:["chat-detail",e]})}}),j=(f==null?void 0:f.membershipKind)==="watching";return h?j?l.jsx(Mj,{agentId:h,chatId:e,readOnly:!0,titleFallback:(f==null?void 0:f.title)??null,joinAction:{onJoin:()=>x.mutate(),joining:x.isPending,error:x.isError?x.error instanceof Error?x.error.message:"Failed to join":null}}):l.jsx(Mj,{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 mX(){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(Fc,{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."})]})})}function pX({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),[S,x]=b.useState(!1),[j,k]=b.useState(null),w=b.useRef(null);b.useEffect(()=>{(async()=>{try{const z=await Ee.get("/me/organizations");a(z)}catch(z){k(z instanceof Error?z.message:"Failed to load your team")}finally{x(!0)}})()},[]),b.useEffect(()=>{var I;const z=((I=n.find(O=>O.id===e))==null?void 0:I.displayName)??"";o(z),f(z)},[n,e]),b.useEffect(()=>{const z=w.current;if(!z||!c)return;z.focus();const I=z.value.length;z.setSelectionRange(I,I)},[c]);const C=s.trim(),_=C.length>0&&!m&&S&&!j,R=b.useCallback(async z=>{if(z==null||z.preventDefault(),!(!_||!e)){g(null);try{C!==c.trim()&&(h(!0),await Ee.patch(`/orgs/${encodeURIComponent(e)}`,{displayName:C}),mi("team_renamed")),t()}catch(I){g(I instanceof Error?I.message:"Failed to rename team")}finally{h(!1)}}},[_,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:w,id:"onboarding-team-name","aria-label":"Team display name",value:s,onChange:z=>o(z.target.value),maxLength:200,disabled:m,className:"text-body",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)",outline:"none",caretColor:"var(--accent)"},onFocus:z=>{z.currentTarget.style.borderColor="var(--accent)"},onBlur:z=>{z.currentTarget.style.borderColor="var(--border)"}})]}),p||j?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 — ${j}. Refresh the page and try again.`}):null,l.jsx("div",{className:"flex justify-end",children:l.jsxs(xe,{type:"submit",disabled:!_,children:[l.jsx("span",{children:"Continue"}),l.jsx(PE,{className:"h-4 w-4"})]})})]})}function Ub(){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 di({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(fr,{className:"h-3 w-3"}):e}),l.jsx("div",{style:{minHeight:"var(--sp-6)",paddingBottom:"var(--sp-1)"},children:n})]})}const gX=3e4,yX=1e3,vX=3e3;function bX(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function xX({organizationId:e,memberId:t,joinPath:n,refreshMe:a}){var $e;const s=An(),{user:o}=lt(),c=ZM(e,t),f=VM(c),m=f!=null&&f.connectToken&&f.connectTokenExpiresAt&&f.connectTokenExpiresAt>Date.now()?f.connectToken:null,h=m?(f==null?void 0:f.connectTokenExpiresAt)??null:null,[p,g]=b.useState(()=>(f==null?void 0:f.displayName)??(o!=null&&o.username?`${o.username}'s assistant`:"Assistant")),[S,x]=b.useState(()=>(f==null?void 0:f.visibility)??"organization"),[j,k]=b.useState(()=>(f==null?void 0:f.selectedRuntime)??null),[w,C]=b.useState(null),[_,R]=b.useState(null),[z,I]=b.useState(null),[O,F]=b.useState(()=>m),[D,W]=b.useState(()=>h),[L,V]=b.useState([]),[Y,me]=b.useState("form"),[te,J]=b.useState(null),q=b.useRef(null),le=b.useRef(null),ee=b.useRef(null),ve=b.useRef(0);b.useEffect(()=>()=>{le.current&&(le.current.cancelled=!0)},[]),b.useEffect(()=>{QM(c,{displayName:p,selectedRuntime:j,connectToken:O,connectTokenExpiresAt:D,visibility:S})},[c,p,j,O,D,S]),b.useEffect(()=>{(async()=>{try{const Ie=await Ee.get("/me/organizations");V(Ie)}catch{}})()},[]),b.useEffect(()=>{if(Y!=="form")return;let Ie=!1;const Ke=async()=>{const wt=++ve.current;try{const K=await pi();if(Ie||wt!==ve.current)return;const Ce=K.filter(_e=>_e.status==="connected").sort((_e,At)=>At.lastSeenAt.localeCompare(_e.lastSeenAt))[0]??null;if(C(_e=>(_e==null?void 0:_e.id)===(Ce==null?void 0:Ce.id)?_e:Ce),Ce){ee.current!==Ce.id&&(ee.current=null,I(null),R(null));try{const _e=await ph(Ce.id);if(Ie||wt!==ve.current)return;ee.current=Ce.id,I(Ce.id),R(_e.capabilities)}catch{}}else ee.current=null,I(null),R(null)}catch{}};Ke();const et=setInterval(Ke,vX);return()=>{Ie=!0,clearInterval(et)}},[Y]),b.useEffect(()=>{if(w)return;if(O&&D&&D>Date.now()){const Ke=Math.max(D-Date.now(),0),et=window.setTimeout(()=>{F(null),W(null)},Ke);return()=>window.clearTimeout(et)}O&&(F(null),W(null));let Ie=!1;return(async()=>{try{const Ke=await Ee.post("/me/connect-tokens",{});Ie||(F(Ke.token),W(Date.now()+Ke.expiresIn*1e3))}catch(Ke){Ie||J(Ke instanceof Error?Ke.message:"Failed to generate connect token")}})(),()=>{Ie=!0}},[w,O,D]);const M=w&&z===w.id?_:null;b.useEffect(()=>{k(Ie=>{var et;if(!M)return Ie;const Ke=SX(M);return Ie&&Ke&&Object.keys(M).includes(Ie)&&((et=M[Ie])==null?void 0:et.state)==="ok"?Ie:Ke})},[M]);const P=M?Object.entries(M).filter(([,Ie])=>Ie.state==="ok").map(([Ie])=>Ie):[],U=(($e=L.find(Ie=>Ie.id===e))==null?void 0:$e.displayName)??"",T=p.trim(),G=T||"your agent",Z=O?`npm install -g @agent-team-foundation/first-tree-hub
|
|
418
|
-
first-tree-hub connect ${O}`:null,ae=b.useCallback(async Ie=>{le.current&&(le.current.cancelled=!0);const Ke={cancelled:!1};le.current=Ke;const et=Date.now();for(;!Ke.cancelled;){let wt=!1;try{const K=await Ee.get(`/agents/${encodeURIComponent(Ie)}/client-status`);if(Ke.cancelled)return;wt=K.online===!0}catch{if(Ke.cancelled)return}if(wt){KM(c);try{await a()}catch{}if(Ke.cancelled)return;s("/",{replace:!0});return}if(Date.now()-et>gX){Ke.cancelled||me("timeout");return}await new Promise(K=>setTimeout(K,yX))}},[c,a,s]),Se=!!(T&&w&&j&&P.includes(j)&&Y==="form"),Re=b.useCallback(async()=>{if(!w||!j||!T)return;J(null),me("creating");const Ie=av(T);let Ke;try{Ke=(await Ee.post(gn("/agents"),{type:"personal_assistant",displayName:T,...Ie?{name:Ie}:{},clientId:w.id,runtimeProvider:j,visibility:S,...e?{organizationId:e}:{}})).uuid,q.current=Ke,HM(Ke),mi("agent_created",{runtimeProvider:j})}catch(et){J(et instanceof Error?et.message:"Failed to create agent"),me("form");return}await ae(Ke)},[T,w,j,S,ae,e]),je=b.useCallback(async()=>{const Ie=q.current;Ie&&(J(null),me("creating"),await ae(Ie))},[ae]);return Y==="creating"?l.jsx(TX,{nameOrFallback:G}):Y==="timeout"?l.jsx(AX,{nameOrFallback:G,hostname:(w==null?void 0:w.hostname)??null,error:te,onRetry:je}):l.jsx(wX,{joinPath:n,teamName:U,displayName:p,setDisplayName:g,trimmedName:T,connectedClient:w,cliCommand:Z,capabilitiesLoaded:M!==null,okRuntimes:P,selectedRuntime:j,setSelectedRuntime:k,visibility:S,setVisibility:x,error:te,canCreate:Se,onCreate:Re})}function SX(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 wX({joinPath:e,teamName:t,displayName:n,setDisplayName:a,trimmedName:s,connectedClient:o,cliCommand:c,capabilitiesLoaded:f,okRuntimes:m,selectedRuntime:h,setSelectedRuntime:p,visibility:g,setVisibility:S,error:x,canCreate:j,onCreate:k}){const w=b.useRef(null),C=e==="invite"&&t,_=!!o&&!!h&&f&&m.includes(h),R=f&&m.length===0&&!!o,z=s?o?R?"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 I;s||(I=w.current)==null||I.focus()},[s]),l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:C?l.jsxs(l.Fragment,{children:["You've joined"," ",l.jsx("span",{className:"font-semibold",style:{color:"var(--fg-2)"},children:t}),". Let's set up your first agent."]}):l.jsx(l.Fragment,{children:"Let's set up your first agent."})}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[l.jsx(Ub,{}),l.jsx(di,{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:w,id:"onboarding-name","aria-label":"Agent display name",value:n,onChange:I=>a(I.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:I=>{I.currentTarget.style.borderBottomColor="var(--accent)"},onBlur:I=>{I.currentTarget.style.borderBottomColor="var(--border-faint)"}})]})}),l.jsx(di,{number:"02",state:_?"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(NX,{hostname:o.hostname??o.id}),l.jsx(EX,{runtimes:m,selected:h,onSelect:p,capabilitiesLoaded:f})]}):l.jsxs(l.Fragment,{children:[l.jsx(kX,{command:c}),l.jsx(jX,{})]})]}):null]})}),l.jsx(di,{number:"03",state:_?"active":"idle",children:l.jsxs("div",{style:{animation:_?"subtle-fade 200ms ease-out":void 0},children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{color:_?"var(--fg)":"var(--fg-4)",fontWeight:_?600:500},children:"Pick who can use it"}),_?l.jsx(CX,{value:g,onChange:S}):null]})})]}),x&&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:x}),s&&l.jsxs("div",{style:{marginTop:j?"var(--sp-4)":"var(--sp-5)",marginLeft:"calc(var(--sp-5) + var(--sp-3))",animation:"subtle-fade 180ms ease-out"},children:[!j&&l.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-4)"},children:z}),j&&l.jsxs(xe,{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:k,onMouseEnter:I=>{I.currentTarget.style.transform="scale(1.01)",I.currentTarget.style.boxShadow="var(--shadow-md)"},onMouseLeave:I=>{I.currentTarget.style.transform="scale(1)",I.currentTarget.style.boxShadow="var(--shadow-md)"},children:[l.jsxs("span",{children:["Create ",s]}),l.jsx(PE,{className:"h-4 w-4"})]}),l.jsx("p",{className:"text-caption",style:{margin:j?"var(--sp-2) 0 0":"var(--sp-0_5) 0 0",color:"var(--fg-4)"},children:"You can customize this agent after setup."})]})]})}function kX({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(xe,{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(fr,{className:"h-3.5 w-3.5"}):l.jsx(Rv,{className:"h-3.5 w-3.5"}),t?"Copied":"Copy"]})]})})}function jX(){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(_X,{}),l.jsx("span",{children:"Waiting for your computer…"})]})}function EX({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)"}})}),bX(s)]},s)})]})]})}function CX({value:e,onChange:t}){const n=[{value:"organization",title:"Shared with team",description:"Anyone in your org can @mention and chat with this agent."},{value:"private",title:"Private to you",description:"Only you can see this agent and chat with it. Others on the team won't see it listed."}];return l.jsxs("fieldset",{className:"flex flex-col",style:{gap:"var(--sp-2)",margin:"var(--sp-2) 0 0",padding:0,border:0},children:[l.jsx("legend",{className:"sr-only",children:"Agent visibility"}),n.map(a=>{const s=e===a.value;return l.jsxs("label",{className:"text-body",style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",background:s?"color-mix(in oklch, var(--accent) 8%, var(--bg))":"var(--bg)",border:s?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",cursor:"pointer",color:s?"var(--fg)":"var(--fg-2)",transition:"background 120ms ease, border-color 120ms ease"},children:[l.jsx("input",{type:"radio",name:"onboarding-visibility",value:a.value,checked:s,onChange:()=>t(a.value),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)",marginTop:"var(--sp-0_5)",borderRadius:"50%",border:s?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-strong)",background:s?"color-mix(in oklch, var(--accent) 8%, transparent)":"transparent",flexShrink:0,transition:"border-color 160ms ease, background 160ms ease"},children:s&&l.jsx("span",{style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--accent)"}})}),l.jsxs("span",{className:"flex flex-col",style:{gap:"var(--sp-0_5)",minWidth:0},children:[l.jsx("span",{className:"font-medium",style:{color:s?"var(--fg)":"var(--fg-2)"},children:a.title}),l.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:a.description})]})]},a.value)})]})}function NX({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(fr,{className:"h-3.5 w-3.5"}),l.jsxs("span",{children:[l.jsx("span",{className:"mono font-semibold",children:e})," connected"]})]})}function _X(){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 TX({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(RX,{}),l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Usually takes ~10 seconds"})]})}function AX({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(xe,{onClick:a,children:"Try again"})})]})}function RX(){return l.jsxs("span",{className:"flex items-center",style:{gap:6},children:[l.jsx(Yg,{delayMs:0}),l.jsx(Yg,{delayMs:160}),l.jsx(Yg,{delayMs:320})]})}function Yg({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 rA(){return(await Ee.get("/me/github/repos")).repos}const aA="https://github.com/agent-team-foundation/first-tree";function iA(e){return e.length===1?[`Source repo: ${e[0]}`]:["Source repos:",...e.map(t=>`- ${t}`)]}function Bb(e,t){const n=iA(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: ${aA}`].join(`
|
|
420
|
-
`)}function OX(e){const t=iA(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: ${aA}`].join(`
|
|
421
|
-
`)}function MX(){const{role:e}=lt();return e==="admin"?l.jsx(BX,{}):l.jsx(zX,{})}function zX(){var f,m;const{organizationId:e}=lt(),[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([zb(e),UT(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(IX,{});if(t.kind==="error")return l.jsx(DX,{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(LX,{treeUrl:o,teamRepos:c}):o?l.jsx(PX,{treeUrl:o}):l.jsx(UX,{})}function DX({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(xe,{type:"button",onClick:t,children:"Try again"})})]})}function IX(){return l.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)"},children:"Checking your team's setup…"})}function LX({treeUrl:e,teamRepos:t}){var w;const n=An(),{dismissOnboarding:a,markOnboardingCompleted:s}=lt(),{addToast:o}=$c(),[c,f]=b.useState(!1),[m,h]=b.useState(null),[p,g]=b.useState(()=>t.map(C=>C.url)),S=p.length>0,x=b.useCallback(C=>{g(_=>_.includes(C)?_.filter(R=>R!==C):[..._,C])},[]),j=b.useCallback(async()=>{if(p.length!==0){f(!0),h(null);try{const C=await Fb(),_=await bc(C.uuid);await Rh(C.uuid,{expectedVersion:_.version,payload:{gitRepos:p.map(I=>({url:I}))}});const R=await Db(C.uuid),z=Bb(p,e);try{await To(R.id,z)}catch{}mi("tree_chat_started",{agentUuid:C.uuid,chatId:R.id,treeMode:"existing",joinPath:"invite"}),a(),s(),n(`/?c=${encodeURIComponent(R.id)}`,{replace:!1})}catch(C){h(C instanceof Error?C.message:"Failed to start the chat"),f(!1)}}},[p,e,n,a,s]),k=b.useCallback(()=>{mi("tree_intro_dismissed",{joinPath:"invite"}),a(),o($b(n))},[a,o,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(ov,{label:"Tree",value:e}),t.length===1?l.jsx(ov,{label:"Source repo",value:((w=t[0])==null?void 0:w.url)??""}):l.jsxs("fieldset",{disabled:c,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(C=>{const _=p.includes(C.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:_?"color-mix(in oklch, var(--accent) 8%, var(--bg))":"var(--bg)",border:_?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",cursor:c?"not-allowed":"pointer",color:_?"var(--fg)":"var(--fg-2)",fontWeight:_?600:400},children:[l.jsx("input",{type:"checkbox",value:C.url,checked:_,onChange:()=>x(C.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:_?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border)",borderRadius:"var(--radius-chip)",background:_?"var(--accent)":"transparent",color:"var(--bg)",transition:"background 120ms ease, border-color 120ms ease"},children:_?l.jsx(fr,{className:"h-3 w-3",strokeWidth:3}):null}),l.jsx("span",{className:"mono truncate",style:{minWidth:0,flex:1},children:C.url})]},C.url)})]}),m?l.jsx(Hb,{children:m}):null,l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)"},children:[l.jsx(xe,{type:"button",disabled:!S||c,onClick:()=>void j(),children:c?"Starting…":"Confirm"}),l.jsx(xe,{type:"button",variant:"outline",onClick:k,disabled:c,children:"I'll do it later"})]})]})]})}function PX({treeUrl:e}){const t=An(),{dismissOnboarding:n,markOnboardingCompleted:a}=lt(),{addToast:s}=$c(),[o,c]=b.useState(!1),[f,m]=b.useState(null),[h,p]=b.useState(null),[g,S]=b.useState(null),[x,j]=b.useState([]),k=x.length>0,w=b.useCallback(R=>{j(z=>z.includes(R)?z.filter(I=>I!==R):[...z,R])},[]);b.useEffect(()=>{let R=!1;return(async()=>{try{const z=await rA();if(R)return;p(z)}catch(z){R||S(z instanceof Error?z.message:"Failed to list GitHub repositories")}})(),()=>{R=!0}},[]);const C=b.useCallback(async()=>{if(x.length!==0){c(!0),m(null);try{const R=await Fb(),z=await bc(R.uuid);await Rh(R.uuid,{expectedVersion:z.version,payload:{gitRepos:x.map(F=>({url:F}))}});const I=await Db(R.uuid),O=Bb(x,e);try{await To(I.id,O)}catch{}mi("tree_chat_started",{agentUuid:R.uuid,chatId:I.id,treeMode:"existing",joinPath:"invite"}),n(),a(),t(`/?c=${encodeURIComponent(I.id)}`,{replace:!1})}catch(R){m(R instanceof Error?R.message:"Failed to start the chat"),c(!1)}}},[x,e,t,n,a]),_=b.useCallback(()=>{mi("tree_intro_dismissed",{joinPath:"invite"}),n(),s($b(t))},[n,s,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(Ub,{}),l.jsx(di,{number:"01",state:"complete",children:l.jsx(ov,{label:"Tree",value:e})}),l.jsx(di,{number:"02",state:k?"complete":"active",children:l.jsx(sA,{disabled:o,repos:h,error:g,selectedRepoUrls:x,onToggle:w})}),l.jsxs(di,{number:"03",state:k?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:k?"var(--fg)":"var(--fg-4)",fontWeight:k?600:500},children:"Let your agent join the tree"}),k?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."]}),f?l.jsx(Hb,{style:{marginTop:"var(--sp-3)"},children:f}):null,l.jsxs("div",{className:"flex",style:{marginTop:"var(--sp-3)",gap:"var(--sp-2)"},children:[l.jsx(xe,{type:"button",disabled:!k||o,onClick:()=>void C(),children:o?"Starting…":"Continue"}),l.jsx(xe,{type:"button",variant:"outline",onClick:_,disabled:o,children:"I'll do it later"})]})]}):null]})]})]})}function UX(){const{dismissOnboarding:e}=lt(),{addToast:t}=$c(),n=b.useRef(!1);return b.useEffect(()=>{n.current||(n.current=!0,mi("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 BX(){const e=An(),{dismissOnboarding:t,markOnboardingCompleted:n,organizationId:a}=lt(),{addToast:s}=$c(),[o,c]=b.useState(!1),[f,m]=b.useState(null),[h,p]=b.useState(null),[g,S]=b.useState(""),[x,j]=b.useState([]),[k,w]=b.useState(null),[C,_]=b.useState(null),R=b.useCallback(V=>{j(Y=>Y.includes(V)?Y.filter(me=>me!==V):[...Y,V])},[]);b.useEffect(()=>{let V=!1;return(async()=>{try{const Y=await rA();if(V)return;w(Y)}catch(Y){V||_(Y instanceof Error?Y.message:"Failed to list GitHub repositories")}})(),()=>{V=!0}},[]),b.useEffect(()=>{if(!a)return;let V=!1;return(async()=>{try{const Y=await zb(a);if(V)return;Y.repo&&(S(Y.repo),p(me=>me??"existing"))}catch{}})(),()=>{V=!0}},[a]);const z=g.trim(),I=(()=>{if(h!=="existing")return!0;if(!z)return!1;try{return new URL(z).protocol==="https:"}catch{return!1}})(),O=b.useCallback(()=>{mi("tree_intro_dismissed"),t(),s($b(e))},[t,s,e]),F=b.useCallback(async()=>{if(x.length!==0&&h&&!(h==="existing"&&!I)){m(null),c(!0);try{const V=await Fb(),Y=await bc(V.uuid),me=x.map(q=>({url:q}));if(await Rh(V.uuid,{expectedVersion:Y.version,payload:{gitRepos:me}}),a)try{await BT(a,{repos:me})}catch(q){console.warn("Step 3: PUT source_repos failed; agent gitRepos already saved",q)}if(h==="existing"&&a)try{await PT(a,{repo:z})}catch(q){console.warn("Step 3: PUT context_tree settings failed; agent will still proceed",q),s({title:"Tree binding wasn't saved to Hub yet",description:"Your agent will still proceed. You can re-bind from Team Settings later."})}const te=await Db(V.uuid),J=h==="existing"?Bb(x,z):OX(x);try{await To(te.id,J)}catch{}mi("tree_chat_started",{agentUuid:V.uuid,chatId:te.id,treeMode:h}),t(),n(),e(`/?c=${encodeURIComponent(te.id)}`,{replace:!1})}catch(V){m(V instanceof Error?V.message:"Failed to start the tree-init chat"),c(!1)}}},[x,h,I,z,a,e,t,n,s]),D=x.length>0,W=D&&h!==null&&!o&&(h==="new"||I),L=!!h&&(h==="new"||I);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(Ub,{}),l.jsx(di,{number:"01",state:D?"complete":"active",children:l.jsx(sA,{disabled:o,repos:k,error:C,selectedRepoUrls:x,onToggle:R})}),l.jsxs(di,{number:"02",state:L?"complete":D?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:D?"var(--fg)":"var(--fg-4)",fontWeight:D?600:500},children:"Bind or create the tree"}),D?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:o,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(V=>{const Y=h===V.value;return l.jsxs("label",{className:"text-body transition-colors",style:{padding:"var(--sp-1_5) var(--sp-3)",background:Y?"var(--bg)":"transparent",borderRadius:"calc(var(--radius-input) - var(--sp-0_5))",color:Y?"var(--fg)":"var(--fg-3)",fontWeight:Y?600:400,boxShadow:Y?"var(--shadow-sm)":"none",cursor:o?"not-allowed":"pointer",userSelect:"none"},children:[l.jsx("input",{type:"radio",name:"tree-mode",value:V.value,checked:Y,onChange:()=>p(V.value),className:"sr-only"}),V.label]},V.value)})]}),h==="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:g,onChange:V=>S(V.target.value),placeholder:"https://github.com/your-org/your-tree",disabled:o,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,h==="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(di,{number:"03",state:L?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:L?"var(--fg)":"var(--fg-4)",fontWeight:L?600:500},children:"Let your agent build it"}),L?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","."]}),f?l.jsx(Hb,{style:{marginTop:"var(--sp-3)"},children:f}):null,l.jsxs("div",{className:"flex",style:{marginTop:"var(--sp-3)",gap:"var(--sp-2)"},children:[l.jsx(xe,{type:"button",disabled:!W,onClick:()=>void F(),children:o?"Starting…":"Continue"}),l.jsx(xe,{type:"button",variant:"outline",onClick:O,disabled:o,children:"I'll do it later"})]})]}):null]})]})]})}async function Fb(){const e=$M(),t=await Zv(),n=t.filter(s=>s.type!=="human"),a=(e?t.find(s=>s.uuid===e):void 0)??n.slice().sort((s,o)=>o.uuid.localeCompare(s.uuid))[0]??t[0];if(!a)throw new Error("No agent available to chat with — finish Step 2 first.");return a}function $b(e){return{title:"Setup hidden",description:"Your agent isn't bound to a source repo yet. Resume from Settings → Onboarding any time to finish.",action:{label:"Resume setup",onClick:()=>e("/settings/onboarding")}}}function ov({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 Hb({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 sA({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(xe,{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(FX,{repos:t,selectedRepoUrls:a,onToggle:s})]})}function FX({repos:e,selectedRepoUrls:t,onToggle:n}){const[a,s]=b.useState(!1),o=b.useRef(null);b.useEffect(()=>{if(!a)return;const p=S=>{o.current&&!o.current.contains(S.target)&&s(!1)},g=S=>{S.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 S=g.fullName.split("/")[0]??"",x=p.get(S);x?x.push(g):p.set(S,[g])}return[...p.entries()].sort(([g],[S])=>g.localeCompare(S))},[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($X,{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(Av,{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],S)=>l.jsxs("div",{children:[l.jsx("div",{className:"text-eyebrow",style:{paddingTop:S>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(x=>{const j=f.has(x.cloneUrl),k=x.fullName.slice(p.length+1);return l.jsxs("button",{type:"button",role:"option","aria-selected":j,onClick:()=>n(x.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:j?"var(--accent-bg)":"transparent",color:j?"var(--accent)":"var(--fg)",border:"none",cursor:"pointer",textAlign:"left"},onMouseEnter:w=>{j||(w.currentTarget.style.background="var(--surface-1)")},onMouseLeave:w=>{j||(w.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:j?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border)",borderRadius:"var(--radius-chip)",background:j?"var(--accent)":"transparent",color:"var(--bg)",transition:"background 120ms ease, border-color 120ms ease"},children:j?l.jsx(fr,{className:"h-3 w-3",strokeWidth:3}):null}),l.jsx("span",{className:"truncate",style:{minWidth:0,flex:1},children:k}),x.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"})]},x.cloneUrl)})]},p))})]})}function $X({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(ms,{className:"h-3 w-3"})})]})}function HX(){const{onboardingStep:e,refreshMe:t,organizationId:n,memberId:a,role:s}=lt(),[o,c]=fh(),f=o.get("step"),[m]=b.useState(()=>DE()),[h,p]=b.useState(()=>ME()),g=b.useCallback(k=>{FM(k),p(k)},[]),S=s==="admin",x=b.useMemo(()=>f==="team"&&S?"step1":f==="agent"?"step2":f==="tree"||e==="completed"?"step3-intro":e==="connect"&&!h&&m!=="invite"&&S?"step1":"step2",[f,e,h,m,S]),j=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:x==="step1"?l.jsx(pX,{organizationId:n,onContinue:j}):x==="step2"?l.jsx(xX,{organizationId:n,memberId:a,joinPath:m,refreshMe:t}):l.jsx(MX,{})})})}function qX({selectedChatId:e,onSelectChat:t}){const{onboardingStep:n,onboardingDismissedAt:a}=lt();return e===lh?l.jsx(mY,{onCreated:t}):e?l.jsx(hX,{chatId:e}):n!==null&&!a?l.jsx(HX,{}):l.jsx(mX,{})}const ZX={1:"Name your team",2:"Set up your agent",3:"Build your context-tree"};function GX(){const{onboardingStep:e,onboardingDismissedAt:t,dismissOnboarding:n}=lt(),{addToast:a}=$c(),s=An(),[o,c]=fh(),f=o.get("c"),m=o.get("step"),h=ME(),g=DE()==="invite",S=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 x=e==="completed",j=()=>{n(),a({title:"Setup hidden",description:"Resume any time in Settings → Onboarding.",action:{label:"Open settings",onClick:()=>s("/settings/onboarding")}})},k={1:Xg(1,S,e),2:Xg(2,S,e),3:Xg(3,S,e)},w=C=>{if(C!==3)return;const _=new URLSearchParams(o);_.delete("c"),_.set("step","tree"),c(_,{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,_)=>{const R=k[C],z=[1,2,3][_+1],I=z?Dj(R)&&Dj(k[z]):!1;return l.jsxs("li",{className:"flex items-center",style:{minWidth:0},children:[l.jsx(VX,{index:C,state:R,label:ZX[C],onClick:C===3&&R==="active"?()=>w(C):void 0}),z?l.jsx(KX,{solid:I}):null]},C)})}),l.jsx("button",{type:"button",onClick:j,disabled:!x,title:x?"Hide setup steps":"Finish setting up your agent first","aria-label":"Hide setup steps",className:x?"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:x?"var(--fg-2)":"var(--fg-4)",fontSize:14,lineHeight:1,opacity:x?1:.5},onMouseEnter:C=>{x&&(C.currentTarget.style.background="var(--surface-2)")},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},children:"✕"})]})}function Xg(e,t,n){return e===t?"active":e===1||e===2&&n==="completed"?"completed":"pending"}function Dj(e){return e==="active"||e==="completed"}function VX({index:e,state:t,label:n,onClick:a}){const s=!!a,o=QX(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 QX(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 KX({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 YX=i_.catch("active");function XX(){const[e,t]=fh(),n=e.get("c"),a=e.get("a"),s=YX.parse(e.get("engagement"));p_(),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",lh),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(uY,{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(GX,{}),l.jsx(qX,{selectedChatId:n,onSelectChat:o})]})]})}const WX=new XR({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});function JX(){return l.jsx(WR,{client:WX,children:l.jsx(WM,{children:l.jsx(s5,{children:l.jsx(NM,{children:l.jsxs(nM,{children:[l.jsx(Pt,{path:"/login",element:l.jsx(cQ,{})}),l.jsx(Pt,{path:"/signup",element:l.jsx(Jn,{to:"/login",replace:!0})}),l.jsx(Pt,{path:"/auth/github/complete",element:l.jsx(dQ,{})}),l.jsx(Pt,{path:"/invite/:token",element:l.jsx(sQ,{})}),null,null,l.jsx(Pt,{element:l.jsx(r3,{}),children:l.jsxs(Pt,{element:l.jsx(JF,{children:l.jsx(a5,{})}),children:[l.jsx(Pt,{index:!0,element:l.jsx(XX,{})}),l.jsx(Pt,{path:"context",element:l.jsx(bV,{})}),l.jsx(Pt,{path:"agents/:uuid",element:l.jsx(OG,{})}),l.jsx(Pt,{path:"team",element:l.jsx(bK,{})}),l.jsxs(Pt,{path:"settings",element:l.jsx(XQ,{}),children:[l.jsx(Pt,{index:!0,element:l.jsx(Jn,{to:"computers",replace:!0})}),l.jsx(Pt,{path:"team",element:l.jsx(DK,{})}),l.jsx(Pt,{path:"computers",element:l.jsx(EQ,{})}),l.jsx(Pt,{path:"github",element:l.jsx(OQ,{})}),l.jsx(Pt,{path:"integrations",element:l.jsx(QQ,{})}),l.jsx(Pt,{path:"onboarding",element:l.jsx(KQ,{})}),l.jsx(Pt,{path:"setup",element:l.jsx(Jn,{to:"/settings/onboarding",replace:!0})})]}),l.jsx(Pt,{path:"agents",element:l.jsx(Jn,{to:"/team",replace:!0})}),l.jsx(Pt,{path:"clients",element:l.jsx(Jn,{to:"/settings/computers",replace:!0})}),l.jsx(Pt,{path:"integrations",element:l.jsx(Jn,{to:"/settings/integrations",replace:!0})}),l.jsx(Pt,{path:"team/members",element:l.jsx(Jn,{to:"/team",replace:!0})}),l.jsx(Pt,{path:"team/agents",element:l.jsx(Jn,{to:"/team",replace:!0})}),l.jsx(Pt,{path:"team/invite",element:l.jsx(Jn,{to:"/team",replace:!0})}),l.jsx(Pt,{path:"team/settings",element:l.jsx(Jn,{to:"/settings/team",replace:!0})}),l.jsx(Pt,{path:"admin",element:l.jsx(eW,{})})]})})]})})})})})}function eW(){const e=Ar();return e.hash==="#bindings"?l.jsx(Jn,{to:`/settings/integrations${e.search}`,replace:!0}):l.jsx(Jn,{to:`/team${e.hash}`,replace:!0})}const lA=document.getElementById("root");if(!lA)throw new Error("Root element not found");ER.createRoot(lA).render(l.jsx(b.StrictMode,{children:l.jsx(JX,{})}));export{PE as A,Fc as F,Lc as L,GE as U,at as c,l as j,b as r};
|