@curie-agent/daemon 0.4.4 → 0.4.5
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/package.json +7 -7
- package/web/dist/assets/WikiGraphView-D6dbFm1b.js +5398 -0
- package/web/dist/assets/index-BBZdB_CX.css +1 -0
- package/web/dist/assets/index-CDqUB0fl.js +212 -0
- package/web/dist/index.html +2 -2
- package/web/dist/assets/index-BNHnn_LR.js +0 -234
- package/web/dist/assets/index-ulOOFddN.css +0 -1
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
var V0=Object.defineProperty;var Q0=(e,t,n)=>t in e?V0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ye=(e,t,n)=>Q0(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))a(l);new MutationObserver(l=>{for(const s of l)if(s.type==="childList")for(const r of s.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&a(r)}).observe(document,{childList:!0,subtree:!0});function n(l){const s={};return l.integrity&&(s.integrity=l.integrity),l.referrerPolicy&&(s.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?s.credentials="include":l.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function a(l){if(l.ep)return;l.ep=!0;const s=n(l);fetch(l.href,s)}})();function K0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nx={exports:{}},_c={};/**
|
|
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 J0=Symbol.for("react.transitional.element"),W0=Symbol.for("react.fragment");function ax(e,t,n){var a=null;if(n!==void 0&&(a=""+n),t.key!==void 0&&(a=""+t.key),"key"in t){n={};for(var l in t)l!=="key"&&(n[l]=t[l])}else n=t;return t=n.ref,{$$typeof:J0,type:e,key:a,ref:t!==void 0?t:null,props:n}}_c.Fragment=W0;_c.jsx=ax;_c.jsxs=ax;nx.exports=_c;var i=nx.exports,lx={exports:{}},ue={};/**
|
|
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 ff=Symbol.for("react.transitional.element"),F0=Symbol.for("react.portal"),P0=Symbol.for("react.fragment"),e1=Symbol.for("react.strict_mode"),t1=Symbol.for("react.profiler"),n1=Symbol.for("react.consumer"),a1=Symbol.for("react.context"),l1=Symbol.for("react.forward_ref"),s1=Symbol.for("react.suspense"),r1=Symbol.for("react.memo"),sx=Symbol.for("react.lazy"),i1=Symbol.for("react.activity"),np=Symbol.iterator;function o1(e){return e===null||typeof e!="object"?null:(e=np&&e[np]||e["@@iterator"],typeof e=="function"?e:null)}var rx={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ix=Object.assign,ox={};function Vs(e,t,n){this.props=e,this.context=t,this.refs=ox,this.updater=n||rx}Vs.prototype.isReactComponent={};Vs.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};Vs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function cx(){}cx.prototype=Vs.prototype;function hf(e,t,n){this.props=e,this.context=t,this.refs=ox,this.updater=n||rx}var pf=hf.prototype=new cx;pf.constructor=hf;ix(pf,Vs.prototype);pf.isPureReactComponent=!0;var ap=Array.isArray;function ld(){}var He={H:null,A:null,T:null,S:null},ux=Object.prototype.hasOwnProperty;function mf(e,t,n){var a=n.ref;return{$$typeof:ff,type:e,key:t,ref:a!==void 0?a:null,props:n}}function c1(e,t){return mf(e.type,t,e.props)}function gf(e){return typeof e=="object"&&e!==null&&e.$$typeof===ff}function u1(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var lp=/\/+/g;function su(e,t){return typeof e=="object"&&e!==null&&e.key!=null?u1(""+e.key):t.toString(36)}function d1(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(ld,ld):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function ls(e,t,n,a,l){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var r=!1;if(e===null)r=!0;else switch(s){case"bigint":case"string":case"number":r=!0;break;case"object":switch(e.$$typeof){case ff:case F0:r=!0;break;case sx:return r=e._init,ls(r(e._payload),t,n,a,l)}}if(r)return l=l(e),r=a===""?"."+su(e,0):a,ap(l)?(n="",r!=null&&(n=r.replace(lp,"$&/")+"/"),ls(l,t,n,"",function(u){return u})):l!=null&&(gf(l)&&(l=c1(l,n+(l.key==null||e&&e.key===l.key?"":(""+l.key).replace(lp,"$&/")+"/")+r)),t.push(l)),1;r=0;var o=a===""?".":a+":";if(ap(e))for(var c=0;c<e.length;c++)a=e[c],s=o+su(a,c),r+=ls(a,t,n,s,l);else if(c=o1(e),typeof c=="function")for(e=c.call(e),c=0;!(a=e.next()).done;)a=a.value,s=o+su(a,c++),r+=ls(a,t,n,s,l);else if(s==="object"){if(typeof e.then=="function")return ls(d1(e),t,n,a,l);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return r}function Yi(e,t,n){if(e==null)return e;var a=[],l=0;return ls(e,a,"","",function(s){return t.call(n,s,l++)}),a}function f1(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var sp=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},h1={map:Yi,forEach:function(e,t,n){Yi(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Yi(e,function(){t++}),t},toArray:function(e){return Yi(e,function(t){return t})||[]},only:function(e){if(!gf(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ue.Activity=i1;ue.Children=h1;ue.Component=Vs;ue.Fragment=P0;ue.Profiler=t1;ue.PureComponent=hf;ue.StrictMode=e1;ue.Suspense=s1;ue.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=He;ue.__COMPILER_RUNTIME={__proto__:null,c:function(e){return He.H.useMemoCache(e)}};ue.cache=function(e){return function(){return e.apply(null,arguments)}};ue.cacheSignal=function(){return null};ue.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var a=ix({},e.props),l=e.key;if(t!=null)for(s in t.key!==void 0&&(l=""+t.key),t)!ux.call(t,s)||s==="key"||s==="__self"||s==="__source"||s==="ref"&&t.ref===void 0||(a[s]=t[s]);var s=arguments.length-2;if(s===1)a.children=n;else if(1<s){for(var r=Array(s),o=0;o<s;o++)r[o]=arguments[o+2];a.children=r}return mf(e.type,l,a)};ue.createContext=function(e){return e={$$typeof:a1,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:n1,_context:e},e};ue.createElement=function(e,t,n){var a,l={},s=null;if(t!=null)for(a in t.key!==void 0&&(s=""+t.key),t)ux.call(t,a)&&a!=="key"&&a!=="__self"&&a!=="__source"&&(l[a]=t[a]);var r=arguments.length-2;if(r===1)l.children=n;else if(1<r){for(var o=Array(r),c=0;c<r;c++)o[c]=arguments[c+2];l.children=o}if(e&&e.defaultProps)for(a in r=e.defaultProps,r)l[a]===void 0&&(l[a]=r[a]);return mf(e,s,l)};ue.createRef=function(){return{current:null}};ue.forwardRef=function(e){return{$$typeof:l1,render:e}};ue.isValidElement=gf;ue.lazy=function(e){return{$$typeof:sx,_payload:{_status:-1,_result:e},_init:f1}};ue.memo=function(e,t){return{$$typeof:r1,type:e,compare:t===void 0?null:t}};ue.startTransition=function(e){var t=He.T,n={};He.T=n;try{var a=e(),l=He.S;l!==null&&l(n,a),typeof a=="object"&&a!==null&&typeof a.then=="function"&&a.then(ld,sp)}catch(s){sp(s)}finally{t!==null&&n.types!==null&&(t.types=n.types),He.T=t}};ue.unstable_useCacheRefresh=function(){return He.H.useCacheRefresh()};ue.use=function(e){return He.H.use(e)};ue.useActionState=function(e,t,n){return He.H.useActionState(e,t,n)};ue.useCallback=function(e,t){return He.H.useCallback(e,t)};ue.useContext=function(e){return He.H.useContext(e)};ue.useDebugValue=function(){};ue.useDeferredValue=function(e,t){return He.H.useDeferredValue(e,t)};ue.useEffect=function(e,t){return He.H.useEffect(e,t)};ue.useEffectEvent=function(e){return He.H.useEffectEvent(e)};ue.useId=function(){return He.H.useId()};ue.useImperativeHandle=function(e,t,n){return He.H.useImperativeHandle(e,t,n)};ue.useInsertionEffect=function(e,t){return He.H.useInsertionEffect(e,t)};ue.useLayoutEffect=function(e,t){return He.H.useLayoutEffect(e,t)};ue.useMemo=function(e,t){return He.H.useMemo(e,t)};ue.useOptimistic=function(e,t){return He.H.useOptimistic(e,t)};ue.useReducer=function(e,t,n){return He.H.useReducer(e,t,n)};ue.useRef=function(e){return He.H.useRef(e)};ue.useState=function(e){return He.H.useState(e)};ue.useSyncExternalStore=function(e,t,n){return He.H.useSyncExternalStore(e,t,n)};ue.useTransition=function(){return He.H.useTransition()};ue.version="19.2.6";lx.exports=ue;var m=lx.exports;const Ie=K0(m);var dx={exports:{}},Nc={},fx={exports:{}},hx={};/**
|
|
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
|
+
*/(function(e){function t(C,M){var V=C.length;C.push(M);e:for(;0<V;){var J=V-1>>>1,ne=C[J];if(0<l(ne,M))C[J]=M,C[V]=ne,V=J;else break e}}function n(C){return C.length===0?null:C[0]}function a(C){if(C.length===0)return null;var M=C[0],V=C.pop();if(V!==M){C[0]=V;e:for(var J=0,ne=C.length,Se=ne>>>1;J<Se;){var le=2*(J+1)-1,B=C[le],w=le+1,Z=C[w];if(0>l(B,V))w<ne&&0>l(Z,B)?(C[J]=Z,C[w]=V,J=w):(C[J]=B,C[le]=V,J=le);else if(w<ne&&0>l(Z,V))C[J]=Z,C[w]=V,J=w;else break e}}return M}function l(C,M){var V=C.sortIndex-M.sortIndex;return V!==0?V:C.id-M.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var r=Date,o=r.now();e.unstable_now=function(){return r.now()-o}}var c=[],u=[],d=1,f=null,h=3,p=!1,v=!1,j=!1,k=!1,g=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;function y(C){for(var M=n(u);M!==null;){if(M.callback===null)a(u);else if(M.startTime<=C)a(u),M.sortIndex=M.expirationTime,t(c,M);else break;M=n(u)}}function T(C){if(j=!1,y(C),!v)if(n(c)!==null)v=!0,_||(_=!0,K());else{var M=n(u);M!==null&&A(T,M.startTime-C)}}var _=!1,E=-1,D=5,O=-1;function R(){return k?!0:!(e.unstable_now()-O<D)}function X(){if(k=!1,_){var C=e.unstable_now();O=C;var M=!0;try{e:{v=!1,j&&(j=!1,x(E),E=-1),p=!0;var V=h;try{t:{for(y(C),f=n(c);f!==null&&!(f.expirationTime>C&&R());){var J=f.callback;if(typeof J=="function"){f.callback=null,h=f.priorityLevel;var ne=J(f.expirationTime<=C);if(C=e.unstable_now(),typeof ne=="function"){f.callback=ne,y(C),M=!0;break t}f===n(c)&&a(c),y(C)}else a(c);f=n(c)}if(f!==null)M=!0;else{var Se=n(u);Se!==null&&A(T,Se.startTime-C),M=!1}}break e}finally{f=null,h=V,p=!1}M=void 0}}finally{M?K():_=!1}}}var K;if(typeof b=="function")K=function(){b(X)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,z=P.port2;P.port1.onmessage=X,K=function(){z.postMessage(null)}}else K=function(){g(X,0)};function A(C,M){E=g(function(){C(e.unstable_now())},M)}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(C){C.callback=null},e.unstable_forceFrameRate=function(C){0>C||125<C?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<C?Math.floor(1e3/C):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_next=function(C){switch(h){case 1:case 2:case 3:var M=3;break;default:M=h}var V=h;h=M;try{return C()}finally{h=V}},e.unstable_requestPaint=function(){k=!0},e.unstable_runWithPriority=function(C,M){switch(C){case 1:case 2:case 3:case 4:case 5:break;default:C=3}var V=h;h=C;try{return M()}finally{h=V}},e.unstable_scheduleCallback=function(C,M,V){var J=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?J+V:J):V=J,C){case 1:var ne=-1;break;case 2:ne=250;break;case 5:ne=1073741823;break;case 4:ne=1e4;break;default:ne=5e3}return ne=V+ne,C={id:d++,callback:M,priorityLevel:C,startTime:V,expirationTime:ne,sortIndex:-1},V>J?(C.sortIndex=V,t(u,C),n(c)===null&&C===n(u)&&(j?(x(E),E=-1):j=!0,A(T,V-J))):(C.sortIndex=ne,t(c,C),v||p||(v=!0,_||(_=!0,K()))),C},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(C){var M=h;return function(){var V=h;h=M;try{return C.apply(this,arguments)}finally{h=V}}}})(hx);fx.exports=hx;var p1=fx.exports,px={exports:{}},$t={};/**
|
|
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 m1=m;function mx(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function $a(){}var Lt={d:{f:$a,r:function(){throw Error(mx(522))},D:$a,C:$a,L:$a,m:$a,X:$a,S:$a,M:$a},p:0,findDOMNode:null},g1=Symbol.for("react.portal");function x1(e,t,n){var a=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:g1,key:a==null?null:""+a,children:e,containerInfo:t,implementation:n}}var Rr=m1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Tc(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}$t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Lt;$t.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(mx(299));return x1(e,t,null,n)};$t.flushSync=function(e){var t=Rr.T,n=Lt.p;try{if(Rr.T=null,Lt.p=2,e)return e()}finally{Rr.T=t,Lt.p=n,Lt.d.f()}};$t.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Lt.d.C(e,t))};$t.prefetchDNS=function(e){typeof e=="string"&&Lt.d.D(e)};$t.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,a=Tc(n,t.crossOrigin),l=typeof t.integrity=="string"?t.integrity:void 0,s=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Lt.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:a,integrity:l,fetchPriority:s}):n==="script"&&Lt.d.X(e,{crossOrigin:a,integrity:l,fetchPriority:s,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};$t.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Tc(t.as,t.crossOrigin);Lt.d.M(e,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&Lt.d.M(e)};$t.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,a=Tc(n,t.crossOrigin);Lt.d.L(e,n,{crossOrigin:a,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};$t.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Tc(t.as,t.crossOrigin);Lt.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else Lt.d.m(e)};$t.requestFormReset=function(e){Lt.d.r(e)};$t.unstable_batchedUpdates=function(e,t){return e(t)};$t.useFormState=function(e,t,n){return Rr.H.useFormState(e,t,n)};$t.useFormStatus=function(){return Rr.H.useHostTransitionStatus()};$t.version="19.2.6";function gx(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(gx)}catch(e){console.error(e)}}gx(),px.exports=$t;var Cl=px.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 ft=p1,xx=m,y1=Cl;function U(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function yx(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function gi(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function bx(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function vx(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function rp(e){if(gi(e)!==e)throw Error(U(188))}function b1(e){var t=e.alternate;if(!t){if(t=gi(e),t===null)throw Error(U(188));return t!==e?null:e}for(var n=e,a=t;;){var l=n.return;if(l===null)break;var s=l.alternate;if(s===null){if(a=l.return,a!==null){n=a;continue}break}if(l.child===s.child){for(s=l.child;s;){if(s===n)return rp(l),e;if(s===a)return rp(l),t;s=s.sibling}throw Error(U(188))}if(n.return!==a.return)n=l,a=s;else{for(var r=!1,o=l.child;o;){if(o===n){r=!0,n=l,a=s;break}if(o===a){r=!0,a=l,n=s;break}o=o.sibling}if(!r){for(o=s.child;o;){if(o===n){r=!0,n=s,a=l;break}if(o===a){r=!0,a=s,n=l;break}o=o.sibling}if(!r)throw Error(U(189))}}if(n.alternate!==a)throw Error(U(190))}if(n.tag!==3)throw Error(U(188));return n.stateNode.current===n?e:t}function Sx(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=Sx(e),t!==null)return t;e=e.sibling}return null}var qe=Object.assign,v1=Symbol.for("react.element"),Ii=Symbol.for("react.transitional.element"),Tr=Symbol.for("react.portal"),os=Symbol.for("react.fragment"),wx=Symbol.for("react.strict_mode"),sd=Symbol.for("react.profiler"),jx=Symbol.for("react.consumer"),ma=Symbol.for("react.context"),xf=Symbol.for("react.forward_ref"),rd=Symbol.for("react.suspense"),id=Symbol.for("react.suspense_list"),yf=Symbol.for("react.memo"),Ha=Symbol.for("react.lazy"),od=Symbol.for("react.activity"),S1=Symbol.for("react.memo_cache_sentinel"),ip=Symbol.iterator;function mr(e){return e===null||typeof e!="object"?null:(e=ip&&e[ip]||e["@@iterator"],typeof e=="function"?e:null)}var w1=Symbol.for("react.client.reference");function cd(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===w1?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case os:return"Fragment";case sd:return"Profiler";case wx:return"StrictMode";case rd:return"Suspense";case id:return"SuspenseList";case od:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case Tr:return"Portal";case ma:return e.displayName||"Context";case jx:return(e._context.displayName||"Context")+".Consumer";case xf:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case yf:return t=e.displayName||null,t!==null?t:cd(e.type)||"Memo";case Ha:t=e._payload,e=e._init;try{return cd(e(t))}catch{}}return null}var Er=Array.isArray,se=xx.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ke=y1.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ol={pending:!1,data:null,method:null,action:null},ud=[],cs=-1;function na(e){return{current:e}}function gt(e){0>cs||(e.current=ud[cs],ud[cs]=null,cs--)}function Le(e,t){cs++,ud[cs]=e.current,e.current=t}var ea=na(null),Fr=na(null),Pa=na(null),$o=na(null);function Uo(e,t){switch(Le(Pa,t),Le(Fr,e),Le(ea,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?hm(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=hm(t),e=Gb(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}gt(ea),Le(ea,e)}function Ms(){gt(ea),gt(Fr),gt(Pa)}function dd(e){e.memoizedState!==null&&Le($o,e);var t=ea.current,n=Gb(t,e.type);t!==n&&(Le(Fr,e),Le(ea,n))}function Bo(e){Fr.current===e&&(gt(ea),gt(Fr)),$o.current===e&&(gt($o),ci._currentValue=Ol)}var ru,op;function _l(e){if(ru===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);ru=t&&t[1]||"",op=-1<n.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+ru+e+op}var iu=!1;function ou(e,t){if(!e||iu)return"";iu=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var f=function(){throw Error()};if(Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(p){var h=p}Reflect.construct(e,[],f)}else{try{f.call()}catch(p){h=p}e.call(f.prototype)}}else{try{throw Error()}catch(p){h=p}(f=e())&&typeof f.catch=="function"&&f.catch(function(){})}}catch(p){if(p&&h&&typeof p.stack=="string")return[p.stack,h.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var l=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");l&&l.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var s=a.DetermineComponentFrameRoot(),r=s[0],o=s[1];if(r&&o){var c=r.split(`
|
|
44
|
+
`),u=o.split(`
|
|
45
|
+
`);for(l=a=0;a<c.length&&!c[a].includes("DetermineComponentFrameRoot");)a++;for(;l<u.length&&!u[l].includes("DetermineComponentFrameRoot");)l++;if(a===c.length||l===u.length)for(a=c.length-1,l=u.length-1;1<=a&&0<=l&&c[a]!==u[l];)l--;for(;1<=a&&0<=l;a--,l--)if(c[a]!==u[l]){if(a!==1||l!==1)do if(a--,l--,0>l||c[a]!==u[l]){var d=`
|
|
46
|
+
`+c[a].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),d}while(1<=a&&0<=l);break}}}finally{iu=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?_l(n):""}function j1(e,t){switch(e.tag){case 26:case 27:case 5:return _l(e.type);case 16:return _l("Lazy");case 13:return e.child!==t&&t!==null?_l("Suspense Fallback"):_l("Suspense");case 19:return _l("SuspenseList");case 0:case 15:return ou(e.type,!1);case 11:return ou(e.type.render,!1);case 1:return ou(e.type,!0);case 31:return _l("Activity");default:return""}}function cp(e){try{var t="",n=null;do t+=j1(e,n),n=e,e=e.return;while(e);return t}catch(a){return`
|
|
47
|
+
Error generating stack: `+a.message+`
|
|
48
|
+
`+a.stack}}var fd=Object.prototype.hasOwnProperty,bf=ft.unstable_scheduleCallback,cu=ft.unstable_cancelCallback,k1=ft.unstable_shouldYield,_1=ft.unstable_requestPaint,fn=ft.unstable_now,N1=ft.unstable_getCurrentPriorityLevel,kx=ft.unstable_ImmediatePriority,_x=ft.unstable_UserBlockingPriority,Zo=ft.unstable_NormalPriority,T1=ft.unstable_LowPriority,Nx=ft.unstable_IdlePriority,E1=ft.log,A1=ft.unstable_setDisableYieldValue,xi=null,hn=null;function Qa(e){if(typeof E1=="function"&&A1(e),hn&&typeof hn.setStrictMode=="function")try{hn.setStrictMode(xi,e)}catch{}}var pn=Math.clz32?Math.clz32:O1,z1=Math.log,C1=Math.LN2;function O1(e){return e>>>=0,e===0?32:31-(z1(e)/C1|0)|0}var Xi=256,Vi=262144,Qi=4194304;function Nl(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ec(e,t,n){var a=e.pendingLanes;if(a===0)return 0;var l=0,s=e.suspendedLanes,r=e.pingedLanes;e=e.warmLanes;var o=a&134217727;return o!==0?(a=o&~s,a!==0?l=Nl(a):(r&=o,r!==0?l=Nl(r):n||(n=o&~e,n!==0&&(l=Nl(n))))):(o=a&~s,o!==0?l=Nl(o):r!==0?l=Nl(r):n||(n=a&~e,n!==0&&(l=Nl(n)))),l===0?0:t!==0&&t!==l&&!(t&s)&&(s=l&-l,n=t&-t,s>=n||s===32&&(n&4194048)!==0)?t:l}function yi(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function D1(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 Tx(){var e=Qi;return Qi<<=1,!(Qi&62914560)&&(Qi=4194304),e}function uu(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function bi(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function M1(e,t,n,a,l,s){var r=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var o=e.entanglements,c=e.expirationTimes,u=e.hiddenUpdates;for(n=r&~n;0<n;){var d=31-pn(n),f=1<<d;o[d]=0,c[d]=-1;var h=u[d];if(h!==null)for(u[d]=null,d=0;d<h.length;d++){var p=h[d];p!==null&&(p.lane&=-536870913)}n&=~f}a!==0&&Ex(e,a,0),s!==0&&l===0&&e.tag!==0&&(e.suspendedLanes|=s&~(r&~t))}function Ex(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-pn(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|n&261930}function Ax(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var a=31-pn(n),l=1<<a;l&t|e[a]&t&&(e[a]|=t),n&=~l}}function zx(e,t){var n=t&-t;return n=n&42?1:vf(n),n&(e.suspendedLanes|t)?0:n}function vf(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Sf(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Cx(){var e=ke.p;return e!==0?e:(e=window.event,e===void 0?32:ev(e.type))}function up(e,t){var n=ke.p;try{return ke.p=e,t()}finally{ke.p=n}}var hl=Math.random().toString(36).slice(2),vt="__reactFiber$"+hl,Ft="__reactProps$"+hl,Qs="__reactContainer$"+hl,hd="__reactEvents$"+hl,R1="__reactListeners$"+hl,L1="__reactHandles$"+hl,dp="__reactResources$"+hl,vi="__reactMarker$"+hl;function wf(e){delete e[vt],delete e[Ft],delete e[hd],delete e[R1],delete e[L1]}function us(e){var t=e[vt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Qs]||n[vt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=ym(e);e!==null;){if(n=e[vt])return n;e=ym(e)}return t}e=n,n=e.parentNode}return null}function Ks(e){if(e=e[vt]||e[Qs]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ar(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(U(33))}function js(e){var t=e[dp];return t||(t=e[dp]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function mt(e){e[vi]=!0}var Ox=new Set,Dx={};function Gl(e,t){Rs(e,t),Rs(e+"Capture",t)}function Rs(e,t){for(Dx[e]=t,e=0;e<t.length;e++)Ox.add(t[e])}var $1=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]*$"),fp={},hp={};function U1(e){return fd.call(hp,e)?!0:fd.call(fp,e)?!1:$1.test(e)?hp[e]=!0:(fp[e]=!0,!1)}function vo(e,t,n){if(U1(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var a=t.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function Ki(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function ra(e,t,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+a)}}function jn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Mx(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function B1(e,t,n){var a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var l=a.get,s=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(r){n=""+r,s.call(this,r)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return n},setValue:function(r){n=""+r},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function pd(e){if(!e._valueTracker){var t=Mx(e)?"checked":"value";e._valueTracker=B1(e,t,""+e[t])}}function Rx(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),a="";return e&&(a=Mx(e)?e.checked?"true":"false":e.value),e=a,e!==n?(t.setValue(e),!0):!1}function Ho(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Z1=/[\n"\\]/g;function Nn(e){return e.replace(Z1,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function md(e,t,n,a,l,s,r,o){e.name="",r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"?e.type=r:e.removeAttribute("type"),t!=null?r==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+jn(t)):e.value!==""+jn(t)&&(e.value=""+jn(t)):r!=="submit"&&r!=="reset"||e.removeAttribute("value"),t!=null?gd(e,r,jn(t)):n!=null?gd(e,r,jn(n)):a!=null&&e.removeAttribute("value"),l==null&&s!=null&&(e.defaultChecked=!!s),l!=null&&(e.checked=l&&typeof l!="function"&&typeof l!="symbol"),o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.name=""+jn(o):e.removeAttribute("name")}function Lx(e,t,n,a,l,s,r,o){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.type=s),t!=null||n!=null){if(!(s!=="submit"&&s!=="reset"||t!=null)){pd(e);return}n=n!=null?""+jn(n):"",t=t!=null?""+jn(t):n,o||t===e.value||(e.value=t),e.defaultValue=t}a=a??l,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=o?e.checked:!!a,e.defaultChecked=!!a,r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(e.name=r),pd(e)}function gd(e,t,n){t==="number"&&Ho(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function ks(e,t,n,a){if(e=e.options,t){t={};for(var l=0;l<n.length;l++)t["$"+n[l]]=!0;for(n=0;n<e.length;n++)l=t.hasOwnProperty("$"+e[n].value),e[n].selected!==l&&(e[n].selected=l),l&&a&&(e[n].defaultSelected=!0)}else{for(n=""+jn(n),t=null,l=0;l<e.length;l++){if(e[l].value===n){e[l].selected=!0,a&&(e[l].defaultSelected=!0);return}t!==null||e[l].disabled||(t=e[l])}t!==null&&(t.selected=!0)}}function $x(e,t,n){if(t!=null&&(t=""+jn(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+jn(n):""}function Ux(e,t,n,a){if(t==null){if(a!=null){if(n!=null)throw Error(U(92));if(Er(a)){if(1<a.length)throw Error(U(93));a=a[0]}n=a}n==null&&(n=""),t=n}n=jn(t),e.defaultValue=n,a=e.textContent,a===n&&a!==""&&a!==null&&(e.value=a),pd(e)}function Ls(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var H1=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 pp(e,t,n){var a=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?a?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":a?e.setProperty(t,n):typeof n!="number"||n===0||H1.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Bx(e,t,n){if(t!=null&&typeof t!="object")throw Error(U(62));if(e=e.style,n!=null){for(var a in n)!n.hasOwnProperty(a)||t!=null&&t.hasOwnProperty(a)||(a.indexOf("--")===0?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="");for(var l in t)a=t[l],t.hasOwnProperty(l)&&n[l]!==a&&pp(e,l,a)}else for(var s in t)t.hasOwnProperty(s)&&pp(e,s,t[s])}function jf(e){if(e.indexOf("-")===-1)return!1;switch(e){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 q1=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"]]),G1=/^[\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 So(e){return G1.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ga(){}var xd=null;function kf(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ds=null,_s=null;function mp(e){var t=Ks(e);if(t&&(e=t.stateNode)){var n=e[Ft]||null;e:switch(e=t.stateNode,t.type){case"input":if(md(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Nn(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var a=n[t];if(a!==e&&a.form===e.form){var l=a[Ft]||null;if(!l)throw Error(U(90));md(a,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name)}}for(t=0;t<n.length;t++)a=n[t],a.form===e.form&&Rx(a)}break e;case"textarea":$x(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&ks(e,!!n.multiple,t,!1)}}}var du=!1;function Zx(e,t,n){if(du)return e(t,n);du=!0;try{var a=e(t);return a}finally{if(du=!1,(ds!==null||_s!==null)&&(Zc(),ds&&(t=ds,e=_s,_s=ds=null,mp(t),e)))for(t=0;t<e.length;t++)mp(e[t])}}function Pr(e,t){var n=e.stateNode;if(n===null)return null;var a=n[Ft]||null;if(a===null)return null;n=a[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(a=!a.disabled)||(e=e.type,a=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!a;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(U(231,t,typeof n));return n}var wa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yd=!1;if(wa)try{var gr={};Object.defineProperty(gr,"passive",{get:function(){yd=!0}}),window.addEventListener("test",gr,gr),window.removeEventListener("test",gr,gr)}catch{yd=!1}var Ka=null,_f=null,wo=null;function Hx(){if(wo)return wo;var e,t=_f,n=t.length,a,l="value"in Ka?Ka.value:Ka.textContent,s=l.length;for(e=0;e<n&&t[e]===l[e];e++);var r=n-e;for(a=1;a<=r&&t[n-a]===l[s-a];a++);return wo=l.slice(e,1<a?1-a:void 0)}function jo(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Ji(){return!0}function gp(){return!1}function Pt(e){function t(n,a,l,s,r){this._reactName=n,this._targetInst=l,this.type=a,this.nativeEvent=s,this.target=r,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(n=e[o],this[o]=n?n(s):s[o]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Ji:gp,this.isPropagationStopped=gp,this}return qe(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Ji)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ji)},persist:function(){},isPersistent:Ji}),t}var Yl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ac=Pt(Yl),Si=qe({},Yl,{view:0,detail:0}),Y1=Pt(Si),fu,hu,xr,zc=qe({},Si,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Nf,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==xr&&(xr&&e.type==="mousemove"?(fu=e.screenX-xr.screenX,hu=e.screenY-xr.screenY):hu=fu=0,xr=e),fu)},movementY:function(e){return"movementY"in e?e.movementY:hu}}),xp=Pt(zc),I1=qe({},zc,{dataTransfer:0}),X1=Pt(I1),V1=qe({},Si,{relatedTarget:0}),pu=Pt(V1),Q1=qe({},Yl,{animationName:0,elapsedTime:0,pseudoElement:0}),K1=Pt(Q1),J1=qe({},Yl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),W1=Pt(J1),F1=qe({},Yl,{data:0}),yp=Pt(F1),P1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},e2={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"},t2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function n2(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=t2[e])?!!t[e]:!1}function Nf(){return n2}var a2=qe({},Si,{key:function(e){if(e.key){var t=P1[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=jo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?e2[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Nf,charCode:function(e){return e.type==="keypress"?jo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?jo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),l2=Pt(a2),s2=qe({},zc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),bp=Pt(s2),r2=qe({},Si,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Nf}),i2=Pt(r2),o2=qe({},Yl,{propertyName:0,elapsedTime:0,pseudoElement:0}),c2=Pt(o2),u2=qe({},zc,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),d2=Pt(u2),f2=qe({},Yl,{newState:0,oldState:0}),h2=Pt(f2),p2=[9,13,27,32],Tf=wa&&"CompositionEvent"in window,Lr=null;wa&&"documentMode"in document&&(Lr=document.documentMode);var m2=wa&&"TextEvent"in window&&!Lr,qx=wa&&(!Tf||Lr&&8<Lr&&11>=Lr),vp=" ",Sp=!1;function Gx(e,t){switch(e){case"keyup":return p2.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yx(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var fs=!1;function g2(e,t){switch(e){case"compositionend":return Yx(t);case"keypress":return t.which!==32?null:(Sp=!0,vp);case"textInput":return e=t.data,e===vp&&Sp?null:e;default:return null}}function x2(e,t){if(fs)return e==="compositionend"||!Tf&&Gx(e,t)?(e=Hx(),wo=_f=Ka=null,fs=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return qx&&t.locale!=="ko"?null:t.data;default:return null}}var y2={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 wp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!y2[e.type]:t==="textarea"}function Ix(e,t,n,a){ds?_s?_s.push(a):_s=[a]:ds=a,t=sc(t,"onChange"),0<t.length&&(n=new Ac("onChange","change",null,n,a),e.push({event:n,listeners:t}))}var $r=null,ei=null;function b2(e){Zb(e,0)}function Cc(e){var t=Ar(e);if(Rx(t))return e}function jp(e,t){if(e==="change")return t}var Xx=!1;if(wa){var mu;if(wa){var gu="oninput"in document;if(!gu){var kp=document.createElement("div");kp.setAttribute("oninput","return;"),gu=typeof kp.oninput=="function"}mu=gu}else mu=!1;Xx=mu&&(!document.documentMode||9<document.documentMode)}function _p(){$r&&($r.detachEvent("onpropertychange",Vx),ei=$r=null)}function Vx(e){if(e.propertyName==="value"&&Cc(ei)){var t=[];Ix(t,ei,e,kf(e)),Zx(b2,t)}}function v2(e,t,n){e==="focusin"?(_p(),$r=t,ei=n,$r.attachEvent("onpropertychange",Vx)):e==="focusout"&&_p()}function S2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Cc(ei)}function w2(e,t){if(e==="click")return Cc(t)}function j2(e,t){if(e==="input"||e==="change")return Cc(t)}function k2(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var gn=typeof Object.is=="function"?Object.is:k2;function ti(e,t){if(gn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;for(a=0;a<n.length;a++){var l=n[a];if(!fd.call(t,l)||!gn(e[l],t[l]))return!1}return!0}function Np(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Tp(e,t){var n=Np(e);e=0;for(var a;n;){if(n.nodeType===3){if(a=e+n.textContent.length,e<=t&&a>=t)return{node:n,offset:t-e};e=a}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Np(n)}}function Qx(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Qx(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Kx(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ho(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ho(e.document)}return t}function Ef(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var _2=wa&&"documentMode"in document&&11>=document.documentMode,hs=null,bd=null,Ur=null,vd=!1;function Ep(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;vd||hs==null||hs!==Ho(a)||(a=hs,"selectionStart"in a&&Ef(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Ur&&ti(Ur,a)||(Ur=a,a=sc(bd,"onSelect"),0<a.length&&(t=new Ac("onSelect","select",null,t,n),e.push({event:t,listeners:a}),t.target=hs)))}function wl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ps={animationend:wl("Animation","AnimationEnd"),animationiteration:wl("Animation","AnimationIteration"),animationstart:wl("Animation","AnimationStart"),transitionrun:wl("Transition","TransitionRun"),transitionstart:wl("Transition","TransitionStart"),transitioncancel:wl("Transition","TransitionCancel"),transitionend:wl("Transition","TransitionEnd")},xu={},Jx={};wa&&(Jx=document.createElement("div").style,"AnimationEvent"in window||(delete ps.animationend.animation,delete ps.animationiteration.animation,delete ps.animationstart.animation),"TransitionEvent"in window||delete ps.transitionend.transition);function Il(e){if(xu[e])return xu[e];if(!ps[e])return e;var t=ps[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Jx)return xu[e]=t[n];return e}var Wx=Il("animationend"),Fx=Il("animationiteration"),Px=Il("animationstart"),N2=Il("transitionrun"),T2=Il("transitionstart"),E2=Il("transitioncancel"),ey=Il("transitionend"),ty=new Map,Sd="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(" ");Sd.push("scrollEnd");function Xn(e,t){ty.set(e,t),Gl(t,[e])}var qo=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Sn=[],ms=0,Af=0;function Oc(){for(var e=ms,t=Af=ms=0;t<e;){var n=Sn[t];Sn[t++]=null;var a=Sn[t];Sn[t++]=null;var l=Sn[t];Sn[t++]=null;var s=Sn[t];if(Sn[t++]=null,a!==null&&l!==null){var r=a.pending;r===null?l.next=l:(l.next=r.next,r.next=l),a.pending=l}s!==0&&ny(n,l,s)}}function Dc(e,t,n,a){Sn[ms++]=e,Sn[ms++]=t,Sn[ms++]=n,Sn[ms++]=a,Af|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function zf(e,t,n,a){return Dc(e,t,n,a),Go(e)}function Xl(e,t){return Dc(e,null,null,t),Go(e)}function ny(e,t,n){e.lanes|=n;var a=e.alternate;a!==null&&(a.lanes|=n);for(var l=!1,s=e.return;s!==null;)s.childLanes|=n,a=s.alternate,a!==null&&(a.childLanes|=n),s.tag===22&&(e=s.stateNode,e===null||e._visibility&1||(l=!0)),e=s,s=s.return;return e.tag===3?(s=e.stateNode,l&&t!==null&&(l=31-pn(n),e=s.hiddenUpdates,a=e[l],a===null?e[l]=[t]:a.push(t),t.lane=n|536870912),s):null}function Go(e){if(50<Vr)throw Vr=0,qd=null,Error(U(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var gs={};function A2(e,t,n,a){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function cn(e,t,n,a){return new A2(e,t,n,a)}function Cf(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ya(e,t){var n=e.alternate;return n===null?(n=cn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ay(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ko(e,t,n,a,l,s){var r=0;if(a=e,typeof e=="function")Cf(e)&&(r=1);else if(typeof e=="string")r=MS(e,n,ea.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case od:return e=cn(31,n,t,l),e.elementType=od,e.lanes=s,e;case os:return Dl(n.children,l,s,t);case wx:r=8,l|=24;break;case sd:return e=cn(12,n,t,l|2),e.elementType=sd,e.lanes=s,e;case rd:return e=cn(13,n,t,l),e.elementType=rd,e.lanes=s,e;case id:return e=cn(19,n,t,l),e.elementType=id,e.lanes=s,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ma:r=10;break e;case jx:r=9;break e;case xf:r=11;break e;case yf:r=14;break e;case Ha:r=16,a=null;break e}r=29,n=Error(U(130,e===null?"null":typeof e,"")),a=null}return t=cn(r,n,t,l),t.elementType=e,t.type=a,t.lanes=s,t}function Dl(e,t,n,a){return e=cn(7,e,a,t),e.lanes=n,e}function yu(e,t,n){return e=cn(6,e,null,t),e.lanes=n,e}function ly(e){var t=cn(18,null,null,0);return t.stateNode=e,t}function bu(e,t,n){return t=cn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ap=new WeakMap;function Tn(e,t){if(typeof e=="object"&&e!==null){var n=Ap.get(e);return n!==void 0?n:(t={value:e,source:t,stack:cp(t)},Ap.set(e,t),t)}return{value:e,source:t,stack:cp(t)}}var xs=[],ys=0,Yo=null,ni=0,kn=[],_n=0,ol=null,Wn=1,Fn="";function ha(e,t){xs[ys++]=ni,xs[ys++]=Yo,Yo=e,ni=t}function sy(e,t,n){kn[_n++]=Wn,kn[_n++]=Fn,kn[_n++]=ol,ol=e;var a=Wn;e=Fn;var l=32-pn(a)-1;a&=~(1<<l),n+=1;var s=32-pn(t)+l;if(30<s){var r=l-l%5;s=(a&(1<<r)-1).toString(32),a>>=r,l-=r,Wn=1<<32-pn(t)+l|n<<l|a,Fn=s+e}else Wn=1<<s|n<<l|a,Fn=e}function Of(e){e.return!==null&&(ha(e,1),sy(e,1,0))}function Df(e){for(;e===Yo;)Yo=xs[--ys],xs[ys]=null,ni=xs[--ys],xs[ys]=null;for(;e===ol;)ol=kn[--_n],kn[_n]=null,Fn=kn[--_n],kn[_n]=null,Wn=kn[--_n],kn[_n]=null}function ry(e,t){kn[_n++]=Wn,kn[_n++]=Fn,kn[_n++]=ol,Wn=t.id,Fn=t.overflow,ol=e}var St=null,Ze=null,xe=!1,el=null,En=!1,wd=Error(U(519));function cl(e){var t=Error(U(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ai(Tn(t,e)),wd}function zp(e){var t=e.stateNode,n=e.type,a=e.memoizedProps;switch(t[vt]=e,t[Ft]=a,n){case"dialog":he("cancel",t),he("close",t);break;case"iframe":case"object":case"embed":he("load",t);break;case"video":case"audio":for(n=0;n<ii.length;n++)he(ii[n],t);break;case"source":he("error",t);break;case"img":case"image":case"link":he("error",t),he("load",t);break;case"details":he("toggle",t);break;case"input":he("invalid",t),Lx(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":he("invalid",t);break;case"textarea":he("invalid",t),Ux(t,a.value,a.defaultValue,a.children)}n=a.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||a.suppressHydrationWarning===!0||qb(t.textContent,n)?(a.popover!=null&&(he("beforetoggle",t),he("toggle",t)),a.onScroll!=null&&he("scroll",t),a.onScrollEnd!=null&&he("scrollend",t),a.onClick!=null&&(t.onclick=ga),t=!0):t=!1,t||cl(e,!0)}function Cp(e){for(St=e.return;St;)switch(St.tag){case 5:case 31:case 13:En=!1;return;case 27:case 3:En=!0;return;default:St=St.return}}function ts(e){if(e!==St)return!1;if(!xe)return Cp(e),xe=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Vd(e.type,e.memoizedProps)),n=!n),n&&Ze&&cl(e),Cp(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(U(317));Ze=xm(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(U(317));Ze=xm(e)}else t===27?(t=Ze,pl(e.type)?(e=Wd,Wd=null,Ze=e):Ze=t):Ze=St?zn(e.stateNode.nextSibling):null;return!0}function $l(){Ze=St=null,xe=!1}function vu(){var e=el;return e!==null&&(Kt===null?Kt=e:Kt.push.apply(Kt,e),el=null),e}function ai(e){el===null?el=[e]:el.push(e)}var jd=na(null),Vl=null,xa=null;function Ya(e,t,n){Le(jd,t._currentValue),t._currentValue=n}function ba(e){e._currentValue=jd.current,gt(jd)}function kd(e,t,n){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===n)break;e=e.return}}function _d(e,t,n,a){var l=e.child;for(l!==null&&(l.return=e);l!==null;){var s=l.dependencies;if(s!==null){var r=l.child;s=s.firstContext;e:for(;s!==null;){var o=s;s=l;for(var c=0;c<t.length;c++)if(o.context===t[c]){s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),kd(s.return,n,e),a||(r=null);break e}s=o.next}}else if(l.tag===18){if(r=l.return,r===null)throw Error(U(341));r.lanes|=n,s=r.alternate,s!==null&&(s.lanes|=n),kd(r,n,e),r=null}else r=l.child;if(r!==null)r.return=l;else for(r=l;r!==null;){if(r===e){r=null;break}if(l=r.sibling,l!==null){l.return=r.return,r=l;break}r=r.return}l=r}}function Js(e,t,n,a){e=null;for(var l=t,s=!1;l!==null;){if(!s){if(l.flags&524288)s=!0;else if(l.flags&262144)break}if(l.tag===10){var r=l.alternate;if(r===null)throw Error(U(387));if(r=r.memoizedProps,r!==null){var o=l.type;gn(l.pendingProps.value,r.value)||(e!==null?e.push(o):e=[o])}}else if(l===$o.current){if(r=l.alternate,r===null)throw Error(U(387));r.memoizedState.memoizedState!==l.memoizedState.memoizedState&&(e!==null?e.push(ci):e=[ci])}l=l.return}e!==null&&_d(t,e,n,a),t.flags|=262144}function Io(e){for(e=e.firstContext;e!==null;){if(!gn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ul(e){Vl=e,xa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function wt(e){return iy(Vl,e)}function Wi(e,t){return Vl===null&&Ul(e),iy(e,t)}function iy(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},xa===null){if(e===null)throw Error(U(308));xa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else xa=xa.next=t;return n}var z2=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,a){e.push(a)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},C2=ft.unstable_scheduleCallback,O2=ft.unstable_NormalPriority,st={$$typeof:ma,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Mf(){return{controller:new z2,data:new Map,refCount:0}}function wi(e){e.refCount--,e.refCount===0&&C2(O2,function(){e.controller.abort()})}var Br=null,Nd=0,$s=0,Ns=null;function D2(e,t){if(Br===null){var n=Br=[];Nd=0,$s=sh(),Ns={status:"pending",value:void 0,then:function(a){n.push(a)}}}return Nd++,t.then(Op,Op),t}function Op(){if(--Nd===0&&Br!==null){Ns!==null&&(Ns.status="fulfilled");var e=Br;Br=null,$s=0,Ns=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function M2(e,t){var n=[],a={status:"pending",value:null,reason:null,then:function(l){n.push(l)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var l=0;l<n.length;l++)(0,n[l])(t)},function(l){for(a.status="rejected",a.reason=l,l=0;l<n.length;l++)(0,n[l])(void 0)}),a}var Dp=se.S;se.S=function(e,t){Sb=fn(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&D2(e,t),Dp!==null&&Dp(e,t)};var Ml=na(null);function Rf(){var e=Ml.current;return e!==null?e:Me.pooledCache}function _o(e,t){t===null?Le(Ml,Ml.current):Le(Ml,t.pool)}function oy(){var e=Rf();return e===null?null:{parent:st._currentValue,pool:e}}var Ws=Error(U(460)),Lf=Error(U(474)),Mc=Error(U(542)),Xo={then:function(){}};function Mp(e){return e=e.status,e==="fulfilled"||e==="rejected"}function cy(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(ga,ga),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Lp(e),e;default:if(typeof t.status=="string")t.then(ga,ga);else{if(e=Me,e!==null&&100<e.shellSuspendCounter)throw Error(U(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var l=t;l.status="fulfilled",l.value=a}},function(a){if(t.status==="pending"){var l=t;l.status="rejected",l.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Lp(e),e}throw Rl=t,Ws}}function Tl(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Rl=n,Ws):n}}var Rl=null;function Rp(){if(Rl===null)throw Error(U(459));var e=Rl;return Rl=null,e}function Lp(e){if(e===Ws||e===Mc)throw Error(U(483))}var Ts=null,li=0;function Fi(e){var t=li;return li+=1,Ts===null&&(Ts=[]),cy(Ts,e,t)}function yr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Pi(e,t){throw t.$$typeof===v1?Error(U(525)):(e=Object.prototype.toString.call(t),Error(U(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function uy(e){function t(g,x){if(e){var b=g.deletions;b===null?(g.deletions=[x],g.flags|=16):b.push(x)}}function n(g,x){if(!e)return null;for(;x!==null;)t(g,x),x=x.sibling;return null}function a(g){for(var x=new Map;g!==null;)g.key!==null?x.set(g.key,g):x.set(g.index,g),g=g.sibling;return x}function l(g,x){return g=ya(g,x),g.index=0,g.sibling=null,g}function s(g,x,b){return g.index=b,e?(b=g.alternate,b!==null?(b=b.index,b<x?(g.flags|=67108866,x):b):(g.flags|=67108866,x)):(g.flags|=1048576,x)}function r(g){return e&&g.alternate===null&&(g.flags|=67108866),g}function o(g,x,b,y){return x===null||x.tag!==6?(x=yu(b,g.mode,y),x.return=g,x):(x=l(x,b),x.return=g,x)}function c(g,x,b,y){var T=b.type;return T===os?d(g,x,b.props.children,y,b.key):x!==null&&(x.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Ha&&Tl(T)===x.type)?(x=l(x,b.props),yr(x,b),x.return=g,x):(x=ko(b.type,b.key,b.props,null,g.mode,y),yr(x,b),x.return=g,x)}function u(g,x,b,y){return x===null||x.tag!==4||x.stateNode.containerInfo!==b.containerInfo||x.stateNode.implementation!==b.implementation?(x=bu(b,g.mode,y),x.return=g,x):(x=l(x,b.children||[]),x.return=g,x)}function d(g,x,b,y,T){return x===null||x.tag!==7?(x=Dl(b,g.mode,y,T),x.return=g,x):(x=l(x,b),x.return=g,x)}function f(g,x,b){if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return x=yu(""+x,g.mode,b),x.return=g,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Ii:return b=ko(x.type,x.key,x.props,null,g.mode,b),yr(b,x),b.return=g,b;case Tr:return x=bu(x,g.mode,b),x.return=g,x;case Ha:return x=Tl(x),f(g,x,b)}if(Er(x)||mr(x))return x=Dl(x,g.mode,b,null),x.return=g,x;if(typeof x.then=="function")return f(g,Fi(x),b);if(x.$$typeof===ma)return f(g,Wi(g,x),b);Pi(g,x)}return null}function h(g,x,b,y){var T=x!==null?x.key:null;if(typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint")return T!==null?null:o(g,x,""+b,y);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Ii:return b.key===T?c(g,x,b,y):null;case Tr:return b.key===T?u(g,x,b,y):null;case Ha:return b=Tl(b),h(g,x,b,y)}if(Er(b)||mr(b))return T!==null?null:d(g,x,b,y,null);if(typeof b.then=="function")return h(g,x,Fi(b),y);if(b.$$typeof===ma)return h(g,x,Wi(g,b),y);Pi(g,b)}return null}function p(g,x,b,y,T){if(typeof y=="string"&&y!==""||typeof y=="number"||typeof y=="bigint")return g=g.get(b)||null,o(x,g,""+y,T);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Ii:return g=g.get(y.key===null?b:y.key)||null,c(x,g,y,T);case Tr:return g=g.get(y.key===null?b:y.key)||null,u(x,g,y,T);case Ha:return y=Tl(y),p(g,x,b,y,T)}if(Er(y)||mr(y))return g=g.get(b)||null,d(x,g,y,T,null);if(typeof y.then=="function")return p(g,x,b,Fi(y),T);if(y.$$typeof===ma)return p(g,x,b,Wi(x,y),T);Pi(x,y)}return null}function v(g,x,b,y){for(var T=null,_=null,E=x,D=x=0,O=null;E!==null&&D<b.length;D++){E.index>D?(O=E,E=null):O=E.sibling;var R=h(g,E,b[D],y);if(R===null){E===null&&(E=O);break}e&&E&&R.alternate===null&&t(g,E),x=s(R,x,D),_===null?T=R:_.sibling=R,_=R,E=O}if(D===b.length)return n(g,E),xe&&ha(g,D),T;if(E===null){for(;D<b.length;D++)E=f(g,b[D],y),E!==null&&(x=s(E,x,D),_===null?T=E:_.sibling=E,_=E);return xe&&ha(g,D),T}for(E=a(E);D<b.length;D++)O=p(E,g,D,b[D],y),O!==null&&(e&&O.alternate!==null&&E.delete(O.key===null?D:O.key),x=s(O,x,D),_===null?T=O:_.sibling=O,_=O);return e&&E.forEach(function(X){return t(g,X)}),xe&&ha(g,D),T}function j(g,x,b,y){if(b==null)throw Error(U(151));for(var T=null,_=null,E=x,D=x=0,O=null,R=b.next();E!==null&&!R.done;D++,R=b.next()){E.index>D?(O=E,E=null):O=E.sibling;var X=h(g,E,R.value,y);if(X===null){E===null&&(E=O);break}e&&E&&X.alternate===null&&t(g,E),x=s(X,x,D),_===null?T=X:_.sibling=X,_=X,E=O}if(R.done)return n(g,E),xe&&ha(g,D),T;if(E===null){for(;!R.done;D++,R=b.next())R=f(g,R.value,y),R!==null&&(x=s(R,x,D),_===null?T=R:_.sibling=R,_=R);return xe&&ha(g,D),T}for(E=a(E);!R.done;D++,R=b.next())R=p(E,g,D,R.value,y),R!==null&&(e&&R.alternate!==null&&E.delete(R.key===null?D:R.key),x=s(R,x,D),_===null?T=R:_.sibling=R,_=R);return e&&E.forEach(function(K){return t(g,K)}),xe&&ha(g,D),T}function k(g,x,b,y){if(typeof b=="object"&&b!==null&&b.type===os&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Ii:e:{for(var T=b.key;x!==null;){if(x.key===T){if(T=b.type,T===os){if(x.tag===7){n(g,x.sibling),y=l(x,b.props.children),y.return=g,g=y;break e}}else if(x.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Ha&&Tl(T)===x.type){n(g,x.sibling),y=l(x,b.props),yr(y,b),y.return=g,g=y;break e}n(g,x);break}else t(g,x);x=x.sibling}b.type===os?(y=Dl(b.props.children,g.mode,y,b.key),y.return=g,g=y):(y=ko(b.type,b.key,b.props,null,g.mode,y),yr(y,b),y.return=g,g=y)}return r(g);case Tr:e:{for(T=b.key;x!==null;){if(x.key===T)if(x.tag===4&&x.stateNode.containerInfo===b.containerInfo&&x.stateNode.implementation===b.implementation){n(g,x.sibling),y=l(x,b.children||[]),y.return=g,g=y;break e}else{n(g,x);break}else t(g,x);x=x.sibling}y=bu(b,g.mode,y),y.return=g,g=y}return r(g);case Ha:return b=Tl(b),k(g,x,b,y)}if(Er(b))return v(g,x,b,y);if(mr(b)){if(T=mr(b),typeof T!="function")throw Error(U(150));return b=T.call(b),j(g,x,b,y)}if(typeof b.then=="function")return k(g,x,Fi(b),y);if(b.$$typeof===ma)return k(g,x,Wi(g,b),y);Pi(g,b)}return typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint"?(b=""+b,x!==null&&x.tag===6?(n(g,x.sibling),y=l(x,b),y.return=g,g=y):(n(g,x),y=yu(b,g.mode,y),y.return=g,g=y),r(g)):n(g,x)}return function(g,x,b,y){try{li=0;var T=k(g,x,b,y);return Ts=null,T}catch(E){if(E===Ws||E===Mc)throw E;var _=cn(29,E,null,g.mode);return _.lanes=y,_.return=g,_}finally{}}}var Bl=uy(!0),dy=uy(!1),qa=!1;function $f(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Td(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function tl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function nl(e,t,n){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,je&2){var l=a.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),a.pending=t,t=Go(e),ny(e,null,n),t}return Dc(e,a,t,n),Go(e)}function Zr(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,Ax(e,n)}}function Su(e,t){var n=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,n===a)){var l=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var r={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};s===null?l=s=r:s=s.next=r,n=n.next}while(n!==null);s===null?l=s=t:s=s.next=t}else l=s=t;n={baseState:a.baseState,firstBaseUpdate:l,lastBaseUpdate:s,shared:a.shared,callbacks:a.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ed=!1;function Hr(){if(Ed){var e=Ns;if(e!==null)throw e}}function qr(e,t,n,a){Ed=!1;var l=e.updateQueue;qa=!1;var s=l.firstBaseUpdate,r=l.lastBaseUpdate,o=l.shared.pending;if(o!==null){l.shared.pending=null;var c=o,u=c.next;c.next=null,r===null?s=u:r.next=u,r=c;var d=e.alternate;d!==null&&(d=d.updateQueue,o=d.lastBaseUpdate,o!==r&&(o===null?d.firstBaseUpdate=u:o.next=u,d.lastBaseUpdate=c))}if(s!==null){var f=l.baseState;r=0,d=u=c=null,o=s;do{var h=o.lane&-536870913,p=h!==o.lane;if(p?(ge&h)===h:(a&h)===h){h!==0&&h===$s&&(Ed=!0),d!==null&&(d=d.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var v=e,j=o;h=t;var k=n;switch(j.tag){case 1:if(v=j.payload,typeof v=="function"){f=v.call(k,f,h);break e}f=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=j.payload,h=typeof v=="function"?v.call(k,f,h):v,h==null)break e;f=qe({},f,h);break e;case 2:qa=!0}}h=o.callback,h!==null&&(e.flags|=64,p&&(e.flags|=8192),p=l.callbacks,p===null?l.callbacks=[h]:p.push(h))}else p={lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,r|=h;if(o=o.next,o===null){if(o=l.shared.pending,o===null)break;p=o,o=p.next,p.next=null,l.lastBaseUpdate=p,l.shared.pending=null}}while(!0);d===null&&(c=f),l.baseState=c,l.firstBaseUpdate=u,l.lastBaseUpdate=d,s===null&&(l.shared.lanes=0),dl|=r,e.lanes=r,e.memoizedState=f}}function fy(e,t){if(typeof e!="function")throw Error(U(191,e));e.call(t)}function hy(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)fy(n[e],t)}var Us=na(null),Vo=na(0);function $p(e,t){e=Na,Le(Vo,e),Le(Us,t),Na=e|t.baseLanes}function Ad(){Le(Vo,Na),Le(Us,Us.current)}function Uf(){Na=Vo.current,gt(Us),gt(Vo)}var xn=na(null),An=null;function Ia(e){var t=e.alternate;Le(tt,tt.current&1),Le(xn,e),An===null&&(t===null||Us.current!==null||t.memoizedState!==null)&&(An=e)}function zd(e){Le(tt,tt.current),Le(xn,e),An===null&&(An=e)}function py(e){e.tag===22?(Le(tt,tt.current),Le(xn,e),An===null&&(An=e)):Xa()}function Xa(){Le(tt,tt.current),Le(xn,xn.current)}function on(e){gt(xn),An===e&&(An=null),gt(tt)}var tt=na(0);function Qo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Kd(n)||Jd(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ja=0,de=null,Oe=null,at=null,Ko=!1,Es=!1,Zl=!1,Jo=0,si=0,As=null,R2=0;function Fe(){throw Error(U(321))}function Bf(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!gn(e[n],t[n]))return!1;return!0}function Zf(e,t,n,a,l,s){return ja=s,de=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,se.H=e===null||e.memoizedState===null?Iy:Wf,Zl=!1,s=n(a,l),Zl=!1,Es&&(s=gy(t,n,a,l)),my(e),s}function my(e){se.H=ri;var t=Oe!==null&&Oe.next!==null;if(ja=0,at=Oe=de=null,Ko=!1,si=0,As=null,t)throw Error(U(300));e===null||rt||(e=e.dependencies,e!==null&&Io(e)&&(rt=!0))}function gy(e,t,n,a){de=e;var l=0;do{if(Es&&(As=null),si=0,Es=!1,25<=l)throw Error(U(301));if(l+=1,at=Oe=null,e.updateQueue!=null){var s=e.updateQueue;s.lastEffect=null,s.events=null,s.stores=null,s.memoCache!=null&&(s.memoCache.index=0)}se.H=Xy,s=t(n,a)}while(Es);return s}function L2(){var e=se.H,t=e.useState()[0];return t=typeof t.then=="function"?ji(t):t,e=e.useState()[0],(Oe!==null?Oe.memoizedState:null)!==e&&(de.flags|=1024),t}function Hf(){var e=Jo!==0;return Jo=0,e}function qf(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Gf(e){if(Ko){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ko=!1}ja=0,at=Oe=de=null,Es=!1,si=Jo=0,As=null}function Rt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return at===null?de.memoizedState=at=e:at=at.next=e,at}function nt(){if(Oe===null){var e=de.alternate;e=e!==null?e.memoizedState:null}else e=Oe.next;var t=at===null?de.memoizedState:at.next;if(t!==null)at=t,Oe=e;else{if(e===null)throw de.alternate===null?Error(U(467)):Error(U(310));Oe=e,e={memoizedState:Oe.memoizedState,baseState:Oe.baseState,baseQueue:Oe.baseQueue,queue:Oe.queue,next:null},at===null?de.memoizedState=at=e:at=at.next=e}return at}function Rc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ji(e){var t=si;return si+=1,As===null&&(As=[]),e=cy(As,e,t),t=de,(at===null?t.memoizedState:at.next)===null&&(t=t.alternate,se.H=t===null||t.memoizedState===null?Iy:Wf),e}function Lc(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ji(e);if(e.$$typeof===ma)return wt(e)}throw Error(U(438,String(e)))}function Yf(e){var t=null,n=de.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var a=de.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(l){return l.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Rc(),de.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),a=0;a<e;a++)n[a]=S1;return t.index++,n}function ka(e,t){return typeof t=="function"?t(e):t}function No(e){var t=nt();return If(t,Oe,e)}function If(e,t,n){var a=e.queue;if(a===null)throw Error(U(311));a.lastRenderedReducer=n;var l=e.baseQueue,s=a.pending;if(s!==null){if(l!==null){var r=l.next;l.next=s.next,s.next=r}t.baseQueue=l=s,a.pending=null}if(s=e.baseState,l===null)e.memoizedState=s;else{t=l.next;var o=r=null,c=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f!==u.lane?(ge&f)===f:(ja&f)===f){var h=u.revertLane;if(h===0)c!==null&&(c=c.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===$s&&(d=!0);else if((ja&h)===h){u=u.next,h===$s&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},c===null?(o=c=f,r=s):c=c.next=f,de.lanes|=h,dl|=h;f=u.action,Zl&&n(s,f),s=u.hasEagerState?u.eagerState:n(s,f)}else h={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},c===null?(o=c=h,r=s):c=c.next=h,de.lanes|=f,dl|=f;u=u.next}while(u!==null&&u!==t);if(c===null?r=s:c.next=o,!gn(s,e.memoizedState)&&(rt=!0,d&&(n=Ns,n!==null)))throw n;e.memoizedState=s,e.baseState=r,e.baseQueue=c,a.lastRenderedState=s}return l===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function wu(e){var t=nt(),n=t.queue;if(n===null)throw Error(U(311));n.lastRenderedReducer=e;var a=n.dispatch,l=n.pending,s=t.memoizedState;if(l!==null){n.pending=null;var r=l=l.next;do s=e(s,r.action),r=r.next;while(r!==l);gn(s,t.memoizedState)||(rt=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,a]}function xy(e,t,n){var a=de,l=nt(),s=xe;if(s){if(n===void 0)throw Error(U(407));n=n()}else n=t();var r=!gn((Oe||l).memoizedState,n);if(r&&(l.memoizedState=n,rt=!0),l=l.queue,Xf(vy.bind(null,a,l,e),[e]),l.getSnapshot!==t||r||at!==null&&at.memoizedState.tag&1){if(a.flags|=2048,Bs(9,{destroy:void 0},by.bind(null,a,l,n,t),null),Me===null)throw Error(U(349));s||ja&127||yy(a,t,n)}return n}function yy(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=de.updateQueue,t===null?(t=Rc(),de.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function by(e,t,n,a){t.value=n,t.getSnapshot=a,Sy(t)&&wy(e)}function vy(e,t,n){return n(function(){Sy(t)&&wy(e)})}function Sy(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!gn(e,n)}catch{return!0}}function wy(e){var t=Xl(e,2);t!==null&&Wt(t,e,2)}function Cd(e){var t=Rt();if(typeof e=="function"){var n=e;if(e=n(),Zl){Qa(!0);try{n()}finally{Qa(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ka,lastRenderedState:e},t}function jy(e,t,n,a){return e.baseState=n,If(e,Oe,typeof a=="function"?a:ka)}function $2(e,t,n,a,l){if(Uc(e))throw Error(U(485));if(e=t.action,e!==null){var s={payload:l,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(r){s.listeners.push(r)}};se.T!==null?n(!0):s.isTransition=!1,a(s),n=t.pending,n===null?(s.next=t.pending=s,ky(t,s)):(s.next=n.next,t.pending=n.next=s)}}function ky(e,t){var n=t.action,a=t.payload,l=e.state;if(t.isTransition){var s=se.T,r={};se.T=r;try{var o=n(l,a),c=se.S;c!==null&&c(r,o),Up(e,t,o)}catch(u){Od(e,t,u)}finally{s!==null&&r.types!==null&&(s.types=r.types),se.T=s}}else try{s=n(l,a),Up(e,t,s)}catch(u){Od(e,t,u)}}function Up(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(a){Bp(e,t,a)},function(a){return Od(e,t,a)}):Bp(e,t,n)}function Bp(e,t,n){t.status="fulfilled",t.value=n,_y(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,ky(e,n)))}function Od(e,t,n){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=n,_y(t),t=t.next;while(t!==a)}e.action=null}function _y(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ny(e,t){return t}function Zp(e,t){if(xe){var n=Me.formState;if(n!==null){e:{var a=de;if(xe){if(Ze){t:{for(var l=Ze,s=En;l.nodeType!==8;){if(!s){l=null;break t}if(l=zn(l.nextSibling),l===null){l=null;break t}}s=l.data,l=s==="F!"||s==="F"?l:null}if(l){Ze=zn(l.nextSibling),a=l.data==="F!";break e}}cl(a)}a=!1}a&&(t=n[0])}}return n=Rt(),n.memoizedState=n.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ny,lastRenderedState:t},n.queue=a,n=qy.bind(null,de,a),a.dispatch=n,a=Cd(!1),s=Jf.bind(null,de,!1,a.queue),a=Rt(),l={state:t,dispatch:null,action:e,pending:null},a.queue=l,n=$2.bind(null,de,l,s,n),l.dispatch=n,a.memoizedState=e,[t,n,!1]}function Hp(e){var t=nt();return Ty(t,Oe,e)}function Ty(e,t,n){if(t=If(e,t,Ny)[0],e=No(ka)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=ji(t)}catch(r){throw r===Ws?Mc:r}else a=t;t=nt();var l=t.queue,s=l.dispatch;return n!==t.memoizedState&&(de.flags|=2048,Bs(9,{destroy:void 0},U2.bind(null,l,n),null)),[a,s,e]}function U2(e,t){e.action=t}function qp(e){var t=nt(),n=Oe;if(n!==null)return Ty(t,n,e);nt(),t=t.memoizedState,n=nt();var a=n.queue.dispatch;return n.memoizedState=e,[t,a,!1]}function Bs(e,t,n,a){return e={tag:e,create:n,deps:a,inst:t,next:null},t=de.updateQueue,t===null&&(t=Rc(),de.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(a=n.next,n.next=e,e.next=a,t.lastEffect=e),e}function Ey(){return nt().memoizedState}function To(e,t,n,a){var l=Rt();de.flags|=e,l.memoizedState=Bs(1|t,{destroy:void 0},n,a===void 0?null:a)}function $c(e,t,n,a){var l=nt();a=a===void 0?null:a;var s=l.memoizedState.inst;Oe!==null&&a!==null&&Bf(a,Oe.memoizedState.deps)?l.memoizedState=Bs(t,s,n,a):(de.flags|=e,l.memoizedState=Bs(1|t,s,n,a))}function Gp(e,t){To(8390656,8,e,t)}function Xf(e,t){$c(2048,8,e,t)}function B2(e){de.flags|=4;var t=de.updateQueue;if(t===null)t=Rc(),de.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ay(e){var t=nt().memoizedState;return B2({ref:t,nextImpl:e}),function(){if(je&2)throw Error(U(440));return t.impl.apply(void 0,arguments)}}function zy(e,t){return $c(4,2,e,t)}function Cy(e,t){return $c(4,4,e,t)}function Oy(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Dy(e,t,n){n=n!=null?n.concat([e]):null,$c(4,4,Oy.bind(null,t,e),n)}function Vf(){}function My(e,t){var n=nt();t=t===void 0?null:t;var a=n.memoizedState;return t!==null&&Bf(t,a[1])?a[0]:(n.memoizedState=[e,t],e)}function Ry(e,t){var n=nt();t=t===void 0?null:t;var a=n.memoizedState;if(t!==null&&Bf(t,a[1]))return a[0];if(a=e(),Zl){Qa(!0);try{e()}finally{Qa(!1)}}return n.memoizedState=[a,t],a}function Qf(e,t,n){return n===void 0||ja&1073741824&&!(ge&261930)?e.memoizedState=t:(e.memoizedState=n,e=jb(),de.lanes|=e,dl|=e,n)}function Ly(e,t,n,a){return gn(n,t)?n:Us.current!==null?(e=Qf(e,n,a),gn(e,t)||(rt=!0),e):!(ja&42)||ja&1073741824&&!(ge&261930)?(rt=!0,e.memoizedState=n):(e=jb(),de.lanes|=e,dl|=e,t)}function $y(e,t,n,a,l){var s=ke.p;ke.p=s!==0&&8>s?s:8;var r=se.T,o={};se.T=o,Jf(e,!1,t,n);try{var c=l(),u=se.S;if(u!==null&&u(o,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=M2(c,a);Gr(e,t,d,mn(e))}else Gr(e,t,a,mn(e))}catch(f){Gr(e,t,{then:function(){},status:"rejected",reason:f},mn())}finally{ke.p=s,r!==null&&o.types!==null&&(r.types=o.types),se.T=r}}function Z2(){}function Dd(e,t,n,a){if(e.tag!==5)throw Error(U(476));var l=Uy(e).queue;$y(e,l,t,Ol,n===null?Z2:function(){return By(e),n(a)})}function Uy(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Ol,baseState:Ol,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ka,lastRenderedState:Ol},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ka,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function By(e){var t=Uy(e);t.next===null&&(t=e.alternate.memoizedState),Gr(e,t.next.queue,{},mn())}function Kf(){return wt(ci)}function Zy(){return nt().memoizedState}function Hy(){return nt().memoizedState}function H2(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=mn();e=tl(n);var a=nl(t,e,n);a!==null&&(Wt(a,t,n),Zr(a,t,n)),t={cache:Mf()},e.payload=t;return}t=t.return}}function q2(e,t,n){var a=mn();n={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Uc(e)?Gy(t,n):(n=zf(e,t,n,a),n!==null&&(Wt(n,e,a),Yy(n,t,a)))}function qy(e,t,n){var a=mn();Gr(e,t,n,a)}function Gr(e,t,n,a){var l={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Uc(e))Gy(t,l);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var r=t.lastRenderedState,o=s(r,n);if(l.hasEagerState=!0,l.eagerState=o,gn(o,r))return Dc(e,t,l,0),Me===null&&Oc(),!1}catch{}finally{}if(n=zf(e,t,l,a),n!==null)return Wt(n,e,a),Yy(n,t,a),!0}return!1}function Jf(e,t,n,a){if(a={lane:2,revertLane:sh(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Uc(e)){if(t)throw Error(U(479))}else t=zf(e,n,a,2),t!==null&&Wt(t,e,2)}function Uc(e){var t=e.alternate;return e===de||t!==null&&t===de}function Gy(e,t){Es=Ko=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Yy(e,t,n){if(n&4194048){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,Ax(e,n)}}var ri={readContext:wt,use:Lc,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useLayoutEffect:Fe,useInsertionEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useSyncExternalStore:Fe,useId:Fe,useHostTransitionStatus:Fe,useFormState:Fe,useActionState:Fe,useOptimistic:Fe,useMemoCache:Fe,useCacheRefresh:Fe};ri.useEffectEvent=Fe;var Iy={readContext:wt,use:Lc,useCallback:function(e,t){return Rt().memoizedState=[e,t===void 0?null:t],e},useContext:wt,useEffect:Gp,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,To(4194308,4,Oy.bind(null,t,e),n)},useLayoutEffect:function(e,t){return To(4194308,4,e,t)},useInsertionEffect:function(e,t){To(4,2,e,t)},useMemo:function(e,t){var n=Rt();t=t===void 0?null:t;var a=e();if(Zl){Qa(!0);try{e()}finally{Qa(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=Rt();if(n!==void 0){var l=n(t);if(Zl){Qa(!0);try{n(t)}finally{Qa(!1)}}}else l=t;return a.memoizedState=a.baseState=l,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:l},a.queue=e,e=e.dispatch=q2.bind(null,de,e),[a.memoizedState,e]},useRef:function(e){var t=Rt();return e={current:e},t.memoizedState=e},useState:function(e){e=Cd(e);var t=e.queue,n=qy.bind(null,de,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Vf,useDeferredValue:function(e,t){var n=Rt();return Qf(n,e,t)},useTransition:function(){var e=Cd(!1);return e=$y.bind(null,de,e.queue,!0,!1),Rt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=de,l=Rt();if(xe){if(n===void 0)throw Error(U(407));n=n()}else{if(n=t(),Me===null)throw Error(U(349));ge&127||yy(a,t,n)}l.memoizedState=n;var s={value:n,getSnapshot:t};return l.queue=s,Gp(vy.bind(null,a,s,e),[e]),a.flags|=2048,Bs(9,{destroy:void 0},by.bind(null,a,s,n,t),null),n},useId:function(){var e=Rt(),t=Me.identifierPrefix;if(xe){var n=Fn,a=Wn;n=(a&~(1<<32-pn(a)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Jo++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=R2++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Kf,useFormState:Zp,useActionState:Zp,useOptimistic:function(e){var t=Rt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Jf.bind(null,de,!0,n),n.dispatch=t,[e,t]},useMemoCache:Yf,useCacheRefresh:function(){return Rt().memoizedState=H2.bind(null,de)},useEffectEvent:function(e){var t=Rt(),n={impl:e};return t.memoizedState=n,function(){if(je&2)throw Error(U(440));return n.impl.apply(void 0,arguments)}}},Wf={readContext:wt,use:Lc,useCallback:My,useContext:wt,useEffect:Xf,useImperativeHandle:Dy,useInsertionEffect:zy,useLayoutEffect:Cy,useMemo:Ry,useReducer:No,useRef:Ey,useState:function(){return No(ka)},useDebugValue:Vf,useDeferredValue:function(e,t){var n=nt();return Ly(n,Oe.memoizedState,e,t)},useTransition:function(){var e=No(ka)[0],t=nt().memoizedState;return[typeof e=="boolean"?e:ji(e),t]},useSyncExternalStore:xy,useId:Zy,useHostTransitionStatus:Kf,useFormState:Hp,useActionState:Hp,useOptimistic:function(e,t){var n=nt();return jy(n,Oe,e,t)},useMemoCache:Yf,useCacheRefresh:Hy};Wf.useEffectEvent=Ay;var Xy={readContext:wt,use:Lc,useCallback:My,useContext:wt,useEffect:Xf,useImperativeHandle:Dy,useInsertionEffect:zy,useLayoutEffect:Cy,useMemo:Ry,useReducer:wu,useRef:Ey,useState:function(){return wu(ka)},useDebugValue:Vf,useDeferredValue:function(e,t){var n=nt();return Oe===null?Qf(n,e,t):Ly(n,Oe.memoizedState,e,t)},useTransition:function(){var e=wu(ka)[0],t=nt().memoizedState;return[typeof e=="boolean"?e:ji(e),t]},useSyncExternalStore:xy,useId:Zy,useHostTransitionStatus:Kf,useFormState:qp,useActionState:qp,useOptimistic:function(e,t){var n=nt();return Oe!==null?jy(n,Oe,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Yf,useCacheRefresh:Hy};Xy.useEffectEvent=Ay;function ju(e,t,n,a){t=e.memoizedState,n=n(a,t),n=n==null?t:qe({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Md={enqueueSetState:function(e,t,n){e=e._reactInternals;var a=mn(),l=tl(a);l.payload=t,n!=null&&(l.callback=n),t=nl(e,l,a),t!==null&&(Wt(t,e,a),Zr(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var a=mn(),l=tl(a);l.tag=1,l.payload=t,n!=null&&(l.callback=n),t=nl(e,l,a),t!==null&&(Wt(t,e,a),Zr(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=mn(),a=tl(n);a.tag=2,t!=null&&(a.callback=t),t=nl(e,a,n),t!==null&&(Wt(t,e,n),Zr(t,e,n))}};function Yp(e,t,n,a,l,s,r){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,s,r):t.prototype&&t.prototype.isPureReactComponent?!ti(n,a)||!ti(l,s):!0}function Ip(e,t,n,a){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,a),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,a),t.state!==e&&Md.enqueueReplaceState(t,t.state,null)}function Hl(e,t){var n=t;if("ref"in t){n={};for(var a in t)a!=="ref"&&(n[a]=t[a])}if(e=e.defaultProps){n===t&&(n=qe({},n));for(var l in e)n[l]===void 0&&(n[l]=e[l])}return n}function Vy(e){qo(e)}function Qy(e){console.error(e)}function Ky(e){qo(e)}function Wo(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function Xp(e,t,n){try{var a=e.onCaughtError;a(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(l){setTimeout(function(){throw l})}}function Rd(e,t,n){return n=tl(n),n.tag=3,n.payload={element:null},n.callback=function(){Wo(e,t)},n}function Jy(e){return e=tl(e),e.tag=3,e}function Wy(e,t,n,a){var l=n.type.getDerivedStateFromError;if(typeof l=="function"){var s=a.value;e.payload=function(){return l(s)},e.callback=function(){Xp(t,n,a)}}var r=n.stateNode;r!==null&&typeof r.componentDidCatch=="function"&&(e.callback=function(){Xp(t,n,a),typeof l!="function"&&(al===null?al=new Set([this]):al.add(this));var o=a.stack;this.componentDidCatch(a.value,{componentStack:o!==null?o:""})})}function G2(e,t,n,a,l){if(n.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=n.alternate,t!==null&&Js(t,n,l,!0),n=xn.current,n!==null){switch(n.tag){case 31:case 13:return An===null?nc():n.alternate===null&&Pe===0&&(Pe=3),n.flags&=-257,n.flags|=65536,n.lanes=l,a===Xo?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([a]):t.add(a),Mu(e,a,l)),!1;case 22:return n.flags|=65536,a===Xo?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([a]):n.add(a)),Mu(e,a,l)),!1}throw Error(U(435,n.tag))}return Mu(e,a,l),nc(),!1}if(xe)return t=xn.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=l,a!==wd&&(e=Error(U(422),{cause:a}),ai(Tn(e,n)))):(a!==wd&&(t=Error(U(423),{cause:a}),ai(Tn(t,n))),e=e.current.alternate,e.flags|=65536,l&=-l,e.lanes|=l,a=Tn(a,n),l=Rd(e.stateNode,a,l),Su(e,l),Pe!==4&&(Pe=2)),!1;var s=Error(U(520),{cause:a});if(s=Tn(s,n),Xr===null?Xr=[s]:Xr.push(s),Pe!==4&&(Pe=2),t===null)return!0;a=Tn(a,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=l&-l,n.lanes|=e,e=Rd(n.stateNode,a,e),Su(n,e),!1;case 1:if(t=n.type,s=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||s!==null&&typeof s.componentDidCatch=="function"&&(al===null||!al.has(s))))return n.flags|=65536,l&=-l,n.lanes|=l,l=Jy(l),Wy(l,e,n,a),Su(n,l),!1}n=n.return}while(n!==null);return!1}var Ff=Error(U(461)),rt=!1;function bt(e,t,n,a){t.child=e===null?dy(t,null,n,a):Bl(t,e.child,n,a)}function Vp(e,t,n,a,l){n=n.render;var s=t.ref;if("ref"in a){var r={};for(var o in a)o!=="ref"&&(r[o]=a[o])}else r=a;return Ul(t),a=Zf(e,t,n,r,s,l),o=Hf(),e!==null&&!rt?(qf(e,t,l),_a(e,t,l)):(xe&&o&&Of(t),t.flags|=1,bt(e,t,a,l),t.child)}function Qp(e,t,n,a,l){if(e===null){var s=n.type;return typeof s=="function"&&!Cf(s)&&s.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=s,Fy(e,t,s,a,l)):(e=ko(n.type,null,a,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!Pf(e,l)){var r=s.memoizedProps;if(n=n.compare,n=n!==null?n:ti,n(r,a)&&e.ref===t.ref)return _a(e,t,l)}return t.flags|=1,e=ya(s,a),e.ref=t.ref,e.return=t,t.child=e}function Fy(e,t,n,a,l){if(e!==null){var s=e.memoizedProps;if(ti(s,a)&&e.ref===t.ref)if(rt=!1,t.pendingProps=a=s,Pf(e,l))e.flags&131072&&(rt=!0);else return t.lanes=e.lanes,_a(e,t,l)}return Ld(e,t,n,a,l)}function Py(e,t,n,a){var l=a.children,s=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.mode==="hidden"){if(t.flags&128){if(s=s!==null?s.baseLanes|n:n,e!==null){for(a=t.child=e.child,l=0;a!==null;)l=l|a.lanes|a.childLanes,a=a.sibling;a=l&~s}else a=0,t.child=null;return Kp(e,t,s,n,a)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&_o(t,s!==null?s.cachePool:null),s!==null?$p(t,s):Ad(),py(t);else return a=t.lanes=536870912,Kp(e,t,s!==null?s.baseLanes|n:n,n,a)}else s!==null?(_o(t,s.cachePool),$p(t,s),Xa(),t.memoizedState=null):(e!==null&&_o(t,null),Ad(),Xa());return bt(e,t,l,n),t.child}function zr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Kp(e,t,n,a,l){var s=Rf();return s=s===null?null:{parent:st._currentValue,pool:s},t.memoizedState={baseLanes:n,cachePool:s},e!==null&&_o(t,null),Ad(),py(t),e!==null&&Js(e,t,a,!0),t.childLanes=l,null}function Eo(e,t){return t=Fo({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Jp(e,t,n){return Bl(t,e.child,null,n),e=Eo(t,t.pendingProps),e.flags|=2,on(t),t.memoizedState=null,e}function Y2(e,t,n){var a=t.pendingProps,l=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(xe){if(a.mode==="hidden")return e=Eo(t,a),t.lanes=536870912,zr(null,e);if(zd(t),(e=Ze)?(e=Ib(e,En),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ol!==null?{id:Wn,overflow:Fn}:null,retryLane:536870912,hydrationErrors:null},n=ly(e),n.return=t,t.child=n,St=t,Ze=null)):e=null,e===null)throw cl(t);return t.lanes=536870912,null}return Eo(t,a)}var s=e.memoizedState;if(s!==null){var r=s.dehydrated;if(zd(t),l)if(t.flags&256)t.flags&=-257,t=Jp(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(U(558));else if(rt||Js(e,t,n,!1),l=(n&e.childLanes)!==0,rt||l){if(a=Me,a!==null&&(r=zx(a,n),r!==0&&r!==s.retryLane))throw s.retryLane=r,Xl(e,r),Wt(a,e,r),Ff;nc(),t=Jp(e,t,n)}else e=s.treeContext,Ze=zn(r.nextSibling),St=t,xe=!0,el=null,En=!1,e!==null&&ry(t,e),t=Eo(t,a),t.flags|=4096;return t}return e=ya(e.child,{mode:a.mode,children:a.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ao(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(U(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Ld(e,t,n,a,l){return Ul(t),n=Zf(e,t,n,a,void 0,l),a=Hf(),e!==null&&!rt?(qf(e,t,l),_a(e,t,l)):(xe&&a&&Of(t),t.flags|=1,bt(e,t,n,l),t.child)}function Wp(e,t,n,a,l,s){return Ul(t),t.updateQueue=null,n=gy(t,a,n,l),my(e),a=Hf(),e!==null&&!rt?(qf(e,t,s),_a(e,t,s)):(xe&&a&&Of(t),t.flags|=1,bt(e,t,n,s),t.child)}function Fp(e,t,n,a,l){if(Ul(t),t.stateNode===null){var s=gs,r=n.contextType;typeof r=="object"&&r!==null&&(s=wt(r)),s=new n(a,s),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Md,t.stateNode=s,s._reactInternals=t,s=t.stateNode,s.props=a,s.state=t.memoizedState,s.refs={},$f(t),r=n.contextType,s.context=typeof r=="object"&&r!==null?wt(r):gs,s.state=t.memoizedState,r=n.getDerivedStateFromProps,typeof r=="function"&&(ju(t,n,r,a),s.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(r=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),r!==s.state&&Md.enqueueReplaceState(s,s.state,null),qr(t,a,s,l),Hr(),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){s=t.stateNode;var o=t.memoizedProps,c=Hl(n,o);s.props=c;var u=s.context,d=n.contextType;r=gs,typeof d=="object"&&d!==null&&(r=wt(d));var f=n.getDerivedStateFromProps;d=typeof f=="function"||typeof s.getSnapshotBeforeUpdate=="function",o=t.pendingProps!==o,d||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(o||u!==r)&&Ip(t,s,a,r),qa=!1;var h=t.memoizedState;s.state=h,qr(t,a,s,l),Hr(),u=t.memoizedState,o||h!==u||qa?(typeof f=="function"&&(ju(t,n,f,a),u=t.memoizedState),(c=qa||Yp(t,n,c,a,h,u,r))?(d||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=u),s.props=a,s.state=u,s.context=r,a=c):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{s=t.stateNode,Td(e,t),r=t.memoizedProps,d=Hl(n,r),s.props=d,f=t.pendingProps,h=s.context,u=n.contextType,c=gs,typeof u=="object"&&u!==null&&(c=wt(u)),o=n.getDerivedStateFromProps,(u=typeof o=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(r!==f||h!==c)&&Ip(t,s,a,c),qa=!1,h=t.memoizedState,s.state=h,qr(t,a,s,l),Hr();var p=t.memoizedState;r!==f||h!==p||qa||e!==null&&e.dependencies!==null&&Io(e.dependencies)?(typeof o=="function"&&(ju(t,n,o,a),p=t.memoizedState),(d=qa||Yp(t,n,d,a,h,p,c)||e!==null&&e.dependencies!==null&&Io(e.dependencies))?(u||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(a,p,c),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(a,p,c)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||r===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||r===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=p),s.props=a,s.state=p,s.context=c,a=d):(typeof s.componentDidUpdate!="function"||r===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||r===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),a=!1)}return s=a,Ao(e,t),a=(t.flags&128)!==0,s||a?(s=t.stateNode,n=a&&typeof n.getDerivedStateFromError!="function"?null:s.render(),t.flags|=1,e!==null&&a?(t.child=Bl(t,e.child,null,l),t.child=Bl(t,null,n,l)):bt(e,t,n,l),t.memoizedState=s.state,e=t.child):e=_a(e,t,l),e}function Pp(e,t,n,a){return $l(),t.flags|=256,bt(e,t,n,a),t.child}var ku={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _u(e){return{baseLanes:e,cachePool:oy()}}function Nu(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=dn),e}function eb(e,t,n){var a=t.pendingProps,l=!1,s=(t.flags&128)!==0,r;if((r=s)||(r=e!==null&&e.memoizedState===null?!1:(tt.current&2)!==0),r&&(l=!0,t.flags&=-129),r=(t.flags&32)!==0,t.flags&=-33,e===null){if(xe){if(l?Ia(t):Xa(),(e=Ze)?(e=Ib(e,En),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ol!==null?{id:Wn,overflow:Fn}:null,retryLane:536870912,hydrationErrors:null},n=ly(e),n.return=t,t.child=n,St=t,Ze=null)):e=null,e===null)throw cl(t);return Jd(e)?t.lanes=32:t.lanes=536870912,null}var o=a.children;return a=a.fallback,l?(Xa(),l=t.mode,o=Fo({mode:"hidden",children:o},l),a=Dl(a,l,n,null),o.return=t,a.return=t,o.sibling=a,t.child=o,a=t.child,a.memoizedState=_u(n),a.childLanes=Nu(e,r,n),t.memoizedState=ku,zr(null,a)):(Ia(t),$d(t,o))}var c=e.memoizedState;if(c!==null&&(o=c.dehydrated,o!==null)){if(s)t.flags&256?(Ia(t),t.flags&=-257,t=Tu(e,t,n)):t.memoizedState!==null?(Xa(),t.child=e.child,t.flags|=128,t=null):(Xa(),o=a.fallback,l=t.mode,a=Fo({mode:"visible",children:a.children},l),o=Dl(o,l,n,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,Bl(t,e.child,null,n),a=t.child,a.memoizedState=_u(n),a.childLanes=Nu(e,r,n),t.memoizedState=ku,t=zr(null,a));else if(Ia(t),Jd(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var u=r.dgst;r=u,a=Error(U(419)),a.stack="",a.digest=r,ai({value:a,source:null,stack:null}),t=Tu(e,t,n)}else if(rt||Js(e,t,n,!1),r=(n&e.childLanes)!==0,rt||r){if(r=Me,r!==null&&(a=zx(r,n),a!==0&&a!==c.retryLane))throw c.retryLane=a,Xl(e,a),Wt(r,e,a),Ff;Kd(o)||nc(),t=Tu(e,t,n)}else Kd(o)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,Ze=zn(o.nextSibling),St=t,xe=!0,el=null,En=!1,e!==null&&ry(t,e),t=$d(t,a.children),t.flags|=4096);return t}return l?(Xa(),o=a.fallback,l=t.mode,c=e.child,u=c.sibling,a=ya(c,{mode:"hidden",children:a.children}),a.subtreeFlags=c.subtreeFlags&65011712,u!==null?o=ya(u,o):(o=Dl(o,l,n,null),o.flags|=2),o.return=t,a.return=t,a.sibling=o,t.child=a,zr(null,a),a=t.child,o=e.child.memoizedState,o===null?o=_u(n):(l=o.cachePool,l!==null?(c=st._currentValue,l=l.parent!==c?{parent:c,pool:c}:l):l=oy(),o={baseLanes:o.baseLanes|n,cachePool:l}),a.memoizedState=o,a.childLanes=Nu(e,r,n),t.memoizedState=ku,zr(e.child,a)):(Ia(t),n=e.child,e=n.sibling,n=ya(n,{mode:"visible",children:a.children}),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n)}function $d(e,t){return t=Fo({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Fo(e,t){return e=cn(22,e,null,t),e.lanes=0,e}function Tu(e,t,n){return Bl(t,e.child,null,n),e=$d(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function em(e,t,n){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),kd(e.return,t,n)}function Eu(e,t,n,a,l,s){var r=e.memoizedState;r===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:n,tailMode:l,treeForkCount:s}:(r.isBackwards=t,r.rendering=null,r.renderingStartTime=0,r.last=a,r.tail=n,r.tailMode=l,r.treeForkCount=s)}function tb(e,t,n){var a=t.pendingProps,l=a.revealOrder,s=a.tail;a=a.children;var r=tt.current,o=(r&2)!==0;if(o?(r=r&1|2,t.flags|=128):r&=1,Le(tt,r),bt(e,t,a,n),a=xe?ni:0,!o&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&em(e,n,t);else if(e.tag===19)em(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&Qo(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),Eu(t,!1,l,n,s,a);break;case"backwards":case"unstable_legacy-backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&Qo(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}Eu(t,!0,n,null,s,a);break;case"together":Eu(t,!1,null,null,void 0,a);break;default:t.memoizedState=null}return t.child}function _a(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),dl|=t.lanes,!(n&t.childLanes))if(e!==null){if(Js(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(U(153));if(t.child!==null){for(e=t.child,n=ya(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ya(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Pf(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&Io(e)))}function I2(e,t,n){switch(t.tag){case 3:Uo(t,t.stateNode.containerInfo),Ya(t,st,e.memoizedState.cache),$l();break;case 27:case 5:dd(t);break;case 4:Uo(t,t.stateNode.containerInfo);break;case 10:Ya(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,zd(t),null;break;case 13:var a=t.memoizedState;if(a!==null)return a.dehydrated!==null?(Ia(t),t.flags|=128,null):n&t.child.childLanes?eb(e,t,n):(Ia(t),e=_a(e,t,n),e!==null?e.sibling:null);Ia(t);break;case 19:var l=(e.flags&128)!==0;if(a=(n&t.childLanes)!==0,a||(Js(e,t,n,!1),a=(n&t.childLanes)!==0),l){if(a)return tb(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),Le(tt,tt.current),a)break;return null;case 22:return t.lanes=0,Py(e,t,n,t.pendingProps);case 24:Ya(t,st,e.memoizedState.cache)}return _a(e,t,n)}function nb(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)rt=!0;else{if(!Pf(e,n)&&!(t.flags&128))return rt=!1,I2(e,t,n);rt=!!(e.flags&131072)}else rt=!1,xe&&t.flags&1048576&&sy(t,ni,t.index);switch(t.lanes=0,t.tag){case 16:e:{var a=t.pendingProps;if(e=Tl(t.elementType),t.type=e,typeof e=="function")Cf(e)?(a=Hl(e,a),t.tag=1,t=Fp(null,t,e,a,n)):(t.tag=0,t=Ld(null,t,e,a,n));else{if(e!=null){var l=e.$$typeof;if(l===xf){t.tag=11,t=Vp(null,t,e,a,n);break e}else if(l===yf){t.tag=14,t=Qp(null,t,e,a,n);break e}}throw t=cd(e)||e,Error(U(306,t,""))}}return t;case 0:return Ld(e,t,t.type,t.pendingProps,n);case 1:return a=t.type,l=Hl(a,t.pendingProps),Fp(e,t,a,l,n);case 3:e:{if(Uo(t,t.stateNode.containerInfo),e===null)throw Error(U(387));a=t.pendingProps;var s=t.memoizedState;l=s.element,Td(e,t),qr(t,a,null,n);var r=t.memoizedState;if(a=r.cache,Ya(t,st,a),a!==s.cache&&_d(t,[st],n,!0),Hr(),a=r.element,s.isDehydrated)if(s={element:a,isDehydrated:!1,cache:r.cache},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){t=Pp(e,t,a,n);break e}else if(a!==l){l=Tn(Error(U(424)),t),ai(l),t=Pp(e,t,a,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ze=zn(e.firstChild),St=t,xe=!0,el=null,En=!0,n=dy(t,null,a,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if($l(),a===l){t=_a(e,t,n);break e}bt(e,t,a,n)}t=t.child}return t;case 26:return Ao(e,t),e===null?(n=vm(t.type,null,t.pendingProps,null))?t.memoizedState=n:xe||(n=t.type,e=t.pendingProps,a=rc(Pa.current).createElement(n),a[vt]=t,a[Ft]=e,jt(a,n,e),mt(a),t.stateNode=a):t.memoizedState=vm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return dd(t),e===null&&xe&&(a=t.stateNode=Xb(t.type,t.pendingProps,Pa.current),St=t,En=!0,l=Ze,pl(t.type)?(Wd=l,Ze=zn(a.firstChild)):Ze=l),bt(e,t,t.pendingProps.children,n),Ao(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&xe&&((l=a=Ze)&&(a=SS(a,t.type,t.pendingProps,En),a!==null?(t.stateNode=a,St=t,Ze=zn(a.firstChild),En=!1,l=!0):l=!1),l||cl(t)),dd(t),l=t.type,s=t.pendingProps,r=e!==null?e.memoizedProps:null,a=s.children,Vd(l,s)?a=null:r!==null&&Vd(l,r)&&(t.flags|=32),t.memoizedState!==null&&(l=Zf(e,t,L2,null,null,n),ci._currentValue=l),Ao(e,t),bt(e,t,a,n),t.child;case 6:return e===null&&xe&&((e=n=Ze)&&(n=wS(n,t.pendingProps,En),n!==null?(t.stateNode=n,St=t,Ze=null,e=!0):e=!1),e||cl(t)),null;case 13:return eb(e,t,n);case 4:return Uo(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=Bl(t,null,a,n):bt(e,t,a,n),t.child;case 11:return Vp(e,t,t.type,t.pendingProps,n);case 7:return bt(e,t,t.pendingProps,n),t.child;case 8:return bt(e,t,t.pendingProps.children,n),t.child;case 12:return bt(e,t,t.pendingProps.children,n),t.child;case 10:return a=t.pendingProps,Ya(t,t.type,a.value),bt(e,t,a.children,n),t.child;case 9:return l=t.type._context,a=t.pendingProps.children,Ul(t),l=wt(l),a=a(l),t.flags|=1,bt(e,t,a,n),t.child;case 14:return Qp(e,t,t.type,t.pendingProps,n);case 15:return Fy(e,t,t.type,t.pendingProps,n);case 19:return tb(e,t,n);case 31:return Y2(e,t,n);case 22:return Py(e,t,n,t.pendingProps);case 24:return Ul(t),a=wt(st),e===null?(l=Rf(),l===null&&(l=Me,s=Mf(),l.pooledCache=s,s.refCount++,s!==null&&(l.pooledCacheLanes|=n),l=s),t.memoizedState={parent:a,cache:l},$f(t),Ya(t,st,l)):(e.lanes&n&&(Td(e,t),qr(t,null,null,n),Hr()),l=e.memoizedState,s=t.memoizedState,l.parent!==a?(l={parent:a,cache:a},t.memoizedState=l,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=l),Ya(t,st,a)):(a=s.cache,Ya(t,st,a),a!==l.cache&&_d(t,[st],n,!0))),bt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(U(156,t.tag))}function ia(e){e.flags|=4}function Au(e,t,n,a,l){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(l&335544128)===l)if(e.stateNode.complete)e.flags|=8192;else if(Nb())e.flags|=8192;else throw Rl=Xo,Lf}else e.flags&=-16777217}function tm(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Kb(t))if(Nb())e.flags|=8192;else throw Rl=Xo,Lf}function eo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Tx():536870912,e.lanes|=t,Zs|=t)}function br(e,t){if(!xe)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null}}function Be(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,a=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,a|=l.subtreeFlags&65011712,a|=l.flags&65011712,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,a|=l.subtreeFlags,a|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=a,e.childLanes=n,t}function X2(e,t,n){var a=t.pendingProps;switch(Df(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Be(t),null;case 1:return Be(t),null;case 3:return n=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),ba(st),Ms(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ts(t)?ia(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,vu())),Be(t),null;case 26:var l=t.type,s=t.memoizedState;return e===null?(ia(t),s!==null?(Be(t),tm(t,s)):(Be(t),Au(t,l,null,a,n))):s?s!==e.memoizedState?(ia(t),Be(t),tm(t,s)):(Be(t),t.flags&=-16777217):(e=e.memoizedProps,e!==a&&ia(t),Be(t),Au(t,l,e,a,n)),null;case 27:if(Bo(t),n=Pa.current,l=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&ia(t);else{if(!a){if(t.stateNode===null)throw Error(U(166));return Be(t),null}e=ea.current,ts(t)?zp(t):(e=Xb(l,a,n),t.stateNode=e,ia(t))}return Be(t),null;case 5:if(Bo(t),l=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&ia(t);else{if(!a){if(t.stateNode===null)throw Error(U(166));return Be(t),null}if(s=ea.current,ts(t))zp(t);else{var r=rc(Pa.current);switch(s){case 1:s=r.createElementNS("http://www.w3.org/2000/svg",l);break;case 2:s=r.createElementNS("http://www.w3.org/1998/Math/MathML",l);break;default:switch(l){case"svg":s=r.createElementNS("http://www.w3.org/2000/svg",l);break;case"math":s=r.createElementNS("http://www.w3.org/1998/Math/MathML",l);break;case"script":s=r.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof a.is=="string"?r.createElement("select",{is:a.is}):r.createElement("select"),a.multiple?s.multiple=!0:a.size&&(s.size=a.size);break;default:s=typeof a.is=="string"?r.createElement(l,{is:a.is}):r.createElement(l)}}s[vt]=t,s[Ft]=a;e:for(r=t.child;r!==null;){if(r.tag===5||r.tag===6)s.appendChild(r.stateNode);else if(r.tag!==4&&r.tag!==27&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break e;for(;r.sibling===null;){if(r.return===null||r.return===t)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}t.stateNode=s;e:switch(jt(s,l,a),l){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&ia(t)}}return Be(t),Au(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&ia(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(U(166));if(e=Pa.current,ts(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,l=St,l!==null)switch(l.tag){case 27:case 5:a=l.memoizedProps}e[vt]=t,e=!!(e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||qb(e.nodeValue,n)),e||cl(t,!0)}else e=rc(e).createTextNode(a),e[vt]=t,t.stateNode=e}return Be(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(a=ts(t),n!==null){if(e===null){if(!a)throw Error(U(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(U(557));e[vt]=t}else $l(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Be(t),e=!1}else n=vu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(on(t),t):(on(t),null);if(t.flags&128)throw Error(U(558))}return Be(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(l=ts(t),a!==null&&a.dehydrated!==null){if(e===null){if(!l)throw Error(U(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(U(317));l[vt]=t}else $l(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Be(t),l=!1}else l=vu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),l=!0;if(!l)return t.flags&256?(on(t),t):(on(t),null)}return on(t),t.flags&128?(t.lanes=n,t):(n=a!==null,e=e!==null&&e.memoizedState!==null,n&&(a=t.child,l=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(l=a.alternate.memoizedState.cachePool.pool),s=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(s=a.memoizedState.cachePool.pool),s!==l&&(a.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),eo(t,t.updateQueue),Be(t),null);case 4:return Ms(),e===null&&rh(t.stateNode.containerInfo),Be(t),null;case 10:return ba(t.type),Be(t),null;case 19:if(gt(tt),a=t.memoizedState,a===null)return Be(t),null;if(l=(t.flags&128)!==0,s=a.rendering,s===null)if(l)br(a,!1);else{if(Pe!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=Qo(e),s!==null){for(t.flags|=128,br(a,!1),e=s.updateQueue,t.updateQueue=e,eo(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ay(n,e),n=n.sibling;return Le(tt,tt.current&1|2),xe&&ha(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&fn()>ec&&(t.flags|=128,l=!0,br(a,!1),t.lanes=4194304)}else{if(!l)if(e=Qo(s),e!==null){if(t.flags|=128,l=!0,e=e.updateQueue,t.updateQueue=e,eo(t,e),br(a,!0),a.tail===null&&a.tailMode==="hidden"&&!s.alternate&&!xe)return Be(t),null}else 2*fn()-a.renderingStartTime>ec&&n!==536870912&&(t.flags|=128,l=!0,br(a,!1),t.lanes=4194304);a.isBackwards?(s.sibling=t.child,t.child=s):(e=a.last,e!==null?e.sibling=s:t.child=s,a.last=s)}return a.tail!==null?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=fn(),e.sibling=null,n=tt.current,Le(tt,l?n&1|2:n&1),xe&&ha(t,a.treeForkCount),e):(Be(t),null);case 22:case 23:return on(t),Uf(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?n&536870912&&!(t.flags&128)&&(Be(t),t.subtreeFlags&6&&(t.flags|=8192)):Be(t),n=t.updateQueue,n!==null&&eo(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==n&&(t.flags|=2048),e!==null&>(Ml),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ba(st),Be(t),null;case 25:return null;case 30:return null}throw Error(U(156,t.tag))}function V2(e,t){switch(Df(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ba(st),Ms(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Bo(t),null;case 31:if(t.memoizedState!==null){if(on(t),t.alternate===null)throw Error(U(340));$l()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(on(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(U(340));$l()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return gt(tt),null;case 4:return Ms(),null;case 10:return ba(t.type),null;case 22:case 23:return on(t),Uf(),e!==null&>(Ml),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ba(st),null;case 25:return null;default:return null}}function ab(e,t){switch(Df(t),t.tag){case 3:ba(st),Ms();break;case 26:case 27:case 5:Bo(t);break;case 4:Ms();break;case 31:t.memoizedState!==null&&on(t);break;case 13:on(t);break;case 19:gt(tt);break;case 10:ba(t.type);break;case 22:case 23:on(t),Uf(),e!==null&>(Ml);break;case 24:ba(st)}}function ki(e,t){try{var n=t.updateQueue,a=n!==null?n.lastEffect:null;if(a!==null){var l=a.next;n=l;do{if((n.tag&e)===e){a=void 0;var s=n.create,r=n.inst;a=s(),r.destroy=a}n=n.next}while(n!==l)}}catch(o){Ee(t,t.return,o)}}function ul(e,t,n){try{var a=t.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var s=l.next;a=s;do{if((a.tag&e)===e){var r=a.inst,o=r.destroy;if(o!==void 0){r.destroy=void 0,l=t;var c=n,u=o;try{u()}catch(d){Ee(l,c,d)}}}a=a.next}while(a!==s)}}catch(d){Ee(t,t.return,d)}}function lb(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{hy(t,n)}catch(a){Ee(e,e.return,a)}}}function sb(e,t,n){n.props=Hl(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){Ee(e,t,a)}}function Yr(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:a=e.stateNode;break;default:a=e.stateNode}typeof n=="function"?e.refCleanup=n(a):n.current=a}}catch(l){Ee(e,t,l)}}function Pn(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a=="function")try{a()}catch(l){Ee(e,t,l)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(l){Ee(e,t,l)}else n.current=null}function rb(e){var t=e.type,n=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&a.focus();break e;case"img":n.src?a.src=n.src:n.srcSet&&(a.srcset=n.srcSet)}}catch(l){Ee(e,e.return,l)}}function zu(e,t,n){try{var a=e.stateNode;mS(a,e.type,n,t),a[Ft]=t}catch(l){Ee(e,e.return,l)}}function ib(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&pl(e.type)||e.tag===4}function Cu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ib(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&pl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ud(e,t,n){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ga));else if(a!==4&&(a===27&&pl(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Ud(e,t,n),e=e.sibling;e!==null;)Ud(e,t,n),e=e.sibling}function Po(e,t,n){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(a!==4&&(a===27&&pl(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Po(e,t,n),e=e.sibling;e!==null;)Po(e,t,n),e=e.sibling}function ob(e){var t=e.stateNode,n=e.memoizedProps;try{for(var a=e.type,l=t.attributes;l.length;)t.removeAttributeNode(l[0]);jt(t,a,n),t[vt]=e,t[Ft]=n}catch(s){Ee(e,e.return,s)}}var pa=!1,lt=!1,Ou=!1,nm=typeof WeakSet=="function"?WeakSet:Set,ht=null;function Q2(e,t){if(e=e.containerInfo,Id=uc,e=Kx(e),Ef(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var a=n.getSelection&&n.getSelection();if(a&&a.rangeCount!==0){n=a.anchorNode;var l=a.anchorOffset,s=a.focusNode;a=a.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var r=0,o=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||l!==0&&f.nodeType!==3||(o=r+l),f!==s||a!==0&&f.nodeType!==3||(c=r+a),f.nodeType===3&&(r+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===l&&(o=r),h===s&&++d===a&&(c=r),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Xd={focusedElem:e,selectionRange:n},uc=!1,ht=t;ht!==null;)if(t=ht,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ht=e;else for(;ht!==null;){switch(t=ht,s=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)l=e[n],l.ref.impl=l.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&s!==null){e=void 0,n=t,l=s.memoizedProps,s=s.memoizedState,a=n.stateNode;try{var v=Hl(n.type,l);e=a.getSnapshotBeforeUpdate(v,s),a.__reactInternalSnapshotBeforeUpdate=e}catch(j){Ee(n,n.return,j)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Qd(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Qd(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(U(163))}if(e=t.sibling,e!==null){e.return=t.return,ht=e;break}ht=t.return}}function cb(e,t,n){var a=n.flags;switch(n.tag){case 0:case 11:case 15:ca(e,n),a&4&&ki(5,n);break;case 1:if(ca(e,n),a&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(r){Ee(n,n.return,r)}else{var l=Hl(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(l,t,e.__reactInternalSnapshotBeforeUpdate)}catch(r){Ee(n,n.return,r)}}a&64&&lb(n),a&512&&Yr(n,n.return);break;case 3:if(ca(e,n),a&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{hy(e,t)}catch(r){Ee(n,n.return,r)}}break;case 27:t===null&&a&4&&ob(n);case 26:case 5:ca(e,n),t===null&&a&4&&rb(n),a&512&&Yr(n,n.return);break;case 12:ca(e,n);break;case 31:ca(e,n),a&4&&fb(e,n);break;case 13:ca(e,n),a&4&&hb(e,n),a&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=aS.bind(null,n),jS(e,n))));break;case 22:if(a=n.memoizedState!==null||pa,!a){t=t!==null&&t.memoizedState!==null||lt,l=pa;var s=lt;pa=a,(lt=t)&&!s?fa(e,n,(n.subtreeFlags&8772)!==0):ca(e,n),pa=l,lt=s}break;case 30:break;default:ca(e,n)}}function ub(e){var t=e.alternate;t!==null&&(e.alternate=null,ub(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&wf(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Ye=null,Vt=!1;function oa(e,t,n){for(n=n.child;n!==null;)db(e,t,n),n=n.sibling}function db(e,t,n){if(hn&&typeof hn.onCommitFiberUnmount=="function")try{hn.onCommitFiberUnmount(xi,n)}catch{}switch(n.tag){case 26:lt||Pn(n,t),oa(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:lt||Pn(n,t);var a=Ye,l=Vt;pl(n.type)&&(Ye=n.stateNode,Vt=!1),oa(e,t,n),Qr(n.stateNode),Ye=a,Vt=l;break;case 5:lt||Pn(n,t);case 6:if(a=Ye,l=Vt,Ye=null,oa(e,t,n),Ye=a,Vt=l,Ye!==null)if(Vt)try{(Ye.nodeType===9?Ye.body:Ye.nodeName==="HTML"?Ye.ownerDocument.body:Ye).removeChild(n.stateNode)}catch(s){Ee(n,t,s)}else try{Ye.removeChild(n.stateNode)}catch(s){Ee(n,t,s)}break;case 18:Ye!==null&&(Vt?(e=Ye,mm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Ys(e)):mm(Ye,n.stateNode));break;case 4:a=Ye,l=Vt,Ye=n.stateNode.containerInfo,Vt=!0,oa(e,t,n),Ye=a,Vt=l;break;case 0:case 11:case 14:case 15:ul(2,n,t),lt||ul(4,n,t),oa(e,t,n);break;case 1:lt||(Pn(n,t),a=n.stateNode,typeof a.componentWillUnmount=="function"&&sb(n,t,a)),oa(e,t,n);break;case 21:oa(e,t,n);break;case 22:lt=(a=lt)||n.memoizedState!==null,oa(e,t,n),lt=a;break;default:oa(e,t,n)}}function fb(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ys(e)}catch(n){Ee(t,t.return,n)}}}function hb(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ys(e)}catch(n){Ee(t,t.return,n)}}function K2(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new nm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new nm),t;default:throw Error(U(435,e.tag))}}function to(e,t){var n=K2(e);t.forEach(function(a){if(!n.has(a)){n.add(a);var l=lS.bind(null,e,a);a.then(l,l)}})}function It(e,t){var n=t.deletions;if(n!==null)for(var a=0;a<n.length;a++){var l=n[a],s=e,r=t,o=r;e:for(;o!==null;){switch(o.tag){case 27:if(pl(o.type)){Ye=o.stateNode,Vt=!1;break e}break;case 5:Ye=o.stateNode,Vt=!1;break e;case 3:case 4:Ye=o.stateNode.containerInfo,Vt=!0;break e}o=o.return}if(Ye===null)throw Error(U(160));db(s,r,l),Ye=null,Vt=!1,s=l.alternate,s!==null&&(s.return=null),l.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)pb(t,e),t=t.sibling}var Bn=null;function pb(e,t){var n=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:It(t,e),Xt(e),a&4&&(ul(3,e,e.return),ki(3,e),ul(5,e,e.return));break;case 1:It(t,e),Xt(e),a&512&&(lt||n===null||Pn(n,n.return)),a&64&&pa&&(e=e.updateQueue,e!==null&&(a=e.callbacks,a!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?a:n.concat(a))));break;case 26:var l=Bn;if(It(t,e),Xt(e),a&512&&(lt||n===null||Pn(n,n.return)),a&4){var s=n!==null?n.memoizedState:null;if(a=e.memoizedState,n===null)if(a===null)if(e.stateNode===null){e:{a=e.type,n=e.memoizedProps,l=l.ownerDocument||l;t:switch(a){case"title":s=l.getElementsByTagName("title")[0],(!s||s[vi]||s[vt]||s.namespaceURI==="http://www.w3.org/2000/svg"||s.hasAttribute("itemprop"))&&(s=l.createElement(a),l.head.insertBefore(s,l.querySelector("head > title"))),jt(s,a,n),s[vt]=e,mt(s),a=s;break e;case"link":var r=wm("link","href",l).get(a+(n.href||""));if(r){for(var o=0;o<r.length;o++)if(s=r[o],s.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&s.getAttribute("rel")===(n.rel==null?null:n.rel)&&s.getAttribute("title")===(n.title==null?null:n.title)&&s.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){r.splice(o,1);break t}}s=l.createElement(a),jt(s,a,n),l.head.appendChild(s);break;case"meta":if(r=wm("meta","content",l).get(a+(n.content||""))){for(o=0;o<r.length;o++)if(s=r[o],s.getAttribute("content")===(n.content==null?null:""+n.content)&&s.getAttribute("name")===(n.name==null?null:n.name)&&s.getAttribute("property")===(n.property==null?null:n.property)&&s.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&s.getAttribute("charset")===(n.charSet==null?null:n.charSet)){r.splice(o,1);break t}}s=l.createElement(a),jt(s,a,n),l.head.appendChild(s);break;default:throw Error(U(468,a))}s[vt]=e,mt(s),a=s}e.stateNode=a}else jm(l,e.type,e.stateNode);else e.stateNode=Sm(l,a,e.memoizedProps);else s!==a?(s===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):s.count--,a===null?jm(l,e.type,e.stateNode):Sm(l,a,e.memoizedProps)):a===null&&e.stateNode!==null&&zu(e,e.memoizedProps,n.memoizedProps)}break;case 27:It(t,e),Xt(e),a&512&&(lt||n===null||Pn(n,n.return)),n!==null&&a&4&&zu(e,e.memoizedProps,n.memoizedProps);break;case 5:if(It(t,e),Xt(e),a&512&&(lt||n===null||Pn(n,n.return)),e.flags&32){l=e.stateNode;try{Ls(l,"")}catch(v){Ee(e,e.return,v)}}a&4&&e.stateNode!=null&&(l=e.memoizedProps,zu(e,l,n!==null?n.memoizedProps:l)),a&1024&&(Ou=!0);break;case 6:if(It(t,e),Xt(e),a&4){if(e.stateNode===null)throw Error(U(162));a=e.memoizedProps,n=e.stateNode;try{n.nodeValue=a}catch(v){Ee(e,e.return,v)}}break;case 3:if(Oo=null,l=Bn,Bn=ic(t.containerInfo),It(t,e),Bn=l,Xt(e),a&4&&n!==null&&n.memoizedState.isDehydrated)try{Ys(t.containerInfo)}catch(v){Ee(e,e.return,v)}Ou&&(Ou=!1,mb(e));break;case 4:a=Bn,Bn=ic(e.stateNode.containerInfo),It(t,e),Xt(e),Bn=a;break;case 12:It(t,e),Xt(e);break;case 31:It(t,e),Xt(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,to(e,a)));break;case 13:It(t,e),Xt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Bc=fn()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,to(e,a)));break;case 22:l=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,u=pa,d=lt;if(pa=u||l,lt=d||c,It(t,e),lt=d,pa=u,Xt(e),a&8192)e:for(t=e.stateNode,t._visibility=l?t._visibility&-2:t._visibility|1,l&&(n===null||c||pa||lt||El(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){c=n=t;try{if(s=c.stateNode,l)r=s.style,typeof r.setProperty=="function"?r.setProperty("display","none","important"):r.display="none";else{o=c.stateNode;var f=c.memoizedProps.style,h=f!=null&&f.hasOwnProperty("display")?f.display:null;o.style.display=h==null||typeof h=="boolean"?"":(""+h).trim()}}catch(v){Ee(c,c.return,v)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=l?"":c.memoizedProps}catch(v){Ee(c,c.return,v)}}}else if(t.tag===18){if(n===null){c=t;try{var p=c.stateNode;l?gm(p,!0):gm(c.stateNode,!1)}catch(v){Ee(c,c.return,v)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}a&4&&(a=e.updateQueue,a!==null&&(n=a.retryQueue,n!==null&&(a.retryQueue=null,to(e,n))));break;case 19:It(t,e),Xt(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,to(e,a)));break;case 30:break;case 21:break;default:It(t,e),Xt(e)}}function Xt(e){var t=e.flags;if(t&2){try{for(var n,a=e.return;a!==null;){if(ib(a)){n=a;break}a=a.return}if(n==null)throw Error(U(160));switch(n.tag){case 27:var l=n.stateNode,s=Cu(e);Po(e,s,l);break;case 5:var r=n.stateNode;n.flags&32&&(Ls(r,""),n.flags&=-33);var o=Cu(e);Po(e,o,r);break;case 3:case 4:var c=n.stateNode.containerInfo,u=Cu(e);Ud(e,u,c);break;default:throw Error(U(161))}}catch(d){Ee(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function mb(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;mb(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ca(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)cb(e,t.alternate,t),t=t.sibling}function El(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ul(4,t,t.return),El(t);break;case 1:Pn(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&sb(t,t.return,n),El(t);break;case 27:Qr(t.stateNode);case 26:case 5:Pn(t,t.return),El(t);break;case 22:t.memoizedState===null&&El(t);break;case 30:El(t);break;default:El(t)}e=e.sibling}}function fa(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var a=t.alternate,l=e,s=t,r=s.flags;switch(s.tag){case 0:case 11:case 15:fa(l,s,n),ki(4,s);break;case 1:if(fa(l,s,n),a=s,l=a.stateNode,typeof l.componentDidMount=="function")try{l.componentDidMount()}catch(u){Ee(a,a.return,u)}if(a=s,l=a.updateQueue,l!==null){var o=a.stateNode;try{var c=l.shared.hiddenCallbacks;if(c!==null)for(l.shared.hiddenCallbacks=null,l=0;l<c.length;l++)fy(c[l],o)}catch(u){Ee(a,a.return,u)}}n&&r&64&&lb(s),Yr(s,s.return);break;case 27:ob(s);case 26:case 5:fa(l,s,n),n&&a===null&&r&4&&rb(s),Yr(s,s.return);break;case 12:fa(l,s,n);break;case 31:fa(l,s,n),n&&r&4&&fb(l,s);break;case 13:fa(l,s,n),n&&r&4&&hb(l,s);break;case 22:s.memoizedState===null&&fa(l,s,n),Yr(s,s.return);break;case 30:break;default:fa(l,s,n)}t=t.sibling}}function eh(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&wi(n))}function th(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&wi(e))}function Rn(e,t,n,a){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)gb(e,t,n,a),t=t.sibling}function gb(e,t,n,a){var l=t.flags;switch(t.tag){case 0:case 11:case 15:Rn(e,t,n,a),l&2048&&ki(9,t);break;case 1:Rn(e,t,n,a);break;case 3:Rn(e,t,n,a),l&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&wi(e)));break;case 12:if(l&2048){Rn(e,t,n,a),e=t.stateNode;try{var s=t.memoizedProps,r=s.id,o=s.onPostCommit;typeof o=="function"&&o(r,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){Ee(t,t.return,c)}}else Rn(e,t,n,a);break;case 31:Rn(e,t,n,a);break;case 13:Rn(e,t,n,a);break;case 23:break;case 22:s=t.stateNode,r=t.alternate,t.memoizedState!==null?s._visibility&2?Rn(e,t,n,a):Ir(e,t):s._visibility&2?Rn(e,t,n,a):(s._visibility|=2,ss(e,t,n,a,(t.subtreeFlags&10256)!==0||!1)),l&2048&&eh(r,t);break;case 24:Rn(e,t,n,a),l&2048&&th(t.alternate,t);break;default:Rn(e,t,n,a)}}function ss(e,t,n,a,l){for(l=l&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var s=e,r=t,o=n,c=a,u=r.flags;switch(r.tag){case 0:case 11:case 15:ss(s,r,o,c,l),ki(8,r);break;case 23:break;case 22:var d=r.stateNode;r.memoizedState!==null?d._visibility&2?ss(s,r,o,c,l):Ir(s,r):(d._visibility|=2,ss(s,r,o,c,l)),l&&u&2048&&eh(r.alternate,r);break;case 24:ss(s,r,o,c,l),l&&u&2048&&th(r.alternate,r);break;default:ss(s,r,o,c,l)}t=t.sibling}}function Ir(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,a=t,l=a.flags;switch(a.tag){case 22:Ir(n,a),l&2048&&eh(a.alternate,a);break;case 24:Ir(n,a),l&2048&&th(a.alternate,a);break;default:Ir(n,a)}t=t.sibling}}var Cr=8192;function ns(e,t,n){if(e.subtreeFlags&Cr)for(e=e.child;e!==null;)xb(e,t,n),e=e.sibling}function xb(e,t,n){switch(e.tag){case 26:ns(e,t,n),e.flags&Cr&&e.memoizedState!==null&&RS(n,Bn,e.memoizedState,e.memoizedProps);break;case 5:ns(e,t,n);break;case 3:case 4:var a=Bn;Bn=ic(e.stateNode.containerInfo),ns(e,t,n),Bn=a;break;case 22:e.memoizedState===null&&(a=e.alternate,a!==null&&a.memoizedState!==null?(a=Cr,Cr=16777216,ns(e,t,n),Cr=a):ns(e,t,n));break;default:ns(e,t,n)}}function yb(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function vr(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];ht=a,vb(a,e)}yb(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)bb(e),e=e.sibling}function bb(e){switch(e.tag){case 0:case 11:case 15:vr(e),e.flags&2048&&ul(9,e,e.return);break;case 3:vr(e);break;case 12:vr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,zo(e)):vr(e);break;default:vr(e)}}function zo(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];ht=a,vb(a,e)}yb(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ul(8,t,t.return),zo(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,zo(t));break;default:zo(t)}e=e.sibling}}function vb(e,t){for(;ht!==null;){var n=ht;switch(n.tag){case 0:case 11:case 15:ul(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var a=n.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:wi(n.memoizedState.cache)}if(a=n.child,a!==null)a.return=n,ht=a;else e:for(n=e;ht!==null;){a=ht;var l=a.sibling,s=a.return;if(ub(a),a===n){ht=null;break e}if(l!==null){l.return=s,ht=l;break e}ht=s}}}var J2={getCacheForType:function(e){var t=wt(st),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return wt(st).controller.signal}},W2=typeof WeakMap=="function"?WeakMap:Map,je=0,Me=null,pe=null,ge=0,Te=0,rn=null,Ja=!1,Fs=!1,nh=!1,Na=0,Pe=0,dl=0,Ll=0,ah=0,dn=0,Zs=0,Xr=null,Kt=null,Bd=!1,Bc=0,Sb=0,ec=1/0,tc=null,al=null,ut=0,ll=null,Hs=null,va=0,Zd=0,Hd=null,wb=null,Vr=0,qd=null;function mn(){return je&2&&ge!==0?ge&-ge:se.T!==null?sh():Cx()}function jb(){if(dn===0)if(!(ge&536870912)||xe){var e=Vi;Vi<<=1,!(Vi&3932160)&&(Vi=262144),dn=e}else dn=536870912;return e=xn.current,e!==null&&(e.flags|=32),dn}function Wt(e,t,n){(e===Me&&(Te===2||Te===9)||e.cancelPendingCommit!==null)&&(qs(e,0),Wa(e,ge,dn,!1)),bi(e,n),(!(je&2)||e!==Me)&&(e===Me&&(!(je&2)&&(Ll|=n),Pe===4&&Wa(e,ge,dn,!1)),aa(e))}function kb(e,t,n){if(je&6)throw Error(U(327));var a=!n&&(t&127)===0&&(t&e.expiredLanes)===0||yi(e,t),l=a?eS(e,t):Du(e,t,!0),s=a;do{if(l===0){Fs&&!a&&Wa(e,t,0,!1);break}else{if(n=e.current.alternate,s&&!F2(n)){l=Du(e,t,!1),s=!1;continue}if(l===2){if(s=t,e.errorRecoveryDisabledLanes&s)var r=0;else r=e.pendingLanes&-536870913,r=r!==0?r:r&536870912?536870912:0;if(r!==0){t=r;e:{var o=e;l=Xr;var c=o.current.memoizedState.isDehydrated;if(c&&(qs(o,r).flags|=256),r=Du(o,r,!1),r!==2){if(nh&&!c){o.errorRecoveryDisabledLanes|=s,Ll|=s,l=4;break e}s=Kt,Kt=l,s!==null&&(Kt===null?Kt=s:Kt.push.apply(Kt,s))}l=r}if(s=!1,l!==2)continue}}if(l===1){qs(e,0),Wa(e,t,0,!0);break}e:{switch(a=e,s=l,s){case 0:case 1:throw Error(U(345));case 4:if((t&4194048)!==t)break;case 6:Wa(a,t,dn,!Ja);break e;case 2:Kt=null;break;case 3:case 5:break;default:throw Error(U(329))}if((t&62914560)===t&&(l=Bc+300-fn(),10<l)){if(Wa(a,t,dn,!Ja),Ec(a,0,!0)!==0)break e;va=t,a.timeoutHandle=Yb(am.bind(null,a,n,Kt,tc,Bd,t,dn,Ll,Zs,Ja,s,"Throttled",-0,0),l);break e}am(a,n,Kt,tc,Bd,t,dn,Ll,Zs,Ja,s,null,-0,0)}}break}while(!0);aa(e)}function am(e,t,n,a,l,s,r,o,c,u,d,f,h,p){if(e.timeoutHandle=-1,f=t.subtreeFlags,f&8192||(f&16785408)===16785408){f={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ga},xb(t,s,f);var v=(s&62914560)===s?Bc-fn():(s&4194048)===s?Sb-fn():0;if(v=LS(f,v),v!==null){va=s,e.cancelPendingCommit=v(sm.bind(null,e,t,s,n,a,l,r,o,c,d,f,null,h,p)),Wa(e,s,r,!u);return}}sm(e,t,s,n,a,l,r,o,c)}function F2(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var a=0;a<n.length;a++){var l=n[a],s=l.getSnapshot;l=l.value;try{if(!gn(s(),l))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Wa(e,t,n,a){t&=~ah,t&=~Ll,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var l=t;0<l;){var s=31-pn(l),r=1<<s;a[s]=-1,l&=~r}n!==0&&Ex(e,n,t)}function Zc(){return je&6?!0:(_i(0),!1)}function lh(){if(pe!==null){if(Te===0)var e=pe.return;else e=pe,xa=Vl=null,Gf(e),Ts=null,li=0,e=pe;for(;e!==null;)ab(e.alternate,e),e=e.return;pe=null}}function qs(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,yS(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),va=0,lh(),Me=e,pe=n=ya(e.current,null),ge=t,Te=0,rn=null,Ja=!1,Fs=yi(e,t),nh=!1,Zs=dn=ah=Ll=dl=Pe=0,Kt=Xr=null,Bd=!1,t&8&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var l=31-pn(a),s=1<<l;t|=e[l],a&=~s}return Na=t,Oc(),n}function _b(e,t){de=null,se.H=ri,t===Ws||t===Mc?(t=Rp(),Te=3):t===Lf?(t=Rp(),Te=4):Te=t===Ff?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,rn=t,pe===null&&(Pe=1,Wo(e,Tn(t,e.current)))}function Nb(){var e=xn.current;return e===null?!0:(ge&4194048)===ge?An===null:(ge&62914560)===ge||ge&536870912?e===An:!1}function Tb(){var e=se.H;return se.H=ri,e===null?ri:e}function Eb(){var e=se.A;return se.A=J2,e}function nc(){Pe=4,Ja||(ge&4194048)!==ge&&xn.current!==null||(Fs=!0),!(dl&134217727)&&!(Ll&134217727)||Me===null||Wa(Me,ge,dn,!1)}function Du(e,t,n){var a=je;je|=2;var l=Tb(),s=Eb();(Me!==e||ge!==t)&&(tc=null,qs(e,t)),t=!1;var r=Pe;e:do try{if(Te!==0&&pe!==null){var o=pe,c=rn;switch(Te){case 8:lh(),r=6;break e;case 3:case 2:case 9:case 6:xn.current===null&&(t=!0);var u=Te;if(Te=0,rn=null,bs(e,o,c,u),n&&Fs){r=0;break e}break;default:u=Te,Te=0,rn=null,bs(e,o,c,u)}}P2(),r=Pe;break}catch(d){_b(e,d)}while(!0);return t&&e.shellSuspendCounter++,xa=Vl=null,je=a,se.H=l,se.A=s,pe===null&&(Me=null,ge=0,Oc()),r}function P2(){for(;pe!==null;)Ab(pe)}function eS(e,t){var n=je;je|=2;var a=Tb(),l=Eb();Me!==e||ge!==t?(tc=null,ec=fn()+500,qs(e,t)):Fs=yi(e,t);e:do try{if(Te!==0&&pe!==null){t=pe;var s=rn;t:switch(Te){case 1:Te=0,rn=null,bs(e,t,s,1);break;case 2:case 9:if(Mp(s)){Te=0,rn=null,lm(t);break}t=function(){Te!==2&&Te!==9||Me!==e||(Te=7),aa(e)},s.then(t,t);break e;case 3:Te=7;break e;case 4:Te=5;break e;case 7:Mp(s)?(Te=0,rn=null,lm(t)):(Te=0,rn=null,bs(e,t,s,7));break;case 5:var r=null;switch(pe.tag){case 26:r=pe.memoizedState;case 5:case 27:var o=pe;if(r?Kb(r):o.stateNode.complete){Te=0,rn=null;var c=o.sibling;if(c!==null)pe=c;else{var u=o.return;u!==null?(pe=u,Hc(u)):pe=null}break t}}Te=0,rn=null,bs(e,t,s,5);break;case 6:Te=0,rn=null,bs(e,t,s,6);break;case 8:lh(),Pe=6;break e;default:throw Error(U(462))}}tS();break}catch(d){_b(e,d)}while(!0);return xa=Vl=null,se.H=a,se.A=l,je=n,pe!==null?0:(Me=null,ge=0,Oc(),Pe)}function tS(){for(;pe!==null&&!k1();)Ab(pe)}function Ab(e){var t=nb(e.alternate,e,Na);e.memoizedProps=e.pendingProps,t===null?Hc(e):pe=t}function lm(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Wp(n,t,t.pendingProps,t.type,void 0,ge);break;case 11:t=Wp(n,t,t.pendingProps,t.type.render,t.ref,ge);break;case 5:Gf(t);default:ab(n,t),t=pe=ay(t,Na),t=nb(n,t,Na)}e.memoizedProps=e.pendingProps,t===null?Hc(e):pe=t}function bs(e,t,n,a){xa=Vl=null,Gf(t),Ts=null,li=0;var l=t.return;try{if(G2(e,l,t,n,ge)){Pe=1,Wo(e,Tn(n,e.current)),pe=null;return}}catch(s){if(l!==null)throw pe=l,s;Pe=1,Wo(e,Tn(n,e.current)),pe=null;return}t.flags&32768?(xe||a===1?e=!0:Fs||ge&536870912?e=!1:(Ja=e=!0,(a===2||a===9||a===3||a===6)&&(a=xn.current,a!==null&&a.tag===13&&(a.flags|=16384))),zb(t,e)):Hc(t)}function Hc(e){var t=e;do{if(t.flags&32768){zb(t,Ja);return}e=t.return;var n=X2(t.alternate,t,Na);if(n!==null){pe=n;return}if(t=t.sibling,t!==null){pe=t;return}pe=t=e}while(t!==null);Pe===0&&(Pe=5)}function zb(e,t){do{var n=V2(e.alternate,e);if(n!==null){n.flags&=32767,pe=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){pe=e;return}pe=e=n}while(e!==null);Pe=6,pe=null}function sm(e,t,n,a,l,s,r,o,c){e.cancelPendingCommit=null;do qc();while(ut!==0);if(je&6)throw Error(U(327));if(t!==null){if(t===e.current)throw Error(U(177));if(s=t.lanes|t.childLanes,s|=Af,M1(e,n,s,r,o,c),e===Me&&(pe=Me=null,ge=0),Hs=t,ll=e,va=n,Zd=s,Hd=l,wb=a,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,sS(Zo,function(){return Rb(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!==0,t.subtreeFlags&13878||a){a=se.T,se.T=null,l=ke.p,ke.p=2,r=je,je|=4;try{Q2(e,t,n)}finally{je=r,ke.p=l,se.T=a}}ut=1,Cb(),Ob(),Db()}}function Cb(){if(ut===1){ut=0;var e=ll,t=Hs,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=se.T,se.T=null;var a=ke.p;ke.p=2;var l=je;je|=4;try{pb(t,e);var s=Xd,r=Kx(e.containerInfo),o=s.focusedElem,c=s.selectionRange;if(r!==o&&o&&o.ownerDocument&&Qx(o.ownerDocument.documentElement,o)){if(c!==null&&Ef(o)){var u=c.start,d=c.end;if(d===void 0&&(d=u),"selectionStart"in o)o.selectionStart=u,o.selectionEnd=Math.min(d,o.value.length);else{var f=o.ownerDocument||document,h=f&&f.defaultView||window;if(h.getSelection){var p=h.getSelection(),v=o.textContent.length,j=Math.min(c.start,v),k=c.end===void 0?j:Math.min(c.end,v);!p.extend&&j>k&&(r=k,k=j,j=r);var g=Tp(o,j),x=Tp(o,k);if(g&&x&&(p.rangeCount!==1||p.anchorNode!==g.node||p.anchorOffset!==g.offset||p.focusNode!==x.node||p.focusOffset!==x.offset)){var b=f.createRange();b.setStart(g.node,g.offset),p.removeAllRanges(),j>k?(p.addRange(b),p.extend(x.node,x.offset)):(b.setEnd(x.node,x.offset),p.addRange(b))}}}}for(f=[],p=o;p=p.parentNode;)p.nodeType===1&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<f.length;o++){var y=f[o];y.element.scrollLeft=y.left,y.element.scrollTop=y.top}}uc=!!Id,Xd=Id=null}finally{je=l,ke.p=a,se.T=n}}e.current=t,ut=2}}function Ob(){if(ut===2){ut=0;var e=ll,t=Hs,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=se.T,se.T=null;var a=ke.p;ke.p=2;var l=je;je|=4;try{cb(e,t.alternate,t)}finally{je=l,ke.p=a,se.T=n}}ut=3}}function Db(){if(ut===4||ut===3){ut=0,_1();var e=ll,t=Hs,n=va,a=wb;t.subtreeFlags&10256||t.flags&10256?ut=5:(ut=0,Hs=ll=null,Mb(e,e.pendingLanes));var l=e.pendingLanes;if(l===0&&(al=null),Sf(n),t=t.stateNode,hn&&typeof hn.onCommitFiberRoot=="function")try{hn.onCommitFiberRoot(xi,t,void 0,(t.current.flags&128)===128)}catch{}if(a!==null){t=se.T,l=ke.p,ke.p=2,se.T=null;try{for(var s=e.onRecoverableError,r=0;r<a.length;r++){var o=a[r];s(o.value,{componentStack:o.stack})}}finally{se.T=t,ke.p=l}}va&3&&qc(),aa(e),l=e.pendingLanes,n&261930&&l&42?e===qd?Vr++:(Vr=0,qd=e):Vr=0,_i(0)}}function Mb(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,wi(t)))}function qc(){return Cb(),Ob(),Db(),Rb()}function Rb(){if(ut!==5)return!1;var e=ll,t=Zd;Zd=0;var n=Sf(va),a=se.T,l=ke.p;try{ke.p=32>n?32:n,se.T=null,n=Hd,Hd=null;var s=ll,r=va;if(ut=0,Hs=ll=null,va=0,je&6)throw Error(U(331));var o=je;if(je|=4,bb(s.current),gb(s,s.current,r,n),je=o,_i(0,!1),hn&&typeof hn.onPostCommitFiberRoot=="function")try{hn.onPostCommitFiberRoot(xi,s)}catch{}return!0}finally{ke.p=l,se.T=a,Mb(e,t)}}function rm(e,t,n){t=Tn(n,t),t=Rd(e.stateNode,t,2),e=nl(e,t,2),e!==null&&(bi(e,2),aa(e))}function Ee(e,t,n){if(e.tag===3)rm(e,e,n);else for(;t!==null;){if(t.tag===3){rm(t,e,n);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(al===null||!al.has(a))){e=Tn(n,e),n=Jy(2),a=nl(t,n,2),a!==null&&(Wy(n,a,t,e),bi(a,2),aa(a));break}}t=t.return}}function Mu(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new W2;var l=new Set;a.set(t,l)}else l=a.get(t),l===void 0&&(l=new Set,a.set(t,l));l.has(n)||(nh=!0,l.add(n),e=nS.bind(null,e,t,n),t.then(e,e))}function nS(e,t,n){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Me===e&&(ge&n)===n&&(Pe===4||Pe===3&&(ge&62914560)===ge&&300>fn()-Bc?!(je&2)&&qs(e,0):ah|=n,Zs===ge&&(Zs=0)),aa(e)}function Lb(e,t){t===0&&(t=Tx()),e=Xl(e,t),e!==null&&(bi(e,t),aa(e))}function aS(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Lb(e,n)}function lS(e,t){var n=0;switch(e.tag){case 31:case 13:var a=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(U(314))}a!==null&&a.delete(t),Lb(e,n)}function sS(e,t){return bf(e,t)}var ac=null,rs=null,Gd=!1,lc=!1,Ru=!1,Fa=0;function aa(e){e!==rs&&e.next===null&&(rs===null?ac=rs=e:rs=rs.next=e),lc=!0,Gd||(Gd=!0,iS())}function _i(e,t){if(!Ru&&lc){Ru=!0;do for(var n=!1,a=ac;a!==null;){if(e!==0){var l=a.pendingLanes;if(l===0)var s=0;else{var r=a.suspendedLanes,o=a.pingedLanes;s=(1<<31-pn(42|e)+1)-1,s&=l&~(r&~o),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(n=!0,im(a,s))}else s=ge,s=Ec(a,a===Me?s:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),!(s&3)||yi(a,s)||(n=!0,im(a,s));a=a.next}while(n);Ru=!1}}function rS(){$b()}function $b(){lc=Gd=!1;var e=0;Fa!==0&&xS()&&(e=Fa);for(var t=fn(),n=null,a=ac;a!==null;){var l=a.next,s=Ub(a,t);s===0?(a.next=null,n===null?ac=l:n.next=l,l===null&&(rs=n)):(n=a,(e!==0||s&3)&&(lc=!0)),a=l}ut!==0&&ut!==5||_i(e),Fa!==0&&(Fa=0)}function Ub(e,t){for(var n=e.suspendedLanes,a=e.pingedLanes,l=e.expirationTimes,s=e.pendingLanes&-62914561;0<s;){var r=31-pn(s),o=1<<r,c=l[r];c===-1?(!(o&n)||o&a)&&(l[r]=D1(o,t)):c<=t&&(e.expiredLanes|=o),s&=~o}if(t=Me,n=ge,n=Ec(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,n===0||e===t&&(Te===2||Te===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&cu(a),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||yi(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(a!==null&&cu(a),Sf(n)){case 2:case 8:n=_x;break;case 32:n=Zo;break;case 268435456:n=Nx;break;default:n=Zo}return a=Bb.bind(null,e),n=bf(n,a),e.callbackPriority=t,e.callbackNode=n,t}return a!==null&&a!==null&&cu(a),e.callbackPriority=2,e.callbackNode=null,2}function Bb(e,t){if(ut!==0&&ut!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(qc()&&e.callbackNode!==n)return null;var a=ge;return a=Ec(e,e===Me?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(kb(e,a,t),Ub(e,fn()),e.callbackNode!=null&&e.callbackNode===n?Bb.bind(null,e):null)}function im(e,t){if(qc())return null;kb(e,t,!0)}function iS(){bS(function(){je&6?bf(kx,rS):$b()})}function sh(){if(Fa===0){var e=$s;e===0&&(e=Xi,Xi<<=1,!(Xi&261888)&&(Xi=256)),Fa=e}return Fa}function om(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:So(""+e)}function cm(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function oS(e,t,n,a,l){if(t==="submit"&&n&&n.stateNode===l){var s=om((l[Ft]||null).action),r=a.submitter;r&&(t=(t=r[Ft]||null)?om(t.formAction):r.getAttribute("formAction"),t!==null&&(s=t,r=null));var o=new Ac("action","action",null,a,l);e.push({event:o,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(Fa!==0){var c=r?cm(l,r):new FormData(l);Dd(n,{pending:!0,data:c,method:l.method,action:s},null,c)}}else typeof s=="function"&&(o.preventDefault(),c=r?cm(l,r):new FormData(l),Dd(n,{pending:!0,data:c,method:l.method,action:s},s,c))},currentTarget:l}]})}}for(var Lu=0;Lu<Sd.length;Lu++){var $u=Sd[Lu],cS=$u.toLowerCase(),uS=$u[0].toUpperCase()+$u.slice(1);Xn(cS,"on"+uS)}Xn(Wx,"onAnimationEnd");Xn(Fx,"onAnimationIteration");Xn(Px,"onAnimationStart");Xn("dblclick","onDoubleClick");Xn("focusin","onFocus");Xn("focusout","onBlur");Xn(N2,"onTransitionRun");Xn(T2,"onTransitionStart");Xn(E2,"onTransitionCancel");Xn(ey,"onTransitionEnd");Rs("onMouseEnter",["mouseout","mouseover"]);Rs("onMouseLeave",["mouseout","mouseover"]);Rs("onPointerEnter",["pointerout","pointerover"]);Rs("onPointerLeave",["pointerout","pointerover"]);Gl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Gl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Gl("onBeforeInput",["compositionend","keypress","textInput","paste"]);Gl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Gl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Gl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ii="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(" "),dS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ii));function Zb(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var a=e[n],l=a.event;a=a.listeners;e:{var s=void 0;if(t)for(var r=a.length-1;0<=r;r--){var o=a[r],c=o.instance,u=o.currentTarget;if(o=o.listener,c!==s&&l.isPropagationStopped())break e;s=o,l.currentTarget=u;try{s(l)}catch(d){qo(d)}l.currentTarget=null,s=c}else for(r=0;r<a.length;r++){if(o=a[r],c=o.instance,u=o.currentTarget,o=o.listener,c!==s&&l.isPropagationStopped())break e;s=o,l.currentTarget=u;try{s(l)}catch(d){qo(d)}l.currentTarget=null,s=c}}}}function he(e,t){var n=t[hd];n===void 0&&(n=t[hd]=new Set);var a=e+"__bubble";n.has(a)||(Hb(t,e,2,!1),n.add(a))}function Uu(e,t,n){var a=0;t&&(a|=4),Hb(n,e,a,t)}var no="_reactListening"+Math.random().toString(36).slice(2);function rh(e){if(!e[no]){e[no]=!0,Ox.forEach(function(n){n!=="selectionchange"&&(dS.has(n)||Uu(n,!1,e),Uu(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[no]||(t[no]=!0,Uu("selectionchange",!1,t))}}function Hb(e,t,n,a){switch(ev(t)){case 2:var l=BS;break;case 8:l=ZS;break;default:l=uh}n=l.bind(null,t,n,e),l=void 0,!yd||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(l=!0),a?l!==void 0?e.addEventListener(t,n,{capture:!0,passive:l}):e.addEventListener(t,n,!0):l!==void 0?e.addEventListener(t,n,{passive:l}):e.addEventListener(t,n,!1)}function Bu(e,t,n,a,l){var s=a;if(!(t&1)&&!(t&2)&&a!==null)e:for(;;){if(a===null)return;var r=a.tag;if(r===3||r===4){var o=a.stateNode.containerInfo;if(o===l)break;if(r===4)for(r=a.return;r!==null;){var c=r.tag;if((c===3||c===4)&&r.stateNode.containerInfo===l)return;r=r.return}for(;o!==null;){if(r=us(o),r===null)return;if(c=r.tag,c===5||c===6||c===26||c===27){a=s=r;continue e}o=o.parentNode}}a=a.return}Zx(function(){var u=s,d=kf(n),f=[];e:{var h=ty.get(e);if(h!==void 0){var p=Ac,v=e;switch(e){case"keypress":if(jo(n)===0)break e;case"keydown":case"keyup":p=l2;break;case"focusin":v="focus",p=pu;break;case"focusout":v="blur",p=pu;break;case"beforeblur":case"afterblur":p=pu;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=xp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=X1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=i2;break;case Wx:case Fx:case Px:p=K1;break;case ey:p=c2;break;case"scroll":case"scrollend":p=Y1;break;case"wheel":p=d2;break;case"copy":case"cut":case"paste":p=W1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=bp;break;case"toggle":case"beforetoggle":p=h2}var j=(t&4)!==0,k=!j&&(e==="scroll"||e==="scrollend"),g=j?h!==null?h+"Capture":null:h;j=[];for(var x=u,b;x!==null;){var y=x;if(b=y.stateNode,y=y.tag,y!==5&&y!==26&&y!==27||b===null||g===null||(y=Pr(x,g),y!=null&&j.push(oi(x,y,b))),k)break;x=x.return}0<j.length&&(h=new p(h,v,null,n,d),f.push({event:h,listeners:j}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",h&&n!==xd&&(v=n.relatedTarget||n.fromElement)&&(us(v)||v[Qs]))break e;if((p||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,p?(v=n.relatedTarget||n.toElement,p=u,v=v?us(v):null,v!==null&&(k=gi(v),j=v.tag,v!==k||j!==5&&j!==27&&j!==6)&&(v=null)):(p=null,v=u),p!==v)){if(j=xp,y="onMouseLeave",g="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(j=bp,y="onPointerLeave",g="onPointerEnter",x="pointer"),k=p==null?h:Ar(p),b=v==null?h:Ar(v),h=new j(y,x+"leave",p,n,d),h.target=k,h.relatedTarget=b,y=null,us(d)===u&&(j=new j(g,x+"enter",v,n,d),j.target=b,j.relatedTarget=k,y=j),k=y,p&&v)t:{for(j=fS,g=p,x=v,b=0,y=g;y;y=j(y))b++;y=0;for(var T=x;T;T=j(T))y++;for(;0<b-y;)g=j(g),b--;for(;0<y-b;)x=j(x),y--;for(;b--;){if(g===x||x!==null&&g===x.alternate){j=g;break t}g=j(g),x=j(x)}j=null}else j=null;p!==null&&um(f,h,p,j,!1),v!==null&&k!==null&&um(f,k,v,j,!0)}}e:{if(h=u?Ar(u):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var _=jp;else if(wp(h))if(Xx)_=j2;else{_=S2;var E=v2}else p=h.nodeName,!p||p.toLowerCase()!=="input"||h.type!=="checkbox"&&h.type!=="radio"?u&&jf(u.elementType)&&(_=jp):_=w2;if(_&&(_=_(e,u))){Ix(f,_,n,d);break e}E&&E(e,h,u),e==="focusout"&&u&&h.type==="number"&&u.memoizedProps.value!=null&&gd(h,"number",h.value)}switch(E=u?Ar(u):window,e){case"focusin":(wp(E)||E.contentEditable==="true")&&(hs=E,bd=u,Ur=null);break;case"focusout":Ur=bd=hs=null;break;case"mousedown":vd=!0;break;case"contextmenu":case"mouseup":case"dragend":vd=!1,Ep(f,n,d);break;case"selectionchange":if(_2)break;case"keydown":case"keyup":Ep(f,n,d)}var D;if(Tf)e:{switch(e){case"compositionstart":var O="onCompositionStart";break e;case"compositionend":O="onCompositionEnd";break e;case"compositionupdate":O="onCompositionUpdate";break e}O=void 0}else fs?Gx(e,n)&&(O="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(O="onCompositionStart");O&&(qx&&n.locale!=="ko"&&(fs||O!=="onCompositionStart"?O==="onCompositionEnd"&&fs&&(D=Hx()):(Ka=d,_f="value"in Ka?Ka.value:Ka.textContent,fs=!0)),E=sc(u,O),0<E.length&&(O=new yp(O,e,null,n,d),f.push({event:O,listeners:E}),D?O.data=D:(D=Yx(n),D!==null&&(O.data=D)))),(D=m2?g2(e,n):x2(e,n))&&(O=sc(u,"onBeforeInput"),0<O.length&&(E=new yp("onBeforeInput","beforeinput",null,n,d),f.push({event:E,listeners:O}),E.data=D)),oS(f,e,u,n,d)}Zb(f,t)})}function oi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function sc(e,t){for(var n=t+"Capture",a=[];e!==null;){var l=e,s=l.stateNode;if(l=l.tag,l!==5&&l!==26&&l!==27||s===null||(l=Pr(e,n),l!=null&&a.unshift(oi(e,l,s)),l=Pr(e,t),l!=null&&a.push(oi(e,l,s))),e.tag===3)return a;e=e.return}return[]}function fS(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function um(e,t,n,a,l){for(var s=t._reactName,r=[];n!==null&&n!==a;){var o=n,c=o.alternate,u=o.stateNode;if(o=o.tag,c!==null&&c===a)break;o!==5&&o!==26&&o!==27||u===null||(c=u,l?(u=Pr(n,s),u!=null&&r.unshift(oi(n,u,c))):l||(u=Pr(n,s),u!=null&&r.push(oi(n,u,c)))),n=n.return}r.length!==0&&e.push({event:t,listeners:r})}var hS=/\r\n?/g,pS=/\u0000|\uFFFD/g;function dm(e){return(typeof e=="string"?e:""+e).replace(hS,`
|
|
49
|
+
`).replace(pS,"")}function qb(e,t){return t=dm(t),dm(e)===t}function Ce(e,t,n,a,l,s){switch(n){case"children":typeof a=="string"?t==="body"||t==="textarea"&&a===""||Ls(e,a):(typeof a=="number"||typeof a=="bigint")&&t!=="body"&&Ls(e,""+a);break;case"className":Ki(e,"class",a);break;case"tabIndex":Ki(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Ki(e,n,a);break;case"style":Bx(e,a,s);break;case"data":if(t!=="object"){Ki(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=So(""+a),e.setAttribute(n,a);break;case"action":case"formAction":if(typeof a=="function"){e.setAttribute(n,"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 s=="function"&&(n==="formAction"?(t!=="input"&&Ce(e,t,"name",l.name,l,null),Ce(e,t,"formEncType",l.formEncType,l,null),Ce(e,t,"formMethod",l.formMethod,l,null),Ce(e,t,"formTarget",l.formTarget,l,null)):(Ce(e,t,"encType",l.encType,l,null),Ce(e,t,"method",l.method,l,null),Ce(e,t,"target",l.target,l,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=So(""+a),e.setAttribute(n,a);break;case"onClick":a!=null&&(e.onclick=ga);break;case"onScroll":a!=null&&he("scroll",e);break;case"onScrollEnd":a!=null&&he("scrollend",e);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(U(61));if(n=a.__html,n!=null){if(l.children!=null)throw Error(U(60));e.innerHTML=n}}break;case"multiple":e.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":e.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){e.removeAttribute("xlink:href");break}n=So(""+a),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,""+a):e.removeAttribute(n);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":a&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":a===!0?e.setAttribute(n,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,a):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(n,a):e.removeAttribute(n);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?e.removeAttribute(n):e.setAttribute(n,a);break;case"popover":he("beforetoggle",e),he("toggle",e),vo(e,"popover",a);break;case"xlinkActuate":ra(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":ra(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":ra(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":ra(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":ra(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":ra(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":ra(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":ra(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":ra(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":vo(e,"is",a);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=q1.get(n)||n,vo(e,n,a))}}function Yd(e,t,n,a,l,s){switch(n){case"style":Bx(e,a,s);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(U(61));if(n=a.__html,n!=null){if(l.children!=null)throw Error(U(60));e.innerHTML=n}}break;case"children":typeof a=="string"?Ls(e,a):(typeof a=="number"||typeof a=="bigint")&&Ls(e,""+a);break;case"onScroll":a!=null&&he("scroll",e);break;case"onScrollEnd":a!=null&&he("scrollend",e);break;case"onClick":a!=null&&(e.onclick=ga);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Dx.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(l=n.endsWith("Capture"),t=n.slice(2,l?n.length-7:void 0),s=e[Ft]||null,s=s!=null?s[n]:null,typeof s=="function"&&e.removeEventListener(t,s,l),typeof a=="function")){typeof s!="function"&&s!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,a,l);break e}n in e?e[n]=a:a===!0?e.setAttribute(n,""):vo(e,n,a)}}}function jt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":he("error",e),he("load",e);var a=!1,l=!1,s;for(s in n)if(n.hasOwnProperty(s)){var r=n[s];if(r!=null)switch(s){case"src":a=!0;break;case"srcSet":l=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(U(137,t));default:Ce(e,t,s,r,n,null)}}l&&Ce(e,t,"srcSet",n.srcSet,n,null),a&&Ce(e,t,"src",n.src,n,null);return;case"input":he("invalid",e);var o=s=r=l=null,c=null,u=null;for(a in n)if(n.hasOwnProperty(a)){var d=n[a];if(d!=null)switch(a){case"name":l=d;break;case"type":r=d;break;case"checked":c=d;break;case"defaultChecked":u=d;break;case"value":s=d;break;case"defaultValue":o=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(U(137,t));break;default:Ce(e,t,a,d,n,null)}}Lx(e,s,o,c,u,r,l,!1);return;case"select":he("invalid",e),a=r=s=null;for(l in n)if(n.hasOwnProperty(l)&&(o=n[l],o!=null))switch(l){case"value":s=o;break;case"defaultValue":r=o;break;case"multiple":a=o;default:Ce(e,t,l,o,n,null)}t=s,n=r,e.multiple=!!a,t!=null?ks(e,!!a,t,!1):n!=null&&ks(e,!!a,n,!0);return;case"textarea":he("invalid",e),s=l=a=null;for(r in n)if(n.hasOwnProperty(r)&&(o=n[r],o!=null))switch(r){case"value":a=o;break;case"defaultValue":l=o;break;case"children":s=o;break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(U(91));break;default:Ce(e,t,r,o,n,null)}Ux(e,a,l,s);return;case"option":for(c in n)if(n.hasOwnProperty(c)&&(a=n[c],a!=null))switch(c){case"selected":e.selected=a&&typeof a!="function"&&typeof a!="symbol";break;default:Ce(e,t,c,a,n,null)}return;case"dialog":he("beforetoggle",e),he("toggle",e),he("cancel",e),he("close",e);break;case"iframe":case"object":he("load",e);break;case"video":case"audio":for(a=0;a<ii.length;a++)he(ii[a],e);break;case"image":he("error",e),he("load",e);break;case"details":he("toggle",e);break;case"embed":case"source":case"link":he("error",e),he("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(u in n)if(n.hasOwnProperty(u)&&(a=n[u],a!=null))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(U(137,t));default:Ce(e,t,u,a,n,null)}return;default:if(jf(t)){for(d in n)n.hasOwnProperty(d)&&(a=n[d],a!==void 0&&Yd(e,t,d,a,n,void 0));return}}for(o in n)n.hasOwnProperty(o)&&(a=n[o],a!=null&&Ce(e,t,o,a,n,null))}function mS(e,t,n,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var l=null,s=null,r=null,o=null,c=null,u=null,d=null;for(p in n){var f=n[p];if(n.hasOwnProperty(p)&&f!=null)switch(p){case"checked":break;case"value":break;case"defaultValue":c=f;default:a.hasOwnProperty(p)||Ce(e,t,p,null,a,f)}}for(var h in a){var p=a[h];if(f=n[h],a.hasOwnProperty(h)&&(p!=null||f!=null))switch(h){case"type":s=p;break;case"name":l=p;break;case"checked":u=p;break;case"defaultChecked":d=p;break;case"value":r=p;break;case"defaultValue":o=p;break;case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(U(137,t));break;default:p!==f&&Ce(e,t,h,p,a,f)}}md(e,r,o,c,u,d,s,l);return;case"select":p=r=o=h=null;for(s in n)if(c=n[s],n.hasOwnProperty(s)&&c!=null)switch(s){case"value":break;case"multiple":p=c;default:a.hasOwnProperty(s)||Ce(e,t,s,null,a,c)}for(l in a)if(s=a[l],c=n[l],a.hasOwnProperty(l)&&(s!=null||c!=null))switch(l){case"value":h=s;break;case"defaultValue":o=s;break;case"multiple":r=s;default:s!==c&&Ce(e,t,l,s,a,c)}t=o,n=r,a=p,h!=null?ks(e,!!n,h,!1):!!a!=!!n&&(t!=null?ks(e,!!n,t,!0):ks(e,!!n,n?[]:"",!1));return;case"textarea":p=h=null;for(o in n)if(l=n[o],n.hasOwnProperty(o)&&l!=null&&!a.hasOwnProperty(o))switch(o){case"value":break;case"children":break;default:Ce(e,t,o,null,a,l)}for(r in a)if(l=a[r],s=n[r],a.hasOwnProperty(r)&&(l!=null||s!=null))switch(r){case"value":h=l;break;case"defaultValue":p=l;break;case"children":break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(U(91));break;default:l!==s&&Ce(e,t,r,l,a,s)}$x(e,h,p);return;case"option":for(var v in n)if(h=n[v],n.hasOwnProperty(v)&&h!=null&&!a.hasOwnProperty(v))switch(v){case"selected":e.selected=!1;break;default:Ce(e,t,v,null,a,h)}for(c in a)if(h=a[c],p=n[c],a.hasOwnProperty(c)&&h!==p&&(h!=null||p!=null))switch(c){case"selected":e.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:Ce(e,t,c,h,a,p)}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 j in n)h=n[j],n.hasOwnProperty(j)&&h!=null&&!a.hasOwnProperty(j)&&Ce(e,t,j,null,a,h);for(u in a)if(h=a[u],p=n[u],a.hasOwnProperty(u)&&h!==p&&(h!=null||p!=null))switch(u){case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(U(137,t));break;default:Ce(e,t,u,h,a,p)}return;default:if(jf(t)){for(var k in n)h=n[k],n.hasOwnProperty(k)&&h!==void 0&&!a.hasOwnProperty(k)&&Yd(e,t,k,void 0,a,h);for(d in a)h=a[d],p=n[d],!a.hasOwnProperty(d)||h===p||h===void 0&&p===void 0||Yd(e,t,d,h,a,p);return}}for(var g in n)h=n[g],n.hasOwnProperty(g)&&h!=null&&!a.hasOwnProperty(g)&&Ce(e,t,g,null,a,h);for(f in a)h=a[f],p=n[f],!a.hasOwnProperty(f)||h===p||h==null&&p==null||Ce(e,t,f,h,a,p)}function fm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function gS(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),a=0;a<n.length;a++){var l=n[a],s=l.transferSize,r=l.initiatorType,o=l.duration;if(s&&o&&fm(r)){for(r=0,o=l.responseEnd,a+=1;a<n.length;a++){var c=n[a],u=c.startTime;if(u>o)break;var d=c.transferSize,f=c.initiatorType;d&&fm(f)&&(c=c.responseEnd,r+=d*(c<o?1:(o-u)/(c-u)))}if(--a,t+=8*(s+r)/(l.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Id=null,Xd=null;function rc(e){return e.nodeType===9?e:e.ownerDocument}function hm(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Gb(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Vd(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Zu=null;function xS(){var e=window.event;return e&&e.type==="popstate"?e===Zu?!1:(Zu=e,!0):(Zu=null,!1)}var Yb=typeof setTimeout=="function"?setTimeout:void 0,yS=typeof clearTimeout=="function"?clearTimeout:void 0,pm=typeof Promise=="function"?Promise:void 0,bS=typeof queueMicrotask=="function"?queueMicrotask:typeof pm<"u"?function(e){return pm.resolve(null).then(e).catch(vS)}:Yb;function vS(e){setTimeout(function(){throw e})}function pl(e){return e==="head"}function mm(e,t){var n=t,a=0;do{var l=n.nextSibling;if(e.removeChild(n),l&&l.nodeType===8)if(n=l.data,n==="/$"||n==="/&"){if(a===0){e.removeChild(l),Ys(t);return}a--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")a++;else if(n==="html")Qr(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Qr(n);for(var s=n.firstChild;s;){var r=s.nextSibling,o=s.nodeName;s[vi]||o==="SCRIPT"||o==="STYLE"||o==="LINK"&&s.rel.toLowerCase()==="stylesheet"||n.removeChild(s),s=r}}else n==="body"&&Qr(e.ownerDocument.body);n=l}while(n);Ys(t)}function gm(e,t){var n=e;e=0;do{var a=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),a&&a.nodeType===8)if(n=a.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=a}while(n)}function Qd(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Qd(n),wf(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function SS(e,t,n,a){for(;e.nodeType===1;){var l=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[vi])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(s=e.getAttribute("rel"),s==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(s!==l.rel||e.getAttribute("href")!==(l.href==null||l.href===""?null:l.href)||e.getAttribute("crossorigin")!==(l.crossOrigin==null?null:l.crossOrigin)||e.getAttribute("title")!==(l.title==null?null:l.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(s=e.getAttribute("src"),(s!==(l.src==null?null:l.src)||e.getAttribute("type")!==(l.type==null?null:l.type)||e.getAttribute("crossorigin")!==(l.crossOrigin==null?null:l.crossOrigin))&&s&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var s=l.name==null?null:""+l.name;if(l.type==="hidden"&&e.getAttribute("name")===s)return e}else return e;if(e=zn(e.nextSibling),e===null)break}return null}function wS(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=zn(e.nextSibling),e===null))return null;return e}function Ib(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=zn(e.nextSibling),e===null))return null;return e}function Kd(e){return e.data==="$?"||e.data==="$~"}function Jd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function jS(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var a=function(){t(),n.removeEventListener("DOMContentLoaded",a)};n.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function zn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Wd=null;function xm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return zn(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function ym(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function Xb(e,t,n){switch(t=rc(n),e){case"html":if(e=t.documentElement,!e)throw Error(U(452));return e;case"head":if(e=t.head,!e)throw Error(U(453));return e;case"body":if(e=t.body,!e)throw Error(U(454));return e;default:throw Error(U(451))}}function Qr(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);wf(e)}var Cn=new Map,bm=new Set;function ic(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Aa=ke.d;ke.d={f:kS,r:_S,D:NS,C:TS,L:ES,m:AS,X:CS,S:zS,M:OS};function kS(){var e=Aa.f(),t=Zc();return e||t}function _S(e){var t=Ks(e);t!==null&&t.tag===5&&t.type==="form"?By(t):Aa.r(e)}var Ps=typeof document>"u"?null:document;function Vb(e,t,n){var a=Ps;if(a&&typeof t=="string"&&t){var l=Nn(t);l='link[rel="'+e+'"][href="'+l+'"]',typeof n=="string"&&(l+='[crossorigin="'+n+'"]'),bm.has(l)||(bm.add(l),e={rel:e,crossOrigin:n,href:t},a.querySelector(l)===null&&(t=a.createElement("link"),jt(t,"link",e),mt(t),a.head.appendChild(t)))}}function NS(e){Aa.D(e),Vb("dns-prefetch",e,null)}function TS(e,t){Aa.C(e,t),Vb("preconnect",e,t)}function ES(e,t,n){Aa.L(e,t,n);var a=Ps;if(a&&e&&t){var l='link[rel="preload"][as="'+Nn(t)+'"]';t==="image"&&n&&n.imageSrcSet?(l+='[imagesrcset="'+Nn(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(l+='[imagesizes="'+Nn(n.imageSizes)+'"]')):l+='[href="'+Nn(e)+'"]';var s=l;switch(t){case"style":s=Gs(e);break;case"script":s=er(e)}Cn.has(s)||(e=qe({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Cn.set(s,e),a.querySelector(l)!==null||t==="style"&&a.querySelector(Ni(s))||t==="script"&&a.querySelector(Ti(s))||(t=a.createElement("link"),jt(t,"link",e),mt(t),a.head.appendChild(t)))}}function AS(e,t){Aa.m(e,t);var n=Ps;if(n&&e){var a=t&&typeof t.as=="string"?t.as:"script",l='link[rel="modulepreload"][as="'+Nn(a)+'"][href="'+Nn(e)+'"]',s=l;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=er(e)}if(!Cn.has(s)&&(e=qe({rel:"modulepreload",href:e},t),Cn.set(s,e),n.querySelector(l)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Ti(s)))return}a=n.createElement("link"),jt(a,"link",e),mt(a),n.head.appendChild(a)}}}function zS(e,t,n){Aa.S(e,t,n);var a=Ps;if(a&&e){var l=js(a).hoistableStyles,s=Gs(e);t=t||"default";var r=l.get(s);if(!r){var o={loading:0,preload:null};if(r=a.querySelector(Ni(s)))o.loading=5;else{e=qe({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Cn.get(s))&&ih(e,n);var c=r=a.createElement("link");mt(c),jt(c,"link",e),c._p=new Promise(function(u,d){c.onload=u,c.onerror=d}),c.addEventListener("load",function(){o.loading|=1}),c.addEventListener("error",function(){o.loading|=2}),o.loading|=4,Co(r,t,a)}r={type:"stylesheet",instance:r,count:1,state:o},l.set(s,r)}}}function CS(e,t){Aa.X(e,t);var n=Ps;if(n&&e){var a=js(n).hoistableScripts,l=er(e),s=a.get(l);s||(s=n.querySelector(Ti(l)),s||(e=qe({src:e,async:!0},t),(t=Cn.get(l))&&oh(e,t),s=n.createElement("script"),mt(s),jt(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},a.set(l,s))}}function OS(e,t){Aa.M(e,t);var n=Ps;if(n&&e){var a=js(n).hoistableScripts,l=er(e),s=a.get(l);s||(s=n.querySelector(Ti(l)),s||(e=qe({src:e,async:!0,type:"module"},t),(t=Cn.get(l))&&oh(e,t),s=n.createElement("script"),mt(s),jt(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},a.set(l,s))}}function vm(e,t,n,a){var l=(l=Pa.current)?ic(l):null;if(!l)throw Error(U(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Gs(n.href),n=js(l).hoistableStyles,a=n.get(t),a||(a={type:"style",instance:null,count:0,state:null},n.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Gs(n.href);var s=js(l).hoistableStyles,r=s.get(e);if(r||(l=l.ownerDocument||l,r={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,r),(s=l.querySelector(Ni(e)))&&!s._p&&(r.instance=s,r.state.loading=5),Cn.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Cn.set(e,n),s||DS(l,e,n,r.state))),t&&a===null)throw Error(U(528,""));return r}if(t&&a!==null)throw Error(U(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=er(n),n=js(l).hoistableScripts,a=n.get(t),a||(a={type:"script",instance:null,count:0,state:null},n.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(U(444,e))}}function Gs(e){return'href="'+Nn(e)+'"'}function Ni(e){return'link[rel="stylesheet"]['+e+"]"}function Qb(e){return qe({},e,{"data-precedence":e.precedence,precedence:null})}function DS(e,t,n,a){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=e.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),jt(t,"link",n),mt(t),e.head.appendChild(t))}function er(e){return'[src="'+Nn(e)+'"]'}function Ti(e){return"script[async]"+e}function Sm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+Nn(n.href)+'"]');if(a)return t.instance=a,mt(a),a;var l=qe({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),mt(a),jt(a,"style",l),Co(a,n.precedence,e),t.instance=a;case"stylesheet":l=Gs(n.href);var s=e.querySelector(Ni(l));if(s)return t.state.loading|=4,t.instance=s,mt(s),s;a=Qb(n),(l=Cn.get(l))&&ih(a,l),s=(e.ownerDocument||e).createElement("link"),mt(s);var r=s;return r._p=new Promise(function(o,c){r.onload=o,r.onerror=c}),jt(s,"link",a),t.state.loading|=4,Co(s,n.precedence,e),t.instance=s;case"script":return s=er(n.src),(l=e.querySelector(Ti(s)))?(t.instance=l,mt(l),l):(a=n,(l=Cn.get(s))&&(a=qe({},n),oh(a,l)),e=e.ownerDocument||e,l=e.createElement("script"),mt(l),jt(l,"link",a),e.head.appendChild(l),t.instance=l);case"void":return null;default:throw Error(U(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(a=t.instance,t.state.loading|=4,Co(a,n.precedence,e));return t.instance}function Co(e,t,n){for(var a=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),l=a.length?a[a.length-1]:null,s=l,r=0;r<a.length;r++){var o=a[r];if(o.dataset.precedence===t)s=o;else if(s!==l)break}s?s.parentNode.insertBefore(e,s.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function ih(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function oh(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Oo=null;function wm(e,t,n){if(Oo===null){var a=new Map,l=Oo=new Map;l.set(n,a)}else l=Oo,a=l.get(n),a||(a=new Map,l.set(n,a));if(a.has(e))return a;for(a.set(e,null),n=n.getElementsByTagName(e),l=0;l<n.length;l++){var s=n[l];if(!(s[vi]||s[vt]||e==="link"&&s.getAttribute("rel")==="stylesheet")&&s.namespaceURI!=="http://www.w3.org/2000/svg"){var r=s.getAttribute(t)||"";r=e+r;var o=a.get(r);o?o.push(s):a.set(r,[s])}}return a}function jm(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function MS(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Kb(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function RS(e,t,n,a){if(n.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var l=Gs(a.href),s=t.querySelector(Ni(l));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=oc.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=s,mt(s);return}s=t.ownerDocument||t,a=Qb(a),(l=Cn.get(l))&&ih(a,l),s=s.createElement("link"),mt(s);var r=s;r._p=new Promise(function(o,c){r.onload=o,r.onerror=c}),jt(s,"link",a),n.instance=s}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=oc.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Hu=0;function LS(e,t){return e.stylesheets&&e.count===0&&Do(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var a=setTimeout(function(){if(e.stylesheets&&Do(e,e.stylesheets),e.unsuspend){var s=e.unsuspend;e.unsuspend=null,s()}},6e4+t);0<e.imgBytes&&Hu===0&&(Hu=62500*gS());var l=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Do(e,e.stylesheets),e.unsuspend)){var s=e.unsuspend;e.unsuspend=null,s()}},(e.imgBytes>Hu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(l)}}:null}function oc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Do(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var cc=null;function Do(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,cc=new Map,t.forEach($S,e),cc=null,oc.call(e))}function $S(e,t){if(!(t.state.loading&4)){var n=cc.get(e);if(n)var a=n.get(null);else{n=new Map,cc.set(e,n);for(var l=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s<l.length;s++){var r=l[s];(r.nodeName==="LINK"||r.getAttribute("media")!=="not all")&&(n.set(r.dataset.precedence,r),a=r)}a&&n.set(null,a)}l=t.instance,r=l.getAttribute("data-precedence"),s=n.get(r)||a,s===a&&n.set(null,l),n.set(r,l),this.count++,a=oc.bind(this),l.addEventListener("load",a),l.addEventListener("error",a),s?s.parentNode.insertBefore(l,s.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(l,e.firstChild)),t.state.loading|=4}}var ci={$$typeof:ma,Provider:null,Consumer:null,_currentValue:Ol,_currentValue2:Ol,_threadCount:0};function US(e,t,n,a,l,s,r,o,c){this.tag=1,this.containerInfo=e,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=uu(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=uu(0),this.hiddenUpdates=uu(null),this.identifierPrefix=a,this.onUncaughtError=l,this.onCaughtError=s,this.onRecoverableError=r,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function Jb(e,t,n,a,l,s,r,o,c,u,d,f){return e=new US(e,t,n,r,c,u,d,f,o),t=1,s===!0&&(t|=24),s=cn(3,null,null,t),e.current=s,s.stateNode=e,t=Mf(),t.refCount++,e.pooledCache=t,t.refCount++,s.memoizedState={element:a,isDehydrated:n,cache:t},$f(s),e}function Wb(e){return e?(e=gs,e):gs}function Fb(e,t,n,a,l,s){l=Wb(l),a.context===null?a.context=l:a.pendingContext=l,a=tl(t),a.payload={element:n},s=s===void 0?null:s,s!==null&&(a.callback=s),n=nl(e,a,t),n!==null&&(Wt(n,e,t),Zr(n,e,t))}function km(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ch(e,t){km(e,t),(e=e.alternate)&&km(e,t)}function Pb(e){if(e.tag===13||e.tag===31){var t=Xl(e,67108864);t!==null&&Wt(t,e,67108864),ch(e,67108864)}}function _m(e){if(e.tag===13||e.tag===31){var t=mn();t=vf(t);var n=Xl(e,t);n!==null&&Wt(n,e,t),ch(e,t)}}var uc=!0;function BS(e,t,n,a){var l=se.T;se.T=null;var s=ke.p;try{ke.p=2,uh(e,t,n,a)}finally{ke.p=s,se.T=l}}function ZS(e,t,n,a){var l=se.T;se.T=null;var s=ke.p;try{ke.p=8,uh(e,t,n,a)}finally{ke.p=s,se.T=l}}function uh(e,t,n,a){if(uc){var l=Fd(a);if(l===null)Bu(e,t,a,dc,n),Nm(e,a);else if(qS(l,e,t,n,a))a.stopPropagation();else if(Nm(e,a),t&4&&-1<HS.indexOf(e)){for(;l!==null;){var s=Ks(l);if(s!==null)switch(s.tag){case 3:if(s=s.stateNode,s.current.memoizedState.isDehydrated){var r=Nl(s.pendingLanes);if(r!==0){var o=s;for(o.pendingLanes|=2,o.entangledLanes|=2;r;){var c=1<<31-pn(r);o.entanglements[1]|=c,r&=~c}aa(s),!(je&6)&&(ec=fn()+500,_i(0))}}break;case 31:case 13:o=Xl(s,2),o!==null&&Wt(o,s,2),Zc(),ch(s,2)}if(s=Fd(a),s===null&&Bu(e,t,a,dc,n),s===l)break;l=s}l!==null&&a.stopPropagation()}else Bu(e,t,a,null,n)}}function Fd(e){return e=kf(e),dh(e)}var dc=null;function dh(e){if(dc=null,e=us(e),e!==null){var t=gi(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=bx(t),e!==null)return e;e=null}else if(n===31){if(e=vx(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return dc=e,null}function ev(e){switch(e){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(N1()){case kx:return 2;case _x:return 8;case Zo:case T1:return 32;case Nx:return 268435456;default:return 32}default:return 32}}var Pd=!1,sl=null,rl=null,il=null,ui=new Map,di=new Map,Va=[],HS="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 Nm(e,t){switch(e){case"focusin":case"focusout":sl=null;break;case"dragenter":case"dragleave":rl=null;break;case"mouseover":case"mouseout":il=null;break;case"pointerover":case"pointerout":ui.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":di.delete(t.pointerId)}}function Sr(e,t,n,a,l,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:a,nativeEvent:s,targetContainers:[l]},t!==null&&(t=Ks(t),t!==null&&Pb(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,l!==null&&t.indexOf(l)===-1&&t.push(l),e)}function qS(e,t,n,a,l){switch(t){case"focusin":return sl=Sr(sl,e,t,n,a,l),!0;case"dragenter":return rl=Sr(rl,e,t,n,a,l),!0;case"mouseover":return il=Sr(il,e,t,n,a,l),!0;case"pointerover":var s=l.pointerId;return ui.set(s,Sr(ui.get(s)||null,e,t,n,a,l)),!0;case"gotpointercapture":return s=l.pointerId,di.set(s,Sr(di.get(s)||null,e,t,n,a,l)),!0}return!1}function tv(e){var t=us(e.target);if(t!==null){var n=gi(t);if(n!==null){if(t=n.tag,t===13){if(t=bx(n),t!==null){e.blockedOn=t,up(e.priority,function(){_m(n)});return}}else if(t===31){if(t=vx(n),t!==null){e.blockedOn=t,up(e.priority,function(){_m(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Mo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Fd(e.nativeEvent);if(n===null){n=e.nativeEvent;var a=new n.constructor(n.type,n);xd=a,n.target.dispatchEvent(a),xd=null}else return t=Ks(n),t!==null&&Pb(t),e.blockedOn=n,!1;t.shift()}return!0}function Tm(e,t,n){Mo(e)&&n.delete(t)}function GS(){Pd=!1,sl!==null&&Mo(sl)&&(sl=null),rl!==null&&Mo(rl)&&(rl=null),il!==null&&Mo(il)&&(il=null),ui.forEach(Tm),di.forEach(Tm)}function ao(e,t){e.blockedOn===t&&(e.blockedOn=null,Pd||(Pd=!0,ft.unstable_scheduleCallback(ft.unstable_NormalPriority,GS)))}var lo=null;function Em(e){lo!==e&&(lo=e,ft.unstable_scheduleCallback(ft.unstable_NormalPriority,function(){lo===e&&(lo=null);for(var t=0;t<e.length;t+=3){var n=e[t],a=e[t+1],l=e[t+2];if(typeof a!="function"){if(dh(a||n)===null)continue;break}var s=Ks(n);s!==null&&(e.splice(t,3),t-=3,Dd(s,{pending:!0,data:l,method:n.method,action:a},a,l))}}))}function Ys(e){function t(c){return ao(c,e)}sl!==null&&ao(sl,e),rl!==null&&ao(rl,e),il!==null&&ao(il,e),ui.forEach(t),di.forEach(t);for(var n=0;n<Va.length;n++){var a=Va[n];a.blockedOn===e&&(a.blockedOn=null)}for(;0<Va.length&&(n=Va[0],n.blockedOn===null);)tv(n),n.blockedOn===null&&Va.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(a=0;a<n.length;a+=3){var l=n[a],s=n[a+1],r=l[Ft]||null;if(typeof s=="function")r||Em(n);else if(r){var o=null;if(s&&s.hasAttribute("formAction")){if(l=s,r=s[Ft]||null)o=r.formAction;else if(dh(l)!==null)continue}else o=r.action;typeof o=="function"?n[a+1]=o:(n.splice(a,3),a-=3),Em(n)}}}function nv(){function e(s){s.canIntercept&&s.info==="react-transition"&&s.intercept({handler:function(){return new Promise(function(r){return l=r})},focusReset:"manual",scroll:"manual"})}function t(){l!==null&&(l(),l=null),a||setTimeout(n,20)}function n(){if(!a&&!navigation.transition){var s=navigation.currentEntry;s&&s.url!=null&&navigation.navigate(s.url,{state:s.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var a=!1,l=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){a=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),l!==null&&(l(),l=null)}}}function fh(e){this._internalRoot=e}Gc.prototype.render=fh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(U(409));var n=t.current,a=mn();Fb(n,a,e,t,null,null)};Gc.prototype.unmount=fh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Fb(e.current,2,null,e,null,null),Zc(),t[Qs]=null}};function Gc(e){this._internalRoot=e}Gc.prototype.unstable_scheduleHydration=function(e){if(e){var t=Cx();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Va.length&&t!==0&&t<Va[n].priority;n++);Va.splice(n,0,e),n===0&&tv(e)}};var Am=xx.version;if(Am!=="19.2.6")throw Error(U(527,Am,"19.2.6"));ke.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(U(188)):(e=Object.keys(e).join(","),Error(U(268,e)));return e=b1(t),e=e!==null?Sx(e):null,e=e===null?null:e.stateNode,e};var YS={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:se,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var so=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!so.isDisabled&&so.supportsFiber)try{xi=so.inject(YS),hn=so}catch{}}Nc.createRoot=function(e,t){if(!yx(e))throw Error(U(299));var n=!1,a="",l=Vy,s=Qy,r=Ky;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(l=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(r=t.onRecoverableError)),t=Jb(e,1,!1,null,null,n,a,null,l,s,r,nv),e[Qs]=t.current,rh(e),new fh(t)};Nc.hydrateRoot=function(e,t,n){if(!yx(e))throw Error(U(299));var a=!1,l="",s=Vy,r=Qy,o=Ky,c=null;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(s=n.onUncaughtError),n.onCaughtError!==void 0&&(r=n.onCaughtError),n.onRecoverableError!==void 0&&(o=n.onRecoverableError),n.formState!==void 0&&(c=n.formState)),t=Jb(e,1,!0,t,n??null,a,l,c,s,r,o,nv),t.context=Wb(null),n=t.current,a=mn(),a=vf(a),l=tl(a),l.callback=null,nl(n,l,a),n=a,t.current.lanes=n,bi(t,n),aa(t),e[Qs]=t.current,rh(e),new Gc(t)};Nc.version="19.2.6";function av(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(av)}catch(e){console.error(e)}}av(),dx.exports=Nc;var IS=dx.exports;function XS(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}class VS{constructor(t,n){this.baseUrl=t,this.token=n}async request(t,n){const a=XS(),s=await(await fetch(`${this.baseUrl}/api/json-rpc`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token}`},body:JSON.stringify({jsonrpc:"2.0",id:a,method:t,params:n})})).json();if("error"in s)throw new Error(s.error.message);return s.result}async sessionList(){return this.request("session.list")}async sessionGet(t){return this.request("session.get",{id:t})}async sessionStats(){return this.request("session.stats")}async sessionSend(t,n,a){return this.request("session.send",{id:t,text:n,type:a})}async sessionCancel(t){return this.request("session.cancel",{id:t})}async sessionResume(t){return this.request("session.resume",t?{id:t}:void 0)}async configGet(t){return this.request("config.get",{key:t})}async configSet(t,n){return this.request("config.set",{key:t,value:n})}async configAll(){return this.request("config.get",{key:"*"})}async providerList(){return this.request("provider.list")}async daemonStatus(){return this.request("daemon.status")}async daemonShutdown(){return this.request("daemon.shutdown")}async cronList(t,n){return this.request("cron.list",{type:t,status:n})}async cronCreate(t,n,a){return this.request("cron.create",{type:t,message:n,scheduledAt:a})}async cronCancel(t){return this.request("cron.cancel",{id:t})}async cronClear(){return this.request("cron.clear")}async heartbeatRun(t){return this.request("heartbeat.run",t?{scheduleType:t}:void 0)}async heartbeatStatus(){return this.request("heartbeat.status")}async channelList(){return this.request("channel.list")}async channelGet(t){return this.request("channel.get",{channelId:t})}async approvalList(t){return this.request("approval.pending",t?{sessionId:t}:void 0)}async approvalDecide(t,n){return this.request("approval.decide",{toolCallId:t,decision:n})}async mcpList(){return this.request("mcp.list")}async identitySetup(t){return this.request("identity.setup",t)}async subagentSpawn(t){return this.request("subagent.spawn",t)}async subagentList(t){return this.request("subagent.list",t)}async subagentCancel(t){return this.request("subagent.cancel",{agentId:t})}async subagentStats(t){return this.request("subagent.stats",{agentId:t})}async subagentSend(t,n){return this.request("subagent.send",{agentId:t,message:n})}async taskSchedule(t){return this.request("task.schedule",t)}async todoList(t){return this.request("todo.list",t)}async todoCreate(t){return this.request("todo.create",t)}async todoUpdate(t){return this.request("todo.update",t)}async todoRemove(t){return this.request("todo.remove",{id:t})}async wikiListPages(){return this.request("wiki.ingest")}async wikiPageGet(t){return this.request("wiki.page.get",{slug:t})}async wikiSearch(t){return this.request("wiki.query",{query:t})}async wikiLint(){return this.request("wiki.lint")}async wikiGraph(){return this.request("wiki.graph")}}class QS{constructor(t,n){ye(this,"ws",null);ye(this,"reconnectTimer",null);ye(this,"reconnectDelay",1e3);ye(this,"_reconnecting",!1);ye(this,"handlers",new Map);ye(this,"connected",!1);this.url=t,this.token=n}connect(){if(this.ws)return;const t=`${this.url.replace("http","ws")}/ws?token=${this.token}`;this.ws=new WebSocket(t),this.ws.onopen=()=>{this.connected=!0,this._reconnecting=!1,this.reconnectDelay=1e3,this.dispatch({type:"connection-status",id:"status",timestamp:Date.now(),connected:!0})},this.ws.onmessage=n=>{try{const a=JSON.parse(n.data);this.dispatch(a)}catch{}},this.ws.onclose=n=>{if(this.connected=!1,this.ws=null,n.code===4001||n.code===4003){this._reconnecting=!1,this.dispatch({type:"auth-error",id:"auth",timestamp:Date.now(),code:n.code});return}this._reconnecting=!0,this.dispatch({type:"connection-status",id:"status",timestamp:Date.now(),connected:!1}),this.scheduleReconnect()},this.ws.onerror=()=>{this.connected=!1,this.dispatch({type:"connection-status",id:"status",timestamp:Date.now(),connected:!1})}}disconnect(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws&&(this.ws.close(),this.ws=null),this._reconnecting=!1,this.connected=!1}isConnected(){return this.connected}isReconnecting(){return this._reconnecting}on(t,n){return this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t).add(n),()=>{var a;(a=this.handlers.get(t))==null||a.delete(n)}}subscribe(t){var n;((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"subscribe",session:t}))}dispatch(t){const n=this.handlers.get(t.type);if(n)for(const l of n)try{l(t)}catch{}const a=this.handlers.get("*");if(a)for(const l of a)try{l(t)}catch{}}scheduleReconnect(){this.reconnectTimer||(this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.reconnectDelay=Math.min(this.reconnectDelay*2,3e4),this.connect()},this.reconnectDelay))}}const lv=m.createContext({rpc:null,ws:null,connected:!1,connectionStatus:"disconnected",token:null,setToken:()=>{}});function Vn(){return m.useContext(lv)}function KS({children:e}){const[t,n]=m.useState(null),[a,l]=m.useState({rpc:null,ws:null,connected:!1,connectionStatus:"disconnected"});m.useEffect(()=>{const o=new URLSearchParams(window.location.search).get("token")||localStorage.getItem("daemon-token")||"";o&&(localStorage.setItem("daemon-token",o),n(o))},[]);const s=o=>{localStorage.setItem("daemon-token",o),n(o)};m.useEffect(()=>{if(!t){l({rpc:null,ws:null,connected:!1,connectionStatus:"disconnected"});return}const o=window.location.origin,c=new VS(o,t),u=new QS(o,t);l({rpc:c,ws:u,connected:!1,connectionStatus:"reconnecting"}),u.connect();const d=u.on("auth-error",()=>{localStorage.removeItem("daemon-token"),n(null)}),f=u.on("connection-status",p=>{const v=!!p.connected;let j;v?j="connected":u.isReconnecting()?j="reconnecting":j="disconnected",l(k=>({...k,connected:v,connectionStatus:j}))}),h=setInterval(()=>{const p=u.isConnected();l(v=>({...v,connected:p,connectionStatus:p?"connected":v.connectionStatus==="reconnecting"?"reconnecting":"disconnected"}))},2e3);return()=>{d(),f(),clearInterval(h),u.disconnect()}},[t]);const r={rpc:a.rpc,ws:a.ws,connected:a.connected,connectionStatus:a.connectionStatus,token:t,setToken:s};return i.jsx(lv.Provider,{value:r,children:e})}function hh(){const{rpc:e,ws:t}=Vn(),[n,a]=m.useState({}),[l,s]=m.useState([]),r=m.useCallback(()=>{e&&(e.providerList().then(u=>{Array.isArray(u)&&s(u)}).catch(()=>{}),Promise.all([e.configGet("model").catch(()=>null),e.configGet("current_provider").catch(()=>null),e.configGet("theme").catch(()=>null),e.configGet("mode").catch(()=>null)]).then(([u,d,f,h])=>{a(p=>({...p,model:u!==null?u:p.model,current_provider:d!==null?d:p.current_provider,theme:f!==null?f:p.theme,mode:h!==null?h:p.mode}))}).catch(()=>{}))},[e]);m.useEffect(()=>{r()},[r]),m.useEffect(()=>{if(t)return t.on("config-changed",()=>{r()})},[t,r]);const o=m.useCallback(u=>n[u],[n]),c=m.useCallback(async(u,d)=>{if(e)try{await e.configSet(u,d),a(f=>({...f,[u]:d}))}catch{}},[e]);return{settings:n,get:o,set:c,providers:l}}function ph(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ql=ph();function sv(e){Ql=e}var zl={exec:()=>null};function be(e,t=""){let n=typeof e=="string"?e:e.source,a={replace:(l,s)=>{let r=typeof s=="string"?s:s.source;return r=r.replace(Et.caret,"$1"),n=n.replace(l,r),a},getRegex:()=>new RegExp(n,t)};return a}var JS=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),Et={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}>`)},WS=/^(?:[ \t]*(?:\n|$))+/,FS=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,PS=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ei=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ew=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,mh=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,rv=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,iv=be(rv).replace(/bull/g,mh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),tw=be(rv).replace(/bull/g,mh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),gh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,nw=/^[^\n]+/,xh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,aw=be(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",xh).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),lw=be(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,mh).getRegex(),Yc="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",yh=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sw=be("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",yh).replace("tag",Yc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ov=be(gh).replace("hr",Ei).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Yc).getRegex(),rw=be(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ov).getRegex(),bh={blockquote:rw,code:FS,def:aw,fences:PS,heading:ew,hr:Ei,html:sw,lheading:iv,list:lw,newline:WS,paragraph:ov,table:zl,text:nw},zm=be("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ei).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Yc).getRegex(),iw={...bh,lheading:tw,table:zm,paragraph:be(gh).replace("hr",Ei).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",zm).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Yc).getRegex()},ow={...bh,html:be(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",yh).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:zl,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:be(gh).replace("hr",Ei).replace("heading",` *#{1,6} *[^
|
|
50
|
+
]`).replace("lheading",iv).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},cw=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,uw=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,cv=/^( {2,}|\\)\n(?!\s*$)/,dw=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,tr=/[\p{P}\p{S}]/u,Ic=/[\s\p{P}\p{S}]/u,vh=/[^\s\p{P}\p{S}]/u,fw=be(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ic).getRegex(),uv=/(?!~)[\p{P}\p{S}]/u,hw=/(?!~)[\s\p{P}\p{S}]/u,pw=/(?:[^\s\p{P}\p{S}]|~)/u,mw=be(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",JS?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),dv=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,gw=be(dv,"u").replace(/punct/g,tr).getRegex(),xw=be(dv,"u").replace(/punct/g,uv).getRegex(),fv="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",yw=be(fv,"gu").replace(/notPunctSpace/g,vh).replace(/punctSpace/g,Ic).replace(/punct/g,tr).getRegex(),bw=be(fv,"gu").replace(/notPunctSpace/g,pw).replace(/punctSpace/g,hw).replace(/punct/g,uv).getRegex(),vw=be("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,vh).replace(/punctSpace/g,Ic).replace(/punct/g,tr).getRegex(),Sw=be(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,tr).getRegex(),ww="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",jw=be(ww,"gu").replace(/notPunctSpace/g,vh).replace(/punctSpace/g,Ic).replace(/punct/g,tr).getRegex(),kw=be(/\\(punct)/,"gu").replace(/punct/g,tr).getRegex(),_w=be(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Nw=be(yh).replace("(?:-->|$)","-->").getRegex(),Tw=be("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Nw).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),fc=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ew=be(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",fc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),hv=be(/^!?\[(label)\]\[(ref)\]/).replace("label",fc).replace("ref",xh).getRegex(),pv=be(/^!?\[(ref)\](?:\[\])?/).replace("ref",xh).getRegex(),Aw=be("reflink|nolink(?!\\()","g").replace("reflink",hv).replace("nolink",pv).getRegex(),Cm=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Sh={_backpedal:zl,anyPunctuation:kw,autolink:_w,blockSkip:mw,br:cv,code:uw,del:zl,delLDelim:zl,delRDelim:zl,emStrongLDelim:gw,emStrongRDelimAst:yw,emStrongRDelimUnd:vw,escape:cw,link:Ew,nolink:pv,punctuation:fw,reflink:hv,reflinkSearch:Aw,tag:Tw,text:dw,url:zl},zw={...Sh,link:be(/^!?\[(label)\]\((.*?)\)/).replace("label",fc).getRegex(),reflink:be(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",fc).getRegex()},ef={...Sh,emStrongRDelimAst:bw,emStrongLDelim:xw,delLDelim:Sw,delRDelim:jw,url:be(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Cm).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:be(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Cm).getRegex()},Cw={...ef,br:be(cv).replace("{2,}","*").getRegex(),text:be(ef.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ro={normal:bh,gfm:iw,pedantic:ow},wr={normal:Sh,gfm:ef,breaks:Cw,pedantic:zw},Ow={"&":"&","<":"<",">":">",'"':""","'":"'"},Om=e=>Ow[e];function Jn(e,t){if(t){if(Et.escapeTest.test(e))return e.replace(Et.escapeReplace,Om)}else if(Et.escapeTestNoEncode.test(e))return e.replace(Et.escapeReplaceNoEncode,Om);return e}function Dm(e){try{e=encodeURI(e).replace(Et.percentDecode,"%")}catch{return null}return e}function Mm(e,t){var s;let n=e.replace(Et.findPipe,(r,o,c)=>{let u=!1,d=o;for(;--d>=0&&c[d]==="\\";)u=!u;return u?"|":" |"}),a=n.split(Et.splitPipe),l=0;if(a[0].trim()||a.shift(),a.length>0&&!((s=a.at(-1))!=null&&s.trim())&&a.pop(),t)if(a.length>t)a.splice(t);else for(;a.length<t;)a.push("");for(;l<a.length;l++)a[l]=a[l].trim().replace(Et.slashPipe,"|");return a}function Ua(e,t,n){let a=e.length;if(a===0)return"";let l=0;for(;l<a&&e.charAt(a-l-1)===t;)l++;return e.slice(0,a-l)}function Rm(e){let t=e.split(`
|
|
51
|
+
`),n=t.length-1;for(;n>=0&&Et.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
52
|
+
`)}function Dw(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let a=0;a<e.length;a++)if(e[a]==="\\")a++;else if(e[a]===t[0])n++;else if(e[a]===t[1]&&(n--,n<0))return a;return n>0?-2:-1}function Mw(e,t=0){let n=t,a="";for(let l of e)if(l===" "){let s=4-n%4;a+=" ".repeat(s),n+=s}else a+=l,n++;return a}function Lm(e,t,n,a,l){let s=t.href,r=t.title||null,o=e[1].replace(l.other.outputLinkReplace,"$1");a.state.inLink=!0;let c={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:r,text:o,tokens:a.inlineTokens(o)};return a.state.inLink=!1,c}function Rw(e,t,n){let a=e.match(n.other.indentCodeCompensation);if(a===null)return t;let l=a[1];return t.split(`
|
|
53
|
+
`).map(s=>{let r=s.match(n.other.beginningSpace);if(r===null)return s;let[o]=r;return o.length>=l.length?s.slice(l.length):s}).join(`
|
|
54
|
+
`)}var hc=class{constructor(e){ye(this,"options");ye(this,"rules");ye(this,"lexer");this.options=e||Ql}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=this.options.pedantic?t[0]:Rm(t[0]),a=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:a}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],a=Rw(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:a}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let a=Ua(n,"#");(this.options.pedantic||!a||this.rules.other.endingSpaceChar.test(a))&&(n=a.trim())}return{type:"heading",raw:Ua(t[0],`
|
|
55
|
+
`),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Ua(t[0],`
|
|
56
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Ua(t[0],`
|
|
57
|
+
`).split(`
|
|
58
|
+
`),a="",l="",s=[];for(;n.length>0;){let r=!1,o=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))o.push(n[c]),r=!0;else if(!r)o.push(n[c]);else break;n=n.slice(c);let u=o.join(`
|
|
59
|
+
`),d=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
60
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
|
|
61
|
+
${u}`:u,l=l?`${l}
|
|
62
|
+
${d}`:d;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,s,!0),this.lexer.state.top=f,n.length===0)break;let h=s.at(-1);if((h==null?void 0:h.type)==="code")break;if((h==null?void 0:h.type)==="blockquote"){let p=h,v=p.raw+`
|
|
63
|
+
`+n.join(`
|
|
64
|
+
`),j=this.blockquote(v);s[s.length-1]=j,a=a.substring(0,a.length-p.raw.length)+j.raw,l=l.substring(0,l.length-p.text.length)+j.text;break}else if((h==null?void 0:h.type)==="list"){let p=h,v=p.raw+`
|
|
65
|
+
`+n.join(`
|
|
66
|
+
`),j=this.list(v);s[s.length-1]=j,a=a.substring(0,a.length-h.raw.length)+j.raw,l=l.substring(0,l.length-p.raw.length)+j.raw,n=v.substring(s.at(-1).raw.length).split(`
|
|
67
|
+
`);continue}}return{type:"blockquote",raw:a,tokens:s,text:l}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),a=n.length>1,l={type:"list",raw:"",ordered:a,start:a?+n.slice(0,-1):"",loose:!1,items:[]};n=a?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=a?n:"[*+-]");let s=this.rules.other.listItemRegex(n),r=!1;for(;e;){let c=!1,u="",d="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;u=t[0],e=e.substring(u.length);let f=Mw(t[2].split(`
|
|
68
|
+
`,1)[0],t[1].length),h=e.split(`
|
|
69
|
+
`,1)[0],p=!f.trim(),v=0;if(this.options.pedantic?(v=2,d=f.trimStart()):p?v=t[1].length+1:(v=f.search(this.rules.other.nonSpaceChar),v=v>4?1:v,d=f.slice(v),v+=t[1].length),p&&this.rules.other.blankLine.test(h)&&(u+=h+`
|
|
70
|
+
`,e=e.substring(h.length+1),c=!0),!c){let j=this.rules.other.nextBulletRegex(v),k=this.rules.other.hrRegex(v),g=this.rules.other.fencesBeginRegex(v),x=this.rules.other.headingBeginRegex(v),b=this.rules.other.htmlBeginRegex(v),y=this.rules.other.blockquoteBeginRegex(v);for(;e;){let T=e.split(`
|
|
71
|
+
`,1)[0],_;if(h=T,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),_=h):_=h.replace(this.rules.other.tabCharGlobal," "),g.test(h)||x.test(h)||b.test(h)||y.test(h)||j.test(h)||k.test(h))break;if(_.search(this.rules.other.nonSpaceChar)>=v||!h.trim())d+=`
|
|
72
|
+
`+_.slice(v);else{if(p||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||g.test(f)||x.test(f)||k.test(f))break;d+=`
|
|
73
|
+
`+h}p=!h.trim(),u+=T+`
|
|
74
|
+
`,e=e.substring(T.length+1),f=_.slice(v)}}l.loose||(r?l.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(r=!0)),l.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(d),loose:!1,text:d,tokens:[]}),l.raw+=u}let o=l.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;l.raw=l.raw.trimEnd();for(let c of l.items){this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]);let u=c.tokens[0];if(c.task&&((u==null?void 0:u.type)==="text"||(u==null?void 0:u.type)==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),u.raw=u.raw.replace(this.rules.other.listReplaceTask,""),u.text=u.text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}let d=this.rules.other.listTaskCheckbox.exec(c.raw);if(d){let f={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};c.checked=f.checked,l.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=f.raw+c.tokens[0].raw,c.tokens[0].text=f.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(f)):c.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):c.tokens.unshift(f)}}else c.task&&(c.task=!1);if(!l.loose){let d=c.tokens.filter(h=>h.type==="space"),f=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));l.loose=f}}if(l.loose)for(let c of l.items){c.loose=!0;for(let u of c.tokens)u.type==="text"&&(u.type="paragraph")}return l}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=Rm(t[0]);return{type:"html",block:!0,raw:n,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:n}}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),a=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",l=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:Ua(t[0],`
|
|
75
|
+
`),href:a,title:l}}}table(e){var r;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Mm(t[1]),a=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),l=(r=t[3])!=null&&r.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
76
|
+
`):[],s={type:"table",raw:Ua(t[0],`
|
|
77
|
+
`),header:[],align:[],rows:[]};if(n.length===a.length){for(let o of a)this.rules.other.tableAlignRight.test(o)?s.align.push("right"):this.rules.other.tableAlignCenter.test(o)?s.align.push("center"):this.rules.other.tableAlignLeft.test(o)?s.align.push("left"):s.align.push(null);for(let o=0;o<n.length;o++)s.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:s.align[o]});for(let o of l)s.rows.push(Mm(o,s.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:s.align[u]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:Ua(t[0],`
|
|
78
|
+
`),depth:t[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
79
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=Ua(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=Dw(t[2],"()");if(s===-2)return;if(s>-1){let r=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,r).trim(),t[3]=""}}let a=t[2],l="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(a);s&&(a=s[1],l=s[3])}else l=t[3]?t[3].slice(1,-1):"";return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?a=a.slice(1):a=a.slice(1,-1)),Lm(t,{href:a&&a.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let a=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),l=t[a.toLowerCase()];if(!l){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return Lm(n,l,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let a=this.rules.inline.emStrongLDelim.exec(e);if(!(!a||!a[1]&&!a[2]&&!a[3]&&!a[4]||a[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(a[1]||a[3])||!n||this.rules.inline.punctuation.exec(n))){let l=[...a[0]].length-1,s,r,o=l,c=0,u=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+l);(a=u.exec(t))!==null;){if(s=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!s)continue;if(r=[...s].length,a[3]||a[4]){o+=r;continue}else if((a[5]||a[6])&&l%3&&!((l+r)%3)){c+=r;continue}if(o-=r,o>0)continue;r=Math.min(r,r+o+c);let d=[...a[0]][0].length,f=e.slice(0,l+a.index+d+r);if(Math.min(l,r)%2){let p=f.slice(1,-1);return{type:"em",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}let h=f.slice(2,-2);return{type:"strong",raw:f,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),a=this.rules.other.nonSpaceChar.test(n),l=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return a&&l&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let a=this.rules.inline.delLDelim.exec(e);if(a&&(!a[1]||!n||this.rules.inline.punctuation.exec(n))){let l=[...a[0]].length-1,s,r,o=l,c=this.rules.inline.delRDelim;for(c.lastIndex=0,t=t.slice(-1*e.length+l);(a=c.exec(t))!==null;){if(s=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!s||(r=[...s].length,r!==l))continue;if(a[3]||a[4]){o+=r;continue}if(o-=r,o>0)continue;r=Math.min(r,r+o);let u=[...a[0]][0].length,d=e.slice(0,l+a.index+u+r),f=d.slice(l,-l);return{type:"del",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,a;return t[2]==="@"?(n=t[1],a="mailto:"+n):(n=t[1],a=n),{type:"link",raw:t[0],text:n,href:a,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let a,l;if(t[2]==="@")a=t[0],l="mailto:"+a;else{let s;do s=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(s!==t[0]);a=t[0],t[1]==="www."?l="http://"+t[0]:l=t[0]}return{type:"link",raw:t[0],text:a,href:l,tokens:[{type:"text",raw:a,text:a}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},Zn=class tf{constructor(t){ye(this,"tokens");ye(this,"options");ye(this,"state");ye(this,"inlineQueue");ye(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Ql,this.options.tokenizer=this.options.tokenizer||new hc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Et,block:ro.normal,inline:wr.normal};this.options.pedantic?(n.block=ro.pedantic,n.inline=wr.pedantic):this.options.gfm&&(n.block=ro.gfm,this.options.breaks?n.inline=wr.breaks:n.inline=wr.gfm),this.tokenizer.rules=n}static get rules(){return{block:ro,inline:wr}}static lex(t,n){return new tf(n).lex(t)}static lexInline(t,n){return new tf(n).inlineTokens(t)}lex(t){t=t.replace(Et.carriageReturn,`
|
|
80
|
+
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let a=this.inlineQueue[n];this.inlineTokens(a.src,a.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],a=!1){var s,r,o;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(Et.tabCharGlobal," ").replace(Et.spaceLine,""));let l=1/0;for(;t;){if(t.length<l)l=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let c;if((r=(s=this.options.extensions)==null?void 0:s.block)!=null&&r.some(d=>(c=d.call({lexer:this},t,n))?(t=t.substring(c.raw.length),n.push(c),!0):!1))continue;if(c=this.tokenizer.space(t)){t=t.substring(c.raw.length);let d=n.at(-1);c.raw.length===1&&d!==void 0?d.raw+=`
|
|
81
|
+
`:n.push(c);continue}if(c=this.tokenizer.code(t)){t=t.substring(c.raw.length);let d=n.at(-1);(d==null?void 0:d.type)==="paragraph"||(d==null?void 0:d.type)==="text"?(d.raw+=(d.raw.endsWith(`
|
|
82
|
+
`)?"":`
|
|
83
|
+
`)+c.raw,d.text+=`
|
|
84
|
+
`+c.text,this.inlineQueue.at(-1).src=d.text):n.push(c);continue}if(c=this.tokenizer.fences(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.heading(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.hr(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.blockquote(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.list(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.html(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.def(t)){t=t.substring(c.raw.length);let d=n.at(-1);(d==null?void 0:d.type)==="paragraph"||(d==null?void 0:d.type)==="text"?(d.raw+=(d.raw.endsWith(`
|
|
85
|
+
`)?"":`
|
|
86
|
+
`)+c.raw,d.text+=`
|
|
87
|
+
`+c.raw,this.inlineQueue.at(-1).src=d.text):this.tokens.links[c.tag]||(this.tokens.links[c.tag]={href:c.href,title:c.title},n.push(c));continue}if(c=this.tokenizer.table(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.lheading(t)){t=t.substring(c.raw.length),n.push(c);continue}let u=t;if((o=this.options.extensions)!=null&&o.startBlock){let d=1/0,f=t.slice(1),h;this.options.extensions.startBlock.forEach(p=>{h=p.call({lexer:this},f),typeof h=="number"&&h>=0&&(d=Math.min(d,h))}),d<1/0&&d>=0&&(u=t.substring(0,d+1))}if(this.state.top&&(c=this.tokenizer.paragraph(u))){let d=n.at(-1);a&&(d==null?void 0:d.type)==="paragraph"?(d.raw+=(d.raw.endsWith(`
|
|
88
|
+
`)?"":`
|
|
89
|
+
`)+c.raw,d.text+=`
|
|
90
|
+
`+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=d.text):n.push(c),a=u.length!==t.length,t=t.substring(c.raw.length);continue}if(c=this.tokenizer.text(t)){t=t.substring(c.raw.length);let d=n.at(-1);(d==null?void 0:d.type)==="text"?(d.raw+=(d.raw.endsWith(`
|
|
91
|
+
`)?"":`
|
|
92
|
+
`)+c.raw,d.text+=`
|
|
93
|
+
`+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=d.text):n.push(c);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var u,d,f,h,p;this.tokenizer.lexer=this;let a=t,l=null;if(this.tokens.links){let v=Object.keys(this.tokens.links);if(v.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(a))!==null;)v.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(a))!==null;)a=a.slice(0,l.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(l=this.tokenizer.rules.inline.blockSkip.exec(a))!==null;)s=l[2]?l[2].length:0,a=a.slice(0,l.index+s)+"["+"a".repeat(l[0].length-s-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);a=((d=(u=this.options.hooks)==null?void 0:u.emStrongMask)==null?void 0:d.call({lexer:this},a))??a;let r=!1,o="",c=1/0;for(;t;){if(t.length<c)c=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}r||(o=""),r=!1;let v;if((h=(f=this.options.extensions)==null?void 0:f.inline)!=null&&h.some(k=>(v=k.call({lexer:this},t,n))?(t=t.substring(v.raw.length),n.push(v),!0):!1))continue;if(v=this.tokenizer.escape(t)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.tag(t)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.link(t)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(v.raw.length);let k=n.at(-1);v.type==="text"&&(k==null?void 0:k.type)==="text"?(k.raw+=v.raw,k.text+=v.text):n.push(v);continue}if(v=this.tokenizer.emStrong(t,a,o)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.codespan(t)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.br(t)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.del(t,a,o)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.autolink(t)){t=t.substring(v.raw.length),n.push(v);continue}if(!this.state.inLink&&(v=this.tokenizer.url(t))){t=t.substring(v.raw.length),n.push(v);continue}let j=t;if((p=this.options.extensions)!=null&&p.startInline){let k=1/0,g=t.slice(1),x;this.options.extensions.startInline.forEach(b=>{x=b.call({lexer:this},g),typeof x=="number"&&x>=0&&(k=Math.min(k,x))}),k<1/0&&k>=0&&(j=t.substring(0,k+1))}if(v=this.tokenizer.inlineText(j)){t=t.substring(v.raw.length),v.raw.slice(-1)!=="_"&&(o=v.raw.slice(-1)),r=!0;let k=n.at(-1);(k==null?void 0:k.type)==="text"?(k.raw+=v.raw,k.text+=v.text):n.push(v);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return n}infiniteLoopError(t){let n="Infinite loop on byte: "+t;if(this.options.silent)console.error(n);else throw new Error(n)}},pc=class{constructor(e){ye(this,"options");ye(this,"parser");this.options=e||Ql}space(e){return""}code({text:e,lang:t,escaped:n}){var s;let a=(s=(t||"").match(Et.notSpaceStart))==null?void 0:s[0],l=e.replace(Et.endingNewline,"")+`
|
|
94
|
+
`;return a?'<pre><code class="language-'+Jn(a)+'">'+(n?l:Jn(l,!0))+`</code></pre>
|
|
95
|
+
`:"<pre><code>"+(n?l:Jn(l,!0))+`</code></pre>
|
|
96
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
97
|
+
${this.parser.parse(e)}</blockquote>
|
|
98
|
+
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
99
|
+
`}hr(e){return`<hr>
|
|
100
|
+
`}list(e){let t=e.ordered,n=e.start,a="";for(let r=0;r<e.items.length;r++){let o=e.items[r];a+=this.listitem(o)}let l=t?"ol":"ul",s=t&&n!==1?' start="'+n+'"':"";return"<"+l+s+`>
|
|
101
|
+
`+a+"</"+l+`>
|
|
102
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
103
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
104
|
+
`}table(e){let t="",n="";for(let l=0;l<e.header.length;l++)n+=this.tablecell(e.header[l]);t+=this.tablerow({text:n});let a="";for(let l=0;l<e.rows.length;l++){let s=e.rows[l];n="";for(let r=0;r<s.length;r++)n+=this.tablecell(s[r]);a+=this.tablerow({text:n})}return a&&(a=`<tbody>${a}</tbody>`),`<table>
|
|
105
|
+
<thead>
|
|
106
|
+
`+t+`</thead>
|
|
107
|
+
`+a+`</table>
|
|
108
|
+
`}tablerow({text:e}){return`<tr>
|
|
109
|
+
${e}</tr>
|
|
110
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
111
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Jn(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let a=this.parser.parseInline(n),l=Dm(e);if(l===null)return a;e=l;let s='<a href="'+e+'"';return t&&(s+=' title="'+Jn(t)+'"'),s+=">"+a+"</a>",s}image({href:e,title:t,text:n,tokens:a}){a&&(n=this.parser.parseInline(a,this.parser.textRenderer));let l=Dm(e);if(l===null)return Jn(n);e=l;let s=`<img src="${e}" alt="${Jn(n)}"`;return t&&(s+=` title="${Jn(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Jn(e.text)}},wh=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Hn=class nf{constructor(t){ye(this,"options");ye(this,"renderer");ye(this,"textRenderer");this.options=t||Ql,this.options.renderer=this.options.renderer||new pc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new wh}static parse(t,n){return new nf(n).parse(t)}static parseInline(t,n){return new nf(n).parseInline(t)}parse(t){var a,l;this.renderer.parser=this;let n="";for(let s=0;s<t.length;s++){let r=t[s];if((l=(a=this.options.extensions)==null?void 0:a.renderers)!=null&&l[r.type]){let c=r,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){n+=u||"";continue}}let o=r;switch(o.type){case"space":{n+=this.renderer.space(o);break}case"hr":{n+=this.renderer.hr(o);break}case"heading":{n+=this.renderer.heading(o);break}case"code":{n+=this.renderer.code(o);break}case"table":{n+=this.renderer.table(o);break}case"blockquote":{n+=this.renderer.blockquote(o);break}case"list":{n+=this.renderer.list(o);break}case"checkbox":{n+=this.renderer.checkbox(o);break}case"html":{n+=this.renderer.html(o);break}case"def":{n+=this.renderer.def(o);break}case"paragraph":{n+=this.renderer.paragraph(o);break}case"text":{n+=this.renderer.text(o);break}default:{let c='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}parseInline(t,n=this.renderer){var l,s;this.renderer.parser=this;let a="";for(let r=0;r<t.length;r++){let o=t[r];if((s=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&s[o.type]){let u=this.options.extensions.renderers[o.type].call({parser:this},o);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){a+=u||"";continue}}let c=o;switch(c.type){case"escape":{a+=n.text(c);break}case"html":{a+=n.html(c);break}case"link":{a+=n.link(c);break}case"image":{a+=n.image(c);break}case"checkbox":{a+=n.checkbox(c);break}case"strong":{a+=n.strong(c);break}case"em":{a+=n.em(c);break}case"codespan":{a+=n.codespan(c);break}case"br":{a+=n.br(c);break}case"del":{a+=n.del(c);break}case"text":{a+=n.text(c);break}default:{let u='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return a}},bo,Or=(bo=class{constructor(e){ye(this,"options");ye(this,"block");this.options=e||Ql}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Zn.lex:Zn.lexInline}provideParser(e=this.block){return e?Hn.parse:Hn.parseInline}},ye(bo,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ye(bo,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),bo),Lw=class{constructor(...e){ye(this,"defaults",ph());ye(this,"options",this.setOptions);ye(this,"parse",this.parseMarkdown(!0));ye(this,"parseInline",this.parseMarkdown(!1));ye(this,"Parser",Hn);ye(this,"Renderer",pc);ye(this,"TextRenderer",wh);ye(this,"Lexer",Zn);ye(this,"Tokenizer",hc);ye(this,"Hooks",Or);this.use(...e)}walkTokens(e,t){var a,l;let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let r=s;for(let o of r.header)n=n.concat(this.walkTokens(o.tokens,t));for(let o of r.rows)for(let c of o)n=n.concat(this.walkTokens(c.tokens,t));break}case"list":{let r=s;n=n.concat(this.walkTokens(r.items,t));break}default:{let r=s;(l=(a=this.defaults.extensions)==null?void 0:a.childTokens)!=null&&l[r.type]?this.defaults.extensions.childTokens[r.type].forEach(o=>{let c=r[o].flat(1/0);n=n.concat(this.walkTokens(c,t))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let a={...n};if(a.async=this.defaults.async||a.async||!1,n.extensions&&(n.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){let s=t.renderers[l.name];s?t.renderers[l.name]=function(...r){let o=l.renderer.apply(this,r);return o===!1&&(o=s.apply(this,r)),o}:t.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[l.level];s?s.unshift(l.tokenizer):t[l.level]=[l.tokenizer],l.start&&(l.level==="block"?t.startBlock?t.startBlock.push(l.start):t.startBlock=[l.start]:l.level==="inline"&&(t.startInline?t.startInline.push(l.start):t.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(t.childTokens[l.name]=l.childTokens)}),a.extensions=t),n.renderer){let l=this.defaults.renderer||new pc(this.defaults);for(let s in n.renderer){if(!(s in l))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let r=s,o=n.renderer[r],c=l[r];l[r]=(...u)=>{let d=o.apply(l,u);return d===!1&&(d=c.apply(l,u)),d||""}}a.renderer=l}if(n.tokenizer){let l=this.defaults.tokenizer||new hc(this.defaults);for(let s in n.tokenizer){if(!(s in l))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let r=s,o=n.tokenizer[r],c=l[r];l[r]=(...u)=>{let d=o.apply(l,u);return d===!1&&(d=c.apply(l,u)),d}}a.tokenizer=l}if(n.hooks){let l=this.defaults.hooks||new Or;for(let s in n.hooks){if(!(s in l))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let r=s,o=n.hooks[r],c=l[r];Or.passThroughHooks.has(s)?l[r]=u=>{if(this.defaults.async&&Or.passThroughHooksRespectAsync.has(s))return(async()=>{let f=await o.call(l,u);return c.call(l,f)})();let d=o.call(l,u);return c.call(l,d)}:l[r]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await o.apply(l,u);return f===!1&&(f=await c.apply(l,u)),f})();let d=o.apply(l,u);return d===!1&&(d=c.apply(l,u)),d}}a.hooks=l}if(n.walkTokens){let l=this.defaults.walkTokens,s=n.walkTokens;a.walkTokens=function(r){let o=[];return o.push(s.call(this,r)),l&&(o=o.concat(l.call(this,r))),o}}this.defaults={...this.defaults,...a}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Zn.lex(e,t??this.defaults)}parser(e,t){return Hn.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let a={...n},l={...this.defaults,...a},s=this.onError(!!l.silent,!!l.async);if(this.defaults.async===!0&&a.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(l.hooks&&(l.hooks.options=l,l.hooks.block=e),l.async)return(async()=>{let r=l.hooks?await l.hooks.preprocess(t):t,o=await(l.hooks?await l.hooks.provideLexer(e):e?Zn.lex:Zn.lexInline)(r,l),c=l.hooks?await l.hooks.processAllTokens(o):o;l.walkTokens&&await Promise.all(this.walkTokens(c,l.walkTokens));let u=await(l.hooks?await l.hooks.provideParser(e):e?Hn.parse:Hn.parseInline)(c,l);return l.hooks?await l.hooks.postprocess(u):u})().catch(s);try{l.hooks&&(t=l.hooks.preprocess(t));let r=(l.hooks?l.hooks.provideLexer(e):e?Zn.lex:Zn.lexInline)(t,l);l.hooks&&(r=l.hooks.processAllTokens(r)),l.walkTokens&&this.walkTokens(r,l.walkTokens);let o=(l.hooks?l.hooks.provideParser(e):e?Hn.parse:Hn.parseInline)(r,l);return l.hooks&&(o=l.hooks.postprocess(o)),o}catch(r){return s(r)}}}onError(e,t){return n=>{if(n.message+=`
|
|
112
|
+
Please report this to https://github.com/markedjs/marked.`,e){let a="<p>An error occurred:</p><pre>"+Jn(n.message+"",!0)+"</pre>";return t?Promise.resolve(a):a}if(t)return Promise.reject(n);throw n}}},ql=new Lw;function _e(e,t){return ql.parse(e,t)}_e.options=_e.setOptions=function(e){return ql.setOptions(e),_e.defaults=ql.defaults,sv(_e.defaults),_e};_e.getDefaults=ph;_e.defaults=Ql;_e.use=function(...e){return ql.use(...e),_e.defaults=ql.defaults,sv(_e.defaults),_e};_e.walkTokens=function(e,t){return ql.walkTokens(e,t)};_e.parseInline=ql.parseInline;_e.Parser=Hn;_e.parser=Hn.parse;_e.Renderer=pc;_e.TextRenderer=wh;_e.Lexer=Zn;_e.lexer=Zn.lex;_e.Tokenizer=hc;_e.Hooks=Or;_e.parse=_e;_e.options;_e.setOptions;_e.use;_e.walkTokens;_e.parseInline;Hn.parse;Zn.lex;/*! @license DOMPurify 3.4.14 | (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.14/LICENSE */function $m(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function $w(e){if(Array.isArray(e))return e}function Uw(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var a,l,s,r,o=[],c=!0,u=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(c=(a=s.call(n)).done)&&(o.push(a.value),o.length!==t);c=!0);}catch(d){u=!0,l=d}finally{try{if(!c&&n.return!=null&&(r=n.return(),Object(r)!==r))return}finally{if(u)throw l}}return o}}function Bw(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
113
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zw(e,t){return $w(e)||Uw(e,t)||Hw(e,t)||Bw()}function Hw(e,t){if(e){if(typeof e=="string")return $m(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$m(e,t):void 0}}const mv=Object.entries,Um=Object.setPrototypeOf,qw=Object.isFrozen,Gw=Object.getPrototypeOf,Yw=Object.getOwnPropertyDescriptor;let dt=Object.freeze,xt=Object.seal,is=Object.create,gv=typeof Reflect<"u"&&Reflect,af=gv.apply,lf=gv.construct;dt||(dt=function(t){return t});xt||(xt=function(t){return t});af||(af=function(t,n){for(var a=arguments.length,l=new Array(a>2?a-2:0),s=2;s<a;s++)l[s-2]=arguments[s];return t.apply(n,l)});lf||(lf=function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),l=1;l<n;l++)a[l-1]=arguments[l];return new t(...a)});const Al=ot(Array.prototype.forEach),Iw=ot(Array.prototype.lastIndexOf),Bm=ot(Array.prototype.pop),jr=ot(Array.prototype.push),Xw=ot(Array.prototype.splice),zs=Array.isArray,Dr=ot(String.prototype.toLowerCase),qu=ot(String.prototype.toString),Zm=ot(String.prototype.match),kr=ot(String.prototype.replace),Hm=ot(String.prototype.indexOf),Vw=ot(String.prototype.trim),Qw=ot(Number.prototype.toString),Kw=ot(Boolean.prototype.toString),qm=typeof BigInt>"u"?null:ot(BigInt.prototype.toString),Gm=typeof Symbol>"u"?null:ot(Symbol.prototype.toString),Qt=ot(Object.prototype.hasOwnProperty),_r=ot(Object.prototype.toString),Tt=ot(RegExp.prototype.test),jl=Jw(TypeError);function ot(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),l=1;l<n;l++)a[l-1]=arguments[l];return af(e,t,a)}}function Jw(e){return function(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return lf(e,n)}}function ve(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Dr;if(Um&&Um(e,null),!zs(t))return e;let a=t.length;for(;a--;){let l=t[a];if(typeof l=="string"){const s=n(l);s!==l&&(qw(t)||(t[a]=s),l=s)}e[l]=!0}return e}function Ww(e){for(let t=0;t<e.length;t++)Qt(e,t)||(e[t]=null);return e}function sn(e){const t=is(null);for(const a of mv(e)){var n=Zw(a,2);const l=n[0],s=n[1];Qt(e,l)&&(zs(s)?t[l]=Ww(s):s&&typeof s=="object"&&s.constructor===Object?t[l]=sn(s):t[l]=s)}return t}function Fw(e){switch(typeof e){case"string":return e;case"number":return Qw(e);case"boolean":return Kw(e);case"bigint":return qm?qm(e):"0";case"symbol":return Gm?Gm(e):"Symbol()";case"undefined":return _r(e);case"function":case"object":{if(e===null)return _r(e);const t=e,n=$n(t,"toString");if(typeof n=="function"){const a=n(t);return typeof a=="string"?a:_r(a)}return _r(e)}default:return _r(e)}}function $n(e,t){for(;e!==null;){const a=Yw(e,t);if(a){if(a.get)return ot(a.get);if(typeof a.value=="function")return ot(a.value)}e=Gw(e)}function n(){return null}return n}function Pw(e){try{return Tt(e,""),!0}catch{return!1}}const Ym=dt(["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"]),Gu=dt(["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"]),Yu=dt(["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"]),ej=dt(["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"]),Iu=dt(["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"]),tj=dt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Im=dt(["#text"]),Xm=dt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","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"]),Xu=dt(["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","dominant-baseline","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","pointer-events","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-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","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"]),Vm=dt(["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"]),io=dt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),nj=xt(/{{[\w\W]*|^[\w\W]*}}/g),aj=xt(/<%[\w\W]*|^[\w\W]*%>/g),lj=xt(/\${[\w\W]*/g),sj=xt(/^data-[\-\w.\u00B7-\uFFFF]+$/),rj=xt(/^aria-[\-\w]+$/),Qm=xt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ij=xt(/^(?:\w+script|data):/i),oj=xt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),cj=xt(/^html$/i),uj=xt(/^[a-z][.\w]*(-[.\w]+)+$/i),Km=xt(/<[/\w!]/g),Jm=xt(/<[/\w]/g),dj=xt(/<\/no(script|embed|frames)/i),fj=xt(/\/>/i),ln={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},xv=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],hj=dt(ve({},xv)),pj=function(){const e={};return Al(xv,t=>{e[t]=xt(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),dt(e)}(),mj=function(){return typeof window>"u"?null:window},gj=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let a=null;const l="data-tt-policy-suffix";n&&n.hasAttribute(l)&&(a=n.getAttribute(l));const s="dompurify"+(a?"#"+a:"");try{return t.createPolicy(s,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Wm=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ba=function(t,n,a,l){return Qt(t,n)&&zs(t[n])?ve(l.base?sn(l.base):{},t[n],l.transform):a},Vu=function(t,n,a){const l=Qt(t,n)?t[n]:void 0;return l&&typeof l=="object"?sn(l):a()};function yv(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:mj();const t=I=>yv(I);if(t.version="3.4.14",t.removed=[],!e||!e.document||e.document.nodeType!==ln.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const a=n,l=a.currentScript;e.DocumentFragment;const s=e.HTMLTemplateElement,r=e.Node,o=e.Element,c=e.NodeFilter,u=e.NamedNodeMap;u===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const d=e.DOMParser,f=e.trustedTypes,h=o.prototype,p=$n(h,"cloneNode"),v=$n(h,"remove"),j=$n(h,"nextSibling"),k=$n(h,"childNodes"),g=$n(h,"parentNode"),x=$n(h,"shadowRoot"),b=$n(h,"attributes"),y=r&&r.prototype?$n(r.prototype,"nodeType"):null,T=r&&r.prototype?$n(r.prototype,"nodeName"):null,_=r&&r.prototype?$n(r.prototype,"ownerDocument"):null,E=function(S){return y?y(S):S.nodeType},D=function(S){return T?T(S):S.nodeName};if(typeof s=="function"){const I=n.createElement("template");I.content&&I.content.ownerDocument&&(n=I.content.ownerDocument)}let O,R="",X,K=!1,P=0;const z=function(){if(P>0)throw jl('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},A=function(S){z(),P++;try{return O.createHTML(S)}finally{P--}},C=function(S){z(),P++;try{return O.createScriptURL(S)}finally{P--}},M=function(){return K||(X=gj(f,l),K=!0),X},V=n,J=V.implementation,ne=V.createNodeIterator,Se=V.createDocumentFragment,le=V.getElementsByTagName,B=a.importNode;let w=Wm();t.isSupported=typeof mv=="function"&&typeof g=="function"&&J&&J.createHTMLDocument!==void 0;const Z=nj,q=aj,ae=lj,re=sj,G=rj,F=ij,$e=oj,Ge=uj;let At=Qm,fe=null;const Ue=ve({},[...Ym,...Gu,...Yu,...Iu,...Im]);let oe=null;const Y=ve({},[...Xm,...Xu,...Vm,...io]);let me=Object.seal(is(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}})),yt=null,Bt=null;const tn=Object.seal(is(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let xl=!0,Jl=!0,or=!1,Li=!0,Qn=!1,Zt=!0,Ht=!1,sa=!1,yl=null,nn=null,Wl=!1,Ca=!1,Fl=!1,Oa=!1,cr=!0,$i=!1;const ur="user-content-";let dr=!0,fr=!1,Da={},Ve=null;const kt=ve({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let _t=null;const Dn=ve({},["audio","video","img","source","image","track"]);let zt=null;const Nt=ve({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ct="http://www.w3.org/1998/Math/MathML",Mn="http://www.w3.org/2000/svg",ze="http://www.w3.org/1999/xhtml";let Ot=ze,qt=!1,an=null;const bl=ve({},[Ct,Mn,ze],qu),Ma=dt(["mi","mo","mn","ms","mtext"]);let bn=ve({},Ma);const Ra=dt(["annotation-xml"]);let vl=ve({},Ra);const O0=ve({},["title","style","font","a","script"]);let hr=null;const D0=["application/xhtml+xml","text/html"],M0="text/html";let et=null,Pl=null;const R0=n.createElement("form"),Gh=function(S){return S instanceof RegExp||S instanceof Function},tu=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Pl&&Pl===S)return;(!S||typeof S!="object")&&(S={}),S=sn(S),hr=D0.indexOf(S.PARSER_MEDIA_TYPE)===-1?M0:S.PARSER_MEDIA_TYPE,et=hr==="application/xhtml+xml"?qu:Dr,fe=Ba(S,"ALLOWED_TAGS",Ue,{transform:et}),oe=Ba(S,"ALLOWED_ATTR",Y,{transform:et}),an=Ba(S,"ALLOWED_NAMESPACES",bl,{transform:qu}),zt=Ba(S,"ADD_URI_SAFE_ATTR",Nt,{transform:et,base:Nt}),_t=Ba(S,"ADD_DATA_URI_TAGS",Dn,{transform:et,base:Dn}),Ve=Ba(S,"FORBID_CONTENTS",kt,{transform:et}),yt=Ba(S,"FORBID_TAGS",sn({}),{transform:et}),Bt=Ba(S,"FORBID_ATTR",sn({}),{transform:et}),Da=Qt(S,"USE_PROFILES")?S.USE_PROFILES&&typeof S.USE_PROFILES=="object"?sn(S.USE_PROFILES):S.USE_PROFILES:!1,xl=S.ALLOW_ARIA_ATTR!==!1,Jl=S.ALLOW_DATA_ATTR!==!1,or=S.ALLOW_UNKNOWN_PROTOCOLS||!1,Li=S.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Qn=S.SAFE_FOR_TEMPLATES||!1,Zt=S.SAFE_FOR_XML!==!1,Ht=S.WHOLE_DOCUMENT||!1,Ca=S.RETURN_DOM||!1,Fl=S.RETURN_DOM_FRAGMENT||!1,Oa=S.RETURN_TRUSTED_TYPE||!1,Wl=S.FORCE_BODY||!1,cr=S.SANITIZE_DOM!==!1,$i=S.SANITIZE_NAMED_PROPS||!1,dr=S.KEEP_CONTENT!==!1,fr=S.IN_PLACE||!1,At=Pw(S.ALLOWED_URI_REGEXP)?S.ALLOWED_URI_REGEXP:Qm,Ot=typeof S.NAMESPACE=="string"?S.NAMESPACE:ze,bn=Vu(S,"MATHML_TEXT_INTEGRATION_POINTS",()=>ve({},Ma)),vl=Vu(S,"HTML_INTEGRATION_POINTS",()=>ve({},Ra));const N=Vu(S,"CUSTOM_ELEMENT_HANDLING",()=>is(null));if(me=is(null),Qt(N,"tagNameCheck")&&Gh(N.tagNameCheck)&&(me.tagNameCheck=N.tagNameCheck),Qt(N,"attributeNameCheck")&&Gh(N.attributeNameCheck)&&(me.attributeNameCheck=N.attributeNameCheck),Qt(N,"allowCustomizedBuiltInElements")&&typeof N.allowCustomizedBuiltInElements=="boolean"&&(me.allowCustomizedBuiltInElements=N.allowCustomizedBuiltInElements),xt(me),Qn&&(Jl=!1),Fl&&(Ca=!0),Da&&(fe=ve({},Im),oe=is(null),Da.html===!0&&(ve(fe,Ym),ve(oe,Xm)),Da.svg===!0&&(ve(fe,Gu),ve(oe,Xu),ve(oe,io)),Da.svgFilters===!0&&(ve(fe,Yu),ve(oe,Xu),ve(oe,io)),Da.mathMl===!0&&(ve(fe,Iu),ve(oe,Vm),ve(oe,io))),tn.tagCheck=null,tn.attributeCheck=null,Qt(S,"ADD_TAGS")&&(typeof S.ADD_TAGS=="function"?tn.tagCheck=S.ADD_TAGS:zs(S.ADD_TAGS)&&(fe===Ue&&(fe=sn(fe)),ve(fe,S.ADD_TAGS,et))),Qt(S,"ADD_ATTR")&&(typeof S.ADD_ATTR=="function"?tn.attributeCheck=S.ADD_ATTR:zs(S.ADD_ATTR)&&(oe===Y&&(oe=sn(oe)),ve(oe,S.ADD_ATTR,et))),Qt(S,"ADD_FORBID_CONTENTS")&&zs(S.ADD_FORBID_CONTENTS)&&(Ve===kt&&(Ve=sn(Ve)),ve(Ve,S.ADD_FORBID_CONTENTS,et)),dr&&(fe["#text"]=!0),Ht&&ve(fe,["html","head","body"]),fe.table&&(ve(fe,["tbody"]),delete yt.tbody),S.TRUSTED_TYPES_POLICY){if(typeof S.TRUSTED_TYPES_POLICY.createHTML!="function")throw jl('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof S.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw jl('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const H=O;O=S.TRUSTED_TYPES_POLICY;try{R=A("")}catch(W){throw O=H,W}}else S.TRUSTED_TYPES_POLICY===null?(O=void 0,R=""):(O===void 0&&(O=M()),O&&typeof R=="string"&&(R=A("")));dt&&dt(S),Pl=S},Yh=ve({},[...Gu,...Yu,...ej]),Ih=ve({},[...Iu,...tj]),L0=function(S,N,H){return N.namespaceURI===ze?S==="svg":N.namespaceURI===Ct?S==="svg"&&(H==="annotation-xml"||bn[H]):!!Yh[S]},$0=function(S,N,H){return N.namespaceURI===ze?S==="math":N.namespaceURI===Mn?S==="math"&&vl[H]:!!Ih[S]},U0=function(S,N,H){return N.namespaceURI===Mn&&!vl[H]||N.namespaceURI===Ct&&!bn[H]?!1:!Ih[S]&&(O0[S]||!Yh[S])},B0=function(S){let N=g(S);(!N||!N.tagName)&&(N={namespaceURI:Ot,tagName:"template"});const H=Dr(S.tagName),W=Dr(N.tagName);return an[S.namespaceURI]?S.namespaceURI===Mn?L0(H,N,W):S.namespaceURI===Ct?$0(H,N,W):S.namespaceURI===ze?U0(H,N,W):!!(hr==="application/xhtml+xml"&&an[S.namespaceURI]):!1},La=function(S){jr(t.removed,{element:S});try{g(S).removeChild(S)}catch{if(v(S),!g(S))throw jl("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Xh=function(S,N,H){try{S.removeAttributeNode(N)}catch{try{S.removeAttribute(H)}catch{}}},Ui=function(S){Bi(S);const N=k(S);if(N){const W=[];Al(N,ee=>{jr(W,ee)}),Al(W,ee=>{try{v(ee)}catch{}})}const H=b(S);if(H)for(let W=H.length-1;W>=0;--W){const ee=H[W],ie=ee&&ee.name;typeof ie=="string"&&Xh(S,ee,ie)}},Sl=function(S,N,H){if(!H)try{H=N.getAttributeNode(S)}catch{H=null}jr(t.removed,{attribute:H||null,from:N});try{H?N.removeAttributeNode(H):N.removeAttribute(S)}catch{try{N.removeAttribute(S)}catch{}}if(S==="is")if(Ca||Fl)try{La(N)}catch{}else try{N.setAttribute(S,"")}catch{}},Z0=function(S){const N=b(S);if(N)for(let H=N.length-1;H>=0;--H){const W=N[H],ee=W&&W.name;typeof ee!="string"||oe[et(ee)]||Xh(S,W,ee)}},Bi=function(S){const N=[S];for(;N.length>0;){const H=N.pop();E(H)===ln.element&&Z0(H);const ee=k(H);if(ee)for(let ie=ee.length-1;ie>=0;--ie)N.push(ee[ie])}},Vh=function(S,N){return Zt?S==="patchsrc"?!0:S==="for"&&N!=="label"&&N!=="output":!1},H0=function(S){if(!Zt)return;const N=[S];for(;N.length>0;){const H=N.pop(),W=E(H);if(W===ln.processingInstruction||W===ln.comment&&Tt(Jm,H.data)){try{v(H)}catch{}continue}if(W===ln.element){const ie=H,Re=et(D(H));try{ie.hasAttribute&&ie.hasAttribute("patchsrc")&&ie.removeAttribute("patchsrc"),ie.hasAttribute&&ie.hasAttribute("for")&&Vh("for",Re)&&ie.removeAttribute("for")}catch{}}const ee=k(H);if(ee)for(let ie=ee.length-1;ie>=0;--ie)N.push(ee[ie])}},Qh=function(S){let N=null,H=null;if(Wl)S="<remove></remove>"+S;else{const ie=Zm(S,/^[\r\n\t ]+/);H=ie&&ie[0]}hr==="application/xhtml+xml"&&Ot===ze&&(S='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+S+"</body></html>");const W=O?A(S):S;if(Ot===ze)try{N=new d().parseFromString(W,hr)}catch{}if(!N||!N.documentElement){N=J.createDocument(Ot,"template",null);try{N.documentElement.innerHTML=qt?R:W}catch{}}const ee=N.body||N.documentElement;return S&&H&&ee.insertBefore(n.createTextNode(H),ee.childNodes[0]||null),Ot===ze?le.call(N,Ht?"html":"body")[0]:Ht?N.documentElement:ee},Kh=function(S){const N=_?_(S):S.ownerDocument;return ne.call(N||S,S,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Zi=function(S){return S=kr(S,Z," "),S=kr(S,q," "),S=kr(S,ae," "),S},nu=function(S){var N;S.normalize();const H=_?_(S):S.ownerDocument,W=ne.call(H||S,S,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let ee=W.nextNode();for(;ee;)ee.data=Zi(ee.data),ee=W.nextNode();const ie=(N=S.querySelectorAll)===null||N===void 0?void 0:N.call(S,"template");ie&&Al(ie,Re=>{es(Re.content)&&nu(Re.content)})},Hi=function(S){const N=T?T(S):null;return typeof N!="string"||et(N)!=="form"?!1:typeof S.nodeName!="string"||typeof S.textContent!="string"||typeof S.removeChild!="function"||S.attributes!==b(S)||typeof S.removeAttribute!="function"||typeof S.setAttribute!="function"||typeof S.namespaceURI!="string"||typeof S.insertBefore!="function"||typeof S.hasChildNodes!="function"||S.nodeType!==y(S)||S.childNodes!==k(S)},es=function(S){if(!y||typeof S!="object"||S===null)return!1;try{return y(S)===ln.documentFragment}catch{return!1}},pr=function(S){if(!y||typeof S!="object"||S===null)return!1;try{return typeof y(S)=="number"}catch{return!1}};function Kn(I,S,N){I.length!==0&&Al(I,H=>{H.call(t,S,N,Pl)})}const q0=function(S,N){return!!(Zt&&S.hasChildNodes()&&!pr(S.firstElementChild)&&Tt(Km,S.textContent)&&Tt(Km,S.innerHTML)||Zt&&S.namespaceURI===ze&&hj[N]&&(pr(S.firstElementChild)||typeof S.textContent=="string"&&Tt(pj[N],S.textContent))||S.nodeType===ln.processingInstruction||Zt&&S.nodeType===ln.comment&&Tt(Jm,S.data))},qi=function(S,N){if(S instanceof RegExp)return Tt(S,N);if(S instanceof Function){for(var H=arguments.length,W=new Array(H>2?H-2:0),ee=2;ee<H;ee++)W[ee-2]=arguments[ee];return!!S(N,...W)}return!1},G0=function(S,N,H){if(!yt[N]&&ep(N)&&qi(me.tagNameCheck,N))return!1;if(dr&&!Ve[N]){const W=g(S),ee=k(S);if(ee&&W){const ie=ee.length;for(let Re=ie-1;Re>=0;--Re){const Qe=S===H?p(ee[Re],!0):ee[Re];W.insertBefore(Qe,j(S))}}}return La(S),!0},Jh=function(S,N,H,W){return S.length===0?N:N===H||N===W?sn(N):N},Wh=function(S,N){return S===N||g(S)!==null?!1:(fr&&Bi(S),!0)},Fh=function(S,N){if(Kn(w.beforeSanitizeElements,S,null),Wh(S,N))return!0;if(Hi(S))return La(S),!0;const H=et(D(S));if(fe=Jh(w.uponSanitizeElement,fe,Ue,yl),Kn(w.uponSanitizeElement,S,{tagName:H,allowedTags:fe}),Wh(S,N))return!0;if(q0(S,H))return La(S),!0;if(yt[H]||!(tn.tagCheck instanceof Function&&tn.tagCheck(H))&&!fe[H]){const ee=G0(S,H,N);return ee===!1&&Kn(w.afterSanitizeElements,S,null),ee}if(E(S)===ln.element&&!B0(S)||(H==="noscript"||H==="noembed"||H==="noframes")&&Tt(dj,S.innerHTML))return La(S),!0;if(Qn&&S.nodeType===ln.text){const ee=Zi(S.textContent);S.textContent!==ee&&(jr(t.removed,{element:S.cloneNode()}),S.textContent=ee)}return Kn(w.afterSanitizeElements,S,null),!1},Ph=function(S,N,H){if(Bt[N]||Vh(N,S)||cr&&(N==="id"||N==="name")&&(H in n||H in R0))return!1;const W=oe[N]||tn.attributeCheck instanceof Function&&tn.attributeCheck(N,S);return Jl&&Tt(re,N)||xl&&Tt(G,N)?!0:W?zt[N]||Tt(At,kr(H,$e,""))||(N==="src"||N==="xlink:href"||N==="href")&&S!=="script"&&Hm(H,"data:")===0&&_t[S]||or&&!Tt(F,kr(H,$e,""))?!0:!H:ep(S)&&qi(me.tagNameCheck,S)&&qi(me.attributeNameCheck,N,S)||N==="is"&&me.allowCustomizedBuiltInElements&&qi(me.tagNameCheck,H)},Y0=ve({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ep=function(S){return!Y0[Dr(S)]&&Tt(Ge,S)},I0=function(S,N,H,W){if(O&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!H)switch(f.getAttributeType(S,N)){case"TrustedHTML":return A(W);case"TrustedScriptURL":return C(W)}return W},X0=function(S,N,H,W){try{H?S.setAttributeNS(H,N,W):S.setAttribute(N,W),Hi(S)?La(S):Bm(t.removed)}catch{Sl(N,S)}},tp=function(S){Kn(w.beforeSanitizeAttributes,S,null);const N=S.attributes;if(!N||Hi(S))return;oe=Jh(w.uponSanitizeAttribute,oe,Y,nn);const H={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:oe,forceKeepAttr:void 0};let W=N.length;const ee=et(S.nodeName);for(;W--;){const ie=N[W],Re=ie.name,Qe=ie.namespaceURI,Gt=ie.value,Yt=et(Re),lu=Gt;let Dt=Re==="value"?lu:Vw(lu);if(H.attrName=Yt,H.attrValue=Dt,H.keepAttr=!0,H.forceKeepAttr=void 0,Kn(w.uponSanitizeAttribute,S,H),Dt=H.attrValue,$i&&(Yt==="id"||Yt==="name")&&Hm(Dt,ur)!==0&&(Sl(Re,S,ie),Dt=ur+Dt),Zt&&Tt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Dt)){Sl(Re,S,ie);continue}if(Yt==="attributename"&&Zm(Dt,"href")){Sl(Re,S,ie);continue}if(!H.forceKeepAttr){if(!H.keepAttr){Sl(Re,S,ie);continue}if(!Li&&Tt(fj,Dt)){Sl(Re,S,ie);continue}if(Qn&&(Dt=Zi(Dt)),!Ph(ee,Yt,Dt)){Sl(Re,S,ie);continue}Dt=I0(ee,Yt,Qe,Dt),Dt!==lu&&X0(S,Re,Qe,Dt)}}Kn(w.afterSanitizeAttributes,S,null)},Gi=function(S){let N=null;const H=Kh(S);for(Kn(w.beforeSanitizeShadowDOM,S,null);N=H.nextNode();)if(Kn(w.uponSanitizeShadowNode,N,null),Fh(N,S),tp(N),es(N.content)&&Gi(N.content),E(N)===ln.element){const W=x(N);es(W)&&(au(W),Gi(W))}Kn(w.afterSanitizeShadowDOM,S,null)},au=function(S){const N=[{node:S,shadow:null}];for(;N.length>0;){const H=N.pop();if(H.shadow){Gi(H.shadow);continue}const W=H.node,ie=E(W)===ln.element,Re=k(W);if(Re)for(let Qe=Re.length-1;Qe>=0;--Qe)N.push({node:Re[Qe],shadow:null});if(ie){const Qe=T?T(W):null;if(typeof Qe=="string"&&et(Qe)==="template"){const Gt=W.content;es(Gt)&&N.push({node:Gt,shadow:null})}}if(ie){const Qe=x(W);es(Qe)&&N.push({node:null,shadow:Qe},{node:Qe,shadow:null})}}};return t.sanitize=function(I){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},N=null,H=null,W=null,ee=null;if(qt=!I,qt&&(I="<!-->"),typeof I!="string"&&!pr(I)&&(I=Fw(I),typeof I!="string"))throw jl("dirty is not a string, aborting");if(!t.isSupported)return I;sa?(fe=yl,oe=nn):tu(S),(w.uponSanitizeElement.length>0||w.uponSanitizeAttribute.length>0)&&(fe=sn(fe)),w.uponSanitizeAttribute.length>0&&(oe=sn(oe)),t.removed=[];const ie=fr&&typeof I!="string"&&pr(I);if(ie){H0(I);const Gt=D(I);if(typeof Gt=="string"){const Yt=et(Gt);if(!fe[Yt]||yt[Yt])throw Ui(I),jl("root node is forbidden and cannot be sanitized in-place")}if(Hi(I))throw Ui(I),jl("root node is clobbered and cannot be sanitized in-place");try{au(I)}catch(Yt){throw Ui(I),Yt}}else if(pr(I))N=Qh("<!---->"),H=N.ownerDocument.importNode(I,!0),H.nodeType===ln.element&&H.nodeName==="BODY"||H.nodeName==="HTML"?N=H:N.appendChild(H),au(H);else{if(!Ca&&!Qn&&!Ht&&I.indexOf("<")===-1)return O&&Oa?A(I):I;if(N=Qh(I),!N)return Ca?null:Oa?R:""}N&&Wl&&La(N.firstChild);const Re=ie?I:N;try{const Gt=Kh(Re);for(;W=Gt.nextNode();)Fh(W,Re),tp(W),es(W.content)&&Gi(W.content)}catch(Gt){throw ie&&(Ui(I),Al(t.removed,Yt=>{Yt.element&&Bi(Yt.element)})),Gt}if(ie)return Al(t.removed,Gt=>{Gt.element&&Bi(Gt.element)}),Qn&&nu(I),I;if(Ca){if(Qn&&nu(N),Fl)for(ee=Se.call(N.ownerDocument);N.firstChild;)ee.appendChild(N.firstChild);else ee=N;return(oe.shadowroot||oe.shadowrootmode)&&(ee=B.call(a,ee,!0)),ee}let Qe=Ht?N.outerHTML:N.innerHTML;return Ht&&fe["!doctype"]&&N.ownerDocument&&N.ownerDocument.doctype&&N.ownerDocument.doctype.name&&Tt(cj,N.ownerDocument.doctype.name)&&(Qe="<!DOCTYPE "+N.ownerDocument.doctype.name+`>
|
|
114
|
+
`+Qe),Qn&&(Qe=Zi(Qe)),O&&Oa?A(Qe):Qe},t.setConfig=function(){let I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tu(I),sa=!0,yl=fe,nn=oe},t.clearConfig=function(){Pl=null,sa=!1,yl=null,nn=null,O=X,R=""},t.isValidAttribute=function(I,S,N){Pl||tu({});const H=et(I),W=et(S);return Ph(H,W,N)},t.addHook=function(I,S){typeof S=="function"&&Qt(w,I)&&jr(w[I],S)},t.removeHook=function(I,S){if(Qt(w,I)){if(S!==void 0){const N=Iw(w[I],S);return N===-1?void 0:Xw(w[I],N,1)[0]}return Bm(w[I])}},t.removeHooks=function(I){Qt(w,I)&&(w[I]=[])},t.removeAllHooks=function(){w=Wm()},t}var xj=yv();function jh(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m${t%60}s`}function un(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(1)}M`}function Un(e){return new Date(e).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function yj(e,t){const n=Math.max(0,Math.floor((t-e)/1e3));if(n<3)return"now";if(n<60)return`${n}s ago`;const a=Math.floor(n/60);if(a<60)return`${a}m ago`;const l=Math.floor(a/60);return l<24?`${l}h ago`:`${Math.floor(l/24)}d ago`}function bv(e){if(!e||Object.keys(e).length===0)return"";const t=Object.entries(e);if(t.length===1){const n=t[0];if(!n)return"";const a=n[0],l=n[1],s=typeof l=="object"?JSON.stringify(l,null,2):String(l);return`${a}: ${s}`}return t.map(([n,a])=>{const l=typeof a=="object"?JSON.stringify(a,null,2):String(a);return`${n}: ${l}`}).join(`
|
|
115
|
+
`)}function vv(e,t){if(!t)return"";if(e==="Bash")return String(t.command||"").slice(0,80);const n=t.file_path||t.path||"";return n?String(n):Object.entries(t).map(([a,l])=>`${a}: ${String(l).slice(0,60)}`).join(", ")}function bj({report:e,fallbackTokens:t,windowTokens:n}){const a=(e==null?void 0:e.usedTokens)??t,l=(e==null?void 0:e.windowTokens)||n,s=Math.max(1,l-((e==null?void 0:e.reservedOutput)??0)),r=Math.min(100,Math.round(a/s*100)),o=r>=85?"var(--red)":r>=50?"var(--yellow)":"var(--green)";return i.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[10px] text-muted font-mono",title:`Context: ${un(a)} of ${un(s)} usable (${un(l)} window)`,children:[i.jsx("span",{style:{opacity:.6},children:"ctx"}),i.jsx("span",{className:"inline-block rounded-full overflow-hidden",style:{width:36,height:4,background:"var(--s3)"},children:i.jsx("span",{className:"block h-full rounded-full",style:{width:`${String(r)}%`,background:o}})}),i.jsx("span",{style:{color:o,opacity:.85},children:`${String(r)}%`}),i.jsx("span",{style:{opacity:.5},children:`${un(a)}/${un(l)}`})]})}function vj({onSend:e,onCancel:t,cmdInput:n,onClearCmdInput:a,totalTokens:l,contextTokens:s,costUsd:r,contextReport:o}){var b;const{providers:c,get:u}=hh(),d=u("current_provider"),f=u("model"),h=Number(((b=c.find(y=>y.name===d))==null?void 0:b.model_context_window)??2e5),p=c.find(y=>y.name===d&&y.configured)||c.find(y=>y.configured)||{name:"none"},[v,j]=m.useState(""),k=m.useRef(null);m.useEffect(()=>{n&&(j(n),setTimeout(()=>{k.current&&(k.current.focus(),k.current.selectionStart=k.current.selectionEnd=n.length)},50),a==null||a())},[n,a]);const g=m.useCallback(()=>{const y=k.current;y&&(y.style.height="",y.style.height=Math.min(y.scrollHeight,160)+"px")},[]),x=m.useCallback(y=>{if(y.key==="Enter"&&!y.shiftKey){y.preventDefault();const T=v.trim();if(!T)return;e(T),j(""),setTimeout(()=>{k.current&&(k.current.style.height="")},0)}},[v,e]);return i.jsx("div",{className:"px-5 pt-3 pb-7 md:pb-3 bg-transparent",children:i.jsxs("div",{className:"glass-card rounded-xl transition-all duration-200",style:{background:"linear-gradient(135deg, var(--s2) 0%, color-mix(in srgb, var(--s1) 90%, var(--wood)) 100%)",border:"1px solid var(--b2)"},children:[i.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-[10.5px]",children:[i.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0",style:{background:d?"var(--green)":"var(--muted2)",opacity:d?1:.3}}),i.jsx("span",{style:{color:"var(--gold)",opacity:.8},children:p.name}),i.jsx("span",{className:"text-muted",children:" · "}),i.jsx("span",{className:"text-muted",children:f||"no model set"})]}),i.jsx("textarea",{ref:k,className:"w-full bg-transparent border-0 outline-none text-fg font-sans text-[13.5px] px-3.5 py-2.5 resize-none leading-[1.5]",style:{color:"var(--cream)"},rows:1,placeholder:"Message curie-agent...",value:v,onChange:y=>{j(y.target.value),g()},onKeyDown:x}),i.jsxs("div",{className:"flex items-center px-3 pb-2.5 pt-1",children:[l!==void 0?i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"text-[10px] text-muted font-mono",style:{opacity:.6},children:[un(l)," tokens"]}),i.jsx("span",{className:"opacity-30 mx-1",children:" · "}),i.jsx(bj,{report:o,fallbackTokens:s??0,windowTokens:h}),i.jsx("span",{className:"opacity-30 mx-1",children:" · "}),i.jsxs("span",{className:"text-[10px] text-muted font-mono",style:{color:"var(--green)",opacity:.6},children:["$",(r??0).toFixed(4)]}),i.jsx("div",{className:"flex-1"})]}):null,t?i.jsx("button",{className:"w-8 h-8 flex items-center justify-center cursor-pointer transition-all duration-200 hover:scale-105 active:scale-95 rounded-lg",style:{background:"var(--red)",color:"#fff"},onClick:t,title:"Stop agent",children:i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.5"})})}):i.jsx("button",{className:"btn-gold rounded-lg w-8 h-8 flex items-center justify-center cursor-pointer transition-all duration-200 hover:scale-105 active:scale-95",onClick:()=>{const y=v.trim();y&&(e(y),j(""))},children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#1a1410",strokeWidth:"2.5",children:[i.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),i.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]})})}const Sj=["line","area","bar","stacked-bar","scatter"];function wj(e){if(!e||typeof e!="object")return!1;const t=e;if(typeof t.type!="string"||!Sj.includes(t.type)||typeof t.title!="string"||t.title.length===0||t.normalize!==void 0&&typeof t.normalize!="boolean"||!Array.isArray(t.series)||t.series.length===0)return!1;for(const n of t.series){if(!n||typeof n!="object")return!1;const a=n;if(typeof a.name!="string"||!Array.isArray(a.points)||a.points.length===0)return!1;for(const l of a.points){if(!l||typeof l!="object")return!1;const s=l;if(typeof s.x!="string"&&typeof s.x!="number"||typeof s.y!="number"||!Number.isFinite(s.y))return!1}}return!0}const Fm=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)","var(--chart-6)","var(--chart-7)","var(--chart-8)"];function Jt(e){return Fm[e%Fm.length]}function jj({spec:e,renderChart:t,renderTable:n,height:a=220}){const l=m.useRef(null),[s,r]=m.useState(0),[o,c]=m.useState(!1);m.useEffect(()=>{const d=l.current;if(!d)return;const f=new ResizeObserver(h=>{var v;const p=(v=h[0])==null?void 0:v.contentRect.width;p&&r(Math.max(240,Math.floor(p)))});return f.observe(d),()=>f.disconnect()},[]);const u=e.series.length>1;return i.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:i.jsxs("div",{className:"rounded-xl p-4 select-none",style:{background:"linear-gradient(135deg, var(--s2) 0%, var(--s1) 100%)",border:"1px solid var(--b1)",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},children:[i.jsxs("div",{className:"flex items-start justify-between gap-3 mb-1.5",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[13px] font-display font-semibold truncate",style:{color:"var(--chart-ink)"},children:e.title}),e.subtitle&&i.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--chart-ink-muted)"},children:e.subtitle})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.normalize&&i.jsx("span",{className:"text-[10px] font-mono px-2 py-1 rounded-[4px]",style:{background:"var(--s3)",border:"1px solid var(--b1)",color:"var(--chart-ink-muted)"},title:"Each series is rebased to 100 at its first point, so differently-scaled series can be compared on one shared axis.",children:"Indexed"}),i.jsx("button",{onClick:()=>c(d=>!d),className:"text-[10px] font-mono px-2 py-1 rounded-[4px] cursor-pointer transition-colors",style:{background:"var(--s3)",border:"1px solid var(--b1)",color:"var(--chart-ink-muted)"},children:o?"Chart":"Table"})]})]}),u&&i.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1 mb-2",children:e.series.map((d,f)=>i.jsxs("div",{className:"flex items-center gap-1.5 text-[10.5px]",style:{color:"var(--chart-ink-muted)"},children:[i.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full shrink-0",style:{background:Jt(f)}}),d.name]},d.name))}),i.jsx("div",{ref:l,className:"w-full",style:{minHeight:a},children:o?n():s>0?t(s,a):null}),e.note&&i.jsx("div",{className:"mt-2 text-[10.5px] italic",style:{color:"var(--chart-ink-muted)"},children:e.note})]})})}function kj(e,t,n=.3){const[a,l]=t,s=l-a,r=e>0?s/e:s,o=Math.max(1,r*(1-n));return{step:r,bandWidth:o,center:c=>a+r*c+r/2,start:c=>a+r*c+(r-o)/2}}function Pm(e,t){const n=e||1,a=Math.floor(Math.log10(n)),l=n/Math.pow(10,a);let s;return t?l<1.5?s=1:l<3?s=2:l<7?s=5:s=10:l<=1?s=1:l<=2?s=2:l<=5?s=5:s=10,s*Math.pow(10,a)}function mc(e,t,n=5){let a=e,l=t;if(a===l){const d=Math.abs(a)*.1||1;a-=d,l+=d}const s=Pm(l-a,!1),r=Pm(s/Math.max(1,n-1),!0),o=Math.floor(a/r)*r,c=Math.ceil(l/r)*r,u=[];for(let d=o;d<=c+r*.5;d+=r)u.push(Math.round(d*1e10)/1e10);return u}function _j(e){var a;if(e.length===0)return 1;const t=Math.max(...e.map(l=>l.points.length));let n=0;for(let l=0;l<t;l++){let s=0;for(const r of e)s+=((a=r.points[l])==null?void 0:a.y)??0;s>n&&(n=s)}return n||1}function Nj(e){return e.map(t=>{var a;const n=(a=t.points[0])==null?void 0:a.y;return n?{...t,points:t.points.map(l=>({x:l.x,y:l.y/n*100}))}:t})}function Sv(e){const t=Math.abs(e);return t<1e3?Number.isInteger(e)?String(e):e.toFixed(2):t<1e6?`${(e/1e3).toFixed(1)}k`:t<1e9?`${(e/1e6).toFixed(2)}M`:`${(e/1e9).toFixed(2)}B`}function Tj(e){return Math.abs(e)>=1e3?`$${Sv(e)}`:`$${e.toLocaleString(void 0,{maximumFractionDigits:2})}`}function Ej(e){const t=["B","KB","MB","GB","TB"];let n=Math.abs(e),a=0;for(;n>=1024&&a<t.length-1;)n/=1024,a++;return`${e<0?"-":""}${n.toFixed(n<10&&a>0?1:0)} ${t[a]}`}function Sa(e,t){switch(t){case"compact":return Sv(e);case"currency":return Tj(e);case"percent":return`${(e*100).toFixed(1)}%`;case"bytes":return Ej(e);case"number":default:return e.toLocaleString()}}function kh({data:e,chartWidth:t}){if(!e)return null;const n=e.x>t*.6;return i.jsxs("div",{className:"absolute pointer-events-none z-10 rounded-lg px-2.5 py-1.5 text-[10.5px] font-mono shadow-lg",style:{left:n?void 0:Math.max(0,e.x+10),right:n?Math.max(0,t-e.x+10):void 0,top:Math.max(0,e.y-10),background:"var(--s3)",border:"1px solid var(--b1)",color:"var(--chart-ink)",minWidth:96,whiteSpace:"nowrap"},children:[i.jsx("div",{className:"font-semibold mb-1",style:{color:"var(--chart-ink-muted)"},children:e.label}),e.rows.map((a,l)=>i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"inline-block w-2 h-2 rounded-full shrink-0",style:{background:a.color}}),i.jsxs("span",{children:[a.name,":"]}),i.jsx("span",{className:"font-semibold ml-auto pl-2",style:{color:"var(--chart-ink)"},children:a.value})]},l))]})}function Aj({spec:e,width:t,height:n}){var P;const[a,l]=m.useState(null),s=e.type==="area",r=44,o=12,c=12,u=24,d=Math.max(10,t-r-o),f=Math.max(10,n-c-u),h=e.normalize?Nj(e.series):e.series,p=((P=h[0])==null?void 0:P.points)??[],v=p.length,j=h.flatMap(z=>z.points.map(A=>A.y)),k=mc(Math.min(0,...j),Math.max(...j,1),5),g=k[0],b=k[k.length-1]-g||1,y=z=>v>1?r+z/(v-1)*d:r+d/2,T=z=>c+f-(z-g)/b*f,_=h.map(z=>z.points.map((A,C)=>`${C===0?"M":"L"} ${y(C)} ${T(A.y)}`).join(" ")),E=s?h.map((z,A)=>{const C=_[A],M=y(z.points.length-1),V=y(0);return`${C} L ${M} ${c+f} L ${V} ${c+f} Z`}):[],D=e.series.length>1&&e.series.length<=4,O=z=>{const A=z.currentTarget.getBoundingClientRect(),C=z.clientX-A.left,M=v>1?Math.round((C-r)/d*(v-1)):0;l(Math.min(v-1,Math.max(0,M)))},R=a!==null&&p[a]?{x:y(a),y:T(Math.max(...h.map(z=>{var A;return((A=z.points[a])==null?void 0:A.y)??g}))),label:String(p[a].x),rows:e.series.map((z,A)=>{var V,J,ne;const C=(V=z.points[a])==null?void 0:V.y;if(C===void 0)return{name:z.name,value:"—",color:Jt(A)};if(!e.normalize)return{name:z.name,value:Sa(C,e.y_format),color:Jt(A)};const M=((ne=(J=h[A])==null?void 0:J.points[a])==null?void 0:ne.y)??0;return{name:z.name,value:`${Sa(C,e.y_format)} (${M.toFixed(1)})`,color:Jt(A)}})}:null,X=Math.floor((v-1)/2),K=v>0?Array.from(new Set([0,X,v-1])):[];return i.jsxs("div",{className:"relative",style:{width:"100%",height:n},children:[i.jsxs("svg",{width:t,height:n,className:"overflow-visible",children:[i.jsx("defs",{children:e.series.map((z,A)=>i.jsxs("linearGradient",{id:`chart-grad-${A}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[i.jsx("stop",{offset:"0%",stopColor:Jt(A),stopOpacity:"0.22"}),i.jsx("stop",{offset:"100%",stopColor:Jt(A),stopOpacity:"0"})]},A))}),k.map((z,A)=>{const C=T(z);return i.jsxs("g",{children:[i.jsx("line",{x1:r,y1:C,x2:t-o,y2:C,stroke:"var(--chart-grid)",strokeWidth:"1"}),i.jsx("text",{x:r-8,y:C+3.5,textAnchor:"end",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace"},children:e.normalize?z.toFixed(0):Sa(z,e.y_format)})]},A)}),i.jsx("line",{x1:r,y1:c+f,x2:t-o,y2:c+f,stroke:"var(--chart-axis)",strokeWidth:"1"}),K.map(z=>{var A;return i.jsx("text",{x:y(z),y:n-6,textAnchor:z===0?"start":z===v-1?"end":"middle",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace",opacity:.7},children:String(((A=p[z])==null?void 0:A.x)??"")},z)}),s&&E.map((z,A)=>i.jsx("path",{d:z,fill:`url(#chart-grad-${A})`},`area-${A}`)),_.map((z,A)=>i.jsx("path",{d:z,fill:"none",stroke:Jt(A),strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},`line-${A}`)),h.map((z,A)=>{const C=z.points[z.points.length-1];if(!C)return null;const M=y(z.points.length-1),V=T(C.y),J=Math.min(M+6,t-o-4),ne=J>t-o-34;return i.jsxs("g",{children:[i.jsx("circle",{cx:M,cy:V,r:"3",fill:Jt(A),stroke:"var(--s1)",strokeWidth:"1.5"}),D&&i.jsx("text",{x:ne?t-o:J,y:V+3,textAnchor:ne?"end":"start",style:{fill:"var(--chart-ink)",fontSize:9.5,fontWeight:600,fontFamily:"inherit"},children:z.name})]},`endpoint-${A}`)}),R&&i.jsx("line",{x1:R.x,y1:c,x2:R.x,y2:c+f,stroke:"var(--chart-axis)",strokeWidth:"1",strokeOpacity:"0.6"}),i.jsx("rect",{x:r,y:c,width:d,height:f,fill:"transparent",onMouseMove:O,onMouseLeave:()=>l(null),style:{cursor:"crosshair"}})]}),i.jsx(kh,{data:R,chartWidth:t})]})}function zj({spec:e,width:t,height:n}){var D;const[a,l]=m.useState(null),s=e.type==="stacked-bar",r=44,o=12,c=12,u=24,d=Math.max(10,t-r-o),f=Math.max(10,n-c-u),h=((D=e.series[0])==null?void 0:D.points)??[],p=h.length,v=s?_j(e.series):Math.max(...e.series.flatMap(O=>O.points.map(R=>R.y)),1),j=mc(0,v,5),k=j[j.length-1],g=O=>c+f-O/(k||1)*f,x=kj(p,[r,r+d],.3),b=2,y=e.series.length,T=s?x.bandWidth:Math.max(2,(x.bandWidth-b*(y-1))/y),_=a!==null&&h[a]?{x:x.center(a),y:c,label:String(h[a].x),rows:e.series.map((O,R)=>{var X;return{name:O.name,value:Sa(((X=O.points[a])==null?void 0:X.y)??0,e.y_format),color:Jt(R)}})}:null,E=Math.floor((p-1)/2);return i.jsxs("div",{className:"relative",style:{width:"100%",height:n},children:[i.jsxs("svg",{width:t,height:n,className:"overflow-visible",children:[j.map((O,R)=>{const X=g(O);return i.jsxs("g",{children:[i.jsx("line",{x1:r,y1:X,x2:t-o,y2:X,stroke:"var(--chart-grid)",strokeWidth:"1"}),i.jsx("text",{x:r-8,y:X+3.5,textAnchor:"end",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace"},children:Sa(O,e.y_format)})]},R)}),i.jsx("line",{x1:r,y1:c+f,x2:t-o,y2:c+f,stroke:"var(--chart-axis)",strokeWidth:"1"}),h.map((O,R)=>p<=1||R===0||R===p-1||R===E?i.jsx("text",{x:x.center(R),y:n-6,textAnchor:"middle",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace",opacity:.7},children:String(O.x)},`label-${R}`):null),h.map((O,R)=>{const X=x.start(R);let K=c+f;return i.jsxs("g",{onMouseEnter:()=>l(R),onMouseLeave:()=>l(null),children:[i.jsx("rect",{x:x.center(R)-x.step/2,y:c,width:x.step,height:f,fill:"transparent"}),e.series.map((P,z)=>{var J;const A=((J=P.points[R])==null?void 0:J.y)??0;if(A<=0)return null;const C=A/(k||1)*f;let M,V;return s?(M=X,V=K-C-(z>0?b:0),K=V):(M=X+z*(T+b),V=c+f-C),i.jsx("rect",{x:M,y:V,width:T,height:C,rx:"2",fill:Jt(z)},z)})]},`group-${R}`)}),_&&i.jsx("line",{x1:_.x,y1:c,x2:_.x,y2:c+f,stroke:"var(--chart-axis)",strokeWidth:"1",strokeOpacity:"0.4"})]}),i.jsx(kh,{data:_,chartWidth:t})]})}function Qu(e,t){if(typeof e=="number")return e;const n=Number(e);return Number.isFinite(n)?n:t}function Cj({spec:e,width:t,height:n}){var E,D;const[a,l]=m.useState(null),s=48,r=16,o=14,c=26,u=Math.max(10,t-s-r),d=Math.max(10,n-o-c),f=e.series.flatMap(O=>O.points.map((R,X)=>Qu(R.x,X))),h=e.series.flatMap(O=>O.points.map(R=>R.y)),p=mc(Math.min(...f),Math.max(...f),4),v=mc(Math.min(0,...h),Math.max(...h,1),5),j=p[0],k=p[p.length-1],g=v[0],x=v[v.length-1],b=O=>s+(O-j)/(k-j||1)*u,y=O=>o+d-(O-g)/(x-g||1)*d,T=a?(E=e.series[a.si])==null?void 0:E.points[a.pi]:void 0,_=a&&T?{x:b(Qu(T.x,a.pi)),y:y(T.y),label:((D=e.series[a.si])==null?void 0:D.name)??"",rows:[{name:e.x_label||"x",value:String(T.x),color:Jt(a.si)},{name:e.y_label||"y",value:Sa(T.y,e.y_format),color:Jt(a.si)}]}:null;return i.jsxs("div",{className:"relative",style:{width:"100%",height:n},children:[i.jsxs("svg",{width:t,height:n,className:"overflow-visible",children:[v.map((O,R)=>{const X=y(O);return i.jsxs("g",{children:[i.jsx("line",{x1:s,y1:X,x2:t-r,y2:X,stroke:"var(--chart-grid)",strokeWidth:"1"}),i.jsx("text",{x:s-8,y:X+3.5,textAnchor:"end",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace"},children:Sa(O,e.y_format)})]},`y-${R}`)}),p.map((O,R)=>i.jsx("text",{x:b(O),y:n-6,textAnchor:"middle",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace",opacity:.7},children:Sa(O)},`x-${R}`)),i.jsx("line",{x1:s,y1:o+d,x2:t-r,y2:o+d,stroke:"var(--chart-axis)",strokeWidth:"1"}),i.jsx("line",{x1:s,y1:o,x2:s,y2:o+d,stroke:"var(--chart-axis)",strokeWidth:"1"}),e.series.map((O,R)=>O.points.map((X,K)=>{const P=b(Qu(X.x,K)),z=y(X.y);return i.jsxs("g",{children:[i.jsx("circle",{cx:P,cy:z,r:"12",fill:"transparent",onMouseEnter:()=>l({si:R,pi:K}),onMouseLeave:()=>l(null),style:{cursor:"pointer"}}),i.jsx("circle",{cx:P,cy:z,r:"4",fill:Jt(R),stroke:"var(--s1)",strokeWidth:"1.5"})]},`${R}-${K}`)})),_&&a&&i.jsx("circle",{cx:_.x,cy:_.y,r:"7",fill:"none",stroke:Jt(a.si),strokeWidth:"1.5"})]}),i.jsx(kh,{data:_,chartWidth:t})]})}function Oj({spec:e}){var n;const t=((n=e.series[0])==null?void 0:n.points.map(a=>a.x))??[];return i.jsxs("div",{children:[i.jsx("div",{className:"overflow-x-auto overflow-y-auto max-h-[260px] scrollbar-thin",children:i.jsxs("table",{className:"w-full text-[11.5px] font-mono",children:[i.jsx("thead",{children:i.jsxs("tr",{style:{borderBottom:"1px solid var(--b1)"},children:[i.jsx("th",{className:"text-left py-1.5 pr-3 font-medium",style:{color:"var(--chart-ink-muted)"},children:e.x_label||"x"}),e.series.map(a=>i.jsx("th",{className:"text-right py-1.5 pl-3 font-medium",style:{color:"var(--chart-ink-muted)"},children:a.name},a.name))]})}),i.jsx("tbody",{children:t.map((a,l)=>i.jsxs("tr",{style:{borderBottom:"1px solid color-mix(in srgb, var(--b1) 40%, transparent)"},children:[i.jsx("td",{className:"py-1 pr-3",style:{color:"var(--chart-ink)",fontVariantNumeric:"tabular-nums"},children:String(a)}),e.series.map(s=>{var r;return i.jsx("td",{className:"text-right py-1 pl-3",style:{color:"var(--chart-ink)",fontVariantNumeric:"tabular-nums"},children:Sa(((r=s.points[l])==null?void 0:r.y)??0,e.y_format)},s.name)})]},l))})]})}),e.normalize&&i.jsx("div",{className:"mt-2 text-[10.5px] italic",style:{color:"var(--chart-ink-muted)"},children:"Chart is indexed to 100 at the first point; this table shows raw values."})]})}function Dj(){return i.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:i.jsxs("div",{className:"rounded-xl p-4 flex items-center gap-2",style:{background:"var(--s2)",border:"1px solid var(--b1)"},children:[i.jsx("div",{className:"w-[6px] h-[6px] rounded-full shrink-0 animate-pulse",style:{background:"var(--muted)"}}),i.jsx("div",{className:"text-[11.5px]",style:{color:"var(--muted)"},children:"Rendering chart…"})]})})}function eg({message:e,raw:t}){return i.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:i.jsxs("div",{className:"rounded-xl p-4",style:{background:"color-mix(in srgb, var(--red) 6%, var(--s2))",border:"1px solid color-mix(in srgb, var(--red) 25%, var(--b1))"},children:[i.jsx("div",{className:"text-[12px] font-semibold mb-1.5",style:{color:"var(--red)"},children:"Chart could not be rendered"}),i.jsx("div",{className:"text-[11.5px] mb-2",style:{color:"var(--text)"},children:e}),i.jsx("pre",{className:"text-[10.5px] font-mono overflow-x-auto whitespace-pre-wrap",style:{color:"var(--muted)"},children:typeof t=="string"?t:JSON.stringify(t,null,2)})]})})}function Mj({spec:e}){const t=(n,a)=>{switch(e.type){case"line":case"area":return i.jsx(Aj,{spec:e,width:n,height:a});case"bar":case"stacked-bar":return i.jsx(zj,{spec:e,width:n,height:a});case"scatter":return i.jsx(Cj,{spec:e,width:n,height:a});default:return null}};return i.jsx(jj,{spec:e,renderChart:t,renderTable:()=>i.jsx(Oj,{spec:e})})}function Rj({spec:e,error:t,pending:n,rawInput:a}){return t?i.jsx(eg,{message:t,raw:a??e}):n?i.jsx(Dj,{}):wj(e)?i.jsx(Mj,{spec:e}):i.jsx(eg,{message:"The chart data did not match the expected format.",raw:a??e})}const tg=["what are we discovering today?","greetings from the lab!","lab coat is on ... ","the system is radioactive","what is our next experiment?","atomic levels are stable!","what is our next reaction?","geiger counter is ticking...","mobile X-ray unit deployed","nobel-tier assist activated","emitting helpful isotopes","cathode rays engaged"];function ng(){return tg[Math.floor(Math.random()*tg.length)]}function wv({content:e}){const[t,n]=m.useState(!0);return i.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:i.jsxs("div",{className:"rounded-lg overflow-hidden cursor-pointer select-none transition-all duration-150",style:{background:"linear-gradient(135deg, var(--s2) 0%, var(--s1) 100%)",border:"1px solid var(--b1)",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},onClick:()=>n(!t),children:[i.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{background:"color-mix(in srgb, var(--s2) 80%, transparent)"},children:[i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",className:"shrink-0",style:{opacity:.7},children:[i.jsx("path",{d:"M12 2a7 7 0 0 0-7 7c0 3 2 5 2 8h10c0-3 2-5 2-8a7 7 0 0 0-7-7z"}),i.jsx("circle",{cx:"9",cy:"9",r:"1",fill:"currentColor"}),i.jsx("circle",{cx:"15",cy:"9",r:"1",fill:"currentColor"})]}),i.jsx("span",{className:"text-[11.5px] font-medium text-text font-mono",children:t?"Hide thinking":"Show thinking"}),i.jsx("div",{className:"flex-1"}),i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`text-muted transition-transform duration-200 ${t?"rotate-180":""}`,children:i.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),t&&i.jsx("div",{className:"px-3 py-2.5",style:{borderTop:"1px solid var(--b1)",background:"color-mix(in srgb, var(--s1) 60%, transparent)"},children:i.jsx("pre",{className:"text-[11px] text-muted leading-relaxed whitespace-pre-wrap font-mono max-h-[300px] overflow-y-auto",children:e})})]})})}function ag(e){return e>=1e6?`${(e/1e6).toFixed(1)}m`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e))}function Lj({entry:e}){const[t,n]=m.useState(!1);return i.jsxs("div",{className:"px-3 py-2 animate-fadeIn",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"flex-1 h-px",style:{background:"var(--b1)"}}),i.jsxs("button",{onClick:()=>n(!t),className:"text-[11px] font-mono px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--muted)",background:"var(--s2)",border:"1px solid var(--b1)"},title:"Everything above is preserved on disk; only the model's working history was summarized.",children:[`context compacted · ${String(e.summarizedMessageCount)} message${e.summarizedMessageCount===1?"":"s"} · ${ag(e.tokensBefore)} → ${ag(e.tokensAfter)} tokens`,i.jsx("span",{className:"ml-1.5",style:{opacity:.6},children:t?"▾":"▸"})]}),i.jsx("div",{className:"flex-1 h-px",style:{background:"var(--b1)"}})]}),t&&i.jsx("div",{className:"mt-2 text-[12px] leading-[1.6] rounded-lg px-3 py-2 markdown-body",style:{background:"var(--s1)",border:"1px solid var(--b1)"},dangerouslySetInnerHTML:{__html:Cs(e.summary)}})]})}function jv({toolCalls:e}){const[t,n]=m.useState(!1);return i.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:i.jsxs("div",{className:"rounded-lg overflow-hidden mb-1",style:{background:"linear-gradient(135deg, var(--s2) 0%, var(--s1) 100%)",border:"1px solid var(--b1)",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},children:[i.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer select-none transition-all duration-150",style:{background:"color-mix(in srgb, var(--s2) 80%, transparent)"},onClick:()=>n(!t),children:[i.jsx("div",{className:"w-[14px] h-[14px] rounded-[3px] flex items-center justify-center",style:{background:"color-mix(in srgb, var(--gold) 15%, var(--s3))"},children:i.jsxs("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",style:{opacity:.7},children:[i.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),i.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),i.jsxs("span",{className:"text-[11.5px] font-medium text-text font-mono",children:[e.length," tool call",e.length>1?"s":""]}),i.jsx("div",{className:"flex-1"}),i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`text-muted transition-transform duration-200 ${t?"rotate-180":""}`,children:i.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),t&&e.map((a,l)=>i.jsxs("div",{className:"px-3 py-2.5 first:border-t-0",style:{borderTop:"1px solid var(--b1)",background:"color-mix(in srgb, var(--s1) 60%, transparent)"},children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("span",{className:"text-[11.5px] font-semibold font-mono",style:{color:"var(--gold)"},children:a.name}),i.jsx("span",{className:"text-xs text-muted font-mono truncate max-w-[250px]",children:a.args})]}),i.jsx("pre",{className:"text-[11px] text-muted font-mono leading-[1.5] overflow-x-auto whitespace-pre-wrap",children:a.input?bv(a.input):""})]},l))]})})}function $j({event:e}){const[t,n]=m.useState(!1);return i.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:i.jsxs("div",{className:"rounded-lg overflow-hidden mb-1",style:{background:"linear-gradient(135deg, var(--s2) 0%, var(--s1) 100%)",border:"1px solid var(--b1)",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},children:[i.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer select-none transition-all duration-150",style:{background:"color-mix(in srgb, var(--s2) 80%, transparent)"},onClick:()=>n(!t),children:[i.jsx("div",{className:"w-[14px] h-[14px] rounded-[3px] flex items-center justify-center",style:{background:"color-mix(in srgb, var(--red) 15%, var(--s3))"},children:i.jsx("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"1.5",children:i.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})})}),i.jsxs("span",{className:"text-[11.5px] font-semibold text-fg font-mono",children:["Heartbeat Brief (",e.scheduleType,")"]}),i.jsx("div",{className:"flex-1"}),i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`text-muted transition-transform duration-200 ${t?"rotate-180":""}`,children:i.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),t&&i.jsx("div",{className:"px-3 py-3 markdown-body",style:{borderTop:"1px solid var(--b1)",background:"color-mix(in srgb, var(--s1) 60%, transparent)"},children:i.jsx("div",{dangerouslySetInnerHTML:{__html:Cs(e.formattedText||"")}})})]})})}function Uj({message:e,time:t}){return i.jsx("div",{className:"px-3 py-1.5 animate-fadeIn",children:i.jsxs("div",{className:"p-3.5 rounded-xl backdrop-blur-md shadow-lg max-w-[480px] flex gap-3 transition-all duration-200 relative overflow-hidden group",style:{background:"linear-gradient(135deg, color-mix(in srgb, var(--gold) 8%, var(--s2)), color-mix(in srgb, var(--gold) 4%, var(--s1)))",border:"1px solid color-mix(in srgb, var(--gold) 20%, var(--b1))"},children:[i.jsx("div",{className:"absolute top-0 right-0 w-24 h-24 rounded-full filter blur-xl opacity-30 group-hover:scale-125 transition-transform duration-500",style:{background:"var(--gold)"}}),i.jsxs("div",{className:"flex items-center justify-center w-8 h-8 rounded-lg shrink-0 relative",style:{background:"color-mix(in srgb, var(--gold) 15%, transparent)",color:"var(--gold)"},children:[i.jsx("span",{className:"absolute inset-0 rounded-lg animate-ping opacity-50",style:{background:"color-mix(in srgb, var(--gold) 20%, transparent)",animationDuration:"2s"}}),i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"animate-wiggle",children:[i.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),i.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]})]}),i.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1 select-none",children:[i.jsx("span",{className:"font-bold text-xs tracking-wide uppercase",style:{color:"var(--gold)"},children:"Reminder Fired"}),i.jsx("span",{className:"text-[10px] text-muted font-mono",children:t})]}),i.jsx("div",{className:"text-[13px] text-text leading-relaxed font-semibold",children:e})]})]})})}function Bj(e,t){const n=e.find(a=>a.type==="tool-result"&&a.toolCallId===t);if(n)return{output:n.output,error:n.error}}function Zj(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br>")}_e.setOptions({gfm:!0,breaks:!0});function Hj(e){return xj.sanitize(e,{ALLOWED_TAGS:["p","br","hr","span","div","h1","h2","h3","h4","h5","h6","strong","em","b","i","u","s","del","ins","mark","sub","sup","ul","ol","li","dl","dt","dd","blockquote","code","pre","kbd","samp","var","a","img","table","thead","tbody","tfoot","tr","th","td","caption","input"],ALLOWED_ATTR:["href","title","alt","src","class","lang","colspan","rowspan","start","type","checked","disabled"],ALLOWED_URI_REGEXP:/^(?:https?|mailto):/i,FORBID_ATTR:["style","srcset","formaction","form"]})}function Cs(e){try{return Hj(_e.parse(e))}catch{return Zj(e)}}function kv({toolCallId:e,name:t,input:n,decision:a,events:l,rpc:s,mode:r}){const[o,c]=m.useState(!1),[u,d]=m.useState(null),f=l.find(j=>j.type==="approval-decision"&&j.toolCallId===e),h=f?f.decision:u,p=a==="ask"&&!h,v=async j=>{if(s){c(!0);try{await s.approvalDecide(e,j),d(j)}catch(k){console.error("Failed to submit tool approval decision:",k)}finally{c(!1)}}};if(!p){const j=h==="allow";return i.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2.5 animate-fadeIn select-none",children:[i.jsx("div",{className:`flex items-center justify-center w-5 h-5 rounded-full ${j?"bg-green-500/10 text-green-500":"bg-red-500/10 text-red-500"} shrink-0`,children:i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:j?i.jsx("polyline",{points:"20 6 9 17 4 12"}):i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),i.jsxs("div",{className:"flex items-baseline gap-1.5 text-xs text-muted",children:[i.jsx("span",{className:"font-semibold text-fg",children:j?"Authorized":"Blocked"}),i.jsx("span",{children:"action:"}),i.jsx("code",{className:"font-mono bg-s3 border border-b1 px-1.5 py-0.5 rounded text-[11px] text-fg",children:t})]})]})}return r==="auto"?null:i.jsx("div",{className:"fixed inset-0 z-[999] flex items-center justify-center bg-black/60 backdrop-blur-sm p-4 animate-fadeIn",children:i.jsxs("div",{className:"w-full max-w-[480px] p-6 rounded-2xl border border-b2 bg-s2/95 backdrop-blur-md shadow-2xl transition-all duration-200 transform scale-100 animate-scaleIn",children:[i.jsxs("div",{className:"flex items-start gap-4 border-b border-b1 pb-4 mb-4",children:[i.jsx("div",{className:"flex items-center justify-center w-10 h-10 rounded-xl bg-yellow-500/10 text-yellow-500 shrink-0",children:i.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("span",{className:"font-bold text-fg text-base block mb-0.5",children:"Authorization Required"}),i.jsx("span",{className:"text-[12px] text-muted",children:"The agent requires permission to run this action."})]})]}),i.jsxs("div",{className:"mb-4",children:[i.jsx("div",{className:"text-[9px] text-muted2 font-mono uppercase tracking-wider mb-1.5 select-none",children:"Action / Tool"}),i.jsx("div",{className:"flex items-center",children:i.jsx("code",{className:"font-mono bg-s3 border border-b1 px-2.5 py-1 rounded-lg text-xs text-fg font-semibold",children:t})})]}),i.jsxs("div",{className:"bg-s1 rounded-xl border border-b1 p-4 mb-6 max-h-[220px] overflow-y-auto scrollbar-thin",children:[i.jsx("div",{className:"text-[9px] text-muted2 font-mono uppercase tracking-wider mb-1.5 select-none",children:"Arguments"}),i.jsx("pre",{className:"font-mono text-[11.5px] text-text overflow-x-auto m-0 leading-normal",children:bv(n)})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("button",{onClick:()=>v("allow"),disabled:o,className:"flex-1 py-2 px-4 rounded-xl bg-green-600 hover:bg-green-500 text-white font-semibold text-[13px] shadow-lg shadow-green-600/10 hover:shadow-green-600/20 transition-all duration-150 active:scale-[0.98] disabled:opacity-50 disabled:pointer-events-none cursor-pointer flex items-center justify-center gap-1.5",children:[i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:i.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Approve Action"]}),i.jsxs("button",{onClick:()=>v("deny"),disabled:o,className:"py-2 px-3 rounded-xl bg-s3 border border-b2 hover:bg-s4 text-fg hover:text-text hover:border-b3 font-semibold text-[13px] transition-all duration-150 active:scale-[0.98] disabled:opacity-50 disabled:pointer-events-none cursor-pointer flex items-center justify-center gap-1.5",children:[i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),"Deny"]})]})]})})}function qj({blocks:e,blockCount:t,response:n,time:a,events:l,rpc:s}){const[r,o]=m.useState(!1);return e&&e.length>0||!!n?i.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:i.jsxs("div",{className:"rounded-lg overflow-hidden cursor-pointer select-none transition-all duration-150",style:{background:"linear-gradient(135deg, var(--s2) 0%, var(--s1) 100%)",border:"1px solid var(--b1)",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},onClick:()=>o(!r),children:[i.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{background:"var(--bg)"},children:[i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",className:"shrink-0",style:{opacity:.7},children:[i.jsx("circle",{cx:"12",cy:"12",r:"2"}),i.jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4"}),i.jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",transform:"rotate(60 12 12)"}),i.jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",transform:"rotate(120 12 12)"})]}),i.jsxs("span",{className:"text-[11.5px] font-medium text-text font-mono",children:[t," agent action",t>1?"s":""]}),n&&i.jsxs("span",{className:"text-[10px] text-muted2 font-mono truncate max-w-[120px]",title:n,children:["“",n.slice(0,60),"...","”"]}),a&&i.jsx("span",{className:"text-[10px] text-muted2 font-mono",children:a}),i.jsx("div",{className:"flex-1"}),i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`text-muted transition-transform duration-200 ${r?"rotate-180":""}`,children:i.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),r&&i.jsxs("div",{className:"px-1 py-1",style:{borderTop:"1px solid var(--b1)",background:"var(--bg)"},onClick:u=>u.stopPropagation(),children:[e.map((u,d)=>{if(u.type==="thinking")return i.jsx(wv,{content:u.content},d);if(u.type==="tool-group"){const f=u;return f.toolCalls.length>0?i.jsx(jv,{toolCalls:f.toolCalls},d):null}return u.type==="approval-request"?i.jsx(kv,{toolCallId:u.toolCallId,name:u.name,input:u.input,decision:u.decision,events:l||[],rpc:s||null,mode:u.mode},d):null}),n&&i.jsxs("div",{className:"mt-3",children:[i.jsx("div",{className:"flex items-baseline gap-2 mb-1",children:i.jsx("span",{className:"text-[10px] font-semibold text-fg",style:{color:"var(--gold)"},children:"curie-agent"})}),i.jsx("div",{className:"text-[13px] text-text leading-[1.65] markdown-body chat-msg-agent pl-3",dangerouslySetInnerHTML:{__html:Cs(n)}})]})]})]})}):null}function Gj(e){switch(e.type){case"user-prompt":return{type:"user",content:e.text||"",time:Un(e.timestamp)};case"assistant-delta":return{type:"assistant",content:e.text||"",time:Un(e.timestamp)};case"thinking-delta":return{type:"thinking",content:e.text||"",time:Un(e.timestamp)};case"heartbeat-brief":return{type:"heartbeat-brief",content:e.formattedText||"",time:Un(e.timestamp),event:e};case"tool-call":{const t=e.name||"tool",n=e.input||{};if(t==="Chart")return{type:"chart",toolCallId:e.toolCallId||"",rawInput:n,time:Un(e.timestamp)};const a=vv(t,n);return{type:"tool-group",content:"",time:"",toolCalls:[{name:t,args:a,input:n}]}}case"approval-request":{const t=e.toolCallId,n=e.name||"tool";if(n==="Chart")return null;const a=e.input||{},l=e.decision,s=e.mode;return{type:"approval-request",toolCallId:t,name:n,input:a,decision:l,mode:s,time:Un(e.timestamp)}}case"cron-task-fired":{const t=e.message||"",n=e.taskId||"";return{type:"reminder-fired",message:t,taskId:n,time:Un(e.timestamp)}}case"context-warning":return{type:"context-warning",content:e.message||"",time:Un(e.timestamp)};case"compaction":return{type:"compaction",summary:e.summary||"",summarizedMessageCount:Number(e.summarizedMessageCount??0),tokensBefore:Number(e.tokensBefore??0),tokensAfter:Number(e.tokensAfter??0),time:Un(e.timestamp)};case"error":return{type:"error",content:e.message||`An error occurred (code: ${e.code||"unknown"})`,time:Un(e.timestamp)};default:return null}}function Yj(e){const t=[];let n=[],a="",l=!1,s="",r=null,o=0;const c=()=>{l&&s&&(n.push({type:"thinking",content:s,time:""}),l=!1,s="")},u=()=>{var h;if(n.length===0)return;let f=0;for(let p=o;p<n.length;p++){const v=n[p];v.type==="tool-group"?f+=((h=v.toolCalls)==null?void 0:h.length)||1:f+=1}r?(r.blocks=[...r.blocks,...n.slice(o)],r.blockCount+=f):(r={type:"agent-actions",blocks:[...n],blockCount:f,response:void 0,time:n[0].time||""},t.push(r)),o=n.length},d=()=>{c(),u(),a&&t.push({type:"assistant",content:a,time:""}),n=[],a="",r=null,o=0};for(const f of e){const h=Gj(f);if(h)if(h.type==="user"||h.type==="error"||h.type==="heartbeat-brief"||h.type==="reminder-fired")d(),t.push(h);else if(h.type==="assistant")a+=h.content;else if(h.type==="thinking")l=!0,s+=h.content||"";else if(h.type==="tool-group"){c();const p=h;n.length>0&&n[n.length-1].type==="tool-group"?n[n.length-1].toolCalls.push(...p.toolCalls||[]):n.push({type:"tool-group",content:"",time:h.time||"",toolCalls:p.toolCalls||[]}),u()}else h.type==="approval-request"?(c(),n.push({type:"approval-request",content:"",time:h.time||"",toolCallId:h.toolCallId||"",name:h.name||"tool",input:h.input||{},decision:h.decision||"ask",mode:h.mode}),u()):(d(),t.push(h))}return d(),t}function Ij({cmdResult:e,rpc:t,className:n,activeSessionId:a,onCreateSession:l,onClearCmdResult:s,events:r,addLiveEvent:o,totalTokens:c,contextTokens:u,costUsd:d,contextReport:f,onSwitchView:h}){const{ws:p,connected:v,connectionStatus:j}=Vn(),[k,g]=m.useState(!1),[x,b]=m.useState(null),[y,T]=m.useState(""),_=m.useRef(null),E=m.useRef(null),[D,O]=m.useState(ng);m.useEffect(()=>{E.current&&!a&&O(ng()),E.current=a},[a]),m.useEffect(()=>{if(j==="connected")b(null);else if(j==="reconnecting")b(null);else{const A=setTimeout(()=>{b("Disconnected from daemon. Check that the daemon is running.")},2e3);return()=>clearTimeout(A)}},[v,j]);const R=m.useMemo(()=>Yj(r),[r]),X=m.useRef(!0),K=m.useCallback(()=>{_.current&&(_.current.scrollTop=_.current.scrollHeight,X.current=!0)},[]);m.useEffect(()=>{const A=_.current;if(!A)return;const C=()=>{const M=A.scrollHeight-A.scrollTop-A.clientHeight<80;X.current=M};return A.addEventListener("scroll",C,{passive:!0}),()=>A.removeEventListener("scroll",C)},[]),m.useEffect(()=>{X.current&&K()},[R,k,K]),m.useEffect(()=>{K()},[K]),m.useEffect(()=>{e&&(console.log("Command palette result:",e),T(e),s==null||s())},[e,s]);const P=m.useCallback(async A=>{var M,V;if(!t){b("Not connected to daemon. Make sure the daemon is running.");return}if(g(!0),b(null),K(),A.startsWith("/")){const J=A.match(/^\/([^\s]+)(?:\s+(.*))?$/);if(J){const ne=J[1].toLowerCase(),Se=(J[2]||"").trim();if(ne==="heartbeat"){o({type:"user-prompt",id:`local-prompt-${Date.now()}`,timestamp:Date.now(),text:A});const le=Se.toLowerCase();if(le==="now"){o({type:"assistant-delta",id:`local-running-${Date.now()}`,timestamp:Date.now(),text:"Executing immediate heartbeat cycle in background..."});try{await t.heartbeatRun(),g(!1)}catch(B){const w=B instanceof Error?B.message:String(B);o({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Heartbeat failed: ${w}`}),g(!1)}}else if(le==="status"||le==="")try{const B=await t.heartbeatStatus(),w=(B==null?void 0:B.schedule)==="on",Z=(B==null?void 0:B.intraday)||"(not set)",q=`### Heartbeat Cycle Status:
|
|
116
|
+
* **Enabled**: \`${w?"yes":"no"}\`
|
|
117
|
+
* **Intraday**: \`${Z}\`
|
|
118
|
+
* **Daily**: \`${(B==null?void 0:B.daily)||"6:00"}\`
|
|
119
|
+
* **Weekly**: \`${(B==null?void 0:B.weekly)||"monday@6:00"}\`
|
|
120
|
+
* **Monthly**: \`${(B==null?void 0:B.monthly)||"1@6:00"}\`
|
|
121
|
+
* **Dreaming**: \`${(B==null?void 0:B.dreaming)||"2:00"}\`
|
|
122
|
+
|
|
123
|
+
**Usage**:
|
|
124
|
+
* \`/heartbeat enable\` / \`/heartbeat disable\`
|
|
125
|
+
* \`/heartbeat daily <H:MM>\`
|
|
126
|
+
* \`/heartbeat weekly <day@H:MM>\`
|
|
127
|
+
* \`/heartbeat monthly <D@H:MM>\`
|
|
128
|
+
* \`/heartbeat dreaming <H:MM>\`
|
|
129
|
+
* \`/heartbeat intraday <H:MM,...>\`
|
|
130
|
+
* \`/heartbeat now\` — run a heartbeat immediately.`;o({type:"assistant-delta",id:`local-status-${Date.now()}`,timestamp:Date.now(),text:q}),g(!1)}catch(B){const w=B instanceof Error?B.message:String(B);o({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to fetch heartbeat status: ${w}`}),g(!1)}else if(le==="enable")try{await t.configSet("heartbeat.schedule","on"),o({type:"assistant-delta",id:`local-enable-${Date.now()}`,timestamp:Date.now(),text:"Heartbeat cycle has been enabled successfully."}),g(!1)}catch(B){const w=B instanceof Error?B.message:String(B);o({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to enable heartbeat: ${w}`}),g(!1)}else if(le==="disable")try{await t.configSet("heartbeat.schedule","off"),o({type:"assistant-delta",id:`local-disable-${Date.now()}`,timestamp:Date.now(),text:"Heartbeat cycle has been disabled."}),g(!1)}catch(B){const w=B instanceof Error?B.message:String(B);o({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to disable heartbeat: ${w}`}),g(!1)}else{const B=Se.split(/\s+/),w=(M=B[0])==null?void 0:M.toLowerCase(),Z=B.slice(1).join(" ").trim();if(["daily","weekly","monthly","dreaming","intraday"].includes(w))try{await t.configSet(`heartbeat.${w}`,Z),o({type:"assistant-delta",id:`local-set-${Date.now()}`,timestamp:Date.now(),text:`Heartbeat schedule for \`${w}\` has been set to: \`${Z}\``}),g(!1)}catch(ae){const re=ae instanceof Error?ae.message:String(ae);o({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to set heartbeat schedule: ${re}`}),g(!1)}else o({type:"assistant-delta",id:`local-unknown-${Date.now()}`,timestamp:Date.now(),text:"Unknown heartbeat command. Supported subcommands: `status`, `enable`, `disable`, `daily`, `weekly`, `monthly`, `dreaming`, `intraday`, `now`."}),g(!1)}return}else if(ne==="cron"){o({type:"user-prompt",id:`local-prompt-${Date.now()}`,timestamp:Date.now(),text:A});const B=Se.toLowerCase().split(/\s+/),w=B[0]||"list",Z=B.slice(1).join(" ").trim();if(w==="list"||!w)try{const q=await t.cronList();if(!q||q.length===0)o({type:"assistant-delta",id:`local-cron-list-${Date.now()}`,timestamp:Date.now(),text:"No reminders scheduled."});else{const ae=q.map((re,G)=>{const F=new Date(re.scheduledAt).toLocaleString(),$e=re.status==="pending"?"⏳":re.status==="fired"?"🔔":re.status==="executing"?"⚙️":re.status==="completed"?"✅":(re.status==="failed","❌"),Ge=re.type==="heartbeat"?`Heartbeat: ${re.schedule?`[${re.schedule.type.toUpperCase()}] `:""}`:re.type==="task"?"Task: ":"Reminder: ";return`${G+1}. ${$e} ${Ge}${re.message} (Scheduled: ${F}, ID: \`${re.id}\`)`}).join(`
|
|
131
|
+
`);o({type:"assistant-delta",id:`local-cron-list-${Date.now()}`,timestamp:Date.now(),text:`### Active Reminders:
|
|
132
|
+
${ae}`})}g(!1)}catch(q){const ae=q instanceof Error?q.message:String(q);o({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to fetch reminders: ${ae}`}),g(!1)}else if(w==="delete"||w==="cancel")if(!Z)o({type:"assistant-delta",id:`local-cron-del-${Date.now()}`,timestamp:Date.now(),text:"Usage: `/cron delete <id>`"}),g(!1);else try{const q=await t.cronCancel(Z);q!=null&&q.cancelled?o({type:"assistant-delta",id:`local-cron-del-${Date.now()}`,timestamp:Date.now(),text:`Reminder \`${Z}\` cancelled.`}):o({type:"assistant-delta",id:`local-cron-del-${Date.now()}`,timestamp:Date.now(),text:`No reminder found with ID: \`${Z}\``}),g(!1)}catch(q){const ae=q instanceof Error?q.message:String(q);o({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to delete reminder: ${ae}`}),g(!1)}else if(w==="clear")try{const q=await t.cronClear();o({type:"assistant-delta",id:`local-cron-clear-${Date.now()}`,timestamp:Date.now(),text:`Successfully cleared ${(q==null?void 0:q.removed)||0} completed reminder(s).`}),g(!1)}catch(q){const ae=q instanceof Error?q.message:String(q);o({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to clear reminders: ${ae}`}),g(!1)}else o({type:"assistant-delta",id:`local-cron-err-${Date.now()}`,timestamp:Date.now(),text:"Unknown cron subcommand. Supported: `/cron list`, `/cron delete <id>`, `/cron clear`."}),g(!1);return}if(ne==="wiki"){o({type:"user-prompt",id:`local-prompt-${Date.now()}`,timestamp:Date.now(),text:A});const le=((V=Se.split(/\s+/)[0])==null?void 0:V.toLowerCase())??"",B=Se.slice(le.length).trim();if(!le||le==="open")h==null||h("wiki"),g(!1);else if(le==="list")try{const w=await t.wikiListPages(),Z=(w==null?void 0:w.pages)??[];if(Z.length===0)o({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:"Wiki is empty. Initialize with: `curie-agent wiki init`"});else{const q={};for(const re of Z){const G=re.category||"other";(q[G]??(q[G]=[])).push(`${re.slug} — ${re.title}`)}const ae=Object.entries(q).flatMap(([re,G])=>[`**${re}** (${G.length})`,...G.map(F=>` ${F}`)]);o({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:`### Wiki Pages (${Z.length} total)
|
|
133
|
+
|
|
134
|
+
${ae.join(`
|
|
135
|
+
`)}`})}g(!1)}catch(w){o({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Wiki list failed: ${w instanceof Error?w.message:String(w)}`}),g(!1)}else if(le==="search")if(!B)o({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:"Usage: `/wiki search <query>`"}),g(!1);else try{const Z=await t.wikiSearch(B)??[];if(Z.length===0)o({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:`No wiki results for "${B}"`});else{const q=Z.slice(0,20).map(ae=>` **${ae.slug}**: ${ae.line}`);o({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:`### Wiki Search: "${B}" (${Z.length} hits)
|
|
136
|
+
|
|
137
|
+
${q.join(`
|
|
138
|
+
`)}`})}g(!1)}catch(w){o({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Wiki search failed: ${w instanceof Error?w.message:String(w)}`}),g(!1)}else if(le==="lint")try{const w=await t.wikiLint(),Z=(w==null?void 0:w.issues)??[];if(Z.length===0)o({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:"Wiki is healthy — no issues found."});else{const q=Z.map(ae=>`- **[${ae.type}]** ${ae.slug?`\`${ae.slug}\`: `:""}${ae.message}`);o({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:`### Wiki Lint (${Z.length} issues)
|
|
139
|
+
|
|
140
|
+
${q.join(`
|
|
141
|
+
`)}`})}g(!1)}catch(w){o({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Wiki lint failed: ${w instanceof Error?w.message:String(w)}`}),g(!1)}else o({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:"Wiki commands:\n- `/wiki` — Open wiki view\n- `/wiki list` — List all pages\n- `/wiki search <q>` — Search pages\n- `/wiki lint` — Health check"}),g(!1);return}}}const C=a||"";try{const J=await t.sessionSend(C,A,"webui");J!=null&&J.sessionId&&!a&&(p==null||p.subscribe(J.sessionId),l==null||l(J.sessionId))}catch(J){const ne=J instanceof Error?J.message:String(J);b(`Failed to send: ${ne}`),g(!1)}},[t,p,a,K,l,o]);m.useEffect(()=>{p&&(p.on("assistant-stop",()=>g(!1)),p.on("error",()=>g(!1)))},[p]);const z=m.useCallback(async()=>{if(!(!t||!a)){g(!1),b(null),K();try{await t.sessionCancel(a)}catch(A){const C=A instanceof Error?A.message:String(A);b(`Failed to cancel: ${C}`)}}},[t,a,K]);return i.jsxs("div",{className:`flex flex-col h-full ${n||""}`,children:[i.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-thin",ref:_,children:[R.length===0&&i.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted",children:[i.jsx("div",{className:"text-lg mb-2 font-display",style:{color:"var(--cream)"},children:"curie"}),i.jsx("div",{className:"text-sm text-muted",children:D})]}),i.jsxs("div",{className:"py-4 pb-6",children:[R.map((A,C)=>{if(A.type==="thinking")return i.jsx(wv,{content:A.content},`thinking-${C}`);if(A.type==="user")return i.jsx("div",{className:"flex flex-row-reverse px-3 py-0.5 animate-fadeIn transition-colors duration-100",children:i.jsxs("div",{className:"flex flex-1 flex-col items-end min-w-0",children:[i.jsxs("div",{className:"flex flex-row-reverse items-baseline gap-2 mb-1",children:[i.jsx("span",{className:"text-xs font-semibold",style:{color:"var(--cream)"},children:"you"}),i.jsx("span",{className:"text-xs text-muted font-mono",children:A.time})]}),i.jsx("div",{className:"text-[13px] text-text leading-[1.65] chat-msg-user rounded-t-[10px] rounded-bl-[10px] px-3.5 py-2.5 max-w-[480px] markdown-body",dangerouslySetInnerHTML:{__html:Cs(A.content)}})]})},C);if(A.type==="tool-group"){const M=A;if(M.toolCalls.length>0)return i.jsx(jv,{toolCalls:M.toolCalls},C)}if(A.type==="agent-actions"){const M=A;return i.jsx(qj,{blocks:M.blocks,blockCount:M.blockCount,time:M.time,events:r,rpc:t},`agent-${M.time||C}`)}if(A.type==="approval-request")return i.jsx(kv,{toolCallId:A.toolCallId,name:A.name,input:A.input,decision:A.decision,events:r,rpc:t,mode:A.mode},C);if(A.type==="heartbeat-brief"){const M=A;return i.jsx($j,{event:M.event},C)}if(A.type==="reminder-fired")return i.jsx(Uj,{message:A.message,time:A.time},C);if(A.type==="chart"){const M=Bj(r,A.toolCallId);return i.jsx(Rj,{spec:M==null?void 0:M.output,error:M==null?void 0:M.error,pending:!M,rawInput:A.rawInput},C)}return A.type==="error"?i.jsxs("div",{className:"px-3 py-0.5 animate-fadeIn transition-colors duration-100",children:[i.jsxs("div",{className:"flex items-baseline gap-2 mb-1",children:[i.jsx("span",{className:"text-xs font-semibold",style:{color:"var(--red)"},children:"error"}),i.jsx("span",{className:"text-xs text-muted font-mono",children:A.time})]}),i.jsx("div",{className:"text-[13px] text-red leading-[1.65] rounded-lg px-3 py-2 bg-red/5 border border-red/10",children:A.content})]},C):A.type==="context-warning"?i.jsx("div",{className:"px-3 py-0.5 animate-fadeIn",children:i.jsx("div",{className:"text-[12px] leading-[1.6] rounded-lg px-3 py-2 markdown-body",style:{background:"color-mix(in srgb, var(--yellow) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--yellow) 25%, transparent)"},dangerouslySetInnerHTML:{__html:Cs(A.content)}})},C):A.type==="compaction"?i.jsx(Lj,{entry:A},C):i.jsxs("div",{className:"px-3 py-0.5 animate-fadeIn transition-colors duration-100",children:[i.jsxs("div",{className:"flex items-baseline gap-2 mb-1",children:[i.jsx("span",{className:"text-xs font-semibold",style:{color:"var(--gold)"},children:"curie-agent"}),i.jsx("span",{className:"text-xs text-muted font-mono",children:A.time})]}),i.jsx("div",{className:"text-[13px] text-text leading-[1.65] markdown-body chat-msg-agent pl-3",dangerouslySetInnerHTML:{__html:Cs(A.content)}})]},C)}),k&&i.jsx("div",{className:"flex items-center px-3 py-2",children:i.jsxs("div",{className:"flex gap-1.5",children:[i.jsx("span",{className:"w-[5px] h-[5px] bg-muted2 rounded-full animate-dot inline-block",style:{animation:"tdot 1.4s infinite"}}),i.jsx("span",{className:"w-[5px] h-[5px] bg-muted2 rounded-full animate-dot inline-block",style:{animation:"tdot 1.4s infinite 0.2s"}}),i.jsx("span",{className:"w-[5px] h-[5px] bg-muted2 rounded-full animate-dot inline-block",style:{animation:"tdot 1.4s infinite 0.4s"}})]})})]})]}),i.jsxs("div",{className:"flex-shrink-0",children:[x&&i.jsx("div",{className:"px-3 py-1.5 bg-red/10 border-t border-red/20",children:i.jsx("div",{className:"text-[11px] text-red font-mono",children:x})}),i.jsx(vj,{onSend:P,onCancel:k?z:void 0,cmdInput:y,onClearCmdInput:()=>T(""),totalTokens:c,contextTokens:u,costUsd:d,contextReport:f})]})]})}const lg={opus:{in:15,out:75},sonnet:{in:3,out:15},haiku:{in:.8,out:4},"gpt-4o":{in:2.5,out:10},"gpt-4":{in:5,out:15},qwen:{in:.112,out:.224}},Xj="sonnet";function _v(e,t,n,a){if(a){const[o,c]=a.split(";"),u=parseFloat(o||"0"),d=parseFloat(c||"0");if(!isNaN(u)&&!isNaN(d))return(t*u+n*d)/1e6}const l=e.toLowerCase(),s=Object.keys(lg).find(o=>l.includes(o))??Xj,r=lg[s];return(t*r.in+n*r.out)/1e6}function Vj({cmdResult:e,onClearCmdResult:t,rpc:n,className:a,activeSessionId:l,onCreateSession:s,events:r,addLiveEvent:o,onSwitchView:c,contextReport:u}){var b;const{get:d,providers:f}=hh(),h=d("model"),p=d("current_provider")||"anthropic",v=(b=f.find(y=>y.name===p))==null?void 0:b.model_cost;let j=0,k=0,g=0;const x=l?r.filter(y=>y.type==="usage"):[];if(x.length>0){j=x.reduce((T,_)=>T+(_.inputTokens||0)+(_.outputTokens||0),0);const y=x[x.length-1];k=y&&y.inputTokens||0,g=x.reduce((T,_)=>T+_v(h||"sonnet",_.inputTokens||0,_.outputTokens||0,v),0)}return i.jsx("div",{className:`flex flex-col h-full ${a||""}`,children:i.jsx(Ij,{cmdResult:e,onClearCmdResult:t,rpc:n,activeSessionId:l,onCreateSession:s,events:r,addLiveEvent:o,totalTokens:j,contextTokens:k,costUsd:g,contextReport:u,onSwitchView:c})})}function Qj({rpc:e,className:t}){const[n,a]=m.useState(null),[l,s]=m.useState(null),[r,o]=m.useState(null),[c,u]=m.useState(!0);m.useEffect(()=>{e&&Promise.all([e.configGet("channels.bot_token").catch(()=>null),e.configGet("channels.user_id").catch(()=>null),e.configGet("channels.chat_id").catch(()=>null)]).then(([f,h,p])=>{a(f),s(h),o(p)}).finally(()=>u(!1))},[e]);const d=!!n&&!!l;return i.jsxs("div",{className:`flex-1 overflow-y-auto p-7 scrollbar-thin ${t||""}`,children:[i.jsxs("div",{className:"flex items-center justify-between mb-5",children:[i.jsx("h2",{className:"text-base font-semibold text-fg tracking-tight",children:"Channels"}),i.jsxs("button",{className:"flex items-center gap-1 bg-transparent border border-b2 rounded px-3 py-1.5 text-muted text-xs hover:border-b3 hover:text-fg transition-colors duration-100",children:[i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[i.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),i.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Connect"]})]}),c?i.jsx("div",{className:"flex items-center justify-center py-10 text-muted",children:"Loading..."}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg mb-0.5 bg-s2",children:[i.jsx("div",{className:"w-8 h-8 rounded-lg bg-s3 flex items-center justify-center shrink-0 text-base",children:d?"📱":"🔌"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"text-[13px] font-medium text-fg",children:d?"Telegram Connected":"Not Connected"}),i.jsx("div",{className:"text-xs text-muted truncate",children:d?`Bot configured for user ${l}`:"Configure a Telegram bot to enable channel messaging"})]}),i.jsx("div",{className:`w-[6px] h-[6px] rounded-full shrink-0 ${d?"bg-green":"bg-muted2"}`})]}),d&&i.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] overflow-hidden mt-3",children:[i.jsx("div",{className:"text-[12px] font-medium text-text2 px-4 py-3 border-b border-b1",children:"Channel Configuration"}),i.jsx(Ku,{label:"Bot Token",value:(n==null?void 0:n.slice(0,12))+"..."||""}),i.jsx(Ku,{label:"User ID",value:l||""}),i.jsx(Ku,{label:"Chat ID",value:r||"not set"})]})]})]})}function Ku({label:e,value:t}){return i.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-b1/50",children:[i.jsx("span",{className:"text-xs text-muted",children:e}),i.jsx("span",{className:"text-xs text-text font-mono",children:t})]})}function Kj({rpc:e,className:t}){const{ws:n}=Vn(),[a,l]=m.useState(null),[s,r]=m.useState([]),[o,c]=m.useState(!0),[u,d]=m.useState(null),[f,h]=m.useState(null),p=m.useRef(null),v=m.useCallback(async()=>{if(e)try{const[w,Z]=await Promise.all([e.sessionStats(),e.sessionList()]);w&&l(w),Array.isArray(Z)&&r(Z)}catch(w){console.error("[StatsView] Failed to load statistics:",w)}},[e]);if(m.useEffect(()=>{c(!0),v().finally(()=>c(!1))},[v]),m.useEffect(()=>{if(!n)return;const w=()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(v,2e3)},Z=n.on("session-stop",w),q=n.on("session-start",w);return()=>{Z(),q(),p.current&&clearTimeout(p.current)}},[n,v]),o)return i.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted py-20 select-none animate-pulse",children:[i.jsx("div",{className:"w-8 h-8 rounded-full mb-4 animate-spin",style:{background:"conic-gradient(from 0deg, transparent, var(--gold))",mask:"radial-gradient(farthest-side, transparent calc(100% - 2px), #000 0)",WebkitMask:"radial-gradient(farthest-side, transparent calc(100% - 2px), #000 0)"}}),i.jsx("span",{className:"text-[13px] font-mono",style:{color:"var(--gold)",opacity:.7},children:"Compiling operations telemetry..."})]});if(!a||a.summary.totalSessions===0)return i.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted py-20 select-none",children:[i.jsx("div",{className:"w-14 h-14 rounded-xl flex items-center justify-center mb-4",style:{background:"linear-gradient(135deg, var(--s2) 0%, var(--s1) 100%)",border:"1px solid var(--b1)",boxShadow:"0 4px 16px rgba(0,0,0,0.2)"},children:i.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",style:{opacity:.6},children:[i.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),i.jsx("path",{d:"M21 12H3M12 3v18"})]})}),i.jsx("div",{className:"text-[14px] font-display font-semibold",style:{color:"var(--cream)"},children:"No operational data found"}),i.jsx("div",{className:"text-[11.5px] text-muted mt-1",children:"Start a conversation to generate metrics."})]});const{summary:j,hourly:k,entrypoints:g,topTools:x}=a,b=w=>w<1e3?String(w):w<1e6?`${(w/1e3).toFixed(1)}k`:`${(w/1e6).toFixed(2)}M`,y=600,T=140,_=45,E=15,D=15,O=25,R=Math.max(...k.map(w=>w.inputTokens+w.outputTokens),1),X=y-_-E,K=T-D-O,P=k.map((w,Z)=>{const q=w.inputTokens+w.outputTokens,ae=_+Z/23*X,re=D+K-q/R*K;return{x:ae,y:re,...w}}),z=P.length>0?`${P.map((w,Z)=>`${Z===0?"M":"L"} ${w.x} ${w.y}`).join(" ")} L ${P[P.length-1].x} ${D+K} L ${P[0].x} ${D+K} Z`:"",A=P.length>0?P.map((w,Z)=>`${Z===0?"M":"L"} ${w.x} ${w.y}`).join(" "):"",C=600,M=140,V=Math.max(...k.map(w=>Math.max(w.toolCalls,w.messages)),1),J=C-_-E,ne=M-D-O,Se=J/24*.75,le=J/24*.25,B=g.webui+g.tui+g.telegram+g.heartbeat||1;return i.jsxs("div",{className:`flex-1 overflow-y-auto p-4 md:p-7 scrollbar-thin ${t||""}`,children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-6",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-lg font-display font-semibold tracking-tight",style:{color:"var(--cream)"},children:"System Telemetry"}),i.jsx("p",{className:"text-[11.5px] text-muted mt-0.5",children:"Real-time daily operations telemetry and interface execution load."})]}),i.jsxs("span",{className:"self-start sm:self-auto text-[11px] font-mono rounded-full px-3 py-1 text-muted select-none",style:{background:"linear-gradient(135deg, var(--s2) 0%, var(--s1) 100%)",border:"1px solid var(--b1)"},children:["Today: ",new Date().toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric"})]})]}),i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[i.jsx(oo,{label:"Today's Sessions",value:String(j.totalSessionsToday),subtitle:"conversations today"}),i.jsx(oo,{label:"Operational Cost",value:`$${j.totalCost.toFixed(4)}`,subtitle:"estimated total",isGreen:!0}),i.jsx(oo,{label:"Volume Consumed",value:b(j.totalTokens),subtitle:"total system tokens"}),i.jsx(oo,{label:"Agent Executions",value:String(j.totalToolCalls),subtitle:"integrated tool calls"})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5 mb-6",children:[i.jsxs("div",{className:"glass-card rounded-xl p-5 flex flex-col relative select-none",children:[i.jsxs("div",{className:"flex items-center justify-between h-6 mb-4",children:[i.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--gold)",opacity:.8},children:"Hourly Token Consumption"}),i.jsx("span",{className:`text-[11px] font-mono text-fg px-2 py-0.5 rounded-[4px] transition-opacity duration-150 ${u!==null?"opacity-100":"opacity-0 pointer-events-none"}`,style:{background:"var(--s3)",border:"1px solid var(--b1)"},children:u!==null?`${String(u).padStart(2,"0")}:00 · ${b(k[u].inputTokens+k[u].outputTokens)} tok`:"00:00 · 0 tok"})]}),i.jsx("div",{className:"relative flex-1 h-[140px]",children:i.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${y} ${T}`,preserveAspectRatio:"none",className:"overflow-visible",children:[i.jsx("defs",{children:i.jsxs("linearGradient",{id:"tokenGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[i.jsx("stop",{offset:"0%",stopColor:"var(--gold)",stopOpacity:"0.25"}),i.jsx("stop",{offset:"100%",stopColor:"var(--gold)",stopOpacity:"0"})]})}),Array.from({length:5}).map((w,Z)=>{const q=D+Z/4*K,ae=Math.round(R-Z/4*R);return i.jsxs("g",{className:"opacity-25",children:[i.jsx("line",{x1:_,y1:q,x2:y-E,y2:q,stroke:"var(--b2)",strokeWidth:"0.75",strokeDasharray:"3 3"}),i.jsx("text",{x:_-8,y:q+3.5,textAnchor:"end",className:"fill-muted font-mono text-[9.5px]",children:b(ae)})]},Z)}),Array.from({length:7}).map((w,Z)=>{const q=Math.round(Z/6*23),ae=_+q/23*X;return i.jsxs("text",{x:ae,y:T-6,textAnchor:"middle",className:"fill-muted font-mono text-[9.5px] opacity-60",children:[String(q).padStart(2,"0"),":00"]},Z)}),z&&i.jsx("path",{d:z,fill:"url(#tokenGrad)"}),A&&i.jsx("path",{d:A,fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",strokeLinecap:"round"}),P.map((w,Z)=>i.jsxs("g",{onMouseEnter:()=>d(Z),onMouseLeave:()=>d(null),children:[i.jsx("rect",{x:w.x-X/48,y:D,width:X/24,height:K,fill:"transparent",className:"cursor-pointer"}),u===Z&&i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:w.x,y1:D,x2:w.x,y2:D+K,stroke:"var(--b2)",strokeWidth:"0.75"}),i.jsx("circle",{cx:w.x,cy:w.y,r:"4",fill:"var(--gold)",stroke:"var(--s1)",strokeWidth:"1.5"})]})]},Z))]})})]}),i.jsxs("div",{className:"glass-card rounded-xl p-5 flex flex-col relative select-none",children:[i.jsxs("div",{className:"flex items-center justify-between h-6 mb-4",children:[i.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--gold)",opacity:.8},children:"Hourly Tool & Prompt Load"}),i.jsx("span",{className:`text-[11px] font-mono text-fg px-2 py-0.5 rounded-[4px] transition-opacity duration-150 ${f!==null?"opacity-100":"opacity-0 pointer-events-none"}`,style:{background:"var(--s3)",border:"1px solid var(--b1)"},children:f!==null?`${String(f).padStart(2,"0")}:00 · 🛠️ ${k[f].toolCalls} calls · 💬 ${k[f].messages} msg`:"00:00 · 0 calls · 0 msg"})]}),i.jsx("div",{className:"relative flex-1 h-[140px]",children:i.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${C} ${M}`,preserveAspectRatio:"none",className:"overflow-visible",children:[Array.from({length:5}).map((w,Z)=>{const q=D+Z/4*ne,ae=Math.round(V-Z/4*V);return i.jsxs("g",{className:"opacity-25",children:[i.jsx("line",{x1:_,y1:q,x2:C-E,y2:q,stroke:"var(--b2)",strokeWidth:"0.75",strokeDasharray:"3 3"}),i.jsx("text",{x:_-8,y:q+3.5,textAnchor:"end",className:"fill-muted font-mono text-[9.5px]",children:ae})]},Z)}),Array.from({length:7}).map((w,Z)=>{const q=Math.round(Z/6*23),ae=_+q/23*J;return i.jsxs("text",{x:ae,y:M-6,textAnchor:"middle",className:"fill-muted font-mono text-[9.5px] opacity-60",children:[String(q).padStart(2,"0"),":00"]},Z)}),k.map((w,Z)=>{const q=_+Z*(Se+le),ae=w.messages/V*ne,re=w.toolCalls/V*ne,G=D+ne-ae,F=G-re;return i.jsxs("g",{onMouseEnter:()=>h(Z),onMouseLeave:()=>h(null),className:"cursor-pointer",children:[w.messages>0&&i.jsx("rect",{x:q,y:G,width:Se,height:ae,fill:"var(--yellow)",rx:"1",className:"transition-all duration-100 hover:opacity-80"}),w.toolCalls>0&&i.jsx("rect",{x:q,y:F,width:Se,height:re,fill:"var(--cream)",rx:"1",className:"transition-all duration-100 hover:opacity-80"}),i.jsx("rect",{x:q-le/2,y:D,width:Se+le,height:ne,fill:"transparent"})]},Z)})]})})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-5 mb-6",children:[i.jsxs("div",{className:"glass-card rounded-xl p-5 flex flex-col select-none",children:[i.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider mb-4 block",style:{color:"var(--gold)",opacity:.8},children:"Telemetry Channels"}),i.jsxs("div",{className:"space-y-3.5 flex-1 flex flex-col justify-center",children:[i.jsx(co,{label:"Web UI Console",count:g.webui,percent:Math.round(g.webui/B*100),color:"var(--gold)"}),i.jsx(co,{label:"CLI TUI Terminal",count:g.tui,percent:Math.round(g.tui/B*100),color:"var(--yellow)"}),i.jsx(co,{label:"Telegram Bot",count:g.telegram,percent:Math.round(g.telegram/B*100),color:"var(--cream)"}),i.jsx(co,{label:"Heartbeat Scheduler",count:g.heartbeat,percent:Math.round(g.heartbeat/B*100),color:"var(--red)"})]})]}),i.jsxs("div",{className:"col-span-1 md:col-span-2 glass-card rounded-xl p-5",children:[i.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider mb-3 block",style:{color:"var(--gold)",opacity:.8},children:"Top Executed Tools Today"}),x.length===0?i.jsx("div",{className:"flex items-center justify-center h-28 text-xs text-muted",children:"No tool executions tracked today"}):i.jsx("div",{className:"overflow-hidden",children:i.jsxs("table",{className:"w-full text-left text-xs",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"font-mono text-[10px]",style:{borderBottom:"1px solid color-mix(in srgb, var(--b1) 40%, transparent)",color:"var(--muted)"},children:[i.jsx("th",{className:"pb-1.5 font-medium",children:"TOOL DEFINITION"}),i.jsx("th",{className:"pb-1.5 font-medium text-right",children:"CALLS"})]})}),i.jsx("tbody",{children:x.map((w,Z)=>i.jsxs("tr",{className:"transition-colors duration-100",style:{borderBottom:"1px solid color-mix(in srgb, var(--b1) 20%, transparent)"},children:[i.jsx("td",{className:"py-2 font-mono text-fg font-medium",children:w.name}),i.jsxs("td",{className:"py-2 text-right font-mono font-semibold",style:{color:"var(--gold)"},children:[w.count," executions"]})]},Z))})]})})]})]}),s.length>0&&i.jsxs("div",{className:"glass-card rounded-xl overflow-hidden",children:[i.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider px-4 py-3.5",style:{borderBottom:"1px solid var(--b1)",color:"var(--gold)",opacity:.8},children:"Telemetry Operations Stream"}),i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-[12.5px]",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"text-left text-xs text-muted font-mono text-[10px]",style:{borderBottom:"1px solid color-mix(in srgb, var(--b1) 40%, transparent)"},children:[i.jsx("th",{className:"px-4 py-2 font-medium",children:"SESSION ID"}),i.jsx("th",{className:"px-4 py-2 font-medium",children:"CHANNEL"}),i.jsx("th",{className:"px-4 py-2 font-medium",children:"MODEL MODEL"}),i.jsx("th",{className:"px-4 py-2 font-medium",children:"TELEMETRY TIMESTAMP"}),i.jsx("th",{className:"px-4 py-2 font-medium",children:"ACTIVE DIRECTORY"})]})}),i.jsx("tbody",{children:s.slice(0,15).map(w=>i.jsxs("tr",{className:"transition-colors duration-75",style:{borderBottom:"1px solid color-mix(in srgb, var(--b1) 20%, transparent)"},children:[i.jsx("td",{className:"px-4 py-2.5 font-mono text-[11.5px] text-fg",children:w.id}),i.jsx("td",{className:"px-4 py-2.5",children:i.jsx("span",{className:"px-2 py-0.5 rounded-[4px] text-[10px] font-mono select-none",style:{background:w.type==="telegram"?"color-mix(in srgb, var(--cream) 10%, transparent)":w.type==="tui"?"color-mix(in srgb, var(--yellow) 10%, transparent)":w.type==="heartbeat"?"color-mix(in srgb, var(--red) 10%, transparent)":"color-mix(in srgb, var(--gold) 10%, transparent)",color:w.type==="telegram"?"var(--cream)":w.type==="tui"?"var(--yellow)":w.type==="heartbeat"?"var(--red)":"var(--gold)",border:"1px solid color-mix(in srgb, var(--b1) 30%, transparent)"},children:w.type||"webui"})}),i.jsx("td",{className:"px-4 py-2.5 text-text font-mono text-[11.5px]",children:w.model}),i.jsx("td",{className:"px-4 py-2.5 text-muted text-xs",children:new Date(w.createdAt).toLocaleString()}),i.jsx("td",{className:"px-4 py-2.5 text-muted text-xs truncate max-w-[220px]",title:w.cwd,children:w.cwd})]},w.id))})]})})]})]})}function oo({label:e,value:t,subtitle:n,isGreen:a}){return i.jsxs("div",{className:"metric-card rounded-xl px-6 py-5 flex flex-col justify-between select-none",children:[i.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--gold)",opacity:.7},children:e}),i.jsx("div",{className:"text-2xl font-display font-bold tracking-tight leading-none",style:{color:a?"var(--green)":"var(--cream)"},children:t}),i.jsx("span",{className:"text-[10px] text-muted mt-2 font-mono",children:n})]})}function co({label:e,count:t,percent:n,color:a}){return i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center justify-between text-xs font-medium text-text2",children:[i.jsx("span",{children:e}),i.jsxs("span",{className:"font-mono text-muted",children:[t," sessions (",n||0,"%)"]})]}),i.jsx("div",{className:"w-full h-1.5 rounded-full overflow-hidden",style:{background:"var(--s2)"},children:i.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${n||0}%`,background:a}})})]})}function Jj({rpc:e,className:t}){const[n,a]=m.useState([]),[l,s]=m.useState(!0);m.useEffect(()=>{e&&(s(!0),e.sessionList().then(o=>{Array.isArray(o)&&a(o)}).catch(()=>{}).finally(()=>s(!1)))},[e]);const r=m.useMemo(()=>{const o=new Map;for(const c of n){const u=o.get(c.cwd)||[];u.push(c),o.set(c.cwd,u)}return Array.from(o.entries()).map(([c,u])=>({cwd:c,sessions:u.length,providers:[...new Set(u.map(d=>d.provider))],models:[...new Set(u.map(d=>d.model))],lastActive:Math.max(...u.map(d=>d.updatedAt))})).sort((c,u)=>u.lastActive-c.lastActive)},[n]);return i.jsxs("div",{className:`flex-1 overflow-y-auto p-7 scrollbar-thin ${t||""}`,children:[i.jsxs("div",{className:"flex items-center justify-between mb-5",children:[i.jsx("h2",{className:"text-base font-semibold text-fg tracking-tight",children:"Projects"}),i.jsxs("span",{className:"text-xs text-muted font-mono",children:[r.length," projects"]})]}),l?i.jsx("div",{className:"flex items-center justify-center py-10 text-muted",children:"Loading..."}):r.length===0?i.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-muted",children:[i.jsx("div",{className:"text-sm",children:"No projects yet"}),i.jsx("div",{className:"text-xs text-muted2 mt-1",children:"Sessions will appear here once you run them"})]}):r.map(o=>i.jsx(Wj,{project:o},o.cwd))]})}function Wj({project:e}){const t=e.cwd.split("/").pop()||e.cwd;return i.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg mb-0.5 hover:bg-s2 cursor-pointer transition-colors duration-100",children:[i.jsx("div",{className:"w-[6px] h-[6px] rounded-full bg-green shrink-0"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"text-[13px] font-medium text-fg",children:t}),i.jsx("div",{className:"text-xs text-muted font-mono",children:e.cwd})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs("span",{className:"text-xs text-muted",children:[e.sessions," session",e.sessions!==1?"s":""]}),i.jsx("span",{className:"text-xs text-muted",children:e.providers.join(", ")})]}),i.jsx("span",{className:"text-[10px] font-medium rounded-full px-2 py-0.5 font-mono bg-green/10 text-green",children:"active"})]})}function Fj(){const{rpc:e,ws:t}=Vn(),[n,a]=m.useState(new Map);m.useEffect(()=>{e&&e.subagentList().then(d=>{if(!Array.isArray(d))return;const f=new Map;for(const h of d)h.agentId&&f.set(h.agentId,{...h,agentId:h.agentId,sessionId:h.sessionId??"",prompt:h.prompt??"",provider:h.provider??"unknown",status:h.status??"done",text:h.text??"",toolCalls:h.toolCalls??0,errors:h.errors??[],inputTokens:h.inputTokens??0,outputTokens:h.outputTokens??0,startedAt:h.startedAt??0});a(f)}).catch(()=>{})},[e]),m.useEffect(()=>{if(!t)return;const d=g=>{a(x=>{const b=new Map(x);return b.set(g.agentId,{agentId:g.agentId,sessionId:g.sessionId||"",prompt:g.prompt||"",provider:g.provider||"unknown",status:"starting",text:"",toolCalls:0,errors:[],inputTokens:0,outputTokens:0,startedAt:g.timestamp}),b})},f=g=>{a(x=>{const b=new Map(x),y=b.get(g.agentId);return y&&b.set(g.agentId,{...y,text:y.text+g.text}),b})},h=g=>{a(x=>{const b=new Map(x),y=b.get(g.agentId);return y&&b.set(g.agentId,{...y,toolCalls:y.toolCalls+1}),b})},p=g=>{a(x=>{const b=new Map(x),y=b.get(g.agentId);return y&&b.set(g.agentId,{...y,inputTokens:y.inputTokens+(g.inputTokens||0),outputTokens:y.outputTokens+(g.outputTokens||0)}),b})},v=g=>{a(x=>{const b=new Map(x),y=b.get(g.agentId);return y&&b.set(g.agentId,{...y,status:"done",text:g.text||y.text,toolCalls:g.toolCalls??y.toolCalls,errors:g.errors||[],doneAt:g.timestamp}),b})},j=g=>{a(x=>{const b=new Map(x),y=b.get(g.agentId);return y&&b.set(g.agentId,{...y,status:"error",errors:[...y.errors||[],g.message],doneAt:g.timestamp}),b})},k=[t.on("agent-start",d),t.on("agent-text-delta",f),t.on("agent-tool-call",h),t.on("agent-usage",p),t.on("agent-done",v),t.on("agent-error",j)];return()=>{for(const g of k)g()}},[t]);const l=m.useCallback(async d=>{if(!e)return null;try{return await e.subagentSpawn(d)}catch(f){return console.error("[useSubagents] Spawn failed:",f),null}},[e]),s=m.useCallback(async d=>{if(!e)return!1;try{return await e.subagentCancel(d),a(f=>{const h=new Map(f),p=h.get(d);return p&&h.set(d,{...p,status:"cancelled",doneAt:Date.now()}),h}),!0}catch{return!1}},[e]),r=m.useCallback(async(d,f)=>{if(!e)return!1;try{return await e.subagentSend(d,f),!0}catch{return!1}},[e]),o=Array.from(n.values()).filter(d=>d.status==="running"||d.status==="starting"),c=Array.from(n.values()).filter(d=>d.status==="done"),u=Array.from(n.values()).filter(d=>d.status==="error");return{agents:n,running:o,completed:c,failed:u,spawn:l,cancel:s,send:r}}const Pj=["agent-start","agent-tool-call","agent-tool-result","agent-text-delta","agent-thinking-delta","agent-done","agent-error"],ek=new Set(["agent-text-delta","agent-thinking-delta"]),sg=50,tk=20,rg=["--chart-1","--chart-2","--chart-3","--chart-4","--chart-5","--chart-6","--chart-7","--chart-8"];function ig(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return rg[t%rg.length]}function vs(e){return typeof e=="string"?e:e==null?"":typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e)}function nk(e){const t=e.event;switch(e.type){case"agent-start":{const n=vs(t.prompt);return{label:"Agent started",detail:n?`"${n}"`:"",tone:"yellow"}}case"agent-tool-call":{const n=vs(t.name)||"tool",a=t.input??{};return{label:n,detail:vv(n,a),tone:"gold"}}case"agent-tool-result":{const n=vs(t.error);return n?{label:"Tool failed",detail:n,tone:"red",wrapDetail:!0}:null}case"agent-thinking-delta":return{label:"Thinking…",detail:`${un(e.charCount)} chars`,tone:"muted"};case"agent-text-delta":return{label:"Streaming…",detail:`${un(e.charCount)} chars`,tone:"muted"};case"agent-done":{const n=[];return typeof t.toolCalls=="number"&&n.push(`${String(t.toolCalls)} tools`),typeof t.durationMs=="number"&&n.push(jh(t.durationMs)),{label:"Completed",detail:n.join(" · "),tone:"green"}}case"agent-error":return{label:"Failed",detail:vs(t.message),tone:"red",wrapDetail:!0};default:return{label:e.type,detail:"",tone:"muted"}}}const ak={green:"bg-green",yellow:"bg-yellow",red:"bg-red",gold:"bg-gold",muted:"bg-muted2"},lk={green:"text-green",yellow:"text-yellow",red:"text-red",gold:"text-gold",muted:"text-muted"};function sk({ws:e}){const[t,n]=m.useState([]),[a,l]=m.useState(()=>Date.now()),s=m.useRef(0);if(m.useEffect(()=>{if(!e)return;const o=u=>d=>{n(f=>{const h=vs(d.agentId),p=vs(d.text);if(ek.has(u)){const v=f[0];return f.length>0&&v.type===u&&v.agentId===h?[{...v,charCount:v.charCount+p.length,timestamp:d.timestamp},...f.slice(1)]:[{seq:s.current++,type:u,agentId:h,timestamp:d.timestamp,charCount:p.length,event:d},...f].slice(0,sg)}return[{seq:s.current++,type:u,agentId:h,timestamp:d.timestamp,charCount:0,event:d},...f].slice(0,sg)})},c=Pj.map(u=>e.on(u,o(u)));return()=>{for(const u of c)u()}},[e]),m.useEffect(()=>{const o=setInterval(()=>{l(Date.now())},1e3);return()=>{clearInterval(o)}},[]),!e)return null;const r=t.map(o=>({entry:o,desc:nk(o)})).filter(o=>o.desc!==null).slice(0,tk);return i.jsxs("div",{children:[i.jsx("div",{className:"h-px bg-b1 my-5"}),i.jsx("div",{className:"text-[11.5px] font-medium text-muted mb-2.5",children:"Live Agent Events"}),r.length===0?i.jsx("div",{className:"text-xs text-muted2 px-3 py-2",children:"Waiting for agent activity…"}):r.map(({entry:o,desc:c})=>i.jsxs("div",{className:"flex items-start gap-3 px-3 py-1.5 rounded-lg mb-0.5 hover:bg-s2 transition-colors",children:[i.jsx("div",{className:`w-[6px] h-[6px] rounded-full shrink-0 mt-[6px] ${ak[c.tone]}`}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("span",{className:`text-[12px] font-mono font-medium ${lk[c.tone]}`,children:c.label})}),c.detail&&i.jsx("div",{className:`text-xs text-muted ${c.wrapDetail?"whitespace-pre-wrap break-words":"truncate"}`,title:c.detail,children:c.detail})]}),o.agentId&&i.jsx("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded-[3px] shrink-0 mt-[2px]",style:{color:`var(${ig(o.agentId)})`,background:`color-mix(in srgb, var(${ig(o.agentId)}) 12%, transparent)`},title:o.agentId,children:o.agentId.slice(0,4)}),i.jsx("span",{className:"text-[10px] text-muted font-mono shrink-0 mt-[3px] w-[52px] text-right",title:Un(o.timestamp),children:yj(o.timestamp,a)})]},o.seq))]})}function rk({rpc:e,sessionId:t,className:n,onOpenSession:a}){const{ws:l}=Vn(),{agents:s,running:r,completed:o,failed:c,spawn:u,cancel:d,send:f}=Fj(),[h,p]=m.useState(!1),[v,j]=m.useState(!1),[k,g]=m.useState(""),[x,b]=m.useState("auto"),[y,T]=m.useState("auto"),[_,E]=m.useState(""),[D,O]=m.useState(""),[R,X]=m.useState(""),[K,P]=m.useState(""),[z,A]=m.useState(""),[C,M]=m.useState(""),[V,J]=m.useState(""),[ne,Se]=m.useState("auto"),[le,B]=m.useState(""),[w,Z]=m.useState(""),[q,ae]=m.useState(""),[re,G]=m.useState(0),F=m.useCallback(Y=>{Y&&(a==null||a(Y))},[a]),$e=m.useCallback(async()=>{if(!k.trim()||!e)return;let Y=t;if(!Y)try{const me=await e.sessionList();Array.isArray(me)&&me.length>0&&(Y=me[0].id)}catch{}await u({sessionId:Y||"",prompt:k.trim(),provider:_||void 0,mode:x!=="auto"?x:void 0,effort:y!=="auto"?y:void 0,model:D||void 0}),g(""),p(!1),E("")},[k,x,y,_,D,t,e,u]),Ge=m.useCallback(async()=>{if(!e||!R.trim()||!K||!z){B("Please fill in prompt and date/time");return}B("");const Y=`${K}T${z}:00`;try{await e.taskSchedule({instruction:R.trim(),scheduled_at:Y,provider:C||void 0,model:V||void 0,effort:ne!=="auto"?ne:void 0}),X(""),P(""),A(""),j(!1)}catch(me){B(me instanceof Error?me.message:"Failed to schedule task")}},[R,K,z,C,V,ne,e]),At=m.useCallback(async()=>{!w||!q.trim()||(await f(w,q.trim()),ae(""))},[w,q,f]),fe=Array.from(s.values()).sort((Y,me)=>(me.startedAt||0)-(Y.startedAt||0)),Ue=fe.filter(Y=>Y.status==="done"||Y.status==="error"||Y.status==="cancelled"),oe=Ue.slice(re*10,(re+1)*10);return i.jsxs("div",{className:`flex-1 overflow-y-auto p-4 md:p-7 scrollbar-thin ${n||""}`,children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-6",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-base font-semibold text-fg tracking-tight",children:"Agents"}),i.jsx("p",{className:"text-[11.5px] text-muted mt-0.5",children:"Parallel subagent orchestration and monitoring."})]}),i.jsxs("div",{className:"flex gap-2 self-start sm:self-auto",children:[i.jsx("button",{onClick:()=>j(!v),className:`text-xs font-medium border rounded-[8px] px-4 py-2 transition-colors select-none ${v?"bg-blue/15 text-blue border-blue/30":"bg-s2 text-muted border-b1 hover:text-fg"}`,children:"Schedule"}),i.jsx("button",{onClick:()=>p(!h),className:"text-xs font-medium bg-green/10 text-green border border-green/20 rounded-[8px] px-4 py-2 hover:bg-green/20 transition-colors duration-150 select-none",children:h?"Cancel":"+ Spawn Agent"})]})]}),h&&i.jsx("div",{className:"bg-s1 border border-b1 rounded-[10px] p-5 mb-6 animate-in",children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx("textarea",{className:"bg-s2 border border-b1 rounded-[8px] p-3 text-[13px] text-fg font-mino resize-y min-h-[60px] focus:border-fg/30 outline-none transition-colors duration-150",placeholder:"What should the subagent do?",value:k,onChange:Y=>g(Y.target.value),onKeyDown:Y=>{Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),$e())}}),i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[i.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:x,onChange:Y=>b(Y.target.value),children:[i.jsx("option",{value:"auto",children:"Mode: inherit"}),i.jsx("option",{value:"plan",children:"Mode: plan"}),i.jsx("option",{value:"edit",children:"Mode: edit"}),i.jsx("option",{value:"auto",children:"Mode: auto"}),i.jsx("option",{value:"yolo",children:"Mode: yolo"})]}),i.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:y,onChange:Y=>T(Y.target.value),children:[i.jsx("option",{value:"auto",children:"Effort: inherit"}),i.jsx("option",{value:"low",children:"Effort: low"}),i.jsx("option",{value:"medium",children:"Effort: medium"}),i.jsx("option",{value:"high",children:"Effort: high"}),i.jsx("option",{value:"max",children:"Effort: max"})]}),i.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:_,onChange:Y=>E(Y.target.value),children:[i.jsx("option",{value:"",children:"Provider: inherit"}),i.jsx("option",{value:"anthropic",children:"Anthropic"}),i.jsx("option",{value:"openai",children:"OpenAI"}),i.jsx("option",{value:"google",children:"Google"}),i.jsx("option",{value:"ollama",children:"Ollama"}),i.jsx("option",{value:"openrouter",children:"OpenRouter"})]}),i.jsx("input",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none font-mono",placeholder:"Model override (optional)",value:D,onChange:Y=>O(Y.target.value)}),i.jsx("button",{onClick:$e,disabled:!k.trim(),className:"bg-green/20 text-green border border-green/30 rounded-[8px] px-4 py-2 text-xs font-medium hover:bg-green/30 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:"Spawn"})]})]})}),v&&i.jsx("div",{className:"bg-s1 border border-b1 rounded-[10px] p-5 mb-6 animate-in",children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx("textarea",{className:"bg-s2 border border-b1 rounded-[8px] p-3 text-[13px] text-fg font-mino resize-y min-h-[60px] focus:border-fg/30 outline-none transition-colors duration-150",placeholder:"What should the scheduled agent do?",value:R,onChange:Y=>X(Y.target.value)}),i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[i.jsx("input",{type:"date",className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:K,onChange:Y=>P(Y.target.value)}),i.jsx("input",{type:"time",className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:z,onChange:Y=>A(Y.target.value)}),i.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:ne,onChange:Y=>Se(Y.target.value),children:[i.jsx("option",{value:"auto",children:"Effort: auto"}),i.jsx("option",{value:"low",children:"Effort: low"}),i.jsx("option",{value:"medium",children:"Effort: medium"}),i.jsx("option",{value:"high",children:"Effort: high"}),i.jsx("option",{value:"max",children:"Effort: max"})]}),i.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:C,onChange:Y=>M(Y.target.value),children:[i.jsx("option",{value:"",children:"Provider: inherit"}),i.jsx("option",{value:"anthropic",children:"Anthropic"}),i.jsx("option",{value:"openai",children:"OpenAI"}),i.jsx("option",{value:"google",children:"Google"}),i.jsx("option",{value:"ollama",children:"Ollama"}),i.jsx("option",{value:"openrouter",children:"OpenRouter"})]}),i.jsx("input",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none font-mono col-span-2 md:col-span-4",placeholder:"Model override (optional)",value:V,onChange:Y=>J(Y.target.value)})]}),le&&i.jsx("div",{className:"text-[11px] text-red bg-red/5 rounded-[6px] p-2",children:le}),i.jsx("button",{onClick:Ge,disabled:!R.trim()||!K||!z,className:"bg-blue/20 text-blue border border-blue/30 rounded-[8px] px-4 py-2 text-xs font-medium hover:bg-blue/30 transition-colors disabled:opacity-40 disabled:cursor-not-allowed self-start",children:"Schedule Agent"})]})}),i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[i.jsx(uo,{label:"Running",value:String(r.length),color:"text-yellow"}),i.jsx(uo,{label:"Completed",value:String(o.length),color:"text-green"}),i.jsx(uo,{label:"Failed",value:String(c.length),color:"text-red"}),i.jsx(uo,{label:"Total Tokens",value:un(fe.reduce((Y,me)=>Y+me.inputTokens+me.outputTokens,0)),color:"text-fg"})]}),r.length>0&&i.jsxs("div",{className:"mb-6",children:[i.jsx("h3",{className:"text-[11px] font-semibold text-text2 uppercase tracking-wider mb-3",children:"Live Agents"}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:r.map(Y=>i.jsx(ik,{agent:Y,onCancel:()=>d(Y.agentId),onOpen:()=>{F(Y.sessionId)}},Y.agentId))})]}),Ue.length>0&&i.jsxs("div",{className:"mb-6",children:[i.jsx("h3",{className:"text-[11px] font-semibold text-text2 uppercase tracking-wider mb-3",children:"History"}),i.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] overflow-hidden",children:[i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-[12px]",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"text-left text-xs text-muted border-b border-b1 font-mono text-[10px]",children:[i.jsx("th",{className:"px-4 py-2 font-medium",children:"STATUS"}),i.jsx("th",{className:"px-4 py-2 font-medium",children:"PROVIDER"}),i.jsx("th",{className:"px-4 py-2 font-medium",children:"PROMPT"}),i.jsx("th",{className:"px-4 py-2 font-medium",children:"DURATION"}),i.jsx("th",{className:"px-4 py-2 font-medium",children:"TOOLS"}),i.jsx("th",{className:"px-4 py-2 font-medium text-right",children:"TOKENS"})]})}),i.jsx("tbody",{children:oe.map(Y=>{const me=Y.status==="done"?"text-green":Y.status==="cancelled"?"text-muted2":"text-red",yt=Y.doneAt?jh(Y.doneAt-Y.startedAt):"-",Bt=Y.inputTokens+Y.outputTokens;return i.jsxs("tr",{className:"hover:bg-s2/30 transition-colors cursor-pointer border-b border-b1/40",title:"Open session in Assistant",onClick:()=>{F(Y.sessionId)},children:[i.jsx("td",{className:"px-4 py-2.5",children:i.jsx("span",{className:`text-[10px] font-mono px-2 py-0.5 rounded-[4px] ${me==="text-green"?"bg-green/10":me==="text-red"?"bg-red/10":"bg-muted/10"}`,children:Y.status})}),i.jsx("td",{className:"px-4 py-2.5 text-muted font-mono text-[11.5px]",children:Y.provider||"-"}),i.jsx("td",{className:"px-4 py-2.5 text-fg truncate max-w-[200px]",title:Y.prompt,children:Y.prompt}),i.jsx("td",{className:"px-4 py-2.5 text-muted font-mono",children:yt}),i.jsx("td",{className:"px-4 py-2.5 text-muted font-mono",children:Y.toolCalls}),i.jsx("td",{className:"px-4 py-2.5 text-right font-mono text-muted",children:Bt>0?un(Bt):"-"})]},Y.agentId)})})]})}),Ue.length>10&&i.jsxs("div",{className:"flex items-center justify-center gap-4 py-2 border-t border-b1",children:[i.jsx("button",{className:"text-xs text-muted hover:text-fg transition-colors disabled:opacity-30",disabled:re===0,onClick:()=>G(Y=>Y-1),children:"Prev"}),i.jsxs("span",{className:"text-[10px] text-muted font-mono",children:[re+1," / ",Math.ceil(Ue.length/10)]}),i.jsx("button",{className:"text-xs text-muted hover:text-fg transition-colors disabled:opacity-30",disabled:(re+1)*10>=Ue.length,onClick:()=>G(Y=>Y+1),children:"Next"})]})]})]}),r.length>0&&i.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] p-4 mb-6",children:[i.jsx("h3",{className:"text-[11px] font-semibold text-text2 uppercase tracking-wider mb-3",children:"Send Message to Agent"}),i.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[i.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none flex-[0.5]",value:w,onChange:Y=>Z(Y.target.value),children:[i.jsx("option",{value:"",children:"Select agent..."}),r.map(Y=>i.jsxs("option",{value:Y.agentId,children:[Y.prompt.slice(0,40),Y.prompt.length>40?"...":""]},Y.agentId))]}),i.jsx("input",{className:"flex-1 bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",placeholder:"Type a message to inject into the agent...",value:q,onChange:Y=>ae(Y.target.value),onKeyDown:Y=>{Y.key==="Enter"&&At()}}),i.jsx("button",{onClick:At,disabled:!w||!q.trim(),className:"bg-fg/10 text-fg border border-fg/20 rounded-[8px] px-4 py-2 text-xs font-medium hover:bg-fg/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:"Send"})]})]}),i.jsx(sk,{ws:l})]})}function uo({label:e,value:t,color:n}){return i.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] px-5 py-4 flex flex-col justify-between select-none",children:[i.jsx("span",{className:"text-[10px] font-semibold text-muted uppercase tracking-wider",children:e}),i.jsx("div",{className:`text-2xl font-bold tracking-tight leading-none mt-1 ${n}`,children:t})]})}function ik({agent:e,onCancel:t,onOpen:n}){const a=Date.now()-e.startedAt,l=e.inputTokens+e.outputTokens,s=e.status==="running"?"text-yellow":"text-green";return i.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] p-4 hover:border-b2 transition-colors cursor-pointer select-none",title:"Open session in Assistant",onClick:n,children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("div",{className:`w-[6px] h-[6px] rounded-full shrink-0 ${e.status==="running"?"bg-yellow animate-pulse":"bg-green"}`}),i.jsx("span",{className:"text-[12.5px] font-medium text-fg truncate flex-1",children:e.prompt}),i.jsx("span",{className:"text-[9px] font-mono bg-s3 px-1.5 py-0.5 rounded-[3px] text-muted shrink-0",children:e.provider}),i.jsx("span",{className:`text-[10px] font-mono ${s}`,children:e.status}),e.status==="running"&&i.jsx("button",{className:"text-[10px] text-red/70 hover:text-red font-mono shrink-0",onClick:r=>{r.stopPropagation(),t()},children:"Cancel"})]}),i.jsxs("div",{className:"text-[10.5px] text-muted font-mono mb-2",children:[jh(a)," · ",e.toolCalls," tools · ",un(l)," tok"]}),e.text&&i.jsx("div",{className:"text-[11px] text-text2 line-clamp-2 font-mono leading-relaxed",children:e.text.slice(-200)})]})}function ok(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.useMemo(()=>a=>{t.forEach(l=>l(a))},t)}const Xc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function nr(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function _h(e){return"nodeType"in e}function Ut(e){var t,n;return e?nr(e)?e:_h(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Nh(e){const{Document:t}=Ut(e);return e instanceof t}function Ai(e){return nr(e)?!1:e instanceof Ut(e).HTMLElement}function Nv(e){return e instanceof Ut(e).SVGElement}function ar(e){return e?nr(e)?e.document:_h(e)?Nh(e)?e:Ai(e)||Nv(e)?e.ownerDocument:document:document:document}const Yn=Xc?m.useLayoutEffect:m.useEffect;function Vc(e){const t=m.useRef(e);return Yn(()=>{t.current=e}),m.useCallback(function(){for(var n=arguments.length,a=new Array(n),l=0;l<n;l++)a[l]=arguments[l];return t.current==null?void 0:t.current(...a)},[])}function ck(){const e=m.useRef(null),t=m.useCallback((a,l)=>{e.current=setInterval(a,l)},[]),n=m.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function fi(e,t){t===void 0&&(t=[e]);const n=m.useRef(e);return Yn(()=>{n.current!==e&&(n.current=e)},t),n}function zi(e,t){const n=m.useRef();return m.useMemo(()=>{const a=e(n.current);return n.current=a,a},[...t])}function gc(e){const t=Vc(e),n=m.useRef(null),a=m.useCallback(l=>{l!==n.current&&(t==null||t(l,n.current)),n.current=l},[]);return[n,a]}function xc(e){const t=m.useRef();return m.useEffect(()=>{t.current=e},[e]),t.current}let Ju={};function Ci(e,t){return m.useMemo(()=>{if(t)return t;const n=Ju[e]==null?0:Ju[e]+1;return Ju[e]=n,e+"-"+n},[e,t])}function Tv(e){return function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),l=1;l<n;l++)a[l-1]=arguments[l];return a.reduce((s,r)=>{const o=Object.entries(r);for(const[c,u]of o){const d=s[c];d!=null&&(s[c]=d+e*u)}return s},{...t})}}const Os=Tv(1),yc=Tv(-1);function uk(e){return"clientX"in e&&"clientY"in e}function Qc(e){if(!e)return!1;const{KeyboardEvent:t}=Ut(e.target);return t&&e instanceof t}function dk(e){if(!e)return!1;const{TouchEvent:t}=Ut(e.target);return t&&e instanceof t}function bc(e){if(dk(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return uk(e)?{x:e.clientX,y:e.clientY}:null}const fl=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[fl.Translate.toString(e),fl.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:a}=e;return t+" "+n+"ms "+a}}}),og="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function fk(e){return e.matches(og)?e:e.querySelector(og)}const hk={display:"none"};function pk(e){let{id:t,value:n}=e;return Ie.createElement("div",{id:t,style:hk},n)}function mk(e){let{id:t,announcement:n,ariaLiveType:a="assertive"}=e;const l={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Ie.createElement("div",{id:t,style:l,role:"status","aria-live":a,"aria-atomic":!0},n)}function gk(){const[e,t]=m.useState("");return{announce:m.useCallback(a=>{a!=null&&t(a)},[]),announcement:e}}const Ev=m.createContext(null);function xk(e){const t=m.useContext(Ev);m.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function yk(){const[e]=m.useState(()=>new Set),t=m.useCallback(a=>(e.add(a),()=>e.delete(a)),[e]);return[m.useCallback(a=>{let{type:l,event:s}=a;e.forEach(r=>{var o;return(o=r[l])==null?void 0:o.call(r,s)})},[e]),t]}const bk={draggable:`
|
|
142
|
+
To pick up a draggable item, press the space bar.
|
|
143
|
+
While dragging, use the arrow keys to move the item.
|
|
144
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
145
|
+
`},vk={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Sk(e){let{announcements:t=vk,container:n,hiddenTextDescribedById:a,screenReaderInstructions:l=bk}=e;const{announce:s,announcement:r}=gk(),o=Ci("DndLiveRegion"),[c,u]=m.useState(!1);if(m.useEffect(()=>{u(!0)},[]),xk(m.useMemo(()=>({onDragStart(f){let{active:h}=f;s(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;t.onDragMove&&s(t.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;s(t.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;s(t.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;s(t.onDragCancel({active:h,over:p}))}}),[s,t])),!c)return null;const d=Ie.createElement(Ie.Fragment,null,Ie.createElement(pk,{id:a,value:l.draggable}),Ie.createElement(mk,{id:o,announcement:r}));return n?Cl.createPortal(d,n):d}var ct;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(ct||(ct={}));function vc(){}function cg(e,t){return m.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function wk(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.useMemo(()=>[...t].filter(a=>a!=null),[...t])}const In=Object.freeze({x:0,y:0});function jk(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function kk(e,t){const n=bc(e);if(!n)return"0 0";const a={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return a.x+"% "+a.y+"%"}function _k(e,t){let{data:{value:n}}=e,{data:{value:a}}=t;return n-a}function Nk(e,t){let{data:{value:n}}=e,{data:{value:a}}=t;return a-n}function ug(e){let{left:t,top:n,height:a,width:l}=e;return[{x:t,y:n},{x:t+l,y:n},{x:t,y:n+a},{x:t+l,y:n+a}]}function Tk(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const Ek=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const l=ug(t),s=[];for(const r of a){const{id:o}=r,c=n.get(o);if(c){const u=ug(c),d=l.reduce((h,p,v)=>h+jk(u[v],p),0),f=Number((d/4).toFixed(4));s.push({id:o,data:{droppableContainer:r,value:f}})}}return s.sort(_k)};function Ak(e,t){const n=Math.max(t.top,e.top),a=Math.max(t.left,e.left),l=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),r=l-a,o=s-n;if(a<l&&n<s){const c=t.width*t.height,u=e.width*e.height,d=r*o,f=d/(c+u-d);return Number(f.toFixed(4))}return 0}const zk=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const l=[];for(const s of a){const{id:r}=s,o=n.get(r);if(o){const c=Ak(o,t);c>0&&l.push({id:r,data:{droppableContainer:s,value:c}})}}return l.sort(Nk)};function Ck(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Av(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:In}function Ok(e){return function(n){for(var a=arguments.length,l=new Array(a>1?a-1:0),s=1;s<a;s++)l[s-1]=arguments[s];return l.reduce((r,o)=>({...r,top:r.top+e*o.y,bottom:r.bottom+e*o.y,left:r.left+e*o.x,right:r.right+e*o.x}),{...n})}}const Dk=Ok(1);function zv(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Mk(e,t,n){const a=zv(t);if(!a)return e;const{scaleX:l,scaleY:s,x:r,y:o}=a,c=e.left-r-(1-l)*parseFloat(n),u=e.top-o-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),d=l?e.width/l:e.width,f=s?e.height/s:e.height;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c}}const Rk={ignoreTransform:!1};function lr(e,t){t===void 0&&(t=Rk);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=Ut(e).getComputedStyle(e);u&&(n=Mk(n,u,d))}const{top:a,left:l,width:s,height:r,bottom:o,right:c}=n;return{top:a,left:l,width:s,height:r,bottom:o,right:c}}function dg(e){return lr(e,{ignoreTransform:!0})}function Lk(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function $k(e,t){return t===void 0&&(t=Ut(e).getComputedStyle(e)),t.position==="fixed"}function Uk(e,t){t===void 0&&(t=Ut(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(l=>{const s=t[l];return typeof s=="string"?n.test(s):!1})}function Th(e,t){const n=[];function a(l){if(t!=null&&n.length>=t||!l)return n;if(Nh(l)&&l.scrollingElement!=null&&!n.includes(l.scrollingElement))return n.push(l.scrollingElement),n;if(!Ai(l)||Nv(l)||n.includes(l))return n;const s=Ut(e).getComputedStyle(l);return l!==e&&Uk(l,s)&&n.push(l),$k(l,s)?n:a(l.parentNode)}return e?a(e):n}function Cv(e){const[t]=Th(e,1);return t??null}function Wu(e){return!Xc||!e?null:nr(e)?e:_h(e)?Nh(e)||e===ar(e).scrollingElement?window:Ai(e)?e:null:null}function Ov(e){return nr(e)?e.scrollX:e.scrollLeft}function Dv(e){return nr(e)?e.scrollY:e.scrollTop}function sf(e){return{x:Ov(e),y:Dv(e)}}var pt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(pt||(pt={}));function Mv(e){return!Xc||!e?!1:e===document.scrollingElement}function Rv(e){const t={x:0,y:0},n=Mv(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},l=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,r=e.scrollTop>=a.y,o=e.scrollLeft>=a.x;return{isTop:l,isLeft:s,isBottom:r,isRight:o,maxScroll:a,minScroll:t}}const Bk={x:.2,y:.2};function Zk(e,t,n,a,l){let{top:s,left:r,right:o,bottom:c}=n;a===void 0&&(a=10),l===void 0&&(l=Bk);const{isTop:u,isBottom:d,isLeft:f,isRight:h}=Rv(e),p={x:0,y:0},v={x:0,y:0},j={height:t.height*l.y,width:t.width*l.x};return!u&&s<=t.top+j.height?(p.y=pt.Backward,v.y=a*Math.abs((t.top+j.height-s)/j.height)):!d&&c>=t.bottom-j.height&&(p.y=pt.Forward,v.y=a*Math.abs((t.bottom-j.height-c)/j.height)),!h&&o>=t.right-j.width?(p.x=pt.Forward,v.x=a*Math.abs((t.right-j.width-o)/j.width)):!f&&r<=t.left+j.width&&(p.x=pt.Backward,v.x=a*Math.abs((t.left+j.width-r)/j.width)),{direction:p,speed:v}}function Hk(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:r}=window;return{top:0,left:0,right:s,bottom:r,width:s,height:r}}const{top:t,left:n,right:a,bottom:l}=e.getBoundingClientRect();return{top:t,left:n,right:a,bottom:l,width:e.clientWidth,height:e.clientHeight}}function Lv(e){return e.reduce((t,n)=>Os(t,sf(n)),In)}function qk(e){return e.reduce((t,n)=>t+Ov(n),0)}function Gk(e){return e.reduce((t,n)=>t+Dv(n),0)}function $v(e,t){if(t===void 0&&(t=lr),!e)return;const{top:n,left:a,bottom:l,right:s}=t(e);Cv(e)&&(l<=0||s<=0||n>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Yk=[["x",["left","right"],qk],["y",["top","bottom"],Gk]];class Eh{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const a=Th(n),l=Lv(a);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,r,o]of Yk)for(const c of r)Object.defineProperty(this,c,{get:()=>{const u=o(a),d=l[s]-u;return this.rect[c]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Kr{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var a;return(a=this.target)==null?void 0:a.removeEventListener(...n)})},this.target=t}add(t,n,a){var l;(l=this.target)==null||l.addEventListener(t,n,a),this.listeners.push([t,n,a])}}function Ik(e){const{EventTarget:t}=Ut(e);return e instanceof t?e:ar(e)}function Fu(e,t){const n=Math.abs(e.x),a=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+a**2)>t:"x"in t&&"y"in t?n>t.x&&a>t.y:"x"in t?n>t.x:"y"in t?a>t.y:!1}var wn;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(wn||(wn={}));function fg(e){e.preventDefault()}function Xk(e){e.stopPropagation()}var we;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(we||(we={}));const Uv={start:[we.Space,we.Enter],cancel:[we.Esc],end:[we.Space,we.Enter,we.Tab]},Vk=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case we.Right:return{...n,x:n.x+25};case we.Left:return{...n,x:n.x-25};case we.Down:return{...n,y:n.y+25};case we.Up:return{...n,y:n.y-25}}};class Ah{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Kr(ar(n)),this.windowListeners=new Kr(Ut(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(wn.Resize,this.handleCancel),this.windowListeners.add(wn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(wn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,a=t.node.current;a&&$v(a),n(In)}handleKeyDown(t){if(Qc(t)){const{active:n,context:a,options:l}=this.props,{keyboardCodes:s=Uv,coordinateGetter:r=Vk,scrollBehavior:o="smooth"}=l,{code:c}=t;if(s.end.includes(c)){this.handleEnd(t);return}if(s.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=a.current,d=u?{x:u.left,y:u.top}:In;this.referenceCoordinates||(this.referenceCoordinates=d);const f=r(t,{active:n,context:a.current,currentCoordinates:d});if(f){const h=yc(f,d),p={x:0,y:0},{scrollableAncestors:v}=a.current;for(const j of v){const k=t.code,{isTop:g,isRight:x,isLeft:b,isBottom:y,maxScroll:T,minScroll:_}=Rv(j),E=Hk(j),D={x:Math.min(k===we.Right?E.right-E.width/2:E.right,Math.max(k===we.Right?E.left:E.left+E.width/2,f.x)),y:Math.min(k===we.Down?E.bottom-E.height/2:E.bottom,Math.max(k===we.Down?E.top:E.top+E.height/2,f.y))},O=k===we.Right&&!x||k===we.Left&&!b,R=k===we.Down&&!y||k===we.Up&&!g;if(O&&D.x!==f.x){const X=j.scrollLeft+h.x,K=k===we.Right&&X<=T.x||k===we.Left&&X>=_.x;if(K&&!h.y){j.scrollTo({left:X,behavior:o});return}K?p.x=j.scrollLeft-X:p.x=k===we.Right?j.scrollLeft-T.x:j.scrollLeft-_.x,p.x&&j.scrollBy({left:-p.x,behavior:o});break}else if(R&&D.y!==f.y){const X=j.scrollTop+h.y,K=k===we.Down&&X<=T.y||k===we.Up&&X>=_.y;if(K&&!h.x){j.scrollTo({top:X,behavior:o});return}K?p.y=j.scrollTop-X:p.y=k===we.Down?j.scrollTop-T.y:j.scrollTop-_.y,p.y&&j.scrollBy({top:-p.y,behavior:o});break}}this.handleMove(t,Os(yc(f,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:a}=this.props;t.preventDefault(),a(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Ah.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:a=Uv,onActivation:l}=t,{active:s}=n;const{code:r}=e.nativeEvent;if(a.start.includes(r)){const o=s.activatorNode.current;return o&&e.target!==o?!1:(e.preventDefault(),l==null||l({event:e.nativeEvent}),!0)}return!1}}];function hg(e){return!!(e&&"distance"in e)}function pg(e){return!!(e&&"delay"in e)}class zh{constructor(t,n,a){var l;a===void 0&&(a=Ik(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:r}=s;this.props=t,this.events=n,this.document=ar(r),this.documentListeners=new Kr(this.document),this.listeners=new Kr(a),this.windowListeners=new Kr(Ut(r)),this.initialCoordinates=(l=bc(s))!=null?l:In,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:a}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(wn.Resize,this.handleCancel),this.windowListeners.add(wn.DragStart,fg),this.windowListeners.add(wn.VisibilityChange,this.handleCancel),this.windowListeners.add(wn.ContextMenu,fg),this.documentListeners.add(wn.Keydown,this.handleKeydown),n){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(pg(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(hg(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:a,onPending:l}=this.props;l(a,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(wn.Click,Xk,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(wn.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:a,initialCoordinates:l,props:s}=this,{onMove:r,options:{activationConstraint:o}}=s;if(!l)return;const c=(n=bc(t))!=null?n:In,u=yc(l,c);if(!a&&o){if(hg(o)){if(o.tolerance!=null&&Fu(u,o.tolerance))return this.handleCancel();if(Fu(u,o.distance))return this.handleStart()}if(pg(o)&&Fu(u,o.tolerance))return this.handleCancel();this.handlePending(o,u);return}t.cancelable&&t.preventDefault(),r(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===we.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Qk={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Ch extends zh{constructor(t){const{event:n}=t,a=ar(n.target);super(t,Qk,a)}}Ch.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return!n.isPrimary||n.button!==0?!1:(a==null||a({event:n}),!0)}}];const Kk={move:{name:"mousemove"},end:{name:"mouseup"}};var rf;(function(e){e[e.RightClick=2]="RightClick"})(rf||(rf={}));class Jk extends zh{constructor(t){super(t,Kk,ar(t.event.target))}}Jk.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return n.button===rf.RightClick?!1:(a==null||a({event:n}),!0)}}];const Pu={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Wk extends zh{constructor(t){super(t,Pu)}static setup(){return window.addEventListener(Pu.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Pu.move.name,t)};function t(){}}}Wk.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;const{touches:l}=n;return l.length>1?!1:(a==null||a({event:n}),!0)}}];var Jr;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Jr||(Jr={}));var Sc;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Sc||(Sc={}));function Fk(e){let{acceleration:t,activator:n=Jr.Pointer,canScroll:a,draggingRect:l,enabled:s,interval:r=5,order:o=Sc.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:h}=e;const p=e_({delta:f,disabled:!s}),[v,j]=ck(),k=m.useRef({x:0,y:0}),g=m.useRef({x:0,y:0}),x=m.useMemo(()=>{switch(n){case Jr.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Jr.DraggableRect:return l}},[n,l,c]),b=m.useRef(null),y=m.useCallback(()=>{const _=b.current;if(!_)return;const E=k.current.x*g.current.x,D=k.current.y*g.current.y;_.scrollBy(E,D)},[]),T=m.useMemo(()=>o===Sc.TreeOrder?[...u].reverse():u,[o,u]);m.useEffect(()=>{if(!s||!u.length||!x){j();return}for(const _ of T){if((a==null?void 0:a(_))===!1)continue;const E=u.indexOf(_),D=d[E];if(!D)continue;const{direction:O,speed:R}=Zk(_,D,x,t,h);for(const X of["x","y"])p[X][O[X]]||(R[X]=0,O[X]=0);if(R.x>0||R.y>0){j(),b.current=_,v(y,r),k.current=R,g.current=O;return}}k.current={x:0,y:0},g.current={x:0,y:0},j()},[t,y,a,j,s,r,JSON.stringify(x),JSON.stringify(p),v,u,T,d,JSON.stringify(h)])}const Pk={x:{[pt.Backward]:!1,[pt.Forward]:!1},y:{[pt.Backward]:!1,[pt.Forward]:!1}};function e_(e){let{delta:t,disabled:n}=e;const a=xc(t);return zi(l=>{if(n||!a||!l)return Pk;const s={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return{x:{[pt.Backward]:l.x[pt.Backward]||s.x===-1,[pt.Forward]:l.x[pt.Forward]||s.x===1},y:{[pt.Backward]:l.y[pt.Backward]||s.y===-1,[pt.Forward]:l.y[pt.Forward]||s.y===1}}},[n,t,a])}function t_(e,t){const n=t!=null?e.get(t):void 0,a=n?n.node.current:null;return zi(l=>{var s;return t==null?null:(s=a??l)!=null?s:null},[a,t])}function n_(e,t){return m.useMemo(()=>e.reduce((n,a)=>{const{sensor:l}=a,s=l.activators.map(r=>({eventName:r.eventName,handler:t(r.handler,a)}));return[...n,...s]},[]),[e,t])}var hi;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(hi||(hi={}));var of;(function(e){e.Optimized="optimized"})(of||(of={}));const mg=new Map;function a_(e,t){let{dragging:n,dependencies:a,config:l}=t;const[s,r]=m.useState(null),{frequency:o,measure:c,strategy:u}=l,d=m.useRef(e),f=k(),h=fi(f),p=m.useCallback(function(g){g===void 0&&(g=[]),!h.current&&r(x=>x===null?g:x.concat(g.filter(b=>!x.includes(b))))},[h]),v=m.useRef(null),j=zi(g=>{if(f&&!n)return mg;if(!g||g===mg||d.current!==e||s!=null){const x=new Map;for(let b of e){if(!b)continue;if(s&&s.length>0&&!s.includes(b.id)&&b.rect.current){x.set(b.id,b.rect.current);continue}const y=b.node.current,T=y?new Eh(c(y),y):null;b.rect.current=T,T&&x.set(b.id,T)}return x}return g},[e,s,n,f,c]);return m.useEffect(()=>{d.current=e},[e]),m.useEffect(()=>{f||p()},[n,f]),m.useEffect(()=>{s&&s.length>0&&r(null)},[JSON.stringify(s)]),m.useEffect(()=>{f||typeof o!="number"||v.current!==null||(v.current=setTimeout(()=>{p(),v.current=null},o))},[o,f,p,...a]),{droppableRects:j,measureDroppableContainers:p,measuringScheduled:s!=null};function k(){switch(u){case hi.Always:return!1;case hi.BeforeDragging:return n;default:return!n}}}function Oh(e,t){return zi(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function l_(e,t){return Oh(e,t)}function s_(e){let{callback:t,disabled:n}=e;const a=Vc(t),l=m.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(a)},[a,n]);return m.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function Kc(e){let{callback:t,disabled:n}=e;const a=Vc(t),l=m.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(a)},[n]);return m.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function r_(e){return new Eh(lr(e),e)}function gg(e,t,n){t===void 0&&(t=r_);const[a,l]=m.useState(null);function s(){l(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const d=t(e);return JSON.stringify(c)===JSON.stringify(d)?c:d})}const r=s_({callback(c){if(e)for(const u of c){const{type:d,target:f}=u;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){s();break}}}}),o=Kc({callback:s});return Yn(()=>{s(),e?(o==null||o.observe(e),r==null||r.observe(document.body,{childList:!0,subtree:!0})):(o==null||o.disconnect(),r==null||r.disconnect())},[e]),a}function i_(e){const t=Oh(e);return Av(e,t)}const xg=[];function o_(e){const t=m.useRef(e),n=zi(a=>e?a&&a!==xg&&e&&t.current&&e.parentNode===t.current.parentNode?a:Th(e):xg,[e]);return m.useEffect(()=>{t.current=e},[e]),n}function c_(e){const[t,n]=m.useState(null),a=m.useRef(e),l=m.useCallback(s=>{const r=Wu(s.target);r&&n(o=>o?(o.set(r,sf(r)),new Map(o)):null)},[]);return m.useEffect(()=>{const s=a.current;if(e!==s){r(s);const o=e.map(c=>{const u=Wu(c);return u?(u.addEventListener("scroll",l,{passive:!0}),[u,sf(u)]):null}).filter(c=>c!=null);n(o.length?new Map(o):null),a.current=e}return()=>{r(e),r(s)};function r(o){o.forEach(c=>{const u=Wu(c);u==null||u.removeEventListener("scroll",l)})}},[l,e]),m.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,r)=>Os(s,r),In):Lv(e):In,[e,t])}function yg(e,t){t===void 0&&(t=[]);const n=m.useRef(null);return m.useEffect(()=>{n.current=null},t),m.useEffect(()=>{const a=e!==In;a&&!n.current&&(n.current=e),!a&&n.current&&(n.current=null)},[e]),n.current?yc(e,n.current):In}function u_(e){m.useEffect(()=>{if(!Xc)return;const t=e.map(n=>{let{sensor:a}=n;return a.setup==null?void 0:a.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function d_(e,t){return m.useMemo(()=>e.reduce((n,a)=>{let{eventName:l,handler:s}=a;return n[l]=r=>{s(r,t)},n},{}),[e,t])}function Bv(e){return m.useMemo(()=>e?Lk(e):null,[e])}const bg=[];function f_(e,t){t===void 0&&(t=lr);const[n]=e,a=Bv(n?Ut(n):null),[l,s]=m.useState(bg);function r(){s(()=>e.length?e.map(c=>Mv(c)?a:new Eh(t(c),c)):bg)}const o=Kc({callback:r});return Yn(()=>{o==null||o.disconnect(),r(),e.forEach(c=>o==null?void 0:o.observe(c))},[e]),l}function Zv(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ai(t)?t:e}function h_(e){let{measure:t}=e;const[n,a]=m.useState(null),l=m.useCallback(u=>{for(const{target:d}of u)if(Ai(d)){a(f=>{const h=t(d);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),s=Kc({callback:l}),r=m.useCallback(u=>{const d=Zv(u);s==null||s.disconnect(),d&&(s==null||s.observe(d)),a(d?t(d):null)},[t,s]),[o,c]=gc(r);return m.useMemo(()=>({nodeRef:o,rect:n,setRef:c}),[n,o,c])}const p_=[{sensor:Ch,options:{}},{sensor:Ah,options:{}}],m_={current:{}},Ro={draggable:{measure:dg},droppable:{measure:dg,strategy:hi.WhileDragging,frequency:of.Optimized},dragOverlay:{measure:lr}};class Wr extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,a;return(n=(a=this.get(t))==null?void 0:a.node.current)!=null?n:void 0}}const g_={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Wr,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:vc},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ro,measureDroppableContainers:vc,windowRect:null,measuringScheduled:!1},Hv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:vc,draggableNodes:new Map,over:null,measureDroppableContainers:vc},Oi=m.createContext(Hv),qv=m.createContext(g_);function x_(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Wr}}}function y_(e,t){switch(t.type){case ct.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ct.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case ct.DragEnd:case ct.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ct.RegisterDroppable:{const{element:n}=t,{id:a}=n,l=new Wr(e.droppable.containers);return l.set(a,n),{...e,droppable:{...e.droppable,containers:l}}}case ct.SetDroppableDisabled:{const{id:n,key:a,disabled:l}=t,s=e.droppable.containers.get(n);if(!s||a!==s.key)return e;const r=new Wr(e.droppable.containers);return r.set(n,{...s,disabled:l}),{...e,droppable:{...e.droppable,containers:r}}}case ct.UnregisterDroppable:{const{id:n,key:a}=t,l=e.droppable.containers.get(n);if(!l||a!==l.key)return e;const s=new Wr(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function b_(e){let{disabled:t}=e;const{active:n,activatorEvent:a,draggableNodes:l}=m.useContext(Oi),s=xc(a),r=xc(n==null?void 0:n.id);return m.useEffect(()=>{if(!t&&!a&&s&&r!=null){if(!Qc(s)||document.activeElement===s.target)return;const o=l.get(r);if(!o)return;const{activatorNode:c,node:u}=o;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[c.current,u.current]){if(!d)continue;const f=fk(d);if(f){f.focus();break}}})}},[a,t,l,r,s]),null}function Gv(e,t){let{transform:n,...a}=t;return e!=null&&e.length?e.reduce((l,s)=>s({transform:l,...a}),n):n}function v_(e){return m.useMemo(()=>({draggable:{...Ro.draggable,...e==null?void 0:e.draggable},droppable:{...Ro.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Ro.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function S_(e){let{activeNode:t,measure:n,initialRect:a,config:l=!0}=e;const s=m.useRef(!1),{x:r,y:o}=typeof l=="boolean"?{x:l,y:l}:l;Yn(()=>{if(!r&&!o||!t){s.current=!1;return}if(s.current||!a)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=n(u),f=Av(d,a);if(r||(f.x=0),o||(f.y=0),s.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=Cv(u);h&&h.scrollBy({top:f.y,left:f.x})}},[t,r,o,a,n])}const Jc=m.createContext({...In,scaleX:1,scaleY:1});var Ga;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ga||(Ga={}));const w_=m.memo(function(t){var n,a,l,s;let{id:r,accessibility:o,autoScroll:c=!0,children:u,sensors:d=p_,collisionDetection:f=zk,measuring:h,modifiers:p,...v}=t;const j=m.useReducer(y_,void 0,x_),[k,g]=j,[x,b]=yk(),[y,T]=m.useState(Ga.Uninitialized),_=y===Ga.Initialized,{draggable:{active:E,nodes:D,translate:O},droppable:{containers:R}}=k,X=E!=null?D.get(E):null,K=m.useRef({initial:null,translated:null}),P=m.useMemo(()=>{var Ve;return E!=null?{id:E,data:(Ve=X==null?void 0:X.data)!=null?Ve:m_,rect:K}:null},[E,X]),z=m.useRef(null),[A,C]=m.useState(null),[M,V]=m.useState(null),J=fi(v,Object.values(v)),ne=Ci("DndDescribedBy",r),Se=m.useMemo(()=>R.getEnabled(),[R]),le=v_(h),{droppableRects:B,measureDroppableContainers:w,measuringScheduled:Z}=a_(Se,{dragging:_,dependencies:[O.x,O.y],config:le.droppable}),q=t_(D,E),ae=m.useMemo(()=>M?bc(M):null,[M]),re=Da(),G=l_(q,le.draggable.measure);S_({activeNode:E!=null?D.get(E):null,config:re.layoutShiftCompensation,initialRect:G,measure:le.draggable.measure});const F=gg(q,le.draggable.measure,G),$e=gg(q?q.parentElement:null),Ge=m.useRef({activatorEvent:null,active:null,activeNode:q,collisionRect:null,collisions:null,droppableRects:B,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),At=R.getNodeFor((n=Ge.current.over)==null?void 0:n.id),fe=h_({measure:le.dragOverlay.measure}),Ue=(a=fe.nodeRef.current)!=null?a:q,oe=_?(l=fe.rect)!=null?l:F:null,Y=!!(fe.nodeRef.current&&fe.rect),me=i_(Y?null:F),yt=Bv(Ue?Ut(Ue):null),Bt=o_(_?At??q:null),tn=f_(Bt),xl=Gv(p,{transform:{x:O.x-me.x,y:O.y-me.y,scaleX:1,scaleY:1},activatorEvent:M,active:P,activeNodeRect:F,containerNodeRect:$e,draggingNodeRect:oe,over:Ge.current.over,overlayNodeRect:fe.rect,scrollableAncestors:Bt,scrollableAncestorRects:tn,windowRect:yt}),Jl=ae?Os(ae,O):null,or=c_(Bt),Li=yg(or),Qn=yg(or,[F]),Zt=Os(xl,Li),Ht=oe?Dk(oe,xl):null,sa=P&&Ht?f({active:P,collisionRect:Ht,droppableRects:B,droppableContainers:Se,pointerCoordinates:Jl}):null,yl=Tk(sa,"id"),[nn,Wl]=m.useState(null),Ca=Y?xl:Os(xl,Qn),Fl=Ck(Ca,(s=nn==null?void 0:nn.rect)!=null?s:null,F),Oa=m.useRef(null),cr=m.useCallback((Ve,kt)=>{let{sensor:_t,options:Dn}=kt;if(z.current==null)return;const zt=D.get(z.current);if(!zt)return;const Nt=Ve.nativeEvent,Ct=new _t({active:z.current,activeNode:zt,event:Nt,options:Dn,context:Ge,onAbort(ze){if(!D.get(ze))return;const{onDragAbort:qt}=J.current,an={id:ze};qt==null||qt(an),x({type:"onDragAbort",event:an})},onPending(ze,Ot,qt,an){if(!D.get(ze))return;const{onDragPending:Ma}=J.current,bn={id:ze,constraint:Ot,initialCoordinates:qt,offset:an};Ma==null||Ma(bn),x({type:"onDragPending",event:bn})},onStart(ze){const Ot=z.current;if(Ot==null)return;const qt=D.get(Ot);if(!qt)return;const{onDragStart:an}=J.current,bl={activatorEvent:Nt,active:{id:Ot,data:qt.data,rect:K}};Cl.unstable_batchedUpdates(()=>{an==null||an(bl),T(Ga.Initializing),g({type:ct.DragStart,initialCoordinates:ze,active:Ot}),x({type:"onDragStart",event:bl}),C(Oa.current),V(Nt)})},onMove(ze){g({type:ct.DragMove,coordinates:ze})},onEnd:Mn(ct.DragEnd),onCancel:Mn(ct.DragCancel)});Oa.current=Ct;function Mn(ze){return async function(){const{active:qt,collisions:an,over:bl,scrollAdjustedTranslate:Ma}=Ge.current;let bn=null;if(qt&&Ma){const{cancelDrop:Ra}=J.current;bn={activatorEvent:Nt,active:qt,collisions:an,delta:Ma,over:bl},ze===ct.DragEnd&&typeof Ra=="function"&&await Promise.resolve(Ra(bn))&&(ze=ct.DragCancel)}z.current=null,Cl.unstable_batchedUpdates(()=>{g({type:ze}),T(Ga.Uninitialized),Wl(null),C(null),V(null),Oa.current=null;const Ra=ze===ct.DragEnd?"onDragEnd":"onDragCancel";if(bn){const vl=J.current[Ra];vl==null||vl(bn),x({type:Ra,event:bn})}})}}},[D]),$i=m.useCallback((Ve,kt)=>(_t,Dn)=>{const zt=_t.nativeEvent,Nt=D.get(Dn);if(z.current!==null||!Nt||zt.dndKit||zt.defaultPrevented)return;const Ct={active:Nt};Ve(_t,kt.options,Ct)===!0&&(zt.dndKit={capturedBy:kt.sensor},z.current=Dn,cr(_t,kt))},[D,cr]),ur=n_(d,$i);u_(d),Yn(()=>{F&&y===Ga.Initializing&&T(Ga.Initialized)},[F,y]),m.useEffect(()=>{const{onDragMove:Ve}=J.current,{active:kt,activatorEvent:_t,collisions:Dn,over:zt}=Ge.current;if(!kt||!_t)return;const Nt={active:kt,activatorEvent:_t,collisions:Dn,delta:{x:Zt.x,y:Zt.y},over:zt};Cl.unstable_batchedUpdates(()=>{Ve==null||Ve(Nt),x({type:"onDragMove",event:Nt})})},[Zt.x,Zt.y]),m.useEffect(()=>{const{active:Ve,activatorEvent:kt,collisions:_t,droppableContainers:Dn,scrollAdjustedTranslate:zt}=Ge.current;if(!Ve||z.current==null||!kt||!zt)return;const{onDragOver:Nt}=J.current,Ct=Dn.get(yl),Mn=Ct&&Ct.rect.current?{id:Ct.id,rect:Ct.rect.current,data:Ct.data,disabled:Ct.disabled}:null,ze={active:Ve,activatorEvent:kt,collisions:_t,delta:{x:zt.x,y:zt.y},over:Mn};Cl.unstable_batchedUpdates(()=>{Wl(Mn),Nt==null||Nt(ze),x({type:"onDragOver",event:ze})})},[yl]),Yn(()=>{Ge.current={activatorEvent:M,active:P,activeNode:q,collisionRect:Ht,collisions:sa,droppableRects:B,draggableNodes:D,draggingNode:Ue,draggingNodeRect:oe,droppableContainers:R,over:nn,scrollableAncestors:Bt,scrollAdjustedTranslate:Zt},K.current={initial:oe,translated:Ht}},[P,q,sa,Ht,D,Ue,oe,B,R,nn,Bt,Zt]),Fk({...re,delta:O,draggingRect:Ht,pointerCoordinates:Jl,scrollableAncestors:Bt,scrollableAncestorRects:tn});const dr=m.useMemo(()=>({active:P,activeNode:q,activeNodeRect:F,activatorEvent:M,collisions:sa,containerNodeRect:$e,dragOverlay:fe,draggableNodes:D,droppableContainers:R,droppableRects:B,over:nn,measureDroppableContainers:w,scrollableAncestors:Bt,scrollableAncestorRects:tn,measuringConfiguration:le,measuringScheduled:Z,windowRect:yt}),[P,q,F,M,sa,$e,fe,D,R,B,nn,w,Bt,tn,le,Z,yt]),fr=m.useMemo(()=>({activatorEvent:M,activators:ur,active:P,activeNodeRect:F,ariaDescribedById:{draggable:ne},dispatch:g,draggableNodes:D,over:nn,measureDroppableContainers:w}),[M,ur,P,F,g,ne,D,nn,w]);return Ie.createElement(Ev.Provider,{value:b},Ie.createElement(Oi.Provider,{value:fr},Ie.createElement(qv.Provider,{value:dr},Ie.createElement(Jc.Provider,{value:Fl},u)),Ie.createElement(b_,{disabled:(o==null?void 0:o.restoreFocus)===!1})),Ie.createElement(Sk,{...o,hiddenTextDescribedById:ne}));function Da(){const Ve=(A==null?void 0:A.autoScrollEnabled)===!1,kt=typeof c=="object"?c.enabled===!1:c===!1,_t=_&&!Ve&&!kt;return typeof c=="object"?{...c,enabled:_t}:{enabled:_t}}}),j_=m.createContext(null),vg="button",k_="Draggable";function __(e){let{id:t,data:n,disabled:a=!1,attributes:l}=e;const s=Ci(k_),{activators:r,activatorEvent:o,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:h}=m.useContext(Oi),{role:p=vg,roleDescription:v="draggable",tabIndex:j=0}=l??{},k=(c==null?void 0:c.id)===t,g=m.useContext(k?Jc:j_),[x,b]=gc(),[y,T]=gc(),_=d_(r,t),E=fi(n);Yn(()=>(f.set(t,{id:t,key:s,node:x,activatorNode:y,data:E}),()=>{const O=f.get(t);O&&O.key===s&&f.delete(t)}),[f,t]);const D=m.useMemo(()=>({role:p,tabIndex:j,"aria-disabled":a,"aria-pressed":k&&p===vg?!0:void 0,"aria-roledescription":v,"aria-describedby":d.draggable}),[a,p,j,k,v,d.draggable]);return{active:c,activatorEvent:o,activeNodeRect:u,attributes:D,isDragging:k,listeners:a?void 0:_,node:x,over:h,setNodeRef:b,setActivatorNodeRef:T,transform:g}}function Yv(){return m.useContext(qv)}const N_="Droppable",T_={timeout:25};function Iv(e){let{data:t,disabled:n=!1,id:a,resizeObserverConfig:l}=e;const s=Ci(N_),{active:r,dispatch:o,over:c,measureDroppableContainers:u}=m.useContext(Oi),d=m.useRef({disabled:n}),f=m.useRef(!1),h=m.useRef(null),p=m.useRef(null),{disabled:v,updateMeasurementsFor:j,timeout:k}={...T_,...l},g=fi(j??a),x=m.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(g.current)?g.current:[g.current]),p.current=null},k)},[k]),b=Kc({callback:x,disabled:v||!r}),y=m.useCallback((D,O)=>{b&&(O&&(b.unobserve(O),f.current=!1),D&&b.observe(D))},[b]),[T,_]=gc(y),E=fi(t);return m.useEffect(()=>{!b||!T.current||(b.disconnect(),f.current=!1,b.observe(T.current))},[T,b]),m.useEffect(()=>(o({type:ct.RegisterDroppable,element:{id:a,key:s,disabled:n,node:T,rect:h,data:E}}),()=>o({type:ct.UnregisterDroppable,key:s,id:a})),[a]),m.useEffect(()=>{n!==d.current.disabled&&(o({type:ct.SetDroppableDisabled,id:a,key:s,disabled:n}),d.current.disabled=n)},[a,s,n,o]),{active:r,rect:h,isOver:(c==null?void 0:c.id)===a,node:T,over:c,setNodeRef:_}}function E_(e){let{animation:t,children:n}=e;const[a,l]=m.useState(null),[s,r]=m.useState(null),o=xc(n);return!n&&!a&&o&&l(o),Yn(()=>{if(!s)return;const c=a==null?void 0:a.key,u=a==null?void 0:a.props.id;if(c==null||u==null){l(null);return}Promise.resolve(t(u,s)).then(()=>{l(null)})},[t,a,s]),Ie.createElement(Ie.Fragment,null,n,a?m.cloneElement(a,{ref:r}):null)}const A_={x:0,y:0,scaleX:1,scaleY:1};function z_(e){let{children:t}=e;return Ie.createElement(Oi.Provider,{value:Hv},Ie.createElement(Jc.Provider,{value:A_},t))}const C_={position:"fixed",touchAction:"none"},O_=e=>Qc(e)?"transform 250ms ease":void 0,D_=m.forwardRef((e,t)=>{let{as:n,activatorEvent:a,adjustScale:l,children:s,className:r,rect:o,style:c,transform:u,transition:d=O_}=e;if(!o)return null;const f=l?u:{...u,scaleX:1,scaleY:1},h={...C_,width:o.width,height:o.height,top:o.top,left:o.left,transform:fl.Transform.toString(f),transformOrigin:l&&a?kk(a,o):void 0,transition:typeof d=="function"?d(a):d,...c};return Ie.createElement(n,{className:r,style:h,ref:t},s)}),M_=e=>t=>{let{active:n,dragOverlay:a}=t;const l={},{styles:s,className:r}=e;if(s!=null&&s.active)for(const[o,c]of Object.entries(s.active))c!==void 0&&(l[o]=n.node.style.getPropertyValue(o),n.node.style.setProperty(o,c));if(s!=null&&s.dragOverlay)for(const[o,c]of Object.entries(s.dragOverlay))c!==void 0&&a.node.style.setProperty(o,c);return r!=null&&r.active&&n.node.classList.add(r.active),r!=null&&r.dragOverlay&&a.node.classList.add(r.dragOverlay),function(){for(const[c,u]of Object.entries(l))n.node.style.setProperty(c,u);r!=null&&r.active&&n.node.classList.remove(r.active)}},R_=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:fl.Transform.toString(t)},{transform:fl.Transform.toString(n)}]},L_={duration:250,easing:"ease",keyframes:R_,sideEffects:M_({styles:{active:{opacity:"0"}}})};function $_(e){let{config:t,draggableNodes:n,droppableContainers:a,measuringConfiguration:l}=e;return Vc((s,r)=>{if(t===null)return;const o=n.get(s);if(!o)return;const c=o.node.current;if(!c)return;const u=Zv(r);if(!u)return;const{transform:d}=Ut(r).getComputedStyle(r),f=zv(d);if(!f)return;const h=typeof t=="function"?t:U_(t);return $v(c,l.draggable.measure),h({active:{id:s,data:o.data,node:c,rect:l.draggable.measure(c)},draggableNodes:n,dragOverlay:{node:r,rect:l.dragOverlay.measure(u)},droppableContainers:a,measuringConfiguration:l,transform:f})})}function U_(e){const{duration:t,easing:n,sideEffects:a,keyframes:l}={...L_,...e};return s=>{let{active:r,dragOverlay:o,transform:c,...u}=s;if(!t)return;const d={x:o.rect.left-r.rect.left,y:o.rect.top-r.rect.top},f={scaleX:c.scaleX!==1?r.rect.width*c.scaleX/o.rect.width:1,scaleY:c.scaleY!==1?r.rect.height*c.scaleY/o.rect.height:1},h={x:c.x-d.x,y:c.y-d.y,...f},p=l({...u,active:r,dragOverlay:o,transform:{initial:c,final:h}}),[v]=p,j=p[p.length-1];if(JSON.stringify(v)===JSON.stringify(j))return;const k=a==null?void 0:a({active:r,dragOverlay:o,...u}),g=o.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(x=>{g.onfinish=()=>{k==null||k(),x()}})}}let Sg=0;function B_(e){return m.useMemo(()=>{if(e!=null)return Sg++,Sg},[e])}const Z_=Ie.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:a,style:l,transition:s,modifiers:r,wrapperElement:o="div",className:c,zIndex:u=999}=e;const{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggableNodes:v,droppableContainers:j,dragOverlay:k,over:g,measuringConfiguration:x,scrollableAncestors:b,scrollableAncestorRects:y,windowRect:T}=Yv(),_=m.useContext(Jc),E=B_(f==null?void 0:f.id),D=Gv(r,{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:k.rect,over:g,overlayNodeRect:k.rect,scrollableAncestors:b,scrollableAncestorRects:y,transform:_,windowRect:T}),O=Oh(h),R=$_({config:a,draggableNodes:v,droppableContainers:j,measuringConfiguration:x}),X=O?k.setRef:void 0;return Ie.createElement(z_,null,Ie.createElement(E_,{animation:R},f&&E?Ie.createElement(D_,{key:E,id:f.id,ref:X,as:o,activatorEvent:d,adjustScale:t,className:c,transition:s,rect:O,style:{zIndex:u,...l},transform:D},n):null))});function Xv(e,t,n){const a=e.slice();return a.splice(n<0?a.length+n:n,0,a.splice(t,1)[0]),a}function H_(e,t){return e.reduce((n,a,l)=>{const s=t.get(a);return s&&(n[l]=s),n},Array(e.length))}function fo(e){return e!==null&&e>=0}function q_(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function G_(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Vv=e=>{let{rects:t,activeIndex:n,overIndex:a,index:l}=e;const s=Xv(t,a,n),r=t[l],o=s[l];return!o||!r?null:{x:o.left-r.left,y:o.top-r.top,scaleX:o.width/r.width,scaleY:o.height/r.height}},ho={scaleX:1,scaleY:1},Y_=e=>{var t;let{activeIndex:n,activeNodeRect:a,index:l,rects:s,overIndex:r}=e;const o=(t=s[n])!=null?t:a;if(!o)return null;if(l===n){const u=s[r];return u?{x:0,y:n<r?u.top+u.height-(o.top+o.height):u.top-o.top,...ho}:null}const c=I_(s,l,n);return l>n&&l<=r?{x:0,y:-o.height-c,...ho}:l<n&&l>=r?{x:0,y:o.height+c,...ho}:{x:0,y:0,...ho}};function I_(e,t,n){const a=e[t],l=e[t-1],s=e[t+1];return a?n<t?l?a.top-(l.top+l.height):s?s.top-(a.top+a.height):0:s?s.top-(a.top+a.height):l?a.top-(l.top+l.height):0:0}const Qv="Sortable",Kv=Ie.createContext({activeIndex:-1,containerId:Qv,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Vv,disabled:{draggable:!1,droppable:!1}});function X_(e){let{children:t,id:n,items:a,strategy:l=Vv,disabled:s=!1}=e;const{active:r,dragOverlay:o,droppableRects:c,over:u,measureDroppableContainers:d}=Yv(),f=Ci(Qv,n),h=o.rect!==null,p=m.useMemo(()=>a.map(_=>typeof _=="object"&&"id"in _?_.id:_),[a]),v=r!=null,j=r?p.indexOf(r.id):-1,k=u?p.indexOf(u.id):-1,g=m.useRef(p),x=!q_(p,g.current),b=k!==-1&&j===-1||x,y=G_(s);Yn(()=>{x&&v&&d(p)},[x,p,v,d]),m.useEffect(()=>{g.current=p},[p]);const T=m.useMemo(()=>({activeIndex:j,containerId:f,disabled:y,disableTransforms:b,items:p,overIndex:k,useDragOverlay:h,sortedRects:H_(p,c),strategy:l}),[j,f,y.draggable,y.droppable,b,p,k,c,h,l]);return Ie.createElement(Kv.Provider,{value:T},t)}const V_=e=>{let{id:t,items:n,activeIndex:a,overIndex:l}=e;return Xv(n,a,l).indexOf(t)},Q_=e=>{let{containerId:t,isSorting:n,wasDragging:a,index:l,items:s,newIndex:r,previousItems:o,previousContainerId:c,transition:u}=e;return!u||!a||o!==s&&l===r?!1:n?!0:r!==l&&t===c},K_={duration:200,easing:"ease"},Jv="transform",J_=fl.Transition.toString({property:Jv,duration:0,easing:"linear"}),W_={roleDescription:"sortable"};function F_(e){let{disabled:t,index:n,node:a,rect:l}=e;const[s,r]=m.useState(null),o=m.useRef(n);return Yn(()=>{if(!t&&n!==o.current&&a.current){const c=l.current;if(c){const u=lr(a.current,{ignoreTransform:!0}),d={x:c.left-u.left,y:c.top-u.top,scaleX:c.width/u.width,scaleY:c.height/u.height};(d.x||d.y)&&r(d)}}n!==o.current&&(o.current=n)},[t,n,a,l]),m.useEffect(()=>{s&&r(null)},[s]),s}function P_(e){let{animateLayoutChanges:t=Q_,attributes:n,disabled:a,data:l,getNewIndex:s=V_,id:r,strategy:o,resizeObserverConfig:c,transition:u=K_}=e;const{items:d,containerId:f,activeIndex:h,disabled:p,disableTransforms:v,sortedRects:j,overIndex:k,useDragOverlay:g,strategy:x}=m.useContext(Kv),b=eN(a,p),y=d.indexOf(r),T=m.useMemo(()=>({sortable:{containerId:f,index:y,items:d},...l}),[f,l,y,d]),_=m.useMemo(()=>d.slice(d.indexOf(r)),[d,r]),{rect:E,node:D,isOver:O,setNodeRef:R}=Iv({id:r,data:T,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...c}}),{active:X,activatorEvent:K,activeNodeRect:P,attributes:z,setNodeRef:A,listeners:C,isDragging:M,over:V,setActivatorNodeRef:J,transform:ne}=__({id:r,data:T,attributes:{...W_,...n},disabled:b.draggable}),Se=ok(R,A),le=!!X,B=le&&!v&&fo(h)&&fo(k),w=!g&&M,Z=w&&B?ne:null,ae=B?Z??(o??x)({rects:j,activeNodeRect:P,activeIndex:h,overIndex:k,index:y}):null,re=fo(h)&&fo(k)?s({id:r,items:d,activeIndex:h,overIndex:k}):y,G=X==null?void 0:X.id,F=m.useRef({activeId:G,items:d,newIndex:re,containerId:f}),$e=d!==F.current.items,Ge=t({active:X,containerId:f,isDragging:M,isSorting:le,id:r,index:y,items:d,newIndex:F.current.newIndex,previousItems:F.current.items,previousContainerId:F.current.containerId,transition:u,wasDragging:F.current.activeId!=null}),At=F_({disabled:!Ge,index:y,node:D,rect:E});return m.useEffect(()=>{le&&F.current.newIndex!==re&&(F.current.newIndex=re),f!==F.current.containerId&&(F.current.containerId=f),d!==F.current.items&&(F.current.items=d)},[le,re,f,d]),m.useEffect(()=>{if(G===F.current.activeId)return;if(G!=null&&F.current.activeId==null){F.current.activeId=G;return}const Ue=setTimeout(()=>{F.current.activeId=G},50);return()=>clearTimeout(Ue)},[G]),{active:X,activeIndex:h,attributes:z,data:T,rect:E,index:y,newIndex:re,items:d,isOver:O,isSorting:le,isDragging:M,listeners:C,node:D,overIndex:k,over:V,setNodeRef:Se,setActivatorNodeRef:J,setDroppableNodeRef:R,setDraggableNodeRef:A,transform:At??ae,transition:fe()};function fe(){if(At||$e&&F.current.newIndex===y)return J_;if(!(w&&!Qc(K)||!u)&&(le||Ge))return fl.Transition.toString({...u,property:Jv})}}function eN(e,t){var n,a;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(a=e==null?void 0:e.droppable)!=null?a:t.droppable}}we.Down,we.Right,we.Up,we.Left;const Dh=[{id:"backlog",label:"Backlog",statuses:["backlog"],defaultStatus:"backlog"},{id:"todo",label:"To Do",statuses:["todo","pending"],defaultStatus:"todo"},{id:"in_progress",label:"In Progress",statuses:["in_progress","executing"],defaultStatus:"in_progress"},{id:"done",label:"Done",statuses:["done","completed"],defaultStatus:"done"}],wg=new Map(Dh.map(e=>[e.id,e]));function Lo(e){for(const t of Dh)if(t.statuses.includes(e))return t.id;return null}function tN(e){const t=new Map;for(const n of e){const a=Lo(n.status);a&&t.set(n.id,a)}return t}const jg=["canceled","failed"],nN={critical:"var(--red)",high:"var(--yellow)",medium:"var(--muted)",low:"var(--green)"},Mh={human:"H",agent:"A",notify:"N"};function aN({task:e}){const t=nN[e.priority]||"var(--muted)",n=e.scheduled_at?new Date(e.scheduled_at).toLocaleDateString(void 0,{month:"short",day:"numeric"}):null;return i.jsxs("div",{className:"glass-card rounded-xl p-3 mb-2 w-[256px] select-none",children:[i.jsx("div",{className:"flex items-center justify-between mb-1.5",children:i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"currentColor",className:"text-muted2",children:[i.jsx("circle",{cx:"3",cy:"2",r:"1"}),i.jsx("circle",{cx:"9",cy:"2",r:"1"}),i.jsx("circle",{cx:"3",cy:"6",r:"1"}),i.jsx("circle",{cx:"9",cy:"6",r:"1"}),i.jsx("circle",{cx:"3",cy:"10",r:"1"}),i.jsx("circle",{cx:"9",cy:"10",r:"1"})]}),i.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:t}})]})}),i.jsx("div",{className:"text-[12.5px] font-medium text-fg mb-1.5 leading-snug line-clamp-3",children:e.title}),i.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[i.jsxs("span",{className:"text-[9px] font-mono font-bold px-1 py-0.5 rounded leading-none",style:{color:"var(--muted)"},children:["[",Mh[e.mode]||"?","]"]}),e.scope==="project"&&i.jsx("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded leading-none",style:{color:"var(--muted)"},children:"proj"}),n&&i.jsx("span",{className:"text-[9px] text-muted2",children:n}),e.tags.slice(0,3).map(a=>i.jsx("span",{className:"leather-tag text-[9px] px-1.5 py-0.5 rounded-full text-muted",children:a},a)),e.tags.length>3&&i.jsxs("span",{className:"text-[9px] text-muted2",children:["+",e.tags.length-3]})]})]})}function lN({task:e,onEdit:t,onRemove:n}){const{attributes:a,listeners:l,setNodeRef:s,transform:r,isDragging:o}=P_({id:e.id,animateLayoutChanges:()=>!1}),c={transform:fl.Transform.toString(r),opacity:o?0:1};return i.jsxs("div",{ref:s,style:c,className:"cursor-grab active:cursor-grabbing",...a,...l,onClick:()=>t(e),children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("div",{}),i.jsx("button",{onClick:u=>{u.stopPropagation(),n(e.id)},className:"text-muted2 hover:text-red transition-colors p-0.5 rounded cursor-pointer",title:"Delete task",children:i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),i.jsx("div",{className:"text-[12.5px] font-medium text-fg mb-1.5 leading-snug line-clamp-3 glass-card rounded-xl p-3 mb-2",children:e.title}),i.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap px-3 pb-2",children:[i.jsxs("span",{className:"text-[9px] font-mono font-bold px-1 py-0.5 rounded leading-none",style:{color:"var(--muted)"},children:["[",Mh[e.mode]||"?","]"]}),e.scope==="project"&&i.jsx("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded leading-none",style:{color:"var(--muted)"},children:"proj"}),e.scheduled_at&&i.jsx("span",{className:"text-[9px] text-muted2",children:new Date(e.scheduled_at).toLocaleDateString(void 0,{month:"short",day:"numeric"})}),e.tags.slice(0,3).map(u=>i.jsx("span",{className:"leather-tag text-[9px] px-1.5 py-0.5 rounded-full text-muted",children:u},u)),e.tags.length>3&&i.jsxs("span",{className:"text-[9px] text-muted2",children:["+",e.tags.length-3]})]})]})}function sN({column:e,tasks:t,isDragging:n,onEdit:a,onRemove:l,className:s=""}){const{setNodeRef:r,isOver:o}=Iv({id:e.id}),c=function(u){return i.jsx(lN,{task:u,onEdit:a,onRemove:l},u.id)};return i.jsxs("div",{className:`flex flex-col h-full min-w-[260px] sm:flex-1 ${s}`,children:[i.jsx("div",{className:"flex items-center justify-between px-3 py-2.5 shrink-0",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[12px] font-semibold font-display",style:{color:"var(--gold)"},children:e.label}),i.jsx("span",{className:"text-[10px] font-mono text-muted bg-s3 px-1.5 py-0.5 rounded",children:t.length})]})}),i.jsxs("div",{ref:r,className:"flex-1 px-2 pb-2 min-h-0 relative transition-colors duration-150 rounded-xl kanban-column-scroll",style:{overflowY:n?"visible":"auto",background:o?"color-mix(in srgb, var(--gold) 8%, transparent)":"transparent"},children:[t.map(c),t.length===0&&i.jsx("div",{className:"text-center py-8 text-[11px] text-muted2 min-h-[120px] flex items-center justify-center",children:"No tasks"})]})]})}function kg({task:e,onSave:t,onClose:n}){const[a,l]=m.useState((e==null?void 0:e.title)??""),[s,r]=m.useState((e==null?void 0:e.description)??""),[o,c]=m.useState((e==null?void 0:e.priority)??"medium"),[u,d]=m.useState((e==null?void 0:e.mode)??"human"),[f,h]=m.useState((e==null?void 0:e.scope)??"personal"),[p,v]=m.useState((e==null?void 0:e.status)??"backlog"),[j,k]=m.useState(()=>{if(e!=null&&e.scheduled_at){const y=new Date(e.scheduled_at),T=y.getTimezoneOffset()*6e4;return new Date(y.getTime()-T).toISOString().slice(0,16)}return""}),[g,x]=m.useState((e==null?void 0:e.tags.join(", "))??""),b=()=>{a.trim()&&t({title:a.trim(),description:s.trim(),priority:o,mode:u,scope:f,status:p,tags:g.split(",").map(y=>y.trim()).filter(Boolean),scheduled_at:j?new Date(j).getTime():void 0})};return i.jsx("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center p-4 animate-fadeIn",style:{background:"rgba(10, 8, 5, 0.7)",backdropFilter:"blur(8px)"},onClick:n,children:i.jsxs("div",{className:"w-full max-w-[420px] rounded-2xl shadow-2xl animate-scaleIn select-none glass-card p-5",onClick:y=>y.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between pb-3 mb-4",style:{borderBottom:"1px solid var(--b1)"},children:[i.jsx("span",{className:"font-bold text-[13.5px] font-display",style:{color:"var(--cream)"},children:e?"Edit Task":"New Task"}),i.jsx("button",{onClick:n,className:"text-muted hover:text-fg transition-colors cursor-pointer",children:i.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Title"}),i.jsx("input",{type:"text",value:a,onChange:y=>l(y.target.value),className:"w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none transition-colors focus:ring-1 focus:ring-gold/30",style:{background:"var(--s2)",border:"1px solid var(--b1)"},autoFocus:!0})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Description"}),i.jsx("textarea",{value:s,onChange:y=>r(y.target.value),rows:2,className:"w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none resize-none transition-colors focus:ring-1 focus:ring-gold/30 scrollbar-thin",style:{background:"var(--s2)",border:"1px solid var(--b1)"}})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Priority"}),i.jsxs("select",{value:o,onChange:y=>c(y.target.value),className:"w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none cursor-pointer",style:{background:"var(--s2)",border:"1px solid var(--b1)"},children:[i.jsx("option",{value:"low",children:"Low"}),i.jsx("option",{value:"medium",children:"Medium"}),i.jsx("option",{value:"high",children:"High"}),i.jsx("option",{value:"critical",children:"Critical"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Mode"}),i.jsxs("select",{value:u,onChange:y=>d(y.target.value),className:"w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none cursor-pointer",style:{background:"var(--s2)",border:"1px solid var(--b1)"},children:[i.jsx("option",{value:"human",children:"Human"}),i.jsx("option",{value:"agent",children:"Agent"}),i.jsx("option",{value:"notify",children:"Notify"})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Scope"}),i.jsxs("select",{value:f,onChange:y=>h(y.target.value),className:"w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none cursor-pointer",style:{background:"var(--s2)",border:"1px solid var(--b1)"},children:[i.jsx("option",{value:"personal",children:"Personal"}),i.jsx("option",{value:"project",children:"Project"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Status"}),i.jsxs("select",{value:p,onChange:y=>v(y.target.value),className:"w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none cursor-pointer",style:{background:"var(--s2)",border:"1px solid var(--b1)"},children:[i.jsx("option",{value:"backlog",children:"Backlog"}),i.jsx("option",{value:"todo",children:"To Do"}),i.jsx("option",{value:"in_progress",children:"In Progress"}),i.jsx("option",{value:"done",children:"Done"})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Scheduled (optional)"}),i.jsx("input",{type:"datetime-local",value:j,onChange:y=>k(y.target.value),className:"w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none cursor-pointer",style:{background:"var(--s2)",border:"1px solid var(--b1)"}})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Tags (comma-separated)"}),i.jsx("input",{type:"text",value:g,onChange:y=>x(y.target.value),placeholder:"bug, feature, urgent",className:"w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none transition-colors focus:ring-1 focus:ring-gold/30",style:{background:"var(--s2)",border:"1px solid var(--b1)"}})]})]}),i.jsxs("div",{className:"flex gap-2 mt-5",children:[i.jsx("button",{onClick:n,className:"flex-1 py-2.5 px-4 rounded-xl text-[12px] font-semibold cursor-pointer transition-all duration-150 active:scale-[0.98]",style:{background:"var(--s3)",border:"1px solid var(--b1)",color:"var(--muted)"},children:"Cancel"}),i.jsx("button",{onClick:b,disabled:!a.trim(),className:"flex-1 btn-gold py-2.5 px-4 rounded-xl text-[12px] font-semibold cursor-pointer active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed",children:e?"Save":"Create"})]})]})})}function rN({rpc:e,className:t}){const{ws:n}=Vn(),[a,l]=m.useState([]),[s,r]=m.useState(!0),[o,c]=m.useState(null),[u,d]=m.useState(!1),[f,h]=m.useState(!1),[p,v]=m.useState("all"),[j,k]=m.useState("all"),[g,x]=m.useState("all"),[b,y]=m.useState(!1),T=m.useRef(null),[_,E]=m.useState({top:0,left:0}),[D,O]=m.useState(null),R=m.useCallback(async()=>{if(e)try{const w={};p!=="all"&&(w.mode=p),j!=="all"&&(w.priority=j),g!=="all"&&(w.scope=g);const Z=await e.todoList(Object.keys(w).length?w:void 0);l(Array.isArray(Z)?Z:[])}catch(w){console.error("[Kanban] Failed to fetch tasks:",w)}finally{r(!1)}},[e,p,j,g]);m.useEffect(()=>{R()},[R]),m.useEffect(()=>{if(!n)return;const w=()=>R(),Z=n.on("todo-changed",w),q=n.on("cron-task-fired",w);return()=>{Z(),q()}},[n,R]),m.useEffect(()=>{if(!b)return;const w=Z=>{Z.target.closest("[data-filter-dropdown]")||y(!1)};return document.addEventListener("click",w),()=>document.removeEventListener("click",w)},[b]);const X=m.useMemo(()=>{const w={backlog:[],todo:[],in_progress:[],done:[]};for(const Z of a){if(Z.mode==="notify")continue;const q=Lo(Z.status);q&&w[q]&&w[q].push(Z)}return Object.values(w).forEach(Z=>Z.sort((q,ae)=>q.order-ae.order)),w},[a]),K=m.useMemo(()=>a.filter(w=>jg.includes(w.status)),[a]),P=m.useMemo(()=>tN(a),[a]),z=m.useMemo(()=>{const w={backlog:[],todo:[],in_progress:[],done:[]};for(const Z of a){if(Z.mode==="notify")continue;const q=Lo(Z.status);q&&!jg.includes(Z.status)&&w[q].push(Z.id)}return w},[a]),A=wk(cg(Ch,{activationConstraint:{delay:250,tolerance:5}}),cg(Ah)),[C,M]=m.useState(!1),V=m.useCallback(w=>{M(!0),O(String(w.active.id))},[]),J=m.useCallback(()=>{M(!1),O(null)},[]),ne=m.useCallback(async w=>{const{active:Z,over:q}=w;if(!q||!e){M(!1),O(null);return}const ae=String(Z.id),re=String(q.id),G=a.find(Ue=>Ue.id===ae);if(!G){M(!1),O(null);return}if(!P.get(ae)){M(!1),O(null);return}let $e=G.status;const Ge=wg.get(re);if(Ge)$e=Ge.defaultStatus;else{const Ue=a.find(oe=>oe.id===re);if(Ue){const oe=Lo(Ue.status);oe&&($e=wg.get(oe).defaultStatus)}}if(G.status!==$e){const Ue=G.status;l(oe=>oe.map(Y=>Y.id===ae?{...Y,status:$e}:Y));try{await e.todoUpdate({id:ae,status:$e})}catch{l(oe=>oe.map(Y=>Y.id===ae?{...Y,status:Ue}:Y))}}else try{await e.todoUpdate({id:ae})}catch{}O(null),M(!1)},[e,a,P]),Se=m.useCallback(async w=>{e&&(await e.todoCreate({title:(w.title??"").trim(),description:w.description,priority:w.priority??"medium",mode:w.mode??"human",scope:w.scope??"personal",status:w.status??"backlog",tags:w.tags,scheduled_at:w.scheduled_at}),h(!1))},[e]),le=m.useCallback(async w=>{!e||!o||(await e.todoUpdate({id:o.id,...w}),c(null))},[e,o]),B=m.useCallback(async w=>{e&&await e.todoRemove(w)},[e]);return s?i.jsx("div",{className:t||"",children:i.jsx("div",{className:"flex items-center justify-center h-full text-muted text-xs",children:"Loading tasks..."})}):i.jsxs("div",{className:`flex flex-col h-full ${t||""}`,children:[i.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--b1)"},children:[i.jsx("h2",{className:"text-[13px] font-semibold font-display",style:{color:"var(--cream)"},children:"Tasks"}),i.jsxs("div",{className:"relative","data-filter-dropdown":!0,children:[i.jsx("button",{ref:T,onClick:()=>{if(!b&&T.current){const w=T.current.getBoundingClientRect(),Z=200;let q=w.left;q+Z>window.innerWidth-8&&(q=window.innerWidth-Z-8),E({top:w.bottom+4,left:Math.max(q,8)})}y(!b)},className:"p-1.5 rounded-lg cursor-pointer transition-colors",style:{background:p!=="all"||j!=="all"||g!=="all"?"var(--s3)":"transparent",border:"1px solid var(--b2)",color:"var(--muted)"},children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})})}),b&&Cl.createPortal(i.jsxs("div",{"data-filter-dropdown":!0,className:"fixed rounded-xl shadow-2xl p-3 space-y-2.5 w-[200px]",style:{top:_.top,left:_.left,background:"var(--s1)",border:"1px solid var(--b1)",zIndex:9999},children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-[9px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Mode"}),i.jsx("div",{className:"flex rounded-lg overflow-hidden",style:{border:"1px solid var(--b2)"},children:["all","human","agent","notify"].map(w=>i.jsx("button",{onClick:()=>{v(w),y(!1)},className:"flex-1 px-1.5 py-1 text-[10px] font-mono cursor-pointer transition-all",style:{color:p===w?"var(--gold)":"var(--muted)",background:p===w?"var(--s3)":"transparent"},children:w==="all"?"All":w.charAt(0).toUpperCase()+w.slice(1)},w))})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[9px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Priority"}),i.jsxs("select",{value:j,onChange:w=>{k(w.target.value),y(!1)},className:"w-full px-2 py-1 rounded-lg text-[11px] font-mono outline-none cursor-pointer",style:{background:"var(--s2)",border:"1px solid var(--b2)",color:"var(--muted)"},children:[i.jsx("option",{value:"all",children:"All"}),i.jsx("option",{value:"low",children:"Low"}),i.jsx("option",{value:"medium",children:"Medium"}),i.jsx("option",{value:"high",children:"High"}),i.jsx("option",{value:"critical",children:"Critical"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[9px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Scope"}),i.jsx("div",{className:"flex rounded-lg overflow-hidden",style:{border:"1px solid var(--b2)"},children:["all","personal","project"].map(w=>i.jsx("button",{onClick:()=>{x(w),y(!1)},className:"flex-1 px-1.5 py-1 text-[10px] font-mono cursor-pointer transition-all",style:{color:g===w?"var(--gold)":"var(--muted)",background:g===w?"var(--s3)":"transparent"},children:w==="all"?"All":w.charAt(0).toUpperCase()+w.slice(1)},w))})]})]}),document.body)]}),i.jsx("div",{className:"flex-1"}),i.jsxs("button",{onClick:()=>d(!u),className:"text-[10px] font-mono px-2 py-0.5 rounded cursor-pointer transition-all duration-150",style:{color:u?"var(--gold)":"var(--muted)",background:u?"var(--s3)":"transparent",border:"1px solid var(--b2)"},children:["Archive ",K.length]}),i.jsx("button",{onClick:()=>h(!0),className:"btn-gold px-3 py-1.5 rounded-lg text-[11px] font-semibold cursor-pointer active:scale-[0.98]",children:"Add"})]}),i.jsxs(w_,{sensors:A,collisionDetection:Ek,onDragStart:V,onDragCancel:J,onDragEnd:ne,children:[i.jsx("div",{className:"flex-1 overflow-x-auto overflow-y-hidden min-h-0 snap-x snap-mandatory sm:overflow-x-visible sm:snap-none",children:i.jsx("div",{className:"flex h-full sm:gap-4 sm:flex-row flex-nowrap sm:min-w-0",children:Dh.map(w=>i.jsx(X_,{items:z[w.id],strategy:Y_,children:i.jsx(sN,{column:w,tasks:X[w.id],isDragging:C,onEdit:c,onRemove:B,className:"snap-center flex-shrink-0 w-screen sm:w-auto sm:flex-1 px-4 sm:px-0"})},w.id))})}),i.jsx(Z_,{children:D&&i.jsx(aN,{task:a.find(w=>w.id===D)})})]}),u&&K.length>0&&i.jsxs("div",{className:"px-4 py-3 shrink-0",style:{borderTop:"1px solid var(--b1)"},children:[i.jsx("h3",{className:"text-[11px] font-semibold text-muted mb-2",children:"Archived Tasks"}),i.jsx("div",{className:"flex gap-2 flex-wrap",children:K.map(w=>i.jsxs("div",{className:"glass-card rounded-lg px-3 py-2 flex items-center gap-2",style:{opacity:.6},children:[i.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:w.status==="failed"?"var(--red)":"var(--muted2)"}}),i.jsx("span",{className:"text-[11px] text-muted line-through",children:w.title}),i.jsxs("span",{className:"text-[9px] font-mono text-muted2",children:["[",Mh[w.mode],"]"]})]},w.id))})]}),f&&i.jsx(kg,{task:null,onSave:Se,onClose:()=>h(!1)}),o&&i.jsx(kg,{task:o,onSave:le,onClose:()=>c(null)})]})}const iN="modulepreload",oN=function(e){return"/"+e},_g={},cN=function(t,n,a){let l=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),o=(r==null?void 0:r.nonce)||(r==null?void 0:r.getAttribute("nonce"));l=Promise.allSettled(n.map(c=>{if(c=oN(c),c in _g)return;_g[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":iN,u||(f.as="script"),f.crossOrigin="",f.href=c,o&&f.setAttribute("nonce",o),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(r){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=r,window.dispatchEvent(o),!o.defaultPrevented)throw r}return l.then(r=>{for(const o of r||[])o.status==="rejected"&&s(o.reason);return t().catch(s)})},uN=m.lazy(()=>cN(()=>import("./WikiGraphView-D6dbFm1b.js"),[]));function dN({rpc:e,className:t}){const{ws:n}=Vn(),[a,l]=m.useState([]),[s,r]=m.useState(!0),[o,c]=m.useState("browse"),u=m.useRef("browse");u.current=o;const[d,f]=m.useState(null),[h,p]=m.useState(null),[v,j]=m.useState(!1),[k,g]=m.useState(""),[x,b]=m.useState([]),[y,T]=m.useState(!1),[_,E]=m.useState(null),[D,O]=m.useState(!1),[R,X]=m.useState(null),[K,P]=m.useState(null),[z,A]=m.useState(!1),C=m.useCallback(async(B=!1)=>{if(e){B||A(!0);try{const w=await e.wikiGraph();P(w??{nodes:[],edges:[]})}catch{P({nodes:[],edges:[]})}finally{B||A(!1)}}},[e]),M=m.useCallback(async(B=!1)=>{if(e){B||r(!0),X(null);try{const w=await e.wikiListPages();l((w==null?void 0:w.pages)??[])}catch(w){X(w instanceof Error?w.message:"Failed to load wiki")}finally{B||r(!1)}}},[e]);m.useEffect(()=>{M()},[M]),m.useEffect(()=>{if(n)return n.on("wiki-op",()=>{M(!0),u.current==="graph"&&C(!0)})},[n,M,C]);const V=m.useCallback(async B=>{if(e){f(B),c("page"),j(!0),p(null);try{const w=await e.wikiPageGet(B);p((w==null?void 0:w.content)??(w==null?void 0:w.error)??"Empty page")}catch(w){p(w instanceof Error?w.message:"Error loading page")}finally{j(!1)}}},[e]),J=m.useCallback(async()=>{if(!(!e||!k.trim())){T(!0),b([]);try{const B=await e.wikiSearch(k);b(B??[])}finally{T(!1)}}},[e,k]),ne=m.useCallback(async()=>{if(e){c("lint"),O(!0),E(null);try{const B=await e.wikiLint();E(B??{orphanPages:[],brokenLinks:[],missingFromIndex:[],staleFrontmatter:[]})}finally{O(!1)}}},[e]),Se=a.reduce((B,w)=>{const Z=w.category||"Other";return(B[Z]??(B[Z]=[])).push(w),B},{}),le=_?_.orphanPages.length+_.brokenLinks.length+_.missingFromIndex.length+_.staleFrontmatter.length:null;return i.jsxs("div",{className:`flex flex-col h-full ${t??""}`,children:[i.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--b1)"},children:[i.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",style:{color:"var(--gold)",flexShrink:0},children:[i.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),i.jsx("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"})]}),i.jsx("span",{className:"text-[13px] font-semibold font-display",style:{color:"var(--cream)"},children:"Wiki"}),i.jsxs("span",{className:"text-[11px] font-mono",style:{color:"var(--muted)"},children:[a.length," pages"]}),i.jsx("div",{className:"flex-1"}),i.jsx("button",{onClick:()=>c("browse"),className:"px-2.5 py-1 rounded-lg text-[11px] font-semibold transition-all duration-150 cursor-pointer",style:{background:o==="browse"?"var(--s3)":"transparent",color:o==="browse"?"var(--gold)":"var(--muted)",border:o==="browse"?"1px solid var(--b2)":"1px solid transparent"},children:"Browse"}),i.jsx("button",{onClick:()=>c("search"),className:"px-2.5 py-1 rounded-lg text-[11px] font-semibold transition-all duration-150 cursor-pointer",style:{background:o==="search"?"var(--s3)":"transparent",color:o==="search"?"var(--gold)":"var(--muted)",border:o==="search"?"1px solid var(--b2)":"1px solid transparent"},children:"Search"}),i.jsxs("button",{onClick:ne,className:"px-2.5 py-1 rounded-lg text-[11px] font-semibold transition-all duration-150 cursor-pointer flex items-center gap-1",style:{background:o==="lint"?"var(--s3)":"transparent",color:o==="lint"?"var(--gold)":"var(--muted)",border:o==="lint"?"1px solid var(--b2)":"1px solid transparent"},children:["Lint",le!==null&&le>0&&i.jsx("span",{className:"rounded-full w-4 h-4 flex items-center justify-center text-[9px] font-bold",style:{background:"var(--red)",color:"#fff"},children:le})]}),i.jsx("button",{onClick:()=>{c("graph"),!K&&!z&&C()},className:"px-2.5 py-1 rounded-lg text-[11px] font-semibold transition-all duration-150 cursor-pointer",style:{background:o==="graph"?"var(--s3)":"transparent",color:o==="graph"?"var(--gold)":"var(--muted)",border:o==="graph"?"1px solid var(--b2)":"1px solid transparent"},children:"Graph"}),i.jsx("button",{onClick:()=>M(),className:"flex items-center justify-center w-7 h-7 rounded-lg transition-all duration-150 cursor-pointer",style:{color:"var(--muted)",border:"1px solid transparent"},title:"Refresh",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("polyline",{points:"23 4 23 10 17 10"}),i.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})})]}),o==="graph"&&i.jsx("div",{className:"flex-1 min-h-0",children:i.jsx(m.Suspense,{fallback:i.jsx("div",{className:"flex items-center justify-center h-full text-[11px]",style:{color:"var(--muted)"},children:"Loading graph renderer…"}),children:i.jsx(uN,{graphData:K,loading:z,onNodeClick:V})})}),i.jsxs("div",{className:`flex-1 min-h-0 overflow-y-auto px-4 py-3 scrollbar-thin${o==="graph"?" hidden":""}`,children:[o==="browse"&&i.jsxs(i.Fragment,{children:[s&&i.jsx("div",{className:"flex items-center justify-center h-32 text-xs",style:{color:"var(--muted)"},children:"Loading…"}),R&&i.jsx("div",{className:"text-xs px-3 py-2 rounded-lg",style:{background:"color-mix(in srgb, var(--red) 10%, transparent)",color:"var(--red)",border:"1px solid color-mix(in srgb, var(--red) 20%, transparent)"},children:R}),!s&&!R&&a.length===0&&i.jsxs("div",{className:"flex flex-col items-center justify-center h-48 gap-3 text-center",children:[i.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",style:{color:"var(--muted)",opacity:.4},children:[i.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),i.jsx("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[12px] font-semibold",style:{color:"var(--fg)"},children:"Wiki is empty"}),i.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--muted)"},children:"Ask the agent to ingest a document to get started"})]}),i.jsx("div",{className:"text-[10px] font-mono px-3 py-1.5 rounded-lg",style:{background:"var(--s2)",color:"var(--muted)",border:"1px solid var(--b1)"},children:"ingest plans/spec.md into the wiki"})]}),!s&&Object.entries(Se).map(([B,w])=>i.jsxs("div",{className:"mb-4",children:[i.jsx("div",{className:"text-[10px] font-mono uppercase tracking-widest mb-1.5 px-1",style:{color:"var(--muted)"},children:B}),i.jsx("div",{className:"space-y-1",children:w.map(Z=>i.jsxs("button",{onClick:()=>V(Z.slug),className:"w-full text-left px-3 py-2 rounded-lg transition-all duration-150 cursor-pointer active:scale-[0.99]",style:{background:"var(--s2)",border:"1px solid var(--b1)",color:"var(--fg)"},children:[i.jsx("div",{className:"text-[12px] font-medium truncate",children:Z.title||Z.slug.split("/").pop()}),i.jsx("div",{className:"text-[10px] font-mono mt-0.5 truncate",style:{color:"var(--muted)"},children:Z.slug})]},Z.slug))})]},B))]}),o==="page"&&i.jsxs("div",{children:[i.jsxs("button",{onClick:()=>c("browse"),className:"flex items-center gap-1.5 text-[11px] mb-3 cursor-pointer transition-colors duration-100",style:{color:"var(--muted)"},children:[i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:i.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to index"]}),v&&i.jsx("div",{className:"flex items-center justify-center h-32 text-xs",style:{color:"var(--muted)"},children:"Loading…"}),!v&&h!==null&&i.jsx("pre",{className:"text-[11px] leading-relaxed whitespace-pre-wrap font-mono p-3 rounded-lg overflow-auto",style:{background:"var(--s2)",color:"var(--fg)",border:"1px solid var(--b1)"},children:h})]}),o==="search"&&i.jsxs("div",{children:[i.jsxs("div",{className:"flex gap-2 mb-3",children:[i.jsx("input",{type:"text",value:k,onChange:B=>g(B.target.value),onKeyDown:B=>B.key==="Enter"&&J(),placeholder:"Search wiki pages…",className:"flex-1 px-3 py-2 rounded-lg text-[12px] outline-none",style:{background:"var(--s2)",border:"1px solid var(--b2)",color:"var(--fg)"},autoFocus:!0}),i.jsx("button",{onClick:J,disabled:y||!k.trim(),className:"px-3 py-2 rounded-lg text-[11px] font-semibold cursor-pointer transition-all duration-150 active:scale-[0.97]",style:{background:"color-mix(in srgb, var(--gold) 15%, transparent)",color:"var(--gold)",border:"1px solid color-mix(in srgb, var(--gold) 25%, transparent)",opacity:y||!k.trim()?.5:1},children:y?"…":"Search"})]}),x.length===0&&!y&&k&&i.jsxs("div",{className:"text-center py-8 text-xs",style:{color:"var(--muted)"},children:['No results for "',k,'"']}),x.length>0&&i.jsx("div",{className:"space-y-1",children:x.map((B,w)=>i.jsxs("button",{onClick:()=>V(B.slug),className:"w-full text-left px-3 py-2 rounded-lg transition-all duration-150 cursor-pointer active:scale-[0.99]",style:{background:"var(--s2)",border:"1px solid var(--b1)"},children:[i.jsxs("div",{className:"text-[11px] font-mono",style:{color:"var(--gold)"},children:[B.slug,":",B.lineNumber]}),i.jsx("div",{className:"text-[11px] mt-0.5 truncate font-mono",style:{color:"var(--fg)"},children:B.line.trim()})]},w))})]}),o==="lint"&&i.jsxs("div",{children:[D&&i.jsx("div",{className:"flex items-center justify-center h-32 text-xs",style:{color:"var(--muted)"},children:"Running lint…"}),!D&&_&&i.jsxs("div",{className:"space-y-4",children:[le===0&&i.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"color-mix(in srgb, var(--green) 10%, transparent)",color:"var(--green)",border:"1px solid color-mix(in srgb, var(--green) 20%, transparent)"},children:[i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:i.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Wiki looks clean — no issues found"]}),i.jsx(po,{title:"Orphan pages",items:_.orphanPages,color:"var(--yellow)",note:"Written but not linked from any other page"}),i.jsx(po,{title:"Broken links",items:_.brokenLinks.map(B=>`${B.from} → [[${B.to}]]`),color:"var(--red)",note:"[[wikilinks]] that reference missing pages"}),i.jsx(po,{title:"Missing from index",items:_.missingFromIndex,color:"var(--yellow)",note:"Pages not listed in index.md"}),i.jsx(po,{title:"Stale frontmatter",items:_.staleFrontmatter,color:"var(--muted)",note:"updated: field older than 30 days"})]})]})]})]})}function po({title:e,items:t,color:n,note:a}){return t.length===0?null:i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[i.jsx("span",{className:"text-[11px] font-semibold",style:{color:n},children:e}),i.jsx("span",{className:"rounded-full px-1.5 py-0.5 text-[9px] font-bold font-mono",style:{background:`color-mix(in srgb, ${n} 15%, transparent)`,color:n},children:t.length})]}),i.jsx("div",{className:"text-[10px] mb-2",style:{color:"var(--muted)"},children:a}),i.jsx("div",{className:"space-y-1",children:t.map((l,s)=>i.jsx("div",{className:"px-3 py-1.5 rounded-lg text-[11px] font-mono truncate",style:{background:"var(--s2)",color:"var(--fg)",border:"1px solid var(--b1)"},children:l},s))})]})}function Gn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ta(e,t){let n=e;for(const a of t.split(".")){if(!Gn(n))return;n=n[a]}return n}function qn(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):""}function Wv(e,t,n){const[a,...l]=t.split("."),s={...e};if(l.length===0)s[a]=n;else{const r=e[a];s[a]=Wv(Gn(r)?r:{},l.join("."),n)}return s}function Fv(e,t,n=""){const a=[];for(const[l,s]of Object.entries(t)){const r=n?`${n}.${l}`:l,o=e[l];Gn(s)&&Gn(o)?a.push(...Fv(o,s,r)):Gn(s)&&o===void 0?a.push({path:r,value:s}):JSON.stringify(s)!==JSON.stringify(o)&&a.push({path:r,value:s})}return a}function fN(e){return[...e].sort((t,n)=>{const a=l=>l.path==="current_provider"?1:0;return a(t)-a(n)})}const hN=/^([01]?\d|2[0-3]):[0-5]\d$/,pN=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];function mo(e){return hN.test(e.trim())}function mN(e){const t={},n=e.auto_compact;if(Gn(n)){const s=Number(n.warn_threshold),r=Number(n.threshold),o=Number(n.forced_threshold),c=[["auto_compact.warn_threshold",s],["auto_compact.threshold",r],["auto_compact.forced_threshold",o]];for(const[u,d]of c)(!Number.isFinite(d)||d<5||d>99)&&(t[u]="Use a percentage between 5 and 99.");!t["auto_compact.warn_threshold"]&&!t["auto_compact.threshold"]&&s>=r&&(t["auto_compact.warn_threshold"]="Warn must be below the suggest threshold."),!t["auto_compact.threshold"]&&!t["auto_compact.forced_threshold"]&&r>=o&&(t["auto_compact.threshold"]="Suggest must be below the force threshold.")}const a=e.heartbeat;if(Gn(a)){for(const c of["daily","dreaming"]){const u=qn(a[c]).trim();u?mo(u)||(t[`heartbeat.${c}`]="Use H:MM, 24-hour (e.g. 6:00)."):t[`heartbeat.${c}`]="Required — turn the heartbeat off with Schedule instead."}const s=qn(a.intraday).trim();s&&!s.split(",").every(c=>mo(c))&&(t["heartbeat.intraday"]="Comma-separated H:MM times (e.g. 7:55,11:55).");const r=qn(a.weekly).trim();if(!r)t["heartbeat.weekly"]="Required — turn the heartbeat off with Schedule instead.";else{const[c,u]=r.split("@");(!u||!mo(u)||!pN.includes(c.toLowerCase()))&&(t["heartbeat.weekly"]="Use day@H:MM (e.g. monday@6:00).")}const o=qn(a.monthly).trim();if(!o)t["heartbeat.monthly"]="Required — turn the heartbeat off with Schedule instead.";else{const[c,u]=o.split("@"),d=Number(c);(!u||!mo(u)||!Number.isInteger(d)||d<1||d>31)&&(t["heartbeat.monthly"]="Use D@H:MM with a day of 1-31 (e.g. 1@6:00).")}}const l=e.providers;if(Gn(l))for(const[s,r]of Object.entries(l)){if(!Gn(r))continue;qn(r.model).trim()||(t[`providers.${s}.model`]="Required — a blank model reverts to the default on restart.");const o=Number(r.model_context_window);(!Number.isFinite(o)||o<1e3)&&(t[`providers.${s}.model_context_window`]="Must be at least 1000 tokens.")}return t}function gN(e){const t=e.trim();if(!t)return{ok:!0,value:{}};let n;try{n=JSON.parse(t)}catch(a){return{ok:!1,error:a instanceof Error?a.message:"Invalid JSON."}}if(!Gn(n))return{ok:!1,error:'Expected a JSON object, e.g. { "name": { … } }.'};for(const[a,l]of Object.entries(n))if(!Gn(l))return{ok:!1,error:`"${a}" must be an object.`};return{ok:!0,value:n}}function Pv(e){return e.split(`
|
|
146
|
+
`).map(t=>t.trim()).filter(Boolean)}function xN(e){return Array.isArray(e)?e.map(t=>String(t)).join(`
|
|
147
|
+
`):typeof e=="string"?Pv(e.split(",").join(`
|
|
148
|
+
`)).join(`
|
|
149
|
+
`):""}const Ng=["anthropic","openai","openrouter","google","ollama","local"],yN=["curie","nord","tokyo-night","dracula","solarized","gruvbox","black","white","grey"],Tg=["plan","edit","auto","yolo"],bN=["low","medium","high","max","auto"],Eg=["on","off"];function vN({rpc:e,className:t}){const{ws:n}=Vn(),[a,l]=m.useState(null),[s,r]=m.useState(null),[o,c]=m.useState(null),[u,d]=m.useState({kind:"idle"}),[f,h]=m.useState("anthropic"),[p,v]=m.useState(new Set),[j,k]=m.useState(!1),[g,x]=m.useState({}),b=m.useRef(!1),y=m.useCallback((A,C)=>{x(M=>C===null?A in M?Object.fromEntries(Object.entries(M).filter(([V])=>V!==A)):M:M[A]===C?M:{...M,[A]:C})},[]),T=m.useCallback(()=>{e&&e.configAll().then(A=>{if(!A||typeof A!="object")throw new Error("Malformed settings payload");const C=A;l(C),r(structuredClone(C)),c(null),k(!1);const M=C.current_provider;typeof M=="string"&&M&&h(M)}).catch(A=>{c(A instanceof Error?A.message:"Failed to load settings")})},[e]);m.useEffect(()=>{T()},[T]);const _=m.useMemo(()=>a&&s?Fv(a,s):[],[a,s]),E=m.useMemo(()=>({...g,...s?mN(s):{}}),[s,g]),D=_.length>0,O=D&&Object.keys(E).length===0&&!b.current;m.useEffect(()=>{if(n)return n.on("config-changed",()=>{b.current||(D?k(!0):T())})},[n,D,T]);const R=m.useCallback((A,C)=>{r(M=>M&&Wv(M,A,C))},[]),X=m.useCallback(()=>{r(a?structuredClone(a):null),d({kind:"idle"})},[a]),K=m.useCallback(async()=>{if(!(!e||!O)){b.current=!0,d({kind:"saving"});try{for(const A of fN(_))await e.configSet(A.path,A.value);d({kind:"saved",at:Date.now()}),b.current=!1,T()}catch(A){b.current=!1,d({kind:"error",msg:A instanceof Error?A.message:"Save failed"})}}},[e,O,_,T]),P=m.useCallback(A=>{v(C=>{const M=new Set(C);return M.has(A)?M.delete(A):M.add(A),M})},[]),z={draft:s,errors:E,upd:R,revealed:p,toggleReveal:P,setBlocker:y};return o?i.jsx("div",{className:`flex-1 overflow-y-auto p-7 scrollbar-thin ${t??""}`,children:i.jsxs("div",{className:"flex flex-col items-center justify-center py-14 gap-3",children:[i.jsx("span",{className:"text-[13px] text-red",children:"Could not load settings"}),i.jsx("span",{className:"text-xs text-muted font-mono",children:o}),i.jsx("button",{onClick:()=>{T()},className:"mt-1 px-3 py-1.5 rounded text-xs text-muted hover:text-fg transition-colors",style:{background:"var(--s3)",border:"1px solid var(--b1)"},children:"Retry"})]})}):s?i.jsx("div",{className:`flex-1 overflow-y-auto p-7 scrollbar-thin ${t??""}`,children:i.jsxs("div",{className:"max-w-3xl mx-auto pb-10",children:[i.jsxs("div",{className:"flex items-center justify-between mb-5 gap-3 flex-wrap",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"text-base font-semibold text-fg tracking-tight",children:"Settings"}),i.jsx("span",{className:"text-[10px] text-muted font-mono",children:"~/.curie-settings.json"})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.jsx(SN,{status:u,dirty:D,errorCount:Object.keys(E).length}),i.jsx("button",{onClick:X,disabled:!D,className:"py-2 px-3.5 rounded-xl text-[12px] font-semibold cursor-pointer transition-all duration-150 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"var(--s3)",border:"1px solid var(--b1)",color:"var(--muted)"},children:"Revert"}),i.jsx("button",{onClick:()=>void K(),disabled:!O,className:"btn-gold py-2 px-4 rounded-xl text-[12px] font-semibold cursor-pointer active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",children:u.kind==="saving"?"Saving…":D?`Save ${String(_.length)} change${_.length===1?"":"s"}`:"Save"})]})]}),j&&i.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-2.5 rounded-lg mb-4",style:{background:"color-mix(in srgb, var(--yellow) 12%, transparent)",border:"1px solid color-mix(in srgb, var(--yellow) 35%, transparent)"},children:[i.jsx("span",{className:"text-[12px]",style:{color:"var(--yellow)"},children:"Settings changed elsewhere. Your edits are kept — reload to see the new values."}),i.jsx("button",{onClick:()=>{T()},className:"text-[11px] font-semibold shrink-0 cursor-pointer hover:underline",style:{color:"var(--yellow)"},children:"Reload"})]}),u.kind==="error"&&i.jsx("div",{className:"px-4 py-2.5 rounded-lg mb-4 text-[12px]",style:{background:"color-mix(in srgb, var(--red) 12%, transparent)",border:"1px solid color-mix(in srgb, var(--red) 35%, transparent)",color:"var(--red)"},children:u.msg}),i.jsxs(ua,{title:"Agent",children:[i.jsxs(Ln,{children:[i.jsx(Nr,{ctx:z,path:"mode",label:"Approval mode",options:Tg}),i.jsx(Nr,{ctx:z,path:"effort",label:"Reasoning effort",options:bN}),i.jsx(Nr,{ctx:z,path:"theme",label:"Theme",options:yN})]}),i.jsxs(Ln,{children:[i.jsx(ed,{ctx:z,path:"statusline",label:"Status line"}),i.jsx(ed,{ctx:z,path:"debug",label:"Debug logging"})]})]}),i.jsxs(ua,{title:"Provider & Model",hint:"The active provider supplies the model used for every turn.",children:[i.jsx(Nr,{ctx:z,path:"current_provider",label:"Active provider",options:Ng}),i.jsx("div",{className:"flex flex-wrap gap-1.5 mt-4 mb-3",children:Ng.map(A=>{const C=f===A,M=qn(ta(s,`providers.${A}.api_key`))!=="";return i.jsxs("button",{onClick:()=>{h(A)},className:"px-2.5 py-1 rounded-lg text-[11px] font-mono cursor-pointer transition-all duration-100 flex items-center gap-1.5",style:{background:C?"color-mix(in srgb, var(--gold) 15%, transparent)":"var(--s2)",border:`1px solid ${C?"var(--gold)":"var(--b1)"}`,color:C?"var(--gold)":"var(--muted)"},children:[A,i.jsx("span",{className:"w-[5px] h-[5px] rounded-full shrink-0",style:{background:M?"var(--green)":"var(--muted2)"}})]},A)})}),i.jsx(td,{ctx:z,path:`providers.${f}.api_key`,label:"API key"}),i.jsxs(Ln,{children:[i.jsx(vn,{ctx:z,path:`providers.${f}.model`,label:"Model"}),i.jsx(vn,{ctx:z,path:`providers.${f}.url`,label:"Base URL"})]}),i.jsxs(Ln,{children:[i.jsx(vn,{ctx:z,path:`providers.${f}.model_cost`,label:"Pricing",placeholder:"3;15",hint:"Input;output USD per million tokens. Tiers: 3;15|272000<6;22.5"}),i.jsx(da,{ctx:z,path:`providers.${f}.model_context_window`,label:"Context window",min:1e3})]}),i.jsx(da,{ctx:z,path:`providers.${f}.max_output_tokens`,label:"Max output tokens",min:256})]}),i.jsx(ua,{title:"Limits",hint:"Per turn caps the current message; per run caps the whole session.",children:i.jsxs(Ln,{children:[i.jsx(da,{ctx:z,path:"tools_per_call",label:"Tool calls per turn",min:1}),i.jsx(da,{ctx:z,path:"tools_per_run",label:"Tool calls per run",min:1}),i.jsx(da,{ctx:z,path:"websearch_per_call",label:"Web searches per turn",min:0}),i.jsx(da,{ctx:z,path:"websearch_per_run",label:"Web searches per run",min:0})]})}),i.jsxs(ua,{title:"Auto-compaction",hint:"Percentages of the context window. Warn < suggest < force.",children:[i.jsx(kl,{ctx:z,path:"auto_compact.enabled",label:"Enabled"}),i.jsxs(Ln,{children:[i.jsx(da,{ctx:z,path:"auto_compact.warn_threshold",label:"Warn at %",min:5,max:99}),i.jsx(da,{ctx:z,path:"auto_compact.threshold",label:"Suggest at %",min:5,max:99}),i.jsx(da,{ctx:z,path:"auto_compact.forced_threshold",label:"Force at %",min:5,max:99}),i.jsx(vn,{ctx:z,path:"auto_compact.model",label:"Summariser model",placeholder:"blank = active model"})]})]}),i.jsxs(ua,{title:"Safety",children:[i.jsxs(Ln,{children:[i.jsx(kl,{ctx:z,path:"safety.path_guard",label:"Path guard"}),i.jsx(kl,{ctx:z,path:"safety.command_guard",label:"Command guard"}),i.jsx(kl,{ctx:z,path:"safety.snapshots",label:"Git snapshots"})]}),i.jsx(zg,{ctx:z,path:"safety.path_allowlist",label:"Path allowlist",hint:"One absolute path per line. Writes outside the project cwd and these paths are refused.",placeholder:"C:\\git\\my-project"})]}),i.jsxs(ua,{title:"Heartbeat",hint:"Autonomous wake-ups. Turn the whole cycle off with Schedule rather than blanking times.",children:[i.jsxs(Ln,{children:[i.jsx(kl,{ctx:z,path:"heartbeat.schedule",label:"Schedule"}),i.jsx(Nr,{ctx:z,path:"heartbeat.mode",label:"Approval mode",options:Tg})]}),i.jsx(vn,{ctx:z,path:"heartbeat.intraday",label:"Intraday",placeholder:"7:55,11:55,15:55",hint:"Comma-separated H:MM times. Blank for none."}),i.jsxs(Ln,{children:[i.jsx(vn,{ctx:z,path:"heartbeat.daily",label:"Daily",placeholder:"6:00"}),i.jsx(vn,{ctx:z,path:"heartbeat.dreaming",label:"Dreaming",placeholder:"2:00"}),i.jsx(vn,{ctx:z,path:"heartbeat.weekly",label:"Weekly",placeholder:"monday@6:00"}),i.jsx(vn,{ctx:z,path:"heartbeat.monthly",label:"Monthly",placeholder:"1@6:00"})]})]}),i.jsxs(ua,{title:"Channels (Telegram)",children:[i.jsx(td,{ctx:z,path:"channels.bot_token",label:"Bot token"}),i.jsxs(Ln,{children:[i.jsx(vn,{ctx:z,path:"channels.user_id",label:"User ID"}),i.jsx(vn,{ctx:z,path:"channels.chat_id",label:"Chat ID"})]}),i.jsx(ed,{ctx:z,path:"channels.allow_groups",label:"Allow group chats"})]}),i.jsxs(ua,{title:"Integrations",children:[i.jsx(td,{ctx:z,path:"brave_search_api_key",label:"Brave Search API key"}),i.jsxs(Ln,{children:[i.jsx(vn,{ctx:z,path:"wiki.path",label:"Wiki path",placeholder:"blank = default"}),i.jsx(kl,{ctx:z,path:"wiki.autoLint",label:"Wiki auto-lint"}),i.jsx(kl,{ctx:z,path:"pricing_tier_warn",label:"Pricing tier warnings"})]}),i.jsx(wN,{ctx:z,path:"mcp_servers",label:"MCP servers",badge:"RESTART",hint:"An object keyed by server name. Changes apply after the daemon restarts."})]}),i.jsxs(ua,{title:"Advanced",children:[i.jsx(zg,{ctx:z,path:"system_prompt_files",label:"System prompt files",badge:"RESTART",hint:"Identity files in ~/.curie-agent/ inlined into the system prompt, in order.",placeholder:"AGENTS.md"}),i.jsx(za,{label:"Web bind IP",hint:"The address the daemon listens on. Edit ~/.curie-settings.json directly — a wrong value makes the daemon unreachable.",children:i.jsx("div",{className:"w-full px-3 py-2 rounded-lg text-[12.5px] font-mono text-muted",style:{background:"var(--s1)",border:"1px solid var(--b1)"},children:qn(ta(s,"web_ip"))||"127.0.0.1"})})]})]})}):i.jsx("div",{className:`flex-1 overflow-y-auto p-7 scrollbar-thin ${t??""}`,children:i.jsx("div",{className:"flex items-center justify-center py-10 text-muted text-[13px]",children:"Loading settings…"})})}function SN({status:e,dirty:t,errorCount:n}){return n>0?i.jsxs("span",{className:"text-[11px] font-mono",style:{color:"var(--red)"},children:[String(n)," error",n===1?"":"s"]}):e.kind==="saved"&&!t?i.jsxs("span",{className:"text-[11px] font-mono",style:{color:"var(--green)"},children:["saved ",new Date(e.at).toLocaleTimeString()]}):t?i.jsx("span",{className:"text-[11px] font-mono text-muted",children:"unsaved"}):null}function ua({title:e,hint:t,children:n}){return i.jsxs("div",{className:"rounded-xl mb-3 overflow-hidden",style:{background:"var(--s1)",border:"1px solid var(--b1)"},children:[i.jsxs("div",{className:"px-4 py-3",style:{borderBottom:"1px solid var(--b1)"},children:[i.jsx("div",{className:"text-[12px] font-medium text-text2",children:e}),t&&i.jsx("div",{className:"text-[10.5px] text-muted mt-0.5",children:t})]}),i.jsx("div",{className:"p-4 space-y-3",children:n})]})}function Ln({children:e}){return i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:e})}function za({label:e,hint:t,error:n,badge:a,children:l}){return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono block",children:e}),a&&i.jsx("span",{className:"text-[9px] font-mono px-1.5 py-px rounded uppercase tracking-wider",style:{background:"color-mix(in srgb, var(--yellow) 15%, transparent)",color:"var(--yellow)"},children:a})]}),l,n?i.jsx("div",{className:"text-[10.5px] mt-1",style:{color:"var(--red)"},children:n}):t?i.jsx("div",{className:"text-[10.5px] text-muted mt-1",children:t}):null]})}const Di="w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none transition-colors focus:ring-1 focus:ring-gold/30",Ag={background:"var(--s2)",border:"1px solid var(--b1)"};function sr(e){return e?{...Ag,border:"1px solid var(--red)"}:Ag}function vn({ctx:e,path:t,label:n,hint:a,badge:l,placeholder:s}){const r=e.errors[t];return i.jsx(za,{label:n,hint:a,error:r,badge:l,children:i.jsx("input",{type:"text",value:qn(ta(e.draft,t)),onChange:o=>{e.upd(t,o.target.value)},placeholder:s,className:Di,style:sr(r)})})}function da({ctx:e,path:t,label:n,hint:a,min:l,max:s}){const r=e.errors[t],o=ta(e.draft,t),{setBlocker:c}=e;return m.useEffect(()=>{o==null||o===""?c(t,"Required."):typeof o!="number"||!Number.isFinite(o)?c(t,"Must be a number."):l!==void 0&&o<l?c(t,`Must be at least ${String(l)}.`):s!==void 0&&o>s?c(t,`Must be at most ${String(s)}.`):c(t,null)},[o,t,l,s,c]),m.useEffect(()=>()=>{c(t,null)},[t,c]),i.jsx(za,{label:n,hint:a,error:r,children:i.jsx("input",{type:"number",min:l,max:s,value:typeof o=="number"?String(o):"",onChange:u=>{const d=u.target.value;e.upd(t,d===""?"":Number(d))},className:Di,style:sr(r)})})}function Nr({ctx:e,path:t,label:n,hint:a,options:l}){const s=e.errors[t],r=qn(ta(e.draft,t));return i.jsx(za,{label:n,hint:a,error:s,children:i.jsxs("select",{value:r,onChange:o=>{e.upd(t,o.target.value)},className:"w-full px-3 py-2 rounded-lg text-[12.5px] text-fg outline-none cursor-pointer",style:sr(s),children:[!l.includes(r)&&i.jsx("option",{value:r,children:r||"—"}),l.map(o=>i.jsx("option",{value:o,children:o},o))]})})}function ed({ctx:e,path:t,label:n,hint:a}){const l=ta(e.draft,t)===!0;return i.jsx(za,{label:n,hint:a,children:i.jsx(e0,{on:l,onClick:()=>{e.upd(t,!l)},onLabel:"on",offLabel:"off"})})}function kl({ctx:e,path:t,label:n,hint:a}){const l=qn(ta(e.draft,t))==="on";return i.jsx(za,{label:n,hint:a,children:i.jsx(e0,{on:l,onClick:()=>{e.upd(t,l?Eg[1]:Eg[0])},onLabel:"on",offLabel:"off"})})}function e0({on:e,onClick:t,onLabel:n,offLabel:a}){return i.jsxs("button",{onClick:t,className:"flex items-center gap-2 px-3 py-2 rounded-lg text-[12.5px] cursor-pointer transition-colors w-full",style:{background:"var(--s2)",border:"1px solid var(--b1)",color:e?"var(--green)":"var(--muted)"},children:[i.jsx("span",{className:"w-8 h-4 rounded-full relative shrink-0 transition-colors",style:{background:e?"var(--green)":"var(--b3)"},children:i.jsx("span",{className:"absolute top-0.5 w-3 h-3 rounded-full transition-all",style:{background:"var(--s1)",left:e?"18px":"2px"}})}),i.jsx("span",{className:"font-mono text-[11px]",children:e?n:a})]})}function td({ctx:e,path:t,label:n,hint:a}){const l=e.errors[t],s=qn(ta(e.draft,t)),r=e.revealed.has(t);return i.jsx(za,{label:n,hint:a??(s?void 0:"Not set"),error:l,children:i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:r?"text":"password",value:s,onChange:o=>{e.upd(t,o.target.value)},autoComplete:"off",spellCheck:!1,placeholder:"not set",className:`${Di} font-mono`,style:sr(l)}),i.jsx("button",{onClick:()=>{e.toggleReveal(t)},title:r?"Hide":"Reveal",className:"px-3 rounded-lg text-muted hover:text-fg transition-colors cursor-pointer shrink-0",style:{background:"var(--s2)",border:"1px solid var(--b1)"},children:r?i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:[i.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),i.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:[i.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),i.jsx("circle",{cx:"12",cy:"12",r:"3"})]})})]})})}function zg({ctx:e,path:t,label:n,hint:a,badge:l,placeholder:s}){const r=e.errors[t];return i.jsx(za,{label:n,hint:a,error:r,badge:l,children:i.jsx("textarea",{value:xN(ta(e.draft,t)),onChange:o=>{e.upd(t,Pv(o.target.value))},rows:3,placeholder:s,className:`${Di} font-mono resize-y scrollbar-thin`,style:sr(r),spellCheck:!1})})}function wN({ctx:e,path:t,label:n,hint:a,badge:l}){const s=ta(e.draft,t),[r,o]=m.useState(()=>JSON.stringify(s??{},null,2)),c=m.useRef(s),{setBlocker:u}=e,d=e.errors[t];return m.useEffect(()=>{s!==c.current&&(c.current=s,o(JSON.stringify(s??{},null,2)),u(t,null))},[s,t,u]),m.useEffect(()=>()=>{u(t,null)},[t,u]),i.jsx(za,{label:n,hint:a,error:d,badge:l,children:i.jsx("textarea",{value:r,onChange:f=>{const h=f.target.value;o(h);const p=gN(h);p.ok?(u(t,null),c.current=p.value,e.upd(t,p.value)):u(t,p.error)},rows:8,className:`${Di} font-mono text-[11.5px] resize-y scrollbar-thin`,style:sr(d),spellCheck:!1})})}var Cg;function $(e,t,n){function a(o,c){if(o._zod||Object.defineProperty(o,"_zod",{value:{def:c,constr:r,traits:new Set},enumerable:!1}),o._zod.traits.has(e))return;o._zod.traits.add(e),t(o,c);const u=r.prototype,d=Object.keys(u);for(let f=0;f<d.length;f++){const h=d[f];h in o||(o[h]=u[h].bind(o))}}const l=(n==null?void 0:n.Parent)??Object;class s extends l{}Object.defineProperty(s,"name",{value:e});function r(o){var c;const u=n!=null&&n.Parent?new s:this;a(u,o),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(r,"init",{value:a}),Object.defineProperty(r,Symbol.hasInstance,{value:o=>{var c,u;return n!=null&&n.Parent&&o instanceof n.Parent?!0:(u=(c=o==null?void 0:o._zod)==null?void 0:c.traits)==null?void 0:u.has(e)}}),Object.defineProperty(r,"name",{value:e}),r}class Ds extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class t0 extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Cg=globalThis).__zod_globalConfig??(Cg.__zod_globalConfig={});const Rh=globalThis.__zod_globalConfig;function Ta(e){return Rh}function n0(e){const t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,l])=>t.indexOf(+a)===-1).map(([a,l])=>l)}function cf(e,t){return typeof t=="bigint"?t.toString():t}function Wc(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Lh(e){return e==null}function $h(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function jN(e,t){const n=e/t,a=Math.round(n),l=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-a)<l?0:n-a}const Og=Symbol("evaluating");function Ae(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==Og)return a===void 0&&(a=Og,a=n()),a},set(l){Object.defineProperty(e,t,{value:l})},configurable:!0})}function Kl(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ml(...e){const t={};for(const n of e){const a=Object.getOwnPropertyDescriptors(n);Object.assign(t,a)}return Object.defineProperties({},t)}function Dg(e){return JSON.stringify(e)}function kN(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const a0="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function pi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const _N=Wc(()=>{var e;if(Rh.jitless||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 Is(e){if(pi(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(pi(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function l0(e){return Is(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const NN=new Set(["string","number","symbol"]);function Xs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function gl(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 te(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 TN(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const EN={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 AN(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 s=ml(e._zod.def,{get shape(){const r={};for(const o in t){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(r[o]=n.shape[o])}return Kl(this,"shape",r),r},checks:[]});return gl(e,s)}function zN(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 s=ml(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const o in t){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&delete r[o]}return Kl(this,"shape",r),r},checks:[]});return gl(e,s)}function CN(e,t){if(!Is(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const r in t)if(Object.getOwnPropertyDescriptor(s,r)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const l=ml(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Kl(this,"shape",s),s}});return gl(e,l)}function ON(e,t){if(!Is(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=ml(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return Kl(this,"shape",a),a}});return gl(e,n)}function DN(e,t){var a;if((a=e._zod.def.checks)!=null&&a.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=ml(e._zod.def,{get shape(){const l={...e._zod.def.shape,...t._zod.def.shape};return Kl(this,"shape",l),l},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return gl(e,n)}function MN(e,t,n){const l=t._zod.def.checks;if(l&&l.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const r=ml(t._zod.def,{get shape(){const o=t._zod.def.shape,c={...o};if(n)for(const u in n){if(!(u in o))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:o[u]}):o[u])}else for(const u in o)c[u]=e?new e({type:"optional",innerType:o[u]}):o[u];return Kl(this,"shape",c),c},checks:[]});return gl(t,r)}function RN(e,t,n){const a=ml(t._zod.def,{get shape(){const l=t._zod.def.shape,s={...l};if(n)for(const r in n){if(!(r in s))throw new Error(`Unrecognized key: "${r}"`);n[r]&&(s[r]=new e({type:"nonoptional",innerType:l[r]}))}else for(const r in l)s[r]=new e({type:"nonoptional",innerType:l[r]});return Kl(this,"shape",s),s}});return gl(t,a)}function Ss(e,t=0){var n;if(e.aborted===!0)return!0;for(let a=t;a<e.issues.length;a++)if(((n=e.issues[a])==null?void 0:n.continue)!==!0)return!0;return!1}function LN(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)===!1)return!0;return!1}function ws(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function go(e){return typeof e=="string"?e:e==null?void 0:e.message}function Ea(e,t,n){var c,u,d,f,h,p;const a=e.message?e.message:go((d=(u=(c=e.inst)==null?void 0:c._zod.def)==null?void 0:u.error)==null?void 0:d.call(u,e))??go((f=t==null?void 0:t.error)==null?void 0:f.call(t,e))??go((h=n.customError)==null?void 0:h.call(n,e))??go((p=n.localeError)==null?void 0:p.call(n,e))??"Invalid input",{inst:l,continue:s,input:r,...o}=e;return o.path??(o.path=[]),o.message=a,t!=null&&t.reportInput&&(o.input=r),o}function Uh(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function mi(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}const s0=(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,cf,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},r0=$("$ZodError",s0),i0=$("$ZodError",s0,{Parent:Error});function $N(e,t=n=>n.message){const n={},a=[];for(const l of e.issues)l.path.length>0?(n[l.path[0]]=n[l.path[0]]||[],n[l.path[0]].push(t(l))):a.push(t(l));return{formErrors:a,fieldErrors:n}}function UN(e,t=n=>n.message){const n={_errors:[]},a=(l,s=[])=>{for(const r of l.issues)if(r.code==="invalid_union"&&r.errors.length)r.errors.map(o=>a({issues:o},[...s,...r.path]));else if(r.code==="invalid_key")a({issues:r.issues},[...s,...r.path]);else if(r.code==="invalid_element")a({issues:r.issues},[...s,...r.path]);else{const o=[...s,...r.path];if(o.length===0)n._errors.push(t(r));else{let c=n,u=0;for(;u<o.length;){const d=o[u];u===o.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(t(r))):c[d]=c[d]||{_errors:[]},c=c[d],u++}}}};return a(e),n}const Bh=e=>(t,n,a,l)=>{const s=a?{...a,async:!1}:{async:!1},r=t._zod.run({value:n,issues:[]},s);if(r instanceof Promise)throw new Ds;if(r.issues.length){const o=new((l==null?void 0:l.Err)??e)(r.issues.map(c=>Ea(c,s,Ta())));throw a0(o,l==null?void 0:l.callee),o}return r.value},Zh=e=>async(t,n,a,l)=>{const s=a?{...a,async:!0}:{async:!0};let r=t._zod.run({value:n,issues:[]},s);if(r instanceof Promise&&(r=await r),r.issues.length){const o=new((l==null?void 0:l.Err)??e)(r.issues.map(c=>Ea(c,s,Ta())));throw a0(o,l==null?void 0:l.callee),o}return r.value},Fc=e=>(t,n,a)=>{const l=a?{...a,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},l);if(s instanceof Promise)throw new Ds;return s.issues.length?{success:!1,error:new(e??r0)(s.issues.map(r=>Ea(r,l,Ta())))}:{success:!0,data:s.value}},BN=Fc(i0),Pc=e=>async(t,n,a)=>{const l=a?{...a,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},l);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(r=>Ea(r,l,Ta())))}:{success:!0,data:s.value}},ZN=Pc(i0),HN=e=>(t,n,a)=>{const l=a?{...a,direction:"backward"}:{direction:"backward"};return Bh(e)(t,n,l)},qN=e=>(t,n,a)=>Bh(e)(t,n,a),GN=e=>async(t,n,a)=>{const l=a?{...a,direction:"backward"}:{direction:"backward"};return Zh(e)(t,n,l)},YN=e=>async(t,n,a)=>Zh(e)(t,n,a),IN=e=>(t,n,a)=>{const l=a?{...a,direction:"backward"}:{direction:"backward"};return Fc(e)(t,n,l)},XN=e=>(t,n,a)=>Fc(e)(t,n,a),VN=e=>async(t,n,a)=>{const l=a?{...a,direction:"backward"}:{direction:"backward"};return Pc(e)(t,n,l)},QN=e=>async(t,n,a)=>Pc(e)(t,n,a),KN=/^[cC][0-9a-z]{6,}$/,JN=/^[0-9a-z]+$/,WN=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,FN=/^[0-9a-vA-V]{20}$/,PN=/^[A-Za-z0-9]{27}$/,eT=/^[a-zA-Z0-9_-]{21}$/,tT=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,nT=/^([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})$/,Mg=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)$/,aT=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,lT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function sT(){return new RegExp(lT,"u")}const rT=/^(?:(?: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])$/,iT=/^(([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}|:))$/,oT=/^((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])$/,cT=/^(([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])$/,uT=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,o0=/^[A-Za-z0-9_-]*$/,dT=/^https?$/,fT=/^\+[1-9]\d{6,14}$/,c0="(?:(?:\\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])))",hT=new RegExp(`^${c0}$`);function u0(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 pT(e){return new RegExp(`^${u0(e)}$`)}function mT(e){const t=u0({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(`^${c0}T(?:${a})$`)}const gT=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}$`)},xT=/^-?\d+$/,d0=/^-?\d+(?:\.\d+)?$/,yT=/^(?:true|false)$/i,bT=/^[^A-Z]*$/,vT=/^[^a-z]*$/,en=$("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),f0={number:"number",bigint:"bigint",object:"date"},h0=$("$ZodCheckLessThan",(e,t)=>{en.init(e,t);const n=f0[typeof t.value];e._zod.onattach.push(a=>{const l=a._zod.bag,s=(t.inclusive?l.maximum:l.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?l.maximum=t.value:l.exclusiveMaximum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),p0=$("$ZodCheckGreaterThan",(e,t)=>{en.init(e,t);const n=f0[typeof t.value];e._zod.onattach.push(a=>{const l=a._zod.bag,s=(t.inclusive?l.minimum:l.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?l.minimum=t.value:l.exclusiveMinimum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ST=$("$ZodCheckMultipleOf",(e,t)=>{en.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):jN(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})}}),wT=$("$ZodCheckNumberFormat",(e,t)=>{var r;en.init(e,t),t.format=t.format||"float64";const n=(r=t.format)==null?void 0:r.includes("int"),a=n?"int":"number",[l,s]=EN[t.format];e._zod.onattach.push(o=>{const c=o._zod.bag;c.format=t.format,c.minimum=l,c.maximum=s,n&&(c.pattern=xT)}),e._zod.check=o=>{const c=o.value;if(n){if(!Number.isInteger(c)){o.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?o.issues.push({input:c,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}):o.issues.push({input:c,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}}c<l&&o.issues.push({origin:"number",input:c,code:"too_small",minimum:l,inclusive:!0,inst:e,continue:!t.abort}),c>s&&o.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),jT=$("$ZodCheckMaxLength",(e,t)=>{var n;en.init(e,t),(n=e._zod.def).when??(n.when=a=>{const l=a.value;return!Lh(l)&&l.length!==void 0}),e._zod.onattach.push(a=>{const l=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<l&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const l=a.value;if(l.length<=t.maximum)return;const r=Uh(l);a.issues.push({origin:r,code:"too_big",maximum:t.maximum,inclusive:!0,input:l,inst:e,continue:!t.abort})}}),kT=$("$ZodCheckMinLength",(e,t)=>{var n;en.init(e,t),(n=e._zod.def).when??(n.when=a=>{const l=a.value;return!Lh(l)&&l.length!==void 0}),e._zod.onattach.push(a=>{const l=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>l&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const l=a.value;if(l.length>=t.minimum)return;const r=Uh(l);a.issues.push({origin:r,code:"too_small",minimum:t.minimum,inclusive:!0,input:l,inst:e,continue:!t.abort})}}),_T=$("$ZodCheckLengthEquals",(e,t)=>{var n;en.init(e,t),(n=e._zod.def).when??(n.when=a=>{const l=a.value;return!Lh(l)&&l.length!==void 0}),e._zod.onattach.push(a=>{const l=a._zod.bag;l.minimum=t.length,l.maximum=t.length,l.length=t.length}),e._zod.check=a=>{const l=a.value,s=l.length;if(s===t.length)return;const r=Uh(l),o=s>t.length;a.issues.push({origin:r,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),eu=$("$ZodCheckStringFormat",(e,t)=>{var n,a;en.init(e,t),e._zod.onattach.push(l=>{const s=l._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=l=>{t.pattern.lastIndex=0,!t.pattern.test(l.value)&&l.issues.push({origin:"string",code:"invalid_format",format:t.format,input:l.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),NT=$("$ZodCheckRegex",(e,t)=>{eu.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})}}),TT=$("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=bT),eu.init(e,t)}),ET=$("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=vT),eu.init(e,t)}),AT=$("$ZodCheckIncludes",(e,t)=>{en.init(e,t);const n=Xs(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=a,e._zod.onattach.push(l=>{const s=l._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(a)}),e._zod.check=l=>{l.value.includes(t.includes,t.position)||l.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:l.value,inst:e,continue:!t.abort})}}),zT=$("$ZodCheckStartsWith",(e,t)=>{en.init(e,t);const n=new RegExp(`^${Xs(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const l=a._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(n)}),e._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:e,continue:!t.abort})}}),CT=$("$ZodCheckEndsWith",(e,t)=>{en.init(e,t);const n=new RegExp(`.*${Xs(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const l=a._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(n)}),e._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:e,continue:!t.abort})}}),OT=$("$ZodCheckOverwrite",(e,t)=>{en.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class DT{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(`
|
|
150
|
+
`).filter(r=>r),l=Math.min(...a.map(r=>r.length-r.trimStart().length)),s=a.map(r=>r.slice(l)).map(r=>" ".repeat(this.indent*2)+r);for(const r of s)this.content.push(r)}compile(){const t=Function,n=this==null?void 0:this.args,l=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new t(...n,l.join(`
|
|
151
|
+
`))}}const MT={major:4,minor:4,patch:3},Ke=$("$ZodType",(e,t)=>{var l;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=MT;const a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const s of a)for(const r of s._zod.onattach)r(e);if(a.length===0)(n=e._zod).deferred??(n.deferred=[]),(l=e._zod.deferred)==null||l.push(()=>{e._zod.run=e._zod.parse});else{const s=(o,c,u)=>{let d=Ss(o),f;for(const h of c){if(h._zod.def.when){if(LN(o)||!h._zod.def.when(o))continue}else if(d)continue;const p=o.issues.length,v=h._zod.check(o);if(v instanceof Promise&&(u==null?void 0:u.async)===!1)throw new Ds;if(f||v instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await v,o.issues.length!==p&&(d||(d=Ss(o,p)))});else{if(o.issues.length===p)continue;d||(d=Ss(o,p))}}return f?f.then(()=>o):o},r=(o,c,u)=>{if(Ss(o))return o.aborted=!0,o;const d=s(c,a,u);if(d instanceof Promise){if(u.async===!1)throw new Ds;return d.then(f=>e._zod.parse(f,u))}return e._zod.parse(d,u)};e._zod.run=(o,c)=>{if(c.skipChecks)return e._zod.parse(o,c);if(c.direction==="backward"){const d=e._zod.parse({value:o.value,issues:[]},{...c,skipChecks:!0});return d instanceof Promise?d.then(f=>r(f,o,c)):r(d,o,c)}const u=e._zod.parse(o,c);if(u instanceof Promise){if(c.async===!1)throw new Ds;return u.then(d=>s(d,a,c))}return s(u,a,c)}}Ae(e,"~standard",()=>({validate:s=>{var r;try{const o=BN(e,s);return o.success?{value:o.data}:{issues:(r=o.error)==null?void 0:r.issues}}catch{return ZN(e,s).then(c=>{var u;return c.success?{value:c.data}:{issues:(u=c.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}))}),Hh=$("$ZodString",(e,t)=>{var n;Ke.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??gT(e._zod.bag),e._zod.parse=(a,l)=>{if(t.coerce)try{a.value=String(a.value)}catch{}return typeof a.value=="string"||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:e}),a}}),Xe=$("$ZodStringFormat",(e,t)=>{eu.init(e,t),Hh.init(e,t)}),RT=$("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=nT),Xe.init(e,t)}),LT=$("$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=Mg(a))}else t.pattern??(t.pattern=Mg());Xe.init(e,t)}),$T=$("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=aT),Xe.init(e,t)}),UT=$("$ZodURL",(e,t)=>{Xe.init(e,t),e._zod.check=n=>{var a;try{const l=n.value.trim();if(!t.normalize&&((a=t.protocol)==null?void 0:a.source)===dT.source&&!/^https?:\/\//i.test(l)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const s=new URL(l);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=l;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),BT=$("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=sT()),Xe.init(e,t)}),ZT=$("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=eT),Xe.init(e,t)}),HT=$("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=KN),Xe.init(e,t)}),qT=$("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=JN),Xe.init(e,t)}),GT=$("$ZodULID",(e,t)=>{t.pattern??(t.pattern=WN),Xe.init(e,t)}),YT=$("$ZodXID",(e,t)=>{t.pattern??(t.pattern=FN),Xe.init(e,t)}),IT=$("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=PN),Xe.init(e,t)}),XT=$("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=mT(t)),Xe.init(e,t)}),VT=$("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=hT),Xe.init(e,t)}),QT=$("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=pT(t)),Xe.init(e,t)}),KT=$("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=tT),Xe.init(e,t)}),JT=$("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=rT),Xe.init(e,t),e._zod.bag.format="ipv4"}),WT=$("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=iT),Xe.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})}}}),FT=$("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=oT),Xe.init(e,t)}),PT=$("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=cT),Xe.init(e,t),e._zod.check=n=>{const a=n.value.split("/");try{if(a.length!==2)throw new Error;const[l,s]=a;if(!s)throw new Error;const r=Number(s);if(`${r}`!==s)throw new Error;if(r<0||r>128)throw new Error;new URL(`http://[${l}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function m0(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const eE=$("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=uT),Xe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{m0(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function tE(e){if(!o0.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return m0(n)}const nE=$("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=o0),Xe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{tE(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),aE=$("$ZodE164",(e,t)=>{t.pattern??(t.pattern=fT),Xe.init(e,t)});function lE(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[a]=n;if(!a)return!1;const l=JSON.parse(atob(a));return!("typ"in l&&(l==null?void 0:l.typ)!=="JWT"||!l.alg||t&&(!("alg"in l)||l.alg!==t))}catch{return!1}}const sE=$("$ZodJWT",(e,t)=>{Xe.init(e,t),e._zod.check=n=>{lE(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),g0=$("$ZodNumber",(e,t)=>{Ke.init(e,t),e._zod.pattern=e._zod.bag.pattern??d0,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const l=n.value;if(typeof l=="number"&&!Number.isNaN(l)&&Number.isFinite(l))return n;const s=typeof l=="number"?Number.isNaN(l)?"NaN":Number.isFinite(l)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:l,inst:e,...s?{received:s}:{}}),n}}),rE=$("$ZodNumberFormat",(e,t)=>{wT.init(e,t),g0.init(e,t)}),iE=$("$ZodBoolean",(e,t)=>{Ke.init(e,t),e._zod.pattern=yT,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=!!n.value}catch{}const l=n.value;return typeof l=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:l,inst:e}),n}}),oE=$("$ZodUnknown",(e,t)=>{Ke.init(e,t),e._zod.parse=n=>n}),cE=$("$ZodNever",(e,t)=>{Ke.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Rg(e,t,n){e.issues.length&&t.issues.push(...ws(n,e.issues)),t.value[n]=e.value}const uE=$("$ZodArray",(e,t)=>{Ke.init(e,t),e._zod.parse=(n,a)=>{const l=n.value;if(!Array.isArray(l))return n.issues.push({expected:"array",code:"invalid_type",input:l,inst:e}),n;n.value=Array(l.length);const s=[];for(let r=0;r<l.length;r++){const o=l[r],c=t.element._zod.run({value:o,issues:[]},a);c instanceof Promise?s.push(c.then(u=>Rg(u,n,r))):Rg(c,n,r)}return s.length?Promise.all(s).then(()=>n):n}});function wc(e,t,n,a,l,s){const r=n in a;if(e.issues.length){if(l&&s&&!r)return;t.issues.push(...ws(n,e.issues))}if(!r&&!l){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?r&&(t.value[n]=void 0):t.value[n]=e.value}function x0(e){var a,l,s,r;const t=Object.keys(e.shape);for(const o of t)if(!((r=(s=(l=(a=e.shape)==null?void 0:a[o])==null?void 0:l._zod)==null?void 0:s.traits)!=null&&r.has("$ZodType")))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);const n=TN(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function y0(e,t,n,a,l,s){const r=[],o=l.keySet,c=l.catchall._zod,u=c.def.type,d=c.optin==="optional",f=c.optout==="optional";for(const h in t){if(h==="__proto__"||o.has(h))continue;if(u==="never"){r.push(h);continue}const p=c.run({value:t[h],issues:[]},a);p instanceof Promise?e.push(p.then(v=>wc(v,n,h,t,d,f))):wc(p,n,h,t,d,f)}return r.length&&n.issues.push({code:"unrecognized_keys",keys:r,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const dE=$("$ZodObject",(e,t)=>{Ke.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const o=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...o};return Object.defineProperty(t,"shape",{value:c}),c}})}const a=Wc(()=>x0(t));Ae(e._zod,"propValues",()=>{const o=t.shape,c={};for(const u in o){const d=o[u]._zod;if(d.values){c[u]??(c[u]=new Set);for(const f of d.values)c[u].add(f)}}return c});const l=pi,s=t.catchall;let r;e._zod.parse=(o,c)=>{r??(r=a.value);const u=o.value;if(!l(u))return o.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),o;o.value={};const d=[],f=r.shape;for(const h of r.keys){const p=f[h],v=p._zod.optin==="optional",j=p._zod.optout==="optional",k=p._zod.run({value:u[h],issues:[]},c);k instanceof Promise?d.push(k.then(g=>wc(g,o,h,u,v,j))):wc(k,o,h,u,v,j)}return s?y0(d,u,o,c,a.value,e):d.length?Promise.all(d).then(()=>o):o}}),fE=$("$ZodObjectJIT",(e,t)=>{dE.init(e,t);const n=e._zod.parse,a=Wc(()=>x0(t)),l=h=>{var b,y;const p=new DT(["shape","payload","ctx"]),v=a.value,j=T=>{const _=Dg(T);return`shape[${_}]._zod.run({ value: input[${_}], issues: [] }, ctx)`};p.write("const input = payload.value;");const k=Object.create(null);let g=0;for(const T of v.keys)k[T]=`key_${g++}`;p.write("const newResult = {};");for(const T of v.keys){const _=k[T],E=Dg(T),D=h[T],O=((b=D==null?void 0:D._zod)==null?void 0:b.optin)==="optional",R=((y=D==null?void 0:D._zod)==null?void 0:y.optout)==="optional";p.write(`const ${_} = ${j(T)};`),O&&R?p.write(`
|
|
152
|
+
if (${_}.issues.length) {
|
|
153
|
+
if (${E} in input) {
|
|
154
|
+
payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
|
|
155
|
+
...iss,
|
|
156
|
+
path: iss.path ? [${E}, ...iss.path] : [${E}]
|
|
157
|
+
})));
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (${_}.value === undefined) {
|
|
162
|
+
if (${E} in input) {
|
|
163
|
+
newResult[${E}] = undefined;
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
newResult[${E}] = ${_}.value;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
`):O?p.write(`
|
|
170
|
+
if (${_}.issues.length) {
|
|
171
|
+
payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
|
|
172
|
+
...iss,
|
|
173
|
+
path: iss.path ? [${E}, ...iss.path] : [${E}]
|
|
174
|
+
})));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (${_}.value === undefined) {
|
|
178
|
+
if (${E} in input) {
|
|
179
|
+
newResult[${E}] = undefined;
|
|
180
|
+
}
|
|
181
|
+
} else {
|
|
182
|
+
newResult[${E}] = ${_}.value;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
`):p.write(`
|
|
186
|
+
const ${_}_present = ${E} in input;
|
|
187
|
+
if (${_}.issues.length) {
|
|
188
|
+
payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
|
|
189
|
+
...iss,
|
|
190
|
+
path: iss.path ? [${E}, ...iss.path] : [${E}]
|
|
191
|
+
})));
|
|
192
|
+
}
|
|
193
|
+
if (!${_}_present && !${_}.issues.length) {
|
|
194
|
+
payload.issues.push({
|
|
195
|
+
code: "invalid_type",
|
|
196
|
+
expected: "nonoptional",
|
|
197
|
+
input: undefined,
|
|
198
|
+
path: [${E}]
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (${_}_present) {
|
|
203
|
+
if (${_}.value === undefined) {
|
|
204
|
+
newResult[${E}] = undefined;
|
|
205
|
+
} else {
|
|
206
|
+
newResult[${E}] = ${_}.value;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
`)}p.write("payload.value = newResult;"),p.write("return payload;");const x=p.compile();return(T,_)=>x(h,T,_)};let s;const r=pi,o=!Rh.jitless,u=o&&_N.value,d=t.catchall;let f;e._zod.parse=(h,p)=>{f??(f=a.value);const v=h.value;return r(v)?o&&u&&(p==null?void 0:p.async)===!1&&p.jitless!==!0?(s||(s=l(t.shape)),h=s(h,p),d?y0([],v,h,p,f,e):h):n(h,p):(h.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),h)}});function Lg(e,t,n,a){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const l=e.filter(s=>!Ss(s));return l.length===1?(t.value=l[0].value,l[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(r=>Ea(r,a,Ta())))}),t)}const b0=$("$ZodUnion",(e,t)=>{Ke.init(e,t),Ae(e._zod,"optin",()=>t.options.some(a=>a._zod.optin==="optional")?"optional":void 0),Ae(e._zod,"optout",()=>t.options.some(a=>a._zod.optout==="optional")?"optional":void 0),Ae(e._zod,"values",()=>{if(t.options.every(a=>a._zod.values))return new Set(t.options.flatMap(a=>Array.from(a._zod.values)))}),Ae(e._zod,"pattern",()=>{if(t.options.every(a=>a._zod.pattern)){const a=t.options.map(l=>l._zod.pattern);return new RegExp(`^(${a.map(l=>$h(l.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(a,l)=>{if(n)return n(a,l);let s=!1;const r=[];for(const o of t.options){const c=o._zod.run({value:a.value,issues:[]},l);if(c instanceof Promise)r.push(c),s=!0;else{if(c.issues.length===0)return c;r.push(c)}}return s?Promise.all(r).then(o=>Lg(o,a,e,l)):Lg(r,a,e,l)}}),hE=$("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,b0.init(e,t);const n=e._zod.parse;Ae(e._zod,"propValues",()=>{const l={};for(const s of t.options){const r=s._zod.propValues;if(!r||Object.keys(r).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[o,c]of Object.entries(r)){l[o]||(l[o]=new Set);for(const u of c)l[o].add(u)}}return l});const a=Wc(()=>{var r;const l=t.options,s=new Map;for(const o of l){const c=(r=o._zod.propValues)==null?void 0:r[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const u of c){if(s.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,o)}}return s});e._zod.parse=(l,s)=>{const r=l.value;if(!pi(r))return l.issues.push({code:"invalid_type",expected:"object",input:r,inst:e}),l;const o=a.value.get(r==null?void 0:r[t.discriminator]);return o?o._zod.run(l,s):t.unionFallback||s.direction==="backward"?n(l,s):(l.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(a.value.keys()),input:r,path:[t.discriminator],inst:e}),l)}}),pE=$("$ZodIntersection",(e,t)=>{Ke.init(e,t),e._zod.parse=(n,a)=>{const l=n.value,s=t.left._zod.run({value:l,issues:[]},a),r=t.right._zod.run({value:l,issues:[]},a);return s instanceof Promise||r instanceof Promise?Promise.all([s,r]).then(([c,u])=>$g(n,c,u)):$g(n,s,r)}});function uf(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(Is(e)&&Is(t)){const n=Object.keys(t),a=Object.keys(e).filter(s=>n.indexOf(s)!==-1),l={...e,...t};for(const s of a){const r=uf(e[s],t[s]);if(!r.valid)return{valid:!1,mergeErrorPath:[s,...r.mergeErrorPath]};l[s]=r.data}return{valid:!0,data:l}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let a=0;a<e.length;a++){const l=e[a],s=t[a],r=uf(l,s);if(!r.valid)return{valid:!1,mergeErrorPath:[a,...r.mergeErrorPath]};n.push(r.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function $g(e,t,n){const a=new Map;let l;for(const o of t.issues)if(o.code==="unrecognized_keys"){l??(l=o);for(const c of o.keys)a.has(c)||a.set(c,{}),a.get(c).l=!0}else e.issues.push(o);for(const o of n.issues)if(o.code==="unrecognized_keys")for(const c of o.keys)a.has(c)||a.set(c,{}),a.get(c).r=!0;else e.issues.push(o);const s=[...a].filter(([,o])=>o.l&&o.r).map(([o])=>o);if(s.length&&l&&e.issues.push({...l,keys:s}),Ss(e))return e;const r=uf(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const mE=$("$ZodRecord",(e,t)=>{Ke.init(e,t),e._zod.parse=(n,a)=>{const l=n.value;if(!Is(l))return n.issues.push({expected:"record",code:"invalid_type",input:l,inst:e}),n;const s=[],r=t.keyType._zod.values;if(r){n.value={};const o=new Set;for(const u of r)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){o.add(typeof u=="number"?u.toString():u);const d=t.keyType._zod.run({value:u,issues:[]},a);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(p=>Ea(p,a,Ta())),input:u,path:[u],inst:e});continue}const f=d.value,h=t.valueType._zod.run({value:l[u],issues:[]},a);h instanceof Promise?s.push(h.then(p=>{p.issues.length&&n.issues.push(...ws(u,p.issues)),n.value[f]=p.value})):(h.issues.length&&n.issues.push(...ws(u,h.issues)),n.value[f]=h.value)}let c;for(const u in l)o.has(u)||(c=c??[],c.push(u));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:l,inst:e,keys:c})}else{n.value={};for(const o of Reflect.ownKeys(l)){if(o==="__proto__"||!Object.prototype.propertyIsEnumerable.call(l,o))continue;let c=t.keyType._zod.run({value:o,issues:[]},a);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof o=="string"&&d0.test(o)&&c.issues.length){const f=t.keyType._zod.run({value:Number(o),issues:[]},a);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(c=f)}if(c.issues.length){t.mode==="loose"?n.value[o]=l[o]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(f=>Ea(f,a,Ta())),input:o,path:[o],inst:e});continue}const d=t.valueType._zod.run({value:l[o],issues:[]},a);d instanceof Promise?s.push(d.then(f=>{f.issues.length&&n.issues.push(...ws(o,f.issues)),n.value[c.value]=f.value})):(d.issues.length&&n.issues.push(...ws(o,d.issues)),n.value[c.value]=d.value)}}return s.length?Promise.all(s).then(()=>n):n}}),gE=$("$ZodEnum",(e,t)=>{Ke.init(e,t);const n=n0(t.entries),a=new Set(n);e._zod.values=a,e._zod.pattern=new RegExp(`^(${n.filter(l=>NN.has(typeof l)).map(l=>typeof l=="string"?Xs(l):l.toString()).join("|")})$`),e._zod.parse=(l,s)=>{const r=l.value;return a.has(r)||l.issues.push({code:"invalid_value",values:n,input:r,inst:e}),l}}),xE=$("$ZodLiteral",(e,t)=>{if(Ke.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"?Xs(a):a?Xs(a.toString()):String(a)).join("|")})$`),e._zod.parse=(a,l)=>{const s=a.value;return n.has(s)||a.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),a}}),yE=$("$ZodTransform",(e,t)=>{Ke.init(e,t),e._zod.optin="optional",e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new t0(e.constructor.name);const l=t.transform(n.value,n);if(a.async)return(l instanceof Promise?l:Promise.resolve(l)).then(r=>(n.value=r,n.fallback=!0,n));if(l instanceof Promise)throw new Ds;return n.value=l,n.fallback=!0,n}});function Ug(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const v0=$("$ZodOptional",(e,t)=>{Ke.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ae(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ae(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${$h(n.source)})?$`):void 0}),e._zod.parse=(n,a)=>{if(t.innerType._zod.optin==="optional"){const l=n.value,s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(r=>Ug(r,l)):Ug(s,l)}return n.value===void 0?n:t.innerType._zod.run(n,a)}}),bE=$("$ZodExactOptional",(e,t)=>{v0.init(e,t),Ae(e._zod,"values",()=>t.innerType._zod.values),Ae(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,a)=>t.innerType._zod.run(n,a)}),vE=$("$ZodNullable",(e,t)=>{Ke.init(e,t),Ae(e._zod,"optin",()=>t.innerType._zod.optin),Ae(e._zod,"optout",()=>t.innerType._zod.optout),Ae(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${$h(n.source)}|null)$`):void 0}),Ae(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)}),SE=$("$ZodDefault",(e,t)=>{Ke.init(e,t),e._zod.optin="optional",Ae(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);if(n.value===void 0)return n.value=t.defaultValue,n;const l=t.innerType._zod.run(n,a);return l instanceof Promise?l.then(s=>Bg(s,t)):Bg(l,t)}});function Bg(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const wE=$("$ZodPrefault",(e,t)=>{Ke.init(e,t),e._zod.optin="optional",Ae(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))}),jE=$("$ZodNonOptional",(e,t)=>{Ke.init(e,t),Ae(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(a=>a!==void 0)):void 0}),e._zod.parse=(n,a)=>{const l=t.innerType._zod.run(n,a);return l instanceof Promise?l.then(s=>Zg(s,e)):Zg(l,e)}});function Zg(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 kE=$("$ZodCatch",(e,t)=>{Ke.init(e,t),e._zod.optin="optional",Ae(e._zod,"optout",()=>t.innerType._zod.optout),Ae(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const l=t.innerType._zod.run(n,a);return l instanceof Promise?l.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(r=>Ea(r,a,Ta()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=l.value,l.issues.length&&(n.value=t.catchValue({...n,error:{issues:l.issues.map(s=>Ea(s,a,Ta()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),_E=$("$ZodPipe",(e,t)=>{Ke.init(e,t),Ae(e._zod,"values",()=>t.in._zod.values),Ae(e._zod,"optin",()=>t.in._zod.optin),Ae(e._zod,"optout",()=>t.out._zod.optout),Ae(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,a)=>{if(a.direction==="backward"){const s=t.out._zod.run(n,a);return s instanceof Promise?s.then(r=>xo(r,t.in,a)):xo(s,t.in,a)}const l=t.in._zod.run(n,a);return l instanceof Promise?l.then(s=>xo(s,t.out,a)):xo(l,t.out,a)}});function xo(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const NE=$("$ZodReadonly",(e,t)=>{Ke.init(e,t),Ae(e._zod,"propValues",()=>t.innerType._zod.propValues),Ae(e._zod,"values",()=>t.innerType._zod.values),Ae(e._zod,"optin",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optin}),Ae(e._zod,"optout",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optout}),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const l=t.innerType._zod.run(n,a);return l instanceof Promise?l.then(Hg):Hg(l)}});function Hg(e){return e.value=Object.freeze(e.value),e}const TE=$("$ZodCustom",(e,t)=>{en.init(e,t),Ke.init(e,t),e._zod.parse=(n,a)=>n,e._zod.check=n=>{const a=n.value,l=t.fn(a);if(l instanceof Promise)return l.then(s=>qg(s,n,a,e));qg(l,n,a,e)}});function qg(e,t,n,a){if(!e){const l={code:"custom",input:n,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(l.params=a._zod.def.params),t.issues.push(mi(l))}}var Gg;class EE{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const a=n[0];return this._map.set(t,a),a&&typeof a=="object"&&"id"in a&&this._idmap.set(a.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const a={...this.get(n)??{}};delete a.id;const l={...a,...this._map.get(t)};return Object.keys(l).length?l:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function AE(){return new EE}(Gg=globalThis).__zod_globalRegistry??(Gg.__zod_globalRegistry=AE());const Mr=globalThis.__zod_globalRegistry;function zE(e,t){return new e({type:"string",...te(t)})}function CE(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...te(t)})}function Yg(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...te(t)})}function OE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...te(t)})}function DE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...te(t)})}function ME(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...te(t)})}function RE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...te(t)})}function LE(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...te(t)})}function $E(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...te(t)})}function UE(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...te(t)})}function BE(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...te(t)})}function ZE(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...te(t)})}function HE(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...te(t)})}function qE(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...te(t)})}function GE(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...te(t)})}function YE(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...te(t)})}function IE(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...te(t)})}function XE(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...te(t)})}function VE(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...te(t)})}function QE(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...te(t)})}function KE(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...te(t)})}function JE(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...te(t)})}function WE(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...te(t)})}function FE(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...te(t)})}function PE(e,t){return new e({type:"string",format:"date",check:"string_format",...te(t)})}function eA(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...te(t)})}function tA(e,t){return new e({type:"string",format:"duration",check:"string_format",...te(t)})}function nA(e,t){return new e({type:"number",checks:[],...te(t)})}function aA(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...te(t)})}function lA(e,t){return new e({type:"boolean",...te(t)})}function sA(e){return new e({type:"unknown"})}function rA(e,t){return new e({type:"never",...te(t)})}function Ig(e,t){return new h0({check:"less_than",...te(t),value:e,inclusive:!1})}function nd(e,t){return new h0({check:"less_than",...te(t),value:e,inclusive:!0})}function Xg(e,t){return new p0({check:"greater_than",...te(t),value:e,inclusive:!1})}function ad(e,t){return new p0({check:"greater_than",...te(t),value:e,inclusive:!0})}function Vg(e,t){return new ST({check:"multiple_of",...te(t),value:e})}function S0(e,t){return new jT({check:"max_length",...te(t),maximum:e})}function jc(e,t){return new kT({check:"min_length",...te(t),minimum:e})}function w0(e,t){return new _T({check:"length_equals",...te(t),length:e})}function iA(e,t){return new NT({check:"string_format",format:"regex",...te(t),pattern:e})}function oA(e){return new TT({check:"string_format",format:"lowercase",...te(e)})}function cA(e){return new ET({check:"string_format",format:"uppercase",...te(e)})}function uA(e,t){return new AT({check:"string_format",format:"includes",...te(t),includes:e})}function dA(e,t){return new zT({check:"string_format",format:"starts_with",...te(t),prefix:e})}function fA(e,t){return new CT({check:"string_format",format:"ends_with",...te(t),suffix:e})}function rr(e){return new OT({check:"overwrite",tx:e})}function hA(e){return rr(t=>t.normalize(e))}function pA(){return rr(e=>e.trim())}function mA(){return rr(e=>e.toLowerCase())}function gA(){return rr(e=>e.toUpperCase())}function xA(){return rr(e=>kN(e))}function yA(e,t,n){return new e({type:"array",element:t,...te(n)})}function bA(e,t,n){return new e({type:"custom",check:"custom",fn:t,...te(n)})}function vA(e,t){const n=SA(a=>(a.addIssue=l=>{if(typeof l=="string")a.issues.push(mi(l,a.value,n._zod.def));else{const s=l;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=a.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),a.issues.push(mi(s))}},e(a.value,a)),t);return n}function SA(e,t){const n=new en({check:"custom",...te(t)});return n._zod.check=e,n}function j0(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)??Mr,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 it(e,t,n={path:[],schemaPath:[]}){var d,f;var a;const l=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const r={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,r);const o=(f=(d=e._zod).toJSONSchema)==null?void 0:f.call(d);if(o)r.schema=o;else{const h={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,r.schema,h);else{const v=r.schema,j=t.processors[l.type];if(!j)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${l.type}`);j(e,t,v,h)}const p=e._zod.parent;p&&(r.ref||(r.ref=p),it(p,t,h),t.seen.get(p).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(r.schema,c),t.io==="input"&&Mt(e)&&(delete r.schema.examples,delete r.schema.default),t.io==="input"&&"_prefault"in r.schema&&((a=r.schema).default??(a.default=r.schema._prefault)),delete r.schema._prefault,t.seen.get(e).schema}function k0(e,t){var r,o,c,u;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 d of e.seen.entries()){const f=(r=e.metadataRegistry.get(d[0]))==null?void 0:r.id;if(f){const h=a.get(f);if(h&&h!==d[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(f,d[0])}}const l=d=>{var j;const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const k=(j=e.external.registry.get(d[0]))==null?void 0:j.id,g=e.external.uri??(b=>b);if(k)return{ref:g(k)};const x=d[1].defId??d[1].schema.id??`schema${e.counter++}`;return d[1].defId=x,{defId:x,ref:`${g("__shared")}#/${f}/${x}`}}if(d[1]===n)return{ref:"#"};const p=`#/${f}/`,v=d[1].schema.id??`__schema${e.counter++}`;return{defId:v,ref:p+v}},s=d=>{if(d[1].schema.$ref)return;const f=d[1],{ref:h,defId:p}=l(d);f.def={...f.schema},p&&(f.defId=p);const v=f.schema;for(const j in v)delete v[j];v.$ref=h};if(e.cycles==="throw")for(const d of e.seen.entries()){const f=d[1];if(f.cycle)throw new Error(`Cycle detected: #/${(o=f.cycle)==null?void 0:o.join("/")}/<root>
|
|
211
|
+
|
|
212
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of e.seen.entries()){const f=d[1];if(t===d[0]){s(d);continue}if(e.external){const p=(c=e.external.registry.get(d[0]))==null?void 0:c.id;if(t!==d[0]&&p){s(d);continue}}if((u=e.metadataRegistry.get(d[0]))==null?void 0:u.id){s(d);continue}if(f.cycle){s(d);continue}if(f.count>1&&e.reused==="ref"){s(d);continue}}}function _0(e,t){var o,c,u,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=f=>{const h=e.seen.get(f);if(h.ref===null)return;const p=h.def??h.schema,v={...p},j=h.ref;if(h.ref=null,j){a(j);const g=e.seen.get(j),x=g.schema;if(x.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(x)):Object.assign(p,x),Object.assign(p,v),f._zod.parent===j)for(const y in p)y==="$ref"||y==="allOf"||y in v||delete p[y];if(x.$ref&&g.def)for(const y in p)y==="$ref"||y==="allOf"||y in g.def&&JSON.stringify(p[y])===JSON.stringify(g.def[y])&&delete p[y]}const k=f._zod.parent;if(k&&k!==j){a(k);const g=e.seen.get(k);if(g!=null&&g.schema.$ref&&(p.$ref=g.schema.$ref,g.def))for(const x in p)x==="$ref"||x==="allOf"||x in g.def&&JSON.stringify(p[x])===JSON.stringify(g.def[x])&&delete p[x]}e.override({zodSchema:f,jsonSchema:p,path:h.path??[]})};for(const f of[...e.seen.entries()].reverse())a(f[0]);const l={};if(e.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?l.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?l.$schema="http://json-schema.org/draft-04/schema#":e.target,(o=e.external)!=null&&o.uri){const f=(c=e.external.registry.get(t))==null?void 0:c.id;if(!f)throw new Error("Schema is missing an `id` property");l.$id=e.external.uri(f)}Object.assign(l,n.def??n.schema);const s=(u=e.metadataRegistry.get(t))==null?void 0:u.id;s!==void 0&&l.id===s&&delete l.id;const r=((d=e.external)==null?void 0:d.defs)??{};for(const f of e.seen.entries()){const h=f[1];h.def&&h.defId&&(h.def.id===h.defId&&delete h.def.id,r[h.defId]=h.def)}e.external||Object.keys(r).length>0&&(e.target==="draft-2020-12"?l.$defs=r:l.definitions=r);try{const f=JSON.parse(JSON.stringify(l));return Object.defineProperty(f,"~standard",{value:{...t["~standard"],jsonSchema:{input:kc(t,"input",e.processors),output:kc(t,"output",e.processors)}},enumerable:!1,writable:!1}),f}catch{throw new Error("Error converting schema to JSON.")}}function Mt(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 Mt(a.element,n);if(a.type==="set")return Mt(a.valueType,n);if(a.type==="lazy")return Mt(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 Mt(a.innerType,n);if(a.type==="intersection")return Mt(a.left,n)||Mt(a.right,n);if(a.type==="record"||a.type==="map")return Mt(a.keyType,n)||Mt(a.valueType,n);if(a.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Mt(a.in,n)||Mt(a.out,n);if(a.type==="object"){for(const l in a.shape)if(Mt(a.shape[l],n))return!0;return!1}if(a.type==="union"){for(const l of a.options)if(Mt(l,n))return!0;return!1}if(a.type==="tuple"){for(const l of a.items)if(Mt(l,n))return!0;return!!(a.rest&&Mt(a.rest,n))}return!1}const wA=(e,t={})=>n=>{const a=j0({...n,processors:t});return it(e,a),k0(a,e),_0(a,e)},kc=(e,t,n={})=>a=>{const{libraryOptions:l,target:s}=a??{},r=j0({...l??{},target:s,io:t,processors:n});return it(e,r),k0(r,e),_0(r,e)},jA={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},kA=(e,t,n,a)=>{const l=n;l.type="string";const{minimum:s,maximum:r,format:o,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(l.minLength=s),typeof r=="number"&&(l.maxLength=r),o&&(l.format=jA[o]??o,l.format===""&&delete l.format,o==="time"&&delete l.format),u&&(l.contentEncoding=u),c&&c.size>0){const d=[...c];d.length===1?l.pattern=d[0].source:d.length>1&&(l.allOf=[...d.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},_A=(e,t,n,a)=>{const l=n,{minimum:s,maximum:r,format:o,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof o=="string"&&o.includes("int")?l.type="integer":l.type="number";const f=typeof d=="number"&&d>=(s??Number.NEGATIVE_INFINITY),h=typeof u=="number"&&u<=(r??Number.POSITIVE_INFINITY),p=t.target==="draft-04"||t.target==="openapi-3.0";f?p?(l.minimum=d,l.exclusiveMinimum=!0):l.exclusiveMinimum=d:typeof s=="number"&&(l.minimum=s),h?p?(l.maximum=u,l.exclusiveMaximum=!0):l.exclusiveMaximum=u:typeof r=="number"&&(l.maximum=r),typeof c=="number"&&(l.multipleOf=c)},NA=(e,t,n,a)=>{n.type="boolean"},TA=(e,t,n,a)=>{n.not={}},EA=(e,t,n,a)=>{},AA=(e,t,n,a)=>{const l=e._zod.def,s=n0(l.entries);s.every(r=>typeof r=="number")&&(n.type="number"),s.every(r=>typeof r=="string")&&(n.type="string"),n.enum=s},zA=(e,t,n,a)=>{const l=e._zod.def,s=[];for(const r of l.values)if(r===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof r=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(r))}else s.push(r);if(s.length!==0)if(s.length===1){const r=s[0];n.type=r===null?"null":typeof r,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[r]:n.const=r}else s.every(r=>typeof r=="number")&&(n.type="number"),s.every(r=>typeof r=="string")&&(n.type="string"),s.every(r=>typeof r=="boolean")&&(n.type="boolean"),s.every(r=>r===null)&&(n.type="null"),n.enum=s},CA=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},OA=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},DA=(e,t,n,a)=>{const l=n,s=e._zod.def,{minimum:r,maximum:o}=e._zod.bag;typeof r=="number"&&(l.minItems=r),typeof o=="number"&&(l.maxItems=o),l.type="array",l.items=it(s.element,t,{...a,path:[...a.path,"items"]})},MA=(e,t,n,a)=>{var u;const l=n,s=e._zod.def;l.type="object",l.properties={};const r=s.shape;for(const d in r)l.properties[d]=it(r[d],t,{...a,path:[...a.path,"properties",d]});const o=new Set(Object.keys(r)),c=new Set([...o].filter(d=>{const f=s.shape[d]._zod;return t.io==="input"?f.optin===void 0:f.optout===void 0}));c.size>0&&(l.required=Array.from(c)),((u=s.catchall)==null?void 0:u._zod.def.type)==="never"?l.additionalProperties=!1:s.catchall?s.catchall&&(l.additionalProperties=it(s.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(l.additionalProperties=!1)},RA=(e,t,n,a)=>{const l=e._zod.def,s=l.inclusive===!1,r=l.options.map((o,c)=>it(o,t,{...a,path:[...a.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=r:n.anyOf=r},LA=(e,t,n,a)=>{const l=e._zod.def,s=it(l.left,t,{...a,path:[...a.path,"allOf",0]}),r=it(l.right,t,{...a,path:[...a.path,"allOf",1]}),o=u=>"allOf"in u&&Object.keys(u).length===1,c=[...o(s)?s.allOf:[s],...o(r)?r.allOf:[r]];n.allOf=c},$A=(e,t,n,a)=>{const l=n,s=e._zod.def;l.type="object";const r=s.keyType,o=r._zod.bag,c=o==null?void 0:o.patterns;if(s.mode==="loose"&&c&&c.size>0){const d=it(s.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});l.patternProperties={};for(const f of c)l.patternProperties[f.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(l.propertyNames=it(s.keyType,t,{...a,path:[...a.path,"propertyNames"]})),l.additionalProperties=it(s.valueType,t,{...a,path:[...a.path,"additionalProperties"]});const u=r._zod.values;if(u){const d=[...u].filter(f=>typeof f=="string"||typeof f=="number");d.length>0&&(l.required=d)}},UA=(e,t,n,a)=>{const l=e._zod.def,s=it(l.innerType,t,a),r=t.seen.get(e);t.target==="openapi-3.0"?(r.ref=l.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},BA=(e,t,n,a)=>{const l=e._zod.def;it(l.innerType,t,a);const s=t.seen.get(e);s.ref=l.innerType},ZA=(e,t,n,a)=>{const l=e._zod.def;it(l.innerType,t,a);const s=t.seen.get(e);s.ref=l.innerType,n.default=JSON.parse(JSON.stringify(l.defaultValue))},HA=(e,t,n,a)=>{const l=e._zod.def;it(l.innerType,t,a);const s=t.seen.get(e);s.ref=l.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(l.defaultValue)))},qA=(e,t,n,a)=>{const l=e._zod.def;it(l.innerType,t,a);const s=t.seen.get(e);s.ref=l.innerType;let r;try{r=l.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=r},GA=(e,t,n,a)=>{const l=e._zod.def,s=l.in._zod.traits.has("$ZodTransform"),r=t.io==="input"?s?l.out:l.in:l.out;it(r,t,a);const o=t.seen.get(e);o.ref=r},YA=(e,t,n,a)=>{const l=e._zod.def;it(l.innerType,t,a);const s=t.seen.get(e);s.ref=l.innerType,n.readOnly=!0},N0=(e,t,n,a)=>{const l=e._zod.def;it(l.innerType,t,a);const s=t.seen.get(e);s.ref=l.innerType},IA=$("ZodISODateTime",(e,t)=>{XT.init(e,t),We.init(e,t)});function XA(e){return FE(IA,e)}const VA=$("ZodISODate",(e,t)=>{VT.init(e,t),We.init(e,t)});function QA(e){return PE(VA,e)}const KA=$("ZodISOTime",(e,t)=>{QT.init(e,t),We.init(e,t)});function JA(e){return eA(KA,e)}const WA=$("ZodISODuration",(e,t)=>{KT.init(e,t),We.init(e,t)});function FA(e){return tA(WA,e)}const PA=(e,t)=>{r0.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>UN(e,n)},flatten:{value:n=>$N(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,cf,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,cf,2)}},isEmpty:{get(){return e.issues.length===0}}})},On=$("ZodError",PA,{Parent:Error}),e3=Bh(On),t3=Zh(On),n3=Fc(On),a3=Pc(On),l3=HN(On),s3=qN(On),r3=GN(On),i3=YN(On),o3=IN(On),c3=XN(On),u3=VN(On),d3=QN(On),Qg=new WeakMap;function Mi(e,t,n){const a=Object.getPrototypeOf(e);let l=Qg.get(a);if(l||(l=new Set,Qg.set(a,l)),!l.has(t)){l.add(t);for(const s in n){const r=n[s];Object.defineProperty(a,s,{configurable:!0,enumerable:!1,get(){const o=r.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:o}),o},set(o){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:o})}})}}}const Je=$("ZodType",(e,t)=>(Ke.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:kc(e,"input"),output:kc(e,"output")}}),e.toJSONSchema=wA(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,a)=>e3(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>n3(e,n,a),e.parseAsync=async(n,a)=>t3(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>a3(e,n,a),e.spa=e.safeParseAsync,e.encode=(n,a)=>l3(e,n,a),e.decode=(n,a)=>s3(e,n,a),e.encodeAsync=async(n,a)=>r3(e,n,a),e.decodeAsync=async(n,a)=>i3(e,n,a),e.safeEncode=(n,a)=>o3(e,n,a),e.safeDecode=(n,a)=>c3(e,n,a),e.safeEncodeAsync=async(n,a)=>u3(e,n,a),e.safeDecodeAsync=async(n,a)=>d3(e,n,a),Mi(e,"ZodType",{check(...n){const a=this.def;return this.clone(ml(a,{checks:[...a.checks??[],...n.map(l=>typeof l=="function"?{_zod:{check:l,def:{check:"custom"},onattach:[]}}:l)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,a){return gl(this,n,a)},brand(){return this},register(n,a){return n.add(this,a),this},refine(n,a){return this.check(l5(n,a))},superRefine(n,a){return this.check(s5(n,a))},overwrite(n){return this.check(rr(n))},optional(){return Fg(this)},exactOptional(){return I3(this)},nullable(){return Pg(this)},nullish(){return Fg(Pg(this))},nonoptional(n){return W3(this,n)},array(){return la(this)},or(n){return Ri([this,n])},and(n){return Z3(this,n)},transform(n){return ex(this,G3(n))},default(n){return Q3(this,n)},prefault(n){return J3(this,n)},catch(n){return P3(this,n)},pipe(n){return ex(this,n)},readonly(){return n5(this)},describe(n){const a=this.clone();return Mr.add(a,{description:n}),a},meta(...n){if(n.length===0)return Mr.get(this);const a=this.clone();return Mr.add(a,n[0]),a},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){var n;return(n=Mr.get(e))==null?void 0:n.description},configurable:!0}),e)),T0=$("_ZodString",(e,t)=>{Hh.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(a,l,s)=>kA(e,a,l);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Mi(e,"_ZodString",{regex(...a){return this.check(iA(...a))},includes(...a){return this.check(uA(...a))},startsWith(...a){return this.check(dA(...a))},endsWith(...a){return this.check(fA(...a))},min(...a){return this.check(jc(...a))},max(...a){return this.check(S0(...a))},length(...a){return this.check(w0(...a))},nonempty(...a){return this.check(jc(1,...a))},lowercase(a){return this.check(oA(a))},uppercase(a){return this.check(cA(a))},trim(){return this.check(pA())},normalize(...a){return this.check(hA(...a))},toLowerCase(){return this.check(mA())},toUpperCase(){return this.check(gA())},slugify(){return this.check(xA())}})}),f3=$("ZodString",(e,t)=>{Hh.init(e,t),T0.init(e,t),e.email=n=>e.check(CE(h3,n)),e.url=n=>e.check(LE(p3,n)),e.jwt=n=>e.check(WE(A3,n)),e.emoji=n=>e.check($E(m3,n)),e.guid=n=>e.check(Yg(Kg,n)),e.uuid=n=>e.check(OE(yo,n)),e.uuidv4=n=>e.check(DE(yo,n)),e.uuidv6=n=>e.check(ME(yo,n)),e.uuidv7=n=>e.check(RE(yo,n)),e.nanoid=n=>e.check(UE(g3,n)),e.guid=n=>e.check(Yg(Kg,n)),e.cuid=n=>e.check(BE(x3,n)),e.cuid2=n=>e.check(ZE(y3,n)),e.ulid=n=>e.check(HE(b3,n)),e.base64=n=>e.check(QE(N3,n)),e.base64url=n=>e.check(KE(T3,n)),e.xid=n=>e.check(qE(v3,n)),e.ksuid=n=>e.check(GE(S3,n)),e.ipv4=n=>e.check(YE(w3,n)),e.ipv6=n=>e.check(IE(j3,n)),e.cidrv4=n=>e.check(XE(k3,n)),e.cidrv6=n=>e.check(VE(_3,n)),e.e164=n=>e.check(JE(E3,n)),e.datetime=n=>e.check(XA(n)),e.date=n=>e.check(QA(n)),e.time=n=>e.check(JA(n)),e.duration=n=>e.check(FA(n))});function L(e){return zE(f3,e)}const We=$("ZodStringFormat",(e,t)=>{Xe.init(e,t),T0.init(e,t)}),h3=$("ZodEmail",(e,t)=>{$T.init(e,t),We.init(e,t)}),Kg=$("ZodGUID",(e,t)=>{RT.init(e,t),We.init(e,t)}),yo=$("ZodUUID",(e,t)=>{LT.init(e,t),We.init(e,t)}),p3=$("ZodURL",(e,t)=>{UT.init(e,t),We.init(e,t)}),m3=$("ZodEmoji",(e,t)=>{BT.init(e,t),We.init(e,t)}),g3=$("ZodNanoID",(e,t)=>{ZT.init(e,t),We.init(e,t)}),x3=$("ZodCUID",(e,t)=>{HT.init(e,t),We.init(e,t)}),y3=$("ZodCUID2",(e,t)=>{qT.init(e,t),We.init(e,t)}),b3=$("ZodULID",(e,t)=>{GT.init(e,t),We.init(e,t)}),v3=$("ZodXID",(e,t)=>{YT.init(e,t),We.init(e,t)}),S3=$("ZodKSUID",(e,t)=>{IT.init(e,t),We.init(e,t)}),w3=$("ZodIPv4",(e,t)=>{JT.init(e,t),We.init(e,t)}),j3=$("ZodIPv6",(e,t)=>{WT.init(e,t),We.init(e,t)}),k3=$("ZodCIDRv4",(e,t)=>{FT.init(e,t),We.init(e,t)}),_3=$("ZodCIDRv6",(e,t)=>{PT.init(e,t),We.init(e,t)}),N3=$("ZodBase64",(e,t)=>{eE.init(e,t),We.init(e,t)}),T3=$("ZodBase64URL",(e,t)=>{nE.init(e,t),We.init(e,t)}),E3=$("ZodE164",(e,t)=>{aE.init(e,t),We.init(e,t)}),A3=$("ZodJWT",(e,t)=>{sE.init(e,t),We.init(e,t)}),E0=$("ZodNumber",(e,t)=>{g0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(a,l,s)=>_A(e,a,l),Mi(e,"ZodNumber",{gt(a,l){return this.check(Xg(a,l))},gte(a,l){return this.check(ad(a,l))},min(a,l){return this.check(ad(a,l))},lt(a,l){return this.check(Ig(a,l))},lte(a,l){return this.check(nd(a,l))},max(a,l){return this.check(nd(a,l))},int(a){return this.check(Jg(a))},safe(a){return this.check(Jg(a))},positive(a){return this.check(Xg(0,a))},nonnegative(a){return this.check(ad(0,a))},negative(a){return this.check(Ig(0,a))},nonpositive(a){return this.check(nd(0,a))},multipleOf(a,l){return this.check(Vg(a,l))},step(a,l){return this.check(Vg(a,l))},finite(){return this}});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 ce(e){return nA(E0,e)}const z3=$("ZodNumberFormat",(e,t)=>{rE.init(e,t),E0.init(e,t)});function Jg(e){return aA(z3,e)}const C3=$("ZodBoolean",(e,t)=>{iE.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>NA(e,n,a)});function qh(e){return lA(C3,e)}const O3=$("ZodUnknown",(e,t)=>{oE.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>EA()});function yn(){return sA(O3)}const D3=$("ZodNever",(e,t)=>{cE.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>TA(e,n,a)});function M3(e){return rA(D3,e)}const R3=$("ZodArray",(e,t)=>{uE.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>DA(e,n,a,l),e.element=t.element,Mi(e,"ZodArray",{min(n,a){return this.check(jc(n,a))},nonempty(n){return this.check(jc(1,n))},max(n,a){return this.check(S0(n,a))},length(n,a){return this.check(w0(n,a))},unwrap(){return this.element}})});function la(e,t){return yA(R3,e,t)}const L3=$("ZodObject",(e,t)=>{fE.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>MA(e,n,a,l),Ae(e,"shape",()=>t.shape),Mi(e,"ZodObject",{keyof(){return Ne(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:yn()})},loose(){return this.clone({...this._zod.def,catchall:yn()})},strict(){return this.clone({...this._zod.def,catchall:M3()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return CN(this,n)},safeExtend(n){return ON(this,n)},merge(n){return DN(this,n)},pick(n){return AN(this,n)},omit(n){return zN(this,n)},partial(...n){return MN(z0,this,n[0])},required(...n){return RN(C0,this,n[0])}})});function Q(e,t){const n={type:"object",shape:e??{},...te(t)};return new L3(n)}const A0=$("ZodUnion",(e,t)=>{b0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>RA(e,n,a,l),e.options=t.options});function Ri(e,t){return new A0({type:"union",options:e,...te(t)})}const $3=$("ZodDiscriminatedUnion",(e,t)=>{A0.init(e,t),hE.init(e,t)});function U3(e,t,n){return new $3({type:"union",options:t,discriminator:e,...te(n)})}const B3=$("ZodIntersection",(e,t)=>{pE.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>LA(e,n,a,l)});function Z3(e,t){return new B3({type:"intersection",left:e,right:t})}const Wg=$("ZodRecord",(e,t)=>{mE.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>$A(e,n,a,l),e.keyType=t.keyType,e.valueType=t.valueType});function ir(e,t,n){return!t||!t._zod?new Wg({type:"record",keyType:L(),valueType:e,...te(t)}):new Wg({type:"record",keyType:e,valueType:t,...te(n)})}const df=$("ZodEnum",(e,t)=>{gE.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(a,l,s)=>AA(e,a,l),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(a,l)=>{const s={};for(const r of a)if(n.has(r))s[r]=t.entries[r];else throw new Error(`Key ${r} not found in enum`);return new df({...t,checks:[],...te(l),entries:s})},e.exclude=(a,l)=>{const s={...t.entries};for(const r of a)if(n.has(r))delete s[r];else throw new Error(`Key ${r} not found in enum`);return new df({...t,checks:[],...te(l),entries:s})}});function Ne(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new df({type:"enum",entries:n,...te(t)})}const H3=$("ZodLiteral",(e,t)=>{xE.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>zA(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 De(e,t){return new H3({type:"literal",values:Array.isArray(e)?e:[e],...te(t)})}const q3=$("ZodTransform",(e,t)=>{yE.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>OA(e,n),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new t0(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(mi(s,n.value,t));else{const r=s;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=e),n.issues.push(mi(r))}};const l=t.transform(n.value,n);return l instanceof Promise?l.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=l,n.fallback=!0,n)}});function G3(e){return new q3({type:"transform",transform:e})}const z0=$("ZodOptional",(e,t)=>{v0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>N0(e,n,a,l),e.unwrap=()=>e._zod.def.innerType});function Fg(e){return new z0({type:"optional",innerType:e})}const Y3=$("ZodExactOptional",(e,t)=>{bE.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>N0(e,n,a,l),e.unwrap=()=>e._zod.def.innerType});function I3(e){return new Y3({type:"optional",innerType:e})}const X3=$("ZodNullable",(e,t)=>{vE.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>UA(e,n,a,l),e.unwrap=()=>e._zod.def.innerType});function Pg(e){return new X3({type:"nullable",innerType:e})}const V3=$("ZodDefault",(e,t)=>{SE.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>ZA(e,n,a,l),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Q3(e,t){return new V3({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():l0(t)}})}const K3=$("ZodPrefault",(e,t)=>{wE.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>HA(e,n,a,l),e.unwrap=()=>e._zod.def.innerType});function J3(e,t){return new K3({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():l0(t)}})}const C0=$("ZodNonOptional",(e,t)=>{jE.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>BA(e,n,a,l),e.unwrap=()=>e._zod.def.innerType});function W3(e,t){return new C0({type:"nonoptional",innerType:e,...te(t)})}const F3=$("ZodCatch",(e,t)=>{kE.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>qA(e,n,a,l),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function P3(e,t){return new F3({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const e5=$("ZodPipe",(e,t)=>{_E.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>GA(e,n,a,l),e.in=t.in,e.out=t.out});function ex(e,t){return new e5({type:"pipe",in:e,out:t})}const t5=$("ZodReadonly",(e,t)=>{NE.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>YA(e,n,a,l),e.unwrap=()=>e._zod.def.innerType});function n5(e){return new t5({type:"readonly",innerType:e})}const a5=$("ZodCustom",(e,t)=>{TE.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(n,a,l)=>CA(e,n)});function l5(e,t={}){return bA(a5,e,t)}function s5(e,t){return vA(e,t)}const r5=Q({type:De("user-prompt"),id:L(),text:L(),cwd:L(),timestamp:ce()}),i5=Q({type:De("assistant-delta"),id:L(),text:L(),timestamp:ce()}),o5=Q({type:De("assistant-stop"),id:L(),timestamp:ce()}),c5=Q({type:De("tool-call"),id:L(),toolCallId:L(),name:L(),input:ir(L(),yn()),timestamp:ce()}),u5=Q({type:De("tool-result"),id:L(),toolCallId:L(),output:yn(),error:L().optional(),timestamp:ce()}),d5=Q({type:De("approval-request"),id:L(),toolCallId:L(),name:L(),input:ir(L(),yn()),decision:Ne(["allow","deny","ask"]).optional(),timestamp:ce()}),f5=Q({type:De("approval-decision"),id:L(),toolCallId:L(),decision:Ne(["allow","deny"]),by:L().optional(),timestamp:ce()}),h5=Q({type:De("usage"),id:L(),inputTokens:ce(),outputTokens:ce(),cacheReadTokens:ce().optional(),cacheWriteTokens:ce().optional(),timestamp:ce()}),p5=Q({type:De("error"),id:L(),message:L(),code:L().optional(),timestamp:ce()}),m5=Q({type:De("session-start"),id:L(),model:L(),provider:L(),cwd:L(),timestamp:ce()}),g5=Q({type:De("session-stop"),id:L(),reason:L(),timestamp:ce()}),x5=Q({type:De("hook"),id:L(),phase:L(),name:L(),result:L().optional(),error:L().optional(),timestamp:ce()}),y5=Q({type:De("status"),id:L(),message:L(),spinner:qh().optional(),timestamp:ce()}),b5=Q({type:De("session-resumed"),id:L(),turnsRecovered:ce(),timestamp:ce()}),v5=Q({type:De("context-warning"),id:L(),message:L(),timestamp:ce()}),S5=Q({type:De("compaction"),id:L(),summary:L(),summarizedMessageCount:ce(),tokensBefore:ce(),tokensAfter:ce(),timestamp:ce()}),w5=Q({type:De("context-report"),id:L(),model:L(),windowTokens:ce(),usedTokens:ce(),reservedOutput:ce(),breakdown:la(Q({label:L(),tokens:ce()})),timestamp:ce()}),j5=Q({type:De("cron-task-fired"),id:L(),taskId:L(),taskType:Ne(["notify","agent","auto"]),message:L(),timestamp:ce()}),k5=Q({type:De("heartbeat-brief"),id:L(),scheduleType:Ne(["intraday","daily","weekly","monthly","dreaming"]),formattedText:L(),toolCalls:ce(),errors:la(L()),timestamp:ce()}),_5=Q({type:De("channel-updated"),id:L(),channelId:L(),channelType:Ne(["cli","telegram"]),displayName:L(),sessionId:L(),timestamp:ce()}),N5=Q({type:De("mcp-status"),id:L(),serverId:L(),connected:qh(),tools:la(L()),timestamp:ce()}),T5=Q({type:De("daemon-ready"),id:L(),version:L(),timestamp:ce()}),E5=Q({type:De("wiki-op"),id:L(),op:Ne(["ingest","query","lint","edit"]),pages:la(L()),timestamp:ce()});U3("type",[r5,i5,o5,c5,u5,d5,f5,h5,p5,m5,g5,x5,y5,b5,v5,S5,w5,j5,k5,_5,N5,T5,E5]);const A5=Q({jsonrpc:De("2.0"),id:Ri([ce(),L()]),method:L(),params:ir(L(),yn()).optional()}),z5=Q({jsonrpc:De("2.0"),method:L(),params:ir(L(),yn()).optional()}),C5=Q({jsonrpc:De("2.0"),id:Ri([ce(),L()]),result:yn()}),O5=Q({jsonrpc:De("2.0"),id:Ri([ce(),L()]),error:Q({code:ce(),message:L(),data:yn().optional()})});Ri([A5,z5,C5,O5]);Q({});Q({id:L()});Q({id:L(),text:L()});Q({id:L()});Q({id:L().optional()});Q({});Q({paneIds:la(L()),text:L()});Q({query:L()});Q({slug:L()});Q({source:L()});Q({});Q({});Q({sessionId:L().optional()});Q({toolCallId:L(),decision:Ne(["allow","deny"])});Q({});Q({});Q({key:L()});Q({key:L(),value:yn()});Q({});Q({});Q({type:Ne(["reminder","heartbeat","task"]).optional(),status:Ne(["pending","fired","executing","completed","failed","cancelled"]).optional()});Q({type:Ne(["reminder","task"]),message:L(),scheduledAt:ce(),schedule:Q({type:Ne(["intraday","daily","weekly","monthly","dreaming"]),value:L()}).optional()});Q({id:L()});Q({});Q({scheduleType:Ne(["intraday","daily","weekly","monthly","dreaming"]).optional()});Q({});Q({});Q({channelId:L()});Q({});Q({});Q({provider:L(),apiKey:L(),model:L(),soulName:L(),soulVibe:L(),userName:L(),userTimezone:L(),userLanguages:L()});Q({sessionId:L(),prompt:L(),provider:Ne(["anthropic","openai","google","ollama","openrouter"]).optional(),mode:Ne(["plan","edit","auto","yolo"]).optional(),effort:Ne(["low","medium","high","max","auto"]).optional(),model:L().optional(),tools:la(L()).optional()});Q({sessionId:L().optional(),status:Ne(["running","completed","error","cancelled"]).optional()});Q({agentId:L()});Q({agentId:L()});Q({agentId:L(),message:L()});Q({instruction:L(),scheduled_at:L(),provider:L().optional(),model:L().optional(),effort:Ne(["low","medium","high","max","auto"]).optional()});Q({status:Ne(["backlog","todo","in_progress","done","canceled","pending","executing","completed","failed"]).optional(),mode:Ne(["human","agent","notify"]).optional(),scope:Ne(["personal","project"]).optional(),priority:Ne(["low","medium","high","critical"]).optional()});Q({title:L(),description:L().default(""),mode:Ne(["human","agent","notify"]).default("human"),scope:Ne(["personal","project"]).default("personal"),priority:Ne(["low","medium","high","critical"]).default("medium"),tags:la(L()).default([]),status:Ne(["backlog","todo","in_progress","done","canceled","pending","executing","completed","failed"]).optional(),scheduled_at:ce().optional()});Q({id:L(),status:Ne(["backlog","todo","in_progress","done","canceled","pending","executing","completed","failed"]).optional(),priority:Ne(["low","medium","high","critical"]).optional(),title:L().optional(),description:L().optional(),tags:la(L()).optional(),mode:Ne(["human","agent","notify"]).optional(),scope:Ne(["personal","project"]).optional(),scheduled_at:ce().optional()});Q({id:L()});const D5=[{name:"status",description:"Show version, model, and account info",usage:"/status",category:"General",handler:"daemon"},{name:"help",description:"Show all available commands",usage:"/help",category:"General",handler:"daemon"},{name:"system",description:"Show OS, platform, Node version, and PathGuard status",usage:"/system",category:"General",handler:"daemon"},{name:"init",description:"Run the setup wizard",usage:"/init",category:"General",handler:"client"},{name:"exit",description:"Exit curie-agent",usage:"/exit",category:"General",handler:"client",aliases:["quit"]},{name:"provider",description:"Switch AI provider",usage:"/provider <anthropic|openai|google|local|ollama|openrouter>",category:"Model & Provider",handler:"daemon"},{name:"model",description:"Switch AI model, set pricing or context window",usage:"/model <model|pricing in;out|window tokens>",category:"Model & Provider",handler:"daemon"},{name:"effort",description:"Set reasoning effort level",usage:"/effort <low|medium|high|max|auto>",category:"Model & Provider",handler:"daemon"},{name:"mode",description:"Set approval mode",usage:"/mode <plan|edit|auto|yolo>",category:"Model & Provider",handler:"daemon"},{name:"theme",description:"Change color theme",usage:"/theme <name>",category:"Display",handler:"client"},{name:"debug",description:"Toggle debug logging",usage:"/debug [on|off]",category:"Display",handler:"client"},{name:"statusline",description:"Toggle status line display",usage:"/statusline [on|off]",category:"Display",handler:"client"},{name:"memory",description:"View memory file sizes or capture a memory",usage:"/memory [status|add <text>]",category:"Knowledge",handler:"daemon"},{name:"todo",description:"Manage tasks in tasks.json",usage:"/todo <list|add|complete|remove>",category:"Knowledge",handler:"daemon"},{name:"stats",description:"Daily usage, sessions, streaks",usage:"/stats",category:"Knowledge",handler:"client"},{name:"context",description:"Context window usage breakdown, compaction, auto-compaction settings",usage:"/context [messages|compact|auto [on|off|threshold N|warn N|forced N|pricing on/off]]",category:"Knowledge",handler:"daemon"},{name:"wiki",description:"Open the wiki tab or run a wiki operation",usage:"/wiki [list|search <query>|lint|status]",category:"Knowledge",handler:"client"},{name:"remind",description:"Create a reminder",usage:"/remind <message at time>",category:"Automation",handler:"daemon"},{name:"cron",description:"Manage reminders",usage:"/cron <list|delete <id>|clear>",category:"Automation",handler:"daemon"},{name:"task",description:"Schedule an agent task",usage:"/task <create|list|delete>",category:"Automation",handler:"daemon"},{name:"heartbeat",description:"Manage heartbeat cycle",usage:"/heartbeat <status|enable|disable|intraday|daily|weekly|monthly|dreaming|now>",category:"Automation",handler:"daemon"},{name:"agent",description:"Launch external AI agent",usage:"/agent <prompt>",category:"Tools",handler:"daemon"},{name:"tools",description:"View/set tool call limits per turn",usage:"/tools [tools_per_call [websearch_per_call]]",category:"Tools",handler:"daemon"},{name:"websearch",description:"View/set web search+fetch limit per turn",usage:"/websearch [count]",category:"Tools",handler:"daemon"},{name:"mcp",description:"Manage MCP server connections",usage:"/mcp <list|reload>",category:"Tools",handler:"daemon"},{name:"skill",description:"List or show available skills",usage:"/skill [name]",category:"Tools",handler:"daemon"},{name:"channels",description:"Manage Telegram channel config",usage:"/channels <list|switch <id>|set-bot-token <t>|set-user-id <id>|set-chat-id <id>|disconnect>",category:"Communication",handler:"client"},{name:"cd",description:"Change working directory with safety checks",usage:"/cd <path>",category:"Safety",handler:"daemon"},{name:"snapshots",description:"List recent git snapshots for recovery",usage:"/snapshots",category:"Safety",handler:"daemon"},{name:"revert",description:"Revert to a git snapshot (index, default: most recent)",usage:"/revert [index]",category:"Safety",handler:"daemon"}],M5=Q({type:De("object"),properties:ir(L(),yn()),required:la(L()).optional(),additionalProperties:qh().optional()});Q({name:L(),description:L(),inputSchema:M5});Q({id:L(),name:L(),input:ir(L(),yn())});Q({id:L(),output:yn(),error:L().optional()});const R5=new Set(["wiki"]),tx=D5.filter(e=>e.handler==="daemon"||R5.has(e.name)).map(e=>[e.usage||`/${e.name}`,e.description]);function L5({open:e,onClose:t,onPick:n}){const[a,l]=m.useState(""),[s,r]=m.useState(0),o=m.useRef(null),c=a?tx.filter(([f,h])=>f.includes(a.toLowerCase())||h.toLowerCase().includes(a.toLowerCase())):tx,u=m.useCallback(f=>{t(),n(f)},[t,n]);m.useEffect(()=>{e&&(l(""),r(0),setTimeout(()=>{var f;return(f=o.current)==null?void 0:f.focus()},50))},[e]);const d=m.useCallback(f=>{if(f.key==="Escape"){t();return}f.key==="ArrowDown"&&(r(h=>Math.min(h+1,c.length-1)),f.preventDefault()),f.key==="ArrowUp"&&(r(h=>Math.max(h-1,0)),f.preventDefault()),f.key==="Enter"&&c[s]&&u(c[s][0])},[c,s,t,u]);return e?i.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[120px]",style:{background:"rgba(10, 8, 5, 0.85)",backdropFilter:"blur(8px)"},onClick:t,children:i.jsxs("div",{className:"w-[560px] rounded-xl overflow-hidden animate-scaleIn",style:{background:"linear-gradient(135deg, var(--s2) 0%, var(--s1) 100%)",border:"1px solid var(--b2)",boxShadow:"0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.03)"},onClick:f=>f.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center gap-2 px-4 py-3",style:{borderBottom:"1px solid var(--b1)"},children:[i.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",className:"shrink-0",style:{opacity:.7},children:[i.jsx("circle",{cx:"11",cy:"11",r:"8"}),i.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),i.jsx("input",{ref:o,className:"flex-1 bg-transparent border-0 outline-none font-sans text-sm",style:{color:"var(--cream)"},placeholder:"Search commands...",value:a,onChange:f=>{l(f.target.value),r(0)},onKeyDown:d})]}),i.jsx("div",{className:"gold-divider"}),i.jsxs("div",{className:"max-h-[340px] overflow-y-auto py-1 scrollbar-thin",children:[c.map(([f,h],p)=>i.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 rounded-lg cursor-pointer transition-all duration-150 mx-1",style:{background:p===s?"var(--s3)":"transparent",borderLeft:p===s?"2px solid var(--gold)":"2px solid transparent"},onClick:()=>u(f),children:[i.jsx("span",{className:"font-mono text-[12.5px] min-w-[190px]",style:{color:p===s?"var(--gold)":"var(--text)"},children:f}),i.jsx("span",{className:"text-xs text-muted truncate",children:h})]},f)),c.length===0&&i.jsx("div",{className:"px-3 py-6 text-center text-muted text-sm",children:"No commands found"})]})]})}):null}const as={anthropic:{label:"Anthropic",defaultModel:"claude-sonnet-4-6",requiresKey:!0},openai:{label:"OpenAI",defaultModel:"gpt-4o",requiresKey:!0},local:{label:"Local (OpenAI-compatible)",defaultModel:"custom",requiresKey:!1},openrouter:{label:"OpenRouter",defaultModel:"anthropic/claude-sonnet-4-6",requiresKey:!0},ollama:{label:"Ollama (Local)",defaultModel:"custom",requiresKey:!1}};function $5({rpc:e,onComplete:t,className:n}){const[a,l]=m.useState("provider"),[s,r]=m.useState(null),[o,c]=m.useState(""),[u,d]=m.useState(""),[f,h]=m.useState(""),[p,v]=m.useState(""),[j,k]=m.useState(""),[g,x]=m.useState(""),[b,y]=m.useState(""),[T,_]=m.useState(!1),[E,D]=m.useState(null),O=m.useCallback(()=>{switch(D(null),a){case"provider":{if(!s)return;const z=as[s];d(z.defaultModel),l(z.requiresKey?"api_key":"model");break}case"api_key":l("model");break;case"model":l("soul_name");break;case"soul_name":if(!f.trim())return;l("soul_vibe");break;case"soul_vibe":l("user_name");break;case"user_name":if(!j.trim())return;l("user_tz");break;case"user_tz":l("user_lang");break;case"user_lang":l("agents");break;case"agents":l("memory");break;case"memory":l("tools");break;case"tools":l("confirm");break}},[a,s,f,j]),R=m.useCallback(async()=>{if(!(!e||!s)){_(!0),D(null);try{await e.identitySetup({provider:s,apiKey:o,model:u,soulName:f.trim()||"Curie",soulVibe:p.trim()||"AI coding assistant — sharp, resourceful, gets things done",userName:j.trim()||"User",userTimezone:g.trim()||"UTC",userLanguages:b.trim()||"TypeScript, Python"}),t()}catch(z){D(z instanceof Error?z.message:"Setup failed")}finally{_(!1)}}},[e,s,o,u,f,p,j,g,b,t]),X=()=>{switch(a){case"provider":return"Choose your provider";case"api_key":return"API key";case"model":return"Select a model";case"soul_name":return"Name your assistant";case"soul_vibe":return"Define the vibe";case"user_name":return"Your name";case"user_tz":return"Timezone";case"user_lang":return"Programming languages";case"agents":return"Workspace configuration";case"memory":return"Memory";case"tools":return"Tools";case"confirm":return"Review & create"}},K=()=>(["provider","api_key","model","soul_name","soul_vibe","user_name","user_tz","user_lang","agents","memory","tools","confirm"].indexOf(a)+1)/12,P=()=>{switch(a){case"provider":return i.jsxs("div",{className:"space-y-3",children:[i.jsx("p",{className:"text-xs text-muted mb-4",children:"Which LLM provider do you want to use for your AI assistant?"}),i.jsx("div",{className:"grid grid-cols-1 gap-2",children:Object.entries(as).map(([z,A])=>i.jsxs("button",{type:"button",onClick:()=>r(z),className:`flex items-center gap-3 px-4 py-3 rounded-xl border text-left transition-all duration-100 ${s===z?"border-blue-500 bg-blue-500/10 text-text":"border-b2 bg-s2 text-text hover:border-b3 hover:bg-s2/80"}`,children:[i.jsx("div",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${s===z?"border-blue-500":"border-b3"}`,children:s===z&&i.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"})}),i.jsxs("div",{children:[i.jsx("div",{className:"text-xs font-medium text-text",children:A.label}),i.jsxs("div",{className:"text-[10.5px] text-muted",children:["Model: ",A.defaultModel]})]})]},z))})]});case"api_key":{const z=as[s];return i.jsxs("div",{className:"space-y-3",children:[i.jsxs("p",{className:"text-xs text-muted",children:["Enter your ",z.label," API key:"]}),i.jsx("input",{type:"password",value:o,onChange:A=>c(A.target.value),placeholder:"sk-...",className:"w-full px-3 py-2.5 bg-[#0d1117] border border-b2 rounded-xl text-xs text-text font-mono placeholder-slate-600 focus:outline-none focus:border-blue-500/70 transition-colors",autoFocus:!0}),i.jsx("p",{className:"text-[10px] text-muted",children:"Saved to ~/.curie-settings.json"})]})}case"model":{const z=as[s];return i.jsxs("div",{className:"space-y-3",children:[i.jsxs("p",{className:"text-xs text-muted",children:["Suggested model: ",i.jsx("code",{className:"text-text font-mono",children:z.defaultModel})]}),i.jsx("input",{type:"text",value:u,onChange:A=>d(A.target.value),placeholder:"Enter model name or accept the default",className:"w-full px-3 py-2.5 bg-[#0d1117] border border-b2 rounded-xl text-xs text-text font-mono placeholder-slate-600 focus:outline-none focus:border-blue-500/70 transition-colors",autoFocus:!0})]})}case"soul_name":return i.jsxs("div",{className:"space-y-3",children:[i.jsx("p",{className:"text-xs text-muted",children:"What should your AI assistant's name be?"}),i.jsx("input",{type:"text",value:f,onChange:z=>h(z.target.value),placeholder:"Curie",className:"w-full px-3 py-2.5 bg-[#0d1117] border border-b2 rounded-xl text-xs text-text placeholder-slate-600 focus:outline-none focus:border-blue-500/70 transition-colors",autoFocus:!0})]});case"soul_vibe":return i.jsxs("div",{className:"space-y-3",children:[i.jsx("p",{className:"text-xs text-muted",children:"Describe your assistant's vibe/personality (1 sentence)."}),i.jsx("input",{type:"text",value:p,onChange:z=>v(z.target.value),placeholder:"AI coding assistant — sharp, resourceful, gets things done",className:"w-full px-3 py-2.5 bg-[#0d1117] border border-b2 rounded-xl text-xs text-text placeholder-slate-600 focus:outline-none focus:border-blue-500/70 transition-colors",autoFocus:!0})]});case"user_name":return i.jsxs("div",{className:"space-y-3",children:[i.jsx("p",{className:"text-xs text-muted",children:"What is your name?"}),i.jsx("input",{type:"text",value:j,onChange:z=>k(z.target.value),placeholder:"Paweł",className:"w-full px-3 py-2.5 bg-[#0d1117] border border-b2 rounded-xl text-xs text-text placeholder-slate-600 focus:outline-none focus:border-blue-500/70 transition-colors",autoFocus:!0})]});case"user_tz":return i.jsxs("div",{className:"space-y-3",children:[i.jsx("p",{className:"text-xs text-muted",children:"Your timezone?"}),i.jsx("input",{type:"text",value:g,onChange:z=>x(z.target.value),placeholder:"Europe/Warsaw",className:"w-full px-3 py-2.5 bg-[#0d1117] border border-b2 rounded-xl text-xs text-text font-mono placeholder-slate-600 focus:outline-none focus:border-blue-500/70 transition-colors",autoFocus:!0})]});case"user_lang":return i.jsxs("div",{className:"space-y-3",children:[i.jsx("p",{className:"text-xs text-muted",children:"Your primary programming languages?"}),i.jsx("input",{type:"text",value:b,onChange:z=>y(z.target.value),placeholder:"TypeScript, Python",className:"w-full px-3 py-2.5 bg-[#0d1117] border border-b2 rounded-xl text-xs text-text placeholder-slate-600 focus:outline-none focus:border-blue-500/70 transition-colors",autoFocus:!0})]});case"agents":return i.jsxs("div",{className:"space-y-3",children:[i.jsx("p",{className:"text-xs text-muted",children:"Next: I'll create your workspace configuration files."}),i.jsxs("div",{className:"p-3 bg-s2 border border-b1 rounded-xl text-[10.5px] text-text leading-relaxed",children:[i.jsx("p",{className:"font-medium mb-1",children:"AGENTS.md will include:"}),i.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-muted",children:[i.jsx("li",{children:"Session startup instructions"}),i.jsx("li",{children:"Memory system (daily notes + long-term)"}),i.jsx("li",{children:"Coding agent capabilities"}),i.jsx("li",{children:"Red lines and safety boundaries"}),i.jsx("li",{children:"Heartbeat configuration"})]})]})]});case"memory":return i.jsx("div",{className:"space-y-3",children:i.jsx("div",{className:"p-3 bg-s2 border border-b1 rounded-xl text-xs text-text leading-relaxed",children:i.jsx("p",{children:"Auto-creating MEMORY.md with initialization entry..."})})});case"tools":return i.jsx("div",{className:"space-y-3",children:i.jsx("div",{className:"p-3 bg-s2 border border-b1 rounded-xl text-xs text-text leading-relaxed",children:i.jsx("p",{children:"Auto-creating TOOLS.md and HEARTBEAT.md..."})})});case"confirm":return i.jsxs("div",{className:"space-y-4",children:[i.jsx("p",{className:"text-xs text-muted",children:"Review your configuration before creating files:"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Za,{label:"Provider",value:as[s].label}),i.jsx(Za,{label:"Model",value:u}),i.jsx(Za,{label:"API Key",value:o?"[set]":"(not set)"}),i.jsx(Za,{label:"Assistant Name",value:f.trim()||"Curie"}),i.jsx(Za,{label:"Vibe",value:p.trim()||"AI coding assistant"}),i.jsx(Za,{label:"Your Name",value:j.trim()||"User"}),i.jsx(Za,{label:"Timezone",value:g.trim()||"UTC"}),i.jsx(Za,{label:"Languages",value:b.trim()||"TypeScript, Python"})]}),i.jsxs("div",{className:"p-3 bg-s2 border border-b1 rounded-xl text-[10.5px] text-muted leading-relaxed",children:["Identity files to be created:",i.jsxs("ul",{className:"list-disc list-inside mt-1",children:[i.jsx("li",{children:"~/.curie-agent/SOUL.md"}),i.jsx("li",{children:"~/.curie-agent/USER.md"}),i.jsx("li",{children:"~/.curie-agent/AGENTS.md"}),i.jsx("li",{children:"~/.curie-agent/MEMORY.md"}),i.jsx("li",{children:"~/.curie-agent/TOOLS.md"}),i.jsx("li",{children:"~/.curie-agent/HEARTBEAT.md"})]})]})]})}};return i.jsx("div",{className:`flex-1 overflow-y-auto p-7 scrollbar-thin flex flex-col ${n||""}`,children:i.jsxs("div",{className:"max-w-lg mx-auto w-full",children:[i.jsxs("div",{className:"mb-6",children:[i.jsx("h2",{className:"text-base font-semibold text-fg tracking-tight mb-1",children:"Setup Wizard"}),i.jsx("p",{className:"text-[11px] text-muted",children:"Configure your AI assistant — takes about 2 minutes"})]}),i.jsx("div",{className:"mb-5",children:i.jsx("div",{className:"h-1 bg-b2 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-blue-500 rounded-full transition-all duration-300",style:{width:`${K()*100}%`}})})}),i.jsx("h3",{className:"text-sm font-medium text-text mb-4",children:X()}),i.jsx("div",{className:"mb-6",children:P()}),E&&i.jsxs("div",{className:"p-3 bg-red-500/10 border border-red-500/20 rounded-xl text-red-400 text-xs flex items-start gap-2.5 mb-4",children:[i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"shrink-0 mt-0.5",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),i.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),i.jsx("span",{children:E})]}),i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a!=="provider"&&a!=="confirm"?i.jsxs("button",{type:"button",onClick:()=>{switch(D(null),a){case"api_key":l("provider");break;case"model":l(as[s].requiresKey?"api_key":"provider");break;case"soul_name":l("provider");break;case"soul_vibe":l("soul_name");break;case"user_name":l("soul_vibe");break;case"user_tz":l("user_name");break;case"user_lang":l("user_tz");break;case"agents":l("user_lang");break;case"memory":l("agents");break;case"tools":l("memory");break}},className:"flex items-center gap-1 bg-transparent border border-b2 rounded px-3 py-2 text-muted text-xs hover:border-b3 hover:text-fg transition-colors duration-100",children:[i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back"]}):i.jsx("div",{}),a==="confirm"?i.jsx("button",{type:"button",onClick:R,disabled:T,className:"flex items-center gap-2 bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-500 hover:to-indigo-500 text-white font-semibold text-xs px-5 py-2 rounded-xl shadow-lg shadow-blue-500/10 disabled:opacity-50 disabled:pointer-events-none active:scale-[0.98] transition-all duration-150",children:T?i.jsxs(i.Fragment,{children:[i.jsxs("svg",{className:"animate-spin h-3.5 w-3.5 text-white",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Creating..."]}):"Create Setup"}):i.jsxs("button",{type:"button",onClick:O,disabled:a==="provider"&&!s||a==="soul_name"&&!f.trim()||a==="user_name"&&!j.trim(),className:"flex items-center gap-2 bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-500 hover:to-indigo-500 text-white font-semibold text-xs px-5 py-2 rounded-xl shadow-lg shadow-blue-500/10 disabled:opacity-50 disabled:pointer-events-none active:scale-[0.98] transition-all duration-150",children:["Next",i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[i.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),i.jsx("polyline",{points:"12 5 19 12 12 19"})]})]})]})]})})}function Za({label:e,value:t}){return i.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-b1/50",children:[i.jsx("span",{className:"text-[10.5px] text-muted",children:e}),i.jsx("span",{className:"text-[10.5px] text-text font-mono",children:t})]})}function U5({onReload:e}){const[t,n]=m.useState(!1);m.useEffect(()=>{const l=()=>n(!0),s=()=>{n(!1),e==null||e()};return window.addEventListener("pwa-update-available",l),window.addEventListener("pwa-controller-updated",s),()=>{window.removeEventListener("pwa-update-available",l),window.removeEventListener("pwa-controller-updated",s)}},[e]);const a=()=>{n(!1),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(l=>{l.waiting&&l.waiting.postMessage("SKIP_WAITING")}),window._pendingUpdateWorker&&window._pendingUpdateWorker.postMessage("SKIP_WAITING")};return t?i.jsxs("div",{className:"bg-blue-500/10 border-b border-blue-500/20 text-blue-400 px-4 py-2 text-center text-xs font-semibold flex items-center justify-center gap-2 select-none shrink-0 z-50 animate-fadeIn",children:[i.jsxs("svg",{className:"animate-bounce shrink-0",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[i.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),i.jsx("polyline",{points:"17 8 12 3 7 8"}),i.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),"Update available",i.jsx("button",{onClick:a,className:"bg-blue-500/20 border border-blue-500/40 text-blue-400 px-2 py-0.5 rounded-[4px] text-[11px] font-bold cursor-pointer hover:bg-blue-500/30 transition-all duration-100",children:"Update"})]}):null}const B5="0.2.4";function Z5({intervalMs:e=3*60*1e3,onNewVersion:t}){const[n,a]=m.useState(!1);return m.useEffect(()=>{async function l(){var r;try{const c=await(await fetch("/health?token="+encodeURIComponent(((r=document.cookie.match(/curie_token=([^;]*)/))==null?void 0:r[1])??""),{cache:"no-store"})).json();c.version&&c.version!==B5&&!n&&(a(!0),t==null||t(c.version),window.dispatchEvent(new CustomEvent("pwa-version-update")))}catch{}}l();const s=setInterval(l,e);return()=>clearInterval(s)},[e,n,t]),null}function H5(){const{rpc:e,ws:t}=Vn(),[n,a]=m.useState([]),l=m.useCallback(()=>{e&&e.sessionList().then(s=>{Array.isArray(s)&&a(s)}).catch(()=>{})},[e]);return m.useEffect(()=>{l()},[l]),m.useEffect(()=>{if(!t)return;const s=["user-prompt","assistant-stop","error","session-start","session-resumed"],r=[];for(const o of s)r.push(t.on(o,l));return()=>{for(const o of r)o()}},[t,l]),{sessions:n,refetch:l}}function q5(e){const{rpc:t,ws:n}=Vn(),[a,l]=m.useState(null),[s,r]=m.useState([]),[o,c]=m.useState(!1),[u,d]=m.useState(null);m.useEffect(()=>{if(!t||!e){l(null),r([]),c(!1);return}c(!0),t.sessionGet(e).then(h=>{h!=null&&h.info&&l(h.info),h!=null&&h.events&&r(h.events)}).catch(()=>{}).finally(()=>c(!1))},[t,e]),m.useEffect(()=>{if(!n||!e)return;const h=j=>{if(j.type!=="heartbeat-brief"&&j.type!=="cron-task-fired"){const k=j.sessionId||j.id;if(k&&k!==e)return}r(k=>k.slice(-10).some(x=>x.timestamp===j.timestamp&&x.type===j.type&&JSON.stringify(x)===JSON.stringify(j))?k:[...k,j])},p=[],v=["user-prompt","assistant-delta","assistant-stop","tool-call","tool-result","error","status","usage","thinking-delta","heartbeat-brief","approval-request","approval-decision","context-warning","cron-task-fired","compaction"];for(const j of v)p.push(n.on(j,h));return p.push(n.on("context-report",j=>{const k=j.sessionId;k&&k!==e||d({model:String(j.model??""),windowTokens:Number(j.windowTokens??0),usedTokens:Number(j.usedTokens??0),reservedOutput:Number(j.reservedOutput??0),breakdown:j.breakdown??[]})})),()=>{for(const j of p)j()}},[n,e]);const f=m.useCallback(h=>{r(p=>[...p,h])},[]);return{info:a,events:s,loading:o,addLiveEvent:f,contextReport:u}}function G5({onAuthorize:e}){const[t,n]=m.useState(""),[a,l]=m.useState(!1),[s,r]=m.useState(null),o=async c=>{if(c.preventDefault(),!!t.trim()){l(!0),r(null);try{(await fetch("/health",{headers:{Authorization:`Bearer ${t.trim()}`}})).ok?e(t.trim()):r("Invalid Access Token. Please verify and try again.")}catch{r("Cannot connect to Curie Daemon. Make sure the daemon is running.")}finally{l(!1)}}};return i.jsxs("div",{className:"flex min-h-screen w-screen items-center justify-center p-4 font-sans select-none relative overflow-hidden",style:{background:"#0e0b08",color:"var(--cream, #f5e6d0)"},children:[i.jsx("div",{className:"absolute top-[-20%] left-[-20%] w-[60%] h-[60%] rounded-full opacity-30 blur-[120px] pointer-events-none",style:{background:"#2d1f0e"}}),i.jsx("div",{className:"absolute bottom-[-20%] right-[-20%] w-[60%] h-[60%] rounded-full opacity-25 blur-[120px] pointer-events-none",style:{background:"#1e1408"}}),i.jsx("div",{className:"absolute top-[40%] left-[50%] w-[40%] h-[40%] rounded-full opacity-15 blur-[100px] pointer-events-none",style:{background:"#d4a54a",transform:"translate(-50%, -50%)"}}),i.jsxs("div",{className:"w-full max-w-[440px] rounded-2xl shadow-2xl p-7 flex flex-col items-center animate-scaleIn relative z-10",style:{background:"linear-gradient(135deg, rgba(34, 28, 22, 0.95), rgba(20, 16, 12, 0.98))",backdropFilter:"blur(24px)",border:"1px solid rgba(86, 72, 58, 0.5)",boxShadow:"0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(245,230,208,0.04)"},children:[i.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px] rounded-t-2xl",style:{background:"linear-gradient(90deg, transparent, #d4a54a, transparent)"}}),i.jsxs("div",{className:"flex flex-col items-center gap-3 mb-6 mt-2",children:[i.jsxs("div",{className:"relative group",children:[i.jsx("div",{className:"absolute inset-0 rounded-xl blur-md group-hover:blur-lg transition-all duration-300 animate-gold-pulse",style:{background:"rgba(212, 165, 74, 0.2)"}}),i.jsx("img",{src:"/icons/logo-512.png",alt:"Curie Logo",className:"w-14 h-14 object-contain rounded-xl relative z-10 transform group-hover:scale-105 transition-transform duration-300",style:{border:"1px solid rgba(86, 72, 58, 0.6)",boxShadow:"0 4px 16px rgba(0,0,0,0.4)"}})]}),i.jsxs("div",{className:"text-center mt-1",children:[i.jsx("span",{className:"text-xl font-display font-bold gold-shimmer block",children:"curie-agent"}),i.jsx("span",{className:"text-[10px] font-mono block mt-0.5",style:{color:"#d4a54a",opacity:.6},children:"v0.2.4"})]})]}),i.jsxs("div",{className:"text-center mb-6",children:[i.jsx("h2",{className:"text-sm font-semibold mb-2",style:{color:"#f5e6d0"},children:"Authorize this device"}),i.jsx("p",{className:"text-[12.5px] leading-relaxed px-2",style:{color:"#8b7355"},children:"Curie requires a secure daemon connection. Enter your access token below to authorize this device and start planning."})]}),i.jsxs("form",{onSubmit:o,className:"w-full space-y-4",children:[i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-wider block ml-1",style:{color:"#d4a54a",opacity:.7},children:"Daemon Access Token"}),i.jsxs("div",{className:"relative group",children:[i.jsx("div",{className:"absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none transition-colors duration-200",style:{color:"#8b7355"},children:i.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:i.jsx("path",{d:"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"})})}),i.jsx("input",{type:"password",required:!0,placeholder:"Paste your daemon.token...",value:t,onChange:c=>n(c.target.value),disabled:a,className:"w-full pl-10 pr-4 py-2.5 rounded-xl text-[13px] font-mono focus:outline-none transition-all duration-200",style:{background:"rgba(14, 11, 8, 0.8)",border:"1px solid rgba(86, 72, 58, 0.4)",color:"#f5e6d0"}})]})]}),s&&i.jsxs("div",{className:"p-3 rounded-xl text-xs flex items-start gap-2.5 animate-fadeIn",style:{background:"color-mix(in srgb, var(--red) 10%, transparent)",border:"1px solid color-mix(in srgb, var(--red) 20%, transparent)",color:"var(--red)"},children:[i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"shrink-0 mt-0.5",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),i.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),i.jsx("span",{children:s})]}),i.jsx("button",{type:"submit",disabled:a||!t.trim(),className:"btn-gold w-full py-2.5 px-4 rounded-xl font-semibold text-xs active:scale-[0.98] transition-all duration-150 disabled:opacity-50 disabled:pointer-events-none cursor-pointer flex items-center justify-center gap-2",children:a?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"w-3.5 h-3.5 rounded-full animate-spin",style:{background:"conic-gradient(from 0deg, transparent, #1a1410)",mask:"radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 0)",WebkitMask:"radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 0)"}}),"Verifying Credentials..."]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"Authorize & Connect"}),i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[i.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),i.jsx("polyline",{points:"12 5 19 12 12 19"})]})]})})]}),i.jsxs("div",{className:"w-full mt-6 pt-5 space-y-2 leading-relaxed",style:{borderTop:"1px solid rgba(86, 72, 58, 0.3)",fontSize:"11.5px",color:"#8b7355"},children:[i.jsx("div",{className:"font-semibold",style:{color:"#bfae94"},children:"Where is my token?"}),i.jsx("p",{children:"When starting the daemon, look for the console output in your terminal. It displays the dashboard link containing the secure token."}),i.jsxs("p",{children:["You can also find the raw token inside the file ",i.jsx("code",{className:"font-mono px-1 py-0.5 rounded text-[10.5px]",style:{background:"rgba(14, 11, 8, 0.6)",border:"1px solid rgba(86, 72, 58, 0.3)",color:"#d4c4a8"},children:"~/.curie-agent/daemon.token"})," on your host machine."]})]})]})]})}const Y5=["plan","edit","auto","yolo"],I5=[{view:"assistant",label:"Assistant",icon:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"},{view:"channels",label:"Channels",icon:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07A19.5 19.5 0 0 1 4.86 13a19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 3.77 2h3a2 2 0 0 1 2 1.72c.127.96.361 1.903.7 2.81a2 2 0 0 1-.45 2.11L7.91 9.91a16 16 0 0 0 6.16 6.16l1.27-1.27a2 2 0 0 1 2.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0 1 22 16.92z"},{view:"stats",label:"Stats",icon:"M18 20V10M12 20V4M6 20v-6"},{view:"projects",label:"Projects",icon:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"},{view:"agents",label:"Agents",icon:"M12 8c0 2.21-1.79 4-4 4s-4-1.79-4-4 1.79-4 4-4 4 1.79 4 4zm-6 12v-2a6 6 0 0 1 12 0v2"},{view:"kanban",label:"Tasks",icon:"M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2M9 5a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2M9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01"},{view:"wiki",label:"Wiki",icon:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"},{view:"settings",label:"Settings",icon:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}];function X5(){const{rpc:e,connected:t,token:n,setToken:a}=Vn(),{get:l,set:s,providers:r}=hh(),[o,c]=m.useState("assistant"),u=l("mode")||"auto",[d,f]=m.useState(!1),[h,p]=m.useState(""),[v,j]=m.useState(null),[k,g]=m.useState(!1),[x,b]=m.useState(null),[y,T]=m.useState(navigator.onLine),[_,E]=m.useState(!1),[D,O]=m.useState(!1),[R,X]=m.useState(!1),[K,P]=m.useState(!1),z=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;m.useEffect(()=>{const G=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone===!0;E(!!G)},[]),m.useEffect(()=>{const G=Ge=>{Ge.preventDefault(),b(Ge)},F=()=>T(!0),$e=()=>T(!1);return window.addEventListener("beforeinstallprompt",G),window.addEventListener("online",F),window.addEventListener("offline",$e),()=>{window.removeEventListener("beforeinstallprompt",G),window.removeEventListener("online",F),window.removeEventListener("offline",$e)}},[]);const A=async()=>{if(x){x.prompt();const{outcome:G}=await x.userChoice;console.log(`PWA install prompt choice: ${G}`),b(null)}else O(!0)},{sessions:C,refetch:M}=H5(),{events:V,addLiveEvent:J,contextReport:ne}=q5(v),Se=l("theme")||"curie";m.useEffect(()=>{document.documentElement.setAttribute("data-theme",Se)},[Se]),m.useEffect(()=>{const G=()=>g(window.innerWidth<768);return G(),window.addEventListener("resize",G),()=>window.removeEventListener("resize",G)},[]),m.useEffect(()=>{!t||!e||e.configGet("current_provider").then(G=>{G||X(!0)}).catch(()=>{})},[t,e]);const le=m.useCallback(()=>{j(null)},[]),B=m.useCallback(G=>{j(G)},[]),w=m.useCallback(G=>{j(G),c("assistant")},[]),Z=m.useCallback(G=>{j(G),M()},[M]);m.useEffect(()=>{const G=F=>{(F.metaKey||F.ctrlKey)&&F.key==="k"&&(F.preventDefault(),f(!0))};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[]);const q=m.useCallback(G=>{p(G),f(!1)},[]),ae=m.useCallback(()=>{p("")},[]),re=(G,F=18)=>i.jsx("svg",{width:F,height:F,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:i.jsx("path",{d:G.icon})});return n?i.jsxs("div",{className:"flex h-dvh w-screen flex-col overflow-hidden bg-bg coffee-pattern",children:[!y&&i.jsxs("div",{className:"px-4 py-2 text-center text-xs font-semibold flex items-center justify-center gap-2 select-none shrink-0 z-50 animate-fadeIn",style:{background:"color-mix(in srgb, var(--yellow) 10%, transparent)",borderBottom:"1px solid color-mix(in srgb, var(--yellow) 20%, transparent)",color:"var(--yellow)"},children:[i.jsxs("svg",{className:"animate-pulse shrink-0",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[i.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),i.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),i.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),"Offline Mode — Curie is running on cached local client"]}),i.jsx(U5,{}),i.jsx(Z5,{}),i.jsxs("main",{className:"flex flex-1 flex-col overflow-hidden bg-bg",children:[i.jsxs("div",{className:"topbar-wood flex h-12 items-center gap-3 px-4 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsxs("button",{className:"relative flex items-center justify-center w-8 h-8 rounded-lg transition-all duration-150",style:{color:K?"var(--fg)":"var(--muted)",background:K?"var(--s3)":"transparent",border:K?"1px solid var(--b1)":"1px solid transparent"},onClick:()=>P(!0),title:"Sessions",children:[i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:i.jsx("path",{d:"M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"})}),C.length>0&&i.jsx("span",{className:"absolute -top-0.5 -right-0.5 text-[9px] font-bold rounded-full w-4 h-4 flex items-center justify-center",style:{background:"var(--gold)",color:"#1a1410"},children:C.length>99?"99+":C.length})]}),i.jsx("div",{className:"w-px h-5 bg-b1 mx-0.5"}),I5.map(G=>i.jsx("button",{className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all duration-150 cursor-pointer",style:{color:o===G.view?"var(--gold)":"var(--muted)",background:o===G.view?"var(--s3)":"transparent",border:o===G.view?"1px solid var(--b1)":"1px solid transparent"},onClick:()=>c(G.view),title:G.label,children:re(G,18)},G.view))]}),i.jsx("div",{className:"flex-1"}),window.innerWidth>=640&&i.jsx("div",{className:"flex rounded-lg overflow-hidden",style:{border:"1px solid var(--b2)",background:"var(--bg)"},children:Y5.map(G=>i.jsx("button",{className:"px-2.5 py-1 text-xs cursor-pointer transition-all duration-150 font-mono select-none",style:{color:u===G?"var(--gold)":"var(--muted)",background:u===G?"var(--s3)":"transparent",borderRight:"1px solid var(--b1)"},onClick:()=>s("mode",G),children:G},G))}),(x||k&&!_)&&i.jsxs("button",{onClick:A,className:"flex items-center justify-center rounded-lg transition-all duration-150 px-2.5 py-1 gap-1.5 text-xs font-semibold cursor-pointer shrink-0",style:{background:"var(--bg)",border:"1px solid color-mix(in srgb, var(--green) 30%, transparent)",color:"var(--green)"},children:[i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[i.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),i.jsx("polyline",{points:"7 10 12 15 17 10"}),i.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),!k&&i.jsx(i.Fragment,{children:"Install"})]}),i.jsxs("button",{className:"flex items-center justify-center rounded-lg transition-all duration-150 px-2.5 py-1 gap-1.5 text-xs font-semibold cursor-pointer shrink-0",style:{background:"transparent",border:"1px solid var(--b2)",color:"var(--muted)"},onClick:()=>f(!0),title:"Open Commands",children:[i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[i.jsx("circle",{cx:"11",cy:"11",r:"8"}),i.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),!k&&i.jsx(i.Fragment,{children:"Ctrl+k"})]})]}),i.jsxs("div",{className:"relative flex-1 min-h-0",children:[R&&e?i.jsx($5,{rpc:e,onComplete:()=>X(!1),className:"absolute inset-0"}):o==="assistant"&&i.jsx(Vj,{contextReport:ne,cmdResult:h,onClearCmdResult:ae,rpc:e,className:"absolute inset-0",activeSessionId:v,onCreateSession:Z,events:V,addLiveEvent:J,onSwitchView:G=>c(G)}),o==="channels"&&i.jsx(Qj,{rpc:e,className:"absolute inset-0"}),o==="stats"&&i.jsx(Kj,{rpc:e,className:"absolute inset-0"}),o==="projects"&&i.jsx(Jj,{rpc:e,className:"absolute inset-0"}),o==="agents"&&i.jsx(rk,{rpc:e,onOpenSession:w,className:"absolute inset-0"}),o==="kanban"&&i.jsx(rN,{rpc:e,className:"absolute inset-0"}),o==="wiki"&&i.jsx(dN,{rpc:e,className:"absolute inset-0"}),o==="settings"&&i.jsx(vN,{rpc:e,className:"absolute inset-0"})]})]}),i.jsx(L5,{open:d,onClose:()=>f(!1),onPick:q}),K&&i.jsx("div",{className:"fixed inset-0 z-[998] flex items-end animate-fadeIn",style:{background:"rgba(10, 8, 5, 0.6)",backdropFilter:"blur(4px)"},onClick:()=>P(!1),children:i.jsxs("div",{className:"w-full max-h-[70vh] rounded-t-2xl overflow-hidden animate-slideUp select-none flex flex-col wood-grain",style:{background:"var(--s1)",borderTop:"1px solid var(--b1)"},onClick:G=>G.stopPropagation(),children:[i.jsx("div",{className:"flex justify-center pt-3 pb-1 shrink-0",children:i.jsx("div",{className:"w-8 h-1 rounded-full",style:{background:"var(--gold)",opacity:.3}})}),i.jsxs("div",{className:"flex items-center justify-between px-4 pb-3 shrink-0",style:{borderBottom:"1px solid var(--b1)"},children:[i.jsx("span",{className:"text-[13px] font-display font-semibold",style:{color:"var(--cream)"},children:"Sessions"}),i.jsx("button",{onClick:()=>P(!1),className:"text-muted hover:text-fg transition-colors duration-100 p-1",children:i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),i.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--b1)"},children:i.jsxs("button",{onClick:()=>{le(),P(!1)},className:"w-full flex items-center gap-2.5 py-2 px-3 rounded-xl transition-all duration-150 active:scale-[0.98] cursor-pointer",style:{background:"color-mix(in srgb, var(--gold) 10%, transparent)",border:"1px solid color-mix(in srgb, var(--gold) 20%, transparent)",color:"var(--gold)"},children:[i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),i.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),i.jsx("span",{className:"text-[12.5px] font-semibold",children:"New Chat"})]})}),i.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-4 scrollbar-thin",children:[C.sort((G,F)=>F.updatedAt-G.updatedAt).map(G=>i.jsx("button",{className:"w-full text-left py-3 px-3 rounded-xl mb-1 transition-all duration-150 active:scale-[0.98] min-h-[52px] cursor-pointer",style:{background:G.id===v?"linear-gradient(135deg, var(--s3) 0%, var(--s2) 100%)":"transparent",border:G.id===v?"1px solid var(--b2)":"1px solid transparent"},onClick:()=>{B(G.id),P(!1)},children:i.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[i.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:G.id===v?"var(--gold)":"transparent",boxShadow:G.id===v?"0 0 4px var(--gold)":"none"}}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"text-[12.5px] font-medium text-fg truncate",children:G.name||G.provider}),i.jsxs("div",{className:"text-[11px] text-muted",children:[G.provider," · ",(()=>{const F=Date.now()-G.updatedAt;return F<6e4?"just now":F<36e5?`${Math.floor(F/6e4)}m ago`:F<864e5?`${Math.floor(F/36e5)}h ago`:`${Math.floor(F/864e5)}d ago`})()]})]}),G.type&&G.type!=="webui"&&i.jsx("span",{className:"text-[9px] font-mono text-muted bg-s2 px-1.5 py-0.5 rounded shrink-0",children:G.type})]})},G.id)),C.length===0&&i.jsx("div",{className:"text-center py-8 text-xs text-muted",children:"No sessions yet"})]}),v&&i.jsx("div",{className:"border-t border-b1 px-4 py-3 shrink-0",children:(()=>{var Y;const G=V.filter(me=>me.type==="usage"),F=G.reduce((me,yt)=>me+(yt.inputTokens||0)+(yt.outputTokens||0),0),$e=G[G.length-1],Ge=$e&&$e.inputTokens||0,At=l("current_provider")||"anthropic",fe=(Y=r.find(me=>me.name===At))==null?void 0:Y.model_cost,Ue=l("model")||"sonnet",oe=G.reduce((me,yt)=>me+_v(Ue,yt.inputTokens||0,yt.outputTokens||0,fe),0);return i.jsxs("div",{className:"grid grid-cols-3 gap-3 text-center",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-[9px] text-muted2 uppercase tracking-wider font-mono",children:"Tokens"}),i.jsx("div",{className:"text-[12px] text-fg font-mono font-semibold",children:un(F)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[9px] text-muted2 uppercase tracking-wider font-mono",children:"Context"}),i.jsx("div",{className:"text-[12px] text-fg font-mono font-semibold",children:un(Ge)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[9px] text-muted2 uppercase tracking-wider font-mono",children:"Cost"}),i.jsxs("div",{className:"text-[12px] text-green font-mono font-semibold",children:["$",oe.toFixed(4)]})]})]})})()})]})}),D&&i.jsx("div",{className:"fixed inset-0 z-[999] flex items-center justify-center p-4 animate-fadeIn",style:{background:"rgba(10, 8, 5, 0.7)",backdropFilter:"blur(8px)"},children:i.jsxs("div",{className:"w-full max-w-[340px] p-5 rounded-2xl shadow-2xl animate-scaleIn select-none",style:{background:"linear-gradient(135deg, var(--s2), var(--s1))",border:"1px solid var(--b2)",boxShadow:"0 20px 60px rgba(0,0,0,0.5)"},children:[i.jsxs("div",{className:"flex items-center justify-between pb-3 mb-4",style:{borderBottom:"1px solid var(--b1)"},children:[i.jsx("span",{className:"font-bold text-[13.5px] font-display",style:{color:"var(--cream)"},children:"Install Curie Agent"}),i.jsx("button",{onClick:()=>O(!1),className:"text-muted hover:text-fg transition-colors duration-100 cursor-pointer",children:i.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),i.jsx("div",{className:"space-y-3.5 text-xs text-text leading-relaxed",children:z?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-[12px] text-muted mb-1 px-0.5",children:"Follow these simple steps to add Curie to your home screen:"}),i.jsxs("div",{className:"flex gap-3 items-start p-3 rounded-xl",style:{background:"color-mix(in srgb, var(--s1) 50%, transparent)",border:"1px solid var(--b1)"},children:[i.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-lg shrink-0",style:{background:"color-mix(in srgb, var(--gold) 10%, transparent)",color:"var(--gold)"},children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:i.jsx("path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8M16 6l-4-4-4 4M12 2v13"})})}),i.jsxs("div",{children:[i.jsx("span",{className:"font-semibold text-fg block mb-0.5",children:"1. Tap the Share Button"}),i.jsx("span",{className:"text-[11px] text-muted",children:"Tap the Share icon in Safari's bottom toolbar."})]})]}),i.jsxs("div",{className:"flex gap-3 items-start p-3 rounded-xl",style:{background:"color-mix(in srgb, var(--s1) 50%, transparent)",border:"1px solid var(--b1)"},children:[i.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-lg shrink-0 font-bold font-mono text-[16px] select-none",style:{background:"color-mix(in srgb, var(--gold) 10%, transparent)",color:"var(--gold)"},children:"+"}),i.jsxs("div",{children:[i.jsx("span",{className:"font-semibold text-fg block mb-0.5",children:"2. Add to Home Screen"}),i.jsxs("span",{className:"text-[11px] text-muted",children:["Scroll down and select ",i.jsx("strong",{children:"Add to Home Screen"}),"."]})]})]})]}):i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-[12px] text-muted mb-1 px-0.5",children:"Follow these simple steps to add Curie to your home screen:"}),i.jsxs("div",{className:"flex gap-3 items-start bg-s1/50 border border-b1 p-3 rounded-xl",children:[i.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-lg bg-blue-500/10 text-blue-400 shrink-0",children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[i.jsx("circle",{cx:"12",cy:"12",r:"1"}),i.jsx("circle",{cx:"12",cy:"5",r:"1"}),i.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),i.jsxs("div",{children:[i.jsx("span",{className:"font-semibold text-fg block mb-0.5",children:"1. Open Browser Menu"}),i.jsx("span",{className:"text-[11px] text-muted",children:"Tap the menu icon (three dots) in the top-right corner."})]})]}),i.jsxs("div",{className:"flex gap-3 items-start bg-s1/50 border border-b1 p-3 rounded-xl",children:[i.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-lg bg-blue-500/10 text-blue-400 shrink-0",children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[i.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),i.jsx("polyline",{points:"7 10 12 15 17 10"}),i.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}),i.jsxs("div",{children:[i.jsx("span",{className:"font-semibold text-fg block mb-0.5",children:"2. Select Add / Install"}),i.jsxs("span",{className:"text-[11px] text-muted",children:["Tap ",i.jsx("strong",{children:"Add to Home screen"})," or ",i.jsx("strong",{children:"Install app"}),"."]})]})]})]})}),i.jsx("button",{onClick:()=>O(!1),className:"btn-gold w-full mt-5 py-2.5 px-4 rounded-xl font-semibold text-xs active:scale-[0.98] transition-all duration-150 cursor-pointer flex items-center justify-center",children:"Got it"})]})})]}):i.jsx(G5,{onAuthorize:a})}function V5(){return i.jsx(KS,{children:i.jsx(X5,{})})}const Q5=IS.createRoot(document.getElementById("root"));Q5.render(i.jsx(Ie.StrictMode,{children:i.jsx(V5,{})}));"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").then(e=>{console.log("ServiceWorker registration successful with scope: ",e.scope),e.addEventListener("updatefound",()=>{const t=e.installing;t&&(window._pendingUpdateWorker=t,t.addEventListener("statechange",()=>{t.state==="installed"&&(window._hasPendingUpdate=!0,window.dispatchEvent(new CustomEvent("pwa-update-available")))}))}),navigator.serviceWorker.addEventListener("controllerchange",()=>{window.dispatchEvent(new CustomEvent("pwa-controller-updated"))})}).catch(e=>console.error("ServiceWorker registration failed: ",e))});export{Ie as R,K0 as g,i as j,m as r};
|