@curie-agent/daemon 0.4.2 → 0.4.4

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.
@@ -1,165 +0,0 @@
1
- var L2=Object.defineProperty;var B2=(e,t,n)=>t in e?L2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var de=(e,t,n)=>B2(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))l(a);new MutationObserver(a=>{for(const s of a)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&l(i)}).observe(document,{childList:!0,subtree:!0});function n(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function l(a){if(a.ep)return;a.ep=!0;const s=n(a);fetch(a.href,s)}})();function _x(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tx={exports:{}},gc={};/**
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 U2=Symbol.for("react.transitional.element"),q2=Symbol.for("react.fragment");function Ax(e,t,n){var l=null;if(n!==void 0&&(l=""+n),t.key!==void 0&&(l=""+t.key),"key"in t){n={};for(var a in t)a!=="key"&&(n[a]=t[a])}else n=t;return t=n.ref,{$$typeof:U2,type:e,key:l,ref:t!==void 0?t:null,props:n}}gc.Fragment=q2;gc.jsx=Ax;gc.jsxs=Ax;Tx.exports=gc;var o=Tx.exports,Dx={exports:{}},se={};/**
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 kf=Symbol.for("react.transitional.element"),Y2=Symbol.for("react.portal"),V2=Symbol.for("react.fragment"),X2=Symbol.for("react.strict_mode"),G2=Symbol.for("react.profiler"),Q2=Symbol.for("react.consumer"),Z2=Symbol.for("react.context"),I2=Symbol.for("react.forward_ref"),K2=Symbol.for("react.suspense"),W2=Symbol.for("react.memo"),zx=Symbol.for("react.lazy"),J2=Symbol.for("react.activity"),vp=Symbol.iterator;function F2(e){return e===null||typeof e!="object"?null:(e=vp&&e[vp]||e["@@iterator"],typeof e=="function"?e:null)}var Rx={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ox=Object.assign,Hx={};function bs(e,t,n){this.props=e,this.context=t,this.refs=Hx,this.updater=n||Rx}bs.prototype.isReactComponent={};bs.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")};bs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function $x(){}$x.prototype=bs.prototype;function Ef(e,t,n){this.props=e,this.context=t,this.refs=Hx,this.updater=n||Rx}var Cf=Ef.prototype=new $x;Cf.constructor=Ef;Ox(Cf,bs.prototype);Cf.isPureReactComponent=!0;var bp=Array.isArray;function rd(){}var Te={H:null,A:null,T:null,S:null},Lx=Object.prototype.hasOwnProperty;function Mf(e,t,n){var l=n.ref;return{$$typeof:kf,type:e,key:t,ref:l!==void 0?l:null,props:n}}function P2(e,t){return Mf(e.type,t,e.props)}function _f(e){return typeof e=="object"&&e!==null&&e.$$typeof===kf}function ew(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var wp=/\/+/g;function ru(e,t){return typeof e=="object"&&e!==null&&e.key!=null?ew(""+e.key):t.toString(36)}function tw(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(rd,rd):(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 Ea(e,t,n,l,a){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(s){case"bigint":case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case kf:case Y2:i=!0;break;case zx:return i=e._init,Ea(i(e._payload),t,n,l,a)}}if(i)return a=a(e),i=l===""?"."+ru(e,0):l,bp(a)?(n="",i!=null&&(n=i.replace(wp,"$&/")+"/"),Ea(a,t,n,"",function(u){return u})):a!=null&&(_f(a)&&(a=P2(a,n+(a.key==null||e&&e.key===a.key?"":(""+a.key).replace(wp,"$&/")+"/")+i)),t.push(a)),1;i=0;var r=l===""?".":l+":";if(bp(e))for(var c=0;c<e.length;c++)l=e[c],s=r+ru(l,c),i+=Ea(l,t,n,s,a);else if(c=F2(e),typeof c=="function")for(e=c.call(e),c=0;!(l=e.next()).done;)l=l.value,s=r+ru(l,c++),i+=Ea(l,t,n,s,a);else if(s==="object"){if(typeof e.then=="function")return Ea(tw(e),t,n,l,a);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 i}function mr(e,t,n){if(e==null)return e;var l=[],a=0;return Ea(e,l,"","",function(s){return t.call(n,s,a++)}),l}function nw(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)},lw={map:mr,forEach:function(e,t,n){mr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return mr(e,function(){t++}),t},toArray:function(e){return mr(e,function(t){return t})||[]},only:function(e){if(!_f(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};se.Activity=J2;se.Children=lw;se.Component=bs;se.Fragment=V2;se.Profiler=G2;se.PureComponent=Ef;se.StrictMode=X2;se.Suspense=K2;se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Te;se.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Te.H.useMemoCache(e)}};se.cache=function(e){return function(){return e.apply(null,arguments)}};se.cacheSignal=function(){return null};se.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var l=Ox({},e.props),a=e.key;if(t!=null)for(s in t.key!==void 0&&(a=""+t.key),t)!Lx.call(t,s)||s==="key"||s==="__self"||s==="__source"||s==="ref"&&t.ref===void 0||(l[s]=t[s]);var s=arguments.length-2;if(s===1)l.children=n;else if(1<s){for(var i=Array(s),r=0;r<s;r++)i[r]=arguments[r+2];l.children=i}return Mf(e.type,a,l)};se.createContext=function(e){return e={$$typeof:Z2,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Q2,_context:e},e};se.createElement=function(e,t,n){var l,a={},s=null;if(t!=null)for(l in t.key!==void 0&&(s=""+t.key),t)Lx.call(t,l)&&l!=="key"&&l!=="__self"&&l!=="__source"&&(a[l]=t[l]);var i=arguments.length-2;if(i===1)a.children=n;else if(1<i){for(var r=Array(i),c=0;c<i;c++)r[c]=arguments[c+2];a.children=r}if(e&&e.defaultProps)for(l in i=e.defaultProps,i)a[l]===void 0&&(a[l]=i[l]);return Mf(e,s,a)};se.createRef=function(){return{current:null}};se.forwardRef=function(e){return{$$typeof:I2,render:e}};se.isValidElement=_f;se.lazy=function(e){return{$$typeof:zx,_payload:{_status:-1,_result:e},_init:nw}};se.memo=function(e,t){return{$$typeof:W2,type:e,compare:t===void 0?null:t}};se.startTransition=function(e){var t=Te.T,n={};Te.T=n;try{var l=e(),a=Te.S;a!==null&&a(n,l),typeof l=="object"&&l!==null&&typeof l.then=="function"&&l.then(rd,Sp)}catch(s){Sp(s)}finally{t!==null&&n.types!==null&&(t.types=n.types),Te.T=t}};se.unstable_useCacheRefresh=function(){return Te.H.useCacheRefresh()};se.use=function(e){return Te.H.use(e)};se.useActionState=function(e,t,n){return Te.H.useActionState(e,t,n)};se.useCallback=function(e,t){return Te.H.useCallback(e,t)};se.useContext=function(e){return Te.H.useContext(e)};se.useDebugValue=function(){};se.useDeferredValue=function(e,t){return Te.H.useDeferredValue(e,t)};se.useEffect=function(e,t){return Te.H.useEffect(e,t)};se.useEffectEvent=function(e){return Te.H.useEffectEvent(e)};se.useId=function(){return Te.H.useId()};se.useImperativeHandle=function(e,t,n){return Te.H.useImperativeHandle(e,t,n)};se.useInsertionEffect=function(e,t){return Te.H.useInsertionEffect(e,t)};se.useLayoutEffect=function(e,t){return Te.H.useLayoutEffect(e,t)};se.useMemo=function(e,t){return Te.H.useMemo(e,t)};se.useOptimistic=function(e,t){return Te.H.useOptimistic(e,t)};se.useReducer=function(e,t,n){return Te.H.useReducer(e,t,n)};se.useRef=function(e){return Te.H.useRef(e)};se.useState=function(e){return Te.H.useState(e)};se.useSyncExternalStore=function(e,t,n){return Te.H.useSyncExternalStore(e,t,n)};se.useTransition=function(){return Te.H.useTransition()};se.version="19.2.6";Dx.exports=se;var b=Dx.exports;const _e=_x(b);var Bx={exports:{}},mc={},Ux={exports:{}},qx={};/**
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(k,R){var D=k.length;k.push(R);e:for(;0<D;){var O=D-1>>>1,q=k[O];if(0<a(q,R))k[O]=R,k[D]=q,D=O;else break e}}function n(k){return k.length===0?null:k[0]}function l(k){if(k.length===0)return null;var R=k[0],D=k.pop();if(D!==R){k[0]=D;e:for(var O=0,q=k.length,X=q>>>1;O<X;){var L=2*(O+1)-1,Y=k[L],_=L+1,U=k[_];if(0>a(Y,D))_<q&&0>a(U,Y)?(k[O]=U,k[_]=D,O=_):(k[O]=Y,k[L]=D,O=L);else if(_<q&&0>a(U,D))k[O]=U,k[_]=D,O=_;else break e}}return R}function a(k,R){var D=k.sortIndex-R.sortIndex;return D!==0?D:k.id-R.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 i=Date,r=i.now();e.unstable_now=function(){return i.now()-r}}var c=[],u=[],d=1,f=null,h=3,p=!1,x=!1,S=!1,w=!1,g=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;function v(k){for(var R=n(u);R!==null;){if(R.callback===null)l(u);else if(R.startTime<=k)l(u),R.sortIndex=R.expirationTime,t(c,R);else break;R=n(u)}}function j(k){if(S=!1,v(k),!x)if(n(c)!==null)x=!0,E||(E=!0,$());else{var R=n(u);R!==null&&z(j,R.startTime-k)}}var E=!1,M=-1,T=5,C=-1;function H(){return w?!0:!(e.unstable_now()-C<T)}function A(){if(w=!1,E){var k=e.unstable_now();C=k;var R=!0;try{e:{x=!1,S&&(S=!1,y(M),M=-1),p=!0;var D=h;try{t:{for(v(k),f=n(c);f!==null&&!(f.expirationTime>k&&H());){var O=f.callback;if(typeof O=="function"){f.callback=null,h=f.priorityLevel;var q=O(f.expirationTime<=k);if(k=e.unstable_now(),typeof q=="function"){f.callback=q,v(k),R=!0;break t}f===n(c)&&l(c),v(k)}else l(c);f=n(c)}if(f!==null)R=!0;else{var X=n(u);X!==null&&z(j,X.startTime-k),R=!1}}break e}finally{f=null,h=D,p=!1}R=void 0}}finally{R?$():E=!1}}}var $;if(typeof m=="function")$=function(){m(A)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,N=V.port2;V.port1.onmessage=A,$=function(){N.postMessage(null)}}else $=function(){g(A,0)};function z(k,R){M=g(function(){k(e.unstable_now())},R)}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(k){k.callback=null},e.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<k?Math.floor(1e3/k):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_next=function(k){switch(h){case 1:case 2:case 3:var R=3;break;default:R=h}var D=h;h=R;try{return k()}finally{h=D}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(k,R){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var D=h;h=k;try{return R()}finally{h=D}},e.unstable_scheduleCallback=function(k,R,D){var O=e.unstable_now();switch(typeof D=="object"&&D!==null?(D=D.delay,D=typeof D=="number"&&0<D?O+D:O):D=O,k){case 1:var q=-1;break;case 2:q=250;break;case 5:q=1073741823;break;case 4:q=1e4;break;default:q=5e3}return q=D+q,k={id:d++,callback:R,priorityLevel:k,startTime:D,expirationTime:q,sortIndex:-1},D>O?(k.sortIndex=D,t(u,k),n(c)===null&&k===n(u)&&(S?(y(M),M=-1):S=!0,z(j,D-O))):(k.sortIndex=q,t(c,k),x||p||(x=!0,E||(E=!0,$()))),k},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(k){var R=h;return function(){var D=h;h=R;try{return k.apply(this,arguments)}finally{h=D}}}})(qx);Ux.exports=qx;var aw=Ux.exports,Yx={exports:{}},dt={};/**
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 sw=b;function Vx(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 sl(){}var ut={d:{f:sl,r:function(){throw Error(Vx(522))},D:sl,C:sl,L:sl,m:sl,X:sl,S:sl,M:sl},p:0,findDOMNode:null},iw=Symbol.for("react.portal");function rw(e,t,n){var l=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:iw,key:l==null?null:""+l,children:e,containerInfo:t,implementation:n}}var Fs=sw.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function xc(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}dt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ut;dt.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(Vx(299));return rw(e,t,null,n)};dt.flushSync=function(e){var t=Fs.T,n=ut.p;try{if(Fs.T=null,ut.p=2,e)return e()}finally{Fs.T=t,ut.p=n,ut.d.f()}};dt.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,ut.d.C(e,t))};dt.prefetchDNS=function(e){typeof e=="string"&&ut.d.D(e)};dt.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,l=xc(n,t.crossOrigin),a=typeof t.integrity=="string"?t.integrity:void 0,s=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?ut.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:l,integrity:a,fetchPriority:s}):n==="script"&&ut.d.X(e,{crossOrigin:l,integrity:a,fetchPriority:s,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};dt.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=xc(t.as,t.crossOrigin);ut.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&&ut.d.M(e)};dt.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,l=xc(n,t.crossOrigin);ut.d.L(e,n,{crossOrigin:l,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})}};dt.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=xc(t.as,t.crossOrigin);ut.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 ut.d.m(e)};dt.requestFormReset=function(e){ut.d.r(e)};dt.unstable_batchedUpdates=function(e,t){return e(t)};dt.useFormState=function(e,t,n){return Fs.H.useFormState(e,t,n)};dt.useFormStatus=function(){return Fs.H.useHostTransitionStatus()};dt.version="19.2.6";function Xx(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Xx)}catch(e){console.error(e)}}Xx(),Yx.exports=dt;var Wl=Yx.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 Ze=aw,Gx=b,ow=Wl;function Q(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 Qx(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Vi(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 Zx(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 Ix(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 Np(e){if(Vi(e)!==e)throw Error(Q(188))}function cw(e){var t=e.alternate;if(!t){if(t=Vi(e),t===null)throw Error(Q(188));return t!==e?null:e}for(var n=e,l=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(l=a.return,l!==null){n=l;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return Np(a),e;if(s===l)return Np(a),t;s=s.sibling}throw Error(Q(188))}if(n.return!==l.return)n=a,l=s;else{for(var i=!1,r=a.child;r;){if(r===n){i=!0,n=a,l=s;break}if(r===l){i=!0,l=a,n=s;break}r=r.sibling}if(!i){for(r=s.child;r;){if(r===n){i=!0,n=s,l=a;break}if(r===l){i=!0,l=s,n=a;break}r=r.sibling}if(!i)throw Error(Q(189))}}if(n.alternate!==l)throw Error(Q(190))}if(n.tag!==3)throw Error(Q(188));return n.stateNode.current===n?e:t}function Kx(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=Kx(e),t!==null)return t;e=e.sibling}return null}var Ae=Object.assign,uw=Symbol.for("react.element"),xr=Symbol.for("react.transitional.element"),Xs=Symbol.for("react.portal"),_a=Symbol.for("react.fragment"),Wx=Symbol.for("react.strict_mode"),od=Symbol.for("react.profiler"),Jx=Symbol.for("react.consumer"),Un=Symbol.for("react.context"),Tf=Symbol.for("react.forward_ref"),cd=Symbol.for("react.suspense"),ud=Symbol.for("react.suspense_list"),Af=Symbol.for("react.memo"),ul=Symbol.for("react.lazy"),dd=Symbol.for("react.activity"),dw=Symbol.for("react.memo_cache_sentinel"),jp=Symbol.iterator;function Rs(e){return e===null||typeof e!="object"?null:(e=jp&&e[jp]||e["@@iterator"],typeof e=="function"?e:null)}var fw=Symbol.for("react.client.reference");function fd(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===fw?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case _a:return"Fragment";case od:return"Profiler";case Wx:return"StrictMode";case cd:return"Suspense";case ud:return"SuspenseList";case dd:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case Xs:return"Portal";case Un:return e.displayName||"Context";case Jx:return(e._context.displayName||"Context")+".Consumer";case Tf:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Af:return t=e.displayName||null,t!==null?t:fd(e.type)||"Memo";case ul:t=e._payload,e=e._init;try{return fd(e(t))}catch{}}return null}var Gs=Array.isArray,le=Gx.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me=ow.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Fl={pending:!1,data:null,method:null,action:null},hd=[],Ta=-1;function Cn(e){return{current:e}}function Fe(e){0>Ta||(e.current=hd[Ta],hd[Ta]=null,Ta--)}function Ee(e,t){Ta++,hd[Ta]=e.current,e.current=t}var jn=Cn(null),xi=Cn(null),Nl=Cn(null),yo=Cn(null);function vo(e,t){switch(Ee(Nl,t),Ee(xi,e),Ee(jn,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Tg(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Tg(t),e=xv(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Fe(jn),Ee(jn,e)}function es(){Fe(jn),Fe(xi),Fe(Nl)}function pd(e){e.memoizedState!==null&&Ee(yo,e);var t=jn.current,n=xv(t,e.type);t!==n&&(Ee(xi,e),Ee(jn,n))}function bo(e){xi.current===e&&(Fe(jn),Fe(xi)),yo.current===e&&(Fe(yo),Mi._currentValue=Fl)}var ou,kp;function Xl(e){if(ou===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);ou=t&&t[1]||"",kp=-1<n.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+ou+e+kp}var cu=!1;function uu(e,t){if(!e||cu)return"";cu=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={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]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var s=l.DetermineComponentFrameRoot(),i=s[0],r=s[1];if(i&&r){var c=i.split(`
44
- `),u=r.split(`
45
- `);for(a=l=0;l<c.length&&!c[l].includes("DetermineComponentFrameRoot");)l++;for(;a<u.length&&!u[a].includes("DetermineComponentFrameRoot");)a++;if(l===c.length||a===u.length)for(l=c.length-1,a=u.length-1;1<=l&&0<=a&&c[l]!==u[a];)a--;for(;1<=l&&0<=a;l--,a--)if(c[l]!==u[a]){if(l!==1||a!==1)do if(l--,a--,0>a||c[l]!==u[a]){var d=`
46
- `+c[l].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),d}while(1<=l&&0<=a);break}}}finally{cu=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Xl(n):""}function hw(e,t){switch(e.tag){case 26:case 27:case 5:return Xl(e.type);case 16:return Xl("Lazy");case 13:return e.child!==t&&t!==null?Xl("Suspense Fallback"):Xl("Suspense");case 19:return Xl("SuspenseList");case 0:case 15:return uu(e.type,!1);case 11:return uu(e.type.render,!1);case 1:return uu(e.type,!0);case 31:return Xl("Activity");default:return""}}function Ep(e){try{var t="",n=null;do t+=hw(e,n),n=e,e=e.return;while(e);return t}catch(l){return`
47
- Error generating stack: `+l.message+`
48
- `+l.stack}}var gd=Object.prototype.hasOwnProperty,Df=Ze.unstable_scheduleCallback,du=Ze.unstable_cancelCallback,pw=Ze.unstable_shouldYield,gw=Ze.unstable_requestPaint,_t=Ze.unstable_now,mw=Ze.unstable_getCurrentPriorityLevel,Fx=Ze.unstable_ImmediatePriority,Px=Ze.unstable_UserBlockingPriority,wo=Ze.unstable_NormalPriority,xw=Ze.unstable_LowPriority,e0=Ze.unstable_IdlePriority,yw=Ze.log,vw=Ze.unstable_setDisableYieldValue,Xi=null,Tt=null;function yl(e){if(typeof yw=="function"&&vw(e),Tt&&typeof Tt.setStrictMode=="function")try{Tt.setStrictMode(Xi,e)}catch{}}var At=Math.clz32?Math.clz32:Sw,bw=Math.log,ww=Math.LN2;function Sw(e){return e>>>=0,e===0?32:31-(bw(e)/ww|0)|0}var yr=256,vr=262144,br=4194304;function Gl(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 yc(e,t,n){var l=e.pendingLanes;if(l===0)return 0;var a=0,s=e.suspendedLanes,i=e.pingedLanes;e=e.warmLanes;var r=l&134217727;return r!==0?(l=r&~s,l!==0?a=Gl(l):(i&=r,i!==0?a=Gl(i):n||(n=r&~e,n!==0&&(a=Gl(n))))):(r=l&~s,r!==0?a=Gl(r):i!==0?a=Gl(i):n||(n=l&~e,n!==0&&(a=Gl(n)))),a===0?0:t!==0&&t!==a&&!(t&s)&&(s=a&-a,n=t&-t,s>=n||s===32&&(n&4194048)!==0)?t:a}function Gi(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Nw(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 t0(){var e=br;return br<<=1,!(br&62914560)&&(br=4194304),e}function fu(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Qi(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function jw(e,t,n,l,a,s){var i=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 r=e.entanglements,c=e.expirationTimes,u=e.hiddenUpdates;for(n=i&~n;0<n;){var d=31-At(n),f=1<<d;r[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}l!==0&&n0(e,l,0),s!==0&&a===0&&e.tag!==0&&(e.suspendedLanes|=s&~(i&~t))}function n0(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-At(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|n&261930}function l0(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-At(n),a=1<<l;a&t|e[l]&t&&(e[l]|=t),n&=~a}}function a0(e,t){var n=t&-t;return n=n&42?1:zf(n),n&(e.suspendedLanes|t)?0:n}function zf(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 Rf(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function s0(){var e=me.p;return e!==0?e:(e=window.event,e===void 0?32:Mv(e.type))}function Cp(e,t){var n=me.p;try{return me.p=e,t()}finally{me.p=n}}var $l=Math.random().toString(36).slice(2),et="__reactFiber$"+$l,wt="__reactProps$"+$l,ws="__reactContainer$"+$l,md="__reactEvents$"+$l,kw="__reactListeners$"+$l,Ew="__reactHandles$"+$l,Mp="__reactResources$"+$l,Zi="__reactMarker$"+$l;function Of(e){delete e[et],delete e[wt],delete e[md],delete e[kw],delete e[Ew]}function Aa(e){var t=e[et];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ws]||n[et]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Og(e);e!==null;){if(n=e[et])return n;e=Og(e)}return t}e=n,n=e.parentNode}return null}function Ss(e){if(e=e[et]||e[ws]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Qs(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(Q(33))}function Xa(e){var t=e[Mp];return t||(t=e[Mp]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Je(e){e[Zi]=!0}var i0=new Set,r0={};function ga(e,t){ts(e,t),ts(e+"Capture",t)}function ts(e,t){for(r0[e]=t,e=0;e<t.length;e++)i0.add(t[e])}var Cw=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]*$"),_p={},Tp={};function Mw(e){return gd.call(Tp,e)?!0:gd.call(_p,e)?!1:Cw.test(e)?Tp[e]=!0:(_p[e]=!0,!1)}function Kr(e,t,n){if(Mw(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function wr(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 Dn(e,t,n,l){if(l===null)e.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+l)}}function qt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function o0(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function _w(e,t,n){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var a=l.get,s=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(i){n=""+i,s.call(this,i)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return n},setValue:function(i){n=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function xd(e){if(!e._valueTracker){var t=o0(e)?"checked":"value";e._valueTracker=_w(e,t,""+e[t])}}function c0(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=o0(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function So(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 Tw=/[\n"\\]/g;function Xt(e){return e.replace(Tw,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function yd(e,t,n,l,a,s,i,r){e.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?e.type=i:e.removeAttribute("type"),t!=null?i==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+qt(t)):e.value!==""+qt(t)&&(e.value=""+qt(t)):i!=="submit"&&i!=="reset"||e.removeAttribute("value"),t!=null?vd(e,i,qt(t)):n!=null?vd(e,i,qt(n)):l!=null&&e.removeAttribute("value"),a==null&&s!=null&&(e.defaultChecked=!!s),a!=null&&(e.checked=a&&typeof a!="function"&&typeof a!="symbol"),r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"?e.name=""+qt(r):e.removeAttribute("name")}function u0(e,t,n,l,a,s,i,r){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)){xd(e);return}n=n!=null?""+qt(n):"",t=t!=null?""+qt(t):n,r||t===e.value||(e.value=t),e.defaultValue=t}l=l??a,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=r?e.checked:!!l,e.defaultChecked=!!l,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.name=i),xd(e)}function vd(e,t,n){t==="number"&&So(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Ga(e,t,n,l){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&l&&(e[n].defaultSelected=!0)}else{for(n=""+qt(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,l&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function d0(e,t,n){if(t!=null&&(t=""+qt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+qt(n):""}function f0(e,t,n,l){if(t==null){if(l!=null){if(n!=null)throw Error(Q(92));if(Gs(l)){if(1<l.length)throw Error(Q(93));l=l[0]}n=l}n==null&&(n=""),t=n}n=qt(t),e.defaultValue=n,l=e.textContent,l===n&&l!==""&&l!==null&&(e.value=l),xd(e)}function ns(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Aw=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 Ap(e,t,n){var l=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,n):typeof n!="number"||n===0||Aw.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function h0(e,t,n){if(t!=null&&typeof t!="object")throw Error(Q(62));if(e=e.style,n!=null){for(var l in n)!n.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var a in t)l=t[a],t.hasOwnProperty(a)&&n[a]!==l&&Ap(e,a,l)}else for(var s in t)t.hasOwnProperty(s)&&Ap(e,s,t[s])}function Hf(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 Dw=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"]]),zw=/^[\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 Wr(e){return zw.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function qn(){}var bd=null;function $f(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Da=null,Qa=null;function Dp(e){var t=Ss(e);if(t&&(e=t.stateNode)){var n=e[wt]||null;e:switch(e=t.stateNode,t.type){case"input":if(yd(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="'+Xt(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var a=l[wt]||null;if(!a)throw Error(Q(90));yd(l,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)l=n[t],l.form===e.form&&c0(l)}break e;case"textarea":d0(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Ga(e,!!n.multiple,t,!1)}}}var hu=!1;function p0(e,t,n){if(hu)return e(t,n);hu=!0;try{var l=e(t);return l}finally{if(hu=!1,(Da!==null||Qa!==null)&&(Tc(),Da&&(t=Da,e=Qa,Qa=Da=null,Dp(t),e)))for(t=0;t<e.length;t++)Dp(e[t])}}function yi(e,t){var n=e.stateNode;if(n===null)return null;var l=n[wt]||null;if(l===null)return null;n=l[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":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(Q(231,t,typeof n));return n}var Kn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),wd=!1;if(Kn)try{var Os={};Object.defineProperty(Os,"passive",{get:function(){wd=!0}}),window.addEventListener("test",Os,Os),window.removeEventListener("test",Os,Os)}catch{wd=!1}var vl=null,Lf=null,Jr=null;function g0(){if(Jr)return Jr;var e,t=Lf,n=t.length,l,a="value"in vl?vl.value:vl.textContent,s=a.length;for(e=0;e<n&&t[e]===a[e];e++);var i=n-e;for(l=1;l<=i&&t[n-l]===a[s-l];l++);return Jr=a.slice(e,1<l?1-l:void 0)}function Fr(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 Sr(){return!0}function zp(){return!1}function St(e){function t(n,l,a,s,i){this._reactName=n,this._targetInst=a,this.type=l,this.nativeEvent=s,this.target=i,this.currentTarget=null;for(var r in e)e.hasOwnProperty(r)&&(n=e[r],this[r]=n?n(s):s[r]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Sr:zp,this.isPropagationStopped=zp,this}return Ae(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=Sr)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Sr)},persist:function(){},isPersistent:Sr}),t}var ma={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vc=St(ma),Ii=Ae({},ma,{view:0,detail:0}),Rw=St(Ii),pu,gu,Hs,bc=Ae({},Ii,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bf,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!==Hs&&(Hs&&e.type==="mousemove"?(pu=e.screenX-Hs.screenX,gu=e.screenY-Hs.screenY):gu=pu=0,Hs=e),pu)},movementY:function(e){return"movementY"in e?e.movementY:gu}}),Rp=St(bc),Ow=Ae({},bc,{dataTransfer:0}),Hw=St(Ow),$w=Ae({},Ii,{relatedTarget:0}),mu=St($w),Lw=Ae({},ma,{animationName:0,elapsedTime:0,pseudoElement:0}),Bw=St(Lw),Uw=Ae({},ma,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),qw=St(Uw),Yw=Ae({},ma,{data:0}),Op=St(Yw),Vw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Xw={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"},Gw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Qw(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Gw[e])?!!t[e]:!1}function Bf(){return Qw}var Zw=Ae({},Ii,{key:function(e){if(e.key){var t=Vw[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Fr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Xw[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bf,charCode:function(e){return e.type==="keypress"?Fr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Fr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Iw=St(Zw),Kw=Ae({},bc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Hp=St(Kw),Ww=Ae({},Ii,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bf}),Jw=St(Ww),Fw=Ae({},ma,{propertyName:0,elapsedTime:0,pseudoElement:0}),Pw=St(Fw),eS=Ae({},bc,{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}),tS=St(eS),nS=Ae({},ma,{newState:0,oldState:0}),lS=St(nS),aS=[9,13,27,32],Uf=Kn&&"CompositionEvent"in window,Ps=null;Kn&&"documentMode"in document&&(Ps=document.documentMode);var sS=Kn&&"TextEvent"in window&&!Ps,m0=Kn&&(!Uf||Ps&&8<Ps&&11>=Ps),$p=" ",Lp=!1;function x0(e,t){switch(e){case"keyup":return aS.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function y0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var za=!1;function iS(e,t){switch(e){case"compositionend":return y0(t);case"keypress":return t.which!==32?null:(Lp=!0,$p);case"textInput":return e=t.data,e===$p&&Lp?null:e;default:return null}}function rS(e,t){if(za)return e==="compositionend"||!Uf&&x0(e,t)?(e=g0(),Jr=Lf=vl=null,za=!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 m0&&t.locale!=="ko"?null:t.data;default:return null}}var oS={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 Bp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!oS[e.type]:t==="textarea"}function v0(e,t,n,l){Da?Qa?Qa.push(l):Qa=[l]:Da=l,t=Uo(t,"onChange"),0<t.length&&(n=new vc("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var ei=null,vi=null;function cS(e){pv(e,0)}function wc(e){var t=Qs(e);if(c0(t))return e}function Up(e,t){if(e==="change")return t}var b0=!1;if(Kn){var xu;if(Kn){var yu="oninput"in document;if(!yu){var qp=document.createElement("div");qp.setAttribute("oninput","return;"),yu=typeof qp.oninput=="function"}xu=yu}else xu=!1;b0=xu&&(!document.documentMode||9<document.documentMode)}function Yp(){ei&&(ei.detachEvent("onpropertychange",w0),vi=ei=null)}function w0(e){if(e.propertyName==="value"&&wc(vi)){var t=[];v0(t,vi,e,$f(e)),p0(cS,t)}}function uS(e,t,n){e==="focusin"?(Yp(),ei=t,vi=n,ei.attachEvent("onpropertychange",w0)):e==="focusout"&&Yp()}function dS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return wc(vi)}function fS(e,t){if(e==="click")return wc(t)}function hS(e,t){if(e==="input"||e==="change")return wc(t)}function pS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var zt=typeof Object.is=="function"?Object.is:pS;function bi(e,t){if(zt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),l=Object.keys(t);if(n.length!==l.length)return!1;for(l=0;l<n.length;l++){var a=n[l];if(!gd.call(t,a)||!zt(e[a],t[a]))return!1}return!0}function Vp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xp(e,t){var n=Vp(e);e=0;for(var l;n;){if(n.nodeType===3){if(l=e+n.textContent.length,e<=t&&l>=t)return{node:n,offset:t-e};e=l}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Vp(n)}}function S0(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?S0(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function N0(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=So(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=So(e.document)}return t}function qf(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 gS=Kn&&"documentMode"in document&&11>=document.documentMode,Ra=null,Sd=null,ti=null,Nd=!1;function Gp(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Nd||Ra==null||Ra!==So(l)||(l=Ra,"selectionStart"in l&&qf(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),ti&&bi(ti,l)||(ti=l,l=Uo(Sd,"onSelect"),0<l.length&&(t=new vc("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=Ra)))}function Vl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Oa={animationend:Vl("Animation","AnimationEnd"),animationiteration:Vl("Animation","AnimationIteration"),animationstart:Vl("Animation","AnimationStart"),transitionrun:Vl("Transition","TransitionRun"),transitionstart:Vl("Transition","TransitionStart"),transitioncancel:Vl("Transition","TransitionCancel"),transitionend:Vl("Transition","TransitionEnd")},vu={},j0={};Kn&&(j0=document.createElement("div").style,"AnimationEvent"in window||(delete Oa.animationend.animation,delete Oa.animationiteration.animation,delete Oa.animationstart.animation),"TransitionEvent"in window||delete Oa.transitionend.transition);function xa(e){if(vu[e])return vu[e];if(!Oa[e])return e;var t=Oa[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in j0)return vu[e]=t[n];return e}var k0=xa("animationend"),E0=xa("animationiteration"),C0=xa("animationstart"),mS=xa("transitionrun"),xS=xa("transitionstart"),yS=xa("transitioncancel"),M0=xa("transitionend"),_0=new Map,jd="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(" ");jd.push("scrollEnd");function un(e,t){_0.set(e,t),ga(t,[e])}var No=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)},Bt=[],Ha=0,Yf=0;function Sc(){for(var e=Ha,t=Yf=Ha=0;t<e;){var n=Bt[t];Bt[t++]=null;var l=Bt[t];Bt[t++]=null;var a=Bt[t];Bt[t++]=null;var s=Bt[t];if(Bt[t++]=null,l!==null&&a!==null){var i=l.pending;i===null?a.next=a:(a.next=i.next,i.next=a),l.pending=a}s!==0&&T0(n,a,s)}}function Nc(e,t,n,l){Bt[Ha++]=e,Bt[Ha++]=t,Bt[Ha++]=n,Bt[Ha++]=l,Yf|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Vf(e,t,n,l){return Nc(e,t,n,l),jo(e)}function ya(e,t){return Nc(e,null,null,t),jo(e)}function T0(e,t,n){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n);for(var a=!1,s=e.return;s!==null;)s.childLanes|=n,l=s.alternate,l!==null&&(l.childLanes|=n),s.tag===22&&(e=s.stateNode,e===null||e._visibility&1||(a=!0)),e=s,s=s.return;return e.tag===3?(s=e.stateNode,a&&t!==null&&(a=31-At(n),e=s.hiddenUpdates,l=e[a],l===null?e[a]=[t]:l.push(t),t.lane=n|536870912),s):null}function jo(e){if(50<ui)throw ui=0,Gd=null,Error(Q(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var $a={};function vS(e,t,n,l){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=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Et(e,t,n,l){return new vS(e,t,n,l)}function Xf(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xn(e,t){var n=e.alternate;return n===null?(n=Et(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 A0(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 Pr(e,t,n,l,a,s){var i=0;if(l=e,typeof e=="function")Xf(e)&&(i=1);else if(typeof e=="string")i=jN(e,n,jn.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case dd:return e=Et(31,n,t,a),e.elementType=dd,e.lanes=s,e;case _a:return Pl(n.children,a,s,t);case Wx:i=8,a|=24;break;case od:return e=Et(12,n,t,a|2),e.elementType=od,e.lanes=s,e;case cd:return e=Et(13,n,t,a),e.elementType=cd,e.lanes=s,e;case ud:return e=Et(19,n,t,a),e.elementType=ud,e.lanes=s,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Un:i=10;break e;case Jx:i=9;break e;case Tf:i=11;break e;case Af:i=14;break e;case ul:i=16,l=null;break e}i=29,n=Error(Q(130,e===null?"null":typeof e,"")),l=null}return t=Et(i,n,t,a),t.elementType=e,t.type=l,t.lanes=s,t}function Pl(e,t,n,l){return e=Et(7,e,l,t),e.lanes=n,e}function bu(e,t,n){return e=Et(6,e,null,t),e.lanes=n,e}function D0(e){var t=Et(18,null,null,0);return t.stateNode=e,t}function wu(e,t,n){return t=Et(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Qp=new WeakMap;function Gt(e,t){if(typeof e=="object"&&e!==null){var n=Qp.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Ep(t)},Qp.set(e,t),t)}return{value:e,source:t,stack:Ep(t)}}var La=[],Ba=0,ko=null,wi=0,Yt=[],Vt=0,Dl=null,wn=1,Sn="";function Ln(e,t){La[Ba++]=wi,La[Ba++]=ko,ko=e,wi=t}function z0(e,t,n){Yt[Vt++]=wn,Yt[Vt++]=Sn,Yt[Vt++]=Dl,Dl=e;var l=wn;e=Sn;var a=32-At(l)-1;l&=~(1<<a),n+=1;var s=32-At(t)+a;if(30<s){var i=a-a%5;s=(l&(1<<i)-1).toString(32),l>>=i,a-=i,wn=1<<32-At(t)+a|n<<a|l,Sn=s+e}else wn=1<<s|n<<a|l,Sn=e}function Gf(e){e.return!==null&&(Ln(e,1),z0(e,1,0))}function Qf(e){for(;e===ko;)ko=La[--Ba],La[Ba]=null,wi=La[--Ba],La[Ba]=null;for(;e===Dl;)Dl=Yt[--Vt],Yt[Vt]=null,Sn=Yt[--Vt],Yt[Vt]=null,wn=Yt[--Vt],Yt[Vt]=null}function R0(e,t){Yt[Vt++]=wn,Yt[Vt++]=Sn,Yt[Vt++]=Dl,wn=t.id,Sn=t.overflow,Dl=e}var tt=null,Me=null,ue=!1,jl=null,Qt=!1,kd=Error(Q(519));function zl(e){var t=Error(Q(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Si(Gt(t,e)),kd}function Zp(e){var t=e.stateNode,n=e.type,l=e.memoizedProps;switch(t[et]=e,t[wt]=l,n){case"dialog":re("cancel",t),re("close",t);break;case"iframe":case"object":case"embed":re("load",t);break;case"video":case"audio":for(n=0;n<Ei.length;n++)re(Ei[n],t);break;case"source":re("error",t);break;case"img":case"image":case"link":re("error",t),re("load",t);break;case"details":re("toggle",t);break;case"input":re("invalid",t),u0(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":re("invalid",t);break;case"textarea":re("invalid",t),f0(t,l.value,l.defaultValue,l.children)}n=l.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||l.suppressHydrationWarning===!0||mv(t.textContent,n)?(l.popover!=null&&(re("beforetoggle",t),re("toggle",t)),l.onScroll!=null&&re("scroll",t),l.onScrollEnd!=null&&re("scrollend",t),l.onClick!=null&&(t.onclick=qn),t=!0):t=!1,t||zl(e,!0)}function Ip(e){for(tt=e.return;tt;)switch(tt.tag){case 5:case 31:case 13:Qt=!1;return;case 27:case 3:Qt=!0;return;default:tt=tt.return}}function Sa(e){if(e!==tt)return!1;if(!ue)return Ip(e),ue=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Wd(e.type,e.memoizedProps)),n=!n),n&&Me&&zl(e),Ip(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Q(317));Me=Rg(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Q(317));Me=Rg(e)}else t===27?(t=Me,Ll(e.type)?(e=ef,ef=null,Me=e):Me=t):Me=tt?It(e.stateNode.nextSibling):null;return!0}function sa(){Me=tt=null,ue=!1}function Su(){var e=jl;return e!==null&&(xt===null?xt=e:xt.push.apply(xt,e),jl=null),e}function Si(e){jl===null?jl=[e]:jl.push(e)}var Ed=Cn(null),va=null,Yn=null;function hl(e,t,n){Ee(Ed,t._currentValue),t._currentValue=n}function Gn(e){e._currentValue=Ed.current,Fe(Ed)}function Cd(e,t,n){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===n)break;e=e.return}}function Md(e,t,n,l){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var s=a.dependencies;if(s!==null){var i=a.child;s=s.firstContext;e:for(;s!==null;){var r=s;s=a;for(var c=0;c<t.length;c++)if(r.context===t[c]){s.lanes|=n,r=s.alternate,r!==null&&(r.lanes|=n),Cd(s.return,n,e),l||(i=null);break e}s=r.next}}else if(a.tag===18){if(i=a.return,i===null)throw Error(Q(341));i.lanes|=n,s=i.alternate,s!==null&&(s.lanes|=n),Cd(i,n,e),i=null}else i=a.child;if(i!==null)i.return=a;else for(i=a;i!==null;){if(i===e){i=null;break}if(a=i.sibling,a!==null){a.return=i.return,i=a;break}i=i.return}a=i}}function Ns(e,t,n,l){e=null;for(var a=t,s=!1;a!==null;){if(!s){if(a.flags&524288)s=!0;else if(a.flags&262144)break}if(a.tag===10){var i=a.alternate;if(i===null)throw Error(Q(387));if(i=i.memoizedProps,i!==null){var r=a.type;zt(a.pendingProps.value,i.value)||(e!==null?e.push(r):e=[r])}}else if(a===yo.current){if(i=a.alternate,i===null)throw Error(Q(387));i.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e!==null?e.push(Mi):e=[Mi])}a=a.return}e!==null&&Md(t,e,n,l),t.flags|=262144}function Eo(e){for(e=e.firstContext;e!==null;){if(!zt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ia(e){va=e,Yn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function nt(e){return O0(va,e)}function Nr(e,t){return va===null&&ia(e),O0(e,t)}function O0(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Yn===null){if(e===null)throw Error(Q(308));Yn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Yn=Yn.next=t;return n}var bS=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},wS=Ze.unstable_scheduleCallback,SS=Ze.unstable_NormalPriority,qe={$$typeof:Un,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Zf(){return{controller:new bS,data:new Map,refCount:0}}function Ki(e){e.refCount--,e.refCount===0&&wS(SS,function(){e.controller.abort()})}var ni=null,_d=0,ls=0,Za=null;function NS(e,t){if(ni===null){var n=ni=[];_d=0,ls=yh(),Za={status:"pending",value:void 0,then:function(l){n.push(l)}}}return _d++,t.then(Kp,Kp),t}function Kp(){if(--_d===0&&ni!==null){Za!==null&&(Za.status="fulfilled");var e=ni;ni=null,ls=0,Za=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function jS(e,t){var n=[],l={status:"pending",value:null,reason:null,then:function(a){n.push(a)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var a=0;a<n.length;a++)(0,n[a])(t)},function(a){for(l.status="rejected",l.reason=a,a=0;a<n.length;a++)(0,n[a])(void 0)}),l}var Wp=le.S;le.S=function(e,t){Ky=_t(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&NS(e,t),Wp!==null&&Wp(e,t)};var ea=Cn(null);function If(){var e=ea.current;return e!==null?e:ke.pooledCache}function eo(e,t){t===null?Ee(ea,ea.current):Ee(ea,t.pool)}function H0(){var e=If();return e===null?null:{parent:qe._currentValue,pool:e}}var js=Error(Q(460)),Kf=Error(Q(474)),jc=Error(Q(542)),Co={then:function(){}};function Jp(e){return e=e.status,e==="fulfilled"||e==="rejected"}function $0(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(qn,qn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Pp(e),e;default:if(typeof t.status=="string")t.then(qn,qn);else{if(e=ke,e!==null&&100<e.shellSuspendCounter)throw Error(Q(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var a=t;a.status="fulfilled",a.value=l}},function(l){if(t.status==="pending"){var a=t;a.status="rejected",a.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Pp(e),e}throw ta=t,js}}function Ql(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(ta=n,js):n}}var ta=null;function Fp(){if(ta===null)throw Error(Q(459));var e=ta;return ta=null,e}function Pp(e){if(e===js||e===jc)throw Error(Q(483))}var Ia=null,Ni=0;function jr(e){var t=Ni;return Ni+=1,Ia===null&&(Ia=[]),$0(Ia,e,t)}function $s(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function kr(e,t){throw t.$$typeof===uw?Error(Q(525)):(e=Object.prototype.toString.call(t),Error(Q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function L0(e){function t(g,y){if(e){var m=g.deletions;m===null?(g.deletions=[y],g.flags|=16):m.push(y)}}function n(g,y){if(!e)return null;for(;y!==null;)t(g,y),y=y.sibling;return null}function l(g){for(var y=new Map;g!==null;)g.key!==null?y.set(g.key,g):y.set(g.index,g),g=g.sibling;return y}function a(g,y){return g=Xn(g,y),g.index=0,g.sibling=null,g}function s(g,y,m){return g.index=m,e?(m=g.alternate,m!==null?(m=m.index,m<y?(g.flags|=67108866,y):m):(g.flags|=67108866,y)):(g.flags|=1048576,y)}function i(g){return e&&g.alternate===null&&(g.flags|=67108866),g}function r(g,y,m,v){return y===null||y.tag!==6?(y=bu(m,g.mode,v),y.return=g,y):(y=a(y,m),y.return=g,y)}function c(g,y,m,v){var j=m.type;return j===_a?d(g,y,m.props.children,v,m.key):y!==null&&(y.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===ul&&Ql(j)===y.type)?(y=a(y,m.props),$s(y,m),y.return=g,y):(y=Pr(m.type,m.key,m.props,null,g.mode,v),$s(y,m),y.return=g,y)}function u(g,y,m,v){return y===null||y.tag!==4||y.stateNode.containerInfo!==m.containerInfo||y.stateNode.implementation!==m.implementation?(y=wu(m,g.mode,v),y.return=g,y):(y=a(y,m.children||[]),y.return=g,y)}function d(g,y,m,v,j){return y===null||y.tag!==7?(y=Pl(m,g.mode,v,j),y.return=g,y):(y=a(y,m),y.return=g,y)}function f(g,y,m){if(typeof y=="string"&&y!==""||typeof y=="number"||typeof y=="bigint")return y=bu(""+y,g.mode,m),y.return=g,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case xr:return m=Pr(y.type,y.key,y.props,null,g.mode,m),$s(m,y),m.return=g,m;case Xs:return y=wu(y,g.mode,m),y.return=g,y;case ul:return y=Ql(y),f(g,y,m)}if(Gs(y)||Rs(y))return y=Pl(y,g.mode,m,null),y.return=g,y;if(typeof y.then=="function")return f(g,jr(y),m);if(y.$$typeof===Un)return f(g,Nr(g,y),m);kr(g,y)}return null}function h(g,y,m,v){var j=y!==null?y.key:null;if(typeof m=="string"&&m!==""||typeof m=="number"||typeof m=="bigint")return j!==null?null:r(g,y,""+m,v);if(typeof m=="object"&&m!==null){switch(m.$$typeof){case xr:return m.key===j?c(g,y,m,v):null;case Xs:return m.key===j?u(g,y,m,v):null;case ul:return m=Ql(m),h(g,y,m,v)}if(Gs(m)||Rs(m))return j!==null?null:d(g,y,m,v,null);if(typeof m.then=="function")return h(g,y,jr(m),v);if(m.$$typeof===Un)return h(g,y,Nr(g,m),v);kr(g,m)}return null}function p(g,y,m,v,j){if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return g=g.get(m)||null,r(y,g,""+v,j);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case xr:return g=g.get(v.key===null?m:v.key)||null,c(y,g,v,j);case Xs:return g=g.get(v.key===null?m:v.key)||null,u(y,g,v,j);case ul:return v=Ql(v),p(g,y,m,v,j)}if(Gs(v)||Rs(v))return g=g.get(m)||null,d(y,g,v,j,null);if(typeof v.then=="function")return p(g,y,m,jr(v),j);if(v.$$typeof===Un)return p(g,y,m,Nr(y,v),j);kr(y,v)}return null}function x(g,y,m,v){for(var j=null,E=null,M=y,T=y=0,C=null;M!==null&&T<m.length;T++){M.index>T?(C=M,M=null):C=M.sibling;var H=h(g,M,m[T],v);if(H===null){M===null&&(M=C);break}e&&M&&H.alternate===null&&t(g,M),y=s(H,y,T),E===null?j=H:E.sibling=H,E=H,M=C}if(T===m.length)return n(g,M),ue&&Ln(g,T),j;if(M===null){for(;T<m.length;T++)M=f(g,m[T],v),M!==null&&(y=s(M,y,T),E===null?j=M:E.sibling=M,E=M);return ue&&Ln(g,T),j}for(M=l(M);T<m.length;T++)C=p(M,g,T,m[T],v),C!==null&&(e&&C.alternate!==null&&M.delete(C.key===null?T:C.key),y=s(C,y,T),E===null?j=C:E.sibling=C,E=C);return e&&M.forEach(function(A){return t(g,A)}),ue&&Ln(g,T),j}function S(g,y,m,v){if(m==null)throw Error(Q(151));for(var j=null,E=null,M=y,T=y=0,C=null,H=m.next();M!==null&&!H.done;T++,H=m.next()){M.index>T?(C=M,M=null):C=M.sibling;var A=h(g,M,H.value,v);if(A===null){M===null&&(M=C);break}e&&M&&A.alternate===null&&t(g,M),y=s(A,y,T),E===null?j=A:E.sibling=A,E=A,M=C}if(H.done)return n(g,M),ue&&Ln(g,T),j;if(M===null){for(;!H.done;T++,H=m.next())H=f(g,H.value,v),H!==null&&(y=s(H,y,T),E===null?j=H:E.sibling=H,E=H);return ue&&Ln(g,T),j}for(M=l(M);!H.done;T++,H=m.next())H=p(M,g,T,H.value,v),H!==null&&(e&&H.alternate!==null&&M.delete(H.key===null?T:H.key),y=s(H,y,T),E===null?j=H:E.sibling=H,E=H);return e&&M.forEach(function($){return t(g,$)}),ue&&Ln(g,T),j}function w(g,y,m,v){if(typeof m=="object"&&m!==null&&m.type===_a&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case xr:e:{for(var j=m.key;y!==null;){if(y.key===j){if(j=m.type,j===_a){if(y.tag===7){n(g,y.sibling),v=a(y,m.props.children),v.return=g,g=v;break e}}else if(y.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===ul&&Ql(j)===y.type){n(g,y.sibling),v=a(y,m.props),$s(v,m),v.return=g,g=v;break e}n(g,y);break}else t(g,y);y=y.sibling}m.type===_a?(v=Pl(m.props.children,g.mode,v,m.key),v.return=g,g=v):(v=Pr(m.type,m.key,m.props,null,g.mode,v),$s(v,m),v.return=g,g=v)}return i(g);case Xs:e:{for(j=m.key;y!==null;){if(y.key===j)if(y.tag===4&&y.stateNode.containerInfo===m.containerInfo&&y.stateNode.implementation===m.implementation){n(g,y.sibling),v=a(y,m.children||[]),v.return=g,g=v;break e}else{n(g,y);break}else t(g,y);y=y.sibling}v=wu(m,g.mode,v),v.return=g,g=v}return i(g);case ul:return m=Ql(m),w(g,y,m,v)}if(Gs(m))return x(g,y,m,v);if(Rs(m)){if(j=Rs(m),typeof j!="function")throw Error(Q(150));return m=j.call(m),S(g,y,m,v)}if(typeof m.then=="function")return w(g,y,jr(m),v);if(m.$$typeof===Un)return w(g,y,Nr(g,m),v);kr(g,m)}return typeof m=="string"&&m!==""||typeof m=="number"||typeof m=="bigint"?(m=""+m,y!==null&&y.tag===6?(n(g,y.sibling),v=a(y,m),v.return=g,g=v):(n(g,y),v=bu(m,g.mode,v),v.return=g,g=v),i(g)):n(g,y)}return function(g,y,m,v){try{Ni=0;var j=w(g,y,m,v);return Ia=null,j}catch(M){if(M===js||M===jc)throw M;var E=Et(29,M,null,g.mode);return E.lanes=v,E.return=g,E}finally{}}}var ra=L0(!0),B0=L0(!1),dl=!1;function Wf(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 kl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function El(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,ge&2){var a=l.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),l.pending=t,t=jo(e),T0(e,null,n),t}return Nc(e,l,t,n),jo(e)}function li(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,l0(e,n)}}function Nu(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var a=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var i={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};s===null?a=s=i:s=s.next=i,n=n.next}while(n!==null);s===null?a=s=t:s=s.next=t}else a=s=t;n={baseState:l.baseState,firstBaseUpdate:a,lastBaseUpdate:s,shared:l.shared,callbacks:l.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ad=!1;function ai(){if(Ad){var e=Za;if(e!==null)throw e}}function si(e,t,n,l){Ad=!1;var a=e.updateQueue;dl=!1;var s=a.firstBaseUpdate,i=a.lastBaseUpdate,r=a.shared.pending;if(r!==null){a.shared.pending=null;var c=r,u=c.next;c.next=null,i===null?s=u:i.next=u,i=c;var d=e.alternate;d!==null&&(d=d.updateQueue,r=d.lastBaseUpdate,r!==i&&(r===null?d.firstBaseUpdate=u:r.next=u,d.lastBaseUpdate=c))}if(s!==null){var f=a.baseState;i=0,d=u=c=null,r=s;do{var h=r.lane&-536870913,p=h!==r.lane;if(p?(ce&h)===h:(l&h)===h){h!==0&&h===ls&&(Ad=!0),d!==null&&(d=d.next={lane:0,tag:r.tag,payload:r.payload,callback:null,next:null});e:{var x=e,S=r;h=t;var w=n;switch(S.tag){case 1:if(x=S.payload,typeof x=="function"){f=x.call(w,f,h);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=S.payload,h=typeof x=="function"?x.call(w,f,h):x,h==null)break e;f=Ae({},f,h);break e;case 2:dl=!0}}h=r.callback,h!==null&&(e.flags|=64,p&&(e.flags|=8192),p=a.callbacks,p===null?a.callbacks=[h]:p.push(h))}else p={lane:h,tag:r.tag,payload:r.payload,callback:r.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,i|=h;if(r=r.next,r===null){if(r=a.shared.pending,r===null)break;p=r,r=p.next,p.next=null,a.lastBaseUpdate=p,a.shared.pending=null}}while(!0);d===null&&(c=f),a.baseState=c,a.firstBaseUpdate=u,a.lastBaseUpdate=d,s===null&&(a.shared.lanes=0),Ol|=i,e.lanes=i,e.memoizedState=f}}function U0(e,t){if(typeof e!="function")throw Error(Q(191,e));e.call(t)}function q0(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)U0(n[e],t)}var as=Cn(null),Mo=Cn(0);function eg(e,t){e=Pn,Ee(Mo,e),Ee(as,t),Pn=e|t.baseLanes}function Dd(){Ee(Mo,Pn),Ee(as,as.current)}function Jf(){Pn=Mo.current,Fe(as),Fe(Mo)}var Rt=Cn(null),Zt=null;function pl(e){var t=e.alternate;Ee($e,$e.current&1),Ee(Rt,e),Zt===null&&(t===null||as.current!==null||t.memoizedState!==null)&&(Zt=e)}function zd(e){Ee($e,$e.current),Ee(Rt,e),Zt===null&&(Zt=e)}function Y0(e){e.tag===22?(Ee($e,$e.current),Ee(Rt,e),Zt===null&&(Zt=e)):gl()}function gl(){Ee($e,$e.current),Ee(Rt,Rt.current)}function kt(e){Fe(Rt),Zt===e&&(Zt=null),Fe($e)}var $e=Cn(0);function _o(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Fd(n)||Pd(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 Wn=0,ie=null,je=null,Be=null,To=!1,Ka=!1,oa=!1,Ao=0,ji=0,Wa=null,kS=0;function Oe(){throw Error(Q(321))}function Ff(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!zt(e[n],t[n]))return!1;return!0}function Pf(e,t,n,l,a,s){return Wn=s,ie=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,le.H=e===null||e.memoizedState===null?vy:uh,oa=!1,s=n(l,a),oa=!1,Ka&&(s=X0(t,n,l,a)),V0(e),s}function V0(e){le.H=ki;var t=je!==null&&je.next!==null;if(Wn=0,Be=je=ie=null,To=!1,ji=0,Wa=null,t)throw Error(Q(300));e===null||Ye||(e=e.dependencies,e!==null&&Eo(e)&&(Ye=!0))}function X0(e,t,n,l){ie=e;var a=0;do{if(Ka&&(Wa=null),ji=0,Ka=!1,25<=a)throw Error(Q(301));if(a+=1,Be=je=null,e.updateQueue!=null){var s=e.updateQueue;s.lastEffect=null,s.events=null,s.stores=null,s.memoCache!=null&&(s.memoCache.index=0)}le.H=by,s=t(n,l)}while(Ka);return s}function ES(){var e=le.H,t=e.useState()[0];return t=typeof t.then=="function"?Wi(t):t,e=e.useState()[0],(je!==null?je.memoizedState:null)!==e&&(ie.flags|=1024),t}function eh(){var e=Ao!==0;return Ao=0,e}function th(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function nh(e){if(To){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}To=!1}Wn=0,Be=je=ie=null,Ka=!1,ji=Ao=0,Wa=null}function ct(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Be===null?ie.memoizedState=Be=e:Be=Be.next=e,Be}function Le(){if(je===null){var e=ie.alternate;e=e!==null?e.memoizedState:null}else e=je.next;var t=Be===null?ie.memoizedState:Be.next;if(t!==null)Be=t,je=e;else{if(e===null)throw ie.alternate===null?Error(Q(467)):Error(Q(310));je=e,e={memoizedState:je.memoizedState,baseState:je.baseState,baseQueue:je.baseQueue,queue:je.queue,next:null},Be===null?ie.memoizedState=Be=e:Be=Be.next=e}return Be}function kc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Wi(e){var t=ji;return ji+=1,Wa===null&&(Wa=[]),e=$0(Wa,e,t),t=ie,(Be===null?t.memoizedState:Be.next)===null&&(t=t.alternate,le.H=t===null||t.memoizedState===null?vy:uh),e}function Ec(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Wi(e);if(e.$$typeof===Un)return nt(e)}throw Error(Q(438,String(e)))}function lh(e){var t=null,n=ie.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var l=ie.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(a){return a.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=kc(),ie.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),l=0;l<e;l++)n[l]=dw;return t.index++,n}function Jn(e,t){return typeof t=="function"?t(e):t}function to(e){var t=Le();return ah(t,je,e)}function ah(e,t,n){var l=e.queue;if(l===null)throw Error(Q(311));l.lastRenderedReducer=n;var a=e.baseQueue,s=l.pending;if(s!==null){if(a!==null){var i=a.next;a.next=s.next,s.next=i}t.baseQueue=a=s,l.pending=null}if(s=e.baseState,a===null)e.memoizedState=s;else{t=a.next;var r=i=null,c=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f!==u.lane?(ce&f)===f:(Wn&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===ls&&(d=!0);else if((Wn&h)===h){u=u.next,h===ls&&(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?(r=c=f,i=s):c=c.next=f,ie.lanes|=h,Ol|=h;f=u.action,oa&&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?(r=c=h,i=s):c=c.next=h,ie.lanes|=f,Ol|=f;u=u.next}while(u!==null&&u!==t);if(c===null?i=s:c.next=r,!zt(s,e.memoizedState)&&(Ye=!0,d&&(n=Za,n!==null)))throw n;e.memoizedState=s,e.baseState=i,e.baseQueue=c,l.lastRenderedState=s}return a===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function ju(e){var t=Le(),n=t.queue;if(n===null)throw Error(Q(311));n.lastRenderedReducer=e;var l=n.dispatch,a=n.pending,s=t.memoizedState;if(a!==null){n.pending=null;var i=a=a.next;do s=e(s,i.action),i=i.next;while(i!==a);zt(s,t.memoizedState)||(Ye=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,l]}function G0(e,t,n){var l=ie,a=Le(),s=ue;if(s){if(n===void 0)throw Error(Q(407));n=n()}else n=t();var i=!zt((je||a).memoizedState,n);if(i&&(a.memoizedState=n,Ye=!0),a=a.queue,sh(I0.bind(null,l,a,e),[e]),a.getSnapshot!==t||i||Be!==null&&Be.memoizedState.tag&1){if(l.flags|=2048,ss(9,{destroy:void 0},Z0.bind(null,l,a,n,t),null),ke===null)throw Error(Q(349));s||Wn&127||Q0(l,t,n)}return n}function Q0(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ie.updateQueue,t===null?(t=kc(),ie.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Z0(e,t,n,l){t.value=n,t.getSnapshot=l,K0(t)&&W0(e)}function I0(e,t,n){return n(function(){K0(t)&&W0(e)})}function K0(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!zt(e,n)}catch{return!0}}function W0(e){var t=ya(e,2);t!==null&&bt(t,e,2)}function Rd(e){var t=ct();if(typeof e=="function"){var n=e;if(e=n(),oa){yl(!0);try{n()}finally{yl(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jn,lastRenderedState:e},t}function J0(e,t,n,l){return e.baseState=n,ah(e,je,typeof l=="function"?l:Jn)}function CS(e,t,n,l,a){if(Mc(e))throw Error(Q(485));if(e=t.action,e!==null){var s={payload:a,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(i){s.listeners.push(i)}};le.T!==null?n(!0):s.isTransition=!1,l(s),n=t.pending,n===null?(s.next=t.pending=s,F0(t,s)):(s.next=n.next,t.pending=n.next=s)}}function F0(e,t){var n=t.action,l=t.payload,a=e.state;if(t.isTransition){var s=le.T,i={};le.T=i;try{var r=n(a,l),c=le.S;c!==null&&c(i,r),tg(e,t,r)}catch(u){Od(e,t,u)}finally{s!==null&&i.types!==null&&(s.types=i.types),le.T=s}}else try{s=n(a,l),tg(e,t,s)}catch(u){Od(e,t,u)}}function tg(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(l){ng(e,t,l)},function(l){return Od(e,t,l)}):ng(e,t,n)}function ng(e,t,n){t.status="fulfilled",t.value=n,P0(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,F0(e,n)))}function Od(e,t,n){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=n,P0(t),t=t.next;while(t!==l)}e.action=null}function P0(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ey(e,t){return t}function lg(e,t){if(ue){var n=ke.formState;if(n!==null){e:{var l=ie;if(ue){if(Me){t:{for(var a=Me,s=Qt;a.nodeType!==8;){if(!s){a=null;break t}if(a=It(a.nextSibling),a===null){a=null;break t}}s=a.data,a=s==="F!"||s==="F"?a:null}if(a){Me=It(a.nextSibling),l=a.data==="F!";break e}}zl(l)}l=!1}l&&(t=n[0])}}return n=ct(),n.memoizedState=n.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ey,lastRenderedState:t},n.queue=l,n=my.bind(null,ie,l),l.dispatch=n,l=Rd(!1),s=ch.bind(null,ie,!1,l.queue),l=ct(),a={state:t,dispatch:null,action:e,pending:null},l.queue=a,n=CS.bind(null,ie,a,s,n),a.dispatch=n,l.memoizedState=e,[t,n,!1]}function ag(e){var t=Le();return ty(t,je,e)}function ty(e,t,n){if(t=ah(e,t,ey)[0],e=to(Jn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Wi(t)}catch(i){throw i===js?jc:i}else l=t;t=Le();var a=t.queue,s=a.dispatch;return n!==t.memoizedState&&(ie.flags|=2048,ss(9,{destroy:void 0},MS.bind(null,a,n),null)),[l,s,e]}function MS(e,t){e.action=t}function sg(e){var t=Le(),n=je;if(n!==null)return ty(t,n,e);Le(),t=t.memoizedState,n=Le();var l=n.queue.dispatch;return n.memoizedState=e,[t,l,!1]}function ss(e,t,n,l){return e={tag:e,create:n,deps:l,inst:t,next:null},t=ie.updateQueue,t===null&&(t=kc(),ie.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(l=n.next,n.next=e,e.next=l,t.lastEffect=e),e}function ny(){return Le().memoizedState}function no(e,t,n,l){var a=ct();ie.flags|=e,a.memoizedState=ss(1|t,{destroy:void 0},n,l===void 0?null:l)}function Cc(e,t,n,l){var a=Le();l=l===void 0?null:l;var s=a.memoizedState.inst;je!==null&&l!==null&&Ff(l,je.memoizedState.deps)?a.memoizedState=ss(t,s,n,l):(ie.flags|=e,a.memoizedState=ss(1|t,s,n,l))}function ig(e,t){no(8390656,8,e,t)}function sh(e,t){Cc(2048,8,e,t)}function _S(e){ie.flags|=4;var t=ie.updateQueue;if(t===null)t=kc(),ie.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ly(e){var t=Le().memoizedState;return _S({ref:t,nextImpl:e}),function(){if(ge&2)throw Error(Q(440));return t.impl.apply(void 0,arguments)}}function ay(e,t){return Cc(4,2,e,t)}function sy(e,t){return Cc(4,4,e,t)}function iy(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 ry(e,t,n){n=n!=null?n.concat([e]):null,Cc(4,4,iy.bind(null,t,e),n)}function ih(){}function oy(e,t){var n=Le();t=t===void 0?null:t;var l=n.memoizedState;return t!==null&&Ff(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function cy(e,t){var n=Le();t=t===void 0?null:t;var l=n.memoizedState;if(t!==null&&Ff(t,l[1]))return l[0];if(l=e(),oa){yl(!0);try{e()}finally{yl(!1)}}return n.memoizedState=[l,t],l}function rh(e,t,n){return n===void 0||Wn&1073741824&&!(ce&261930)?e.memoizedState=t:(e.memoizedState=n,e=Jy(),ie.lanes|=e,Ol|=e,n)}function uy(e,t,n,l){return zt(n,t)?n:as.current!==null?(e=rh(e,n,l),zt(e,t)||(Ye=!0),e):!(Wn&42)||Wn&1073741824&&!(ce&261930)?(Ye=!0,e.memoizedState=n):(e=Jy(),ie.lanes|=e,Ol|=e,t)}function dy(e,t,n,l,a){var s=me.p;me.p=s!==0&&8>s?s:8;var i=le.T,r={};le.T=r,ch(e,!1,t,n);try{var c=a(),u=le.S;if(u!==null&&u(r,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=jS(c,l);ii(e,t,d,Dt(e))}else ii(e,t,l,Dt(e))}catch(f){ii(e,t,{then:function(){},status:"rejected",reason:f},Dt())}finally{me.p=s,i!==null&&r.types!==null&&(i.types=r.types),le.T=i}}function TS(){}function Hd(e,t,n,l){if(e.tag!==5)throw Error(Q(476));var a=fy(e).queue;dy(e,a,t,Fl,n===null?TS:function(){return hy(e),n(l)})}function fy(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Fl,baseState:Fl,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jn,lastRenderedState:Fl},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jn,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function hy(e){var t=fy(e);t.next===null&&(t=e.alternate.memoizedState),ii(e,t.next.queue,{},Dt())}function oh(){return nt(Mi)}function py(){return Le().memoizedState}function gy(){return Le().memoizedState}function AS(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Dt();e=kl(n);var l=El(t,e,n);l!==null&&(bt(l,t,n),li(l,t,n)),t={cache:Zf()},e.payload=t;return}t=t.return}}function DS(e,t,n){var l=Dt();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Mc(e)?xy(t,n):(n=Vf(e,t,n,l),n!==null&&(bt(n,e,l),yy(n,t,l)))}function my(e,t,n){var l=Dt();ii(e,t,n,l)}function ii(e,t,n,l){var a={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Mc(e))xy(t,a);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var i=t.lastRenderedState,r=s(i,n);if(a.hasEagerState=!0,a.eagerState=r,zt(r,i))return Nc(e,t,a,0),ke===null&&Sc(),!1}catch{}finally{}if(n=Vf(e,t,a,l),n!==null)return bt(n,e,l),yy(n,t,l),!0}return!1}function ch(e,t,n,l){if(l={lane:2,revertLane:yh(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Mc(e)){if(t)throw Error(Q(479))}else t=Vf(e,n,l,2),t!==null&&bt(t,e,2)}function Mc(e){var t=e.alternate;return e===ie||t!==null&&t===ie}function xy(e,t){Ka=To=!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 l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,l0(e,n)}}var ki={readContext:nt,use:Ec,useCallback:Oe,useContext:Oe,useEffect:Oe,useImperativeHandle:Oe,useLayoutEffect:Oe,useInsertionEffect:Oe,useMemo:Oe,useReducer:Oe,useRef:Oe,useState:Oe,useDebugValue:Oe,useDeferredValue:Oe,useTransition:Oe,useSyncExternalStore:Oe,useId:Oe,useHostTransitionStatus:Oe,useFormState:Oe,useActionState:Oe,useOptimistic:Oe,useMemoCache:Oe,useCacheRefresh:Oe};ki.useEffectEvent=Oe;var vy={readContext:nt,use:Ec,useCallback:function(e,t){return ct().memoizedState=[e,t===void 0?null:t],e},useContext:nt,useEffect:ig,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,no(4194308,4,iy.bind(null,t,e),n)},useLayoutEffect:function(e,t){return no(4194308,4,e,t)},useInsertionEffect:function(e,t){no(4,2,e,t)},useMemo:function(e,t){var n=ct();t=t===void 0?null:t;var l=e();if(oa){yl(!0);try{e()}finally{yl(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=ct();if(n!==void 0){var a=n(t);if(oa){yl(!0);try{n(t)}finally{yl(!1)}}}else a=t;return l.memoizedState=l.baseState=a,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},l.queue=e,e=e.dispatch=DS.bind(null,ie,e),[l.memoizedState,e]},useRef:function(e){var t=ct();return e={current:e},t.memoizedState=e},useState:function(e){e=Rd(e);var t=e.queue,n=my.bind(null,ie,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ih,useDeferredValue:function(e,t){var n=ct();return rh(n,e,t)},useTransition:function(){var e=Rd(!1);return e=dy.bind(null,ie,e.queue,!0,!1),ct().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var l=ie,a=ct();if(ue){if(n===void 0)throw Error(Q(407));n=n()}else{if(n=t(),ke===null)throw Error(Q(349));ce&127||Q0(l,t,n)}a.memoizedState=n;var s={value:n,getSnapshot:t};return a.queue=s,ig(I0.bind(null,l,s,e),[e]),l.flags|=2048,ss(9,{destroy:void 0},Z0.bind(null,l,s,n,t),null),n},useId:function(){var e=ct(),t=ke.identifierPrefix;if(ue){var n=Sn,l=wn;n=(l&~(1<<32-At(l)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Ao++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=kS++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:oh,useFormState:lg,useActionState:lg,useOptimistic:function(e){var t=ct();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ch.bind(null,ie,!0,n),n.dispatch=t,[e,t]},useMemoCache:lh,useCacheRefresh:function(){return ct().memoizedState=AS.bind(null,ie)},useEffectEvent:function(e){var t=ct(),n={impl:e};return t.memoizedState=n,function(){if(ge&2)throw Error(Q(440));return n.impl.apply(void 0,arguments)}}},uh={readContext:nt,use:Ec,useCallback:oy,useContext:nt,useEffect:sh,useImperativeHandle:ry,useInsertionEffect:ay,useLayoutEffect:sy,useMemo:cy,useReducer:to,useRef:ny,useState:function(){return to(Jn)},useDebugValue:ih,useDeferredValue:function(e,t){var n=Le();return uy(n,je.memoizedState,e,t)},useTransition:function(){var e=to(Jn)[0],t=Le().memoizedState;return[typeof e=="boolean"?e:Wi(e),t]},useSyncExternalStore:G0,useId:py,useHostTransitionStatus:oh,useFormState:ag,useActionState:ag,useOptimistic:function(e,t){var n=Le();return J0(n,je,e,t)},useMemoCache:lh,useCacheRefresh:gy};uh.useEffectEvent=ly;var by={readContext:nt,use:Ec,useCallback:oy,useContext:nt,useEffect:sh,useImperativeHandle:ry,useInsertionEffect:ay,useLayoutEffect:sy,useMemo:cy,useReducer:ju,useRef:ny,useState:function(){return ju(Jn)},useDebugValue:ih,useDeferredValue:function(e,t){var n=Le();return je===null?rh(n,e,t):uy(n,je.memoizedState,e,t)},useTransition:function(){var e=ju(Jn)[0],t=Le().memoizedState;return[typeof e=="boolean"?e:Wi(e),t]},useSyncExternalStore:G0,useId:py,useHostTransitionStatus:oh,useFormState:sg,useActionState:sg,useOptimistic:function(e,t){var n=Le();return je!==null?J0(n,je,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:lh,useCacheRefresh:gy};by.useEffectEvent=ly;function ku(e,t,n,l){t=e.memoizedState,n=n(l,t),n=n==null?t:Ae({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var $d={enqueueSetState:function(e,t,n){e=e._reactInternals;var l=Dt(),a=kl(l);a.payload=t,n!=null&&(a.callback=n),t=El(e,a,l),t!==null&&(bt(t,e,l),li(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=Dt(),a=kl(l);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=El(e,a,l),t!==null&&(bt(t,e,l),li(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Dt(),l=kl(n);l.tag=2,t!=null&&(l.callback=t),t=El(e,l,n),t!==null&&(bt(t,e,n),li(t,e,n))}};function rg(e,t,n,l,a,s,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,s,i):t.prototype&&t.prototype.isPureReactComponent?!bi(n,l)||!bi(a,s):!0}function og(e,t,n,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,l),t.state!==e&&$d.enqueueReplaceState(t,t.state,null)}function ca(e,t){var n=t;if("ref"in t){n={};for(var l in t)l!=="ref"&&(n[l]=t[l])}if(e=e.defaultProps){n===t&&(n=Ae({},n));for(var a in e)n[a]===void 0&&(n[a]=e[a])}return n}function wy(e){No(e)}function Sy(e){console.error(e)}function Ny(e){No(e)}function Do(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function cg(e,t,n){try{var l=e.onCaughtError;l(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function Ld(e,t,n){return n=kl(n),n.tag=3,n.payload={element:null},n.callback=function(){Do(e,t)},n}function jy(e){return e=kl(e),e.tag=3,e}function ky(e,t,n,l){var a=n.type.getDerivedStateFromError;if(typeof a=="function"){var s=l.value;e.payload=function(){return a(s)},e.callback=function(){cg(t,n,l)}}var i=n.stateNode;i!==null&&typeof i.componentDidCatch=="function"&&(e.callback=function(){cg(t,n,l),typeof a!="function"&&(Cl===null?Cl=new Set([this]):Cl.add(this));var r=l.stack;this.componentDidCatch(l.value,{componentStack:r!==null?r:""})})}function zS(e,t,n,l,a){if(n.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=n.alternate,t!==null&&Ns(t,n,a,!0),n=Rt.current,n!==null){switch(n.tag){case 31:case 13:return Zt===null?$o():n.alternate===null&&He===0&&(He=3),n.flags&=-257,n.flags|=65536,n.lanes=a,l===Co?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([l]):t.add(l),Hu(e,l,a)),!1;case 22:return n.flags|=65536,l===Co?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([l]):n.add(l)),Hu(e,l,a)),!1}throw Error(Q(435,n.tag))}return Hu(e,l,a),$o(),!1}if(ue)return t=Rt.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,l!==kd&&(e=Error(Q(422),{cause:l}),Si(Gt(e,n)))):(l!==kd&&(t=Error(Q(423),{cause:l}),Si(Gt(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,l=Gt(l,n),a=Ld(e.stateNode,l,a),Nu(e,a),He!==4&&(He=2)),!1;var s=Error(Q(520),{cause:l});if(s=Gt(s,n),ci===null?ci=[s]:ci.push(s),He!==4&&(He=2),t===null)return!0;l=Gt(l,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Ld(n.stateNode,l,e),Nu(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"&&(Cl===null||!Cl.has(s))))return n.flags|=65536,a&=-a,n.lanes|=a,a=jy(a),ky(a,e,n,l),Nu(n,a),!1}n=n.return}while(n!==null);return!1}var dh=Error(Q(461)),Ye=!1;function Pe(e,t,n,l){t.child=e===null?B0(t,null,n,l):ra(t,e.child,n,l)}function ug(e,t,n,l,a){n=n.render;var s=t.ref;if("ref"in l){var i={};for(var r in l)r!=="ref"&&(i[r]=l[r])}else i=l;return ia(t),l=Pf(e,t,n,i,s,a),r=eh(),e!==null&&!Ye?(th(e,t,a),Fn(e,t,a)):(ue&&r&&Gf(t),t.flags|=1,Pe(e,t,l,a),t.child)}function dg(e,t,n,l,a){if(e===null){var s=n.type;return typeof s=="function"&&!Xf(s)&&s.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=s,Ey(e,t,s,l,a)):(e=Pr(n.type,null,l,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!fh(e,a)){var i=s.memoizedProps;if(n=n.compare,n=n!==null?n:bi,n(i,l)&&e.ref===t.ref)return Fn(e,t,a)}return t.flags|=1,e=Xn(s,l),e.ref=t.ref,e.return=t,t.child=e}function Ey(e,t,n,l,a){if(e!==null){var s=e.memoizedProps;if(bi(s,l)&&e.ref===t.ref)if(Ye=!1,t.pendingProps=l=s,fh(e,a))e.flags&131072&&(Ye=!0);else return t.lanes=e.lanes,Fn(e,t,a)}return Bd(e,t,n,l,a)}function Cy(e,t,n,l){var a=l.children,s=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if(t.flags&128){if(s=s!==null?s.baseLanes|n:n,e!==null){for(l=t.child=e.child,a=0;l!==null;)a=a|l.lanes|l.childLanes,l=l.sibling;l=a&~s}else l=0,t.child=null;return fg(e,t,s,n,l)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&eo(t,s!==null?s.cachePool:null),s!==null?eg(t,s):Dd(),Y0(t);else return l=t.lanes=536870912,fg(e,t,s!==null?s.baseLanes|n:n,n,l)}else s!==null?(eo(t,s.cachePool),eg(t,s),gl(),t.memoizedState=null):(e!==null&&eo(t,null),Dd(),gl());return Pe(e,t,a,n),t.child}function Zs(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function fg(e,t,n,l,a){var s=If();return s=s===null?null:{parent:qe._currentValue,pool:s},t.memoizedState={baseLanes:n,cachePool:s},e!==null&&eo(t,null),Dd(),Y0(t),e!==null&&Ns(e,t,l,!0),t.childLanes=a,null}function lo(e,t){return t=zo({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function hg(e,t,n){return ra(t,e.child,null,n),e=lo(t,t.pendingProps),e.flags|=2,kt(t),t.memoizedState=null,e}function RS(e,t,n){var l=t.pendingProps,a=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ue){if(l.mode==="hidden")return e=lo(t,l),t.lanes=536870912,Zs(null,e);if(zd(t),(e=Me)?(e=vv(e,Qt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Dl!==null?{id:wn,overflow:Sn}:null,retryLane:536870912,hydrationErrors:null},n=D0(e),n.return=t,t.child=n,tt=t,Me=null)):e=null,e===null)throw zl(t);return t.lanes=536870912,null}return lo(t,l)}var s=e.memoizedState;if(s!==null){var i=s.dehydrated;if(zd(t),a)if(t.flags&256)t.flags&=-257,t=hg(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(Q(558));else if(Ye||Ns(e,t,n,!1),a=(n&e.childLanes)!==0,Ye||a){if(l=ke,l!==null&&(i=a0(l,n),i!==0&&i!==s.retryLane))throw s.retryLane=i,ya(e,i),bt(l,e,i),dh;$o(),t=hg(e,t,n)}else e=s.treeContext,Me=It(i.nextSibling),tt=t,ue=!0,jl=null,Qt=!1,e!==null&&R0(t,e),t=lo(t,l),t.flags|=4096;return t}return e=Xn(e.child,{mode:l.mode,children:l.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(Q(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Bd(e,t,n,l,a){return ia(t),n=Pf(e,t,n,l,void 0,a),l=eh(),e!==null&&!Ye?(th(e,t,a),Fn(e,t,a)):(ue&&l&&Gf(t),t.flags|=1,Pe(e,t,n,a),t.child)}function pg(e,t,n,l,a,s){return ia(t),t.updateQueue=null,n=X0(t,l,n,a),V0(e),l=eh(),e!==null&&!Ye?(th(e,t,s),Fn(e,t,s)):(ue&&l&&Gf(t),t.flags|=1,Pe(e,t,n,s),t.child)}function gg(e,t,n,l,a){if(ia(t),t.stateNode===null){var s=$a,i=n.contextType;typeof i=="object"&&i!==null&&(s=nt(i)),s=new n(l,s),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=$d,t.stateNode=s,s._reactInternals=t,s=t.stateNode,s.props=l,s.state=t.memoizedState,s.refs={},Wf(t),i=n.contextType,s.context=typeof i=="object"&&i!==null?nt(i):$a,s.state=t.memoizedState,i=n.getDerivedStateFromProps,typeof i=="function"&&(ku(t,n,i,l),s.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(i=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),i!==s.state&&$d.enqueueReplaceState(s,s.state,null),si(t,l,s,a),ai(),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){s=t.stateNode;var r=t.memoizedProps,c=ca(n,r);s.props=c;var u=s.context,d=n.contextType;i=$a,typeof d=="object"&&d!==null&&(i=nt(d));var f=n.getDerivedStateFromProps;d=typeof f=="function"||typeof s.getSnapshotBeforeUpdate=="function",r=t.pendingProps!==r,d||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(r||u!==i)&&og(t,s,l,i),dl=!1;var h=t.memoizedState;s.state=h,si(t,l,s,a),ai(),u=t.memoizedState,r||h!==u||dl?(typeof f=="function"&&(ku(t,n,f,l),u=t.memoizedState),(c=dl||rg(t,n,c,l,h,u,i))?(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=l,t.memoizedState=u),s.props=l,s.state=u,s.context=i,l=c):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{s=t.stateNode,Td(e,t),i=t.memoizedProps,d=ca(n,i),s.props=d,f=t.pendingProps,h=s.context,u=n.contextType,c=$a,typeof u=="object"&&u!==null&&(c=nt(u)),r=n.getDerivedStateFromProps,(u=typeof r=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(i!==f||h!==c)&&og(t,s,l,c),dl=!1,h=t.memoizedState,s.state=h,si(t,l,s,a),ai();var p=t.memoizedState;i!==f||h!==p||dl||e!==null&&e.dependencies!==null&&Eo(e.dependencies)?(typeof r=="function"&&(ku(t,n,r,l),p=t.memoizedState),(d=dl||rg(t,n,d,l,h,p,c)||e!==null&&e.dependencies!==null&&Eo(e.dependencies))?(u||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(l,p,c),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(l,p,c)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||i===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=p),s.props=l,s.state=p,s.context=c,l=d):(typeof s.componentDidUpdate!="function"||i===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),l=!1)}return s=l,ao(e,t),l=(t.flags&128)!==0,s||l?(s=t.stateNode,n=l&&typeof n.getDerivedStateFromError!="function"?null:s.render(),t.flags|=1,e!==null&&l?(t.child=ra(t,e.child,null,a),t.child=ra(t,null,n,a)):Pe(e,t,n,a),t.memoizedState=s.state,e=t.child):e=Fn(e,t,a),e}function mg(e,t,n,l){return sa(),t.flags|=256,Pe(e,t,n,l),t.child}var Eu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Cu(e){return{baseLanes:e,cachePool:H0()}}function Mu(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Mt),e}function My(e,t,n){var l=t.pendingProps,a=!1,s=(t.flags&128)!==0,i;if((i=s)||(i=e!==null&&e.memoizedState===null?!1:($e.current&2)!==0),i&&(a=!0,t.flags&=-129),i=(t.flags&32)!==0,t.flags&=-33,e===null){if(ue){if(a?pl(t):gl(),(e=Me)?(e=vv(e,Qt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Dl!==null?{id:wn,overflow:Sn}:null,retryLane:536870912,hydrationErrors:null},n=D0(e),n.return=t,t.child=n,tt=t,Me=null)):e=null,e===null)throw zl(t);return Pd(e)?t.lanes=32:t.lanes=536870912,null}var r=l.children;return l=l.fallback,a?(gl(),a=t.mode,r=zo({mode:"hidden",children:r},a),l=Pl(l,a,n,null),r.return=t,l.return=t,r.sibling=l,t.child=r,l=t.child,l.memoizedState=Cu(n),l.childLanes=Mu(e,i,n),t.memoizedState=Eu,Zs(null,l)):(pl(t),Ud(t,r))}var c=e.memoizedState;if(c!==null&&(r=c.dehydrated,r!==null)){if(s)t.flags&256?(pl(t),t.flags&=-257,t=_u(e,t,n)):t.memoizedState!==null?(gl(),t.child=e.child,t.flags|=128,t=null):(gl(),r=l.fallback,a=t.mode,l=zo({mode:"visible",children:l.children},a),r=Pl(r,a,n,null),r.flags|=2,l.return=t,r.return=t,l.sibling=r,t.child=l,ra(t,e.child,null,n),l=t.child,l.memoizedState=Cu(n),l.childLanes=Mu(e,i,n),t.memoizedState=Eu,t=Zs(null,l));else if(pl(t),Pd(r)){if(i=r.nextSibling&&r.nextSibling.dataset,i)var u=i.dgst;i=u,l=Error(Q(419)),l.stack="",l.digest=i,Si({value:l,source:null,stack:null}),t=_u(e,t,n)}else if(Ye||Ns(e,t,n,!1),i=(n&e.childLanes)!==0,Ye||i){if(i=ke,i!==null&&(l=a0(i,n),l!==0&&l!==c.retryLane))throw c.retryLane=l,ya(e,l),bt(i,e,l),dh;Fd(r)||$o(),t=_u(e,t,n)}else Fd(r)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,Me=It(r.nextSibling),tt=t,ue=!0,jl=null,Qt=!1,e!==null&&R0(t,e),t=Ud(t,l.children),t.flags|=4096);return t}return a?(gl(),r=l.fallback,a=t.mode,c=e.child,u=c.sibling,l=Xn(c,{mode:"hidden",children:l.children}),l.subtreeFlags=c.subtreeFlags&65011712,u!==null?r=Xn(u,r):(r=Pl(r,a,n,null),r.flags|=2),r.return=t,l.return=t,l.sibling=r,t.child=l,Zs(null,l),l=t.child,r=e.child.memoizedState,r===null?r=Cu(n):(a=r.cachePool,a!==null?(c=qe._currentValue,a=a.parent!==c?{parent:c,pool:c}:a):a=H0(),r={baseLanes:r.baseLanes|n,cachePool:a}),l.memoizedState=r,l.childLanes=Mu(e,i,n),t.memoizedState=Eu,Zs(e.child,l)):(pl(t),n=e.child,e=n.sibling,n=Xn(n,{mode:"visible",children:l.children}),n.return=t,n.sibling=null,e!==null&&(i=t.deletions,i===null?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=n,t.memoizedState=null,n)}function Ud(e,t){return t=zo({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function zo(e,t){return e=Et(22,e,null,t),e.lanes=0,e}function _u(e,t,n){return ra(t,e.child,null,n),e=Ud(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function xg(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Cd(e.return,t,n)}function Tu(e,t,n,l,a,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:a,treeForkCount:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=l,i.tail=n,i.tailMode=a,i.treeForkCount=s)}function _y(e,t,n){var l=t.pendingProps,a=l.revealOrder,s=l.tail;l=l.children;var i=$e.current,r=(i&2)!==0;if(r?(i=i&1|2,t.flags|=128):i&=1,Ee($e,i),Pe(e,t,l,n),l=ue?wi:0,!r&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&xg(e,n,t);else if(e.tag===19)xg(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(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&_o(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),Tu(t,!1,a,n,s,l);break;case"backwards":case"unstable_legacy-backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&_o(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}Tu(t,!0,n,null,s,l);break;case"together":Tu(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function Fn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ol|=t.lanes,!(n&t.childLanes))if(e!==null){if(Ns(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(Q(153));if(t.child!==null){for(e=t.child,n=Xn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Xn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function fh(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&Eo(e)))}function OS(e,t,n){switch(t.tag){case 3:vo(t,t.stateNode.containerInfo),hl(t,qe,e.memoizedState.cache),sa();break;case 27:case 5:pd(t);break;case 4:vo(t,t.stateNode.containerInfo);break;case 10:hl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,zd(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(pl(t),t.flags|=128,null):n&t.child.childLanes?My(e,t,n):(pl(t),e=Fn(e,t,n),e!==null?e.sibling:null);pl(t);break;case 19:var a=(e.flags&128)!==0;if(l=(n&t.childLanes)!==0,l||(Ns(e,t,n,!1),l=(n&t.childLanes)!==0),a){if(l)return _y(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),Ee($e,$e.current),l)break;return null;case 22:return t.lanes=0,Cy(e,t,n,t.pendingProps);case 24:hl(t,qe,e.memoizedState.cache)}return Fn(e,t,n)}function Ty(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ye=!0;else{if(!fh(e,n)&&!(t.flags&128))return Ye=!1,OS(e,t,n);Ye=!!(e.flags&131072)}else Ye=!1,ue&&t.flags&1048576&&z0(t,wi,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=Ql(t.elementType),t.type=e,typeof e=="function")Xf(e)?(l=ca(e,l),t.tag=1,t=gg(null,t,e,l,n)):(t.tag=0,t=Bd(null,t,e,l,n));else{if(e!=null){var a=e.$$typeof;if(a===Tf){t.tag=11,t=ug(null,t,e,l,n);break e}else if(a===Af){t.tag=14,t=dg(null,t,e,l,n);break e}}throw t=fd(e)||e,Error(Q(306,t,""))}}return t;case 0:return Bd(e,t,t.type,t.pendingProps,n);case 1:return l=t.type,a=ca(l,t.pendingProps),gg(e,t,l,a,n);case 3:e:{if(vo(t,t.stateNode.containerInfo),e===null)throw Error(Q(387));l=t.pendingProps;var s=t.memoizedState;a=s.element,Td(e,t),si(t,l,null,n);var i=t.memoizedState;if(l=i.cache,hl(t,qe,l),l!==s.cache&&Md(t,[qe],n,!0),ai(),l=i.element,s.isDehydrated)if(s={element:l,isDehydrated:!1,cache:i.cache},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){t=mg(e,t,l,n);break e}else if(l!==a){a=Gt(Error(Q(424)),t),Si(a),t=mg(e,t,l,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(Me=It(e.firstChild),tt=t,ue=!0,jl=null,Qt=!0,n=B0(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(sa(),l===a){t=Fn(e,t,n);break e}Pe(e,t,l,n)}t=t.child}return t;case 26:return ao(e,t),e===null?(n=$g(t.type,null,t.pendingProps,null))?t.memoizedState=n:ue||(n=t.type,e=t.pendingProps,l=qo(Nl.current).createElement(n),l[et]=t,l[wt]=e,lt(l,n,e),Je(l),t.stateNode=l):t.memoizedState=$g(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return pd(t),e===null&&ue&&(l=t.stateNode=bv(t.type,t.pendingProps,Nl.current),tt=t,Qt=!0,a=Me,Ll(t.type)?(ef=a,Me=It(l.firstChild)):Me=a),Pe(e,t,t.pendingProps.children,n),ao(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ue&&((a=l=Me)&&(l=dN(l,t.type,t.pendingProps,Qt),l!==null?(t.stateNode=l,tt=t,Me=It(l.firstChild),Qt=!1,a=!0):a=!1),a||zl(t)),pd(t),a=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,l=s.children,Wd(a,s)?l=null:i!==null&&Wd(a,i)&&(t.flags|=32),t.memoizedState!==null&&(a=Pf(e,t,ES,null,null,n),Mi._currentValue=a),ao(e,t),Pe(e,t,l,n),t.child;case 6:return e===null&&ue&&((e=n=Me)&&(n=fN(n,t.pendingProps,Qt),n!==null?(t.stateNode=n,tt=t,Me=null,e=!0):e=!1),e||zl(t)),null;case 13:return My(e,t,n);case 4:return vo(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=ra(t,null,l,n):Pe(e,t,l,n),t.child;case 11:return ug(e,t,t.type,t.pendingProps,n);case 7:return Pe(e,t,t.pendingProps,n),t.child;case 8:return Pe(e,t,t.pendingProps.children,n),t.child;case 12:return Pe(e,t,t.pendingProps.children,n),t.child;case 10:return l=t.pendingProps,hl(t,t.type,l.value),Pe(e,t,l.children,n),t.child;case 9:return a=t.type._context,l=t.pendingProps.children,ia(t),a=nt(a),l=l(a),t.flags|=1,Pe(e,t,l,n),t.child;case 14:return dg(e,t,t.type,t.pendingProps,n);case 15:return Ey(e,t,t.type,t.pendingProps,n);case 19:return _y(e,t,n);case 31:return RS(e,t,n);case 22:return Cy(e,t,n,t.pendingProps);case 24:return ia(t),l=nt(qe),e===null?(a=If(),a===null&&(a=ke,s=Zf(),a.pooledCache=s,s.refCount++,s!==null&&(a.pooledCacheLanes|=n),a=s),t.memoizedState={parent:l,cache:a},Wf(t),hl(t,qe,a)):(e.lanes&n&&(Td(e,t),si(t,null,null,n),ai()),a=e.memoizedState,s=t.memoizedState,a.parent!==l?(a={parent:l,cache:l},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),hl(t,qe,l)):(l=s.cache,hl(t,qe,l),l!==a.cache&&Md(t,[qe],n,!0))),Pe(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(Q(156,t.tag))}function zn(e){e.flags|=4}function Au(e,t,n,l,a){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(a&335544128)===a)if(e.stateNode.complete)e.flags|=8192;else if(ev())e.flags|=8192;else throw ta=Co,Kf}else e.flags&=-16777217}function yg(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Nv(t))if(ev())e.flags|=8192;else throw ta=Co,Kf}function Er(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?t0():536870912,e.lanes|=t,is|=t)}function Ls(e,t){if(!ue)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 l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function Ce(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,l=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,l|=a.subtreeFlags&65011712,l|=a.flags&65011712,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,l|=a.subtreeFlags,l|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=l,e.childLanes=n,t}function HS(e,t,n){var l=t.pendingProps;switch(Qf(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ce(t),null;case 1:return Ce(t),null;case 3:return n=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Gn(qe),es(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Sa(t)?zn(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Su())),Ce(t),null;case 26:var a=t.type,s=t.memoizedState;return e===null?(zn(t),s!==null?(Ce(t),yg(t,s)):(Ce(t),Au(t,a,null,l,n))):s?s!==e.memoizedState?(zn(t),Ce(t),yg(t,s)):(Ce(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&zn(t),Ce(t),Au(t,a,e,l,n)),null;case 27:if(bo(t),n=Nl.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&zn(t);else{if(!l){if(t.stateNode===null)throw Error(Q(166));return Ce(t),null}e=jn.current,Sa(t)?Zp(t):(e=bv(a,l,n),t.stateNode=e,zn(t))}return Ce(t),null;case 5:if(bo(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&zn(t);else{if(!l){if(t.stateNode===null)throw Error(Q(166));return Ce(t),null}if(s=jn.current,Sa(t))Zp(t);else{var i=qo(Nl.current);switch(s){case 1:s=i.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:s=i.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":s=i.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":s=i.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":s=i.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof l.is=="string"?i.createElement("select",{is:l.is}):i.createElement("select"),l.multiple?s.multiple=!0:l.size&&(s.size=l.size);break;default:s=typeof l.is=="string"?i.createElement(a,{is:l.is}):i.createElement(a)}}s[et]=t,s[wt]=l;e:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)s.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;i.sibling===null;){if(i.return===null||i.return===t)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=s;e:switch(lt(s,a,l),a){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&zn(t)}}return Ce(t),Au(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&zn(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(Q(166));if(e=Nl.current,Sa(t)){if(e=t.stateNode,n=t.memoizedProps,l=null,a=tt,a!==null)switch(a.tag){case 27:case 5:l=a.memoizedProps}e[et]=t,e=!!(e.nodeValue===n||l!==null&&l.suppressHydrationWarning===!0||mv(e.nodeValue,n)),e||zl(t,!0)}else e=qo(e).createTextNode(l),e[et]=t,t.stateNode=e}return Ce(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(l=Sa(t),n!==null){if(e===null){if(!l)throw Error(Q(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Q(557));e[et]=t}else sa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ce(t),e=!1}else n=Su(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(kt(t),t):(kt(t),null);if(t.flags&128)throw Error(Q(558))}return Ce(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Sa(t),l!==null&&l.dehydrated!==null){if(e===null){if(!a)throw Error(Q(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(Q(317));a[et]=t}else sa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ce(t),a=!1}else a=Su(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(kt(t),t):(kt(t),null)}return kt(t),t.flags&128?(t.lanes=n,t):(n=l!==null,e=e!==null&&e.memoizedState!==null,n&&(l=t.child,a=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(a=l.alternate.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==a&&(l.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Er(t,t.updateQueue),Ce(t),null);case 4:return es(),e===null&&vh(t.stateNode.containerInfo),Ce(t),null;case 10:return Gn(t.type),Ce(t),null;case 19:if(Fe($e),l=t.memoizedState,l===null)return Ce(t),null;if(a=(t.flags&128)!==0,s=l.rendering,s===null)if(a)Ls(l,!1);else{if(He!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=_o(e),s!==null){for(t.flags|=128,Ls(l,!1),e=s.updateQueue,t.updateQueue=e,Er(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)A0(n,e),n=n.sibling;return Ee($e,$e.current&1|2),ue&&Ln(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&_t()>Oo&&(t.flags|=128,a=!0,Ls(l,!1),t.lanes=4194304)}else{if(!a)if(e=_o(s),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Er(t,e),Ls(l,!0),l.tail===null&&l.tailMode==="hidden"&&!s.alternate&&!ue)return Ce(t),null}else 2*_t()-l.renderingStartTime>Oo&&n!==536870912&&(t.flags|=128,a=!0,Ls(l,!1),t.lanes=4194304);l.isBackwards?(s.sibling=t.child,t.child=s):(e=l.last,e!==null?e.sibling=s:t.child=s,l.last=s)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=_t(),e.sibling=null,n=$e.current,Ee($e,a?n&1|2:n&1),ue&&Ln(t,l.treeForkCount),e):(Ce(t),null);case 22:case 23:return kt(t),Jf(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?n&536870912&&!(t.flags&128)&&(Ce(t),t.subtreeFlags&6&&(t.flags|=8192)):Ce(t),n=t.updateQueue,n!==null&&Er(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==n&&(t.flags|=2048),e!==null&&Fe(ea),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Gn(qe),Ce(t),null;case 25:return null;case 30:return null}throw Error(Q(156,t.tag))}function $S(e,t){switch(Qf(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Gn(qe),es(),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(kt(t),t.alternate===null)throw Error(Q(340));sa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(kt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));sa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Fe($e),null;case 4:return es(),null;case 10:return Gn(t.type),null;case 22:case 23:return kt(t),Jf(),e!==null&&Fe(ea),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Gn(qe),null;case 25:return null;default:return null}}function Ay(e,t){switch(Qf(t),t.tag){case 3:Gn(qe),es();break;case 26:case 27:case 5:bo(t);break;case 4:es();break;case 31:t.memoizedState!==null&&kt(t);break;case 13:kt(t);break;case 19:Fe($e);break;case 10:Gn(t.type);break;case 22:case 23:kt(t),Jf(),e!==null&&Fe(ea);break;case 24:Gn(qe)}}function Ji(e,t){try{var n=t.updateQueue,l=n!==null?n.lastEffect:null;if(l!==null){var a=l.next;n=a;do{if((n.tag&e)===e){l=void 0;var s=n.create,i=n.inst;l=s(),i.destroy=l}n=n.next}while(n!==a)}}catch(r){we(t,t.return,r)}}function Rl(e,t,n){try{var l=t.updateQueue,a=l!==null?l.lastEffect:null;if(a!==null){var s=a.next;l=s;do{if((l.tag&e)===e){var i=l.inst,r=i.destroy;if(r!==void 0){i.destroy=void 0,a=t;var c=n,u=r;try{u()}catch(d){we(a,c,d)}}}l=l.next}while(l!==s)}}catch(d){we(t,t.return,d)}}function Dy(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{q0(t,n)}catch(l){we(e,e.return,l)}}}function zy(e,t,n){n.props=ca(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){we(e,t,l)}}function ri(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof n=="function"?e.refCleanup=n(l):n.current=l}}catch(a){we(e,t,a)}}function Nn(e,t){var n=e.ref,l=e.refCleanup;if(n!==null)if(typeof l=="function")try{l()}catch(a){we(e,t,a)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(a){we(e,t,a)}else n.current=null}function Ry(e){var t=e.type,n=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&l.focus();break e;case"img":n.src?l.src=n.src:n.srcSet&&(l.srcset=n.srcSet)}}catch(a){we(e,e.return,a)}}function Du(e,t,n){try{var l=e.stateNode;sN(l,e.type,n,t),l[wt]=t}catch(a){we(e,e.return,a)}}function Oy(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ll(e.type)||e.tag===4}function zu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Oy(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&&Ll(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 qd(e,t,n){var l=e.tag;if(l===5||l===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=qn));else if(l!==4&&(l===27&&Ll(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(qd(e,t,n),e=e.sibling;e!==null;)qd(e,t,n),e=e.sibling}function Ro(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(l!==4&&(l===27&&Ll(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Ro(e,t,n),e=e.sibling;e!==null;)Ro(e,t,n),e=e.sibling}function Hy(e){var t=e.stateNode,n=e.memoizedProps;try{for(var l=e.type,a=t.attributes;a.length;)t.removeAttributeNode(a[0]);lt(t,l,n),t[et]=e,t[wt]=n}catch(s){we(e,e.return,s)}}var Bn=!1,Ue=!1,Ru=!1,vg=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function LS(e,t){if(e=e.containerInfo,Id=Go,e=N0(e),qf(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var l=n.getSelection&&n.getSelection();if(l&&l.rangeCount!==0){n=l.anchorNode;var a=l.anchorOffset,s=l.focusNode;l=l.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var i=0,r=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||a!==0&&f.nodeType!==3||(r=i+a),f!==s||l!==0&&f.nodeType!==3||(c=i+l),f.nodeType===3&&(i+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===a&&(r=i),h===s&&++d===l&&(c=i),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=r===-1||c===-1?null:{start:r,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Kd={focusedElem:e,selectionRange:n},Go=!1,Ke=t;Ke!==null;)if(t=Ke,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ke=e;else for(;Ke!==null;){switch(t=Ke,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++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&s!==null){e=void 0,n=t,a=s.memoizedProps,s=s.memoizedState,l=n.stateNode;try{var x=ca(n.type,a);e=l.getSnapshotBeforeUpdate(x,s),l.__reactInternalSnapshotBeforeUpdate=e}catch(S){we(n,n.return,S)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Jd(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Jd(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(Q(163))}if(e=t.sibling,e!==null){e.return=t.return,Ke=e;break}Ke=t.return}}function $y(e,t,n){var l=n.flags;switch(n.tag){case 0:case 11:case 15:On(e,n),l&4&&Ji(5,n);break;case 1:if(On(e,n),l&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(i){we(n,n.return,i)}else{var a=ca(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(a,t,e.__reactInternalSnapshotBeforeUpdate)}catch(i){we(n,n.return,i)}}l&64&&Dy(n),l&512&&ri(n,n.return);break;case 3:if(On(e,n),l&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{q0(e,t)}catch(i){we(n,n.return,i)}}break;case 27:t===null&&l&4&&Hy(n);case 26:case 5:On(e,n),t===null&&l&4&&Ry(n),l&512&&ri(n,n.return);break;case 12:On(e,n);break;case 31:On(e,n),l&4&&Uy(e,n);break;case 13:On(e,n),l&4&&qy(e,n),l&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=ZS.bind(null,n),hN(e,n))));break;case 22:if(l=n.memoizedState!==null||Bn,!l){t=t!==null&&t.memoizedState!==null||Ue,a=Bn;var s=Ue;Bn=l,(Ue=t)&&!s?$n(e,n,(n.subtreeFlags&8772)!==0):On(e,n),Bn=a,Ue=s}break;case 30:break;default:On(e,n)}}function Ly(e){var t=e.alternate;t!==null&&(e.alternate=null,Ly(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Of(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 De=null,mt=!1;function Rn(e,t,n){for(n=n.child;n!==null;)By(e,t,n),n=n.sibling}function By(e,t,n){if(Tt&&typeof Tt.onCommitFiberUnmount=="function")try{Tt.onCommitFiberUnmount(Xi,n)}catch{}switch(n.tag){case 26:Ue||Nn(n,t),Rn(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Ue||Nn(n,t);var l=De,a=mt;Ll(n.type)&&(De=n.stateNode,mt=!1),Rn(e,t,n),di(n.stateNode),De=l,mt=a;break;case 5:Ue||Nn(n,t);case 6:if(l=De,a=mt,De=null,Rn(e,t,n),De=l,mt=a,De!==null)if(mt)try{(De.nodeType===9?De.body:De.nodeName==="HTML"?De.ownerDocument.body:De).removeChild(n.stateNode)}catch(s){we(n,t,s)}else try{De.removeChild(n.stateNode)}catch(s){we(n,t,s)}break;case 18:De!==null&&(mt?(e=De,Dg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),us(e)):Dg(De,n.stateNode));break;case 4:l=De,a=mt,De=n.stateNode.containerInfo,mt=!0,Rn(e,t,n),De=l,mt=a;break;case 0:case 11:case 14:case 15:Rl(2,n,t),Ue||Rl(4,n,t),Rn(e,t,n);break;case 1:Ue||(Nn(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"&&zy(n,t,l)),Rn(e,t,n);break;case 21:Rn(e,t,n);break;case 22:Ue=(l=Ue)||n.memoizedState!==null,Rn(e,t,n),Ue=l;break;default:Rn(e,t,n)}}function Uy(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{us(e)}catch(n){we(t,t.return,n)}}}function qy(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{us(e)}catch(n){we(t,t.return,n)}}function BS(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new vg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new vg),t;default:throw Error(Q(435,e.tag))}}function Cr(e,t){var n=BS(e);t.forEach(function(l){if(!n.has(l)){n.add(l);var a=IS.bind(null,e,l);l.then(a,a)}})}function pt(e,t){var n=t.deletions;if(n!==null)for(var l=0;l<n.length;l++){var a=n[l],s=e,i=t,r=i;e:for(;r!==null;){switch(r.tag){case 27:if(Ll(r.type)){De=r.stateNode,mt=!1;break e}break;case 5:De=r.stateNode,mt=!1;break e;case 3:case 4:De=r.stateNode.containerInfo,mt=!0;break e}r=r.return}if(De===null)throw Error(Q(160));By(s,i,a),De=null,mt=!1,s=a.alternate,s!==null&&(s.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Yy(t,e),t=t.sibling}var en=null;function Yy(e,t){var n=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:pt(t,e),gt(e),l&4&&(Rl(3,e,e.return),Ji(3,e),Rl(5,e,e.return));break;case 1:pt(t,e),gt(e),l&512&&(Ue||n===null||Nn(n,n.return)),l&64&&Bn&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?l:n.concat(l))));break;case 26:var a=en;if(pt(t,e),gt(e),l&512&&(Ue||n===null||Nn(n,n.return)),l&4){var s=n!==null?n.memoizedState:null;if(l=e.memoizedState,n===null)if(l===null)if(e.stateNode===null){e:{l=e.type,n=e.memoizedProps,a=a.ownerDocument||a;t:switch(l){case"title":s=a.getElementsByTagName("title")[0],(!s||s[Zi]||s[et]||s.namespaceURI==="http://www.w3.org/2000/svg"||s.hasAttribute("itemprop"))&&(s=a.createElement(l),a.head.insertBefore(s,a.querySelector("head > title"))),lt(s,l,n),s[et]=e,Je(s),l=s;break e;case"link":var i=Bg("link","href",a).get(l+(n.href||""));if(i){for(var r=0;r<i.length;r++)if(s=i[r],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)){i.splice(r,1);break t}}s=a.createElement(l),lt(s,l,n),a.head.appendChild(s);break;case"meta":if(i=Bg("meta","content",a).get(l+(n.content||""))){for(r=0;r<i.length;r++)if(s=i[r],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)){i.splice(r,1);break t}}s=a.createElement(l),lt(s,l,n),a.head.appendChild(s);break;default:throw Error(Q(468,l))}s[et]=e,Je(s),l=s}e.stateNode=l}else Ug(a,e.type,e.stateNode);else e.stateNode=Lg(a,l,e.memoizedProps);else s!==l?(s===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):s.count--,l===null?Ug(a,e.type,e.stateNode):Lg(a,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Du(e,e.memoizedProps,n.memoizedProps)}break;case 27:pt(t,e),gt(e),l&512&&(Ue||n===null||Nn(n,n.return)),n!==null&&l&4&&Du(e,e.memoizedProps,n.memoizedProps);break;case 5:if(pt(t,e),gt(e),l&512&&(Ue||n===null||Nn(n,n.return)),e.flags&32){a=e.stateNode;try{ns(a,"")}catch(x){we(e,e.return,x)}}l&4&&e.stateNode!=null&&(a=e.memoizedProps,Du(e,a,n!==null?n.memoizedProps:a)),l&1024&&(Ru=!0);break;case 6:if(pt(t,e),gt(e),l&4){if(e.stateNode===null)throw Error(Q(162));l=e.memoizedProps,n=e.stateNode;try{n.nodeValue=l}catch(x){we(e,e.return,x)}}break;case 3:if(ro=null,a=en,en=Yo(t.containerInfo),pt(t,e),en=a,gt(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{us(t.containerInfo)}catch(x){we(e,e.return,x)}Ru&&(Ru=!1,Vy(e));break;case 4:l=en,en=Yo(e.stateNode.containerInfo),pt(t,e),gt(e),en=l;break;case 12:pt(t,e),gt(e);break;case 31:pt(t,e),gt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Cr(e,l)));break;case 13:pt(t,e),gt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(_c=_t()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Cr(e,l)));break;case 22:a=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,u=Bn,d=Ue;if(Bn=u||a,Ue=d||c,pt(t,e),Ue=d,Bn=u,gt(e),l&8192)e:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||c||Bn||Ue||Zl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){c=n=t;try{if(s=c.stateNode,a)i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none";else{r=c.stateNode;var f=c.memoizedProps.style,h=f!=null&&f.hasOwnProperty("display")?f.display:null;r.style.display=h==null||typeof h=="boolean"?"":(""+h).trim()}}catch(x){we(c,c.return,x)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=a?"":c.memoizedProps}catch(x){we(c,c.return,x)}}}else if(t.tag===18){if(n===null){c=t;try{var p=c.stateNode;a?zg(p,!0):zg(c.stateNode,!1)}catch(x){we(c,c.return,x)}}}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}l&4&&(l=e.updateQueue,l!==null&&(n=l.retryQueue,n!==null&&(l.retryQueue=null,Cr(e,n))));break;case 19:pt(t,e),gt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Cr(e,l)));break;case 30:break;case 21:break;default:pt(t,e),gt(e)}}function gt(e){var t=e.flags;if(t&2){try{for(var n,l=e.return;l!==null;){if(Oy(l)){n=l;break}l=l.return}if(n==null)throw Error(Q(160));switch(n.tag){case 27:var a=n.stateNode,s=zu(e);Ro(e,s,a);break;case 5:var i=n.stateNode;n.flags&32&&(ns(i,""),n.flags&=-33);var r=zu(e);Ro(e,r,i);break;case 3:case 4:var c=n.stateNode.containerInfo,u=zu(e);qd(e,u,c);break;default:throw Error(Q(161))}}catch(d){we(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Vy(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Vy(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function On(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)$y(e,t.alternate,t),t=t.sibling}function Zl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Rl(4,t,t.return),Zl(t);break;case 1:Nn(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&zy(t,t.return,n),Zl(t);break;case 27:di(t.stateNode);case 26:case 5:Nn(t,t.return),Zl(t);break;case 22:t.memoizedState===null&&Zl(t);break;case 30:Zl(t);break;default:Zl(t)}e=e.sibling}}function $n(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,a=e,s=t,i=s.flags;switch(s.tag){case 0:case 11:case 15:$n(a,s,n),Ji(4,s);break;case 1:if($n(a,s,n),l=s,a=l.stateNode,typeof a.componentDidMount=="function")try{a.componentDidMount()}catch(u){we(l,l.return,u)}if(l=s,a=l.updateQueue,a!==null){var r=l.stateNode;try{var c=a.shared.hiddenCallbacks;if(c!==null)for(a.shared.hiddenCallbacks=null,a=0;a<c.length;a++)U0(c[a],r)}catch(u){we(l,l.return,u)}}n&&i&64&&Dy(s),ri(s,s.return);break;case 27:Hy(s);case 26:case 5:$n(a,s,n),n&&l===null&&i&4&&Ry(s),ri(s,s.return);break;case 12:$n(a,s,n);break;case 31:$n(a,s,n),n&&i&4&&Uy(a,s);break;case 13:$n(a,s,n),n&&i&4&&qy(a,s);break;case 22:s.memoizedState===null&&$n(a,s,n),ri(s,s.return);break;case 30:break;default:$n(a,s,n)}t=t.sibling}}function hh(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&&Ki(n))}function ph(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ki(e))}function Pt(e,t,n,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Xy(e,t,n,l),t=t.sibling}function Xy(e,t,n,l){var a=t.flags;switch(t.tag){case 0:case 11:case 15:Pt(e,t,n,l),a&2048&&Ji(9,t);break;case 1:Pt(e,t,n,l);break;case 3:Pt(e,t,n,l),a&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ki(e)));break;case 12:if(a&2048){Pt(e,t,n,l),e=t.stateNode;try{var s=t.memoizedProps,i=s.id,r=s.onPostCommit;typeof r=="function"&&r(i,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){we(t,t.return,c)}}else Pt(e,t,n,l);break;case 31:Pt(e,t,n,l);break;case 13:Pt(e,t,n,l);break;case 23:break;case 22:s=t.stateNode,i=t.alternate,t.memoizedState!==null?s._visibility&2?Pt(e,t,n,l):oi(e,t):s._visibility&2?Pt(e,t,n,l):(s._visibility|=2,Ca(e,t,n,l,(t.subtreeFlags&10256)!==0||!1)),a&2048&&hh(i,t);break;case 24:Pt(e,t,n,l),a&2048&&ph(t.alternate,t);break;default:Pt(e,t,n,l)}}function Ca(e,t,n,l,a){for(a=a&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var s=e,i=t,r=n,c=l,u=i.flags;switch(i.tag){case 0:case 11:case 15:Ca(s,i,r,c,a),Ji(8,i);break;case 23:break;case 22:var d=i.stateNode;i.memoizedState!==null?d._visibility&2?Ca(s,i,r,c,a):oi(s,i):(d._visibility|=2,Ca(s,i,r,c,a)),a&&u&2048&&hh(i.alternate,i);break;case 24:Ca(s,i,r,c,a),a&&u&2048&&ph(i.alternate,i);break;default:Ca(s,i,r,c,a)}t=t.sibling}}function oi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,l=t,a=l.flags;switch(l.tag){case 22:oi(n,l),a&2048&&hh(l.alternate,l);break;case 24:oi(n,l),a&2048&&ph(l.alternate,l);break;default:oi(n,l)}t=t.sibling}}var Is=8192;function Na(e,t,n){if(e.subtreeFlags&Is)for(e=e.child;e!==null;)Gy(e,t,n),e=e.sibling}function Gy(e,t,n){switch(e.tag){case 26:Na(e,t,n),e.flags&Is&&e.memoizedState!==null&&kN(n,en,e.memoizedState,e.memoizedProps);break;case 5:Na(e,t,n);break;case 3:case 4:var l=en;en=Yo(e.stateNode.containerInfo),Na(e,t,n),en=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Is,Is=16777216,Na(e,t,n),Is=l):Na(e,t,n));break;default:Na(e,t,n)}}function Qy(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 Bs(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var l=t[n];Ke=l,Iy(l,e)}Qy(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Zy(e),e=e.sibling}function Zy(e){switch(e.tag){case 0:case 11:case 15:Bs(e),e.flags&2048&&Rl(9,e,e.return);break;case 3:Bs(e);break;case 12:Bs(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,so(e)):Bs(e);break;default:Bs(e)}}function so(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var l=t[n];Ke=l,Iy(l,e)}Qy(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Rl(8,t,t.return),so(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,so(t));break;default:so(t)}e=e.sibling}}function Iy(e,t){for(;Ke!==null;){var n=Ke;switch(n.tag){case 0:case 11:case 15:Rl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var l=n.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Ki(n.memoizedState.cache)}if(l=n.child,l!==null)l.return=n,Ke=l;else e:for(n=e;Ke!==null;){l=Ke;var a=l.sibling,s=l.return;if(Ly(l),l===n){Ke=null;break e}if(a!==null){a.return=s,Ke=a;break e}Ke=s}}}var US={getCacheForType:function(e){var t=nt(qe),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return nt(qe).controller.signal}},qS=typeof WeakMap=="function"?WeakMap:Map,ge=0,ke=null,oe=null,ce=0,be=0,jt=null,bl=!1,ks=!1,gh=!1,Pn=0,He=0,Ol=0,na=0,mh=0,Mt=0,is=0,ci=null,xt=null,Yd=!1,_c=0,Ky=0,Oo=1/0,Ho=null,Cl=null,Qe=0,Ml=null,rs=null,Qn=0,Vd=0,Xd=null,Wy=null,ui=0,Gd=null;function Dt(){return ge&2&&ce!==0?ce&-ce:le.T!==null?yh():s0()}function Jy(){if(Mt===0)if(!(ce&536870912)||ue){var e=vr;vr<<=1,!(vr&3932160)&&(vr=262144),Mt=e}else Mt=536870912;return e=Rt.current,e!==null&&(e.flags|=32),Mt}function bt(e,t,n){(e===ke&&(be===2||be===9)||e.cancelPendingCommit!==null)&&(os(e,0),wl(e,ce,Mt,!1)),Qi(e,n),(!(ge&2)||e!==ke)&&(e===ke&&(!(ge&2)&&(na|=n),He===4&&wl(e,ce,Mt,!1)),Mn(e))}function Fy(e,t,n){if(ge&6)throw Error(Q(327));var l=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Gi(e,t),a=l?XS(e,t):Ou(e,t,!0),s=l;do{if(a===0){ks&&!l&&wl(e,t,0,!1);break}else{if(n=e.current.alternate,s&&!YS(n)){a=Ou(e,t,!1),s=!1;continue}if(a===2){if(s=t,e.errorRecoveryDisabledLanes&s)var i=0;else i=e.pendingLanes&-536870913,i=i!==0?i:i&536870912?536870912:0;if(i!==0){t=i;e:{var r=e;a=ci;var c=r.current.memoizedState.isDehydrated;if(c&&(os(r,i).flags|=256),i=Ou(r,i,!1),i!==2){if(gh&&!c){r.errorRecoveryDisabledLanes|=s,na|=s,a=4;break e}s=xt,xt=a,s!==null&&(xt===null?xt=s:xt.push.apply(xt,s))}a=i}if(s=!1,a!==2)continue}}if(a===1){os(e,0),wl(e,t,0,!0);break}e:{switch(l=e,s=a,s){case 0:case 1:throw Error(Q(345));case 4:if((t&4194048)!==t)break;case 6:wl(l,t,Mt,!bl);break e;case 2:xt=null;break;case 3:case 5:break;default:throw Error(Q(329))}if((t&62914560)===t&&(a=_c+300-_t(),10<a)){if(wl(l,t,Mt,!bl),yc(l,0,!0)!==0)break e;Qn=t,l.timeoutHandle=yv(bg.bind(null,l,n,xt,Ho,Yd,t,Mt,na,is,bl,s,"Throttled",-0,0),a);break e}bg(l,n,xt,Ho,Yd,t,Mt,na,is,bl,s,null,-0,0)}}break}while(!0);Mn(e)}function bg(e,t,n,l,a,s,i,r,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:qn},Gy(t,s,f);var x=(s&62914560)===s?_c-_t():(s&4194048)===s?Ky-_t():0;if(x=EN(f,x),x!==null){Qn=s,e.cancelPendingCommit=x(Sg.bind(null,e,t,s,n,l,a,i,r,c,d,f,null,h,p)),wl(e,s,i,!u);return}}Sg(e,t,s,n,l,a,i,r,c)}function YS(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 l=0;l<n.length;l++){var a=n[l],s=a.getSnapshot;a=a.value;try{if(!zt(s(),a))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 wl(e,t,n,l){t&=~mh,t&=~na,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var a=t;0<a;){var s=31-At(a),i=1<<s;l[s]=-1,a&=~i}n!==0&&n0(e,n,t)}function Tc(){return ge&6?!0:(Fi(0),!1)}function xh(){if(oe!==null){if(be===0)var e=oe.return;else e=oe,Yn=va=null,nh(e),Ia=null,Ni=0,e=oe;for(;e!==null;)Ay(e.alternate,e),e=e.return;oe=null}}function os(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,oN(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Qn=0,xh(),ke=e,oe=n=Xn(e.current,null),ce=t,be=0,jt=null,bl=!1,ks=Gi(e,t),gh=!1,is=Mt=mh=na=Ol=He=0,xt=ci=null,Yd=!1,t&8&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var a=31-At(l),s=1<<a;t|=e[a],l&=~s}return Pn=t,Sc(),n}function Py(e,t){ie=null,le.H=ki,t===js||t===jc?(t=Fp(),be=3):t===Kf?(t=Fp(),be=4):be=t===dh?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,jt=t,oe===null&&(He=1,Do(e,Gt(t,e.current)))}function ev(){var e=Rt.current;return e===null?!0:(ce&4194048)===ce?Zt===null:(ce&62914560)===ce||ce&536870912?e===Zt:!1}function tv(){var e=le.H;return le.H=ki,e===null?ki:e}function nv(){var e=le.A;return le.A=US,e}function $o(){He=4,bl||(ce&4194048)!==ce&&Rt.current!==null||(ks=!0),!(Ol&134217727)&&!(na&134217727)||ke===null||wl(ke,ce,Mt,!1)}function Ou(e,t,n){var l=ge;ge|=2;var a=tv(),s=nv();(ke!==e||ce!==t)&&(Ho=null,os(e,t)),t=!1;var i=He;e:do try{if(be!==0&&oe!==null){var r=oe,c=jt;switch(be){case 8:xh(),i=6;break e;case 3:case 2:case 9:case 6:Rt.current===null&&(t=!0);var u=be;if(be=0,jt=null,Ua(e,r,c,u),n&&ks){i=0;break e}break;default:u=be,be=0,jt=null,Ua(e,r,c,u)}}VS(),i=He;break}catch(d){Py(e,d)}while(!0);return t&&e.shellSuspendCounter++,Yn=va=null,ge=l,le.H=a,le.A=s,oe===null&&(ke=null,ce=0,Sc()),i}function VS(){for(;oe!==null;)lv(oe)}function XS(e,t){var n=ge;ge|=2;var l=tv(),a=nv();ke!==e||ce!==t?(Ho=null,Oo=_t()+500,os(e,t)):ks=Gi(e,t);e:do try{if(be!==0&&oe!==null){t=oe;var s=jt;t:switch(be){case 1:be=0,jt=null,Ua(e,t,s,1);break;case 2:case 9:if(Jp(s)){be=0,jt=null,wg(t);break}t=function(){be!==2&&be!==9||ke!==e||(be=7),Mn(e)},s.then(t,t);break e;case 3:be=7;break e;case 4:be=5;break e;case 7:Jp(s)?(be=0,jt=null,wg(t)):(be=0,jt=null,Ua(e,t,s,7));break;case 5:var i=null;switch(oe.tag){case 26:i=oe.memoizedState;case 5:case 27:var r=oe;if(i?Nv(i):r.stateNode.complete){be=0,jt=null;var c=r.sibling;if(c!==null)oe=c;else{var u=r.return;u!==null?(oe=u,Ac(u)):oe=null}break t}}be=0,jt=null,Ua(e,t,s,5);break;case 6:be=0,jt=null,Ua(e,t,s,6);break;case 8:xh(),He=6;break e;default:throw Error(Q(462))}}GS();break}catch(d){Py(e,d)}while(!0);return Yn=va=null,le.H=l,le.A=a,ge=n,oe!==null?0:(ke=null,ce=0,Sc(),He)}function GS(){for(;oe!==null&&!pw();)lv(oe)}function lv(e){var t=Ty(e.alternate,e,Pn);e.memoizedProps=e.pendingProps,t===null?Ac(e):oe=t}function wg(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=pg(n,t,t.pendingProps,t.type,void 0,ce);break;case 11:t=pg(n,t,t.pendingProps,t.type.render,t.ref,ce);break;case 5:nh(t);default:Ay(n,t),t=oe=A0(t,Pn),t=Ty(n,t,Pn)}e.memoizedProps=e.pendingProps,t===null?Ac(e):oe=t}function Ua(e,t,n,l){Yn=va=null,nh(t),Ia=null,Ni=0;var a=t.return;try{if(zS(e,a,t,n,ce)){He=1,Do(e,Gt(n,e.current)),oe=null;return}}catch(s){if(a!==null)throw oe=a,s;He=1,Do(e,Gt(n,e.current)),oe=null;return}t.flags&32768?(ue||l===1?e=!0:ks||ce&536870912?e=!1:(bl=e=!0,(l===2||l===9||l===3||l===6)&&(l=Rt.current,l!==null&&l.tag===13&&(l.flags|=16384))),av(t,e)):Ac(t)}function Ac(e){var t=e;do{if(t.flags&32768){av(t,bl);return}e=t.return;var n=HS(t.alternate,t,Pn);if(n!==null){oe=n;return}if(t=t.sibling,t!==null){oe=t;return}oe=t=e}while(t!==null);He===0&&(He=5)}function av(e,t){do{var n=$S(e.alternate,e);if(n!==null){n.flags&=32767,oe=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){oe=e;return}oe=e=n}while(e!==null);He=6,oe=null}function Sg(e,t,n,l,a,s,i,r,c){e.cancelPendingCommit=null;do Dc();while(Qe!==0);if(ge&6)throw Error(Q(327));if(t!==null){if(t===e.current)throw Error(Q(177));if(s=t.lanes|t.childLanes,s|=Yf,jw(e,n,s,i,r,c),e===ke&&(oe=ke=null,ce=0),rs=t,Ml=e,Qn=n,Vd=s,Xd=a,Wy=l,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,KS(wo,function(){return cv(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,t.subtreeFlags&13878||l){l=le.T,le.T=null,a=me.p,me.p=2,i=ge,ge|=4;try{LS(e,t,n)}finally{ge=i,me.p=a,le.T=l}}Qe=1,sv(),iv(),rv()}}function sv(){if(Qe===1){Qe=0;var e=Ml,t=rs,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=le.T,le.T=null;var l=me.p;me.p=2;var a=ge;ge|=4;try{Yy(t,e);var s=Kd,i=N0(e.containerInfo),r=s.focusedElem,c=s.selectionRange;if(i!==r&&r&&r.ownerDocument&&S0(r.ownerDocument.documentElement,r)){if(c!==null&&qf(r)){var u=c.start,d=c.end;if(d===void 0&&(d=u),"selectionStart"in r)r.selectionStart=u,r.selectionEnd=Math.min(d,r.value.length);else{var f=r.ownerDocument||document,h=f&&f.defaultView||window;if(h.getSelection){var p=h.getSelection(),x=r.textContent.length,S=Math.min(c.start,x),w=c.end===void 0?S:Math.min(c.end,x);!p.extend&&S>w&&(i=w,w=S,S=i);var g=Xp(r,S),y=Xp(r,w);if(g&&y&&(p.rangeCount!==1||p.anchorNode!==g.node||p.anchorOffset!==g.offset||p.focusNode!==y.node||p.focusOffset!==y.offset)){var m=f.createRange();m.setStart(g.node,g.offset),p.removeAllRanges(),S>w?(p.addRange(m),p.extend(y.node,y.offset)):(m.setEnd(y.node,y.offset),p.addRange(m))}}}}for(f=[],p=r;p=p.parentNode;)p.nodeType===1&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<f.length;r++){var v=f[r];v.element.scrollLeft=v.left,v.element.scrollTop=v.top}}Go=!!Id,Kd=Id=null}finally{ge=a,me.p=l,le.T=n}}e.current=t,Qe=2}}function iv(){if(Qe===2){Qe=0;var e=Ml,t=rs,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=le.T,le.T=null;var l=me.p;me.p=2;var a=ge;ge|=4;try{$y(e,t.alternate,t)}finally{ge=a,me.p=l,le.T=n}}Qe=3}}function rv(){if(Qe===4||Qe===3){Qe=0,gw();var e=Ml,t=rs,n=Qn,l=Wy;t.subtreeFlags&10256||t.flags&10256?Qe=5:(Qe=0,rs=Ml=null,ov(e,e.pendingLanes));var a=e.pendingLanes;if(a===0&&(Cl=null),Rf(n),t=t.stateNode,Tt&&typeof Tt.onCommitFiberRoot=="function")try{Tt.onCommitFiberRoot(Xi,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=le.T,a=me.p,me.p=2,le.T=null;try{for(var s=e.onRecoverableError,i=0;i<l.length;i++){var r=l[i];s(r.value,{componentStack:r.stack})}}finally{le.T=t,me.p=a}}Qn&3&&Dc(),Mn(e),a=e.pendingLanes,n&261930&&a&42?e===Gd?ui++:(ui=0,Gd=e):ui=0,Fi(0)}}function ov(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ki(t)))}function Dc(){return sv(),iv(),rv(),cv()}function cv(){if(Qe!==5)return!1;var e=Ml,t=Vd;Vd=0;var n=Rf(Qn),l=le.T,a=me.p;try{me.p=32>n?32:n,le.T=null,n=Xd,Xd=null;var s=Ml,i=Qn;if(Qe=0,rs=Ml=null,Qn=0,ge&6)throw Error(Q(331));var r=ge;if(ge|=4,Zy(s.current),Xy(s,s.current,i,n),ge=r,Fi(0,!1),Tt&&typeof Tt.onPostCommitFiberRoot=="function")try{Tt.onPostCommitFiberRoot(Xi,s)}catch{}return!0}finally{me.p=a,le.T=l,ov(e,t)}}function Ng(e,t,n){t=Gt(n,t),t=Ld(e.stateNode,t,2),e=El(e,t,2),e!==null&&(Qi(e,2),Mn(e))}function we(e,t,n){if(e.tag===3)Ng(e,e,n);else for(;t!==null;){if(t.tag===3){Ng(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Cl===null||!Cl.has(l))){e=Gt(n,e),n=jy(2),l=El(t,n,2),l!==null&&(ky(n,l,t,e),Qi(l,2),Mn(l));break}}t=t.return}}function Hu(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new qS;var a=new Set;l.set(t,a)}else a=l.get(t),a===void 0&&(a=new Set,l.set(t,a));a.has(n)||(gh=!0,a.add(n),e=QS.bind(null,e,t,n),t.then(e,e))}function QS(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ke===e&&(ce&n)===n&&(He===4||He===3&&(ce&62914560)===ce&&300>_t()-_c?!(ge&2)&&os(e,0):mh|=n,is===ce&&(is=0)),Mn(e)}function uv(e,t){t===0&&(t=t0()),e=ya(e,t),e!==null&&(Qi(e,t),Mn(e))}function ZS(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),uv(e,n)}function IS(e,t){var n=0;switch(e.tag){case 31:case 13:var l=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(Q(314))}l!==null&&l.delete(t),uv(e,n)}function KS(e,t){return Df(e,t)}var Lo=null,Ma=null,Qd=!1,Bo=!1,$u=!1,Sl=0;function Mn(e){e!==Ma&&e.next===null&&(Ma===null?Lo=Ma=e:Ma=Ma.next=e),Bo=!0,Qd||(Qd=!0,JS())}function Fi(e,t){if(!$u&&Bo){$u=!0;do for(var n=!1,l=Lo;l!==null;){if(e!==0){var a=l.pendingLanes;if(a===0)var s=0;else{var i=l.suspendedLanes,r=l.pingedLanes;s=(1<<31-At(42|e)+1)-1,s&=a&~(i&~r),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(n=!0,jg(l,s))}else s=ce,s=yc(l,l===ke?s:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),!(s&3)||Gi(l,s)||(n=!0,jg(l,s));l=l.next}while(n);$u=!1}}function WS(){dv()}function dv(){Bo=Qd=!1;var e=0;Sl!==0&&rN()&&(e=Sl);for(var t=_t(),n=null,l=Lo;l!==null;){var a=l.next,s=fv(l,t);s===0?(l.next=null,n===null?Lo=a:n.next=a,a===null&&(Ma=n)):(n=l,(e!==0||s&3)&&(Bo=!0)),l=a}Qe!==0&&Qe!==5||Fi(e),Sl!==0&&(Sl=0)}function fv(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,a=e.expirationTimes,s=e.pendingLanes&-62914561;0<s;){var i=31-At(s),r=1<<i,c=a[i];c===-1?(!(r&n)||r&l)&&(a[i]=Nw(r,t)):c<=t&&(e.expiredLanes|=r),s&=~r}if(t=ke,n=ce,n=yc(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,n===0||e===t&&(be===2||be===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&du(l),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Gi(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(l!==null&&du(l),Rf(n)){case 2:case 8:n=Px;break;case 32:n=wo;break;case 268435456:n=e0;break;default:n=wo}return l=hv.bind(null,e),n=Df(n,l),e.callbackPriority=t,e.callbackNode=n,t}return l!==null&&l!==null&&du(l),e.callbackPriority=2,e.callbackNode=null,2}function hv(e,t){if(Qe!==0&&Qe!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Dc()&&e.callbackNode!==n)return null;var l=ce;return l=yc(e,e===ke?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Fy(e,l,t),fv(e,_t()),e.callbackNode!=null&&e.callbackNode===n?hv.bind(null,e):null)}function jg(e,t){if(Dc())return null;Fy(e,t,!0)}function JS(){cN(function(){ge&6?Df(Fx,WS):dv()})}function yh(){if(Sl===0){var e=ls;e===0&&(e=yr,yr<<=1,!(yr&261888)&&(yr=256)),Sl=e}return Sl}function kg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Wr(""+e)}function Eg(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 FS(e,t,n,l,a){if(t==="submit"&&n&&n.stateNode===a){var s=kg((a[wt]||null).action),i=l.submitter;i&&(t=(t=i[wt]||null)?kg(t.formAction):i.getAttribute("formAction"),t!==null&&(s=t,i=null));var r=new vc("action","action",null,l,a);e.push({event:r,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Sl!==0){var c=i?Eg(a,i):new FormData(a);Hd(n,{pending:!0,data:c,method:a.method,action:s},null,c)}}else typeof s=="function"&&(r.preventDefault(),c=i?Eg(a,i):new FormData(a),Hd(n,{pending:!0,data:c,method:a.method,action:s},s,c))},currentTarget:a}]})}}for(var Lu=0;Lu<jd.length;Lu++){var Bu=jd[Lu],PS=Bu.toLowerCase(),eN=Bu[0].toUpperCase()+Bu.slice(1);un(PS,"on"+eN)}un(k0,"onAnimationEnd");un(E0,"onAnimationIteration");un(C0,"onAnimationStart");un("dblclick","onDoubleClick");un("focusin","onFocus");un("focusout","onBlur");un(mS,"onTransitionRun");un(xS,"onTransitionStart");un(yS,"onTransitionCancel");un(M0,"onTransitionEnd");ts("onMouseEnter",["mouseout","mouseover"]);ts("onMouseLeave",["mouseout","mouseover"]);ts("onPointerEnter",["pointerout","pointerover"]);ts("onPointerLeave",["pointerout","pointerover"]);ga("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ga("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ga("onBeforeInput",["compositionend","keypress","textInput","paste"]);ga("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ga("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ga("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ei="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(" "),tN=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ei));function pv(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var l=e[n],a=l.event;l=l.listeners;e:{var s=void 0;if(t)for(var i=l.length-1;0<=i;i--){var r=l[i],c=r.instance,u=r.currentTarget;if(r=r.listener,c!==s&&a.isPropagationStopped())break e;s=r,a.currentTarget=u;try{s(a)}catch(d){No(d)}a.currentTarget=null,s=c}else for(i=0;i<l.length;i++){if(r=l[i],c=r.instance,u=r.currentTarget,r=r.listener,c!==s&&a.isPropagationStopped())break e;s=r,a.currentTarget=u;try{s(a)}catch(d){No(d)}a.currentTarget=null,s=c}}}}function re(e,t){var n=t[md];n===void 0&&(n=t[md]=new Set);var l=e+"__bubble";n.has(l)||(gv(t,e,2,!1),n.add(l))}function Uu(e,t,n){var l=0;t&&(l|=4),gv(n,e,l,t)}var Mr="_reactListening"+Math.random().toString(36).slice(2);function vh(e){if(!e[Mr]){e[Mr]=!0,i0.forEach(function(n){n!=="selectionchange"&&(tN.has(n)||Uu(n,!1,e),Uu(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Mr]||(t[Mr]=!0,Uu("selectionchange",!1,t))}}function gv(e,t,n,l){switch(Mv(t)){case 2:var a=_N;break;case 8:a=TN;break;default:a=Nh}n=a.bind(null,t,n,e),a=void 0,!wd||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),l?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function qu(e,t,n,l,a){var s=l;if(!(t&1)&&!(t&2)&&l!==null)e:for(;;){if(l===null)return;var i=l.tag;if(i===3||i===4){var r=l.stateNode.containerInfo;if(r===a)break;if(i===4)for(i=l.return;i!==null;){var c=i.tag;if((c===3||c===4)&&i.stateNode.containerInfo===a)return;i=i.return}for(;r!==null;){if(i=Aa(r),i===null)return;if(c=i.tag,c===5||c===6||c===26||c===27){l=s=i;continue e}r=r.parentNode}}l=l.return}p0(function(){var u=s,d=$f(n),f=[];e:{var h=_0.get(e);if(h!==void 0){var p=vc,x=e;switch(e){case"keypress":if(Fr(n)===0)break e;case"keydown":case"keyup":p=Iw;break;case"focusin":x="focus",p=mu;break;case"focusout":x="blur",p=mu;break;case"beforeblur":case"afterblur":p=mu;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=Rp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Hw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Jw;break;case k0:case E0:case C0:p=Bw;break;case M0:p=Pw;break;case"scroll":case"scrollend":p=Rw;break;case"wheel":p=tS;break;case"copy":case"cut":case"paste":p=qw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Hp;break;case"toggle":case"beforetoggle":p=lS}var S=(t&4)!==0,w=!S&&(e==="scroll"||e==="scrollend"),g=S?h!==null?h+"Capture":null:h;S=[];for(var y=u,m;y!==null;){var v=y;if(m=v.stateNode,v=v.tag,v!==5&&v!==26&&v!==27||m===null||g===null||(v=yi(y,g),v!=null&&S.push(Ci(y,v,m))),w)break;y=y.return}0<S.length&&(h=new p(h,x,null,n,d),f.push({event:h,listeners:S}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",h&&n!==bd&&(x=n.relatedTarget||n.fromElement)&&(Aa(x)||x[ws]))break e;if((p||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,p?(x=n.relatedTarget||n.toElement,p=u,x=x?Aa(x):null,x!==null&&(w=Vi(x),S=x.tag,x!==w||S!==5&&S!==27&&S!==6)&&(x=null)):(p=null,x=u),p!==x)){if(S=Rp,v="onMouseLeave",g="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(S=Hp,v="onPointerLeave",g="onPointerEnter",y="pointer"),w=p==null?h:Qs(p),m=x==null?h:Qs(x),h=new S(v,y+"leave",p,n,d),h.target=w,h.relatedTarget=m,v=null,Aa(d)===u&&(S=new S(g,y+"enter",x,n,d),S.target=m,S.relatedTarget=w,v=S),w=v,p&&x)t:{for(S=nN,g=p,y=x,m=0,v=g;v;v=S(v))m++;v=0;for(var j=y;j;j=S(j))v++;for(;0<m-v;)g=S(g),m--;for(;0<v-m;)y=S(y),v--;for(;m--;){if(g===y||y!==null&&g===y.alternate){S=g;break t}g=S(g),y=S(y)}S=null}else S=null;p!==null&&Cg(f,h,p,S,!1),x!==null&&w!==null&&Cg(f,w,x,S,!0)}}e:{if(h=u?Qs(u):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var E=Up;else if(Bp(h))if(b0)E=hS;else{E=dS;var M=uS}else p=h.nodeName,!p||p.toLowerCase()!=="input"||h.type!=="checkbox"&&h.type!=="radio"?u&&Hf(u.elementType)&&(E=Up):E=fS;if(E&&(E=E(e,u))){v0(f,E,n,d);break e}M&&M(e,h,u),e==="focusout"&&u&&h.type==="number"&&u.memoizedProps.value!=null&&vd(h,"number",h.value)}switch(M=u?Qs(u):window,e){case"focusin":(Bp(M)||M.contentEditable==="true")&&(Ra=M,Sd=u,ti=null);break;case"focusout":ti=Sd=Ra=null;break;case"mousedown":Nd=!0;break;case"contextmenu":case"mouseup":case"dragend":Nd=!1,Gp(f,n,d);break;case"selectionchange":if(gS)break;case"keydown":case"keyup":Gp(f,n,d)}var T;if(Uf)e:{switch(e){case"compositionstart":var C="onCompositionStart";break e;case"compositionend":C="onCompositionEnd";break e;case"compositionupdate":C="onCompositionUpdate";break e}C=void 0}else za?x0(e,n)&&(C="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(C="onCompositionStart");C&&(m0&&n.locale!=="ko"&&(za||C!=="onCompositionStart"?C==="onCompositionEnd"&&za&&(T=g0()):(vl=d,Lf="value"in vl?vl.value:vl.textContent,za=!0)),M=Uo(u,C),0<M.length&&(C=new Op(C,e,null,n,d),f.push({event:C,listeners:M}),T?C.data=T:(T=y0(n),T!==null&&(C.data=T)))),(T=sS?iS(e,n):rS(e,n))&&(C=Uo(u,"onBeforeInput"),0<C.length&&(M=new Op("onBeforeInput","beforeinput",null,n,d),f.push({event:M,listeners:C}),M.data=T)),FS(f,e,u,n,d)}pv(f,t)})}function Ci(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Uo(e,t){for(var n=t+"Capture",l=[];e!==null;){var a=e,s=a.stateNode;if(a=a.tag,a!==5&&a!==26&&a!==27||s===null||(a=yi(e,n),a!=null&&l.unshift(Ci(e,a,s)),a=yi(e,t),a!=null&&l.push(Ci(e,a,s))),e.tag===3)return l;e=e.return}return[]}function nN(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Cg(e,t,n,l,a){for(var s=t._reactName,i=[];n!==null&&n!==l;){var r=n,c=r.alternate,u=r.stateNode;if(r=r.tag,c!==null&&c===l)break;r!==5&&r!==26&&r!==27||u===null||(c=u,a?(u=yi(n,s),u!=null&&i.unshift(Ci(n,u,c))):a||(u=yi(n,s),u!=null&&i.push(Ci(n,u,c)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var lN=/\r\n?/g,aN=/\u0000|\uFFFD/g;function Mg(e){return(typeof e=="string"?e:""+e).replace(lN,`
49
- `).replace(aN,"")}function mv(e,t){return t=Mg(t),Mg(e)===t}function Ne(e,t,n,l,a,s){switch(n){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||ns(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&ns(e,""+l);break;case"className":wr(e,"class",l);break;case"tabIndex":wr(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":wr(e,n,l);break;case"style":h0(e,l,s);break;case"data":if(t!=="object"){wr(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=Wr(""+l),e.setAttribute(n,l);break;case"action":case"formAction":if(typeof l=="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"&&Ne(e,t,"name",a.name,a,null),Ne(e,t,"formEncType",a.formEncType,a,null),Ne(e,t,"formMethod",a.formMethod,a,null),Ne(e,t,"formTarget",a.formTarget,a,null)):(Ne(e,t,"encType",a.encType,a,null),Ne(e,t,"method",a.method,a,null),Ne(e,t,"target",a.target,a,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=Wr(""+l),e.setAttribute(n,l);break;case"onClick":l!=null&&(e.onclick=qn);break;case"onScroll":l!=null&&re("scroll",e);break;case"onScrollEnd":l!=null&&re("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(Q(61));if(n=l.__html,n!=null){if(a.children!=null)throw Error(Q(60));e.innerHTML=n}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}n=Wr(""+l),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":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,""+l):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":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":l===!0?e.setAttribute(n,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,l):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(n,l):e.removeAttribute(n);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(n):e.setAttribute(n,l);break;case"popover":re("beforetoggle",e),re("toggle",e),Kr(e,"popover",l);break;case"xlinkActuate":Dn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Dn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Dn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Dn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Dn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Dn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Dn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Dn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Dn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Kr(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=Dw.get(n)||n,Kr(e,n,l))}}function Zd(e,t,n,l,a,s){switch(n){case"style":h0(e,l,s);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(Q(61));if(n=l.__html,n!=null){if(a.children!=null)throw Error(Q(60));e.innerHTML=n}}break;case"children":typeof l=="string"?ns(e,l):(typeof l=="number"||typeof l=="bigint")&&ns(e,""+l);break;case"onScroll":l!=null&&re("scroll",e);break;case"onScrollEnd":l!=null&&re("scrollend",e);break;case"onClick":l!=null&&(e.onclick=qn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!r0.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(a=n.endsWith("Capture"),t=n.slice(2,a?n.length-7:void 0),s=e[wt]||null,s=s!=null?s[n]:null,typeof s=="function"&&e.removeEventListener(t,s,a),typeof l=="function")){typeof s!="function"&&s!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,l,a);break e}n in e?e[n]=l:l===!0?e.setAttribute(n,""):Kr(e,n,l)}}}function lt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":re("error",e),re("load",e);var l=!1,a=!1,s;for(s in n)if(n.hasOwnProperty(s)){var i=n[s];if(i!=null)switch(s){case"src":l=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(Q(137,t));default:Ne(e,t,s,i,n,null)}}a&&Ne(e,t,"srcSet",n.srcSet,n,null),l&&Ne(e,t,"src",n.src,n,null);return;case"input":re("invalid",e);var r=s=i=a=null,c=null,u=null;for(l in n)if(n.hasOwnProperty(l)){var d=n[l];if(d!=null)switch(l){case"name":a=d;break;case"type":i=d;break;case"checked":c=d;break;case"defaultChecked":u=d;break;case"value":s=d;break;case"defaultValue":r=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(Q(137,t));break;default:Ne(e,t,l,d,n,null)}}u0(e,s,r,c,u,i,a,!1);return;case"select":re("invalid",e),l=i=s=null;for(a in n)if(n.hasOwnProperty(a)&&(r=n[a],r!=null))switch(a){case"value":s=r;break;case"defaultValue":i=r;break;case"multiple":l=r;default:Ne(e,t,a,r,n,null)}t=s,n=i,e.multiple=!!l,t!=null?Ga(e,!!l,t,!1):n!=null&&Ga(e,!!l,n,!0);return;case"textarea":re("invalid",e),s=a=l=null;for(i in n)if(n.hasOwnProperty(i)&&(r=n[i],r!=null))switch(i){case"value":l=r;break;case"defaultValue":a=r;break;case"children":s=r;break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(Q(91));break;default:Ne(e,t,i,r,n,null)}f0(e,l,a,s);return;case"option":for(c in n)if(n.hasOwnProperty(c)&&(l=n[c],l!=null))switch(c){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Ne(e,t,c,l,n,null)}return;case"dialog":re("beforetoggle",e),re("toggle",e),re("cancel",e),re("close",e);break;case"iframe":case"object":re("load",e);break;case"video":case"audio":for(l=0;l<Ei.length;l++)re(Ei[l],e);break;case"image":re("error",e),re("load",e);break;case"details":re("toggle",e);break;case"embed":case"source":case"link":re("error",e),re("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)&&(l=n[u],l!=null))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(Q(137,t));default:Ne(e,t,u,l,n,null)}return;default:if(Hf(t)){for(d in n)n.hasOwnProperty(d)&&(l=n[d],l!==void 0&&Zd(e,t,d,l,n,void 0));return}}for(r in n)n.hasOwnProperty(r)&&(l=n[r],l!=null&&Ne(e,t,r,l,n,null))}function sN(e,t,n,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,s=null,i=null,r=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:l.hasOwnProperty(p)||Ne(e,t,p,null,l,f)}}for(var h in l){var p=l[h];if(f=n[h],l.hasOwnProperty(h)&&(p!=null||f!=null))switch(h){case"type":s=p;break;case"name":a=p;break;case"checked":u=p;break;case"defaultChecked":d=p;break;case"value":i=p;break;case"defaultValue":r=p;break;case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(Q(137,t));break;default:p!==f&&Ne(e,t,h,p,l,f)}}yd(e,i,r,c,u,d,s,a);return;case"select":p=i=r=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:l.hasOwnProperty(s)||Ne(e,t,s,null,l,c)}for(a in l)if(s=l[a],c=n[a],l.hasOwnProperty(a)&&(s!=null||c!=null))switch(a){case"value":h=s;break;case"defaultValue":r=s;break;case"multiple":i=s;default:s!==c&&Ne(e,t,a,s,l,c)}t=r,n=i,l=p,h!=null?Ga(e,!!n,h,!1):!!l!=!!n&&(t!=null?Ga(e,!!n,t,!0):Ga(e,!!n,n?[]:"",!1));return;case"textarea":p=h=null;for(r in n)if(a=n[r],n.hasOwnProperty(r)&&a!=null&&!l.hasOwnProperty(r))switch(r){case"value":break;case"children":break;default:Ne(e,t,r,null,l,a)}for(i in l)if(a=l[i],s=n[i],l.hasOwnProperty(i)&&(a!=null||s!=null))switch(i){case"value":h=a;break;case"defaultValue":p=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(Q(91));break;default:a!==s&&Ne(e,t,i,a,l,s)}d0(e,h,p);return;case"option":for(var x in n)if(h=n[x],n.hasOwnProperty(x)&&h!=null&&!l.hasOwnProperty(x))switch(x){case"selected":e.selected=!1;break;default:Ne(e,t,x,null,l,h)}for(c in l)if(h=l[c],p=n[c],l.hasOwnProperty(c)&&h!==p&&(h!=null||p!=null))switch(c){case"selected":e.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:Ne(e,t,c,h,l,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 S in n)h=n[S],n.hasOwnProperty(S)&&h!=null&&!l.hasOwnProperty(S)&&Ne(e,t,S,null,l,h);for(u in l)if(h=l[u],p=n[u],l.hasOwnProperty(u)&&h!==p&&(h!=null||p!=null))switch(u){case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(Q(137,t));break;default:Ne(e,t,u,h,l,p)}return;default:if(Hf(t)){for(var w in n)h=n[w],n.hasOwnProperty(w)&&h!==void 0&&!l.hasOwnProperty(w)&&Zd(e,t,w,void 0,l,h);for(d in l)h=l[d],p=n[d],!l.hasOwnProperty(d)||h===p||h===void 0&&p===void 0||Zd(e,t,d,h,l,p);return}}for(var g in n)h=n[g],n.hasOwnProperty(g)&&h!=null&&!l.hasOwnProperty(g)&&Ne(e,t,g,null,l,h);for(f in l)h=l[f],p=n[f],!l.hasOwnProperty(f)||h===p||h==null&&p==null||Ne(e,t,f,h,l,p)}function _g(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function iN(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),l=0;l<n.length;l++){var a=n[l],s=a.transferSize,i=a.initiatorType,r=a.duration;if(s&&r&&_g(i)){for(i=0,r=a.responseEnd,l+=1;l<n.length;l++){var c=n[l],u=c.startTime;if(u>r)break;var d=c.transferSize,f=c.initiatorType;d&&_g(f)&&(c=c.responseEnd,i+=d*(c<r?1:(r-u)/(c-u)))}if(--l,t+=8*(s+i)/(a.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,Kd=null;function qo(e){return e.nodeType===9?e:e.ownerDocument}function Tg(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 xv(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 Wd(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 Yu=null;function rN(){var e=window.event;return e&&e.type==="popstate"?e===Yu?!1:(Yu=e,!0):(Yu=null,!1)}var yv=typeof setTimeout=="function"?setTimeout:void 0,oN=typeof clearTimeout=="function"?clearTimeout:void 0,Ag=typeof Promise=="function"?Promise:void 0,cN=typeof queueMicrotask=="function"?queueMicrotask:typeof Ag<"u"?function(e){return Ag.resolve(null).then(e).catch(uN)}:yv;function uN(e){setTimeout(function(){throw e})}function Ll(e){return e==="head"}function Dg(e,t){var n=t,l=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"||n==="/&"){if(l===0){e.removeChild(a),us(t);return}l--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")l++;else if(n==="html")di(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,di(n);for(var s=n.firstChild;s;){var i=s.nextSibling,r=s.nodeName;s[Zi]||r==="SCRIPT"||r==="STYLE"||r==="LINK"&&s.rel.toLowerCase()==="stylesheet"||n.removeChild(s),s=i}}else n==="body"&&di(e.ownerDocument.body);n=a}while(n);us(t)}function zg(e,t){var n=e;e=0;do{var l=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||""),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=l}while(n)}function Jd(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":Jd(n),Of(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function dN(e,t,n,l){for(;e.nodeType===1;){var a=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Zi])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!==a.rel||e.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||e.getAttribute("title")!==(a.title==null?null:a.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(s=e.getAttribute("src"),(s!==(a.src==null?null:a.src)||e.getAttribute("type")!==(a.type==null?null:a.type)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&s&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var s=a.name==null?null:""+a.name;if(a.type==="hidden"&&e.getAttribute("name")===s)return e}else return e;if(e=It(e.nextSibling),e===null)break}return null}function fN(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=It(e.nextSibling),e===null))return null;return e}function vv(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=It(e.nextSibling),e===null))return null;return e}function Fd(e){return e.data==="$?"||e.data==="$~"}function Pd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function hN(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var l=function(){t(),n.removeEventListener("DOMContentLoaded",l)};n.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function It(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 ef=null;function Rg(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return It(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Og(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 bv(e,t,n){switch(t=qo(n),e){case"html":if(e=t.documentElement,!e)throw Error(Q(452));return e;case"head":if(e=t.head,!e)throw Error(Q(453));return e;case"body":if(e=t.body,!e)throw Error(Q(454));return e;default:throw Error(Q(451))}}function di(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Of(e)}var Kt=new Map,Hg=new Set;function Yo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var tl=me.d;me.d={f:pN,r:gN,D:mN,C:xN,L:yN,m:vN,X:wN,S:bN,M:SN};function pN(){var e=tl.f(),t=Tc();return e||t}function gN(e){var t=Ss(e);t!==null&&t.tag===5&&t.type==="form"?hy(t):tl.r(e)}var Es=typeof document>"u"?null:document;function wv(e,t,n){var l=Es;if(l&&typeof t=="string"&&t){var a=Xt(t);a='link[rel="'+e+'"][href="'+a+'"]',typeof n=="string"&&(a+='[crossorigin="'+n+'"]'),Hg.has(a)||(Hg.add(a),e={rel:e,crossOrigin:n,href:t},l.querySelector(a)===null&&(t=l.createElement("link"),lt(t,"link",e),Je(t),l.head.appendChild(t)))}}function mN(e){tl.D(e),wv("dns-prefetch",e,null)}function xN(e,t){tl.C(e,t),wv("preconnect",e,t)}function yN(e,t,n){tl.L(e,t,n);var l=Es;if(l&&e&&t){var a='link[rel="preload"][as="'+Xt(t)+'"]';t==="image"&&n&&n.imageSrcSet?(a+='[imagesrcset="'+Xt(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(a+='[imagesizes="'+Xt(n.imageSizes)+'"]')):a+='[href="'+Xt(e)+'"]';var s=a;switch(t){case"style":s=cs(e);break;case"script":s=Cs(e)}Kt.has(s)||(e=Ae({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Kt.set(s,e),l.querySelector(a)!==null||t==="style"&&l.querySelector(Pi(s))||t==="script"&&l.querySelector(er(s))||(t=l.createElement("link"),lt(t,"link",e),Je(t),l.head.appendChild(t)))}}function vN(e,t){tl.m(e,t);var n=Es;if(n&&e){var l=t&&typeof t.as=="string"?t.as:"script",a='link[rel="modulepreload"][as="'+Xt(l)+'"][href="'+Xt(e)+'"]',s=a;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=Cs(e)}if(!Kt.has(s)&&(e=Ae({rel:"modulepreload",href:e},t),Kt.set(s,e),n.querySelector(a)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(er(s)))return}l=n.createElement("link"),lt(l,"link",e),Je(l),n.head.appendChild(l)}}}function bN(e,t,n){tl.S(e,t,n);var l=Es;if(l&&e){var a=Xa(l).hoistableStyles,s=cs(e);t=t||"default";var i=a.get(s);if(!i){var r={loading:0,preload:null};if(i=l.querySelector(Pi(s)))r.loading=5;else{e=Ae({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Kt.get(s))&&bh(e,n);var c=i=l.createElement("link");Je(c),lt(c,"link",e),c._p=new Promise(function(u,d){c.onload=u,c.onerror=d}),c.addEventListener("load",function(){r.loading|=1}),c.addEventListener("error",function(){r.loading|=2}),r.loading|=4,io(i,t,l)}i={type:"stylesheet",instance:i,count:1,state:r},a.set(s,i)}}}function wN(e,t){tl.X(e,t);var n=Es;if(n&&e){var l=Xa(n).hoistableScripts,a=Cs(e),s=l.get(a);s||(s=n.querySelector(er(a)),s||(e=Ae({src:e,async:!0},t),(t=Kt.get(a))&&wh(e,t),s=n.createElement("script"),Je(s),lt(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(a,s))}}function SN(e,t){tl.M(e,t);var n=Es;if(n&&e){var l=Xa(n).hoistableScripts,a=Cs(e),s=l.get(a);s||(s=n.querySelector(er(a)),s||(e=Ae({src:e,async:!0,type:"module"},t),(t=Kt.get(a))&&wh(e,t),s=n.createElement("script"),Je(s),lt(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(a,s))}}function $g(e,t,n,l){var a=(a=Nl.current)?Yo(a):null;if(!a)throw Error(Q(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=cs(n.href),n=Xa(a).hoistableStyles,l=n.get(t),l||(l={type:"style",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=cs(n.href);var s=Xa(a).hoistableStyles,i=s.get(e);if(i||(a=a.ownerDocument||a,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,i),(s=a.querySelector(Pi(e)))&&!s._p&&(i.instance=s,i.state.loading=5),Kt.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},Kt.set(e,n),s||NN(a,e,n,i.state))),t&&l===null)throw Error(Q(528,""));return i}if(t&&l!==null)throw Error(Q(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Cs(n),n=Xa(a).hoistableScripts,l=n.get(t),l||(l={type:"script",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(Q(444,e))}}function cs(e){return'href="'+Xt(e)+'"'}function Pi(e){return'link[rel="stylesheet"]['+e+"]"}function Sv(e){return Ae({},e,{"data-precedence":e.precedence,precedence:null})}function NN(e,t,n,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),lt(t,"link",n),Je(t),e.head.appendChild(t))}function Cs(e){return'[src="'+Xt(e)+'"]'}function er(e){return"script[async]"+e}function Lg(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+Xt(n.href)+'"]');if(l)return t.instance=l,Je(l),l;var a=Ae({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Je(l),lt(l,"style",a),io(l,n.precedence,e),t.instance=l;case"stylesheet":a=cs(n.href);var s=e.querySelector(Pi(a));if(s)return t.state.loading|=4,t.instance=s,Je(s),s;l=Sv(n),(a=Kt.get(a))&&bh(l,a),s=(e.ownerDocument||e).createElement("link"),Je(s);var i=s;return i._p=new Promise(function(r,c){i.onload=r,i.onerror=c}),lt(s,"link",l),t.state.loading|=4,io(s,n.precedence,e),t.instance=s;case"script":return s=Cs(n.src),(a=e.querySelector(er(s)))?(t.instance=a,Je(a),a):(l=n,(a=Kt.get(s))&&(l=Ae({},n),wh(l,a)),e=e.ownerDocument||e,a=e.createElement("script"),Je(a),lt(a,"link",l),e.head.appendChild(a),t.instance=a);case"void":return null;default:throw Error(Q(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(l=t.instance,t.state.loading|=4,io(l,n.precedence,e));return t.instance}function io(e,t,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=l.length?l[l.length-1]:null,s=a,i=0;i<l.length;i++){var r=l[i];if(r.dataset.precedence===t)s=r;else if(s!==a)break}s?s.parentNode.insertBefore(e,s.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function bh(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function wh(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var ro=null;function Bg(e,t,n){if(ro===null){var l=new Map,a=ro=new Map;a.set(n,l)}else a=ro,l=a.get(n),l||(l=new Map,a.set(n,l));if(l.has(e))return l;for(l.set(e,null),n=n.getElementsByTagName(e),a=0;a<n.length;a++){var s=n[a];if(!(s[Zi]||s[et]||e==="link"&&s.getAttribute("rel")==="stylesheet")&&s.namespaceURI!=="http://www.w3.org/2000/svg"){var i=s.getAttribute(t)||"";i=e+i;var r=l.get(i);r?r.push(s):l.set(i,[s])}}return l}function Ug(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function jN(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 Nv(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function kN(e,t,n,l){if(n.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var a=cs(l.href),s=t.querySelector(Pi(a));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Vo.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=s,Je(s);return}s=t.ownerDocument||t,l=Sv(l),(a=Kt.get(a))&&bh(l,a),s=s.createElement("link"),Je(s);var i=s;i._p=new Promise(function(r,c){i.onload=r,i.onerror=c}),lt(s,"link",l),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=Vo.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Vu=0;function EN(e,t){return e.stylesheets&&e.count===0&&oo(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var l=setTimeout(function(){if(e.stylesheets&&oo(e,e.stylesheets),e.unsuspend){var s=e.unsuspend;e.unsuspend=null,s()}},6e4+t);0<e.imgBytes&&Vu===0&&(Vu=62500*iN());var a=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&oo(e,e.stylesheets),e.unsuspend)){var s=e.unsuspend;e.unsuspend=null,s()}},(e.imgBytes>Vu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(a)}}:null}function Vo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)oo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Xo=null;function oo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Xo=new Map,t.forEach(CN,e),Xo=null,Vo.call(e))}function CN(e,t){if(!(t.state.loading&4)){var n=Xo.get(e);if(n)var l=n.get(null);else{n=new Map,Xo.set(e,n);for(var a=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s<a.length;s++){var i=a[s];(i.nodeName==="LINK"||i.getAttribute("media")!=="not all")&&(n.set(i.dataset.precedence,i),l=i)}l&&n.set(null,l)}a=t.instance,i=a.getAttribute("data-precedence"),s=n.get(i)||l,s===l&&n.set(null,a),n.set(i,a),this.count++,l=Vo.bind(this),a.addEventListener("load",l),a.addEventListener("error",l),s?s.parentNode.insertBefore(a,s.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(a,e.firstChild)),t.state.loading|=4}}var Mi={$$typeof:Un,Provider:null,Consumer:null,_currentValue:Fl,_currentValue2:Fl,_threadCount:0};function MN(e,t,n,l,a,s,i,r,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=fu(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fu(0),this.hiddenUpdates=fu(null),this.identifierPrefix=l,this.onUncaughtError=a,this.onCaughtError=s,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function jv(e,t,n,l,a,s,i,r,c,u,d,f){return e=new MN(e,t,n,i,c,u,d,f,r),t=1,s===!0&&(t|=24),s=Et(3,null,null,t),e.current=s,s.stateNode=e,t=Zf(),t.refCount++,e.pooledCache=t,t.refCount++,s.memoizedState={element:l,isDehydrated:n,cache:t},Wf(s),e}function kv(e){return e?(e=$a,e):$a}function Ev(e,t,n,l,a,s){a=kv(a),l.context===null?l.context=a:l.pendingContext=a,l=kl(t),l.payload={element:n},s=s===void 0?null:s,s!==null&&(l.callback=s),n=El(e,l,t),n!==null&&(bt(n,e,t),li(n,e,t))}function qg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Sh(e,t){qg(e,t),(e=e.alternate)&&qg(e,t)}function Cv(e){if(e.tag===13||e.tag===31){var t=ya(e,67108864);t!==null&&bt(t,e,67108864),Sh(e,67108864)}}function Yg(e){if(e.tag===13||e.tag===31){var t=Dt();t=zf(t);var n=ya(e,t);n!==null&&bt(n,e,t),Sh(e,t)}}var Go=!0;function _N(e,t,n,l){var a=le.T;le.T=null;var s=me.p;try{me.p=2,Nh(e,t,n,l)}finally{me.p=s,le.T=a}}function TN(e,t,n,l){var a=le.T;le.T=null;var s=me.p;try{me.p=8,Nh(e,t,n,l)}finally{me.p=s,le.T=a}}function Nh(e,t,n,l){if(Go){var a=tf(l);if(a===null)qu(e,t,l,Qo,n),Vg(e,l);else if(DN(a,e,t,n,l))l.stopPropagation();else if(Vg(e,l),t&4&&-1<AN.indexOf(e)){for(;a!==null;){var s=Ss(a);if(s!==null)switch(s.tag){case 3:if(s=s.stateNode,s.current.memoizedState.isDehydrated){var i=Gl(s.pendingLanes);if(i!==0){var r=s;for(r.pendingLanes|=2,r.entangledLanes|=2;i;){var c=1<<31-At(i);r.entanglements[1]|=c,i&=~c}Mn(s),!(ge&6)&&(Oo=_t()+500,Fi(0))}}break;case 31:case 13:r=ya(s,2),r!==null&&bt(r,s,2),Tc(),Sh(s,2)}if(s=tf(l),s===null&&qu(e,t,l,Qo,n),s===a)break;a=s}a!==null&&l.stopPropagation()}else qu(e,t,l,null,n)}}function tf(e){return e=$f(e),jh(e)}var Qo=null;function jh(e){if(Qo=null,e=Aa(e),e!==null){var t=Vi(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=Zx(t),e!==null)return e;e=null}else if(n===31){if(e=Ix(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 Qo=e,null}function Mv(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(mw()){case Fx:return 2;case Px:return 8;case wo:case xw:return 32;case e0:return 268435456;default:return 32}default:return 32}}var nf=!1,_l=null,Tl=null,Al=null,_i=new Map,Ti=new Map,ml=[],AN="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 Vg(e,t){switch(e){case"focusin":case"focusout":_l=null;break;case"dragenter":case"dragleave":Tl=null;break;case"mouseover":case"mouseout":Al=null;break;case"pointerover":case"pointerout":_i.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ti.delete(t.pointerId)}}function Us(e,t,n,l,a,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:l,nativeEvent:s,targetContainers:[a]},t!==null&&(t=Ss(t),t!==null&&Cv(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function DN(e,t,n,l,a){switch(t){case"focusin":return _l=Us(_l,e,t,n,l,a),!0;case"dragenter":return Tl=Us(Tl,e,t,n,l,a),!0;case"mouseover":return Al=Us(Al,e,t,n,l,a),!0;case"pointerover":var s=a.pointerId;return _i.set(s,Us(_i.get(s)||null,e,t,n,l,a)),!0;case"gotpointercapture":return s=a.pointerId,Ti.set(s,Us(Ti.get(s)||null,e,t,n,l,a)),!0}return!1}function _v(e){var t=Aa(e.target);if(t!==null){var n=Vi(t);if(n!==null){if(t=n.tag,t===13){if(t=Zx(n),t!==null){e.blockedOn=t,Cp(e.priority,function(){Yg(n)});return}}else if(t===31){if(t=Ix(n),t!==null){e.blockedOn=t,Cp(e.priority,function(){Yg(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 co(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=tf(e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);bd=l,n.target.dispatchEvent(l),bd=null}else return t=Ss(n),t!==null&&Cv(t),e.blockedOn=n,!1;t.shift()}return!0}function Xg(e,t,n){co(e)&&n.delete(t)}function zN(){nf=!1,_l!==null&&co(_l)&&(_l=null),Tl!==null&&co(Tl)&&(Tl=null),Al!==null&&co(Al)&&(Al=null),_i.forEach(Xg),Ti.forEach(Xg)}function _r(e,t){e.blockedOn===t&&(e.blockedOn=null,nf||(nf=!0,Ze.unstable_scheduleCallback(Ze.unstable_NormalPriority,zN)))}var Tr=null;function Gg(e){Tr!==e&&(Tr=e,Ze.unstable_scheduleCallback(Ze.unstable_NormalPriority,function(){Tr===e&&(Tr=null);for(var t=0;t<e.length;t+=3){var n=e[t],l=e[t+1],a=e[t+2];if(typeof l!="function"){if(jh(l||n)===null)continue;break}var s=Ss(n);s!==null&&(e.splice(t,3),t-=3,Hd(s,{pending:!0,data:a,method:n.method,action:l},l,a))}}))}function us(e){function t(c){return _r(c,e)}_l!==null&&_r(_l,e),Tl!==null&&_r(Tl,e),Al!==null&&_r(Al,e),_i.forEach(t),Ti.forEach(t);for(var n=0;n<ml.length;n++){var l=ml[n];l.blockedOn===e&&(l.blockedOn=null)}for(;0<ml.length&&(n=ml[0],n.blockedOn===null);)_v(n),n.blockedOn===null&&ml.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(l=0;l<n.length;l+=3){var a=n[l],s=n[l+1],i=a[wt]||null;if(typeof s=="function")i||Gg(n);else if(i){var r=null;if(s&&s.hasAttribute("formAction")){if(a=s,i=s[wt]||null)r=i.formAction;else if(jh(a)!==null)continue}else r=i.action;typeof r=="function"?n[l+1]=r:(n.splice(l,3),l-=3),Gg(n)}}}function Tv(){function e(s){s.canIntercept&&s.info==="react-transition"&&s.intercept({handler:function(){return new Promise(function(i){return a=i})},focusReset:"manual",scroll:"manual"})}function t(){a!==null&&(a(),a=null),l||setTimeout(n,20)}function n(){if(!l&&!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 l=!1,a=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),a!==null&&(a(),a=null)}}}function kh(e){this._internalRoot=e}zc.prototype.render=kh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Q(409));var n=t.current,l=Dt();Ev(n,l,e,t,null,null)};zc.prototype.unmount=kh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ev(e.current,2,null,e,null,null),Tc(),t[ws]=null}};function zc(e){this._internalRoot=e}zc.prototype.unstable_scheduleHydration=function(e){if(e){var t=s0();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ml.length&&t!==0&&t<ml[n].priority;n++);ml.splice(n,0,e),n===0&&_v(e)}};var Qg=Gx.version;if(Qg!=="19.2.6")throw Error(Q(527,Qg,"19.2.6"));me.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Q(188)):(e=Object.keys(e).join(","),Error(Q(268,e)));return e=cw(t),e=e!==null?Kx(e):null,e=e===null?null:e.stateNode,e};var RN={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:le,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ar=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ar.isDisabled&&Ar.supportsFiber)try{Xi=Ar.inject(RN),Tt=Ar}catch{}}mc.createRoot=function(e,t){if(!Qx(e))throw Error(Q(299));var n=!1,l="",a=wy,s=Sy,i=Ny;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(a=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=jv(e,1,!1,null,null,n,l,null,a,s,i,Tv),e[ws]=t.current,vh(e),new kh(t)};mc.hydrateRoot=function(e,t,n){if(!Qx(e))throw Error(Q(299));var l=!1,a="",s=wy,i=Sy,r=Ny,c=null;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onUncaughtError!==void 0&&(s=n.onUncaughtError),n.onCaughtError!==void 0&&(i=n.onCaughtError),n.onRecoverableError!==void 0&&(r=n.onRecoverableError),n.formState!==void 0&&(c=n.formState)),t=jv(e,1,!0,t,n??null,l,a,c,s,i,r,Tv),t.context=kv(null),n=t.current,l=Dt(),l=zf(l),a=kl(l),a.callback=null,El(n,a,l),n=l,t.current.lanes=n,Qi(t,n),Mn(t),e[ws]=t.current,vh(e),new zc(t)};mc.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(),Bx.exports=mc;var ON=Bx.exports;function HN(){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 $N{constructor(t,n){this.baseUrl=t,this.token=n}async request(t,n){const l=HN(),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:l,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,l){return this.request("session.send",{id:t,text:n,type:l})}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 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,l){return this.request("cron.create",{type:t,message:n,scheduledAt:l})}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 LN{constructor(t,n){de(this,"ws",null);de(this,"reconnectTimer",null);de(this,"reconnectDelay",1e3);de(this,"_reconnecting",!1);de(this,"handlers",new Map);de(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 l=JSON.parse(n.data);this.dispatch(l)}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 l;(l=this.handlers.get(t))==null||l.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 a of n)try{a(t)}catch{}const l=this.handlers.get("*");if(l)for(const a of l)try{a(t)}catch{}}scheduleReconnect(){this.reconnectTimer||(this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.reconnectDelay=Math.min(this.reconnectDelay*2,3e4),this.connect()},this.reconnectDelay))}}const Dv=b.createContext({rpc:null,ws:null,connected:!1,connectionStatus:"disconnected",token:null,setToken:()=>{}});function _n(){return b.useContext(Dv)}function BN({children:e}){const[t,n]=b.useState(null),[l,a]=b.useState({rpc:null,ws:null,connected:!1,connectionStatus:"disconnected"});b.useEffect(()=>{const r=new URLSearchParams(window.location.search).get("token")||localStorage.getItem("daemon-token")||"";r&&(localStorage.setItem("daemon-token",r),n(r))},[]);const s=r=>{localStorage.setItem("daemon-token",r),n(r)};b.useEffect(()=>{if(!t){a({rpc:null,ws:null,connected:!1,connectionStatus:"disconnected"});return}const r=window.location.origin,c=new $N(r,t),u=new LN(r,t);a({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 x=!!p.connected;let S;x?S="connected":u.isReconnecting()?S="reconnecting":S="disconnected",a(w=>({...w,connected:x,connectionStatus:S}))}),h=setInterval(()=>{const p=u.isConnected();a(x=>({...x,connected:p,connectionStatus:p?"connected":x.connectionStatus==="reconnecting"?"reconnecting":"disconnected"}))},2e3);return()=>{d(),f(),clearInterval(h),u.disconnect()}},[t]);const i={rpc:l.rpc,ws:l.ws,connected:l.connected,connectionStatus:l.connectionStatus,token:t,setToken:s};return o.jsx(Dv.Provider,{value:i,children:e})}function Eh(){const{rpc:e,ws:t}=_n(),[n,l]=b.useState({}),[a,s]=b.useState([]),i=b.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])=>{l(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]);b.useEffect(()=>{i()},[i]),b.useEffect(()=>{if(t)return t.on("config-changed",()=>{i()})},[t,i]);const r=b.useCallback(u=>n[u],[n]),c=b.useCallback(async(u,d)=>{if(e)try{await e.configSet(u,d),l(f=>({...f,[u]:d}))}catch{}},[e]);return{settings:n,get:r,set:c,providers:a}}function Ch(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ba=Ch();function zv(e){ba=e}var Kl={exec:()=>null};function he(e,t=""){let n=typeof e=="string"?e:e.source,l={replace:(a,s)=>{let i=typeof s=="string"?s:s.source;return i=i.replace(at.caret,"$1"),n=n.replace(a,i),l},getRegex:()=>new RegExp(n,t)};return l}var UN=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),at={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)}}>`)},qN=/^(?:[ \t]*(?:\n|$))+/,YN=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,VN=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,tr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,XN=/^ {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+|$)/,Ov=he(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(),GN=he(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(),_h=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,QN=/^[^\n]+/,Th=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ZN=he(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Th).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),IN=he(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Mh).getRegex(),Rc="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",Ah=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,KN=he("^ {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",Ah).replace("tag",Rc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Hv=he(_h).replace("hr",tr).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",Rc).getRegex(),WN=he(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Hv).getRegex(),Dh={blockquote:WN,code:YN,def:ZN,fences:VN,heading:XN,hr:tr,html:KN,lheading:Ov,list:IN,newline:qN,paragraph:Hv,table:Kl,text:QN},Zg=he("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",tr).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",Rc).getRegex(),JN={...Dh,lheading:GN,table:Zg,paragraph:he(_h).replace("hr",tr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Zg).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",Rc).getRegex()},FN={...Dh,html:he(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ah).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:Kl,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:he(_h).replace("hr",tr).replace("heading",` *#{1,6} *[^
50
- ]`).replace("lheading",Ov).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},PN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ej=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,$v=/^( {2,}|\\)\n(?!\s*$)/,tj=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ms=/[\p{P}\p{S}]/u,Oc=/[\s\p{P}\p{S}]/u,zh=/[^\s\p{P}\p{S}]/u,nj=he(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Oc).getRegex(),Lv=/(?!~)[\p{P}\p{S}]/u,lj=/(?!~)[\s\p{P}\p{S}]/u,aj=/(?:[^\s\p{P}\p{S}]|~)/u,sj=he(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",UN?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Bv=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ij=he(Bv,"u").replace(/punct/g,Ms).getRegex(),rj=he(Bv,"u").replace(/punct/g,Lv).getRegex(),Uv="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",oj=he(Uv,"gu").replace(/notPunctSpace/g,zh).replace(/punctSpace/g,Oc).replace(/punct/g,Ms).getRegex(),cj=he(Uv,"gu").replace(/notPunctSpace/g,aj).replace(/punctSpace/g,lj).replace(/punct/g,Lv).getRegex(),uj=he("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,zh).replace(/punctSpace/g,Oc).replace(/punct/g,Ms).getRegex(),dj=he(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Ms).getRegex(),fj="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",hj=he(fj,"gu").replace(/notPunctSpace/g,zh).replace(/punctSpace/g,Oc).replace(/punct/g,Ms).getRegex(),pj=he(/\\(punct)/,"gu").replace(/punct/g,Ms).getRegex(),gj=he(/^<(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(),mj=he(Ah).replace("(?:-->|$)","-->").getRegex(),xj=he("^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",mj).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Zo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,yj=he(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Zo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),qv=he(/^!?\[(label)\]\[(ref)\]/).replace("label",Zo).replace("ref",Th).getRegex(),Yv=he(/^!?\[(ref)\](?:\[\])?/).replace("ref",Th).getRegex(),vj=he("reflink|nolink(?!\\()","g").replace("reflink",qv).replace("nolink",Yv).getRegex(),Ig=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Rh={_backpedal:Kl,anyPunctuation:pj,autolink:gj,blockSkip:sj,br:$v,code:ej,del:Kl,delLDelim:Kl,delRDelim:Kl,emStrongLDelim:ij,emStrongRDelimAst:oj,emStrongRDelimUnd:uj,escape:PN,link:yj,nolink:Yv,punctuation:nj,reflink:qv,reflinkSearch:vj,tag:xj,text:tj,url:Kl},bj={...Rh,link:he(/^!?\[(label)\]\((.*?)\)/).replace("label",Zo).getRegex(),reflink:he(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Zo).getRegex()},lf={...Rh,emStrongRDelimAst:cj,emStrongLDelim:rj,delLDelim:dj,delRDelim:hj,url:he(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ig).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:he(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ig).getRegex()},wj={...lf,br:he($v).replace("{2,}","*").getRegex(),text:he(lf.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Dr={normal:Dh,gfm:JN,pedantic:FN},qs={normal:Rh,gfm:lf,breaks:wj,pedantic:bj},Sj={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Kg=e=>Sj[e];function xn(e,t){if(t){if(at.escapeTest.test(e))return e.replace(at.escapeReplace,Kg)}else if(at.escapeTestNoEncode.test(e))return e.replace(at.escapeReplaceNoEncode,Kg);return e}function Wg(e){try{e=encodeURI(e).replace(at.percentDecode,"%")}catch{return null}return e}function Jg(e,t){var s;let n=e.replace(at.findPipe,(i,r,c)=>{let u=!1,d=r;for(;--d>=0&&c[d]==="\\";)u=!u;return u?"|":" |"}),l=n.split(at.splitPipe),a=0;if(l[0].trim()||l.shift(),l.length>0&&!((s=l.at(-1))!=null&&s.trim())&&l.pop(),t)if(l.length>t)l.splice(t);else for(;l.length<t;)l.push("");for(;a<l.length;a++)l[a]=l[a].trim().replace(at.slashPipe,"|");return l}function il(e,t,n){let l=e.length;if(l===0)return"";let a=0;for(;a<l&&e.charAt(l-a-1)===t;)a++;return e.slice(0,l-a)}function Fg(e){let t=e.split(`
51
- `),n=t.length-1;for(;n>=0&&at.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
52
- `)}function Nj(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let l=0;l<e.length;l++)if(e[l]==="\\")l++;else if(e[l]===t[0])n++;else if(e[l]===t[1]&&(n--,n<0))return l;return n>0?-2:-1}function jj(e,t=0){let n=t,l="";for(let a of e)if(a===" "){let s=4-n%4;l+=" ".repeat(s),n+=s}else l+=a,n++;return l}function Pg(e,t,n,l,a){let s=t.href,i=t.title||null,r=e[1].replace(a.other.outputLinkReplace,"$1");l.state.inLink=!0;let c={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:i,text:r,tokens:l.inlineTokens(r)};return l.state.inLink=!1,c}function kj(e,t,n){let l=e.match(n.other.indentCodeCompensation);if(l===null)return t;let a=l[1];return t.split(`
53
- `).map(s=>{let i=s.match(n.other.beginningSpace);if(i===null)return s;let[r]=i;return r.length>=a.length?s.slice(a.length):s}).join(`
54
- `)}var Io=class{constructor(e){de(this,"options");de(this,"rules");de(this,"lexer");this.options=e||ba}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]:Fg(t[0]),l=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:l}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],l=kj(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:l}}}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 l=il(n,"#");(this.options.pedantic||!l||this.rules.other.endingSpaceChar.test(l))&&(n=l.trim())}return{type:"heading",raw:il(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:il(t[0],`
56
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=il(t[0],`
57
- `).split(`
58
- `),l="",a="",s=[];for(;n.length>0;){let i=!1,r=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))r.push(n[c]),i=!0;else if(!i)r.push(n[c]);else break;n=n.slice(c);let u=r.join(`
59
- `),d=u.replace(this.rules.other.blockquoteSetextReplace,`
60
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");l=l?`${l}
61
- ${u}`:u,a=a?`${a}
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,x=p.raw+`
63
- `+n.join(`
64
- `),S=this.blockquote(x);s[s.length-1]=S,l=l.substring(0,l.length-p.raw.length)+S.raw,a=a.substring(0,a.length-p.text.length)+S.text;break}else if((h==null?void 0:h.type)==="list"){let p=h,x=p.raw+`
65
- `+n.join(`
66
- `),S=this.list(x);s[s.length-1]=S,l=l.substring(0,l.length-h.raw.length)+S.raw,a=a.substring(0,a.length-p.raw.length)+S.raw,n=x.substring(s.at(-1).raw.length).split(`
67
- `);continue}}return{type:"blockquote",raw:l,tokens:s,text:a}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),l=n.length>1,a={type:"list",raw:"",ordered:l,start:l?+n.slice(0,-1):"",loose:!1,items:[]};n=l?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=l?n:"[*+-]");let s=this.rules.other.listItemRegex(n),i=!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=jj(t[2].split(`
68
- `,1)[0],t[1].length),h=e.split(`
69
- `,1)[0],p=!f.trim(),x=0;if(this.options.pedantic?(x=2,d=f.trimStart()):p?x=t[1].length+1:(x=f.search(this.rules.other.nonSpaceChar),x=x>4?1:x,d=f.slice(x),x+=t[1].length),p&&this.rules.other.blankLine.test(h)&&(u+=h+`
70
- `,e=e.substring(h.length+1),c=!0),!c){let S=this.rules.other.nextBulletRegex(x),w=this.rules.other.hrRegex(x),g=this.rules.other.fencesBeginRegex(x),y=this.rules.other.headingBeginRegex(x),m=this.rules.other.htmlBeginRegex(x),v=this.rules.other.blockquoteBeginRegex(x);for(;e;){let j=e.split(`
71
- `,1)[0],E;if(h=j,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),E=h):E=h.replace(this.rules.other.tabCharGlobal," "),g.test(h)||y.test(h)||m.test(h)||v.test(h)||S.test(h)||w.test(h))break;if(E.search(this.rules.other.nonSpaceChar)>=x||!h.trim())d+=`
72
- `+E.slice(x);else{if(p||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||g.test(f)||y.test(f)||w.test(f))break;d+=`
73
- `+h}p=!h.trim(),u+=j+`
74
- `,e=e.substring(j.length+1),f=E.slice(x)}}a.loose||(i?a.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(i=!0)),a.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(d),loose:!1,text:d,tokens:[]}),a.raw+=u}let r=a.items.at(-1);if(r)r.raw=r.raw.trimEnd(),r.text=r.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let c of a.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,a.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(!a.loose){let d=c.tokens.filter(h=>h.type==="space"),f=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));a.loose=f}}if(a.loose)for(let c of a.items){c.loose=!0;for(let u of c.tokens)u.type==="text"&&(u.type="paragraph")}return a}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=Fg(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," "),l=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",a=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:il(t[0],`
75
- `),href:l,title:a}}}table(e){var i;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Jg(t[1]),l=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),a=(i=t[3])!=null&&i.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
76
- `):[],s={type:"table",raw:il(t[0],`
77
- `),header:[],align:[],rows:[]};if(n.length===l.length){for(let r of l)this.rules.other.tableAlignRight.test(r)?s.align.push("right"):this.rules.other.tableAlignCenter.test(r)?s.align.push("center"):this.rules.other.tableAlignLeft.test(r)?s.align.push("left"):s.align.push(null);for(let r=0;r<n.length;r++)s.header.push({text:n[r],tokens:this.lexer.inline(n[r]),header:!0,align:s.align[r]});for(let r of a)s.rows.push(Jg(r,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:il(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=il(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=Nj(t[2],"()");if(s===-2)return;if(s>-1){let i=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,i).trim(),t[3]=""}}let l=t[2],a="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(l);s&&(l=s[1],a=s[3])}else a=t[3]?t[3].slice(1,-1):"";return l=l.trim(),this.rules.other.startAngleBracket.test(l)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?l=l.slice(1):l=l.slice(1,-1)),Pg(t,{href:l&&l.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.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 l=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),a=t[l.toLowerCase()];if(!a){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return Pg(n,a,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let l=this.rules.inline.emStrongLDelim.exec(e);if(!(!l||!l[1]&&!l[2]&&!l[3]&&!l[4]||l[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(l[1]||l[3])||!n||this.rules.inline.punctuation.exec(n))){let a=[...l[0]].length-1,s,i,r=a,c=0,u=l[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+a);(l=u.exec(t))!==null;){if(s=l[1]||l[2]||l[3]||l[4]||l[5]||l[6],!s)continue;if(i=[...s].length,l[3]||l[4]){r+=i;continue}else if((l[5]||l[6])&&a%3&&!((a+i)%3)){c+=i;continue}if(r-=i,r>0)continue;i=Math.min(i,i+r+c);let d=[...l[0]][0].length,f=e.slice(0,a+l.index+d+i);if(Math.min(a,i)%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," "),l=this.rules.other.nonSpaceChar.test(n),a=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return l&&a&&(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 l=this.rules.inline.delLDelim.exec(e);if(l&&(!l[1]||!n||this.rules.inline.punctuation.exec(n))){let a=[...l[0]].length-1,s,i,r=a,c=this.rules.inline.delRDelim;for(c.lastIndex=0,t=t.slice(-1*e.length+a);(l=c.exec(t))!==null;){if(s=l[1]||l[2]||l[3]||l[4]||l[5]||l[6],!s||(i=[...s].length,i!==a))continue;if(l[3]||l[4]){r+=i;continue}if(r-=i,r>0)continue;i=Math.min(i,i+r);let u=[...l[0]][0].length,d=e.slice(0,a+l.index+u+i),f=d.slice(a,-a);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,l;return t[2]==="@"?(n=t[1],l="mailto:"+n):(n=t[1],l=n),{type:"link",raw:t[0],text:n,href:l,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let l,a;if(t[2]==="@")l=t[0],a="mailto:"+l;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]);l=t[0],t[1]==="www."?a="http://"+t[0]:a=t[0]}return{type:"link",raw:t[0],text:l,href:a,tokens:[{type:"text",raw:l,text:l}]}}}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}}}},nn=class af{constructor(t){de(this,"tokens");de(this,"options");de(this,"state");de(this,"inlineQueue");de(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||ba,this.options.tokenizer=this.options.tokenizer||new Io,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:at,block:Dr.normal,inline:qs.normal};this.options.pedantic?(n.block=Dr.pedantic,n.inline=qs.pedantic):this.options.gfm&&(n.block=Dr.gfm,this.options.breaks?n.inline=qs.breaks:n.inline=qs.gfm),this.tokenizer.rules=n}static get rules(){return{block:Dr,inline:qs}}static lex(t,n){return new af(n).lex(t)}static lexInline(t,n){return new af(n).inlineTokens(t)}lex(t){t=t.replace(at.carriageReturn,`
80
- `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let l=this.inlineQueue[n];this.inlineTokens(l.src,l.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],l=!1){var s,i,r;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(at.tabCharGlobal," ").replace(at.spaceLine,""));let a=1/0;for(;t;){if(t.length<a)a=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let c;if((i=(s=this.options.extensions)==null?void 0:s.block)!=null&&i.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((r=this.options.extensions)!=null&&r.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);l&&(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),l=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 l=t,a=null;if(this.tokens.links){let x=Object.keys(this.tokens.links);if(x.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(l))!==null;)x.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(l))!==null;)l=l.slice(0,a.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(a=this.tokenizer.rules.inline.blockSkip.exec(l))!==null;)s=a[2]?a[2].length:0,l=l.slice(0,a.index+s)+"["+"a".repeat(a[0].length-s-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);l=((d=(u=this.options.hooks)==null?void 0:u.emStrongMask)==null?void 0:d.call({lexer:this},l))??l;let i=!1,r="",c=1/0;for(;t;){if(t.length<c)c=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}i||(r=""),i=!1;let x;if((h=(f=this.options.extensions)==null?void 0:f.inline)!=null&&h.some(w=>(x=w.call({lexer:this},t,n))?(t=t.substring(x.raw.length),n.push(x),!0):!1))continue;if(x=this.tokenizer.escape(t)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.tag(t)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.link(t)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(x.raw.length);let w=n.at(-1);x.type==="text"&&(w==null?void 0:w.type)==="text"?(w.raw+=x.raw,w.text+=x.text):n.push(x);continue}if(x=this.tokenizer.emStrong(t,l,r)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.codespan(t)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.br(t)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.del(t,l,r)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.autolink(t)){t=t.substring(x.raw.length),n.push(x);continue}if(!this.state.inLink&&(x=this.tokenizer.url(t))){t=t.substring(x.raw.length),n.push(x);continue}let S=t;if((p=this.options.extensions)!=null&&p.startInline){let w=1/0,g=t.slice(1),y;this.options.extensions.startInline.forEach(m=>{y=m.call({lexer:this},g),typeof y=="number"&&y>=0&&(w=Math.min(w,y))}),w<1/0&&w>=0&&(S=t.substring(0,w+1))}if(x=this.tokenizer.inlineText(S)){t=t.substring(x.raw.length),x.raw.slice(-1)!=="_"&&(r=x.raw.slice(-1)),i=!0;let w=n.at(-1);(w==null?void 0:w.type)==="text"?(w.raw+=x.raw,w.text+=x.text):n.push(x);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)}},Ko=class{constructor(e){de(this,"options");de(this,"parser");this.options=e||ba}space(e){return""}code({text:e,lang:t,escaped:n}){var s;let l=(s=(t||"").match(at.notSpaceStart))==null?void 0:s[0],a=e.replace(at.endingNewline,"")+`
94
- `;return l?'<pre><code class="language-'+xn(l)+'">'+(n?a:xn(a,!0))+`</code></pre>
95
- `:"<pre><code>"+(n?a:xn(a,!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,l="";for(let i=0;i<e.items.length;i++){let r=e.items[i];l+=this.listitem(r)}let a=t?"ol":"ul",s=t&&n!==1?' start="'+n+'"':"";return"<"+a+s+`>
101
- `+l+"</"+a+`>
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 a=0;a<e.header.length;a++)n+=this.tablecell(e.header[a]);t+=this.tablerow({text:n});let l="";for(let a=0;a<e.rows.length;a++){let s=e.rows[a];n="";for(let i=0;i<s.length;i++)n+=this.tablecell(s[i]);l+=this.tablerow({text:n})}return l&&(l=`<tbody>${l}</tbody>`),`<table>
105
- <thead>
106
- `+t+`</thead>
107
- `+l+`</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>${xn(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 l=this.parser.parseInline(n),a=Wg(e);if(a===null)return l;e=a;let s='<a href="'+e+'"';return t&&(s+=' title="'+xn(t)+'"'),s+=">"+l+"</a>",s}image({href:e,title:t,text:n,tokens:l}){l&&(n=this.parser.parseInline(l,this.parser.textRenderer));let a=Wg(e);if(a===null)return xn(n);e=a;let s=`<img src="${e}" alt="${xn(n)}"`;return t&&(s+=` title="${xn(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:xn(e.text)}},Oh=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}},ln=class sf{constructor(t){de(this,"options");de(this,"renderer");de(this,"textRenderer");this.options=t||ba,this.options.renderer=this.options.renderer||new Ko,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Oh}static parse(t,n){return new sf(n).parse(t)}static parseInline(t,n){return new sf(n).parseInline(t)}parse(t){var l,a;this.renderer.parser=this;let n="";for(let s=0;s<t.length;s++){let i=t[s];if((a=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&a[i.type]){let c=i,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 r=i;switch(r.type){case"space":{n+=this.renderer.space(r);break}case"hr":{n+=this.renderer.hr(r);break}case"heading":{n+=this.renderer.heading(r);break}case"code":{n+=this.renderer.code(r);break}case"table":{n+=this.renderer.table(r);break}case"blockquote":{n+=this.renderer.blockquote(r);break}case"list":{n+=this.renderer.list(r);break}case"checkbox":{n+=this.renderer.checkbox(r);break}case"html":{n+=this.renderer.html(r);break}case"def":{n+=this.renderer.def(r);break}case"paragraph":{n+=this.renderer.paragraph(r);break}case"text":{n+=this.renderer.text(r);break}default:{let c='Token with "'+r.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 a,s;this.renderer.parser=this;let l="";for(let i=0;i<t.length;i++){let r=t[i];if((s=(a=this.options.extensions)==null?void 0:a.renderers)!=null&&s[r.type]){let u=this.options.extensions.renderers[r.type].call({parser:this},r);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){l+=u||"";continue}}let c=r;switch(c.type){case"escape":{l+=n.text(c);break}case"html":{l+=n.html(c);break}case"link":{l+=n.link(c);break}case"image":{l+=n.image(c);break}case"checkbox":{l+=n.checkbox(c);break}case"strong":{l+=n.strong(c);break}case"em":{l+=n.em(c);break}case"codespan":{l+=n.codespan(c);break}case"br":{l+=n.br(c);break}case"del":{l+=n.del(c);break}case"text":{l+=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 l}},Ir,Ks=(Ir=class{constructor(e){de(this,"options");de(this,"block");this.options=e||ba}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?nn.lex:nn.lexInline}provideParser(e=this.block){return e?ln.parse:ln.parseInline}},de(Ir,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),de(Ir,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Ir),Ej=class{constructor(...e){de(this,"defaults",Ch());de(this,"options",this.setOptions);de(this,"parse",this.parseMarkdown(!0));de(this,"parseInline",this.parseMarkdown(!1));de(this,"Parser",ln);de(this,"Renderer",Ko);de(this,"TextRenderer",Oh);de(this,"Lexer",nn);de(this,"Tokenizer",Io);de(this,"Hooks",Ks);this.use(...e)}walkTokens(e,t){var l,a;let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let i=s;for(let r of i.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of i.rows)for(let c of r)n=n.concat(this.walkTokens(c.tokens,t));break}case"list":{let i=s;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=s;(a=(l=this.defaults.extensions)==null?void 0:l.childTokens)!=null&&a[i.type]?this.defaults.extensions.childTokens[i.type].forEach(r=>{let c=i[r].flat(1/0);n=n.concat(this.walkTokens(c,t))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let l={...n};if(l.async=this.defaults.async||l.async||!1,n.extensions&&(n.extensions.forEach(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){let s=t.renderers[a.name];s?t.renderers[a.name]=function(...i){let r=a.renderer.apply(this,i);return r===!1&&(r=s.apply(this,i)),r}:t.renderers[a.name]=a.renderer}if("tokenizer"in a){if(!a.level||a.level!=="block"&&a.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[a.level];s?s.unshift(a.tokenizer):t[a.level]=[a.tokenizer],a.start&&(a.level==="block"?t.startBlock?t.startBlock.push(a.start):t.startBlock=[a.start]:a.level==="inline"&&(t.startInline?t.startInline.push(a.start):t.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(t.childTokens[a.name]=a.childTokens)}),l.extensions=t),n.renderer){let a=this.defaults.renderer||new Ko(this.defaults);for(let s in n.renderer){if(!(s in a))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let i=s,r=n.renderer[i],c=a[i];a[i]=(...u)=>{let d=r.apply(a,u);return d===!1&&(d=c.apply(a,u)),d||""}}l.renderer=a}if(n.tokenizer){let a=this.defaults.tokenizer||new Io(this.defaults);for(let s in n.tokenizer){if(!(s in a))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let i=s,r=n.tokenizer[i],c=a[i];a[i]=(...u)=>{let d=r.apply(a,u);return d===!1&&(d=c.apply(a,u)),d}}l.tokenizer=a}if(n.hooks){let a=this.defaults.hooks||new Ks;for(let s in n.hooks){if(!(s in a))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let i=s,r=n.hooks[i],c=a[i];Ks.passThroughHooks.has(s)?a[i]=u=>{if(this.defaults.async&&Ks.passThroughHooksRespectAsync.has(s))return(async()=>{let f=await r.call(a,u);return c.call(a,f)})();let d=r.call(a,u);return c.call(a,d)}:a[i]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await r.apply(a,u);return f===!1&&(f=await c.apply(a,u)),f})();let d=r.apply(a,u);return d===!1&&(d=c.apply(a,u)),d}}l.hooks=a}if(n.walkTokens){let a=this.defaults.walkTokens,s=n.walkTokens;l.walkTokens=function(i){let r=[];return r.push(s.call(this,i)),a&&(r=r.concat(a.call(this,i))),r}}this.defaults={...this.defaults,...l}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return nn.lex(e,t??this.defaults)}parser(e,t){return ln.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let l={...n},a={...this.defaults,...l},s=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&l.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(a.hooks&&(a.hooks.options=a,a.hooks.block=e),a.async)return(async()=>{let i=a.hooks?await a.hooks.preprocess(t):t,r=await(a.hooks?await a.hooks.provideLexer(e):e?nn.lex:nn.lexInline)(i,a),c=a.hooks?await a.hooks.processAllTokens(r):r;a.walkTokens&&await Promise.all(this.walkTokens(c,a.walkTokens));let u=await(a.hooks?await a.hooks.provideParser(e):e?ln.parse:ln.parseInline)(c,a);return a.hooks?await a.hooks.postprocess(u):u})().catch(s);try{a.hooks&&(t=a.hooks.preprocess(t));let i=(a.hooks?a.hooks.provideLexer(e):e?nn.lex:nn.lexInline)(t,a);a.hooks&&(i=a.hooks.processAllTokens(i)),a.walkTokens&&this.walkTokens(i,a.walkTokens);let r=(a.hooks?a.hooks.provideParser(e):e?ln.parse:ln.parseInline)(i,a);return a.hooks&&(r=a.hooks.postprocess(r)),r}catch(i){return s(i)}}}onError(e,t){return n=>{if(n.message+=`
112
- Please report this to https://github.com/markedjs/marked.`,e){let l="<p>An error occurred:</p><pre>"+xn(n.message+"",!0)+"</pre>";return t?Promise.resolve(l):l}if(t)return Promise.reject(n);throw n}}},ua=new Ej;function ye(e,t){return ua.parse(e,t)}ye.options=ye.setOptions=function(e){return ua.setOptions(e),ye.defaults=ua.defaults,zv(ye.defaults),ye};ye.getDefaults=Ch;ye.defaults=ba;ye.use=function(...e){return ua.use(...e),ye.defaults=ua.defaults,zv(ye.defaults),ye};ye.walkTokens=function(e,t){return ua.walkTokens(e,t)};ye.parseInline=ua.parseInline;ye.Parser=ln;ye.parser=ln.parse;ye.Renderer=Ko;ye.TextRenderer=Oh;ye.Lexer=nn;ye.lexer=nn.lex;ye.Tokenizer=Io;ye.Hooks=Ks;ye.parse=ye;ye.options;ye.setOptions;ye.use;ye.walkTokens;ye.parseInline;ln.parse;nn.lex;function Hh(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m${t%60}s`}function Ai(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(1)}M`}function yn(e){return new Date(e).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Cj(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 l=Math.floor(n/60);if(l<60)return`${l}m ago`;const a=Math.floor(l/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function Vv(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 l=n[0],a=n[1],s=typeof a=="object"?JSON.stringify(a,null,2):String(a);return`${l}: ${s}`}return t.map(([n,l])=>{const a=typeof l=="object"?JSON.stringify(l,null,2):String(l);return`${n}: ${a}`}).join(`
113
- `)}function Xv(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(([l,a])=>`${l}: ${String(a).slice(0,60)}`).join(", ")}function em(e){return e<1e3?String(e):`${(e/1e3).toFixed(1)}k`}function Mj({onSend:e,onCancel:t,cmdInput:n,onClearCmdInput:l,totalTokens:a,contextTokens:s,costUsd:i}){const{providers:r,get:c}=Eh(),u=c("current_provider"),d=c("model"),f=r.find(g=>g.name===u&&g.configured)||r.find(g=>g.configured)||{name:"none"},[h,p]=b.useState(""),x=b.useRef(null);b.useEffect(()=>{n&&(p(n),setTimeout(()=>{x.current&&(x.current.focus(),x.current.selectionStart=x.current.selectionEnd=n.length)},50),l==null||l())},[n,l]);const S=b.useCallback(()=>{const g=x.current;g&&(g.style.height="",g.style.height=Math.min(g.scrollHeight,160)+"px")},[]),w=b.useCallback(g=>{if(g.key==="Enter"&&!g.shiftKey){g.preventDefault();const y=h.trim();if(!y)return;e(y),p(""),setTimeout(()=>{x.current&&(x.current.style.height="")},0)}},[h,e]);return o.jsx("div",{className:"px-5 pt-3 pb-7 md:pb-3 bg-transparent",children:o.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:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-[10.5px]",children:[o.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0",style:{background:u?"var(--green)":"var(--muted2)",opacity:u?1:.3}}),o.jsx("span",{style:{color:"var(--gold)",opacity:.8},children:f.name}),o.jsx("span",{className:"text-muted",children:" · "}),o.jsx("span",{className:"text-muted",children:d||"no model set"})]}),o.jsx("textarea",{ref:x,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:h,onChange:g=>{p(g.target.value),S()},onKeyDown:w}),o.jsxs("div",{className:"flex items-center px-3 pb-2.5 pt-1",children:[a!==void 0?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"text-[10px] text-muted font-mono",style:{opacity:.6},children:[em(a)," tokens"]}),o.jsx("span",{className:"opacity-30 mx-1",children:" · "}),o.jsxs("span",{className:"text-[10px] text-muted font-mono",style:{opacity:.6},children:["ctx ",em(s??0)]}),o.jsx("span",{className:"opacity-30 mx-1",children:" · "}),o.jsxs("span",{className:"text-[10px] text-muted font-mono",style:{color:"var(--green)",opacity:.6},children:["$",(i??0).toFixed(4)]}),o.jsx("div",{className:"flex-1"})]}):null,t?o.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:o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.5"})})}):o.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 g=h.trim();g&&(e(g),p(""))},children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#1a1410",strokeWidth:"2.5",children:[o.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),o.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]})})}const _j=["line","area","bar","stacked-bar","scatter"];function Tj(e){if(!e||typeof e!="object")return!1;const t=e;if(typeof t.type!="string"||!_j.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 l=n;if(typeof l.name!="string"||!Array.isArray(l.points)||l.points.length===0)return!1;for(const a of l.points){if(!a||typeof a!="object")return!1;const s=a;if(typeof s.x!="string"&&typeof s.x!="number"||typeof s.y!="number"||!Number.isFinite(s.y))return!1}}return!0}const tm=["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 yt(e){return tm[e%tm.length]}function Aj({spec:e,renderChart:t,renderTable:n,height:l=220}){const a=b.useRef(null),[s,i]=b.useState(0),[r,c]=b.useState(!1);b.useEffect(()=>{const d=a.current;if(!d)return;const f=new ResizeObserver(h=>{var x;const p=(x=h[0])==null?void 0:x.contentRect.width;p&&i(Math.max(240,Math.floor(p)))});return f.observe(d),()=>f.disconnect()},[]);const u=e.series.length>1;return o.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:o.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:[o.jsxs("div",{className:"flex items-start justify-between gap-3 mb-1.5",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"text-[13px] font-display font-semibold truncate",style:{color:"var(--chart-ink)"},children:e.title}),e.subtitle&&o.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--chart-ink-muted)"},children:e.subtitle})]}),o.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.normalize&&o.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"}),o.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:r?"Chart":"Table"})]})]}),u&&o.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1 mb-2",children:e.series.map((d,f)=>o.jsxs("div",{className:"flex items-center gap-1.5 text-[10.5px]",style:{color:"var(--chart-ink-muted)"},children:[o.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full shrink-0",style:{background:yt(f)}}),d.name]},d.name))}),o.jsx("div",{ref:a,className:"w-full",style:{minHeight:l},children:r?n():s>0?t(s,l):null}),e.note&&o.jsx("div",{className:"mt-2 text-[10.5px] italic",style:{color:"var(--chart-ink-muted)"},children:e.note})]})})}function Dj(e,t,n=.3){const[l,a]=t,s=a-l,i=e>0?s/e:s,r=Math.max(1,i*(1-n));return{step:i,bandWidth:r,center:c=>l+i*c+i/2,start:c=>l+i*c+(i-r)/2}}function nm(e,t){const n=e||1,l=Math.floor(Math.log10(n)),a=n/Math.pow(10,l);let s;return t?a<1.5?s=1:a<3?s=2:a<7?s=5:s=10:a<=1?s=1:a<=2?s=2:a<=5?s=5:s=10,s*Math.pow(10,l)}function Wo(e,t,n=5){let l=e,a=t;if(l===a){const d=Math.abs(l)*.1||1;l-=d,a+=d}const s=nm(a-l,!1),i=nm(s/Math.max(1,n-1),!0),r=Math.floor(l/i)*i,c=Math.ceil(a/i)*i,u=[];for(let d=r;d<=c+i*.5;d+=i)u.push(Math.round(d*1e10)/1e10);return u}function zj(e){var l;if(e.length===0)return 1;const t=Math.max(...e.map(a=>a.points.length));let n=0;for(let a=0;a<t;a++){let s=0;for(const i of e)s+=((l=i.points[a])==null?void 0:l.y)??0;s>n&&(n=s)}return n||1}function Rj(e){return e.map(t=>{var l;const n=(l=t.points[0])==null?void 0:l.y;return n?{...t,points:t.points.map(a=>({x:a.x,y:a.y/n*100}))}:t})}function Gv(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 Oj(e){return Math.abs(e)>=1e3?`$${Gv(e)}`:`$${e.toLocaleString(void 0,{maximumFractionDigits:2})}`}function Hj(e){const t=["B","KB","MB","GB","TB"];let n=Math.abs(e),l=0;for(;n>=1024&&l<t.length-1;)n/=1024,l++;return`${e<0?"-":""}${n.toFixed(n<10&&l>0?1:0)} ${t[l]}`}function Zn(e,t){switch(t){case"compact":return Gv(e);case"currency":return Oj(e);case"percent":return`${(e*100).toFixed(1)}%`;case"bytes":return Hj(e);case"number":default:return e.toLocaleString()}}function $h({data:e,chartWidth:t}){if(!e)return null;const n=e.x>t*.6;return o.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:[o.jsx("div",{className:"font-semibold mb-1",style:{color:"var(--chart-ink-muted)"},children:e.label}),e.rows.map((l,a)=>o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"inline-block w-2 h-2 rounded-full shrink-0",style:{background:l.color}}),o.jsxs("span",{children:[l.name,":"]}),o.jsx("span",{className:"font-semibold ml-auto pl-2",style:{color:"var(--chart-ink)"},children:l.value})]},a))]})}function $j({spec:e,width:t,height:n}){var V;const[l,a]=b.useState(null),s=e.type==="area",i=44,r=12,c=12,u=24,d=Math.max(10,t-i-r),f=Math.max(10,n-c-u),h=e.normalize?Rj(e.series):e.series,p=((V=h[0])==null?void 0:V.points)??[],x=p.length,S=h.flatMap(N=>N.points.map(z=>z.y)),w=Wo(Math.min(0,...S),Math.max(...S,1),5),g=w[0],m=w[w.length-1]-g||1,v=N=>x>1?i+N/(x-1)*d:i+d/2,j=N=>c+f-(N-g)/m*f,E=h.map(N=>N.points.map((z,k)=>`${k===0?"M":"L"} ${v(k)} ${j(z.y)}`).join(" ")),M=s?h.map((N,z)=>{const k=E[z],R=v(N.points.length-1),D=v(0);return`${k} L ${R} ${c+f} L ${D} ${c+f} Z`}):[],T=e.series.length>1&&e.series.length<=4,C=N=>{const z=N.currentTarget.getBoundingClientRect(),k=N.clientX-z.left,R=x>1?Math.round((k-i)/d*(x-1)):0;a(Math.min(x-1,Math.max(0,R)))},H=l!==null&&p[l]?{x:v(l),y:j(Math.max(...h.map(N=>{var z;return((z=N.points[l])==null?void 0:z.y)??g}))),label:String(p[l].x),rows:e.series.map((N,z)=>{var D,O,q;const k=(D=N.points[l])==null?void 0:D.y;if(k===void 0)return{name:N.name,value:"—",color:yt(z)};if(!e.normalize)return{name:N.name,value:Zn(k,e.y_format),color:yt(z)};const R=((q=(O=h[z])==null?void 0:O.points[l])==null?void 0:q.y)??0;return{name:N.name,value:`${Zn(k,e.y_format)} (${R.toFixed(1)})`,color:yt(z)}})}:null,A=Math.floor((x-1)/2),$=x>0?Array.from(new Set([0,A,x-1])):[];return o.jsxs("div",{className:"relative",style:{width:"100%",height:n},children:[o.jsxs("svg",{width:t,height:n,className:"overflow-visible",children:[o.jsx("defs",{children:e.series.map((N,z)=>o.jsxs("linearGradient",{id:`chart-grad-${z}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[o.jsx("stop",{offset:"0%",stopColor:yt(z),stopOpacity:"0.22"}),o.jsx("stop",{offset:"100%",stopColor:yt(z),stopOpacity:"0"})]},z))}),w.map((N,z)=>{const k=j(N);return o.jsxs("g",{children:[o.jsx("line",{x1:i,y1:k,x2:t-r,y2:k,stroke:"var(--chart-grid)",strokeWidth:"1"}),o.jsx("text",{x:i-8,y:k+3.5,textAnchor:"end",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace"},children:e.normalize?N.toFixed(0):Zn(N,e.y_format)})]},z)}),o.jsx("line",{x1:i,y1:c+f,x2:t-r,y2:c+f,stroke:"var(--chart-axis)",strokeWidth:"1"}),$.map(N=>{var z;return o.jsx("text",{x:v(N),y:n-6,textAnchor:N===0?"start":N===x-1?"end":"middle",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace",opacity:.7},children:String(((z=p[N])==null?void 0:z.x)??"")},N)}),s&&M.map((N,z)=>o.jsx("path",{d:N,fill:`url(#chart-grad-${z})`},`area-${z}`)),E.map((N,z)=>o.jsx("path",{d:N,fill:"none",stroke:yt(z),strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},`line-${z}`)),h.map((N,z)=>{const k=N.points[N.points.length-1];if(!k)return null;const R=v(N.points.length-1),D=j(k.y),O=Math.min(R+6,t-r-4),q=O>t-r-34;return o.jsxs("g",{children:[o.jsx("circle",{cx:R,cy:D,r:"3",fill:yt(z),stroke:"var(--s1)",strokeWidth:"1.5"}),T&&o.jsx("text",{x:q?t-r:O,y:D+3,textAnchor:q?"end":"start",style:{fill:"var(--chart-ink)",fontSize:9.5,fontWeight:600,fontFamily:"inherit"},children:N.name})]},`endpoint-${z}`)}),H&&o.jsx("line",{x1:H.x,y1:c,x2:H.x,y2:c+f,stroke:"var(--chart-axis)",strokeWidth:"1",strokeOpacity:"0.6"}),o.jsx("rect",{x:i,y:c,width:d,height:f,fill:"transparent",onMouseMove:C,onMouseLeave:()=>a(null),style:{cursor:"crosshair"}})]}),o.jsx($h,{data:H,chartWidth:t})]})}function Lj({spec:e,width:t,height:n}){var T;const[l,a]=b.useState(null),s=e.type==="stacked-bar",i=44,r=12,c=12,u=24,d=Math.max(10,t-i-r),f=Math.max(10,n-c-u),h=((T=e.series[0])==null?void 0:T.points)??[],p=h.length,x=s?zj(e.series):Math.max(...e.series.flatMap(C=>C.points.map(H=>H.y)),1),S=Wo(0,x,5),w=S[S.length-1],g=C=>c+f-C/(w||1)*f,y=Dj(p,[i,i+d],.3),m=2,v=e.series.length,j=s?y.bandWidth:Math.max(2,(y.bandWidth-m*(v-1))/v),E=l!==null&&h[l]?{x:y.center(l),y:c,label:String(h[l].x),rows:e.series.map((C,H)=>{var A;return{name:C.name,value:Zn(((A=C.points[l])==null?void 0:A.y)??0,e.y_format),color:yt(H)}})}:null,M=Math.floor((p-1)/2);return o.jsxs("div",{className:"relative",style:{width:"100%",height:n},children:[o.jsxs("svg",{width:t,height:n,className:"overflow-visible",children:[S.map((C,H)=>{const A=g(C);return o.jsxs("g",{children:[o.jsx("line",{x1:i,y1:A,x2:t-r,y2:A,stroke:"var(--chart-grid)",strokeWidth:"1"}),o.jsx("text",{x:i-8,y:A+3.5,textAnchor:"end",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace"},children:Zn(C,e.y_format)})]},H)}),o.jsx("line",{x1:i,y1:c+f,x2:t-r,y2:c+f,stroke:"var(--chart-axis)",strokeWidth:"1"}),h.map((C,H)=>p<=1||H===0||H===p-1||H===M?o.jsx("text",{x:y.center(H),y:n-6,textAnchor:"middle",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace",opacity:.7},children:String(C.x)},`label-${H}`):null),h.map((C,H)=>{const A=y.start(H);let $=c+f;return o.jsxs("g",{onMouseEnter:()=>a(H),onMouseLeave:()=>a(null),children:[o.jsx("rect",{x:y.center(H)-y.step/2,y:c,width:y.step,height:f,fill:"transparent"}),e.series.map((V,N)=>{var O;const z=((O=V.points[H])==null?void 0:O.y)??0;if(z<=0)return null;const k=z/(w||1)*f;let R,D;return s?(R=A,D=$-k-(N>0?m:0),$=D):(R=A+N*(j+m),D=c+f-k),o.jsx("rect",{x:R,y:D,width:j,height:k,rx:"2",fill:yt(N)},N)})]},`group-${H}`)}),E&&o.jsx("line",{x1:E.x,y1:c,x2:E.x,y2:c+f,stroke:"var(--chart-axis)",strokeWidth:"1",strokeOpacity:"0.4"})]}),o.jsx($h,{data:E,chartWidth:t})]})}function Xu(e,t){if(typeof e=="number")return e;const n=Number(e);return Number.isFinite(n)?n:t}function Bj({spec:e,width:t,height:n}){var M,T;const[l,a]=b.useState(null),s=48,i=16,r=14,c=26,u=Math.max(10,t-s-i),d=Math.max(10,n-r-c),f=e.series.flatMap(C=>C.points.map((H,A)=>Xu(H.x,A))),h=e.series.flatMap(C=>C.points.map(H=>H.y)),p=Wo(Math.min(...f),Math.max(...f),4),x=Wo(Math.min(0,...h),Math.max(...h,1),5),S=p[0],w=p[p.length-1],g=x[0],y=x[x.length-1],m=C=>s+(C-S)/(w-S||1)*u,v=C=>r+d-(C-g)/(y-g||1)*d,j=l?(M=e.series[l.si])==null?void 0:M.points[l.pi]:void 0,E=l&&j?{x:m(Xu(j.x,l.pi)),y:v(j.y),label:((T=e.series[l.si])==null?void 0:T.name)??"",rows:[{name:e.x_label||"x",value:String(j.x),color:yt(l.si)},{name:e.y_label||"y",value:Zn(j.y,e.y_format),color:yt(l.si)}]}:null;return o.jsxs("div",{className:"relative",style:{width:"100%",height:n},children:[o.jsxs("svg",{width:t,height:n,className:"overflow-visible",children:[x.map((C,H)=>{const A=v(C);return o.jsxs("g",{children:[o.jsx("line",{x1:s,y1:A,x2:t-i,y2:A,stroke:"var(--chart-grid)",strokeWidth:"1"}),o.jsx("text",{x:s-8,y:A+3.5,textAnchor:"end",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace"},children:Zn(C,e.y_format)})]},`y-${H}`)}),p.map((C,H)=>o.jsx("text",{x:m(C),y:n-6,textAnchor:"middle",style:{fill:"var(--chart-ink-muted)",fontSize:9.5,fontFamily:"monospace",opacity:.7},children:Zn(C)},`x-${H}`)),o.jsx("line",{x1:s,y1:r+d,x2:t-i,y2:r+d,stroke:"var(--chart-axis)",strokeWidth:"1"}),o.jsx("line",{x1:s,y1:r,x2:s,y2:r+d,stroke:"var(--chart-axis)",strokeWidth:"1"}),e.series.map((C,H)=>C.points.map((A,$)=>{const V=m(Xu(A.x,$)),N=v(A.y);return o.jsxs("g",{children:[o.jsx("circle",{cx:V,cy:N,r:"12",fill:"transparent",onMouseEnter:()=>a({si:H,pi:$}),onMouseLeave:()=>a(null),style:{cursor:"pointer"}}),o.jsx("circle",{cx:V,cy:N,r:"4",fill:yt(H),stroke:"var(--s1)",strokeWidth:"1.5"})]},`${H}-${$}`)})),E&&l&&o.jsx("circle",{cx:E.x,cy:E.y,r:"7",fill:"none",stroke:yt(l.si),strokeWidth:"1.5"})]}),o.jsx($h,{data:E,chartWidth:t})]})}function Uj({spec:e}){var n;const t=((n=e.series[0])==null?void 0:n.points.map(l=>l.x))??[];return o.jsxs("div",{children:[o.jsx("div",{className:"overflow-x-auto overflow-y-auto max-h-[260px] scrollbar-thin",children:o.jsxs("table",{className:"w-full text-[11.5px] font-mono",children:[o.jsx("thead",{children:o.jsxs("tr",{style:{borderBottom:"1px solid var(--b1)"},children:[o.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(l=>o.jsx("th",{className:"text-right py-1.5 pl-3 font-medium",style:{color:"var(--chart-ink-muted)"},children:l.name},l.name))]})}),o.jsx("tbody",{children:t.map((l,a)=>o.jsxs("tr",{style:{borderBottom:"1px solid color-mix(in srgb, var(--b1) 40%, transparent)"},children:[o.jsx("td",{className:"py-1 pr-3",style:{color:"var(--chart-ink)",fontVariantNumeric:"tabular-nums"},children:String(l)}),e.series.map(s=>{var i;return o.jsx("td",{className:"text-right py-1 pl-3",style:{color:"var(--chart-ink)",fontVariantNumeric:"tabular-nums"},children:Zn(((i=s.points[a])==null?void 0:i.y)??0,e.y_format)},s.name)})]},a))})]})}),e.normalize&&o.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 qj(){return o.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:o.jsxs("div",{className:"rounded-xl p-4 flex items-center gap-2",style:{background:"var(--s2)",border:"1px solid var(--b1)"},children:[o.jsx("div",{className:"w-[6px] h-[6px] rounded-full shrink-0 animate-pulse",style:{background:"var(--muted)"}}),o.jsx("div",{className:"text-[11.5px]",style:{color:"var(--muted)"},children:"Rendering chart…"})]})})}function lm({message:e,raw:t}){return o.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:o.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:[o.jsx("div",{className:"text-[12px] font-semibold mb-1.5",style:{color:"var(--red)"},children:"Chart could not be rendered"}),o.jsx("div",{className:"text-[11.5px] mb-2",style:{color:"var(--text)"},children:e}),o.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 Yj({spec:e}){const t=(n,l)=>{switch(e.type){case"line":case"area":return o.jsx($j,{spec:e,width:n,height:l});case"bar":case"stacked-bar":return o.jsx(Lj,{spec:e,width:n,height:l});case"scatter":return o.jsx(Bj,{spec:e,width:n,height:l});default:return null}};return o.jsx(Aj,{spec:e,renderChart:t,renderTable:()=>o.jsx(Uj,{spec:e})})}function Vj({spec:e,error:t,pending:n,rawInput:l}){return t?o.jsx(lm,{message:t,raw:l??e}):n?o.jsx(qj,{}):Tj(e)?o.jsx(Yj,{spec:e}):o.jsx(lm,{message:"The chart data did not match the expected format.",raw:l??e})}const am=["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 sm(){return am[Math.floor(Math.random()*am.length)]}function Qv({content:e}){const[t,n]=b.useState(!0);return o.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:o.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:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{background:"color-mix(in srgb, var(--s2) 80%, transparent)"},children:[o.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:[o.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"}),o.jsx("circle",{cx:"9",cy:"9",r:"1",fill:"currentColor"}),o.jsx("circle",{cx:"15",cy:"9",r:"1",fill:"currentColor"})]}),o.jsx("span",{className:"text-[11.5px] font-medium text-text font-mono",children:t?"Hide thinking":"Show thinking"}),o.jsx("div",{className:"flex-1"}),o.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:o.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),t&&o.jsx("div",{className:"px-3 py-2.5",style:{borderTop:"1px solid var(--b1)",background:"color-mix(in srgb, var(--s1) 60%, transparent)"},children:o.jsx("pre",{className:"text-[11px] text-muted leading-relaxed whitespace-pre-wrap font-mono max-h-[300px] overflow-y-auto",children:e})})]})})}function Zv({toolCalls:e}){const[t,n]=b.useState(!1);return o.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:o.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:[o.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:[o.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:o.jsxs("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",style:{opacity:.7},children:[o.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),o.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),o.jsxs("span",{className:"text-[11.5px] font-medium text-text font-mono",children:[e.length," tool call",e.length>1?"s":""]}),o.jsx("div",{className:"flex-1"}),o.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:o.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),t&&e.map((l,a)=>o.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:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("span",{className:"text-[11.5px] font-semibold font-mono",style:{color:"var(--gold)"},children:l.name}),o.jsx("span",{className:"text-xs text-muted font-mono truncate max-w-[250px]",children:l.args})]}),o.jsx("pre",{className:"text-[11px] text-muted font-mono leading-[1.5] overflow-x-auto whitespace-pre-wrap",children:l.input?Vv(l.input):""})]},a))]})})}function Xj({event:e}){const[t,n]=b.useState(!1);return o.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:o.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:[o.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:[o.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:o.jsx("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"1.5",children:o.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"})})}),o.jsxs("span",{className:"text-[11.5px] font-semibold text-fg font-mono",children:["Heartbeat Brief (",e.scheduleType,")"]}),o.jsx("div",{className:"flex-1"}),o.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:o.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),t&&o.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:o.jsx("div",{dangerouslySetInnerHTML:{__html:Jo(e.formattedText||"")}})})]})})}function Gj({message:e,time:t}){return o.jsx("div",{className:"px-3 py-1.5 animate-fadeIn",children:o.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:[o.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)"}}),o.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:[o.jsx("span",{className:"absolute inset-0 rounded-lg animate-ping opacity-50",style:{background:"color-mix(in srgb, var(--gold) 20%, transparent)",animationDuration:"2s"}}),o.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"animate-wiggle",children:[o.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),o.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]})]}),o.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1 select-none",children:[o.jsx("span",{className:"font-bold text-xs tracking-wide uppercase",style:{color:"var(--gold)"},children:"Reminder Fired"}),o.jsx("span",{className:"text-[10px] text-muted font-mono",children:t})]}),o.jsx("div",{className:"text-[13px] text-text leading-relaxed font-semibold",children:e})]})]})})}function Qj(e,t){const n=e.find(l=>l.type==="tool-result"&&l.toolCallId===t);if(n)return{output:n.output,error:n.error}}function Zj(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>")}ye.setOptions({gfm:!0,breaks:!0});function Jo(e){try{return ye.parse(e)}catch{return Zj(e)}}function Iv({toolCallId:e,name:t,input:n,decision:l,events:a,rpc:s,mode:i}){const[r,c]=b.useState(!1),[u,d]=b.useState(null),f=a.find(S=>S.type==="approval-decision"&&S.toolCallId===e),h=f?f.decision:u,p=l==="ask"&&!h,x=async S=>{if(s){c(!0);try{await s.approvalDecide(e,S),d(S)}catch(w){console.error("Failed to submit tool approval decision:",w)}finally{c(!1)}}};if(!p){const S=h==="allow";return o.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2.5 animate-fadeIn select-none",children:[o.jsx("div",{className:`flex items-center justify-center w-5 h-5 rounded-full ${S?"bg-green-500/10 text-green-500":"bg-red-500/10 text-red-500"} shrink-0`,children:o.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:S?o.jsx("polyline",{points:"20 6 9 17 4 12"}):o.jsxs(o.Fragment,{children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),o.jsxs("div",{className:"flex items-baseline gap-1.5 text-xs text-muted",children:[o.jsx("span",{className:"font-semibold text-fg",children:S?"Authorized":"Blocked"}),o.jsx("span",{children:"action:"}),o.jsx("code",{className:"font-mono bg-s3 border border-b1 px-1.5 py-0.5 rounded text-[11px] text-fg",children:t})]})]})}return i==="auto"?null:o.jsx("div",{className:"fixed inset-0 z-[999] flex items-center justify-center bg-black/60 backdrop-blur-sm p-4 animate-fadeIn",children:o.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:[o.jsxs("div",{className:"flex items-start gap-4 border-b border-b1 pb-4 mb-4",children:[o.jsx("div",{className:"flex items-center justify-center w-10 h-10 rounded-xl bg-yellow-500/10 text-yellow-500 shrink-0",children:o.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:o.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"font-bold text-fg text-base block mb-0.5",children:"Authorization Required"}),o.jsx("span",{className:"text-[12px] text-muted",children:"The agent requires permission to run this action."})]})]}),o.jsxs("div",{className:"mb-4",children:[o.jsx("div",{className:"text-[9px] text-muted2 font-mono uppercase tracking-wider mb-1.5 select-none",children:"Action / Tool"}),o.jsx("div",{className:"flex items-center",children:o.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})})]}),o.jsxs("div",{className:"bg-s1 rounded-xl border border-b1 p-4 mb-6 max-h-[220px] overflow-y-auto scrollbar-thin",children:[o.jsx("div",{className:"text-[9px] text-muted2 font-mono uppercase tracking-wider mb-1.5 select-none",children:"Arguments"}),o.jsx("pre",{className:"font-mono text-[11.5px] text-text overflow-x-auto m-0 leading-normal",children:Vv(n)})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("button",{onClick:()=>x("allow"),disabled:r,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:[o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:o.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Approve Action"]}),o.jsxs("button",{onClick:()=>x("deny"),disabled:r,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:[o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),"Deny"]})]})]})})}function Ij({blocks:e,blockCount:t,response:n,time:l,events:a,rpc:s}){const[i,r]=b.useState(!1);return e&&e.length>0||!!n?o.jsx("div",{className:"px-3 py-1 animate-fadeIn",children:o.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:()=>r(!i),children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{background:"var(--bg)"},children:[o.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:[o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4"}),o.jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",transform:"rotate(60 12 12)"}),o.jsx("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",transform:"rotate(120 12 12)"})]}),o.jsxs("span",{className:"text-[11.5px] font-medium text-text font-mono",children:[t," agent action",t>1?"s":""]}),n&&o.jsxs("span",{className:"text-[10px] text-muted2 font-mono truncate max-w-[120px]",title:n,children:["“",n.slice(0,60),"...","”"]}),l&&o.jsx("span",{className:"text-[10px] text-muted2 font-mono",children:l}),o.jsx("div",{className:"flex-1"}),o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`text-muted transition-transform duration-200 ${i?"rotate-180":""}`,children:o.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),i&&o.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 o.jsx(Qv,{content:u.content},d);if(u.type==="tool-group"){const f=u;return f.toolCalls.length>0?o.jsx(Zv,{toolCalls:f.toolCalls},d):null}return u.type==="approval-request"?o.jsx(Iv,{toolCallId:u.toolCallId,name:u.name,input:u.input,decision:u.decision,events:a||[],rpc:s||null,mode:u.mode},d):null}),n&&o.jsxs("div",{className:"mt-3",children:[o.jsx("div",{className:"flex items-baseline gap-2 mb-1",children:o.jsx("span",{className:"text-[10px] font-semibold text-fg",style:{color:"var(--gold)"},children:"curie-agent"})}),o.jsx("div",{className:"text-[13px] text-text leading-[1.65] markdown-body chat-msg-agent pl-3",dangerouslySetInnerHTML:{__html:Jo(n)}})]})]})]})}):null}function Kj(e){switch(e.type){case"user-prompt":return{type:"user",content:e.text||"",time:yn(e.timestamp)};case"assistant-delta":return{type:"assistant",content:e.text||"",time:yn(e.timestamp)};case"thinking-delta":return{type:"thinking",content:e.text||"",time:yn(e.timestamp)};case"heartbeat-brief":return{type:"heartbeat-brief",content:e.formattedText||"",time:yn(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:yn(e.timestamp)};const l=Xv(t,n);return{type:"tool-group",content:"",time:"",toolCalls:[{name:t,args:l,input:n}]}}case"approval-request":{const t=e.toolCallId,n=e.name||"tool";if(n==="Chart")return null;const l=e.input||{},a=e.decision,s=e.mode;return{type:"approval-request",toolCallId:t,name:n,input:l,decision:a,mode:s,time:yn(e.timestamp)}}case"cron-task-fired":{const t=e.message||"",n=e.taskId||"";return{type:"reminder-fired",message:t,taskId:n,time:yn(e.timestamp)}}case"context-warning":return{type:"assistant",content:e.message||"",time:yn(e.timestamp)};case"error":return{type:"error",content:e.message||`An error occurred (code: ${e.code||"unknown"})`,time:yn(e.timestamp)};default:return null}}function Wj(e){const t=[];let n=[],l="",a=!1,s="",i=null,r=0;const c=()=>{a&&s&&(n.push({type:"thinking",content:s,time:""}),a=!1,s="")},u=()=>{var h;if(n.length===0)return;let f=0;for(let p=r;p<n.length;p++){const x=n[p];x.type==="tool-group"?f+=((h=x.toolCalls)==null?void 0:h.length)||1:f+=1}i?(i.blocks=[...i.blocks,...n.slice(r)],i.blockCount+=f):(i={type:"agent-actions",blocks:[...n],blockCount:f,response:void 0,time:n[0].time||""},t.push(i)),r=n.length},d=()=>{c(),u(),l&&t.push({type:"assistant",content:l,time:""}),n=[],l="",i=null,r=0};for(const f of e){const h=Kj(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")l+=h.content;else if(h.type==="thinking")a=!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 Jj({cmdResult:e,rpc:t,className:n,activeSessionId:l,onCreateSession:a,onClearCmdResult:s,events:i,addLiveEvent:r,totalTokens:c,contextTokens:u,costUsd:d,onSwitchView:f}){const{ws:h,connected:p,connectionStatus:x}=_n(),[S,w]=b.useState(!1),[g,y]=b.useState(null),[m,v]=b.useState(""),j=b.useRef(null),E=b.useRef(null),[M,T]=b.useState(sm);b.useEffect(()=>{E.current&&!l&&T(sm()),E.current=l},[l]),b.useEffect(()=>{if(x==="connected")y(null);else if(x==="reconnecting")y(null);else{const N=setTimeout(()=>{y("Disconnected from daemon. Check that the daemon is running.")},2e3);return()=>clearTimeout(N)}},[p,x]);const C=b.useMemo(()=>Wj(i),[i]),H=b.useRef(!0),A=b.useCallback(()=>{j.current&&(j.current.scrollTop=j.current.scrollHeight,H.current=!0)},[]);b.useEffect(()=>{const N=j.current;if(!N)return;const z=()=>{const k=N.scrollHeight-N.scrollTop-N.clientHeight<80;H.current=k};return N.addEventListener("scroll",z,{passive:!0}),()=>N.removeEventListener("scroll",z)},[]),b.useEffect(()=>{H.current&&A()},[C,S,A]),b.useEffect(()=>{A()},[A]),b.useEffect(()=>{e&&(console.log("Command palette result:",e),v(e),s==null||s())},[e,s]);const $=b.useCallback(async N=>{var k,R;if(!t){y("Not connected to daemon. Make sure the daemon is running.");return}if(w(!0),y(null),A(),N.startsWith("/")){const D=N.match(/^\/([^\s]+)(?:\s+(.*))?$/);if(D){const O=D[1].toLowerCase(),q=(D[2]||"").trim();if(O==="heartbeat"){r({type:"user-prompt",id:`local-prompt-${Date.now()}`,timestamp:Date.now(),text:N});const X=q.toLowerCase();if(X==="now"){r({type:"assistant-delta",id:`local-running-${Date.now()}`,timestamp:Date.now(),text:"Executing immediate heartbeat cycle in background..."});try{await t.heartbeatRun(),w(!1)}catch(L){const Y=L instanceof Error?L.message:String(L);r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Heartbeat failed: ${Y}`}),w(!1)}}else if(X==="status"||X==="")try{const L=await t.heartbeatStatus(),Y=(L==null?void 0:L.schedule)==="on",_=(L==null?void 0:L.intraday)||"(not set)",U=`### Heartbeat Cycle Status:
114
- * **Enabled**: \`${Y?"yes":"no"}\`
115
- * **Intraday**: \`${_}\`
116
- * **Daily**: \`${(L==null?void 0:L.daily)||"6:00"}\`
117
- * **Weekly**: \`${(L==null?void 0:L.weekly)||"monday@6:00"}\`
118
- * **Monthly**: \`${(L==null?void 0:L.monthly)||"1@6:00"}\`
119
- * **Dreaming**: \`${(L==null?void 0:L.dreaming)||"2:00"}\`
120
-
121
- **Usage**:
122
- * \`/heartbeat enable\` / \`/heartbeat disable\`
123
- * \`/heartbeat daily <H:MM>\`
124
- * \`/heartbeat weekly <day@H:MM>\`
125
- * \`/heartbeat monthly <D@H:MM>\`
126
- * \`/heartbeat dreaming <H:MM>\`
127
- * \`/heartbeat intraday <H:MM,...>\`
128
- * \`/heartbeat now\` — run a heartbeat immediately.`;r({type:"assistant-delta",id:`local-status-${Date.now()}`,timestamp:Date.now(),text:U}),w(!1)}catch(L){const Y=L instanceof Error?L.message:String(L);r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to fetch heartbeat status: ${Y}`}),w(!1)}else if(X==="enable")try{await t.configSet("heartbeat.schedule","on"),r({type:"assistant-delta",id:`local-enable-${Date.now()}`,timestamp:Date.now(),text:"Heartbeat cycle has been enabled successfully."}),w(!1)}catch(L){const Y=L instanceof Error?L.message:String(L);r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to enable heartbeat: ${Y}`}),w(!1)}else if(X==="disable")try{await t.configSet("heartbeat.schedule","off"),r({type:"assistant-delta",id:`local-disable-${Date.now()}`,timestamp:Date.now(),text:"Heartbeat cycle has been disabled."}),w(!1)}catch(L){const Y=L instanceof Error?L.message:String(L);r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to disable heartbeat: ${Y}`}),w(!1)}else{const L=q.split(/\s+/),Y=(k=L[0])==null?void 0:k.toLowerCase(),_=L.slice(1).join(" ").trim();if(["daily","weekly","monthly","dreaming","intraday"].includes(Y))try{await t.configSet(`heartbeat.${Y}`,_),r({type:"assistant-delta",id:`local-set-${Date.now()}`,timestamp:Date.now(),text:`Heartbeat schedule for \`${Y}\` has been set to: \`${_}\``}),w(!1)}catch(G){const I=G instanceof Error?G.message:String(G);r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to set heartbeat schedule: ${I}`}),w(!1)}else r({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`."}),w(!1)}return}else if(O==="cron"){r({type:"user-prompt",id:`local-prompt-${Date.now()}`,timestamp:Date.now(),text:N});const L=q.toLowerCase().split(/\s+/),Y=L[0]||"list",_=L.slice(1).join(" ").trim();if(Y==="list"||!Y)try{const U=await t.cronList();if(!U||U.length===0)r({type:"assistant-delta",id:`local-cron-list-${Date.now()}`,timestamp:Date.now(),text:"No reminders scheduled."});else{const G=U.map((I,B)=>{const K=new Date(I.scheduledAt).toLocaleString(),W=I.status==="pending"?"⏳":I.status==="fired"?"🔔":I.status==="executing"?"⚙️":I.status==="completed"?"✅":(I.status==="failed","❌"),F=I.type==="heartbeat"?`Heartbeat: ${I.schedule?`[${I.schedule.type.toUpperCase()}] `:""}`:I.type==="task"?"Task: ":"Reminder: ";return`${B+1}. ${W} ${F}${I.message} (Scheduled: ${K}, ID: \`${I.id}\`)`}).join(`
129
- `);r({type:"assistant-delta",id:`local-cron-list-${Date.now()}`,timestamp:Date.now(),text:`### Active Reminders:
130
- ${G}`})}w(!1)}catch(U){const G=U instanceof Error?U.message:String(U);r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to fetch reminders: ${G}`}),w(!1)}else if(Y==="delete"||Y==="cancel")if(!_)r({type:"assistant-delta",id:`local-cron-del-${Date.now()}`,timestamp:Date.now(),text:"Usage: `/cron delete <id>`"}),w(!1);else try{const U=await t.cronCancel(_);U!=null&&U.cancelled?r({type:"assistant-delta",id:`local-cron-del-${Date.now()}`,timestamp:Date.now(),text:`Reminder \`${_}\` cancelled.`}):r({type:"assistant-delta",id:`local-cron-del-${Date.now()}`,timestamp:Date.now(),text:`No reminder found with ID: \`${_}\``}),w(!1)}catch(U){const G=U instanceof Error?U.message:String(U);r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to delete reminder: ${G}`}),w(!1)}else if(Y==="clear")try{const U=await t.cronClear();r({type:"assistant-delta",id:`local-cron-clear-${Date.now()}`,timestamp:Date.now(),text:`Successfully cleared ${(U==null?void 0:U.removed)||0} completed reminder(s).`}),w(!1)}catch(U){const G=U instanceof Error?U.message:String(U);r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Failed to clear reminders: ${G}`}),w(!1)}else r({type:"assistant-delta",id:`local-cron-err-${Date.now()}`,timestamp:Date.now(),text:"Unknown cron subcommand. Supported: `/cron list`, `/cron delete <id>`, `/cron clear`."}),w(!1);return}if(O==="wiki"){r({type:"user-prompt",id:`local-prompt-${Date.now()}`,timestamp:Date.now(),text:N});const X=((R=q.split(/\s+/)[0])==null?void 0:R.toLowerCase())??"",L=q.slice(X.length).trim();if(!X||X==="open")f==null||f("wiki"),w(!1);else if(X==="list")try{const Y=await t.wikiListPages(),_=(Y==null?void 0:Y.pages)??[];if(_.length===0)r({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:"Wiki is empty. Initialize with: `curie-agent wiki init`"});else{const U={};for(const I of _){const B=I.category||"other";(U[B]??(U[B]=[])).push(`${I.slug} — ${I.title}`)}const G=Object.entries(U).flatMap(([I,B])=>[`**${I}** (${B.length})`,...B.map(K=>` ${K}`)]);r({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:`### Wiki Pages (${_.length} total)
131
-
132
- ${G.join(`
133
- `)}`})}w(!1)}catch(Y){r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Wiki list failed: ${Y instanceof Error?Y.message:String(Y)}`}),w(!1)}else if(X==="search")if(!L)r({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:"Usage: `/wiki search <query>`"}),w(!1);else try{const _=await t.wikiSearch(L)??[];if(_.length===0)r({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:`No wiki results for "${L}"`});else{const U=_.slice(0,20).map(G=>` **${G.slug}**: ${G.line}`);r({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:`### Wiki Search: "${L}" (${_.length} hits)
134
-
135
- ${U.join(`
136
- `)}`})}w(!1)}catch(Y){r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Wiki search failed: ${Y instanceof Error?Y.message:String(Y)}`}),w(!1)}else if(X==="lint")try{const Y=await t.wikiLint(),_=(Y==null?void 0:Y.issues)??[];if(_.length===0)r({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:"Wiki is healthy — no issues found."});else{const U=_.map(G=>`- **[${G.type}]** ${G.slug?`\`${G.slug}\`: `:""}${G.message}`);r({type:"assistant-delta",id:`local-wiki-${Date.now()}`,timestamp:Date.now(),text:`### Wiki Lint (${_.length} issues)
137
-
138
- ${U.join(`
139
- `)}`})}w(!1)}catch(Y){r({type:"error",id:`local-err-${Date.now()}`,timestamp:Date.now(),message:`Wiki lint failed: ${Y instanceof Error?Y.message:String(Y)}`}),w(!1)}else r({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"}),w(!1);return}}}const z=l||"";try{const D=await t.sessionSend(z,N,"webui");D!=null&&D.sessionId&&!l&&(h==null||h.subscribe(D.sessionId),a==null||a(D.sessionId))}catch(D){const O=D instanceof Error?D.message:String(D);y(`Failed to send: ${O}`),w(!1)}},[t,h,l,A,a,r]);b.useEffect(()=>{h&&(h.on("assistant-stop",()=>w(!1)),h.on("error",()=>w(!1)))},[h]);const V=b.useCallback(async()=>{if(!(!t||!l)){w(!1),y(null),A();try{await t.sessionCancel(l)}catch(N){const z=N instanceof Error?N.message:String(N);y(`Failed to cancel: ${z}`)}}},[t,l,A]);return o.jsxs("div",{className:`flex flex-col h-full ${n||""}`,children:[o.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-thin",ref:j,children:[C.length===0&&o.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted",children:[o.jsx("div",{className:"text-lg mb-2 font-display",style:{color:"var(--cream)"},children:"curie"}),o.jsx("div",{className:"text-sm text-muted",children:M})]}),o.jsxs("div",{className:"py-4 pb-6",children:[C.map((N,z)=>{if(N.type==="thinking")return o.jsx(Qv,{content:N.content},`thinking-${z}`);if(N.type==="user")return o.jsx("div",{className:"flex flex-row-reverse px-3 py-0.5 animate-fadeIn transition-colors duration-100",children:o.jsxs("div",{className:"flex flex-1 flex-col items-end min-w-0",children:[o.jsxs("div",{className:"flex flex-row-reverse items-baseline gap-2 mb-1",children:[o.jsx("span",{className:"text-xs font-semibold",style:{color:"var(--cream)"},children:"you"}),o.jsx("span",{className:"text-xs text-muted font-mono",children:N.time})]}),o.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:Jo(N.content)}})]})},z);if(N.type==="tool-group"){const k=N;if(k.toolCalls.length>0)return o.jsx(Zv,{toolCalls:k.toolCalls},z)}if(N.type==="agent-actions"){const k=N;return o.jsx(Ij,{blocks:k.blocks,blockCount:k.blockCount,time:k.time,events:i,rpc:t},`agent-${k.time||z}`)}if(N.type==="approval-request")return o.jsx(Iv,{toolCallId:N.toolCallId,name:N.name,input:N.input,decision:N.decision,events:i,rpc:t,mode:N.mode},z);if(N.type==="heartbeat-brief"){const k=N;return o.jsx(Xj,{event:k.event},z)}if(N.type==="reminder-fired")return o.jsx(Gj,{message:N.message,time:N.time},z);if(N.type==="chart"){const k=Qj(i,N.toolCallId);return o.jsx(Vj,{spec:k==null?void 0:k.output,error:k==null?void 0:k.error,pending:!k,rawInput:N.rawInput},z)}return N.type==="error"?o.jsxs("div",{className:"px-3 py-0.5 animate-fadeIn transition-colors duration-100",children:[o.jsxs("div",{className:"flex items-baseline gap-2 mb-1",children:[o.jsx("span",{className:"text-xs font-semibold",style:{color:"var(--red)"},children:"error"}),o.jsx("span",{className:"text-xs text-muted font-mono",children:N.time})]}),o.jsx("div",{className:"text-[13px] text-red leading-[1.65] rounded-lg px-3 py-2 bg-red/5 border border-red/10",children:N.content})]},z):o.jsxs("div",{className:"px-3 py-0.5 animate-fadeIn transition-colors duration-100",children:[o.jsxs("div",{className:"flex items-baseline gap-2 mb-1",children:[o.jsx("span",{className:"text-xs font-semibold",style:{color:"var(--gold)"},children:"curie-agent"}),o.jsx("span",{className:"text-xs text-muted font-mono",children:N.time})]}),o.jsx("div",{className:"text-[13px] text-text leading-[1.65] markdown-body chat-msg-agent pl-3",dangerouslySetInnerHTML:{__html:Jo(N.content)}})]},z)}),S&&o.jsx("div",{className:"flex items-center px-3 py-2",children:o.jsxs("div",{className:"flex gap-1.5",children:[o.jsx("span",{className:"w-[5px] h-[5px] bg-muted2 rounded-full animate-dot inline-block",style:{animation:"tdot 1.4s infinite"}}),o.jsx("span",{className:"w-[5px] h-[5px] bg-muted2 rounded-full animate-dot inline-block",style:{animation:"tdot 1.4s infinite 0.2s"}}),o.jsx("span",{className:"w-[5px] h-[5px] bg-muted2 rounded-full animate-dot inline-block",style:{animation:"tdot 1.4s infinite 0.4s"}})]})})]})]}),o.jsxs("div",{className:"flex-shrink-0",children:[g&&o.jsx("div",{className:"px-3 py-1.5 bg-red/10 border-t border-red/20",children:o.jsx("div",{className:"text-[11px] text-red font-mono",children:g})}),o.jsx(Mj,{onSend:$,onCancel:S?V:void 0,cmdInput:m,onClearCmdInput:()=>v(""),totalTokens:c,contextTokens:u,costUsd:d})]})]})}function Fj(e,t,n,l){if(l){const[r,c]=l.split(";"),u=parseFloat(r||"0"),d=parseFloat(c||"0");if(!isNaN(u)&&!isNaN(d))return(t*u+n*d)/1e6}const a={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}},s=Object.keys(a).find(r=>e.toLowerCase().includes(r))||"sonnet",i=a[s];return(t*i.in+n*i.out)/1e6}function Pj({cmdResult:e,onClearCmdResult:t,rpc:n,className:l,activeSessionId:a,onCreateSession:s,events:i,addLiveEvent:r,onSwitchView:c}){var y;const{get:u,providers:d}=Eh(),f=u("model"),h=u("current_provider")||"anthropic",p=(y=d.find(m=>m.name===h))==null?void 0:y.model_cost;let x=0,S=0,w=0;const g=a?i.filter(m=>m.type==="usage"):[];if(g.length>0){x=g.reduce((v,j)=>v+(j.inputTokens||0)+(j.outputTokens||0),0);const m=g[g.length-1];S=m&&m.inputTokens||0,w=g.reduce((v,j)=>v+Fj(f||"sonnet",j.inputTokens||0,j.outputTokens||0,p),0)}return o.jsx("div",{className:`flex flex-col h-full ${l||""}`,children:o.jsx(Jj,{cmdResult:e,onClearCmdResult:t,rpc:n,activeSessionId:a,onCreateSession:s,events:i,addLiveEvent:r,totalTokens:x,contextTokens:S,costUsd:w,onSwitchView:c})})}function e5({rpc:e,className:t}){const[n,l]=b.useState(null),[a,s]=b.useState(null),[i,r]=b.useState(null),[c,u]=b.useState(!0);b.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])=>{l(f),s(h),r(p)}).finally(()=>u(!1))},[e]);const d=!!n&&!!a;return o.jsxs("div",{className:`flex-1 overflow-y-auto p-7 scrollbar-thin ${t||""}`,children:[o.jsxs("div",{className:"flex items-center justify-between mb-5",children:[o.jsx("h2",{className:"text-base font-semibold text-fg tracking-tight",children:"Channels"}),o.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:[o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[o.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),o.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Connect"]})]}),c?o.jsx("div",{className:"flex items-center justify-center py-10 text-muted",children:"Loading..."}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg mb-0.5 bg-s2",children:[o.jsx("div",{className:"w-8 h-8 rounded-lg bg-s3 flex items-center justify-center shrink-0 text-base",children:d?"📱":"🔌"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-[13px] font-medium text-fg",children:d?"Telegram Connected":"Not Connected"}),o.jsx("div",{className:"text-xs text-muted truncate",children:d?`Bot configured for user ${a}`:"Configure a Telegram bot to enable channel messaging"})]}),o.jsx("div",{className:`w-[6px] h-[6px] rounded-full shrink-0 ${d?"bg-green":"bg-muted2"}`})]}),d&&o.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] overflow-hidden mt-3",children:[o.jsx("div",{className:"text-[12px] font-medium text-text2 px-4 py-3 border-b border-b1",children:"Channel Configuration"}),o.jsx(Gu,{label:"Bot Token",value:(n==null?void 0:n.slice(0,12))+"..."||""}),o.jsx(Gu,{label:"User ID",value:a||""}),o.jsx(Gu,{label:"Chat ID",value:i||"not set"})]})]})]})}function Gu({label:e,value:t}){return o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-b1/50",children:[o.jsx("span",{className:"text-xs text-muted",children:e}),o.jsx("span",{className:"text-xs text-text font-mono",children:t})]})}function t5({rpc:e,className:t}){const{ws:n}=_n(),[l,a]=b.useState(null),[s,i]=b.useState([]),[r,c]=b.useState(!0),[u,d]=b.useState(null),[f,h]=b.useState(null),p=b.useRef(null),x=b.useCallback(async()=>{if(e)try{const[_,U]=await Promise.all([e.sessionStats(),e.sessionList()]);_&&a(_),Array.isArray(U)&&i(U)}catch(_){console.error("[StatsView] Failed to load statistics:",_)}},[e]);if(b.useEffect(()=>{c(!0),x().finally(()=>c(!1))},[x]),b.useEffect(()=>{if(!n)return;const _=()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(x,2e3)},U=n.on("session-stop",_),G=n.on("session-start",_);return()=>{U(),G(),p.current&&clearTimeout(p.current)}},[n,x]),r)return o.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted py-20 select-none animate-pulse",children:[o.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)"}}),o.jsx("span",{className:"text-[13px] font-mono",style:{color:"var(--gold)",opacity:.7},children:"Compiling operations telemetry..."})]});if(!l||l.summary.totalSessions===0)return o.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted py-20 select-none",children:[o.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:o.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",style:{opacity:.6},children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o.jsx("path",{d:"M21 12H3M12 3v18"})]})}),o.jsx("div",{className:"text-[14px] font-display font-semibold",style:{color:"var(--cream)"},children:"No operational data found"}),o.jsx("div",{className:"text-[11.5px] text-muted mt-1",children:"Start a conversation to generate metrics."})]});const{summary:S,hourly:w,entrypoints:g,topTools:y}=l,m=_=>_<1e3?String(_):_<1e6?`${(_/1e3).toFixed(1)}k`:`${(_/1e6).toFixed(2)}M`,v=600,j=140,E=45,M=15,T=15,C=25,H=Math.max(...w.map(_=>_.inputTokens+_.outputTokens),1),A=v-E-M,$=j-T-C,V=w.map((_,U)=>{const G=_.inputTokens+_.outputTokens,I=E+U/23*A,B=T+$-G/H*$;return{x:I,y:B,..._}}),N=V.length>0?`${V.map((_,U)=>`${U===0?"M":"L"} ${_.x} ${_.y}`).join(" ")} L ${V[V.length-1].x} ${T+$} L ${V[0].x} ${T+$} Z`:"",z=V.length>0?V.map((_,U)=>`${U===0?"M":"L"} ${_.x} ${_.y}`).join(" "):"",k=600,R=140,D=Math.max(...w.map(_=>Math.max(_.toolCalls,_.messages)),1),O=k-E-M,q=R-T-C,X=O/24*.75,L=O/24*.25,Y=g.webui+g.tui+g.telegram+g.heartbeat||1;return o.jsxs("div",{className:`flex-1 overflow-y-auto p-4 md:p-7 scrollbar-thin ${t||""}`,children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-6",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-display font-semibold tracking-tight",style:{color:"var(--cream)"},children:"System Telemetry"}),o.jsx("p",{className:"text-[11.5px] text-muted mt-0.5",children:"Real-time daily operations telemetry and interface execution load."})]}),o.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"})]})]}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[o.jsx(zr,{label:"Today's Sessions",value:String(S.totalSessionsToday),subtitle:"conversations today"}),o.jsx(zr,{label:"Operational Cost",value:`$${S.totalCost.toFixed(4)}`,subtitle:"estimated total",isGreen:!0}),o.jsx(zr,{label:"Volume Consumed",value:m(S.totalTokens),subtitle:"total system tokens"}),o.jsx(zr,{label:"Agent Executions",value:String(S.totalToolCalls),subtitle:"integrated tool calls"})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5 mb-6",children:[o.jsxs("div",{className:"glass-card rounded-xl p-5 flex flex-col relative select-none",children:[o.jsxs("div",{className:"flex items-center justify-between h-6 mb-4",children:[o.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--gold)",opacity:.8},children:"Hourly Token Consumption"}),o.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 · ${m(w[u].inputTokens+w[u].outputTokens)} tok`:"00:00 · 0 tok"})]}),o.jsx("div",{className:"relative flex-1 h-[140px]",children:o.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${v} ${j}`,preserveAspectRatio:"none",className:"overflow-visible",children:[o.jsx("defs",{children:o.jsxs("linearGradient",{id:"tokenGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[o.jsx("stop",{offset:"0%",stopColor:"var(--gold)",stopOpacity:"0.25"}),o.jsx("stop",{offset:"100%",stopColor:"var(--gold)",stopOpacity:"0"})]})}),Array.from({length:5}).map((_,U)=>{const G=T+U/4*$,I=Math.round(H-U/4*H);return o.jsxs("g",{className:"opacity-25",children:[o.jsx("line",{x1:E,y1:G,x2:v-M,y2:G,stroke:"var(--b2)",strokeWidth:"0.75",strokeDasharray:"3 3"}),o.jsx("text",{x:E-8,y:G+3.5,textAnchor:"end",className:"fill-muted font-mono text-[9.5px]",children:m(I)})]},U)}),Array.from({length:7}).map((_,U)=>{const G=Math.round(U/6*23),I=E+G/23*A;return o.jsxs("text",{x:I,y:j-6,textAnchor:"middle",className:"fill-muted font-mono text-[9.5px] opacity-60",children:[String(G).padStart(2,"0"),":00"]},U)}),N&&o.jsx("path",{d:N,fill:"url(#tokenGrad)"}),z&&o.jsx("path",{d:z,fill:"none",stroke:"var(--gold)",strokeWidth:"1.5",strokeLinecap:"round"}),V.map((_,U)=>o.jsxs("g",{onMouseEnter:()=>d(U),onMouseLeave:()=>d(null),children:[o.jsx("rect",{x:_.x-A/48,y:T,width:A/24,height:$,fill:"transparent",className:"cursor-pointer"}),u===U&&o.jsxs(o.Fragment,{children:[o.jsx("line",{x1:_.x,y1:T,x2:_.x,y2:T+$,stroke:"var(--b2)",strokeWidth:"0.75"}),o.jsx("circle",{cx:_.x,cy:_.y,r:"4",fill:"var(--gold)",stroke:"var(--s1)",strokeWidth:"1.5"})]})]},U))]})})]}),o.jsxs("div",{className:"glass-card rounded-xl p-5 flex flex-col relative select-none",children:[o.jsxs("div",{className:"flex items-center justify-between h-6 mb-4",children:[o.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--gold)",opacity:.8},children:"Hourly Tool & Prompt Load"}),o.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 · 🛠️ ${w[f].toolCalls} calls · 💬 ${w[f].messages} msg`:"00:00 · 0 calls · 0 msg"})]}),o.jsx("div",{className:"relative flex-1 h-[140px]",children:o.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${k} ${R}`,preserveAspectRatio:"none",className:"overflow-visible",children:[Array.from({length:5}).map((_,U)=>{const G=T+U/4*q,I=Math.round(D-U/4*D);return o.jsxs("g",{className:"opacity-25",children:[o.jsx("line",{x1:E,y1:G,x2:k-M,y2:G,stroke:"var(--b2)",strokeWidth:"0.75",strokeDasharray:"3 3"}),o.jsx("text",{x:E-8,y:G+3.5,textAnchor:"end",className:"fill-muted font-mono text-[9.5px]",children:I})]},U)}),Array.from({length:7}).map((_,U)=>{const G=Math.round(U/6*23),I=E+G/23*O;return o.jsxs("text",{x:I,y:R-6,textAnchor:"middle",className:"fill-muted font-mono text-[9.5px] opacity-60",children:[String(G).padStart(2,"0"),":00"]},U)}),w.map((_,U)=>{const G=E+U*(X+L),I=_.messages/D*q,B=_.toolCalls/D*q,K=T+q-I,W=K-B;return o.jsxs("g",{onMouseEnter:()=>h(U),onMouseLeave:()=>h(null),className:"cursor-pointer",children:[_.messages>0&&o.jsx("rect",{x:G,y:K,width:X,height:I,fill:"var(--yellow)",rx:"1",className:"transition-all duration-100 hover:opacity-80"}),_.toolCalls>0&&o.jsx("rect",{x:G,y:W,width:X,height:B,fill:"var(--cream)",rx:"1",className:"transition-all duration-100 hover:opacity-80"}),o.jsx("rect",{x:G-L/2,y:T,width:X+L,height:q,fill:"transparent"})]},U)})]})})]})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-5 mb-6",children:[o.jsxs("div",{className:"glass-card rounded-xl p-5 flex flex-col select-none",children:[o.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider mb-4 block",style:{color:"var(--gold)",opacity:.8},children:"Telemetry Channels"}),o.jsxs("div",{className:"space-y-3.5 flex-1 flex flex-col justify-center",children:[o.jsx(Rr,{label:"Web UI Console",count:g.webui,percent:Math.round(g.webui/Y*100),color:"var(--gold)"}),o.jsx(Rr,{label:"CLI TUI Terminal",count:g.tui,percent:Math.round(g.tui/Y*100),color:"var(--yellow)"}),o.jsx(Rr,{label:"Telegram Bot",count:g.telegram,percent:Math.round(g.telegram/Y*100),color:"var(--cream)"}),o.jsx(Rr,{label:"Heartbeat Scheduler",count:g.heartbeat,percent:Math.round(g.heartbeat/Y*100),color:"var(--red)"})]})]}),o.jsxs("div",{className:"col-span-1 md:col-span-2 glass-card rounded-xl p-5",children:[o.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider mb-3 block",style:{color:"var(--gold)",opacity:.8},children:"Top Executed Tools Today"}),y.length===0?o.jsx("div",{className:"flex items-center justify-center h-28 text-xs text-muted",children:"No tool executions tracked today"}):o.jsx("div",{className:"overflow-hidden",children:o.jsxs("table",{className:"w-full text-left text-xs",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"font-mono text-[10px]",style:{borderBottom:"1px solid color-mix(in srgb, var(--b1) 40%, transparent)",color:"var(--muted)"},children:[o.jsx("th",{className:"pb-1.5 font-medium",children:"TOOL DEFINITION"}),o.jsx("th",{className:"pb-1.5 font-medium text-right",children:"CALLS"})]})}),o.jsx("tbody",{children:y.map((_,U)=>o.jsxs("tr",{className:"transition-colors duration-100",style:{borderBottom:"1px solid color-mix(in srgb, var(--b1) 20%, transparent)"},children:[o.jsx("td",{className:"py-2 font-mono text-fg font-medium",children:_.name}),o.jsxs("td",{className:"py-2 text-right font-mono font-semibold",style:{color:"var(--gold)"},children:[_.count," executions"]})]},U))})]})})]})]}),s.length>0&&o.jsxs("div",{className:"glass-card rounded-xl overflow-hidden",children:[o.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"}),o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full text-[12.5px]",children:[o.jsx("thead",{children:o.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:[o.jsx("th",{className:"px-4 py-2 font-medium",children:"SESSION ID"}),o.jsx("th",{className:"px-4 py-2 font-medium",children:"CHANNEL"}),o.jsx("th",{className:"px-4 py-2 font-medium",children:"MODEL MODEL"}),o.jsx("th",{className:"px-4 py-2 font-medium",children:"TELEMETRY TIMESTAMP"}),o.jsx("th",{className:"px-4 py-2 font-medium",children:"ACTIVE DIRECTORY"})]})}),o.jsx("tbody",{children:s.slice(0,15).map(_=>o.jsxs("tr",{className:"transition-colors duration-75",style:{borderBottom:"1px solid color-mix(in srgb, var(--b1) 20%, transparent)"},children:[o.jsx("td",{className:"px-4 py-2.5 font-mono text-[11.5px] text-fg",children:_.id}),o.jsx("td",{className:"px-4 py-2.5",children:o.jsx("span",{className:"px-2 py-0.5 rounded-[4px] text-[10px] font-mono select-none",style:{background:_.type==="telegram"?"color-mix(in srgb, var(--cream) 10%, transparent)":_.type==="tui"?"color-mix(in srgb, var(--yellow) 10%, transparent)":_.type==="heartbeat"?"color-mix(in srgb, var(--red) 10%, transparent)":"color-mix(in srgb, var(--gold) 10%, transparent)",color:_.type==="telegram"?"var(--cream)":_.type==="tui"?"var(--yellow)":_.type==="heartbeat"?"var(--red)":"var(--gold)",border:"1px solid color-mix(in srgb, var(--b1) 30%, transparent)"},children:_.type||"webui"})}),o.jsx("td",{className:"px-4 py-2.5 text-text font-mono text-[11.5px]",children:_.model}),o.jsx("td",{className:"px-4 py-2.5 text-muted text-xs",children:new Date(_.createdAt).toLocaleString()}),o.jsx("td",{className:"px-4 py-2.5 text-muted text-xs truncate max-w-[220px]",title:_.cwd,children:_.cwd})]},_.id))})]})})]})]})}function zr({label:e,value:t,subtitle:n,isGreen:l}){return o.jsxs("div",{className:"metric-card rounded-xl px-6 py-5 flex flex-col justify-between select-none",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--gold)",opacity:.7},children:e}),o.jsx("div",{className:"text-2xl font-display font-bold tracking-tight leading-none",style:{color:l?"var(--green)":"var(--cream)"},children:t}),o.jsx("span",{className:"text-[10px] text-muted mt-2 font-mono",children:n})]})}function Rr({label:e,count:t,percent:n,color:l}){return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs font-medium text-text2",children:[o.jsx("span",{children:e}),o.jsxs("span",{className:"font-mono text-muted",children:[t," sessions (",n||0,"%)"]})]}),o.jsx("div",{className:"w-full h-1.5 rounded-full overflow-hidden",style:{background:"var(--s2)"},children:o.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${n||0}%`,background:l}})})]})}function n5({rpc:e,className:t}){const[n,l]=b.useState([]),[a,s]=b.useState(!0);b.useEffect(()=>{e&&(s(!0),e.sessionList().then(r=>{Array.isArray(r)&&l(r)}).catch(()=>{}).finally(()=>s(!1)))},[e]);const i=b.useMemo(()=>{const r=new Map;for(const c of n){const u=r.get(c.cwd)||[];u.push(c),r.set(c.cwd,u)}return Array.from(r.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 o.jsxs("div",{className:`flex-1 overflow-y-auto p-7 scrollbar-thin ${t||""}`,children:[o.jsxs("div",{className:"flex items-center justify-between mb-5",children:[o.jsx("h2",{className:"text-base font-semibold text-fg tracking-tight",children:"Projects"}),o.jsxs("span",{className:"text-xs text-muted font-mono",children:[i.length," projects"]})]}),a?o.jsx("div",{className:"flex items-center justify-center py-10 text-muted",children:"Loading..."}):i.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-muted",children:[o.jsx("div",{className:"text-sm",children:"No projects yet"}),o.jsx("div",{className:"text-xs text-muted2 mt-1",children:"Sessions will appear here once you run them"})]}):i.map(r=>o.jsx(l5,{project:r},r.cwd))]})}function l5({project:e}){const t=e.cwd.split("/").pop()||e.cwd;return o.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:[o.jsx("div",{className:"w-[6px] h-[6px] rounded-full bg-green shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-[13px] font-medium text-fg",children:t}),o.jsx("div",{className:"text-xs text-muted font-mono",children:e.cwd})]}),o.jsxs("div",{className:"flex gap-3",children:[o.jsxs("span",{className:"text-xs text-muted",children:[e.sessions," session",e.sessions!==1?"s":""]}),o.jsx("span",{className:"text-xs text-muted",children:e.providers.join(", ")})]}),o.jsx("span",{className:"text-[10px] font-medium rounded-full px-2 py-0.5 font-mono bg-green/10 text-green",children:"active"})]})}function a5(){const{rpc:e,ws:t}=_n(),[n,l]=b.useState(new Map);b.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});l(f)}).catch(()=>{})},[e]),b.useEffect(()=>{if(!t)return;const d=g=>{l(y=>{const m=new Map(y);return m.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}),m})},f=g=>{l(y=>{const m=new Map(y),v=m.get(g.agentId);return v&&m.set(g.agentId,{...v,text:v.text+g.text}),m})},h=g=>{l(y=>{const m=new Map(y),v=m.get(g.agentId);return v&&m.set(g.agentId,{...v,toolCalls:v.toolCalls+1}),m})},p=g=>{l(y=>{const m=new Map(y),v=m.get(g.agentId);return v&&m.set(g.agentId,{...v,inputTokens:v.inputTokens+(g.inputTokens||0),outputTokens:v.outputTokens+(g.outputTokens||0)}),m})},x=g=>{l(y=>{const m=new Map(y),v=m.get(g.agentId);return v&&m.set(g.agentId,{...v,status:"done",text:g.text||v.text,toolCalls:g.toolCalls??v.toolCalls,errors:g.errors||[],doneAt:g.timestamp}),m})},S=g=>{l(y=>{const m=new Map(y),v=m.get(g.agentId);return v&&m.set(g.agentId,{...v,status:"error",errors:[...v.errors||[],g.message],doneAt:g.timestamp}),m})},w=[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",x),t.on("agent-error",S)];return()=>{for(const g of w)g()}},[t]);const a=b.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=b.useCallback(async d=>{if(!e)return!1;try{return await e.subagentCancel(d),l(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]),i=b.useCallback(async(d,f)=>{if(!e)return!1;try{return await e.subagentSend(d,f),!0}catch{return!1}},[e]),r=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:r,completed:c,failed:u,spawn:a,cancel:s,send:i}}const s5=["agent-start","agent-tool-call","agent-tool-result","agent-text-delta","agent-thinking-delta","agent-done","agent-error"],i5=new Set(["agent-text-delta","agent-thinking-delta"]),im=50,r5=20,rm=["--chart-1","--chart-2","--chart-3","--chart-4","--chart-5","--chart-6","--chart-7","--chart-8"];function om(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return rm[t%rm.length]}function qa(e){return typeof e=="string"?e:e==null?"":typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e)}function o5(e){const t=e.event;switch(e.type){case"agent-start":{const n=qa(t.prompt);return{label:"Agent started",detail:n?`"${n}"`:"",tone:"yellow"}}case"agent-tool-call":{const n=qa(t.name)||"tool",l=t.input??{};return{label:n,detail:Xv(n,l),tone:"gold"}}case"agent-tool-result":{const n=qa(t.error);return n?{label:"Tool failed",detail:n,tone:"red",wrapDetail:!0}:null}case"agent-thinking-delta":return{label:"Thinking…",detail:`${Ai(e.charCount)} chars`,tone:"muted"};case"agent-text-delta":return{label:"Streaming…",detail:`${Ai(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(Hh(t.durationMs)),{label:"Completed",detail:n.join(" · "),tone:"green"}}case"agent-error":return{label:"Failed",detail:qa(t.message),tone:"red",wrapDetail:!0};default:return{label:e.type,detail:"",tone:"muted"}}}const c5={green:"bg-green",yellow:"bg-yellow",red:"bg-red",gold:"bg-gold",muted:"bg-muted2"},u5={green:"text-green",yellow:"text-yellow",red:"text-red",gold:"text-gold",muted:"text-muted"};function d5({ws:e}){const[t,n]=b.useState([]),[l,a]=b.useState(()=>Date.now()),s=b.useRef(0);if(b.useEffect(()=>{if(!e)return;const r=u=>d=>{n(f=>{const h=qa(d.agentId),p=qa(d.text);if(i5.has(u)){const x=f[0];return f.length>0&&x.type===u&&x.agentId===h?[{...x,charCount:x.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,im)}return[{seq:s.current++,type:u,agentId:h,timestamp:d.timestamp,charCount:0,event:d},...f].slice(0,im)})},c=s5.map(u=>e.on(u,r(u)));return()=>{for(const u of c)u()}},[e]),b.useEffect(()=>{const r=setInterval(()=>{a(Date.now())},1e3);return()=>{clearInterval(r)}},[]),!e)return null;const i=t.map(r=>({entry:r,desc:o5(r)})).filter(r=>r.desc!==null).slice(0,r5);return o.jsxs("div",{children:[o.jsx("div",{className:"h-px bg-b1 my-5"}),o.jsx("div",{className:"text-[11.5px] font-medium text-muted mb-2.5",children:"Live Agent Events"}),i.length===0?o.jsx("div",{className:"text-xs text-muted2 px-3 py-2",children:"Waiting for agent activity…"}):i.map(({entry:r,desc:c})=>o.jsxs("div",{className:"flex items-start gap-3 px-3 py-1.5 rounded-lg mb-0.5 hover:bg-s2 transition-colors",children:[o.jsx("div",{className:`w-[6px] h-[6px] rounded-full shrink-0 mt-[6px] ${c5[c.tone]}`}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:`text-[12px] font-mono font-medium ${u5[c.tone]}`,children:c.label})}),c.detail&&o.jsx("div",{className:`text-xs text-muted ${c.wrapDetail?"whitespace-pre-wrap break-words":"truncate"}`,title:c.detail,children:c.detail})]}),r.agentId&&o.jsx("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded-[3px] shrink-0 mt-[2px]",style:{color:`var(${om(r.agentId)})`,background:`color-mix(in srgb, var(${om(r.agentId)}) 12%, transparent)`},title:r.agentId,children:r.agentId.slice(0,4)}),o.jsx("span",{className:"text-[10px] text-muted font-mono shrink-0 mt-[3px] w-[52px] text-right",title:yn(r.timestamp),children:Cj(r.timestamp,l)})]},r.seq))]})}function f5({rpc:e,sessionId:t,className:n,onOpenSession:l}){const{ws:a}=_n(),{agents:s,running:i,completed:r,failed:c,spawn:u,cancel:d,send:f}=a5(),[h,p]=b.useState(!1),[x,S]=b.useState(!1),[w,g]=b.useState(""),[y,m]=b.useState("auto"),[v,j]=b.useState("auto"),[E,M]=b.useState(""),[T,C]=b.useState(""),[H,A]=b.useState(""),[$,V]=b.useState(""),[N,z]=b.useState(""),[k,R]=b.useState(""),[D,O]=b.useState(""),[q,X]=b.useState("auto"),[L,Y]=b.useState(""),[_,U]=b.useState(""),[G,I]=b.useState(""),[B,K]=b.useState(0),W=b.useCallback(Z=>{Z&&(l==null||l(Z))},[l]),F=b.useCallback(async()=>{if(!w.trim()||!e)return;let Z=t;if(!Z)try{const ve=await e.sessionList();Array.isArray(ve)&&ve.length>0&&(Z=ve[0].id)}catch{}await u({sessionId:Z||"",prompt:w.trim(),provider:E||void 0,mode:y!=="auto"?y:void 0,effort:v!=="auto"?v:void 0,model:T||void 0}),g(""),p(!1),M("")},[w,y,v,E,T,t,e,u]),J=b.useCallback(async()=>{if(!e||!H.trim()||!$||!N){Y("Please fill in prompt and date/time");return}Y("");const Z=`${$}T${N}:00`;try{await e.taskSchedule({instruction:H.trim(),scheduled_at:Z,provider:k||void 0,model:D||void 0,effort:q!=="auto"?q:void 0}),A(""),V(""),z(""),S(!1)}catch(ve){Y(ve instanceof Error?ve.message:"Failed to schedule task")}},[H,$,N,k,D,q,e]),P=b.useCallback(async()=>{!_||!G.trim()||(await f(_,G.trim()),I(""))},[_,G,f]),ne=Array.from(s.values()).sort((Z,ve)=>(ve.startedAt||0)-(Z.startedAt||0)),ae=ne.filter(Z=>Z.status==="done"||Z.status==="error"||Z.status==="cancelled"),te=ae.slice(B*10,(B+1)*10);return o.jsxs("div",{className:`flex-1 overflow-y-auto p-4 md:p-7 scrollbar-thin ${n||""}`,children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-6",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-base font-semibold text-fg tracking-tight",children:"Agents"}),o.jsx("p",{className:"text-[11.5px] text-muted mt-0.5",children:"Parallel subagent orchestration and monitoring."})]}),o.jsxs("div",{className:"flex gap-2 self-start sm:self-auto",children:[o.jsx("button",{onClick:()=>S(!x),className:`text-xs font-medium border rounded-[8px] px-4 py-2 transition-colors select-none ${x?"bg-blue/15 text-blue border-blue/30":"bg-s2 text-muted border-b1 hover:text-fg"}`,children:"Schedule"}),o.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&&o.jsx("div",{className:"bg-s1 border border-b1 rounded-[10px] p-5 mb-6 animate-in",children:o.jsxs("div",{className:"flex flex-col gap-3",children:[o.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:w,onChange:Z=>g(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&!Z.shiftKey&&(Z.preventDefault(),F())}}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[o.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:y,onChange:Z=>m(Z.target.value),children:[o.jsx("option",{value:"auto",children:"Mode: inherit"}),o.jsx("option",{value:"plan",children:"Mode: plan"}),o.jsx("option",{value:"edit",children:"Mode: edit"}),o.jsx("option",{value:"auto",children:"Mode: auto"}),o.jsx("option",{value:"yolo",children:"Mode: yolo"})]}),o.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:v,onChange:Z=>j(Z.target.value),children:[o.jsx("option",{value:"auto",children:"Effort: inherit"}),o.jsx("option",{value:"low",children:"Effort: low"}),o.jsx("option",{value:"medium",children:"Effort: medium"}),o.jsx("option",{value:"high",children:"Effort: high"}),o.jsx("option",{value:"max",children:"Effort: max"})]}),o.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:E,onChange:Z=>M(Z.target.value),children:[o.jsx("option",{value:"",children:"Provider: inherit"}),o.jsx("option",{value:"anthropic",children:"Anthropic"}),o.jsx("option",{value:"openai",children:"OpenAI"}),o.jsx("option",{value:"google",children:"Google"}),o.jsx("option",{value:"ollama",children:"Ollama"}),o.jsx("option",{value:"openrouter",children:"OpenRouter"})]}),o.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:T,onChange:Z=>C(Z.target.value)}),o.jsx("button",{onClick:F,disabled:!w.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"})]})]})}),x&&o.jsx("div",{className:"bg-s1 border border-b1 rounded-[10px] p-5 mb-6 animate-in",children:o.jsxs("div",{className:"flex flex-col gap-3",children:[o.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:H,onChange:Z=>A(Z.target.value)}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[o.jsx("input",{type:"date",className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:$,onChange:Z=>V(Z.target.value)}),o.jsx("input",{type:"time",className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:N,onChange:Z=>z(Z.target.value)}),o.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:q,onChange:Z=>X(Z.target.value),children:[o.jsx("option",{value:"auto",children:"Effort: auto"}),o.jsx("option",{value:"low",children:"Effort: low"}),o.jsx("option",{value:"medium",children:"Effort: medium"}),o.jsx("option",{value:"high",children:"Effort: high"}),o.jsx("option",{value:"max",children:"Effort: max"})]}),o.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none",value:k,onChange:Z=>R(Z.target.value),children:[o.jsx("option",{value:"",children:"Provider: inherit"}),o.jsx("option",{value:"anthropic",children:"Anthropic"}),o.jsx("option",{value:"openai",children:"OpenAI"}),o.jsx("option",{value:"google",children:"Google"}),o.jsx("option",{value:"ollama",children:"Ollama"}),o.jsx("option",{value:"openrouter",children:"OpenRouter"})]}),o.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:D,onChange:Z=>O(Z.target.value)})]}),L&&o.jsx("div",{className:"text-[11px] text-red bg-red/5 rounded-[6px] p-2",children:L}),o.jsx("button",{onClick:J,disabled:!H.trim()||!$||!N,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"})]})}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[o.jsx(Or,{label:"Running",value:String(i.length),color:"text-yellow"}),o.jsx(Or,{label:"Completed",value:String(r.length),color:"text-green"}),o.jsx(Or,{label:"Failed",value:String(c.length),color:"text-red"}),o.jsx(Or,{label:"Total Tokens",value:Ai(ne.reduce((Z,ve)=>Z+ve.inputTokens+ve.outputTokens,0)),color:"text-fg"})]}),i.length>0&&o.jsxs("div",{className:"mb-6",children:[o.jsx("h3",{className:"text-[11px] font-semibold text-text2 uppercase tracking-wider mb-3",children:"Live Agents"}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:i.map(Z=>o.jsx(h5,{agent:Z,onCancel:()=>d(Z.agentId),onOpen:()=>{W(Z.sessionId)}},Z.agentId))})]}),ae.length>0&&o.jsxs("div",{className:"mb-6",children:[o.jsx("h3",{className:"text-[11px] font-semibold text-text2 uppercase tracking-wider mb-3",children:"History"}),o.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] overflow-hidden",children:[o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full text-[12px]",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"text-left text-xs text-muted border-b border-b1 font-mono text-[10px]",children:[o.jsx("th",{className:"px-4 py-2 font-medium",children:"STATUS"}),o.jsx("th",{className:"px-4 py-2 font-medium",children:"PROVIDER"}),o.jsx("th",{className:"px-4 py-2 font-medium",children:"PROMPT"}),o.jsx("th",{className:"px-4 py-2 font-medium",children:"DURATION"}),o.jsx("th",{className:"px-4 py-2 font-medium",children:"TOOLS"}),o.jsx("th",{className:"px-4 py-2 font-medium text-right",children:"TOKENS"})]})}),o.jsx("tbody",{children:te.map(Z=>{const ve=Z.status==="done"?"text-green":Z.status==="cancelled"?"text-muted2":"text-red",xe=Z.doneAt?Hh(Z.doneAt-Z.startedAt):"-",Se=Z.inputTokens+Z.outputTokens;return o.jsxs("tr",{className:"hover:bg-s2/30 transition-colors cursor-pointer border-b border-b1/40",title:"Open session in Assistant",onClick:()=>{W(Z.sessionId)},children:[o.jsx("td",{className:"px-4 py-2.5",children:o.jsx("span",{className:`text-[10px] font-mono px-2 py-0.5 rounded-[4px] ${ve==="text-green"?"bg-green/10":ve==="text-red"?"bg-red/10":"bg-muted/10"}`,children:Z.status})}),o.jsx("td",{className:"px-4 py-2.5 text-muted font-mono text-[11.5px]",children:Z.provider||"-"}),o.jsx("td",{className:"px-4 py-2.5 text-fg truncate max-w-[200px]",title:Z.prompt,children:Z.prompt}),o.jsx("td",{className:"px-4 py-2.5 text-muted font-mono",children:xe}),o.jsx("td",{className:"px-4 py-2.5 text-muted font-mono",children:Z.toolCalls}),o.jsx("td",{className:"px-4 py-2.5 text-right font-mono text-muted",children:Se>0?Ai(Se):"-"})]},Z.agentId)})})]})}),ae.length>10&&o.jsxs("div",{className:"flex items-center justify-center gap-4 py-2 border-t border-b1",children:[o.jsx("button",{className:"text-xs text-muted hover:text-fg transition-colors disabled:opacity-30",disabled:B===0,onClick:()=>K(Z=>Z-1),children:"Prev"}),o.jsxs("span",{className:"text-[10px] text-muted font-mono",children:[B+1," / ",Math.ceil(ae.length/10)]}),o.jsx("button",{className:"text-xs text-muted hover:text-fg transition-colors disabled:opacity-30",disabled:(B+1)*10>=ae.length,onClick:()=>K(Z=>Z+1),children:"Next"})]})]})]}),i.length>0&&o.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] p-4 mb-6",children:[o.jsx("h3",{className:"text-[11px] font-semibold text-text2 uppercase tracking-wider mb-3",children:"Send Message to Agent"}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[o.jsxs("select",{className:"bg-s2 border border-b1 rounded-[8px] px-3 py-2 text-xs text-fg outline-none flex-[0.5]",value:_,onChange:Z=>U(Z.target.value),children:[o.jsx("option",{value:"",children:"Select agent..."}),i.map(Z=>o.jsxs("option",{value:Z.agentId,children:[Z.prompt.slice(0,40),Z.prompt.length>40?"...":""]},Z.agentId))]}),o.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:G,onChange:Z=>I(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&P()}}),o.jsx("button",{onClick:P,disabled:!_||!G.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"})]})]}),o.jsx(d5,{ws:a})]})}function Or({label:e,value:t,color:n}){return o.jsxs("div",{className:"bg-s1 border border-b1 rounded-[10px] px-5 py-4 flex flex-col justify-between select-none",children:[o.jsx("span",{className:"text-[10px] font-semibold text-muted uppercase tracking-wider",children:e}),o.jsx("div",{className:`text-2xl font-bold tracking-tight leading-none mt-1 ${n}`,children:t})]})}function h5({agent:e,onCancel:t,onOpen:n}){const l=Date.now()-e.startedAt,a=e.inputTokens+e.outputTokens,s=e.status==="running"?"text-yellow":"text-green";return o.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:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("div",{className:`w-[6px] h-[6px] rounded-full shrink-0 ${e.status==="running"?"bg-yellow animate-pulse":"bg-green"}`}),o.jsx("span",{className:"text-[12.5px] font-medium text-fg truncate flex-1",children:e.prompt}),o.jsx("span",{className:"text-[9px] font-mono bg-s3 px-1.5 py-0.5 rounded-[3px] text-muted shrink-0",children:e.provider}),o.jsx("span",{className:`text-[10px] font-mono ${s}`,children:e.status}),e.status==="running"&&o.jsx("button",{className:"text-[10px] text-red/70 hover:text-red font-mono shrink-0",onClick:i=>{i.stopPropagation(),t()},children:"Cancel"})]}),o.jsxs("div",{className:"text-[10.5px] text-muted font-mono mb-2",children:[Hh(l)," · ",e.toolCalls," tools · ",Ai(a)," tok"]}),e.text&&o.jsx("div",{className:"text-[11px] text-text2 line-clamp-2 font-mono leading-relaxed",children:e.text.slice(-200)})]})}function p5(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return b.useMemo(()=>l=>{t.forEach(a=>a(l))},t)}const Hc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function _s(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Lh(e){return"nodeType"in e}function ft(e){var t,n;return e?_s(e)?e:Lh(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Bh(e){const{Document:t}=ft(e);return e instanceof t}function nr(e){return _s(e)?!1:e instanceof ft(e).HTMLElement}function Kv(e){return e instanceof ft(e).SVGElement}function Ts(e){return e?_s(e)?e.document:Lh(e)?Bh(e)?e:nr(e)||Kv(e)?e.ownerDocument:document:document:document}const on=Hc?b.useLayoutEffect:b.useEffect;function $c(e){const t=b.useRef(e);return on(()=>{t.current=e}),b.useCallback(function(){for(var n=arguments.length,l=new Array(n),a=0;a<n;a++)l[a]=arguments[a];return t.current==null?void 0:t.current(...l)},[])}function g5(){const e=b.useRef(null),t=b.useCallback((l,a)=>{e.current=setInterval(l,a)},[]),n=b.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Di(e,t){t===void 0&&(t=[e]);const n=b.useRef(e);return on(()=>{n.current!==e&&(n.current=e)},t),n}function lr(e,t){const n=b.useRef();return b.useMemo(()=>{const l=e(n.current);return n.current=l,l},[...t])}function Fo(e){const t=$c(e),n=b.useRef(null),l=b.useCallback(a=>{a!==n.current&&(t==null||t(a,n.current)),n.current=a},[]);return[n,l]}function Po(e){const t=b.useRef();return b.useEffect(()=>{t.current=e},[e]),t.current}let Qu={};function ar(e,t){return b.useMemo(()=>{if(t)return t;const n=Qu[e]==null?0:Qu[e]+1;return Qu[e]=n,e+"-"+n},[e,t])}function Wv(e){return function(t){for(var n=arguments.length,l=new Array(n>1?n-1:0),a=1;a<n;a++)l[a-1]=arguments[a];return l.reduce((s,i)=>{const r=Object.entries(i);for(const[c,u]of r){const d=s[c];d!=null&&(s[c]=d+e*u)}return s},{...t})}}const Ja=Wv(1),ec=Wv(-1);function m5(e){return"clientX"in e&&"clientY"in e}function Lc(e){if(!e)return!1;const{KeyboardEvent:t}=ft(e.target);return t&&e instanceof t}function x5(e){if(!e)return!1;const{TouchEvent:t}=ft(e.target);return t&&e instanceof t}function tc(e){if(x5(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 m5(e)?{x:e.clientX,y:e.clientY}:null}const Hl=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[Hl.Translate.toString(e),Hl.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:l}=e;return t+" "+n+"ms "+l}}}),cm="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function y5(e){return e.matches(cm)?e:e.querySelector(cm)}const v5={display:"none"};function b5(e){let{id:t,value:n}=e;return _e.createElement("div",{id:t,style:v5},n)}function w5(e){let{id:t,announcement:n,ariaLiveType:l="assertive"}=e;const a={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 _e.createElement("div",{id:t,style:a,role:"status","aria-live":l,"aria-atomic":!0},n)}function S5(){const[e,t]=b.useState("");return{announce:b.useCallback(l=>{l!=null&&t(l)},[]),announcement:e}}const Jv=b.createContext(null);function N5(e){const t=b.useContext(Jv);b.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function j5(){const[e]=b.useState(()=>new Set),t=b.useCallback(l=>(e.add(l),()=>e.delete(l)),[e]);return[b.useCallback(l=>{let{type:a,event:s}=l;e.forEach(i=>{var r;return(r=i[a])==null?void 0:r.call(i,s)})},[e]),t]}const k5={draggable:`
140
- To pick up a draggable item, press the space bar.
141
- While dragging, use the arrow keys to move the item.
142
- Press space again to drop the item in its new position, or press escape to cancel.
143
- `},E5={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 C5(e){let{announcements:t=E5,container:n,hiddenTextDescribedById:l,screenReaderInstructions:a=k5}=e;const{announce:s,announcement:i}=S5(),r=ar("DndLiveRegion"),[c,u]=b.useState(!1);if(b.useEffect(()=>{u(!0)},[]),N5(b.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=_e.createElement(_e.Fragment,null,_e.createElement(b5,{id:l,value:a.draggable}),_e.createElement(w5,{id:r,announcement:i}));return n?Wl.createPortal(d,n):d}var Ge;(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"})(Ge||(Ge={}));function nc(){}function um(e,t){return b.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function M5(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return b.useMemo(()=>[...t].filter(l=>l!=null),[...t])}const cn=Object.freeze({x:0,y:0});function _5(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function T5(e,t){const n=tc(e);if(!n)return"0 0";const l={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return l.x+"% "+l.y+"%"}function A5(e,t){let{data:{value:n}}=e,{data:{value:l}}=t;return n-l}function D5(e,t){let{data:{value:n}}=e,{data:{value:l}}=t;return l-n}function dm(e){let{left:t,top:n,height:l,width:a}=e;return[{x:t,y:n},{x:t+a,y:n},{x:t,y:n+l},{x:t+a,y:n+l}]}function z5(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const R5=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:l}=e;const a=dm(t),s=[];for(const i of l){const{id:r}=i,c=n.get(r);if(c){const u=dm(c),d=a.reduce((h,p,x)=>h+_5(u[x],p),0),f=Number((d/4).toFixed(4));s.push({id:r,data:{droppableContainer:i,value:f}})}}return s.sort(A5)};function O5(e,t){const n=Math.max(t.top,e.top),l=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),i=a-l,r=s-n;if(l<a&&n<s){const c=t.width*t.height,u=e.width*e.height,d=i*r,f=d/(c+u-d);return Number(f.toFixed(4))}return 0}const H5=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:l}=e;const a=[];for(const s of l){const{id:i}=s,r=n.get(i);if(r){const c=O5(r,t);c>0&&a.push({id:i,data:{droppableContainer:s,value:c}})}}return a.sort(D5)};function $5(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Fv(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:cn}function L5(e){return function(n){for(var l=arguments.length,a=new Array(l>1?l-1:0),s=1;s<l;s++)a[s-1]=arguments[s];return a.reduce((i,r)=>({...i,top:i.top+e*r.y,bottom:i.bottom+e*r.y,left:i.left+e*r.x,right:i.right+e*r.x}),{...n})}}const B5=L5(1);function Pv(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 U5(e,t,n){const l=Pv(t);if(!l)return e;const{scaleX:a,scaleY:s,x:i,y:r}=l,c=e.left-i-(1-a)*parseFloat(n),u=e.top-r-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),d=a?e.width/a: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 q5={ignoreTransform:!1};function As(e,t){t===void 0&&(t=q5);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=ft(e).getComputedStyle(e);u&&(n=U5(n,u,d))}const{top:l,left:a,width:s,height:i,bottom:r,right:c}=n;return{top:l,left:a,width:s,height:i,bottom:r,right:c}}function fm(e){return As(e,{ignoreTransform:!0})}function Y5(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function V5(e,t){return t===void 0&&(t=ft(e).getComputedStyle(e)),t.position==="fixed"}function X5(e,t){t===void 0&&(t=ft(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const s=t[a];return typeof s=="string"?n.test(s):!1})}function Uh(e,t){const n=[];function l(a){if(t!=null&&n.length>=t||!a)return n;if(Bh(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!nr(a)||Kv(a)||n.includes(a))return n;const s=ft(e).getComputedStyle(a);return a!==e&&X5(a,s)&&n.push(a),V5(a,s)?n:l(a.parentNode)}return e?l(e):n}function e1(e){const[t]=Uh(e,1);return t??null}function Zu(e){return!Hc||!e?null:_s(e)?e:Lh(e)?Bh(e)||e===Ts(e).scrollingElement?window:nr(e)?e:null:null}function t1(e){return _s(e)?e.scrollX:e.scrollLeft}function n1(e){return _s(e)?e.scrollY:e.scrollTop}function rf(e){return{x:t1(e),y:n1(e)}}var We;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(We||(We={}));function l1(e){return!Hc||!e?!1:e===document.scrollingElement}function a1(e){const t={x:0,y:0},n=l1(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},l={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,i=e.scrollTop>=l.y,r=e.scrollLeft>=l.x;return{isTop:a,isLeft:s,isBottom:i,isRight:r,maxScroll:l,minScroll:t}}const G5={x:.2,y:.2};function Q5(e,t,n,l,a){let{top:s,left:i,right:r,bottom:c}=n;l===void 0&&(l=10),a===void 0&&(a=G5);const{isTop:u,isBottom:d,isLeft:f,isRight:h}=a1(e),p={x:0,y:0},x={x:0,y:0},S={height:t.height*a.y,width:t.width*a.x};return!u&&s<=t.top+S.height?(p.y=We.Backward,x.y=l*Math.abs((t.top+S.height-s)/S.height)):!d&&c>=t.bottom-S.height&&(p.y=We.Forward,x.y=l*Math.abs((t.bottom-S.height-c)/S.height)),!h&&r>=t.right-S.width?(p.x=We.Forward,x.x=l*Math.abs((t.right-S.width-r)/S.width)):!f&&i<=t.left+S.width&&(p.x=We.Backward,x.x=l*Math.abs((t.left+S.width-i)/S.width)),{direction:p,speed:x}}function Z5(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:i}=window;return{top:0,left:0,right:s,bottom:i,width:s,height:i}}const{top:t,left:n,right:l,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:l,bottom:a,width:e.clientWidth,height:e.clientHeight}}function s1(e){return e.reduce((t,n)=>Ja(t,rf(n)),cn)}function I5(e){return e.reduce((t,n)=>t+t1(n),0)}function K5(e){return e.reduce((t,n)=>t+n1(n),0)}function i1(e,t){if(t===void 0&&(t=As),!e)return;const{top:n,left:l,bottom:a,right:s}=t(e);e1(e)&&(a<=0||s<=0||n>=window.innerHeight||l>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const W5=[["x",["left","right"],I5],["y",["top","bottom"],K5]];class qh{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 l=Uh(n),a=s1(l);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,i,r]of W5)for(const c of i)Object.defineProperty(this,c,{get:()=>{const u=r(l),d=a[s]-u;return this.rect[c]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class fi{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var l;return(l=this.target)==null?void 0:l.removeEventListener(...n)})},this.target=t}add(t,n,l){var a;(a=this.target)==null||a.addEventListener(t,n,l),this.listeners.push([t,n,l])}}function J5(e){const{EventTarget:t}=ft(e);return e instanceof t?e:Ts(e)}function Iu(e,t){const n=Math.abs(e.x),l=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+l**2)>t:"x"in t&&"y"in t?n>t.x&&l>t.y:"x"in t?n>t.x:"y"in t?l>t.y:!1}var Ut;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ut||(Ut={}));function hm(e){e.preventDefault()}function F5(e){e.stopPropagation()}var pe;(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"})(pe||(pe={}));const r1={start:[pe.Space,pe.Enter],cancel:[pe.Esc],end:[pe.Space,pe.Enter,pe.Tab]},P5=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case pe.Right:return{...n,x:n.x+25};case pe.Left:return{...n,x:n.x-25};case pe.Down:return{...n,y:n.y+25};case pe.Up:return{...n,y:n.y-25}}};class Yh{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 fi(Ts(n)),this.windowListeners=new fi(ft(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ut.Resize,this.handleCancel),this.windowListeners.add(Ut.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ut.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,l=t.node.current;l&&i1(l),n(cn)}handleKeyDown(t){if(Lc(t)){const{active:n,context:l,options:a}=this.props,{keyboardCodes:s=r1,coordinateGetter:i=P5,scrollBehavior:r="smooth"}=a,{code:c}=t;if(s.end.includes(c)){this.handleEnd(t);return}if(s.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=l.current,d=u?{x:u.left,y:u.top}:cn;this.referenceCoordinates||(this.referenceCoordinates=d);const f=i(t,{active:n,context:l.current,currentCoordinates:d});if(f){const h=ec(f,d),p={x:0,y:0},{scrollableAncestors:x}=l.current;for(const S of x){const w=t.code,{isTop:g,isRight:y,isLeft:m,isBottom:v,maxScroll:j,minScroll:E}=a1(S),M=Z5(S),T={x:Math.min(w===pe.Right?M.right-M.width/2:M.right,Math.max(w===pe.Right?M.left:M.left+M.width/2,f.x)),y:Math.min(w===pe.Down?M.bottom-M.height/2:M.bottom,Math.max(w===pe.Down?M.top:M.top+M.height/2,f.y))},C=w===pe.Right&&!y||w===pe.Left&&!m,H=w===pe.Down&&!v||w===pe.Up&&!g;if(C&&T.x!==f.x){const A=S.scrollLeft+h.x,$=w===pe.Right&&A<=j.x||w===pe.Left&&A>=E.x;if($&&!h.y){S.scrollTo({left:A,behavior:r});return}$?p.x=S.scrollLeft-A:p.x=w===pe.Right?S.scrollLeft-j.x:S.scrollLeft-E.x,p.x&&S.scrollBy({left:-p.x,behavior:r});break}else if(H&&T.y!==f.y){const A=S.scrollTop+h.y,$=w===pe.Down&&A<=j.y||w===pe.Up&&A>=E.y;if($&&!h.x){S.scrollTo({top:A,behavior:r});return}$?p.y=S.scrollTop-A:p.y=w===pe.Down?S.scrollTop-j.y:S.scrollTop-E.y,p.y&&S.scrollBy({top:-p.y,behavior:r});break}}this.handleMove(t,Ja(ec(f,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:l}=this.props;t.preventDefault(),l(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()}}Yh.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:l=r1,onActivation:a}=t,{active:s}=n;const{code:i}=e.nativeEvent;if(l.start.includes(i)){const r=s.activatorNode.current;return r&&e.target!==r?!1:(e.preventDefault(),a==null||a({event:e.nativeEvent}),!0)}return!1}}];function pm(e){return!!(e&&"distance"in e)}function gm(e){return!!(e&&"delay"in e)}class Vh{constructor(t,n,l){var a;l===void 0&&(l=J5(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:i}=s;this.props=t,this.events=n,this.document=Ts(i),this.documentListeners=new fi(this.document),this.listeners=new fi(l),this.windowListeners=new fi(ft(i)),this.initialCoordinates=(a=tc(s))!=null?a:cn,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:l}}}=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(Ut.Resize,this.handleCancel),this.windowListeners.add(Ut.DragStart,hm),this.windowListeners.add(Ut.VisibilityChange,this.handleCancel),this.windowListeners.add(Ut.ContextMenu,hm),this.documentListeners.add(Ut.Keydown,this.handleKeydown),n){if(l!=null&&l({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(gm(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(pm(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:l,onPending:a}=this.props;a(l,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Ut.Click,F5,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ut.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:l,initialCoordinates:a,props:s}=this,{onMove:i,options:{activationConstraint:r}}=s;if(!a)return;const c=(n=tc(t))!=null?n:cn,u=ec(a,c);if(!l&&r){if(pm(r)){if(r.tolerance!=null&&Iu(u,r.tolerance))return this.handleCancel();if(Iu(u,r.distance))return this.handleStart()}if(gm(r)&&Iu(u,r.tolerance))return this.handleCancel();this.handlePending(r,u);return}t.cancelable&&t.preventDefault(),i(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===pe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ek={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Xh extends Vh{constructor(t){const{event:n}=t,l=Ts(n.target);super(t,ek,l)}}Xh.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:l}=t;return!n.isPrimary||n.button!==0?!1:(l==null||l({event:n}),!0)}}];const tk={move:{name:"mousemove"},end:{name:"mouseup"}};var of;(function(e){e[e.RightClick=2]="RightClick"})(of||(of={}));class nk extends Vh{constructor(t){super(t,tk,Ts(t.event.target))}}nk.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:l}=t;return n.button===of.RightClick?!1:(l==null||l({event:n}),!0)}}];const Ku={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class lk extends Vh{constructor(t){super(t,Ku)}static setup(){return window.addEventListener(Ku.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ku.move.name,t)};function t(){}}}lk.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:l}=t;const{touches:a}=n;return a.length>1?!1:(l==null||l({event:n}),!0)}}];var hi;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(hi||(hi={}));var lc;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(lc||(lc={}));function ak(e){let{acceleration:t,activator:n=hi.Pointer,canScroll:l,draggingRect:a,enabled:s,interval:i=5,order:r=lc.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:h}=e;const p=ik({delta:f,disabled:!s}),[x,S]=g5(),w=b.useRef({x:0,y:0}),g=b.useRef({x:0,y:0}),y=b.useMemo(()=>{switch(n){case hi.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case hi.DraggableRect:return a}},[n,a,c]),m=b.useRef(null),v=b.useCallback(()=>{const E=m.current;if(!E)return;const M=w.current.x*g.current.x,T=w.current.y*g.current.y;E.scrollBy(M,T)},[]),j=b.useMemo(()=>r===lc.TreeOrder?[...u].reverse():u,[r,u]);b.useEffect(()=>{if(!s||!u.length||!y){S();return}for(const E of j){if((l==null?void 0:l(E))===!1)continue;const M=u.indexOf(E),T=d[M];if(!T)continue;const{direction:C,speed:H}=Q5(E,T,y,t,h);for(const A of["x","y"])p[A][C[A]]||(H[A]=0,C[A]=0);if(H.x>0||H.y>0){S(),m.current=E,x(v,i),w.current=H,g.current=C;return}}w.current={x:0,y:0},g.current={x:0,y:0},S()},[t,v,l,S,s,i,JSON.stringify(y),JSON.stringify(p),x,u,j,d,JSON.stringify(h)])}const sk={x:{[We.Backward]:!1,[We.Forward]:!1},y:{[We.Backward]:!1,[We.Forward]:!1}};function ik(e){let{delta:t,disabled:n}=e;const l=Po(t);return lr(a=>{if(n||!l||!a)return sk;const s={x:Math.sign(t.x-l.x),y:Math.sign(t.y-l.y)};return{x:{[We.Backward]:a.x[We.Backward]||s.x===-1,[We.Forward]:a.x[We.Forward]||s.x===1},y:{[We.Backward]:a.y[We.Backward]||s.y===-1,[We.Forward]:a.y[We.Forward]||s.y===1}}},[n,t,l])}function rk(e,t){const n=t!=null?e.get(t):void 0,l=n?n.node.current:null;return lr(a=>{var s;return t==null?null:(s=l??a)!=null?s:null},[l,t])}function ok(e,t){return b.useMemo(()=>e.reduce((n,l)=>{const{sensor:a}=l,s=a.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,l)}));return[...n,...s]},[]),[e,t])}var zi;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(zi||(zi={}));var cf;(function(e){e.Optimized="optimized"})(cf||(cf={}));const mm=new Map;function ck(e,t){let{dragging:n,dependencies:l,config:a}=t;const[s,i]=b.useState(null),{frequency:r,measure:c,strategy:u}=a,d=b.useRef(e),f=w(),h=Di(f),p=b.useCallback(function(g){g===void 0&&(g=[]),!h.current&&i(y=>y===null?g:y.concat(g.filter(m=>!y.includes(m))))},[h]),x=b.useRef(null),S=lr(g=>{if(f&&!n)return mm;if(!g||g===mm||d.current!==e||s!=null){const y=new Map;for(let m of e){if(!m)continue;if(s&&s.length>0&&!s.includes(m.id)&&m.rect.current){y.set(m.id,m.rect.current);continue}const v=m.node.current,j=v?new qh(c(v),v):null;m.rect.current=j,j&&y.set(m.id,j)}return y}return g},[e,s,n,f,c]);return b.useEffect(()=>{d.current=e},[e]),b.useEffect(()=>{f||p()},[n,f]),b.useEffect(()=>{s&&s.length>0&&i(null)},[JSON.stringify(s)]),b.useEffect(()=>{f||typeof r!="number"||x.current!==null||(x.current=setTimeout(()=>{p(),x.current=null},r))},[r,f,p,...l]),{droppableRects:S,measureDroppableContainers:p,measuringScheduled:s!=null};function w(){switch(u){case zi.Always:return!1;case zi.BeforeDragging:return n;default:return!n}}}function Gh(e,t){return lr(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function uk(e,t){return Gh(e,t)}function dk(e){let{callback:t,disabled:n}=e;const l=$c(t),a=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(l)},[l,n]);return b.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function Bc(e){let{callback:t,disabled:n}=e;const l=$c(t),a=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(l)},[n]);return b.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function fk(e){return new qh(As(e),e)}function xm(e,t,n){t===void 0&&(t=fk);const[l,a]=b.useState(null);function s(){a(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 i=dk({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}}}}),r=Bc({callback:s});return on(()=>{s(),e?(r==null||r.observe(e),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(r==null||r.disconnect(),i==null||i.disconnect())},[e]),l}function hk(e){const t=Gh(e);return Fv(e,t)}const ym=[];function pk(e){const t=b.useRef(e),n=lr(l=>e?l&&l!==ym&&e&&t.current&&e.parentNode===t.current.parentNode?l:Uh(e):ym,[e]);return b.useEffect(()=>{t.current=e},[e]),n}function gk(e){const[t,n]=b.useState(null),l=b.useRef(e),a=b.useCallback(s=>{const i=Zu(s.target);i&&n(r=>r?(r.set(i,rf(i)),new Map(r)):null)},[]);return b.useEffect(()=>{const s=l.current;if(e!==s){i(s);const r=e.map(c=>{const u=Zu(c);return u?(u.addEventListener("scroll",a,{passive:!0}),[u,rf(u)]):null}).filter(c=>c!=null);n(r.length?new Map(r):null),l.current=e}return()=>{i(e),i(s)};function i(r){r.forEach(c=>{const u=Zu(c);u==null||u.removeEventListener("scroll",a)})}},[a,e]),b.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,i)=>Ja(s,i),cn):s1(e):cn,[e,t])}function vm(e,t){t===void 0&&(t=[]);const n=b.useRef(null);return b.useEffect(()=>{n.current=null},t),b.useEffect(()=>{const l=e!==cn;l&&!n.current&&(n.current=e),!l&&n.current&&(n.current=null)},[e]),n.current?ec(e,n.current):cn}function mk(e){b.useEffect(()=>{if(!Hc)return;const t=e.map(n=>{let{sensor:l}=n;return l.setup==null?void 0:l.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function xk(e,t){return b.useMemo(()=>e.reduce((n,l)=>{let{eventName:a,handler:s}=l;return n[a]=i=>{s(i,t)},n},{}),[e,t])}function o1(e){return b.useMemo(()=>e?Y5(e):null,[e])}const bm=[];function yk(e,t){t===void 0&&(t=As);const[n]=e,l=o1(n?ft(n):null),[a,s]=b.useState(bm);function i(){s(()=>e.length?e.map(c=>l1(c)?l:new qh(t(c),c)):bm)}const r=Bc({callback:i});return on(()=>{r==null||r.disconnect(),i(),e.forEach(c=>r==null?void 0:r.observe(c))},[e]),a}function c1(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return nr(t)?t:e}function vk(e){let{measure:t}=e;const[n,l]=b.useState(null),a=b.useCallback(u=>{for(const{target:d}of u)if(nr(d)){l(f=>{const h=t(d);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),s=Bc({callback:a}),i=b.useCallback(u=>{const d=c1(u);s==null||s.disconnect(),d&&(s==null||s.observe(d)),l(d?t(d):null)},[t,s]),[r,c]=Fo(i);return b.useMemo(()=>({nodeRef:r,rect:n,setRef:c}),[n,r,c])}const bk=[{sensor:Xh,options:{}},{sensor:Yh,options:{}}],wk={current:{}},uo={draggable:{measure:fm},droppable:{measure:fm,strategy:zi.WhileDragging,frequency:cf.Optimized},dragOverlay:{measure:As}};class pi 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,l;return(n=(l=this.get(t))==null?void 0:l.node.current)!=null?n:void 0}}const Sk={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new pi,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:nc},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:uo,measureDroppableContainers:nc,windowRect:null,measuringScheduled:!1},u1={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:nc,draggableNodes:new Map,over:null,measureDroppableContainers:nc},sr=b.createContext(u1),d1=b.createContext(Sk);function Nk(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new pi}}}function jk(e,t){switch(t.type){case Ge.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ge.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 Ge.DragEnd:case Ge.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ge.RegisterDroppable:{const{element:n}=t,{id:l}=n,a=new pi(e.droppable.containers);return a.set(l,n),{...e,droppable:{...e.droppable,containers:a}}}case Ge.SetDroppableDisabled:{const{id:n,key:l,disabled:a}=t,s=e.droppable.containers.get(n);if(!s||l!==s.key)return e;const i=new pi(e.droppable.containers);return i.set(n,{...s,disabled:a}),{...e,droppable:{...e.droppable,containers:i}}}case Ge.UnregisterDroppable:{const{id:n,key:l}=t,a=e.droppable.containers.get(n);if(!a||l!==a.key)return e;const s=new pi(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function kk(e){let{disabled:t}=e;const{active:n,activatorEvent:l,draggableNodes:a}=b.useContext(sr),s=Po(l),i=Po(n==null?void 0:n.id);return b.useEffect(()=>{if(!t&&!l&&s&&i!=null){if(!Lc(s)||document.activeElement===s.target)return;const r=a.get(i);if(!r)return;const{activatorNode:c,node:u}=r;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[c.current,u.current]){if(!d)continue;const f=y5(d);if(f){f.focus();break}}})}},[l,t,a,i,s]),null}function f1(e,t){let{transform:n,...l}=t;return e!=null&&e.length?e.reduce((a,s)=>s({transform:a,...l}),n):n}function Ek(e){return b.useMemo(()=>({draggable:{...uo.draggable,...e==null?void 0:e.draggable},droppable:{...uo.droppable,...e==null?void 0:e.droppable},dragOverlay:{...uo.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 Ck(e){let{activeNode:t,measure:n,initialRect:l,config:a=!0}=e;const s=b.useRef(!1),{x:i,y:r}=typeof a=="boolean"?{x:a,y:a}:a;on(()=>{if(!i&&!r||!t){s.current=!1;return}if(s.current||!l)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=n(u),f=Fv(d,l);if(i||(f.x=0),r||(f.y=0),s.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=e1(u);h&&h.scrollBy({top:f.y,left:f.x})}},[t,i,r,l,n])}const Uc=b.createContext({...cn,scaleX:1,scaleY:1});var fl;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(fl||(fl={}));const Mk=b.memo(function(t){var n,l,a,s;let{id:i,accessibility:r,autoScroll:c=!0,children:u,sensors:d=bk,collisionDetection:f=H5,measuring:h,modifiers:p,...x}=t;const S=b.useReducer(jk,void 0,Nk),[w,g]=S,[y,m]=j5(),[v,j]=b.useState(fl.Uninitialized),E=v===fl.Initialized,{draggable:{active:M,nodes:T,translate:C},droppable:{containers:H}}=w,A=M!=null?T.get(M):null,$=b.useRef({initial:null,translated:null}),V=b.useMemo(()=>{var Ie;return M!=null?{id:M,data:(Ie=A==null?void 0:A.data)!=null?Ie:wk,rect:$}:null},[M,A]),N=b.useRef(null),[z,k]=b.useState(null),[R,D]=b.useState(null),O=Di(x,Object.values(x)),q=ar("DndDescribedBy",i),X=b.useMemo(()=>H.getEnabled(),[H]),L=Ek(h),{droppableRects:Y,measureDroppableContainers:_,measuringScheduled:U}=ck(X,{dragging:E,dependencies:[C.x,C.y],config:L.droppable}),G=rk(T,M),I=b.useMemo(()=>R?tc(R):null,[R]),B=su(),K=uk(G,L.draggable.measure);Ck({activeNode:M!=null?T.get(M):null,config:B.layoutShiftCompensation,initialRect:K,measure:L.draggable.measure});const W=xm(G,L.draggable.measure,K),F=xm(G?G.parentElement:null),J=b.useRef({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:H,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),P=H.getNodeFor((n=J.current.over)==null?void 0:n.id),ne=vk({measure:L.dragOverlay.measure}),ae=(l=ne.nodeRef.current)!=null?l:G,te=E?(a=ne.rect)!=null?a:W:null,Z=!!(ne.nodeRef.current&&ne.rect),ve=hk(Z?null:W),xe=o1(ae?ft(ae):null),Se=pk(E?P??G:null),Nt=yk(Se),Ht=f1(p,{transform:{x:C.x-ve.x,y:C.y-ve.y,scaleX:1,scaleY:1},activatorEvent:R,active:V,activeNodeRect:W,containerNodeRect:F,draggingNodeRect:te,over:J.current.over,overlayNodeRect:ne.rect,scrollableAncestors:Se,scrollableAncestorRects:Nt,windowRect:xe}),Wt=I?Ja(I,C):null,fn=gk(Se),ll=vm(fn),Jt=vm(fn,[W]),st=Ja(Ht,ll),An=te?B5(te,Ht):null,Bl=V&&An?f({active:V,collisionRect:An,droppableRects:Y,droppableContainers:X,pointerCoordinates:Wt}):null,wa=z5(Bl,"id"),[hn,fr]=b.useState(null),eu=Z?Ht:Ja(Ht,Jt),tu=$5(eu,(s=hn==null?void 0:hn.rect)!=null?s:null,W),Ds=b.useRef(null),hr=b.useCallback((Ie,it)=>{let{sensor:rt,options:pn}=it;if(N.current==null)return;const ht=T.get(N.current);if(!ht)return;const ot=Ie.nativeEvent,$t=new rt({active:N.current,activeNode:ht,event:ot,options:pn,context:J,onAbort(Xe){if(!T.get(Xe))return;const{onDragAbort:Lt}=O.current,Ft={id:Xe};Lt==null||Lt(Ft),y({type:"onDragAbort",event:Ft})},onPending(Xe,gn,Lt,Ft){if(!T.get(Xe))return;const{onDragPending:ql}=O.current,mn={id:Xe,constraint:gn,initialCoordinates:Lt,offset:Ft};ql==null||ql(mn),y({type:"onDragPending",event:mn})},onStart(Xe){const gn=N.current;if(gn==null)return;const Lt=T.get(gn);if(!Lt)return;const{onDragStart:Ft}=O.current,Ul={activatorEvent:ot,active:{id:gn,data:Lt.data,rect:$}};Wl.unstable_batchedUpdates(()=>{Ft==null||Ft(Ul),j(fl.Initializing),g({type:Ge.DragStart,initialCoordinates:Xe,active:gn}),y({type:"onDragStart",event:Ul}),k(Ds.current),D(ot)})},onMove(Xe){g({type:Ge.DragMove,coordinates:Xe})},onEnd:al(Ge.DragEnd),onCancel:al(Ge.DragCancel)});Ds.current=$t;function al(Xe){return async function(){const{active:Lt,collisions:Ft,over:Ul,scrollAdjustedTranslate:ql}=J.current;let mn=null;if(Lt&&ql){const{cancelDrop:Yl}=O.current;mn={activatorEvent:ot,active:Lt,collisions:Ft,delta:ql,over:Ul},Xe===Ge.DragEnd&&typeof Yl=="function"&&await Promise.resolve(Yl(mn))&&(Xe=Ge.DragCancel)}N.current=null,Wl.unstable_batchedUpdates(()=>{g({type:Xe}),j(fl.Uninitialized),fr(null),k(null),D(null),Ds.current=null;const Yl=Xe===Ge.DragEnd?"onDragEnd":"onDragCancel";if(mn){const zs=O.current[Yl];zs==null||zs(mn),y({type:Yl,event:mn})}})}}},[T]),nu=b.useCallback((Ie,it)=>(rt,pn)=>{const ht=rt.nativeEvent,ot=T.get(pn);if(N.current!==null||!ot||ht.dndKit||ht.defaultPrevented)return;const $t={active:ot};Ie(rt,it.options,$t)===!0&&(ht.dndKit={capturedBy:it.sensor},N.current=pn,hr(rt,it))},[T,hr]),pr=ok(d,nu);mk(d),on(()=>{W&&v===fl.Initializing&&j(fl.Initialized)},[W,v]),b.useEffect(()=>{const{onDragMove:Ie}=O.current,{active:it,activatorEvent:rt,collisions:pn,over:ht}=J.current;if(!it||!rt)return;const ot={active:it,activatorEvent:rt,collisions:pn,delta:{x:st.x,y:st.y},over:ht};Wl.unstable_batchedUpdates(()=>{Ie==null||Ie(ot),y({type:"onDragMove",event:ot})})},[st.x,st.y]),b.useEffect(()=>{const{active:Ie,activatorEvent:it,collisions:rt,droppableContainers:pn,scrollAdjustedTranslate:ht}=J.current;if(!Ie||N.current==null||!it||!ht)return;const{onDragOver:ot}=O.current,$t=pn.get(wa),al=$t&&$t.rect.current?{id:$t.id,rect:$t.rect.current,data:$t.data,disabled:$t.disabled}:null,Xe={active:Ie,activatorEvent:it,collisions:rt,delta:{x:ht.x,y:ht.y},over:al};Wl.unstable_batchedUpdates(()=>{fr(al),ot==null||ot(Xe),y({type:"onDragOver",event:Xe})})},[wa]),on(()=>{J.current={activatorEvent:R,active:V,activeNode:G,collisionRect:An,collisions:Bl,droppableRects:Y,draggableNodes:T,draggingNode:ae,draggingNodeRect:te,droppableContainers:H,over:hn,scrollableAncestors:Se,scrollAdjustedTranslate:st},$.current={initial:te,translated:An}},[V,G,Bl,An,T,ae,te,Y,H,hn,Se,st]),ak({...B,delta:C,draggingRect:An,pointerCoordinates:Wt,scrollableAncestors:Se,scrollableAncestorRects:Nt});const lu=b.useMemo(()=>({active:V,activeNode:G,activeNodeRect:W,activatorEvent:R,collisions:Bl,containerNodeRect:F,dragOverlay:ne,draggableNodes:T,droppableContainers:H,droppableRects:Y,over:hn,measureDroppableContainers:_,scrollableAncestors:Se,scrollableAncestorRects:Nt,measuringConfiguration:L,measuringScheduled:U,windowRect:xe}),[V,G,W,R,Bl,F,ne,T,H,Y,hn,_,Se,Nt,L,U,xe]),au=b.useMemo(()=>({activatorEvent:R,activators:pr,active:V,activeNodeRect:W,ariaDescribedById:{draggable:q},dispatch:g,draggableNodes:T,over:hn,measureDroppableContainers:_}),[R,pr,V,W,g,q,T,hn,_]);return _e.createElement(Jv.Provider,{value:m},_e.createElement(sr.Provider,{value:au},_e.createElement(d1.Provider,{value:lu},_e.createElement(Uc.Provider,{value:tu},u)),_e.createElement(kk,{disabled:(r==null?void 0:r.restoreFocus)===!1})),_e.createElement(C5,{...r,hiddenTextDescribedById:q}));function su(){const Ie=(z==null?void 0:z.autoScrollEnabled)===!1,it=typeof c=="object"?c.enabled===!1:c===!1,rt=E&&!Ie&&!it;return typeof c=="object"?{...c,enabled:rt}:{enabled:rt}}}),_k=b.createContext(null),wm="button",Tk="Draggable";function Ak(e){let{id:t,data:n,disabled:l=!1,attributes:a}=e;const s=ar(Tk),{activators:i,activatorEvent:r,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:h}=b.useContext(sr),{role:p=wm,roleDescription:x="draggable",tabIndex:S=0}=a??{},w=(c==null?void 0:c.id)===t,g=b.useContext(w?Uc:_k),[y,m]=Fo(),[v,j]=Fo(),E=xk(i,t),M=Di(n);on(()=>(f.set(t,{id:t,key:s,node:y,activatorNode:v,data:M}),()=>{const C=f.get(t);C&&C.key===s&&f.delete(t)}),[f,t]);const T=b.useMemo(()=>({role:p,tabIndex:S,"aria-disabled":l,"aria-pressed":w&&p===wm?!0:void 0,"aria-roledescription":x,"aria-describedby":d.draggable}),[l,p,S,w,x,d.draggable]);return{active:c,activatorEvent:r,activeNodeRect:u,attributes:T,isDragging:w,listeners:l?void 0:E,node:y,over:h,setNodeRef:m,setActivatorNodeRef:j,transform:g}}function h1(){return b.useContext(d1)}const Dk="Droppable",zk={timeout:25};function p1(e){let{data:t,disabled:n=!1,id:l,resizeObserverConfig:a}=e;const s=ar(Dk),{active:i,dispatch:r,over:c,measureDroppableContainers:u}=b.useContext(sr),d=b.useRef({disabled:n}),f=b.useRef(!1),h=b.useRef(null),p=b.useRef(null),{disabled:x,updateMeasurementsFor:S,timeout:w}={...zk,...a},g=Di(S??l),y=b.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},w)},[w]),m=Bc({callback:y,disabled:x||!i}),v=b.useCallback((T,C)=>{m&&(C&&(m.unobserve(C),f.current=!1),T&&m.observe(T))},[m]),[j,E]=Fo(v),M=Di(t);return b.useEffect(()=>{!m||!j.current||(m.disconnect(),f.current=!1,m.observe(j.current))},[j,m]),b.useEffect(()=>(r({type:Ge.RegisterDroppable,element:{id:l,key:s,disabled:n,node:j,rect:h,data:M}}),()=>r({type:Ge.UnregisterDroppable,key:s,id:l})),[l]),b.useEffect(()=>{n!==d.current.disabled&&(r({type:Ge.SetDroppableDisabled,id:l,key:s,disabled:n}),d.current.disabled=n)},[l,s,n,r]),{active:i,rect:h,isOver:(c==null?void 0:c.id)===l,node:j,over:c,setNodeRef:E}}function Rk(e){let{animation:t,children:n}=e;const[l,a]=b.useState(null),[s,i]=b.useState(null),r=Po(n);return!n&&!l&&r&&a(r),on(()=>{if(!s)return;const c=l==null?void 0:l.key,u=l==null?void 0:l.props.id;if(c==null||u==null){a(null);return}Promise.resolve(t(u,s)).then(()=>{a(null)})},[t,l,s]),_e.createElement(_e.Fragment,null,n,l?b.cloneElement(l,{ref:i}):null)}const Ok={x:0,y:0,scaleX:1,scaleY:1};function Hk(e){let{children:t}=e;return _e.createElement(sr.Provider,{value:u1},_e.createElement(Uc.Provider,{value:Ok},t))}const $k={position:"fixed",touchAction:"none"},Lk=e=>Lc(e)?"transform 250ms ease":void 0,Bk=b.forwardRef((e,t)=>{let{as:n,activatorEvent:l,adjustScale:a,children:s,className:i,rect:r,style:c,transform:u,transition:d=Lk}=e;if(!r)return null;const f=a?u:{...u,scaleX:1,scaleY:1},h={...$k,width:r.width,height:r.height,top:r.top,left:r.left,transform:Hl.Transform.toString(f),transformOrigin:a&&l?T5(l,r):void 0,transition:typeof d=="function"?d(l):d,...c};return _e.createElement(n,{className:i,style:h,ref:t},s)}),Uk=e=>t=>{let{active:n,dragOverlay:l}=t;const a={},{styles:s,className:i}=e;if(s!=null&&s.active)for(const[r,c]of Object.entries(s.active))c!==void 0&&(a[r]=n.node.style.getPropertyValue(r),n.node.style.setProperty(r,c));if(s!=null&&s.dragOverlay)for(const[r,c]of Object.entries(s.dragOverlay))c!==void 0&&l.node.style.setProperty(r,c);return i!=null&&i.active&&n.node.classList.add(i.active),i!=null&&i.dragOverlay&&l.node.classList.add(i.dragOverlay),function(){for(const[c,u]of Object.entries(a))n.node.style.setProperty(c,u);i!=null&&i.active&&n.node.classList.remove(i.active)}},qk=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Hl.Transform.toString(t)},{transform:Hl.Transform.toString(n)}]},Yk={duration:250,easing:"ease",keyframes:qk,sideEffects:Uk({styles:{active:{opacity:"0"}}})};function Vk(e){let{config:t,draggableNodes:n,droppableContainers:l,measuringConfiguration:a}=e;return $c((s,i)=>{if(t===null)return;const r=n.get(s);if(!r)return;const c=r.node.current;if(!c)return;const u=c1(i);if(!u)return;const{transform:d}=ft(i).getComputedStyle(i),f=Pv(d);if(!f)return;const h=typeof t=="function"?t:Xk(t);return i1(c,a.draggable.measure),h({active:{id:s,data:r.data,node:c,rect:a.draggable.measure(c)},draggableNodes:n,dragOverlay:{node:i,rect:a.dragOverlay.measure(u)},droppableContainers:l,measuringConfiguration:a,transform:f})})}function Xk(e){const{duration:t,easing:n,sideEffects:l,keyframes:a}={...Yk,...e};return s=>{let{active:i,dragOverlay:r,transform:c,...u}=s;if(!t)return;const d={x:r.rect.left-i.rect.left,y:r.rect.top-i.rect.top},f={scaleX:c.scaleX!==1?i.rect.width*c.scaleX/r.rect.width:1,scaleY:c.scaleY!==1?i.rect.height*c.scaleY/r.rect.height:1},h={x:c.x-d.x,y:c.y-d.y,...f},p=a({...u,active:i,dragOverlay:r,transform:{initial:c,final:h}}),[x]=p,S=p[p.length-1];if(JSON.stringify(x)===JSON.stringify(S))return;const w=l==null?void 0:l({active:i,dragOverlay:r,...u}),g=r.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(y=>{g.onfinish=()=>{w==null||w(),y()}})}}let Sm=0;function Gk(e){return b.useMemo(()=>{if(e!=null)return Sm++,Sm},[e])}const Qk=_e.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:l,style:a,transition:s,modifiers:i,wrapperElement:r="div",className:c,zIndex:u=999}=e;const{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggableNodes:x,droppableContainers:S,dragOverlay:w,over:g,measuringConfiguration:y,scrollableAncestors:m,scrollableAncestorRects:v,windowRect:j}=h1(),E=b.useContext(Uc),M=Gk(f==null?void 0:f.id),T=f1(i,{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:w.rect,over:g,overlayNodeRect:w.rect,scrollableAncestors:m,scrollableAncestorRects:v,transform:E,windowRect:j}),C=Gh(h),H=Vk({config:l,draggableNodes:x,droppableContainers:S,measuringConfiguration:y}),A=C?w.setRef:void 0;return _e.createElement(Hk,null,_e.createElement(Rk,{animation:H},f&&M?_e.createElement(Bk,{key:M,id:f.id,ref:A,as:r,activatorEvent:d,adjustScale:t,className:c,transition:s,rect:C,style:{zIndex:u,...a},transform:T},n):null))});function g1(e,t,n){const l=e.slice();return l.splice(n<0?l.length+n:n,0,l.splice(t,1)[0]),l}function Zk(e,t){return e.reduce((n,l,a)=>{const s=t.get(l);return s&&(n[a]=s),n},Array(e.length))}function Hr(e){return e!==null&&e>=0}function Ik(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 Kk(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const m1=e=>{let{rects:t,activeIndex:n,overIndex:l,index:a}=e;const s=g1(t,l,n),i=t[a],r=s[a];return!r||!i?null:{x:r.left-i.left,y:r.top-i.top,scaleX:r.width/i.width,scaleY:r.height/i.height}},$r={scaleX:1,scaleY:1},Wk=e=>{var t;let{activeIndex:n,activeNodeRect:l,index:a,rects:s,overIndex:i}=e;const r=(t=s[n])!=null?t:l;if(!r)return null;if(a===n){const u=s[i];return u?{x:0,y:n<i?u.top+u.height-(r.top+r.height):u.top-r.top,...$r}:null}const c=Jk(s,a,n);return a>n&&a<=i?{x:0,y:-r.height-c,...$r}:a<n&&a>=i?{x:0,y:r.height+c,...$r}:{x:0,y:0,...$r}};function Jk(e,t,n){const l=e[t],a=e[t-1],s=e[t+1];return l?n<t?a?l.top-(a.top+a.height):s?s.top-(l.top+l.height):0:s?s.top-(l.top+l.height):a?l.top-(a.top+a.height):0:0}const x1="Sortable",y1=_e.createContext({activeIndex:-1,containerId:x1,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:m1,disabled:{draggable:!1,droppable:!1}});function Fk(e){let{children:t,id:n,items:l,strategy:a=m1,disabled:s=!1}=e;const{active:i,dragOverlay:r,droppableRects:c,over:u,measureDroppableContainers:d}=h1(),f=ar(x1,n),h=r.rect!==null,p=b.useMemo(()=>l.map(E=>typeof E=="object"&&"id"in E?E.id:E),[l]),x=i!=null,S=i?p.indexOf(i.id):-1,w=u?p.indexOf(u.id):-1,g=b.useRef(p),y=!Ik(p,g.current),m=w!==-1&&S===-1||y,v=Kk(s);on(()=>{y&&x&&d(p)},[y,p,x,d]),b.useEffect(()=>{g.current=p},[p]);const j=b.useMemo(()=>({activeIndex:S,containerId:f,disabled:v,disableTransforms:m,items:p,overIndex:w,useDragOverlay:h,sortedRects:Zk(p,c),strategy:a}),[S,f,v.draggable,v.droppable,m,p,w,c,h,a]);return _e.createElement(y1.Provider,{value:j},t)}const Pk=e=>{let{id:t,items:n,activeIndex:l,overIndex:a}=e;return g1(n,l,a).indexOf(t)},e3=e=>{let{containerId:t,isSorting:n,wasDragging:l,index:a,items:s,newIndex:i,previousItems:r,previousContainerId:c,transition:u}=e;return!u||!l||r!==s&&a===i?!1:n?!0:i!==a&&t===c},t3={duration:200,easing:"ease"},v1="transform",n3=Hl.Transition.toString({property:v1,duration:0,easing:"linear"}),l3={roleDescription:"sortable"};function a3(e){let{disabled:t,index:n,node:l,rect:a}=e;const[s,i]=b.useState(null),r=b.useRef(n);return on(()=>{if(!t&&n!==r.current&&l.current){const c=a.current;if(c){const u=As(l.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)&&i(d)}}n!==r.current&&(r.current=n)},[t,n,l,a]),b.useEffect(()=>{s&&i(null)},[s]),s}function s3(e){let{animateLayoutChanges:t=e3,attributes:n,disabled:l,data:a,getNewIndex:s=Pk,id:i,strategy:r,resizeObserverConfig:c,transition:u=t3}=e;const{items:d,containerId:f,activeIndex:h,disabled:p,disableTransforms:x,sortedRects:S,overIndex:w,useDragOverlay:g,strategy:y}=b.useContext(y1),m=i3(l,p),v=d.indexOf(i),j=b.useMemo(()=>({sortable:{containerId:f,index:v,items:d},...a}),[f,a,v,d]),E=b.useMemo(()=>d.slice(d.indexOf(i)),[d,i]),{rect:M,node:T,isOver:C,setNodeRef:H}=p1({id:i,data:j,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...c}}),{active:A,activatorEvent:$,activeNodeRect:V,attributes:N,setNodeRef:z,listeners:k,isDragging:R,over:D,setActivatorNodeRef:O,transform:q}=Ak({id:i,data:j,attributes:{...l3,...n},disabled:m.draggable}),X=p5(H,z),L=!!A,Y=L&&!x&&Hr(h)&&Hr(w),_=!g&&R,U=_&&Y?q:null,I=Y?U??(r??y)({rects:S,activeNodeRect:V,activeIndex:h,overIndex:w,index:v}):null,B=Hr(h)&&Hr(w)?s({id:i,items:d,activeIndex:h,overIndex:w}):v,K=A==null?void 0:A.id,W=b.useRef({activeId:K,items:d,newIndex:B,containerId:f}),F=d!==W.current.items,J=t({active:A,containerId:f,isDragging:R,isSorting:L,id:i,index:v,items:d,newIndex:W.current.newIndex,previousItems:W.current.items,previousContainerId:W.current.containerId,transition:u,wasDragging:W.current.activeId!=null}),P=a3({disabled:!J,index:v,node:T,rect:M});return b.useEffect(()=>{L&&W.current.newIndex!==B&&(W.current.newIndex=B),f!==W.current.containerId&&(W.current.containerId=f),d!==W.current.items&&(W.current.items=d)},[L,B,f,d]),b.useEffect(()=>{if(K===W.current.activeId)return;if(K!=null&&W.current.activeId==null){W.current.activeId=K;return}const ae=setTimeout(()=>{W.current.activeId=K},50);return()=>clearTimeout(ae)},[K]),{active:A,activeIndex:h,attributes:N,data:j,rect:M,index:v,newIndex:B,items:d,isOver:C,isSorting:L,isDragging:R,listeners:k,node:T,overIndex:w,over:D,setNodeRef:X,setActivatorNodeRef:O,setDroppableNodeRef:H,setDraggableNodeRef:z,transform:P??I,transition:ne()};function ne(){if(P||F&&W.current.newIndex===v)return n3;if(!(_&&!Lc($)||!u)&&(L||J))return Hl.Transition.toString({...u,property:v1})}}function i3(e,t){var n,l;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(l=e==null?void 0:e.droppable)!=null?l:t.droppable}}pe.Down,pe.Right,pe.Up,pe.Left;const Qh=[{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"}],Nm=new Map(Qh.map(e=>[e.id,e]));function fo(e){for(const t of Qh)if(t.statuses.includes(e))return t.id;return null}function r3(e){const t=new Map;for(const n of e){const l=fo(n.status);l&&t.set(n.id,l)}return t}const jm=["canceled","failed"],o3={critical:"var(--red)",high:"var(--yellow)",medium:"var(--muted)",low:"var(--green)"},Zh={human:"H",agent:"A",notify:"N"};function c3({task:e}){const t=o3[e.priority]||"var(--muted)",n=e.scheduled_at?new Date(e.scheduled_at).toLocaleDateString(void 0,{month:"short",day:"numeric"}):null;return o.jsxs("div",{className:"glass-card rounded-xl p-3 mb-2 w-[256px] select-none",children:[o.jsx("div",{className:"flex items-center justify-between mb-1.5",children:o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"currentColor",className:"text-muted2",children:[o.jsx("circle",{cx:"3",cy:"2",r:"1"}),o.jsx("circle",{cx:"9",cy:"2",r:"1"}),o.jsx("circle",{cx:"3",cy:"6",r:"1"}),o.jsx("circle",{cx:"9",cy:"6",r:"1"}),o.jsx("circle",{cx:"3",cy:"10",r:"1"}),o.jsx("circle",{cx:"9",cy:"10",r:"1"})]}),o.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:t}})]})}),o.jsx("div",{className:"text-[12.5px] font-medium text-fg mb-1.5 leading-snug line-clamp-3",children:e.title}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[o.jsxs("span",{className:"text-[9px] font-mono font-bold px-1 py-0.5 rounded leading-none",style:{color:"var(--muted)"},children:["[",Zh[e.mode]||"?","]"]}),e.scope==="project"&&o.jsx("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded leading-none",style:{color:"var(--muted)"},children:"proj"}),n&&o.jsx("span",{className:"text-[9px] text-muted2",children:n}),e.tags.slice(0,3).map(l=>o.jsx("span",{className:"leather-tag text-[9px] px-1.5 py-0.5 rounded-full text-muted",children:l},l)),e.tags.length>3&&o.jsxs("span",{className:"text-[9px] text-muted2",children:["+",e.tags.length-3]})]})]})}function u3({task:e,onEdit:t,onRemove:n}){const{attributes:l,listeners:a,setNodeRef:s,transform:i,isDragging:r}=s3({id:e.id,animateLayoutChanges:()=>!1}),c={transform:Hl.Transform.toString(i),opacity:r?0:1};return o.jsxs("div",{ref:s,style:c,className:"cursor-grab active:cursor-grabbing",...l,...a,onClick:()=>t(e),children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("div",{}),o.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:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.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}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap px-3 pb-2",children:[o.jsxs("span",{className:"text-[9px] font-mono font-bold px-1 py-0.5 rounded leading-none",style:{color:"var(--muted)"},children:["[",Zh[e.mode]||"?","]"]}),e.scope==="project"&&o.jsx("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded leading-none",style:{color:"var(--muted)"},children:"proj"}),e.scheduled_at&&o.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=>o.jsx("span",{className:"leather-tag text-[9px] px-1.5 py-0.5 rounded-full text-muted",children:u},u)),e.tags.length>3&&o.jsxs("span",{className:"text-[9px] text-muted2",children:["+",e.tags.length-3]})]})]})}function d3({column:e,tasks:t,isDragging:n,onEdit:l,onRemove:a,className:s=""}){const{setNodeRef:i,isOver:r}=p1({id:e.id}),c=function(u){return o.jsx(u3,{task:u,onEdit:l,onRemove:a},u.id)};return o.jsxs("div",{className:`flex flex-col h-full min-w-[260px] sm:flex-1 ${s}`,children:[o.jsx("div",{className:"flex items-center justify-between px-3 py-2.5 shrink-0",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-[12px] font-semibold font-display",style:{color:"var(--gold)"},children:e.label}),o.jsx("span",{className:"text-[10px] font-mono text-muted bg-s3 px-1.5 py-0.5 rounded",children:t.length})]})}),o.jsxs("div",{ref:i,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:r?"color-mix(in srgb, var(--gold) 8%, transparent)":"transparent"},children:[t.map(c),t.length===0&&o.jsx("div",{className:"text-center py-8 text-[11px] text-muted2 min-h-[120px] flex items-center justify-center",children:"No tasks"})]})]})}function km({task:e,onSave:t,onClose:n}){const[l,a]=b.useState((e==null?void 0:e.title)??""),[s,i]=b.useState((e==null?void 0:e.description)??""),[r,c]=b.useState((e==null?void 0:e.priority)??"medium"),[u,d]=b.useState((e==null?void 0:e.mode)??"human"),[f,h]=b.useState((e==null?void 0:e.scope)??"personal"),[p,x]=b.useState((e==null?void 0:e.status)??"backlog"),[S,w]=b.useState(()=>{if(e!=null&&e.scheduled_at){const v=new Date(e.scheduled_at),j=v.getTimezoneOffset()*6e4;return new Date(v.getTime()-j).toISOString().slice(0,16)}return""}),[g,y]=b.useState((e==null?void 0:e.tags.join(", "))??""),m=()=>{l.trim()&&t({title:l.trim(),description:s.trim(),priority:r,mode:u,scope:f,status:p,tags:g.split(",").map(v=>v.trim()).filter(Boolean),scheduled_at:S?new Date(S).getTime():void 0})};return o.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:o.jsxs("div",{className:"w-full max-w-[420px] rounded-2xl shadow-2xl animate-scaleIn select-none glass-card p-5",onClick:v=>v.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between pb-3 mb-4",style:{borderBottom:"1px solid var(--b1)"},children:[o.jsx("span",{className:"font-bold text-[13.5px] font-display",style:{color:"var(--cream)"},children:e?"Edit Task":"New Task"}),o.jsx("button",{onClick:n,className:"text-muted hover:text-fg transition-colors cursor-pointer",children:o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Title"}),o.jsx("input",{type:"text",value:l,onChange:v=>a(v.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})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Description"}),o.jsx("textarea",{value:s,onChange:v=>i(v.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)"}})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Priority"}),o.jsxs("select",{value:r,onChange:v=>c(v.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:[o.jsx("option",{value:"low",children:"Low"}),o.jsx("option",{value:"medium",children:"Medium"}),o.jsx("option",{value:"high",children:"High"}),o.jsx("option",{value:"critical",children:"Critical"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Mode"}),o.jsxs("select",{value:u,onChange:v=>d(v.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:[o.jsx("option",{value:"human",children:"Human"}),o.jsx("option",{value:"agent",children:"Agent"}),o.jsx("option",{value:"notify",children:"Notify"})]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Scope"}),o.jsxs("select",{value:f,onChange:v=>h(v.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:[o.jsx("option",{value:"personal",children:"Personal"}),o.jsx("option",{value:"project",children:"Project"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Status"}),o.jsxs("select",{value:p,onChange:v=>x(v.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:[o.jsx("option",{value:"backlog",children:"Backlog"}),o.jsx("option",{value:"todo",children:"To Do"}),o.jsx("option",{value:"in_progress",children:"In Progress"}),o.jsx("option",{value:"done",children:"Done"})]})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Scheduled (optional)"}),o.jsx("input",{type:"datetime-local",value:S,onChange:v=>w(v.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)"}})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-[10px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Tags (comma-separated)"}),o.jsx("input",{type:"text",value:g,onChange:v=>y(v.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)"}})]})]}),o.jsxs("div",{className:"flex gap-2 mt-5",children:[o.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"}),o.jsx("button",{onClick:m,disabled:!l.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 f3({rpc:e,className:t}){const{ws:n}=_n(),[l,a]=b.useState([]),[s,i]=b.useState(!0),[r,c]=b.useState(null),[u,d]=b.useState(!1),[f,h]=b.useState(!1),[p,x]=b.useState("all"),[S,w]=b.useState("all"),[g,y]=b.useState("all"),[m,v]=b.useState(!1),j=b.useRef(null),[E,M]=b.useState({top:0,left:0}),[T,C]=b.useState(null),H=b.useCallback(async()=>{if(e)try{const _={};p!=="all"&&(_.mode=p),S!=="all"&&(_.priority=S),g!=="all"&&(_.scope=g);const U=await e.todoList(Object.keys(_).length?_:void 0);a(Array.isArray(U)?U:[])}catch(_){console.error("[Kanban] Failed to fetch tasks:",_)}finally{i(!1)}},[e,p,S,g]);b.useEffect(()=>{H()},[H]),b.useEffect(()=>{if(!n)return;const _=()=>H(),U=n.on("todo-changed",_),G=n.on("cron-task-fired",_);return()=>{U(),G()}},[n,H]),b.useEffect(()=>{if(!m)return;const _=U=>{U.target.closest("[data-filter-dropdown]")||v(!1)};return document.addEventListener("click",_),()=>document.removeEventListener("click",_)},[m]);const A=b.useMemo(()=>{const _={backlog:[],todo:[],in_progress:[],done:[]};for(const U of l){if(U.mode==="notify")continue;const G=fo(U.status);G&&_[G]&&_[G].push(U)}return Object.values(_).forEach(U=>U.sort((G,I)=>G.order-I.order)),_},[l]),$=b.useMemo(()=>l.filter(_=>jm.includes(_.status)),[l]),V=b.useMemo(()=>r3(l),[l]),N=b.useMemo(()=>{const _={backlog:[],todo:[],in_progress:[],done:[]};for(const U of l){if(U.mode==="notify")continue;const G=fo(U.status);G&&!jm.includes(U.status)&&_[G].push(U.id)}return _},[l]),z=M5(um(Xh,{activationConstraint:{delay:250,tolerance:5}}),um(Yh)),[k,R]=b.useState(!1),D=b.useCallback(_=>{R(!0),C(String(_.active.id))},[]),O=b.useCallback(()=>{R(!1),C(null)},[]),q=b.useCallback(async _=>{const{active:U,over:G}=_;if(!G||!e){R(!1),C(null);return}const I=String(U.id),B=String(G.id),K=l.find(ae=>ae.id===I);if(!K){R(!1),C(null);return}if(!V.get(I)){R(!1),C(null);return}let F=K.status;const J=Nm.get(B);if(J)F=J.defaultStatus;else{const ae=l.find(te=>te.id===B);if(ae){const te=fo(ae.status);te&&(F=Nm.get(te).defaultStatus)}}if(K.status!==F){const ae=K.status;a(te=>te.map(Z=>Z.id===I?{...Z,status:F}:Z));try{await e.todoUpdate({id:I,status:F})}catch{a(te=>te.map(Z=>Z.id===I?{...Z,status:ae}:Z))}}else try{await e.todoUpdate({id:I})}catch{}C(null),R(!1)},[e,l,V]),X=b.useCallback(async _=>{e&&(await e.todoCreate({title:(_.title??"").trim(),description:_.description,priority:_.priority??"medium",mode:_.mode??"human",scope:_.scope??"personal",status:_.status??"backlog",tags:_.tags,scheduled_at:_.scheduled_at}),h(!1))},[e]),L=b.useCallback(async _=>{!e||!r||(await e.todoUpdate({id:r.id,..._}),c(null))},[e,r]),Y=b.useCallback(async _=>{e&&await e.todoRemove(_)},[e]);return s?o.jsx("div",{className:t||"",children:o.jsx("div",{className:"flex items-center justify-center h-full text-muted text-xs",children:"Loading tasks..."})}):o.jsxs("div",{className:`flex flex-col h-full ${t||""}`,children:[o.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--b1)"},children:[o.jsx("h2",{className:"text-[13px] font-semibold font-display",style:{color:"var(--cream)"},children:"Tasks"}),o.jsxs("div",{className:"relative","data-filter-dropdown":!0,children:[o.jsx("button",{ref:j,onClick:()=>{if(!m&&j.current){const _=j.current.getBoundingClientRect(),U=200;let G=_.left;G+U>window.innerWidth-8&&(G=window.innerWidth-U-8),M({top:_.bottom+4,left:Math.max(G,8)})}v(!m)},className:"p-1.5 rounded-lg cursor-pointer transition-colors",style:{background:p!=="all"||S!=="all"||g!=="all"?"var(--s3)":"transparent",border:"1px solid var(--b2)",color:"var(--muted)"},children:o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:o.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})})}),m&&Wl.createPortal(o.jsxs("div",{"data-filter-dropdown":!0,className:"fixed rounded-xl shadow-2xl p-3 space-y-2.5 w-[200px]",style:{top:E.top,left:E.left,background:"var(--s1)",border:"1px solid var(--b1)",zIndex:9999},children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-[9px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Mode"}),o.jsx("div",{className:"flex rounded-lg overflow-hidden",style:{border:"1px solid var(--b2)"},children:["all","human","agent","notify"].map(_=>o.jsx("button",{onClick:()=>{x(_),v(!1)},className:"flex-1 px-1.5 py-1 text-[10px] font-mono cursor-pointer transition-all",style:{color:p===_?"var(--gold)":"var(--muted)",background:p===_?"var(--s3)":"transparent"},children:_==="all"?"All":_.charAt(0).toUpperCase()+_.slice(1)},_))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-[9px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Priority"}),o.jsxs("select",{value:S,onChange:_=>{w(_.target.value),v(!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:[o.jsx("option",{value:"all",children:"All"}),o.jsx("option",{value:"low",children:"Low"}),o.jsx("option",{value:"medium",children:"Medium"}),o.jsx("option",{value:"high",children:"High"}),o.jsx("option",{value:"critical",children:"Critical"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-[9px] text-muted uppercase tracking-wider font-mono mb-1 block",children:"Scope"}),o.jsx("div",{className:"flex rounded-lg overflow-hidden",style:{border:"1px solid var(--b2)"},children:["all","personal","project"].map(_=>o.jsx("button",{onClick:()=>{y(_),v(!1)},className:"flex-1 px-1.5 py-1 text-[10px] font-mono cursor-pointer transition-all",style:{color:g===_?"var(--gold)":"var(--muted)",background:g===_?"var(--s3)":"transparent"},children:_==="all"?"All":_.charAt(0).toUpperCase()+_.slice(1)},_))})]})]}),document.body)]}),o.jsx("div",{className:"flex-1"}),o.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 ",$.length]}),o.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"})]}),o.jsxs(Mk,{sensors:z,collisionDetection:R5,onDragStart:D,onDragCancel:O,onDragEnd:q,children:[o.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:o.jsx("div",{className:"flex h-full sm:gap-4 sm:flex-row flex-nowrap sm:min-w-0",children:Qh.map(_=>o.jsx(Fk,{items:N[_.id],strategy:Wk,children:o.jsx(d3,{column:_,tasks:A[_.id],isDragging:k,onEdit:c,onRemove:Y,className:"snap-center flex-shrink-0 w-screen sm:w-auto sm:flex-1 px-4 sm:px-0"})},_.id))})}),o.jsx(Qk,{children:T&&o.jsx(c3,{task:l.find(_=>_.id===T)})})]}),u&&$.length>0&&o.jsxs("div",{className:"px-4 py-3 shrink-0",style:{borderTop:"1px solid var(--b1)"},children:[o.jsx("h3",{className:"text-[11px] font-semibold text-muted mb-2",children:"Archived Tasks"}),o.jsx("div",{className:"flex gap-2 flex-wrap",children:$.map(_=>o.jsxs("div",{className:"glass-card rounded-lg px-3 py-2 flex items-center gap-2",style:{opacity:.6},children:[o.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:_.status==="failed"?"var(--red)":"var(--muted2)"}}),o.jsx("span",{className:"text-[11px] text-muted line-through",children:_.title}),o.jsxs("span",{className:"text-[9px] font-mono text-muted2",children:["[",Zh[_.mode],"]"]})]},_.id))})]}),f&&o.jsx(km,{task:null,onSave:X,onClose:()=>h(!1)}),r&&o.jsx(km,{task:r,onSave:L,onClose:()=>c(null)})]})}function Ve(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,l;n<e.length;n++)(l=Ve(e[n]))!==""&&(t+=(t&&" ")+l);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var h3={value:()=>{}};function qc(){for(var e=0,t=arguments.length,n={},l;e<t;++e){if(!(l=arguments[e]+"")||l in n||/[\s.]/.test(l))throw new Error("illegal type: "+l);n[l]=[]}return new ho(n)}function ho(e){this._=e}function p3(e,t){return e.trim().split(/^|\s+/).map(function(n){var l="",a=n.indexOf(".");if(a>=0&&(l=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:l}})}ho.prototype=qc.prototype={constructor:ho,on:function(e,t){var n=this._,l=p3(e+"",n),a,s=-1,i=l.length;if(arguments.length<2){for(;++s<i;)if((a=(e=l[s]).type)&&(a=g3(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(a=(e=l[s]).type)n[a]=Em(n[a],e.name,t);else if(t==null)for(a in n)n[a]=Em(n[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ho(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),l=0,a,s;l<a;++l)n[l]=arguments[l+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],l=0,a=s.length;l<a;++l)s[l].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var l=this._[e],a=0,s=l.length;a<s;++a)l[a].value.apply(t,n)}};function g3(e,t){for(var n=0,l=e.length,a;n<l;++n)if((a=e[n]).name===t)return a.value}function Em(e,t,n){for(var l=0,a=e.length;l<a;++l)if(e[l].name===t){e[l]=h3,e=e.slice(0,l).concat(e.slice(l+1));break}return n!=null&&e.push({name:t,value:n}),e}var uf="http://www.w3.org/1999/xhtml";const Cm={svg:"http://www.w3.org/2000/svg",xhtml:uf,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Yc(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Cm.hasOwnProperty(t)?{space:Cm[t],local:e}:e}function m3(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===uf&&t.documentElement.namespaceURI===uf?t.createElement(e):t.createElementNS(n,e)}}function x3(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function b1(e){var t=Yc(e);return(t.local?x3:m3)(t)}function y3(){}function Ih(e){return e==null?y3:function(){return this.querySelector(e)}}function v3(e){typeof e!="function"&&(e=Ih(e));for(var t=this._groups,n=t.length,l=new Array(n),a=0;a<n;++a)for(var s=t[a],i=s.length,r=l[a]=new Array(i),c,u,d=0;d<i;++d)(c=s[d])&&(u=e.call(c,c.__data__,d,s))&&("__data__"in c&&(u.__data__=c.__data__),r[d]=u);return new Ot(l,this._parents)}function b3(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function w3(){return[]}function w1(e){return e==null?w3:function(){return this.querySelectorAll(e)}}function S3(e){return function(){return b3(e.apply(this,arguments))}}function N3(e){typeof e=="function"?e=S3(e):e=w1(e);for(var t=this._groups,n=t.length,l=[],a=[],s=0;s<n;++s)for(var i=t[s],r=i.length,c,u=0;u<r;++u)(c=i[u])&&(l.push(e.call(c,c.__data__,u,i)),a.push(c));return new Ot(l,a)}function S1(e){return function(){return this.matches(e)}}function N1(e){return function(t){return t.matches(e)}}var j3=Array.prototype.find;function k3(e){return function(){return j3.call(this.children,e)}}function E3(){return this.firstElementChild}function C3(e){return this.select(e==null?E3:k3(typeof e=="function"?e:N1(e)))}var M3=Array.prototype.filter;function _3(){return Array.from(this.children)}function T3(e){return function(){return M3.call(this.children,e)}}function A3(e){return this.selectAll(e==null?_3:T3(typeof e=="function"?e:N1(e)))}function D3(e){typeof e!="function"&&(e=S1(e));for(var t=this._groups,n=t.length,l=new Array(n),a=0;a<n;++a)for(var s=t[a],i=s.length,r=l[a]=[],c,u=0;u<i;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&r.push(c);return new Ot(l,this._parents)}function j1(e){return new Array(e.length)}function z3(){return new Ot(this._enter||this._groups.map(j1),this._parents)}function ac(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}ac.prototype={constructor:ac,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function R3(e){return function(){return e}}function O3(e,t,n,l,a,s){for(var i=0,r,c=t.length,u=s.length;i<u;++i)(r=t[i])?(r.__data__=s[i],l[i]=r):n[i]=new ac(e,s[i]);for(;i<c;++i)(r=t[i])&&(a[i]=r)}function H3(e,t,n,l,a,s,i){var r,c,u=new Map,d=t.length,f=s.length,h=new Array(d),p;for(r=0;r<d;++r)(c=t[r])&&(h[r]=p=i.call(c,c.__data__,r,t)+"",u.has(p)?a[r]=c:u.set(p,c));for(r=0;r<f;++r)p=i.call(e,s[r],r,s)+"",(c=u.get(p))?(l[r]=c,c.__data__=s[r],u.delete(p)):n[r]=new ac(e,s[r]);for(r=0;r<d;++r)(c=t[r])&&u.get(h[r])===c&&(a[r]=c)}function $3(e){return e.__data__}function L3(e,t){if(!arguments.length)return Array.from(this,$3);var n=t?H3:O3,l=this._parents,a=this._groups;typeof e!="function"&&(e=R3(e));for(var s=a.length,i=new Array(s),r=new Array(s),c=new Array(s),u=0;u<s;++u){var d=l[u],f=a[u],h=f.length,p=B3(e.call(d,d&&d.__data__,u,l)),x=p.length,S=r[u]=new Array(x),w=i[u]=new Array(x),g=c[u]=new Array(h);n(d,f,S,w,g,p,t);for(var y=0,m=0,v,j;y<x;++y)if(v=S[y]){for(y>=m&&(m=y+1);!(j=w[m])&&++m<x;);v._next=j||null}}return i=new Ot(i,l),i._enter=r,i._exit=c,i}function B3(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function U3(){return new Ot(this._exit||this._groups.map(j1),this._parents)}function q3(e,t,n){var l=this.enter(),a=this,s=this.exit();return typeof e=="function"?(l=e(l),l&&(l=l.selection())):l=l.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?s.remove():n(s),l&&a?l.merge(a).order():a}function Y3(e){for(var t=e.selection?e.selection():e,n=this._groups,l=t._groups,a=n.length,s=l.length,i=Math.min(a,s),r=new Array(a),c=0;c<i;++c)for(var u=n[c],d=l[c],f=u.length,h=r[c]=new Array(f),p,x=0;x<f;++x)(p=u[x]||d[x])&&(h[x]=p);for(;c<a;++c)r[c]=n[c];return new Ot(r,this._parents)}function V3(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var l=e[t],a=l.length-1,s=l[a],i;--a>=0;)(i=l[a])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function X3(e){e||(e=G3);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,l=n.length,a=new Array(l),s=0;s<l;++s){for(var i=n[s],r=i.length,c=a[s]=new Array(r),u,d=0;d<r;++d)(u=i[d])&&(c[d]=u);c.sort(t)}return new Ot(a,this._parents).order()}function G3(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Q3(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Z3(){return Array.from(this)}function I3(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var l=e[t],a=0,s=l.length;a<s;++a){var i=l[a];if(i)return i}return null}function K3(){let e=0;for(const t of this)++e;return e}function W3(){return!this.node()}function J3(e){for(var t=this._groups,n=0,l=t.length;n<l;++n)for(var a=t[n],s=0,i=a.length,r;s<i;++s)(r=a[s])&&e.call(r,r.__data__,s,a);return this}function F3(e){return function(){this.removeAttribute(e)}}function P3(e){return function(){this.removeAttributeNS(e.space,e.local)}}function eE(e,t){return function(){this.setAttribute(e,t)}}function tE(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function nE(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function lE(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function aE(e,t){var n=Yc(e);if(arguments.length<2){var l=this.node();return n.local?l.getAttributeNS(n.space,n.local):l.getAttribute(n)}return this.each((t==null?n.local?P3:F3:typeof t=="function"?n.local?lE:nE:n.local?tE:eE)(n,t))}function k1(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function sE(e){return function(){this.style.removeProperty(e)}}function iE(e,t,n){return function(){this.style.setProperty(e,t,n)}}function rE(e,t,n){return function(){var l=t.apply(this,arguments);l==null?this.style.removeProperty(e):this.style.setProperty(e,l,n)}}function oE(e,t,n){return arguments.length>1?this.each((t==null?sE:typeof t=="function"?rE:iE)(e,t,n??"")):ds(this.node(),e)}function ds(e,t){return e.style.getPropertyValue(t)||k1(e).getComputedStyle(e,null).getPropertyValue(t)}function cE(e){return function(){delete this[e]}}function uE(e,t){return function(){this[e]=t}}function dE(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function fE(e,t){return arguments.length>1?this.each((t==null?cE:typeof t=="function"?dE:uE)(e,t)):this.node()[e]}function E1(e){return e.trim().split(/^|\s+/)}function Kh(e){return e.classList||new C1(e)}function C1(e){this._node=e,this._names=E1(e.getAttribute("class")||"")}C1.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function M1(e,t){for(var n=Kh(e),l=-1,a=t.length;++l<a;)n.add(t[l])}function _1(e,t){for(var n=Kh(e),l=-1,a=t.length;++l<a;)n.remove(t[l])}function hE(e){return function(){M1(this,e)}}function pE(e){return function(){_1(this,e)}}function gE(e,t){return function(){(t.apply(this,arguments)?M1:_1)(this,e)}}function mE(e,t){var n=E1(e+"");if(arguments.length<2){for(var l=Kh(this.node()),a=-1,s=n.length;++a<s;)if(!l.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?gE:t?hE:pE)(n,t))}function xE(){this.textContent=""}function yE(e){return function(){this.textContent=e}}function vE(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function bE(e){return arguments.length?this.each(e==null?xE:(typeof e=="function"?vE:yE)(e)):this.node().textContent}function wE(){this.innerHTML=""}function SE(e){return function(){this.innerHTML=e}}function NE(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function jE(e){return arguments.length?this.each(e==null?wE:(typeof e=="function"?NE:SE)(e)):this.node().innerHTML}function kE(){this.nextSibling&&this.parentNode.appendChild(this)}function EE(){return this.each(kE)}function CE(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ME(){return this.each(CE)}function _E(e){var t=typeof e=="function"?e:b1(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function TE(){return null}function AE(e,t){var n=typeof e=="function"?e:b1(e),l=t==null?TE:typeof t=="function"?t:Ih(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),l.apply(this,arguments)||null)})}function DE(){var e=this.parentNode;e&&e.removeChild(this)}function zE(){return this.each(DE)}function RE(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function OE(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function HE(e){return this.select(e?OE:RE)}function $E(e){return arguments.length?this.property("__data__",e):this.node().__data__}function LE(e){return function(t){e.call(this,t,this.__data__)}}function BE(e){return e.trim().split(/^|\s+/).map(function(t){var n="",l=t.indexOf(".");return l>=0&&(n=t.slice(l+1),t=t.slice(0,l)),{type:t,name:n}})}function UE(e){return function(){var t=this.__on;if(t){for(var n=0,l=-1,a=t.length,s;n<a;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++l]=s;++l?t.length=l:delete this.__on}}}function qE(e,t,n){return function(){var l=this.__on,a,s=LE(t);if(l){for(var i=0,r=l.length;i<r;++i)if((a=l[i]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=s,a.options=n),a.value=t;return}}this.addEventListener(e.type,s,n),a={type:e.type,name:e.name,value:t,listener:s,options:n},l?l.push(a):this.__on=[a]}}function YE(e,t,n){var l=BE(e+""),a,s=l.length,i;if(arguments.length<2){var r=this.node().__on;if(r){for(var c=0,u=r.length,d;c<u;++c)for(a=0,d=r[c];a<s;++a)if((i=l[a]).type===d.type&&i.name===d.name)return d.value}return}for(r=t?qE:UE,a=0;a<s;++a)this.each(r(l[a],t,n));return this}function T1(e,t,n){var l=k1(e),a=l.CustomEvent;typeof a=="function"?a=new a(t,n):(a=l.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function VE(e,t){return function(){return T1(this,e,t)}}function XE(e,t){return function(){return T1(this,e,t.apply(this,arguments))}}function GE(e,t){return this.each((typeof t=="function"?XE:VE)(e,t))}function*QE(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var l=e[t],a=0,s=l.length,i;a<s;++a)(i=l[a])&&(yield i)}var A1=[null];function Ot(e,t){this._groups=e,this._parents=t}function ir(){return new Ot([[document.documentElement]],A1)}function ZE(){return this}Ot.prototype=ir.prototype={constructor:Ot,select:v3,selectAll:N3,selectChild:C3,selectChildren:A3,filter:D3,data:L3,enter:z3,exit:U3,join:q3,merge:Y3,selection:ZE,order:V3,sort:X3,call:Q3,nodes:Z3,node:I3,size:K3,empty:W3,each:J3,attr:aE,style:oE,property:fE,classed:mE,text:bE,html:jE,raise:EE,lower:ME,append:_E,insert:AE,remove:zE,clone:HE,datum:$E,on:YE,dispatch:GE,[Symbol.iterator]:QE};function Ct(e){return typeof e=="string"?new Ot([[document.querySelector(e)]],[document.documentElement]):new Ot([[e]],A1)}function IE(e){let t;for(;t=e.sourceEvent;)e=t;return e}function tn(e,t){if(e=IE(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var l=n.createSVGPoint();return l.x=e.clientX,l.y=e.clientY,l=l.matrixTransform(t.getScreenCTM().inverse()),[l.x,l.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const KE={passive:!1},Ri={capture:!0,passive:!1};function Wu(e){e.stopImmediatePropagation()}function Fa(e){e.preventDefault(),e.stopImmediatePropagation()}function D1(e){var t=e.document.documentElement,n=Ct(e).on("dragstart.drag",Fa,Ri);"onselectstart"in t?n.on("selectstart.drag",Fa,Ri):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function z1(e,t){var n=e.document.documentElement,l=Ct(e).on("dragstart.drag",null);t&&(l.on("click.drag",Fa,Ri),setTimeout(function(){l.on("click.drag",null)},0)),"onselectstart"in n?l.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Lr=e=>()=>e;function df(e,{sourceEvent:t,subject:n,target:l,identifier:a,active:s,x:i,y:r,dx:c,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:l,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:r,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}df.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function WE(e){return!e.ctrlKey&&!e.button}function JE(){return this.parentNode}function FE(e,t){return t??{x:e.x,y:e.y}}function PE(){return navigator.maxTouchPoints||"ontouchstart"in this}function R1(){var e=WE,t=JE,n=FE,l=PE,a={},s=qc("start","drag","end"),i=0,r,c,u,d,f=0;function h(v){v.on("mousedown.drag",p).filter(l).on("touchstart.drag",w).on("touchmove.drag",g,KE).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(v,j){if(!(d||!e.call(this,v,j))){var E=m(this,t.call(this,v,j),v,j,"mouse");E&&(Ct(v.view).on("mousemove.drag",x,Ri).on("mouseup.drag",S,Ri),D1(v.view),Wu(v),u=!1,r=v.clientX,c=v.clientY,E("start",v))}}function x(v){if(Fa(v),!u){var j=v.clientX-r,E=v.clientY-c;u=j*j+E*E>f}a.mouse("drag",v)}function S(v){Ct(v.view).on("mousemove.drag mouseup.drag",null),z1(v.view,u),Fa(v),a.mouse("end",v)}function w(v,j){if(e.call(this,v,j)){var E=v.changedTouches,M=t.call(this,v,j),T=E.length,C,H;for(C=0;C<T;++C)(H=m(this,M,v,j,E[C].identifier,E[C]))&&(Wu(v),H("start",v,E[C]))}}function g(v){var j=v.changedTouches,E=j.length,M,T;for(M=0;M<E;++M)(T=a[j[M].identifier])&&(Fa(v),T("drag",v,j[M]))}function y(v){var j=v.changedTouches,E=j.length,M,T;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),M=0;M<E;++M)(T=a[j[M].identifier])&&(Wu(v),T("end",v,j[M]))}function m(v,j,E,M,T,C){var H=s.copy(),A=tn(C||E,j),$,V,N;if((N=n.call(v,new df("beforestart",{sourceEvent:E,target:h,identifier:T,active:i,x:A[0],y:A[1],dx:0,dy:0,dispatch:H}),M))!=null)return $=N.x-A[0]||0,V=N.y-A[1]||0,function z(k,R,D){var O=A,q;switch(k){case"start":a[T]=z,q=i++;break;case"end":delete a[T],--i;case"drag":A=tn(D||R,j),q=i;break}H.call(k,v,new df(k,{sourceEvent:R,subject:N,target:h,identifier:T,active:q,x:A[0]+$,y:A[1]+V,dx:A[0]-O[0],dy:A[1]-O[1],dispatch:H}),M)}}return h.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Lr(!!v),h):e},h.container=function(v){return arguments.length?(t=typeof v=="function"?v:Lr(v),h):t},h.subject=function(v){return arguments.length?(n=typeof v=="function"?v:Lr(v),h):n},h.touchable=function(v){return arguments.length?(l=typeof v=="function"?v:Lr(!!v),h):l},h.on=function(){var v=s.on.apply(s,arguments);return v===s?h:v},h.clickDistance=function(v){return arguments.length?(f=(v=+v)*v,h):Math.sqrt(f)},h}function Wh(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function O1(e,t){var n=Object.create(e.prototype);for(var l in t)n[l]=t[l];return n}function rr(){}var Oi=.7,sc=1/Oi,Pa="\\s*([+-]?\\d+)\\s*",Hi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",kn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",eC=/^#([0-9a-f]{3,8})$/,tC=new RegExp(`^rgb\\(${Pa},${Pa},${Pa}\\)$`),nC=new RegExp(`^rgb\\(${kn},${kn},${kn}\\)$`),lC=new RegExp(`^rgba\\(${Pa},${Pa},${Pa},${Hi}\\)$`),aC=new RegExp(`^rgba\\(${kn},${kn},${kn},${Hi}\\)$`),sC=new RegExp(`^hsl\\(${Hi},${kn},${kn}\\)$`),iC=new RegExp(`^hsla\\(${Hi},${kn},${kn},${Hi}\\)$`),Mm={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Wh(rr,da,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:_m,formatHex:_m,formatHex8:rC,formatHsl:oC,formatRgb:Tm,toString:Tm});function _m(){return this.rgb().formatHex()}function rC(){return this.rgb().formatHex8()}function oC(){return H1(this).formatHsl()}function Tm(){return this.rgb().formatRgb()}function da(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=eC.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Am(t):n===3?new vt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Br(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Br(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=tC.exec(e))?new vt(t[1],t[2],t[3],1):(t=nC.exec(e))?new vt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=lC.exec(e))?Br(t[1],t[2],t[3],t[4]):(t=aC.exec(e))?Br(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=sC.exec(e))?Rm(t[1],t[2]/100,t[3]/100,1):(t=iC.exec(e))?Rm(t[1],t[2]/100,t[3]/100,t[4]):Mm.hasOwnProperty(e)?Am(Mm[e]):e==="transparent"?new vt(NaN,NaN,NaN,0):null}function Am(e){return new vt(e>>16&255,e>>8&255,e&255,1)}function Br(e,t,n,l){return l<=0&&(e=t=n=NaN),new vt(e,t,n,l)}function cC(e){return e instanceof rr||(e=da(e)),e?(e=e.rgb(),new vt(e.r,e.g,e.b,e.opacity)):new vt}function ff(e,t,n,l){return arguments.length===1?cC(e):new vt(e,t,n,l??1)}function vt(e,t,n,l){this.r=+e,this.g=+t,this.b=+n,this.opacity=+l}Wh(vt,ff,O1(rr,{brighter(e){return e=e==null?sc:Math.pow(sc,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Oi:Math.pow(Oi,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new vt(la(this.r),la(this.g),la(this.b),ic(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Dm,formatHex:Dm,formatHex8:uC,formatRgb:zm,toString:zm}));function Dm(){return`#${Jl(this.r)}${Jl(this.g)}${Jl(this.b)}`}function uC(){return`#${Jl(this.r)}${Jl(this.g)}${Jl(this.b)}${Jl((isNaN(this.opacity)?1:this.opacity)*255)}`}function zm(){const e=ic(this.opacity);return`${e===1?"rgb(":"rgba("}${la(this.r)}, ${la(this.g)}, ${la(this.b)}${e===1?")":`, ${e})`}`}function ic(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function la(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Jl(e){return e=la(e),(e<16?"0":"")+e.toString(16)}function Rm(e,t,n,l){return l<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new an(e,t,n,l)}function H1(e){if(e instanceof an)return new an(e.h,e.s,e.l,e.opacity);if(e instanceof rr||(e=da(e)),!e)return new an;if(e instanceof an)return e;e=e.rgb();var t=e.r/255,n=e.g/255,l=e.b/255,a=Math.min(t,n,l),s=Math.max(t,n,l),i=NaN,r=s-a,c=(s+a)/2;return r?(t===s?i=(n-l)/r+(n<l)*6:n===s?i=(l-t)/r+2:i=(t-n)/r+4,r/=c<.5?s+a:2-s-a,i*=60):r=c>0&&c<1?0:i,new an(i,r,c,e.opacity)}function dC(e,t,n,l){return arguments.length===1?H1(e):new an(e,t,n,l??1)}function an(e,t,n,l){this.h=+e,this.s=+t,this.l=+n,this.opacity=+l}Wh(an,dC,O1(rr,{brighter(e){return e=e==null?sc:Math.pow(sc,e),new an(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Oi:Math.pow(Oi,e),new an(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,l=n+(n<.5?n:1-n)*t,a=2*n-l;return new vt(Ju(e>=240?e-240:e+120,a,l),Ju(e,a,l),Ju(e<120?e+240:e-120,a,l),this.opacity)},clamp(){return new an(Om(this.h),Ur(this.s),Ur(this.l),ic(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=ic(this.opacity);return`${e===1?"hsl(":"hsla("}${Om(this.h)}, ${Ur(this.s)*100}%, ${Ur(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Om(e){return e=(e||0)%360,e<0?e+360:e}function Ur(e){return Math.max(0,Math.min(1,e||0))}function Ju(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Jh=e=>()=>e;function fC(e,t){return function(n){return e+n*t}}function hC(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(l){return Math.pow(e+l*t,n)}}function pC(e){return(e=+e)==1?$1:function(t,n){return n-t?hC(t,n,e):Jh(isNaN(t)?n:t)}}function $1(e,t){var n=t-e;return n?fC(e,n):Jh(isNaN(e)?t:e)}const rc=function e(t){var n=pC(t);function l(a,s){var i=n((a=ff(a)).r,(s=ff(s)).r),r=n(a.g,s.g),c=n(a.b,s.b),u=$1(a.opacity,s.opacity);return function(d){return a.r=i(d),a.g=r(d),a.b=c(d),a.opacity=u(d),a+""}}return l.gamma=e,l}(1);function gC(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,l=t.slice(),a;return function(s){for(a=0;a<n;++a)l[a]=e[a]*(1-s)+t[a]*s;return l}}function mC(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function xC(e,t){var n=t?t.length:0,l=e?Math.min(n,e.length):0,a=new Array(l),s=new Array(n),i;for(i=0;i<l;++i)a[i]=gi(e[i],t[i]);for(;i<n;++i)s[i]=t[i];return function(r){for(i=0;i<l;++i)s[i]=a[i](r);return s}}function yC(e,t){var n=new Date;return e=+e,t=+t,function(l){return n.setTime(e*(1-l)+t*l),n}}function bn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function vC(e,t){var n={},l={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?n[a]=gi(e[a],t[a]):l[a]=t[a];return function(s){for(a in n)l[a]=n[a](s);return l}}var hf=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Fu=new RegExp(hf.source,"g");function bC(e){return function(){return e}}function wC(e){return function(t){return e(t)+""}}function L1(e,t){var n=hf.lastIndex=Fu.lastIndex=0,l,a,s,i=-1,r=[],c=[];for(e=e+"",t=t+"";(l=hf.exec(e))&&(a=Fu.exec(t));)(s=a.index)>n&&(s=t.slice(n,s),r[i]?r[i]+=s:r[++i]=s),(l=l[0])===(a=a[0])?r[i]?r[i]+=a:r[++i]=a:(r[++i]=null,c.push({i,x:bn(l,a)})),n=Fu.lastIndex;return n<t.length&&(s=t.slice(n),r[i]?r[i]+=s:r[++i]=s),r.length<2?c[0]?wC(c[0].x):bC(t):(t=c.length,function(u){for(var d=0,f;d<t;++d)r[(f=c[d]).i]=f.x(u);return r.join("")})}function gi(e,t){var n=typeof t,l;return t==null||n==="boolean"?Jh(t):(n==="number"?bn:n==="string"?(l=da(t))?(t=l,rc):L1:t instanceof da?rc:t instanceof Date?yC:mC(t)?gC:Array.isArray(t)?xC:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?vC:bn)(e,t)}var Hm=180/Math.PI,pf={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function B1(e,t,n,l,a,s){var i,r,c;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(c=e*n+t*l)&&(n-=e*c,l-=t*c),(r=Math.sqrt(n*n+l*l))&&(n/=r,l/=r,c/=r),e*l<t*n&&(e=-e,t=-t,c=-c,i=-i),{translateX:a,translateY:s,rotate:Math.atan2(t,e)*Hm,skewX:Math.atan(c)*Hm,scaleX:i,scaleY:r}}var qr;function SC(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?pf:B1(t.a,t.b,t.c,t.d,t.e,t.f)}function NC(e){return e==null||(qr||(qr=document.createElementNS("http://www.w3.org/2000/svg","g")),qr.setAttribute("transform",e),!(e=qr.transform.baseVal.consolidate()))?pf:(e=e.matrix,B1(e.a,e.b,e.c,e.d,e.e,e.f))}function U1(e,t,n,l){function a(u){return u.length?u.pop()+" ":""}function s(u,d,f,h,p,x){if(u!==f||d!==h){var S=p.push("translate(",null,t,null,n);x.push({i:S-4,x:bn(u,f)},{i:S-2,x:bn(d,h)})}else(f||h)&&p.push("translate("+f+t+h+n)}function i(u,d,f,h){u!==d?(u-d>180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(a(f)+"rotate(",null,l)-2,x:bn(u,d)})):d&&f.push(a(f)+"rotate("+d+l)}function r(u,d,f,h){u!==d?h.push({i:f.push(a(f)+"skewX(",null,l)-2,x:bn(u,d)}):d&&f.push(a(f)+"skewX("+d+l)}function c(u,d,f,h,p,x){if(u!==f||d!==h){var S=p.push(a(p)+"scale(",null,",",null,")");x.push({i:S-4,x:bn(u,f)},{i:S-2,x:bn(d,h)})}else(f!==1||h!==1)&&p.push(a(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),s(u.translateX,u.translateY,d.translateX,d.translateY,f,h),i(u.rotate,d.rotate,f,h),r(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var x=-1,S=h.length,w;++x<S;)f[(w=h[x]).i]=w.x(p);return f.join("")}}}var jC=U1(SC,"px, ","px)","deg)"),kC=U1(NC,", ",")",")"),EC=1e-12;function $m(e){return((e=Math.exp(e))+1/e)/2}function CC(e){return((e=Math.exp(e))-1/e)/2}function MC(e){return((e=Math.exp(2*e))-1)/(e+1)}const po=function e(t,n,l){function a(s,i){var r=s[0],c=s[1],u=s[2],d=i[0],f=i[1],h=i[2],p=d-r,x=f-c,S=p*p+x*x,w,g;if(S<EC)g=Math.log(h/u)/t,w=function(M){return[r+M*p,c+M*x,u*Math.exp(t*M*g)]};else{var y=Math.sqrt(S),m=(h*h-u*u+l*S)/(2*u*n*y),v=(h*h-u*u-l*S)/(2*h*n*y),j=Math.log(Math.sqrt(m*m+1)-m),E=Math.log(Math.sqrt(v*v+1)-v);g=(E-j)/t,w=function(M){var T=M*g,C=$m(j),H=u/(n*y)*(C*MC(t*T+j)-CC(j));return[r+H*p,c+H*x,u*C/$m(t*T+j)]}}return w.duration=g*1e3*t/Math.SQRT2,w}return a.rho=function(s){var i=Math.max(.001,+s),r=i*i,c=r*r;return e(i,r,c)},a}(Math.SQRT2,2,4);var fs=0,Ws=0,Ys=0,q1=1e3,oc,Js,cc=0,fa=0,Vc=0,$i=typeof performance=="object"&&performance.now?performance:Date,Y1=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Fh(){return fa||(Y1(_C),fa=$i.now()+Vc)}function _C(){fa=0}function uc(){this._call=this._time=this._next=null}uc.prototype=V1.prototype={constructor:uc,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Fh():+n)+(t==null?0:+t),!this._next&&Js!==this&&(Js?Js._next=this:oc=this,Js=this),this._call=e,this._time=n,gf()},stop:function(){this._call&&(this._call=null,this._time=1/0,gf())}};function V1(e,t,n){var l=new uc;return l.restart(e,t,n),l}function TC(){Fh(),++fs;for(var e=oc,t;e;)(t=fa-e._time)>=0&&e._call.call(void 0,t),e=e._next;--fs}function Lm(){fa=(cc=$i.now())+Vc,fs=Ws=0;try{TC()}finally{fs=0,DC(),fa=0}}function AC(){var e=$i.now(),t=e-cc;t>q1&&(Vc-=t,cc=e)}function DC(){for(var e,t=oc,n,l=1/0;t;)t._call?(l>t._time&&(l=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:oc=n);Js=e,gf(l)}function gf(e){if(!fs){Ws&&(Ws=clearTimeout(Ws));var t=e-fa;t>24?(e<1/0&&(Ws=setTimeout(Lm,e-$i.now()-Vc)),Ys&&(Ys=clearInterval(Ys))):(Ys||(cc=$i.now(),Ys=setInterval(AC,q1)),fs=1,Y1(Lm))}}function Bm(e,t,n){var l=new uc;return t=t==null?0:+t,l.restart(a=>{l.stop(),e(a+t)},t,n),l}var zC=qc("start","end","cancel","interrupt"),RC=[],X1=0,Um=1,mf=2,go=3,qm=4,xf=5,mo=6;function Xc(e,t,n,l,a,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;OC(e,n,{name:t,index:l,group:a,on:zC,tween:RC,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:X1})}function Ph(e,t){var n=dn(e,t);if(n.state>X1)throw new Error("too late; already scheduled");return n}function Tn(e,t){var n=dn(e,t);if(n.state>go)throw new Error("too late; already running");return n}function dn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function OC(e,t,n){var l=e.__transition,a;l[t]=n,n.timer=V1(s,0,n.time);function s(u){n.state=Um,n.timer.restart(i,n.delay,n.time),n.delay<=u&&i(u-n.delay)}function i(u){var d,f,h,p;if(n.state!==Um)return c();for(d in l)if(p=l[d],p.name===n.name){if(p.state===go)return Bm(i);p.state===qm?(p.state=mo,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete l[d]):+d<t&&(p.state=mo,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete l[d])}if(Bm(function(){n.state===go&&(n.state=qm,n.timer.restart(r,n.delay,n.time),r(u))}),n.state=mf,n.on.call("start",e,e.__data__,n.index,n.group),n.state===mf){for(n.state=go,a=new Array(h=n.tween.length),d=0,f=-1;d<h;++d)(p=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(a[++f]=p);a.length=f+1}}function r(u){for(var d=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=xf,1),f=-1,h=a.length;++f<h;)a[f].call(e,d);n.state===xf&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=mo,n.timer.stop(),delete l[t];for(var u in l)return;delete e.__transition}}function xo(e,t){var n=e.__transition,l,a,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((l=n[i]).name!==t){s=!1;continue}a=l.state>mf&&l.state<xf,l.state=mo,l.timer.stop(),l.on.call(a?"interrupt":"cancel",e,e.__data__,l.index,l.group),delete n[i]}s&&delete e.__transition}}function HC(e){return this.each(function(){xo(this,e)})}function $C(e,t){var n,l;return function(){var a=Tn(this,e),s=a.tween;if(s!==n){l=n=s;for(var i=0,r=l.length;i<r;++i)if(l[i].name===t){l=l.slice(),l.splice(i,1);break}}a.tween=l}}function LC(e,t,n){var l,a;if(typeof n!="function")throw new Error;return function(){var s=Tn(this,e),i=s.tween;if(i!==l){a=(l=i).slice();for(var r={name:t,value:n},c=0,u=a.length;c<u;++c)if(a[c].name===t){a[c]=r;break}c===u&&a.push(r)}s.tween=a}}function BC(e,t){var n=this._id;if(e+="",arguments.length<2){for(var l=dn(this.node(),n).tween,a=0,s=l.length,i;a<s;++a)if((i=l[a]).name===e)return i.value;return null}return this.each((t==null?$C:LC)(n,e,t))}function ep(e,t,n){var l=e._id;return e.each(function(){var a=Tn(this,l);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return dn(a,l).value[t]}}function G1(e,t){var n;return(typeof t=="number"?bn:t instanceof da?rc:(n=da(t))?(t=n,rc):L1)(e,t)}function UC(e){return function(){this.removeAttribute(e)}}function qC(e){return function(){this.removeAttributeNS(e.space,e.local)}}function YC(e,t,n){var l,a=n+"",s;return function(){var i=this.getAttribute(e);return i===a?null:i===l?s:s=t(l=i,n)}}function VC(e,t,n){var l,a=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===a?null:i===l?s:s=t(l=i,n)}}function XC(e,t,n){var l,a,s;return function(){var i,r=n(this),c;return r==null?void this.removeAttribute(e):(i=this.getAttribute(e),c=r+"",i===c?null:i===l&&c===a?s:(a=c,s=t(l=i,r)))}}function GC(e,t,n){var l,a,s;return function(){var i,r=n(this),c;return r==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),c=r+"",i===c?null:i===l&&c===a?s:(a=c,s=t(l=i,r)))}}function QC(e,t){var n=Yc(e),l=n==="transform"?kC:G1;return this.attrTween(e,typeof t=="function"?(n.local?GC:XC)(n,l,ep(this,"attr."+e,t)):t==null?(n.local?qC:UC)(n):(n.local?VC:YC)(n,l,t))}function ZC(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function IC(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function KC(e,t){var n,l;function a(){var s=t.apply(this,arguments);return s!==l&&(n=(l=s)&&IC(e,s)),n}return a._value=t,a}function WC(e,t){var n,l;function a(){var s=t.apply(this,arguments);return s!==l&&(n=(l=s)&&ZC(e,s)),n}return a._value=t,a}function JC(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var l=Yc(e);return this.tween(n,(l.local?KC:WC)(l,t))}function FC(e,t){return function(){Ph(this,e).delay=+t.apply(this,arguments)}}function PC(e,t){return t=+t,function(){Ph(this,e).delay=t}}function e4(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?FC:PC)(t,e)):dn(this.node(),t).delay}function t4(e,t){return function(){Tn(this,e).duration=+t.apply(this,arguments)}}function n4(e,t){return t=+t,function(){Tn(this,e).duration=t}}function l4(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?t4:n4)(t,e)):dn(this.node(),t).duration}function a4(e,t){if(typeof t!="function")throw new Error;return function(){Tn(this,e).ease=t}}function s4(e){var t=this._id;return arguments.length?this.each(a4(t,e)):dn(this.node(),t).ease}function i4(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Tn(this,e).ease=n}}function r4(e){if(typeof e!="function")throw new Error;return this.each(i4(this._id,e))}function o4(e){typeof e!="function"&&(e=S1(e));for(var t=this._groups,n=t.length,l=new Array(n),a=0;a<n;++a)for(var s=t[a],i=s.length,r=l[a]=[],c,u=0;u<i;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&r.push(c);return new el(l,this._parents,this._name,this._id)}function c4(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,l=t.length,a=n.length,s=Math.min(l,a),i=new Array(l),r=0;r<s;++r)for(var c=t[r],u=n[r],d=c.length,f=i[r]=new Array(d),h,p=0;p<d;++p)(h=c[p]||u[p])&&(f[p]=h);for(;r<l;++r)i[r]=t[r];return new el(i,this._parents,this._name,this._id)}function u4(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function d4(e,t,n){var l,a,s=u4(t)?Ph:Tn;return function(){var i=s(this,e),r=i.on;r!==l&&(a=(l=r).copy()).on(t,n),i.on=a}}function f4(e,t){var n=this._id;return arguments.length<2?dn(this.node(),n).on.on(e):this.each(d4(n,e,t))}function h4(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function p4(){return this.on("end.remove",h4(this._id))}function g4(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ih(e));for(var l=this._groups,a=l.length,s=new Array(a),i=0;i<a;++i)for(var r=l[i],c=r.length,u=s[i]=new Array(c),d,f,h=0;h<c;++h)(d=r[h])&&(f=e.call(d,d.__data__,h,r))&&("__data__"in d&&(f.__data__=d.__data__),u[h]=f,Xc(u[h],t,n,h,u,dn(d,n)));return new el(s,this._parents,t,n)}function m4(e){var t=this._name,n=this._id;typeof e!="function"&&(e=w1(e));for(var l=this._groups,a=l.length,s=[],i=[],r=0;r<a;++r)for(var c=l[r],u=c.length,d,f=0;f<u;++f)if(d=c[f]){for(var h=e.call(d,d.__data__,f,c),p,x=dn(d,n),S=0,w=h.length;S<w;++S)(p=h[S])&&Xc(p,t,n,S,h,x);s.push(h),i.push(d)}return new el(s,i,t,n)}var x4=ir.prototype.constructor;function y4(){return new x4(this._groups,this._parents)}function v4(e,t){var n,l,a;return function(){var s=ds(this,e),i=(this.style.removeProperty(e),ds(this,e));return s===i?null:s===n&&i===l?a:a=t(n=s,l=i)}}function Q1(e){return function(){this.style.removeProperty(e)}}function b4(e,t,n){var l,a=n+"",s;return function(){var i=ds(this,e);return i===a?null:i===l?s:s=t(l=i,n)}}function w4(e,t,n){var l,a,s;return function(){var i=ds(this,e),r=n(this),c=r+"";return r==null&&(c=r=(this.style.removeProperty(e),ds(this,e))),i===c?null:i===l&&c===a?s:(a=c,s=t(l=i,r))}}function S4(e,t){var n,l,a,s="style."+t,i="end."+s,r;return function(){var c=Tn(this,e),u=c.on,d=c.value[s]==null?r||(r=Q1(t)):void 0;(u!==n||a!==d)&&(l=(n=u).copy()).on(i,a=d),c.on=l}}function N4(e,t,n){var l=(e+="")=="transform"?jC:G1;return t==null?this.styleTween(e,v4(e,l)).on("end.style."+e,Q1(e)):typeof t=="function"?this.styleTween(e,w4(e,l,ep(this,"style."+e,t))).each(S4(this._id,e)):this.styleTween(e,b4(e,l,t),n).on("end.style."+e,null)}function j4(e,t,n){return function(l){this.style.setProperty(e,t.call(this,l),n)}}function k4(e,t,n){var l,a;function s(){var i=t.apply(this,arguments);return i!==a&&(l=(a=i)&&j4(e,i,n)),l}return s._value=t,s}function E4(e,t,n){var l="style."+(e+="");if(arguments.length<2)return(l=this.tween(l))&&l._value;if(t==null)return this.tween(l,null);if(typeof t!="function")throw new Error;return this.tween(l,k4(e,t,n??""))}function C4(e){return function(){this.textContent=e}}function M4(e){return function(){var t=e(this);this.textContent=t??""}}function _4(e){return this.tween("text",typeof e=="function"?M4(ep(this,"text",e)):C4(e==null?"":e+""))}function T4(e){return function(t){this.textContent=e.call(this,t)}}function A4(e){var t,n;function l(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&T4(a)),t}return l._value=e,l}function D4(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,A4(e))}function z4(){for(var e=this._name,t=this._id,n=Z1(),l=this._groups,a=l.length,s=0;s<a;++s)for(var i=l[s],r=i.length,c,u=0;u<r;++u)if(c=i[u]){var d=dn(c,t);Xc(c,e,n,u,i,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new el(l,this._parents,e,n)}function R4(){var e,t,n=this,l=n._id,a=n.size();return new Promise(function(s,i){var r={value:i},c={value:function(){--a===0&&s()}};n.each(function(){var u=Tn(this,l),d=u.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(r),t._.interrupt.push(r),t._.end.push(c)),u.on=t}),a===0&&s()})}var O4=0;function el(e,t,n,l){this._groups=e,this._parents=t,this._name=n,this._id=l}function Z1(){return++O4}var Hn=ir.prototype;el.prototype={constructor:el,select:g4,selectAll:m4,selectChild:Hn.selectChild,selectChildren:Hn.selectChildren,filter:o4,merge:c4,selection:y4,transition:z4,call:Hn.call,nodes:Hn.nodes,node:Hn.node,size:Hn.size,empty:Hn.empty,each:Hn.each,on:f4,attr:QC,attrTween:JC,style:N4,styleTween:E4,text:_4,textTween:D4,remove:p4,tween:BC,delay:e4,duration:l4,ease:s4,easeVarying:r4,end:R4,[Symbol.iterator]:Hn[Symbol.iterator]};function H4(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var $4={time:null,delay:0,duration:250,ease:H4};function L4(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function B4(e){var t,n;e instanceof el?(t=e._id,e=e._name):(t=Z1(),(n=$4).time=Fh(),e=e==null?null:e+"");for(var l=this._groups,a=l.length,s=0;s<a;++s)for(var i=l[s],r=i.length,c,u=0;u<r;++u)(c=i[u])&&Xc(c,e,t,u,i,n||L4(c,t));return new el(l,this._parents,e,t)}ir.prototype.interrupt=HC;ir.prototype.transition=B4;const Yr=e=>()=>e;function U4(e,{sourceEvent:t,target:n,transform:l,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:l,enumerable:!0,configurable:!0},_:{value:a}})}function Vn(e,t,n){this.k=e,this.x=t,this.y=n}Vn.prototype={constructor:Vn,scale:function(e){return e===1?this:new Vn(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Vn(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Gc=new Vn(1,0,0);I1.prototype=Vn.prototype;function I1(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Gc;return e.__zoom}function Pu(e){e.stopImmediatePropagation()}function Vs(e){e.preventDefault(),e.stopImmediatePropagation()}function q4(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Y4(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Ym(){return this.__zoom||Gc}function V4(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function X4(){return navigator.maxTouchPoints||"ontouchstart"in this}function G4(e,t,n){var l=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(a>l?(l+a)/2:Math.min(0,l)||Math.max(0,a),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function K1(){var e=q4,t=Y4,n=G4,l=V4,a=X4,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],r=250,c=po,u=qc("start","zoom","end"),d,f,h,p=500,x=150,S=0,w=10;function g(N){N.property("__zoom",Ym).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",H).filter(a).on("touchstart.zoom",A).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(N,z,k,R){var D=N.selection?N.selection():N;D.property("__zoom",Ym),N!==D?j(N,z,k,R):D.interrupt().each(function(){E(this,arguments).event(R).start().zoom(null,typeof z=="function"?z.apply(this,arguments):z).end()})},g.scaleBy=function(N,z,k,R){g.scaleTo(N,function(){var D=this.__zoom.k,O=typeof z=="function"?z.apply(this,arguments):z;return D*O},k,R)},g.scaleTo=function(N,z,k,R){g.transform(N,function(){var D=t.apply(this,arguments),O=this.__zoom,q=k==null?v(D):typeof k=="function"?k.apply(this,arguments):k,X=O.invert(q),L=typeof z=="function"?z.apply(this,arguments):z;return n(m(y(O,L),q,X),D,i)},k,R)},g.translateBy=function(N,z,k,R){g.transform(N,function(){return n(this.__zoom.translate(typeof z=="function"?z.apply(this,arguments):z,typeof k=="function"?k.apply(this,arguments):k),t.apply(this,arguments),i)},null,R)},g.translateTo=function(N,z,k,R,D){g.transform(N,function(){var O=t.apply(this,arguments),q=this.__zoom,X=R==null?v(O):typeof R=="function"?R.apply(this,arguments):R;return n(Gc.translate(X[0],X[1]).scale(q.k).translate(typeof z=="function"?-z.apply(this,arguments):-z,typeof k=="function"?-k.apply(this,arguments):-k),O,i)},R,D)};function y(N,z){return z=Math.max(s[0],Math.min(s[1],z)),z===N.k?N:new Vn(z,N.x,N.y)}function m(N,z,k){var R=z[0]-k[0]*N.k,D=z[1]-k[1]*N.k;return R===N.x&&D===N.y?N:new Vn(N.k,R,D)}function v(N){return[(+N[0][0]+ +N[1][0])/2,(+N[0][1]+ +N[1][1])/2]}function j(N,z,k,R){N.on("start.zoom",function(){E(this,arguments).event(R).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(R).end()}).tween("zoom",function(){var D=this,O=arguments,q=E(D,O).event(R),X=t.apply(D,O),L=k==null?v(X):typeof k=="function"?k.apply(D,O):k,Y=Math.max(X[1][0]-X[0][0],X[1][1]-X[0][1]),_=D.__zoom,U=typeof z=="function"?z.apply(D,O):z,G=c(_.invert(L).concat(Y/_.k),U.invert(L).concat(Y/U.k));return function(I){if(I===1)I=U;else{var B=G(I),K=Y/B[2];I=new Vn(K,L[0]-B[0]*K,L[1]-B[1]*K)}q.zoom(null,I)}})}function E(N,z,k){return!k&&N.__zooming||new M(N,z)}function M(N,z){this.that=N,this.args=z,this.active=0,this.sourceEvent=null,this.extent=t.apply(N,z),this.taps=0}M.prototype={event:function(N){return N&&(this.sourceEvent=N),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(N,z){return this.mouse&&N!=="mouse"&&(this.mouse[1]=z.invert(this.mouse[0])),this.touch0&&N!=="touch"&&(this.touch0[1]=z.invert(this.touch0[0])),this.touch1&&N!=="touch"&&(this.touch1[1]=z.invert(this.touch1[0])),this.that.__zoom=z,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(N){var z=Ct(this.that).datum();u.call(N,this.that,new U4(N,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:u}),z)}};function T(N,...z){if(!e.apply(this,arguments))return;var k=E(this,z).event(N),R=this.__zoom,D=Math.max(s[0],Math.min(s[1],R.k*Math.pow(2,l.apply(this,arguments)))),O=tn(N);if(k.wheel)(k.mouse[0][0]!==O[0]||k.mouse[0][1]!==O[1])&&(k.mouse[1]=R.invert(k.mouse[0]=O)),clearTimeout(k.wheel);else{if(R.k===D)return;k.mouse=[O,R.invert(O)],xo(this),k.start()}Vs(N),k.wheel=setTimeout(q,x),k.zoom("mouse",n(m(y(R,D),k.mouse[0],k.mouse[1]),k.extent,i));function q(){k.wheel=null,k.end()}}function C(N,...z){if(h||!e.apply(this,arguments))return;var k=N.currentTarget,R=E(this,z,!0).event(N),D=Ct(N.view).on("mousemove.zoom",L,!0).on("mouseup.zoom",Y,!0),O=tn(N,k),q=N.clientX,X=N.clientY;D1(N.view),Pu(N),R.mouse=[O,this.__zoom.invert(O)],xo(this),R.start();function L(_){if(Vs(_),!R.moved){var U=_.clientX-q,G=_.clientY-X;R.moved=U*U+G*G>S}R.event(_).zoom("mouse",n(m(R.that.__zoom,R.mouse[0]=tn(_,k),R.mouse[1]),R.extent,i))}function Y(_){D.on("mousemove.zoom mouseup.zoom",null),z1(_.view,R.moved),Vs(_),R.event(_).end()}}function H(N,...z){if(e.apply(this,arguments)){var k=this.__zoom,R=tn(N.changedTouches?N.changedTouches[0]:N,this),D=k.invert(R),O=k.k*(N.shiftKey?.5:2),q=n(m(y(k,O),R,D),t.apply(this,z),i);Vs(N),r>0?Ct(this).transition().duration(r).call(j,q,R,N):Ct(this).call(g.transform,q,R,N)}}function A(N,...z){if(e.apply(this,arguments)){var k=N.touches,R=k.length,D=E(this,z,N.changedTouches.length===R).event(N),O,q,X,L;for(Pu(N),q=0;q<R;++q)X=k[q],L=tn(X,this),L=[L,this.__zoom.invert(L),X.identifier],D.touch0?!D.touch1&&D.touch0[2]!==L[2]&&(D.touch1=L,D.taps=0):(D.touch0=L,O=!0,D.taps=1+!!d);d&&(d=clearTimeout(d)),O&&(D.taps<2&&(f=L[0],d=setTimeout(function(){d=null},p)),xo(this),D.start())}}function $(N,...z){if(this.__zooming){var k=E(this,z).event(N),R=N.changedTouches,D=R.length,O,q,X,L;for(Vs(N),O=0;O<D;++O)q=R[O],X=tn(q,this),k.touch0&&k.touch0[2]===q.identifier?k.touch0[0]=X:k.touch1&&k.touch1[2]===q.identifier&&(k.touch1[0]=X);if(q=k.that.__zoom,k.touch1){var Y=k.touch0[0],_=k.touch0[1],U=k.touch1[0],G=k.touch1[1],I=(I=U[0]-Y[0])*I+(I=U[1]-Y[1])*I,B=(B=G[0]-_[0])*B+(B=G[1]-_[1])*B;q=y(q,Math.sqrt(I/B)),X=[(Y[0]+U[0])/2,(Y[1]+U[1])/2],L=[(_[0]+G[0])/2,(_[1]+G[1])/2]}else if(k.touch0)X=k.touch0[0],L=k.touch0[1];else return;k.zoom("touch",n(m(q,X,L),k.extent,i))}}function V(N,...z){if(this.__zooming){var k=E(this,z).event(N),R=N.changedTouches,D=R.length,O,q;for(Pu(N),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),O=0;O<D;++O)q=R[O],k.touch0&&k.touch0[2]===q.identifier?delete k.touch0:k.touch1&&k.touch1[2]===q.identifier&&delete k.touch1;if(k.touch1&&!k.touch0&&(k.touch0=k.touch1,delete k.touch1),k.touch0)k.touch0[1]=this.__zoom.invert(k.touch0[0]);else if(k.end(),k.taps===2&&(q=tn(q,this),Math.hypot(f[0]-q[0],f[1]-q[1])<w)){var X=Ct(this).on("dblclick.zoom");X&&X.apply(this,arguments)}}}return g.wheelDelta=function(N){return arguments.length?(l=typeof N=="function"?N:Yr(+N),g):l},g.filter=function(N){return arguments.length?(e=typeof N=="function"?N:Yr(!!N),g):e},g.touchable=function(N){return arguments.length?(a=typeof N=="function"?N:Yr(!!N),g):a},g.extent=function(N){return arguments.length?(t=typeof N=="function"?N:Yr([[+N[0][0],+N[0][1]],[+N[1][0],+N[1][1]]]),g):t},g.scaleExtent=function(N){return arguments.length?(s[0]=+N[0],s[1]=+N[1],g):[s[0],s[1]]},g.translateExtent=function(N){return arguments.length?(i[0][0]=+N[0][0],i[1][0]=+N[1][0],i[0][1]=+N[0][1],i[1][1]=+N[1][1],g):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},g.constrain=function(N){return arguments.length?(n=N,g):n},g.duration=function(N){return arguments.length?(r=+N,g):r},g.interpolate=function(N){return arguments.length?(c=N,g):c},g.on=function(){var N=u.on.apply(u,arguments);return N===u?g:N},g.clickDistance=function(N){return arguments.length?(S=(N=+N)*N,g):Math.sqrt(S)},g.tapDistance=function(N){return arguments.length?(w=+N,g):w},g}const En={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:l})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:l}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Li=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],W1=["Enter"," ","Escape"],J1={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var hs;(function(e){e.Strict="strict",e.Loose="loose"})(hs||(hs={}));var aa;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(aa||(aa={}));var Bi;(function(e){e.Partial="partial",e.Full="full"})(Bi||(Bi={}));const F1={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var xl;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(xl||(xl={}));var dc;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(dc||(dc={}));var ee;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ee||(ee={}));const Vm={[ee.Left]:ee.Right,[ee.Right]:ee.Left,[ee.Top]:ee.Bottom,[ee.Bottom]:ee.Top};function P1(e){return e===null?null:e?"valid":"invalid"}const eb=e=>"id"in e&&"source"in e&&"target"in e,Q4=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),tp=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),or=(e,t=[0,0])=>{const{width:n,height:l}=nl(e),a=e.origin??t,s=n*a[0],i=l*a[1];return{x:e.position.x-s,y:e.position.y-i}},Z4=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((l,a)=>{const s=typeof a=="string";let i=!t.nodeLookup&&!s?a:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(a):tp(a)?a:t.nodeLookup.get(a.id));const r=i?fc(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Qc(l,r)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Zc(n)},cr=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},l=!1;return e.forEach(a=>{(t.filter===void 0||t.filter(a))&&(n=Qc(n,fc(a)),l=!0)}),l?Zc(n):{x:0,y:0,width:0,height:0}},np=(e,t,[n,l,a]=[0,0,1],s=!1,i=!1)=>{const r={...dr(t,[n,l,a]),width:t.width/a,height:t.height/a},c=[];for(const u of e.values()){const{measured:d,selectable:f=!0,hidden:h=!1}=u;if(i&&!f||h)continue;const p=d.width??u.width??u.initialWidth??null,x=d.height??u.height??u.initialHeight??null,S=Ui(r,gs(u)),w=(p??0)*(x??0),g=s&&S>0;(!u.internals.handleBounds||g||S>=w||u.dragging)&&c.push(u)}return c},I4=(e,t)=>{const n=new Set;return e.forEach(l=>{n.add(l.id)}),t.filter(l=>n.has(l.source)||n.has(l.target))};function K4(e,t){const n=new Map,l=t!=null&&t.nodes?new Set(t.nodes.map(a=>a.id)):null;return e.forEach(a=>{a.measured.width&&a.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!a.hidden)&&(!l||l.has(a.id))&&n.set(a.id,a)}),n}async function W4({nodes:e,width:t,height:n,panZoom:l,minZoom:a,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const r=K4(e,i),c=cr(r),u=lp(c,t,n,(i==null?void 0:i.minZoom)??a,(i==null?void 0:i.maxZoom)??s,(i==null?void 0:i.padding)??.1);return await l.setViewport(u,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),Promise.resolve(!0)}function tb({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:l=[0,0],nodeExtent:a,onError:s}){const i=n.get(e),r=i.parentId?n.get(i.parentId):void 0,{x:c,y:u}=r?r.internals.positionAbsolute:{x:0,y:0},d=i.origin??l;let f=i.extent||a;if(i.extent==="parent"&&!i.expandParent)if(!r)s==null||s("005",En.error005());else{const p=r.measured.width,x=r.measured.height;p&&x&&(f=[[c,u],[c+p,u+x]])}else r&&ms(i.extent)&&(f=[[i.extent[0][0]+c,i.extent[0][1]+u],[i.extent[1][0]+c,i.extent[1][1]+u]]);const h=ms(f)?ha(t,f,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&(s==null||s("015",En.error015())),{position:{x:h.x-c+(i.measured.width??0)*d[0],y:h.y-u+(i.measured.height??0)*d[1]},positionAbsolute:h}}async function J4({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:l,onBeforeDelete:a}){const s=new Set(e.map(h=>h.id)),i=[];for(const h of n){if(h.deletable===!1)continue;const p=s.has(h.id),x=!p&&h.parentId&&i.find(S=>S.id===h.parentId);(p||x)&&i.push(h)}const r=new Set(t.map(h=>h.id)),c=l.filter(h=>h.deletable!==!1),d=I4(i,c);for(const h of c)r.has(h.id)&&!d.find(x=>x.id===h.id)&&d.push(h);if(!a)return{edges:d,nodes:i};const f=await a({nodes:i,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:i}:{edges:[],nodes:[]}:f}const ps=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ha=(e={x:0,y:0},t,n)=>({x:ps(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:ps(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function nb(e,t,n){const{width:l,height:a}=nl(n),{x:s,y:i}=n.internals.positionAbsolute;return ha(e,[[s,i],[s+l,i+a]],t)}const Xm=(e,t,n)=>e<t?ps(Math.abs(e-t),1,t)/t:e>n?-ps(Math.abs(e-n),1,t)/t:0,lb=(e,t,n=15,l=40)=>{const a=Xm(e.x,l,t.width-l)*n,s=Xm(e.y,l,t.height-l)*n;return[a,s]},Qc=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),yf=({x:e,y:t,width:n,height:l})=>({x:e,y:t,x2:e+n,y2:t+l}),Zc=({x:e,y:t,x2:n,y2:l})=>({x:e,y:t,width:n-e,height:l-t}),gs=(e,t=[0,0])=>{var a,s;const{x:n,y:l}=tp(e)?e.internals.positionAbsolute:or(e,t);return{x:n,y:l,width:((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},fc=(e,t=[0,0])=>{var a,s;const{x:n,y:l}=tp(e)?e.internals.positionAbsolute:or(e,t);return{x:n,y:l,x2:n+(((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0),y2:l+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},ab=(e,t)=>Zc(Qc(yf(e),yf(t))),Ui=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),l=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*l)},Gm=e=>sn(e.width)&&sn(e.height)&&sn(e.x)&&sn(e.y),sn=e=>!isNaN(e)&&isFinite(e),F4=(e,t)=>{},ur=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),dr=({x:e,y:t},[n,l,a],s=!1,i=[1,1])=>{const r={x:(e-n)/a,y:(t-l)/a};return s?ur(r,i):r},hc=({x:e,y:t},[n,l,a])=>({x:e*a+n,y:t*a+l});function ja(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function P4(e,t,n){if(typeof e=="string"||typeof e=="number"){const l=ja(e,n),a=ja(e,t);return{top:l,right:a,bottom:l,left:a,x:a*2,y:l*2}}if(typeof e=="object"){const l=ja(e.top??e.y??0,n),a=ja(e.bottom??e.y??0,n),s=ja(e.left??e.x??0,t),i=ja(e.right??e.x??0,t);return{top:l,right:i,bottom:a,left:s,x:s+i,y:l+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function eM(e,t,n,l,a,s){const{x:i,y:r}=hc(e,[t,n,l]),{x:c,y:u}=hc({x:e.x+e.width,y:e.y+e.height},[t,n,l]),d=a-c,f=s-u;return{left:Math.floor(i),top:Math.floor(r),right:Math.floor(d),bottom:Math.floor(f)}}const lp=(e,t,n,l,a,s)=>{const i=P4(s,t,n),r=(t-i.x)/e.width,c=(n-i.y)/e.height,u=Math.min(r,c),d=ps(u,l,a),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,x=n/2-h*d,S=eM(e,p,x,d,t,n),w={left:Math.min(S.left-i.left,0),top:Math.min(S.top-i.top,0),right:Math.min(S.right-i.right,0),bottom:Math.min(S.bottom-i.bottom,0)};return{x:p-w.left+w.right,y:x-w.top+w.bottom,zoom:d}},qi=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function ms(e){return e!=null&&e!=="parent"}function nl(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function sb(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function ib(e,t={width:0,height:0},n,l,a){const s={...e},i=l.get(n);if(i){const r=i.origin||a;s.x+=i.internals.positionAbsolute.x-(t.width??0)*r[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*r[1]}return s}function Qm(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function tM(){let e,t;return{promise:new Promise((l,a)=>{e=l,t=a}),resolve:e,reject:t}}function nM(e){return{...J1,...e||{}}}function mi(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:l,containerBounds:a}){const{x:s,y:i}=rn(e),r=dr({x:s-((a==null?void 0:a.left)??0),y:i-((a==null?void 0:a.top)??0)},l),{x:c,y:u}=n?ur(r,t):r;return{xSnapped:c,ySnapped:u,...r}}const ap=e=>({width:e.offsetWidth,height:e.offsetHeight}),rb=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},lM=["INPUT","SELECT","TEXTAREA"];function ob(e){var l,a;const t=((a=(l=e.composedPath)==null?void 0:l.call(e))==null?void 0:a[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:lM.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const cb=e=>"clientX"in e,rn=(e,t)=>{var s,i;const n=cb(e),l=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,a=n?e.clientY:(i=e.touches)==null?void 0:i[0].clientY;return{x:l-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},Zm=(e,t,n,l,a)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const r=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:a,position:i.getAttribute("data-handlepos"),x:(r.left-n.left)/l,y:(r.top-n.top)/l,...ap(i)}})};function ub({sourceX:e,sourceY:t,targetX:n,targetY:l,sourceControlX:a,sourceControlY:s,targetControlX:i,targetControlY:r}){const c=e*.125+a*.375+i*.375+n*.125,u=t*.125+s*.375+r*.375+l*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function Vr(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Im({pos:e,x1:t,y1:n,x2:l,y2:a,c:s}){switch(e){case ee.Left:return[t-Vr(t-l,s),n];case ee.Right:return[t+Vr(l-t,s),n];case ee.Top:return[t,n-Vr(n-a,s)];case ee.Bottom:return[t,n+Vr(a-n,s)]}}function db({sourceX:e,sourceY:t,sourcePosition:n=ee.Bottom,targetX:l,targetY:a,targetPosition:s=ee.Top,curvature:i=.25}){const[r,c]=Im({pos:n,x1:e,y1:t,x2:l,y2:a,c:i}),[u,d]=Im({pos:s,x1:l,y1:a,x2:e,y2:t,c:i}),[f,h,p,x]=ub({sourceX:e,sourceY:t,targetX:l,targetY:a,sourceControlX:r,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${r},${c} ${u},${d} ${l},${a}`,f,h,p,x]}function fb({sourceX:e,sourceY:t,targetX:n,targetY:l}){const a=Math.abs(n-e)/2,s=n<e?n+a:n-a,i=Math.abs(l-t)/2,r=l<t?l+i:l-i;return[s,r,a,i]}function aM({sourceNode:e,targetNode:t,selected:n=!1,zIndex:l=0,elevateOnSelect:a=!1,zIndexMode:s="basic"}){if(s==="manual")return l;const i=a&&n?l+1e3:l,r=Math.max(e.parentId||a&&e.selected?e.internals.z:0,t.parentId||a&&t.selected?t.internals.z:0);return i+r}function sM({sourceNode:e,targetNode:t,width:n,height:l,transform:a}){const s=Qc(fc(e),fc(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-a[0]/a[2],y:-a[1]/a[2],width:n/a[2],height:l/a[2]};return Ui(i,Zc(s))>0}const iM=({source:e,sourceHandle:t,target:n,targetHandle:l})=>`xy-edge__${e}${t||""}-${n}${l||""}`,rM=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),oM=(e,t,n={})=>{if(!e.source||!e.target)return t;const l=n.getEdgeId||iM;let a;return eb(e)?a={...e}:a={...e,id:l(e)},rM(a,t)?t:(a.sourceHandle===null&&delete a.sourceHandle,a.targetHandle===null&&delete a.targetHandle,t.concat(a))};function hb({sourceX:e,sourceY:t,targetX:n,targetY:l}){const[a,s,i,r]=fb({sourceX:e,sourceY:t,targetX:n,targetY:l});return[`M ${e},${t}L ${n},${l}`,a,s,i,r]}const Km={[ee.Left]:{x:-1,y:0},[ee.Right]:{x:1,y:0},[ee.Top]:{x:0,y:-1},[ee.Bottom]:{x:0,y:1}},cM=({source:e,sourcePosition:t=ee.Bottom,target:n})=>t===ee.Left||t===ee.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Wm=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function uM({source:e,sourcePosition:t=ee.Bottom,target:n,targetPosition:l=ee.Top,center:a,offset:s,stepPosition:i}){const r=Km[t],c=Km[l],u={x:e.x+r.x*s,y:e.y+r.y*s},d={x:n.x+c.x*s,y:n.y+c.y*s},f=cM({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let x=[],S,w;const g={x:0,y:0},y={x:0,y:0},[,,m,v]=fb({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(r[h]*c[h]===-1){h==="x"?(S=a.x??u.x+(d.x-u.x)*i,w=a.y??(u.y+d.y)/2):(S=a.x??(u.x+d.x)/2,w=a.y??u.y+(d.y-u.y)*i);const T=[{x:S,y:u.y},{x:S,y:d.y}],C=[{x:u.x,y:w},{x:d.x,y:w}];r[h]===p?x=h==="x"?T:C:x=h==="x"?C:T}else{const T=[{x:u.x,y:d.y}],C=[{x:d.x,y:u.y}];if(h==="x"?x=r.x===p?C:T:x=r.y===p?T:C,t===l){const N=Math.abs(e[h]-n[h]);if(N<=s){const z=Math.min(s-1,s-N);r[h]===p?g[h]=(u[h]>e[h]?-1:1)*z:y[h]=(d[h]>n[h]?-1:1)*z}}if(t!==l){const N=h==="x"?"y":"x",z=r[h]===c[N],k=u[N]>d[N],R=u[N]<d[N];(r[h]===1&&(!z&&k||z&&R)||r[h]!==1&&(!z&&R||z&&k))&&(x=h==="x"?T:C)}const H={x:u.x+g.x,y:u.y+g.y},A={x:d.x+y.x,y:d.y+y.y},$=Math.max(Math.abs(H.x-x[0].x),Math.abs(A.x-x[0].x)),V=Math.max(Math.abs(H.y-x[0].y),Math.abs(A.y-x[0].y));$>=V?(S=(H.x+A.x)/2,w=x[0].y):(S=x[0].x,w=(H.y+A.y)/2)}const j={x:u.x+g.x,y:u.y+g.y},E={x:d.x+y.x,y:d.y+y.y};return[[e,...j.x!==x[0].x||j.y!==x[0].y?[j]:[],...x,...E.x!==x[x.length-1].x||E.y!==x[x.length-1].y?[E]:[],n],S,w,m,v]}function dM(e,t,n,l){const a=Math.min(Wm(e,t)/2,Wm(t,n)/2,l),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const u=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${s+a*u},${i}Q ${s},${i} ${s},${i+a*d}`}const r=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${s},${i+a*c}Q ${s},${i} ${s+a*r},${i}`}function vf({sourceX:e,sourceY:t,sourcePosition:n=ee.Bottom,targetX:l,targetY:a,targetPosition:s=ee.Top,borderRadius:i=5,centerX:r,centerY:c,offset:u=20,stepPosition:d=.5}){const[f,h,p,x,S]=uM({source:{x:e,y:t},sourcePosition:n,target:{x:l,y:a},targetPosition:s,center:{x:r,y:c},offset:u,stepPosition:d});let w=`M${f[0].x} ${f[0].y}`;for(let g=1;g<f.length-1;g++)w+=dM(f[g-1],f[g],f[g+1],i);return w+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[w,h,p,x,S]}function Jm(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function fM(e){var f;const{sourceNode:t,targetNode:n}=e;if(!Jm(t)||!Jm(n))return null;const l=t.internals.handleBounds||Fm(t.handles),a=n.internals.handleBounds||Fm(n.handles),s=Pm((l==null?void 0:l.source)??[],e.sourceHandle),i=Pm(e.connectionMode===hs.Strict?(a==null?void 0:a.target)??[]:((a==null?void 0:a.target)??[]).concat((a==null?void 0:a.source)??[]),e.targetHandle);if(!s||!i)return(f=e.onError)==null||f.call(e,"008",En.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const r=(s==null?void 0:s.position)||ee.Bottom,c=(i==null?void 0:i.position)||ee.Top,u=pa(t,s,r),d=pa(n,i,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:r,targetPosition:c}}function Fm(e){if(!e)return null;const t=[],n=[];for(const l of e)l.width=l.width??1,l.height=l.height??1,l.type==="source"?t.push(l):l.type==="target"&&n.push(l);return{source:t,target:n}}function pa(e,t,n=ee.Left,l=!1){const a=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,s=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:i,height:r}=t??nl(e);if(l)return{x:a+i/2,y:s+r/2};switch((t==null?void 0:t.position)??n){case ee.Top:return{x:a+i/2,y:s};case ee.Right:return{x:a+i,y:s+r/2};case ee.Bottom:return{x:a+i/2,y:s+r};case ee.Left:return{x:a,y:s+r/2}}}function Pm(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function bf(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(l=>`${l}=${e[l]}`).join("&")}`:""}function hM(e,{id:t,defaultColor:n,defaultMarkerStart:l,defaultMarkerEnd:a}){const s=new Set;return e.reduce((i,r)=>([r.markerStart||l,r.markerEnd||a].forEach(c=>{if(c&&typeof c=="object"){const u=bf(c,t);s.has(u)||(i.push({id:u,color:c.color||n,...c}),s.add(u))}}),i),[]).sort((i,r)=>i.id.localeCompare(r.id))}const pb=1e3,pM=10,sp={nodeOrigin:[0,0],nodeExtent:Li,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},gM={...sp,checkEquality:!0};function ip(e,t){const n={...e};for(const l in t)t[l]!==void 0&&(n[l]=t[l]);return n}function mM(e,t,n){const l=ip(sp,n);for(const a of e.values())if(a.parentId)op(a,e,t,l);else{const s=or(a,l.nodeOrigin),i=ms(a.extent)?a.extent:l.nodeExtent,r=ha(s,i,nl(a));a.internals.positionAbsolute=r}}function xM(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],l=[];for(const a of e.handles){const s={id:a.id,width:a.width??1,height:a.height??1,nodeId:e.id,x:a.x,y:a.y,position:a.position,type:a.type};a.type==="source"?n.push(s):a.type==="target"&&l.push(s)}return{source:n,target:l}}function rp(e){return e==="manual"}function wf(e,t,n,l={}){var d,f;const a=ip(gM,l),s={i:0},i=new Map(t),r=a!=null&&a.elevateNodesOnSelect&&!rp(a.zIndexMode)?pb:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=i.get(h.id);if(a.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const x=or(h,a.nodeOrigin),S=ms(h.extent)?h.extent:a.nodeExtent,w=ha(x,S,nl(h));p={...a.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:w,handleBounds:xM(h,p),z:gb(h,r,a.zIndexMode),userNode:h}},t.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(c=!1),h.parentId&&op(p,t,n,l,s),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function yM(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function op(e,t,n,l,a){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:r,zIndexMode:c}=ip(sp,l),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}yM(e,n),a&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++a.i,d.internals.z=d.internals.z+a.i*pM),a&&d.internals.rootParentIndex!==void 0&&(a.i=d.internals.rootParentIndex);const f=s&&!rp(c)?pb:0,{x:h,y:p,z:x}=vM(e,d,i,r,f,c),{positionAbsolute:S}=e.internals,w=h!==S.x||p!==S.y;(w||x!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:h,y:p}:S,z:x}})}function gb(e,t,n){const l=sn(e.zIndex)?e.zIndex:0;return rp(n)?l:l+(e.selected?t:0)}function vM(e,t,n,l,a,s){const{x:i,y:r}=t.internals.positionAbsolute,c=nl(e),u=or(e,n),d=ms(e.extent)?ha(u,e.extent,c):u;let f=ha({x:i+d.x,y:r+d.y},l,c);e.extent==="parent"&&(f=nb(f,c,t));const h=gb(e,a,s),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function cp(e,t,n,l=[0,0]){var i;const a=[],s=new Map;for(const r of e){const c=t.get(r.parentId);if(!c)continue;const u=((i=s.get(r.parentId))==null?void 0:i.expandedRect)??gs(c),d=ab(u,r.rect);s.set(r.parentId,{expandedRect:d,parent:c})}return s.size>0&&s.forEach(({expandedRect:r,parent:c},u)=>{var m;const d=c.internals.positionAbsolute,f=nl(c),h=c.origin??l,p=r.x<d.x?Math.round(Math.abs(d.x-r.x)):0,x=r.y<d.y?Math.round(Math.abs(d.y-r.y)):0,S=Math.max(f.width,Math.round(r.width)),w=Math.max(f.height,Math.round(r.height)),g=(S-f.width)*h[0],y=(w-f.height)*h[1];(p>0||x>0||g||y)&&(a.push({id:u,type:"position",position:{x:c.position.x-p+g,y:c.position.y-x+y}}),(m=n.get(u))==null||m.forEach(v=>{e.some(j=>j.id===v.id)||a.push({id:v.id,type:"position",position:{x:v.position.x+p,y:v.position.y+x}})})),(f.width<r.width||f.height<r.height||p||x)&&a.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:S+(p?h[0]*p-g:0),height:w+(x?h[1]*x-y:0)}})}),a}function bM(e,t,n,l,a,s,i){const r=l==null?void 0:l.querySelector(".xyflow__viewport");let c=!1;if(!r)return{changes:[],updatedInternals:c};const u=[],d=window.getComputedStyle(r),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=[];for(const p of e.values()){const x=t.get(p.id);if(!x)continue;if(x.hidden){t.set(x.id,{...x,internals:{...x.internals,handleBounds:void 0}}),c=!0;continue}const S=ap(p.nodeElement),w=x.measured.width!==S.width||x.measured.height!==S.height;if(!!(S.width&&S.height&&(w||!x.internals.handleBounds||p.force))){const y=p.nodeElement.getBoundingClientRect(),m=ms(x.extent)?x.extent:s;let{positionAbsolute:v}=x.internals;x.parentId&&x.extent==="parent"?v=nb(v,S,t.get(x.parentId)):m&&(v=ha(v,m,S));const j={...x,measured:S,internals:{...x.internals,positionAbsolute:v,handleBounds:{source:Zm("source",p.nodeElement,y,f,x.id),target:Zm("target",p.nodeElement,y,f,x.id)}}};t.set(x.id,j),x.parentId&&op(j,t,n,{nodeOrigin:a,zIndexMode:i}),c=!0,w&&(u.push({id:x.id,type:"dimensions",dimensions:S}),x.expandParent&&x.parentId&&h.push({id:x.id,parentId:x.parentId,rect:gs(j,a)}))}}if(h.length>0){const p=cp(h,t,n,a);u.push(...p)}return{changes:u,updatedInternals:c}}async function wM({delta:e,panZoom:t,transform:n,translateExtent:l,width:a,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[a,s]],l),r=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(r)}function ex(e,t,n,l,a,s){let i=a;const r=l.get(i)||new Map;l.set(i,r.set(n,t)),i=`${a}-${e}`;const c=l.get(i)||new Map;if(l.set(i,c.set(n,t)),s){i=`${a}-${e}-${s}`;const u=l.get(i)||new Map;l.set(i,u.set(n,t))}}function mb(e,t,n){e.clear(),t.clear();for(const l of n){const{source:a,target:s,sourceHandle:i=null,targetHandle:r=null}=l,c={edgeId:l.id,source:a,target:s,sourceHandle:i,targetHandle:r},u=`${a}-${i}--${s}-${r}`,d=`${s}-${r}--${a}-${i}`;ex("source",c,d,e,a,i),ex("target",c,u,e,s,r),t.set(l.id,l)}}function xb(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:xb(n,t):!1}function tx(e,t,n){var a;let l=e;do{if((a=l==null?void 0:l.matches)!=null&&a.call(l,t))return!0;if(l===n)return!1;l=l==null?void 0:l.parentElement}while(l);return!1}function SM(e,t,n,l){const a=new Map;for(const[s,i]of e)if((i.selected||i.id===l)&&(!i.parentId||!xb(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const r=e.get(s);r&&a.set(s,{id:s,position:r.position||{x:0,y:0},distance:{x:n.x-r.internals.positionAbsolute.x,y:n.y-r.internals.positionAbsolute.y},extent:r.extent,parentId:r.parentId,origin:r.origin,expandParent:r.expandParent,internals:{positionAbsolute:r.internals.positionAbsolute||{x:0,y:0}},measured:{width:r.measured.width??0,height:r.measured.height??0}})}return a}function ed({nodeId:e,dragItems:t,nodeLookup:n,dragging:l=!0}){var i,r,c;const a=[];for(const[u,d]of t){const f=(i=n.get(u))==null?void 0:i.internals.userNode;f&&a.push({...f,position:d.position,dragging:l})}if(!e)return[a[0],a];const s=(r=n.get(e))==null?void 0:r.internals.userNode;return[s?{...s,position:((c=t.get(e))==null?void 0:c.position)||s.position,dragging:l}:a[0],a]}function NM({dragItems:e,snapGrid:t,x:n,y:l}){const a=e.values().next().value;if(!a)return null;const s={x:n-a.distance.x,y:l-a.distance.y},i=ur(s,t);return{x:i.x-s.x,y:i.y-s.y}}function jM({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:l,onDragStop:a}){let s={x:null,y:null},i=0,r=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,x=!1,S=null;function w({noDragClassName:y,handleSelector:m,domNode:v,isSelectable:j,nodeId:E,nodeClickDistance:M=0}){h=Ct(v);function T({x:$,y:V}){const{nodeLookup:N,nodeExtent:z,snapGrid:k,snapToGrid:R,nodeOrigin:D,onNodeDrag:O,onSelectionDrag:q,onError:X,updateNodePositions:L}=t();s={x:$,y:V};let Y=!1;const _=r.size>1,U=_&&z?yf(cr(r)):null,G=_&&R?NM({dragItems:r,snapGrid:k,x:$,y:V}):null;for(const[I,B]of r){if(!N.has(I))continue;let K={x:$-B.distance.x,y:V-B.distance.y};R&&(K=G?{x:Math.round(K.x+G.x),y:Math.round(K.y+G.y)}:ur(K,k));let W=null;if(_&&z&&!B.extent&&U){const{positionAbsolute:P}=B.internals,ne=P.x-U.x+z[0][0],ae=P.x+B.measured.width-U.x2+z[1][0],te=P.y-U.y+z[0][1],Z=P.y+B.measured.height-U.y2+z[1][1];W=[[ne,te],[ae,Z]]}const{position:F,positionAbsolute:J}=tb({nodeId:I,nextPosition:K,nodeLookup:N,nodeExtent:W||z,nodeOrigin:D,onError:X});Y=Y||B.position.x!==F.x||B.position.y!==F.y,B.position=F,B.internals.positionAbsolute=J}if(x=x||Y,!!Y&&(L(r,!0),S&&(l||O||!E&&q))){const[I,B]=ed({nodeId:E,dragItems:r,nodeLookup:N});l==null||l(S,r,I,B),O==null||O(S,I,B),E||q==null||q(S,B)}}async function C(){if(!d)return;const{transform:$,panBy:V,autoPanSpeed:N,autoPanOnNodeDrag:z}=t();if(!z){c=!1,cancelAnimationFrame(i);return}const[k,R]=lb(u,d,N);(k!==0||R!==0)&&(s.x=(s.x??0)-k/$[2],s.y=(s.y??0)-R/$[2],await V({x:k,y:R})&&T(s)),i=requestAnimationFrame(C)}function H($){var _;const{nodeLookup:V,multiSelectionActive:N,nodesDraggable:z,transform:k,snapGrid:R,snapToGrid:D,selectNodesOnDrag:O,onNodeDragStart:q,onSelectionDragStart:X,unselectNodesAndEdges:L}=t();f=!0,(!O||!j)&&!N&&E&&((_=V.get(E))!=null&&_.selected||L()),j&&O&&E&&(e==null||e(E));const Y=mi($.sourceEvent,{transform:k,snapGrid:R,snapToGrid:D,containerBounds:d});if(s=Y,r=SM(V,z,Y,E),r.size>0&&(n||q||!E&&X)){const[U,G]=ed({nodeId:E,dragItems:r,nodeLookup:V});n==null||n($.sourceEvent,r,U,G),q==null||q($.sourceEvent,U,G),E||X==null||X($.sourceEvent,G)}}const A=R1().clickDistance(M).on("start",$=>{const{domNode:V,nodeDragThreshold:N,transform:z,snapGrid:k,snapToGrid:R}=t();d=(V==null?void 0:V.getBoundingClientRect())||null,p=!1,x=!1,S=$.sourceEvent,N===0&&H($),s=mi($.sourceEvent,{transform:z,snapGrid:k,snapToGrid:R,containerBounds:d}),u=rn($.sourceEvent,d)}).on("drag",$=>{const{autoPanOnNodeDrag:V,transform:N,snapGrid:z,snapToGrid:k,nodeDragThreshold:R,nodeLookup:D}=t(),O=mi($.sourceEvent,{transform:N,snapGrid:z,snapToGrid:k,containerBounds:d});if(S=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||E&&!D.has(E))&&(p=!0),!p){if(!c&&V&&f&&(c=!0,C()),!f){const q=rn($.sourceEvent,d),X=q.x-u.x,L=q.y-u.y;Math.sqrt(X*X+L*L)>R&&H($)}(s.x!==O.xSnapped||s.y!==O.ySnapped)&&r&&f&&(u=rn($.sourceEvent,d),T(O))}}).on("end",$=>{if(!(!f||p)&&(c=!1,f=!1,cancelAnimationFrame(i),r.size>0)){const{nodeLookup:V,updateNodePositions:N,onNodeDragStop:z,onSelectionDragStop:k}=t();if(x&&(N(r,!1),x=!1),a||z||!E&&k){const[R,D]=ed({nodeId:E,dragItems:r,nodeLookup:V,dragging:!1});a==null||a($.sourceEvent,r,R,D),z==null||z($.sourceEvent,R,D),E||k==null||k($.sourceEvent,D)}}}).filter($=>{const V=$.target;return!$.button&&(!y||!tx(V,`.${y}`,v))&&(!m||tx(V,m,v))});h.call(A)}function g(){h==null||h.on(".drag",null)}return{update:w,destroy:g}}function kM(e,t,n){const l=[],a={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())Ui(a,gs(s))>0&&l.push(s);return l}const EM=250;function CM(e,t,n,l){var r,c;let a=[],s=1/0;const i=kM(e,n,t+EM);for(const u of i){const d=[...((r=u.internals.handleBounds)==null?void 0:r.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(l.nodeId===f.nodeId&&l.type===f.type&&l.id===f.id)continue;const{x:h,y:p}=pa(u,f,f.position,!0),x=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));x>t||(x<s?(a=[{...f,x:h,y:p}],s=x):x===s&&a.push({...f,x:h,y:p}))}}if(!a.length)return null;if(a.length>1){const u=l.type==="source"?"target":"source";return a.find(d=>d.type===u)??a[0]}return a[0]}function yb(e,t,n,l,a,s=!1){var u,d,f;const i=l.get(e);if(!i)return null;const r=a==="strict"?(u=i.internals.handleBounds)==null?void 0:u[t]:[...((d=i.internals.handleBounds)==null?void 0:d.source)??[],...((f=i.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?r==null?void 0:r.find(h=>h.id===n):r==null?void 0:r[0])??null;return c&&s?{...c,...pa(i,c,c.position,!0)}:c}function vb(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function MM(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const bb=()=>!0;function _M(e,{connectionMode:t,connectionRadius:n,handleId:l,nodeId:a,edgeUpdaterType:s,isTarget:i,domNode:r,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:x,onConnect:S,onConnectEnd:w,isValidConnection:g=bb,onReconnectEnd:y,updateConnection:m,getTransform:v,getFromHandle:j,autoPanSpeed:E,dragThreshold:M=1,handleDomNode:T}){const C=rb(e.target);let H=0,A;const{x:$,y:V}=rn(e),N=vb(s,T),z=r==null?void 0:r.getBoundingClientRect();let k=!1;if(!z||!N)return;const R=yb(a,N,l,c,t);if(!R)return;let D=rn(e,z),O=!1,q=null,X=!1,L=null;function Y(){if(!d||!z)return;const[F,J]=lb(D,z,E);h({x:F,y:J}),H=requestAnimationFrame(Y)}const _={...R,nodeId:a,type:N,position:R.position},U=c.get(a);let I={inProgress:!0,isValid:null,from:pa(U,_,ee.Left,!0),fromHandle:_,fromPosition:_.position,fromNode:U,to:D,toHandle:null,toPosition:Vm[_.position],toNode:null,pointer:D};function B(){k=!0,m(I),x==null||x(e,{nodeId:a,handleId:l,handleType:N})}M===0&&B();function K(F){if(!k){const{x:Z,y:ve}=rn(F),xe=Z-$,Se=ve-V;if(!(xe*xe+Se*Se>M*M))return;B()}if(!j()||!_){W(F);return}const J=v();D=rn(F,z),A=CM(dr(D,J,!1,[1,1]),n,c,_),O||(Y(),O=!0);const P=wb(F,{handle:A,connectionMode:t,fromNodeId:a,fromHandleId:l,fromType:i?"target":"source",isValidConnection:g,doc:C,lib:u,flowId:f,nodeLookup:c});L=P.handleDomNode,q=P.connection,X=MM(!!A,P.isValid);const ne=c.get(a),ae=ne?pa(ne,_,ee.Left,!0):I.from,te={...I,from:ae,isValid:X,to:P.toHandle&&X?hc({x:P.toHandle.x,y:P.toHandle.y},J):D,toHandle:P.toHandle,toPosition:X&&P.toHandle?P.toHandle.position:Vm[_.position],toNode:P.toHandle?c.get(P.toHandle.nodeId):null,pointer:D};m(te),I=te}function W(F){if(!("touches"in F&&F.touches.length>0)){if(k){(A||L)&&q&&X&&(S==null||S(q));const{inProgress:J,...P}=I,ne={...P,toPosition:I.toHandle?I.toPosition:null};w==null||w(F,ne),s&&(y==null||y(F,ne))}p(),cancelAnimationFrame(H),O=!1,X=!1,q=null,L=null,C.removeEventListener("mousemove",K),C.removeEventListener("mouseup",W),C.removeEventListener("touchmove",K),C.removeEventListener("touchend",W)}}C.addEventListener("mousemove",K),C.addEventListener("mouseup",W),C.addEventListener("touchmove",K),C.addEventListener("touchend",W)}function wb(e,{handle:t,connectionMode:n,fromNodeId:l,fromHandleId:a,fromType:s,doc:i,lib:r,flowId:c,isValidConnection:u=bb,nodeLookup:d}){const f=s==="target",h=t?i.querySelector(`.${r}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:p,y:x}=rn(e),S=i.elementFromPoint(p,x),w=S!=null&&S.classList.contains(`${r}-flow__handle`)?S:h,g={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const y=vb(void 0,w),m=w.getAttribute("data-nodeid"),v=w.getAttribute("data-handleid"),j=w.classList.contains("connectable"),E=w.classList.contains("connectableend");if(!m||!y)return g;const M={source:f?m:l,sourceHandle:f?v:a,target:f?l:m,targetHandle:f?a:v};g.connection=M;const C=j&&E&&(n===hs.Strict?f&&y==="source"||!f&&y==="target":m!==l||v!==a);g.isValid=C&&u(M),g.toHandle=yb(m,y,v,d,n,!0)}return g}const Sf={onPointerDown:_M,isValid:wb};function TM({domNode:e,panZoom:t,getTransform:n,getViewScale:l}){const a=Ct(e);function s({translateExtent:r,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const x=m=>{if(m.sourceEvent.type!=="wheel"||!t)return;const v=n(),j=m.sourceEvent.ctrlKey&&qi()?10:1,E=-m.sourceEvent.deltaY*(m.sourceEvent.deltaMode===1?.05:m.sourceEvent.deltaMode?1:.002)*d,M=v[2]*Math.pow(2,E*j);t.scaleTo(M)};let S=[0,0];const w=m=>{(m.sourceEvent.type==="mousedown"||m.sourceEvent.type==="touchstart")&&(S=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY])},g=m=>{const v=n();if(m.sourceEvent.type!=="mousemove"&&m.sourceEvent.type!=="touchmove"||!t)return;const j=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY],E=[j[0]-S[0],j[1]-S[1]];S=j;const M=l()*Math.max(v[2],Math.log(v[2]))*(p?-1:1),T={x:v[0]-E[0]*M,y:v[1]-E[1]*M},C=[[0,0],[c,u]];t.setViewportConstrained({x:T.x,y:T.y,zoom:v[2]},C,r)},y=K1().on("start",w).on("zoom",f?g:null).on("zoom.wheel",h?x:null);a.call(y,{})}function i(){a.on("zoom",null)}return{update:s,destroy:i,pointer:tn}}const Ic=e=>({x:e.x,y:e.y,zoom:e.k}),td=({x:e,y:t,zoom:n})=>Gc.translate(e,t).scale(n),Ya=(e,t)=>e.target.closest(`.${t}`),Sb=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),AM=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,nd=(e,t=0,n=AM,l=()=>{})=>{const a=typeof t=="number"&&t>0;return a||l(),a?e.transition().duration(t).ease(n).on("end",l):e},Nb=e=>{const t=e.ctrlKey&&qi()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function DM({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:l,panOnScrollMode:a,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:r,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Ya(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&i){const w=tn(d),g=Nb(d),y=f*Math.pow(2,g);l.scaleTo(n,y,w,d);return}const h=d.deltaMode===1?20:1;let p=a===aa.Vertical?0:d.deltaX*h,x=a===aa.Horizontal?0:d.deltaY*h;!qi()&&d.shiftKey&&a!==aa.Vertical&&(p=d.deltaY*h,x=0),l.translateBy(n,-(p/f)*s,-(x/f)*s,{internal:!0});const S=Ic(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,S),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,S),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,r==null||r(d,S))}}function zM({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(l,a){const s=l.type==="wheel",i=!t&&s&&!l.ctrlKey,r=Ya(l,e);if(l.ctrlKey&&s&&r&&l.preventDefault(),i||r)return null;l.preventDefault(),n.call(this,l,a)}}function RM({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return l=>{var s,i,r;if((s=l.sourceEvent)!=null&&s.internal)return;const a=Ic(l.transform);e.mouseButton=((i=l.sourceEvent)==null?void 0:i.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=a,((r=l.sourceEvent)==null?void 0:r.type)==="mousedown"&&t(!0),n&&(n==null||n(l.sourceEvent,a))}}function OM({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:l,onPanZoom:a}){return s=>{var i,r;e.usedRightMouseButton=!!(n&&Sb(t,e.mouseButton??0)),(i=s.sourceEvent)!=null&&i.sync||l([s.transform.x,s.transform.y,s.transform.k]),a&&!((r=s.sourceEvent)!=null&&r.internal)&&(a==null||a(s.sourceEvent,Ic(s.transform)))}}function HM({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:l,onPanZoomEnd:a,onPaneContextMenu:s}){return i=>{var r;if(!((r=i.sourceEvent)!=null&&r.internal)&&(e.isZoomingOrPanning=!1,s&&Sb(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,l(!1),a)){const c=Ic(i.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a==null||a(i.sourceEvent,c)},n?150:0)}}}function $M({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:l,panOnScroll:a,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:r,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var w;const h=e||t,p=n&&f.ctrlKey,x=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Ya(f,`${u}-flow__node`)||Ya(f,`${u}-flow__edge`)))return!0;if(!l&&!h&&!a&&!s&&!n||i||d&&!x||Ya(f,r)&&x||Ya(f,c)&&(!x||a&&x&&!e)||!n&&f.ctrlKey&&x)return!1;if(!n&&f.type==="touchstart"&&((w=f.touches)==null?void 0:w.length)>1)return f.preventDefault(),!1;if(!h&&!a&&!p&&x||!l&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(l)&&!l.includes(f.button)&&f.type==="mousedown")return!1;const S=Array.isArray(l)&&l.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||x)&&S}}function LM({domNode:e,minZoom:t,maxZoom:n,translateExtent:l,viewport:a,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:r,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=K1().scaleExtent([t,n]).translateExtent(l),h=Ct(e).call(f);y({x:a.x,y:a.y,zoom:ps(a.zoom,t,n)},[[0,0],[d.width,d.height]],l);const p=h.on("wheel.zoom"),x=h.on("dblclick.zoom");f.wheelDelta(Nb);function S(A,$){return h?new Promise(V=>{f==null||f.interpolate(($==null?void 0:$.interpolate)==="linear"?gi:po).transform(nd(h,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>V(!0)),A)}):Promise.resolve(!1)}function w({noWheelClassName:A,noPanClassName:$,onPaneContextMenu:V,userSelectionActive:N,panOnScroll:z,panOnDrag:k,panOnScrollMode:R,panOnScrollSpeed:D,preventScrolling:O,zoomOnPinch:q,zoomOnScroll:X,zoomOnDoubleClick:L,zoomActivationKeyPressed:Y,lib:_,onTransformChange:U,connectionInProgress:G,paneClickDistance:I,selectionOnDrag:B}){N&&!u.isZoomingOrPanning&&g();const K=z&&!Y&&!N;f.clickDistance(B?1/0:!sn(I)||I<0?0:I);const W=K?DM({zoomPanValues:u,noWheelClassName:A,d3Selection:h,d3Zoom:f,panOnScrollMode:R,panOnScrollSpeed:D,zoomOnPinch:q,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:r}):zM({noWheelClassName:A,preventScrolling:O,d3ZoomHandler:p});if(h.on("wheel.zoom",W,{passive:!1}),!N){const J=RM({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:i});f.on("start",J);const P=OM({zoomPanValues:u,panOnDrag:k,onPaneContextMenu:!!V,onPanZoom:s,onTransformChange:U});f.on("zoom",P);const ne=HM({zoomPanValues:u,panOnDrag:k,panOnScroll:z,onPaneContextMenu:V,onPanZoomEnd:r,onDraggingChange:c});f.on("end",ne)}const F=$M({zoomActivationKeyPressed:Y,panOnDrag:k,zoomOnScroll:X,panOnScroll:z,zoomOnDoubleClick:L,zoomOnPinch:q,userSelectionActive:N,noPanClassName:$,noWheelClassName:A,lib:_,connectionInProgress:G});f.filter(F),L?h.on("dblclick.zoom",x):h.on("dblclick.zoom",null)}function g(){f.on("zoom",null)}async function y(A,$,V){const N=td(A),z=f==null?void 0:f.constrain()(N,$,V);return z&&await S(z),new Promise(k=>k(z))}async function m(A,$){const V=td(A);return await S(V,$),new Promise(N=>N(V))}function v(A){if(h){const $=td(A),V=h.property("__zoom");(V.k!==A.zoom||V.x!==A.x||V.y!==A.y)&&(f==null||f.transform(h,$,null,{sync:!0}))}}function j(){const A=h?I1(h.node()):{x:0,y:0,k:1};return{x:A.x,y:A.y,zoom:A.k}}function E(A,$){return h?new Promise(V=>{f==null||f.interpolate(($==null?void 0:$.interpolate)==="linear"?gi:po).scaleTo(nd(h,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>V(!0)),A)}):Promise.resolve(!1)}function M(A,$){return h?new Promise(V=>{f==null||f.interpolate(($==null?void 0:$.interpolate)==="linear"?gi:po).scaleBy(nd(h,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>V(!0)),A)}):Promise.resolve(!1)}function T(A){f==null||f.scaleExtent(A)}function C(A){f==null||f.translateExtent(A)}function H(A){const $=!sn(A)||A<0?0:A;f==null||f.clickDistance($)}return{update:w,destroy:g,setViewport:m,setViewportConstrained:y,getViewport:j,scaleTo:E,scaleBy:M,setScaleExtent:T,setTranslateExtent:C,syncViewport:v,setClickDistance:H}}var xs;(function(e){e.Line="line",e.Handle="handle"})(xs||(xs={}));function BM({width:e,prevWidth:t,height:n,prevHeight:l,affectsX:a,affectsY:s}){const i=e-t,r=n-l,c=[i>0?1:i<0?-1:0,r>0?1:r<0?-1:0];return i&&a&&(c[0]=c[0]*-1),r&&s&&(c[1]=c[1]*-1),c}function nx(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),l=e.includes("left"),a=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:l,affectsY:a}}function rl(e,t){return Math.max(0,t-e)}function ol(e,t){return Math.max(0,e-t)}function Xr(e,t,n){return Math.max(0,t-e,e-n)}function lx(e,t){return e?!t:t}function UM(e,t,n,l,a,s,i,r){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:x}=n,{minWidth:S,maxWidth:w,minHeight:g,maxHeight:y}=l,{x:m,y:v,width:j,height:E,aspectRatio:M}=e;let T=Math.floor(d?p-e.pointerX:0),C=Math.floor(f?x-e.pointerY:0);const H=j+(c?-T:T),A=E+(u?-C:C),$=-s[0]*j,V=-s[1]*E;let N=Xr(H,S,w),z=Xr(A,g,y);if(i){let D=0,O=0;c&&T<0?D=rl(m+T+$,i[0][0]):!c&&T>0&&(D=ol(m+H+$,i[1][0])),u&&C<0?O=rl(v+C+V,i[0][1]):!u&&C>0&&(O=ol(v+A+V,i[1][1])),N=Math.max(N,D),z=Math.max(z,O)}if(r){let D=0,O=0;c&&T>0?D=ol(m+T,r[0][0]):!c&&T<0&&(D=rl(m+H,r[1][0])),u&&C>0?O=ol(v+C,r[0][1]):!u&&C<0&&(O=rl(v+A,r[1][1])),N=Math.max(N,D),z=Math.max(z,O)}if(a){if(d){const D=Xr(H/M,g,y)*M;if(N=Math.max(N,D),i){let O=0;!c&&!u||c&&!u&&h?O=ol(v+V+H/M,i[1][1])*M:O=rl(v+V+(c?T:-T)/M,i[0][1])*M,N=Math.max(N,O)}if(r){let O=0;!c&&!u||c&&!u&&h?O=rl(v+H/M,r[1][1])*M:O=ol(v+(c?T:-T)/M,r[0][1])*M,N=Math.max(N,O)}}if(f){const D=Xr(A*M,S,w)/M;if(z=Math.max(z,D),i){let O=0;!c&&!u||u&&!c&&h?O=ol(m+A*M+$,i[1][0])/M:O=rl(m+(u?C:-C)*M+$,i[0][0])/M,z=Math.max(z,O)}if(r){let O=0;!c&&!u||u&&!c&&h?O=rl(m+A*M,r[1][0])/M:O=ol(m+(u?C:-C)*M,r[0][0])/M,z=Math.max(z,O)}}}C=C+(C<0?z:-z),T=T+(T<0?N:-N),a&&(h?H>A*M?C=(lx(c,u)?-T:T)/M:T=(lx(c,u)?-C:C)*M:d?(C=T/M,u=c):(T=C*M,c=u));const k=c?m+T:m,R=u?v+C:v;return{width:j+(c?-T:T),height:E+(u?-C:C),x:s[0]*T*(c?-1:1)+k,y:s[1]*C*(u?-1:1)+R}}const jb={width:0,height:0,x:0,y:0},qM={...jb,pointerX:0,pointerY:0,aspectRatio:1};function YM(e){return[[0,0],[e.measured.width,e.measured.height]]}function VM(e,t,n){const l=t.position.x+e.position.x,a=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,r=n[0]*s,c=n[1]*i;return[[l-r,a-c],[l+s-r,a+i-c]]}function XM({domNode:e,nodeId:t,getStoreItems:n,onChange:l,onEnd:a}){const s=Ct(e);let i={controlDirection:nx("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function r({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:x,onResizeEnd:S,shouldResize:w}){let g={...jb},y={...qM};i={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:nx(u)};let m,v=null,j=[],E,M,T,C=!1;const H=R1().on("start",A=>{const{nodeLookup:$,transform:V,snapGrid:N,snapToGrid:z,nodeOrigin:k,paneDomNode:R}=n();if(m=$.get(t),!m)return;v=(R==null?void 0:R.getBoundingClientRect())??null;const{xSnapped:D,ySnapped:O}=mi(A.sourceEvent,{transform:V,snapGrid:N,snapToGrid:z,containerBounds:v});g={width:m.measured.width??0,height:m.measured.height??0,x:m.position.x??0,y:m.position.y??0},y={...g,pointerX:D,pointerY:O,aspectRatio:g.width/g.height},E=void 0,m.parentId&&(m.extent==="parent"||m.expandParent)&&(E=$.get(m.parentId),M=E&&m.extent==="parent"?YM(E):void 0),j=[],T=void 0;for(const[q,X]of $)if(X.parentId===t&&(j.push({id:q,position:{...X.position},extent:X.extent}),X.extent==="parent"||X.expandParent)){const L=VM(X,m,X.origin??k);T?T=[[Math.min(L[0][0],T[0][0]),Math.min(L[0][1],T[0][1])],[Math.max(L[1][0],T[1][0]),Math.max(L[1][1],T[1][1])]]:T=L}p==null||p(A,{...g})}).on("drag",A=>{const{transform:$,snapGrid:V,snapToGrid:N,nodeOrigin:z}=n(),k=mi(A.sourceEvent,{transform:$,snapGrid:V,snapToGrid:N,containerBounds:v}),R=[];if(!m)return;const{x:D,y:O,width:q,height:X}=g,L={},Y=m.origin??z,{width:_,height:U,x:G,y:I}=UM(y,i.controlDirection,k,i.boundaries,i.keepAspectRatio,Y,M,T),B=_!==q,K=U!==X,W=G!==D&&B,F=I!==O&&K;if(!W&&!F&&!B&&!K)return;if((W||F||Y[0]===1||Y[1]===1)&&(L.x=W?G:g.x,L.y=F?I:g.y,g.x=L.x,g.y=L.y,j.length>0)){const ae=G-D,te=I-O;for(const Z of j)Z.position={x:Z.position.x-ae+Y[0]*(_-q),y:Z.position.y-te+Y[1]*(U-X)},R.push(Z)}if((B||K)&&(L.width=B&&(!i.resizeDirection||i.resizeDirection==="horizontal")?_:g.width,L.height=K&&(!i.resizeDirection||i.resizeDirection==="vertical")?U:g.height,g.width=L.width,g.height=L.height),E&&m.expandParent){const ae=Y[0]*(L.width??0);L.x&&L.x<ae&&(g.x=ae,y.x=y.x-(L.x-ae));const te=Y[1]*(L.height??0);L.y&&L.y<te&&(g.y=te,y.y=y.y-(L.y-te))}const J=BM({width:g.width,prevWidth:q,height:g.height,prevHeight:X,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),P={...g,direction:J};(w==null?void 0:w(A,P))!==!1&&(C=!0,x==null||x(A,P),l(L,R))}).on("end",A=>{C&&(S==null||S(A,{...g}),a==null||a({...g}),C=!1)});s.call(H)}function c(){s.on(".drag",null)}return{update:r,destroy:c}}var kb={exports:{}},Eb={},Cb={exports:{}},Mb={};/**
144
- * @license React
145
- * use-sync-external-store-shim.production.js
146
- *
147
- * Copyright (c) Meta Platforms, Inc. and affiliates.
148
- *
149
- * This source code is licensed under the MIT license found in the
150
- * LICENSE file in the root directory of this source tree.
151
- */var ys=b;function GM(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var QM=typeof Object.is=="function"?Object.is:GM,ZM=ys.useState,IM=ys.useEffect,KM=ys.useLayoutEffect,WM=ys.useDebugValue;function JM(e,t){var n=t(),l=ZM({inst:{value:n,getSnapshot:t}}),a=l[0].inst,s=l[1];return KM(function(){a.value=n,a.getSnapshot=t,ld(a)&&s({inst:a})},[e,n,t]),IM(function(){return ld(a)&&s({inst:a}),e(function(){ld(a)&&s({inst:a})})},[e]),WM(n),n}function ld(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!QM(e,n)}catch{return!0}}function FM(e,t){return t()}var PM=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?FM:JM;Mb.useSyncExternalStore=ys.useSyncExternalStore!==void 0?ys.useSyncExternalStore:PM;Cb.exports=Mb;var e_=Cb.exports;/**
152
- * @license React
153
- * use-sync-external-store-shim/with-selector.production.js
154
- *
155
- * Copyright (c) Meta Platforms, Inc. and affiliates.
156
- *
157
- * This source code is licensed under the MIT license found in the
158
- * LICENSE file in the root directory of this source tree.
159
- */var Kc=b,t_=e_;function n_(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var l_=typeof Object.is=="function"?Object.is:n_,a_=t_.useSyncExternalStore,s_=Kc.useRef,i_=Kc.useEffect,r_=Kc.useMemo,o_=Kc.useDebugValue;Eb.useSyncExternalStoreWithSelector=function(e,t,n,l,a){var s=s_(null);if(s.current===null){var i={hasValue:!1,value:null};s.current=i}else i=s.current;s=r_(function(){function c(p){if(!u){if(u=!0,d=p,p=l(p),a!==void 0&&i.hasValue){var x=i.value;if(a(x,p))return f=x}return f=p}if(x=f,l_(d,p))return x;var S=l(p);return a!==void 0&&a(x,S)?(d=p,x):(d=p,f=S)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,l,a]);var r=a_(e,s[0],s[1]);return i_(function(){i.hasValue=!0,i.value=r},[r]),o_(r),r};kb.exports=Eb;var c_=kb.exports;const u_=_x(c_),d_={},ax=e=>{let t;const n=new Set,l=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(x=>x(t,p))}},a=()=>t,c={setState:l,getState:a,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(d_?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(l,a,c);return c},f_=e=>e?ax(e):ax,{useDebugValue:h_}=_e,{useSyncExternalStoreWithSelector:p_}=u_,g_=e=>e;function _b(e,t=g_,n){const l=p_(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return h_(l),l}const sx=(e,t)=>{const n=f_(e),l=(a,s=t)=>_b(n,a,s);return Object.assign(l,n),l},m_=(e,t)=>e?sx(e,t):sx;function ze(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[l,a]of e)if(!Object.is(a,t.get(l)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const l of e)if(!t.has(l))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const l of n)if(!Object.prototype.hasOwnProperty.call(t,l)||!Object.is(e[l],t[l]))return!1;return!0}const Wc=b.createContext(null),x_=Wc.Provider,Tb=En.error001();function fe(e,t){const n=b.useContext(Wc);if(n===null)throw new Error(Tb);return _b(n,e,t)}function Re(){const e=b.useContext(Wc);if(e===null)throw new Error(Tb);return b.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ix={display:"none"},y_={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ab="react-flow__node-desc",Db="react-flow__edge-desc",v_="react-flow__aria-live",b_=e=>e.ariaLiveMessage,w_=e=>e.ariaLabelConfig;function S_({rfId:e}){const t=fe(b_);return o.jsx("div",{id:`${v_}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:y_,children:t})}function N_({rfId:e,disableKeyboardA11y:t}){const n=fe(w_);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${Ab}-${e}`,style:ix,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${Db}-${e}`,style:ix,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(S_,{rfId:e})]})}const Jc=b.forwardRef(({position:e="top-left",children:t,className:n,style:l,...a},s)=>{const i=`${e}`.split("-");return o.jsx("div",{className:Ve(["react-flow__panel",n,...i]),style:l,ref:s,...a,children:t})});Jc.displayName="Panel";function j_({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(Jc,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:o.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const k_=e=>{const t=[],n=[];for(const[,l]of e.nodeLookup)l.selected&&t.push(l.internals.userNode);for(const[,l]of e.edgeLookup)l.selected&&n.push(l);return{selectedNodes:t,selectedEdges:n}},Gr=e=>e.id;function E_(e,t){return ze(e.selectedNodes.map(Gr),t.selectedNodes.map(Gr))&&ze(e.selectedEdges.map(Gr),t.selectedEdges.map(Gr))}function C_({onSelectionChange:e}){const t=Re(),{selectedNodes:n,selectedEdges:l}=fe(k_,E_);return b.useEffect(()=>{const a={nodes:n,edges:l};e==null||e(a),t.getState().onSelectionChangeHandlers.forEach(s=>s(a))},[n,l,e]),null}const M_=e=>!!e.onSelectionChangeHandlers;function __({onSelectionChange:e}){const t=fe(M_);return e||t?o.jsx(C_,{onSelectionChange:e}):null}const Nf=typeof window<"u"?b.useLayoutEffect:b.useEffect,zb=[0,0],T_={x:0,y:0,zoom:1},A_=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],rx=[...A_,"rfId"],D_=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),ox={translateExtent:Li,nodeOrigin:zb,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function z_(e){const{setNodes:t,setEdges:n,setMinZoom:l,setMaxZoom:a,setTranslateExtent:s,setNodeExtent:i,reset:r,setDefaultNodesAndEdges:c}=fe(D_,ze),u=Re();Nf(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=ox,r()}),[]);const d=b.useRef(ox);return Nf(()=>{for(const f of rx){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?l(h):f==="maxZoom"?a(h):f==="translateExtent"?s(h):f==="nodeExtent"?i(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:nM(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},rx.map(f=>e[f])),null}function cx(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function R_(e){var l;const[t,n]=b.useState(e==="system"?null:e);return b.useEffect(()=>{if(e!=="system"){n(e);return}const a=cx(),s=()=>n(a!=null&&a.matches?"dark":"light");return s(),a==null||a.addEventListener("change",s),()=>{a==null||a.removeEventListener("change",s)}},[e]),t!==null?t:(l=cx())!=null&&l.matches?"dark":"light"}const ux=typeof document<"u"?document:null;function Yi(e=null,t={target:ux,actInsideInputWithModifier:!0}){const[n,l]=b.useState(!1),a=b.useRef(!1),s=b.useRef(new Set([])),[i,r]=b.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
160
- `).replace(`
161
-
162
- `,`
163
- +`).split(`
164
- `)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return b.useEffect(()=>{const c=(t==null?void 0:t.target)??ux,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var w,g;if(a.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!a.current||a.current&&!u)&&ob(p))return!1;const S=fx(p.code,r);if(s.current.add(p[S]),dx(i,s.current,!1)){const y=((g=(w=p.composedPath)==null?void 0:w.call(p))==null?void 0:g[0])||p.target,m=(y==null?void 0:y.nodeName)==="BUTTON"||(y==null?void 0:y.nodeName)==="A";t.preventDefault!==!1&&(a.current||!m)&&p.preventDefault(),l(!0)}},f=p=>{const x=fx(p.code,r);dx(i,s.current,!0)?(l(!1),s.current.clear()):s.current.delete(p[x]),p.key==="Meta"&&s.current.clear(),a.current=!1},h=()=>{s.current.clear(),l(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,l]),n}function dx(e,t,n){return e.filter(l=>n||l.length===t.size).some(l=>l.every(a=>t.has(a)))}function fx(e,t){return t.includes(e)?"code":"key"}const O_=()=>{const e=Re();return b.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:l}=e.getState();return l?l.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[l,a,s],panZoom:i}=e.getState();return i?(await i.setViewport({x:t.x??l,y:t.y??a,zoom:t.zoom??s},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,l]=e.getState().transform;return{x:t,y:n,zoom:l}},setCenter:async(t,n,l)=>e.getState().setCenter(t,n,l),fitBounds:async(t,n)=>{const{width:l,height:a,minZoom:s,maxZoom:i,panZoom:r}=e.getState(),c=lp(t,l,a,s,i,(n==null?void 0:n.padding)??.1);return r?(await r.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:l,snapGrid:a,snapToGrid:s,domNode:i}=e.getState();if(!i)return t;const{x:r,y:c}=i.getBoundingClientRect(),u={x:t.x-r,y:t.y-c},d=n.snapGrid??a,f=n.snapToGrid??s;return dr(u,l,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:l}=e.getState();if(!l)return t;const{x:a,y:s}=l.getBoundingClientRect(),i=hc(t,n);return{x:i.x+a,y:i.y+s}}}),[])};function Rb(e,t){const n=[],l=new Map,a=[];for(const s of e)if(s.type==="add"){a.push(s);continue}else if(s.type==="remove"||s.type==="replace")l.set(s.id,[s]);else{const i=l.get(s.id);i?i.push(s):l.set(s.id,[s])}for(const s of t){const i=l.get(s.id);if(!i){n.push(s);continue}if(i[0].type==="remove")continue;if(i[0].type==="replace"){n.push({...i[0].item});continue}const r={...s};for(const c of i)H_(c,r);n.push(r)}return a.length&&a.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function H_(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function Ob(e,t){return Rb(e,t)}function Hb(e,t){return Rb(e,t)}function Il(e,t){return{id:e,type:"select",selected:t}}function Va(e,t=new Set,n=!1){const l=[];for(const[a,s]of e){const i=t.has(a);!(s.selected===void 0&&!i)&&s.selected!==i&&(n&&(s.selected=i),l.push(Il(s.id,i)))}return l}function hx({items:e=[],lookup:t}){var a;const n=[],l=new Map(e.map(s=>[s.id,s]));for(const[s,i]of e.entries()){const r=t.get(i.id),c=((a=r==null?void 0:r.internals)==null?void 0:a.userNode)??r;c!==void 0&&c!==i&&n.push({id:i.id,item:i,type:"replace"}),c===void 0&&n.push({item:i,type:"add",index:s})}for(const[s]of t)l.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function px(e){return{id:e.id,type:"remove"}}const gx=e=>Q4(e),$_=e=>eb(e);function $b(e){return b.forwardRef(e)}function mx(e){const[t,n]=b.useState(BigInt(0)),[l]=b.useState(()=>L_(()=>n(a=>a+BigInt(1))));return Nf(()=>{const a=l.get();a.length&&(e(a),l.reset())},[t]),l}function L_(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const Lb=b.createContext(null);function B_({children:e}){const t=Re(),n=b.useCallback(r=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:x}=t.getState();let S=c;for(const g of r)S=typeof g=="function"?g(S):g;let w=hx({items:S,lookup:h});for(const g of x.values())w=g(w);d&&u(S),w.length>0?f==null||f(w):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:g,nodes:y,setNodes:m}=t.getState();g&&m(y)})},[]),l=mx(n),a=b.useCallback(r=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const x of r)p=typeof x=="function"?x(p):x;d?u(p):f&&f(hx({items:p,lookup:h}))},[]),s=mx(a),i=b.useMemo(()=>({nodeQueue:l,edgeQueue:s}),[]);return o.jsx(Lb.Provider,{value:i,children:e})}function U_(){const e=b.useContext(Lb);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const q_=e=>!!e.panZoom;function up(){const e=O_(),t=Re(),n=U_(),l=fe(q_),a=b.useMemo(()=>{const s=f=>t.getState().nodeLookup.get(f),i=f=>{n.nodeQueue.push(f)},r=f=>{n.edgeQueue.push(f)},c=f=>{var g,y;const{nodeLookup:h,nodeOrigin:p}=t.getState(),x=gx(f)?f:h.get(f.id),S=x.parentId?ib(x.position,x.measured,x.parentId,h,p):x.position,w={...x,position:S,width:((g=x.measured)==null?void 0:g.width)??x.width,height:((y=x.measured)==null?void 0:y.height)??x.height};return gs(w)},u=(f,h,p={replace:!1})=>{i(x=>x.map(S=>{if(S.id===f){const w=typeof h=="function"?h(S):h;return p.replace&&gx(w)?w:{...S,...w}}return S}))},d=(f,h,p={replace:!1})=>{r(x=>x.map(S=>{if(S.id===f){const w=typeof h=="function"?h(S):h;return p.replace&&$_(w)?w:{...S,...w}}return S}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=s(f))==null?void 0:h.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:i,setEdges:r,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:p}=t.getState(),[x,S,w]=p;return{nodes:f.map(g=>({...g})),edges:h.map(g=>({...g})),viewport:{x,y:S,zoom:w}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:x,onNodesDelete:S,onEdgesDelete:w,triggerNodeChanges:g,triggerEdgeChanges:y,onDelete:m,onBeforeDelete:v}=t.getState(),{nodes:j,edges:E}=await J4({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:x,onBeforeDelete:v}),M=E.length>0,T=j.length>0;if(M){const C=E.map(px);w==null||w(E),y(C)}if(T){const C=j.map(px);S==null||S(j),g(C)}return(T||M)&&(m==null||m({nodes:j,edges:E})),{deletedNodes:j,deletedEdges:E}},getIntersectingNodes:(f,h=!0,p)=>{const x=Gm(f),S=x?f:c(f),w=p!==void 0;return S?(p||t.getState().nodes).filter(g=>{const y=t.getState().nodeLookup.get(g.id);if(y&&!x&&(g.id===f.id||!y.internals.positionAbsolute))return!1;const m=gs(w?g:y),v=Ui(m,S);return h&&v>0||v>=m.width*m.height||v>=S.width*S.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const S=Gm(f)?f:c(f);if(!S)return!1;const w=Ui(S,h);return p&&w>0||w>=h.width*h.height||w>=S.width*S.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,x=>{const S=typeof h=="function"?h(x):h;return p.replace?{...x,data:S}:{...x,data:{...x.data,...S}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,x=>{const S=typeof h=="function"?h(x):h;return p.replace?{...x,data:S}:{...x,data:{...x.data,...S}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return Z4(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var x;return Array.from(((x=t.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:x.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var x;return Array.from(((x=t.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:x.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??tM();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return b.useMemo(()=>({...a,...e,viewportInitialized:l}),[l])}const xx=e=>e.selected,Y_=typeof window<"u"?window:void 0;function V_({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Re(),{deleteElements:l}=up(),a=Yi(e,{actInsideInputWithModifier:!1}),s=Yi(t,{target:Y_});b.useEffect(()=>{if(a){const{edges:i,nodes:r}=n.getState();l({nodes:r.filter(xx),edges:i.filter(xx)}),n.setState({nodesSelectionActive:!1})}},[a]),b.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function X_(e){const t=Re();b.useEffect(()=>{const n=()=>{var a,s,i,r;if(!e.current||!(((s=(a=e.current).checkVisibility)==null?void 0:s.call(a))??!0))return!1;const l=ap(e.current);(l.height===0||l.width===0)&&((r=(i=t.getState()).onError)==null||r.call(i,"004",En.error004())),t.setState({width:l.width||500,height:l.height||500})};if(e.current){n(),window.addEventListener("resize",n);const l=new ResizeObserver(()=>n());return l.observe(e.current),()=>{window.removeEventListener("resize",n),l&&e.current&&l.unobserve(e.current)}}},[])}const Fc={position:"absolute",width:"100%",height:"100%",top:0,left:0},G_=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Q_({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:l=!1,panOnScrollSpeed:a=.5,panOnScrollMode:s=aa.Free,zoomOnDoubleClick:i=!0,panOnDrag:r=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:x,noWheelClassName:S,noPanClassName:w,onViewportChange:g,isControlledViewport:y,paneClickDistance:m,selectionOnDrag:v}){const j=Re(),E=b.useRef(null),{userSelectionActive:M,lib:T,connectionInProgress:C}=fe(G_,ze),H=Yi(h),A=b.useRef();X_(E);const $=b.useCallback(V=>{g==null||g({x:V[0],y:V[1],zoom:V[2]}),y||j.setState({transform:V})},[g,y]);return b.useEffect(()=>{if(E.current){A.current=LM({domNode:E.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:k=>j.setState(R=>R.paneDragging===k?R:{paneDragging:k}),onPanZoomStart:(k,R)=>{const{onViewportChangeStart:D,onMoveStart:O}=j.getState();O==null||O(k,R),D==null||D(R)},onPanZoom:(k,R)=>{const{onViewportChange:D,onMove:O}=j.getState();O==null||O(k,R),D==null||D(R)},onPanZoomEnd:(k,R)=>{const{onViewportChangeEnd:D,onMoveEnd:O}=j.getState();O==null||O(k,R),D==null||D(R)}});const{x:V,y:N,zoom:z}=A.current.getViewport();return j.setState({panZoom:A.current,transform:[V,N,z],domNode:E.current.closest(".react-flow")}),()=>{var k;(k=A.current)==null||k.destroy()}}},[]),b.useEffect(()=>{var V;(V=A.current)==null||V.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:l,panOnScrollSpeed:a,panOnScrollMode:s,zoomOnDoubleClick:i,panOnDrag:r,zoomActivationKeyPressed:H,preventScrolling:p,noPanClassName:w,userSelectionActive:M,noWheelClassName:S,lib:T,onTransformChange:$,connectionInProgress:C,selectionOnDrag:v,paneClickDistance:m})},[e,t,n,l,a,s,i,r,H,p,w,M,S,T,$,C,v,m]),o.jsx("div",{className:"react-flow__renderer",ref:E,style:Fc,children:x})}const Z_=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function I_(){const{userSelectionActive:e,userSelectionRect:t}=fe(Z_,ze);return e&&t?o.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const ad=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},K_=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function W_({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Bi.Full,panOnDrag:l,paneClickDistance:a,selectionOnDrag:s,onSelectionStart:i,onSelectionEnd:r,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:h,onPaneMouseLeave:p,children:x}){const S=Re(),{userSelectionActive:w,elementsSelectable:g,dragging:y,connectionInProgress:m}=fe(K_,ze),v=g&&(e||w),j=b.useRef(null),E=b.useRef(),M=b.useRef(new Set),T=b.useRef(new Set),C=b.useRef(!1),H=D=>{if(C.current||m){C.current=!1;return}c==null||c(D),S.getState().resetSelectedElements(),S.setState({nodesSelectionActive:!1})},A=D=>{if(Array.isArray(l)&&(l!=null&&l.includes(2))){D.preventDefault();return}u==null||u(D)},$=d?D=>d(D):void 0,V=D=>{C.current&&(D.stopPropagation(),C.current=!1)},N=D=>{var U,G;const{domNode:O}=S.getState();if(E.current=O==null?void 0:O.getBoundingClientRect(),!E.current)return;const q=D.target===j.current;if(!q&&!!D.target.closest(".nokey")||!e||!(s&&q||t)||D.button!==0||!D.isPrimary)return;(G=(U=D.target)==null?void 0:U.setPointerCapture)==null||G.call(U,D.pointerId),C.current=!1;const{x:Y,y:_}=rn(D.nativeEvent,E.current);S.setState({userSelectionRect:{width:0,height:0,startX:Y,startY:_,x:Y,y:_}}),q||(D.stopPropagation(),D.preventDefault())},z=D=>{const{userSelectionRect:O,transform:q,nodeLookup:X,edgeLookup:L,connectionLookup:Y,triggerNodeChanges:_,triggerEdgeChanges:U,defaultEdgeOptions:G,resetSelectedElements:I}=S.getState();if(!E.current||!O)return;const{x:B,y:K}=rn(D.nativeEvent,E.current),{startX:W,startY:F}=O;if(!C.current){const te=t?0:a;if(Math.hypot(B-W,K-F)<=te)return;I(),i==null||i(D)}C.current=!0;const J={startX:W,startY:F,x:B<W?B:W,y:K<F?K:F,width:Math.abs(B-W),height:Math.abs(K-F)},P=M.current,ne=T.current;M.current=new Set(np(X,J,q,n===Bi.Partial,!0).map(te=>te.id)),T.current=new Set;const ae=(G==null?void 0:G.selectable)??!0;for(const te of M.current){const Z=Y.get(te);if(Z)for(const{edgeId:ve}of Z.values()){const xe=L.get(ve);xe&&(xe.selectable??ae)&&T.current.add(ve)}}if(!Qm(P,M.current)){const te=Va(X,M.current,!0);_(te)}if(!Qm(ne,T.current)){const te=Va(L,T.current);U(te)}S.setState({userSelectionRect:J,userSelectionActive:!0,nodesSelectionActive:!1})},k=D=>{var O,q;D.button===0&&((q=(O=D.target)==null?void 0:O.releasePointerCapture)==null||q.call(O,D.pointerId),!w&&D.target===j.current&&S.getState().userSelectionRect&&(H==null||H(D)),S.setState({userSelectionActive:!1,userSelectionRect:null}),C.current&&(r==null||r(D),S.setState({nodesSelectionActive:M.current.size>0})))},R=l===!0||Array.isArray(l)&&l.includes(0);return o.jsxs("div",{className:Ve(["react-flow__pane",{draggable:R,dragging:y,selection:e}]),onClick:v?void 0:ad(H,j),onContextMenu:ad(A,j),onWheel:ad($,j),onPointerEnter:v?void 0:f,onPointerMove:v?z:h,onPointerUp:v?k:void 0,onPointerDownCapture:v?N:void 0,onClickCapture:v?V:void 0,onPointerLeave:p,ref:j,style:Fc,children:[x,o.jsx(I_,{})]})}function jf({id:e,store:t,unselect:n=!1,nodeRef:l}){const{addSelectedNodes:a,unselectNodesAndEdges:s,multiSelectionActive:i,nodeLookup:r,onError:c}=t.getState(),u=r.get(e);if(!u){c==null||c("012",En.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&i)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=l==null?void 0:l.current)==null?void 0:d.blur()})):a([e])}function Bb({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:l,nodeId:a,isSelectable:s,nodeClickDistance:i}){const r=Re(),[c,u]=b.useState(!1),d=b.useRef();return b.useEffect(()=>{d.current=jM({getStoreItems:()=>r.getState(),onNodeMouseDown:f=>{jf({id:f,store:r,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),b.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:l,domNode:e.current,isSelectable:s,nodeId:a,nodeClickDistance:i}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,l,t,s,e,a,i]),c}const J_=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Ub(){const e=Re();return b.useCallback(n=>{const{nodeExtent:l,snapToGrid:a,snapGrid:s,nodesDraggable:i,onError:r,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=J_(i),p=a?s[0]:5,x=a?s[1]:5,S=n.direction.x*p*n.factor,w=n.direction.y*x*n.factor;for(const[,g]of u){if(!h(g))continue;let y={x:g.internals.positionAbsolute.x+S,y:g.internals.positionAbsolute.y+w};a&&(y=ur(y,s));const{position:m,positionAbsolute:v}=tb({nodeId:g.id,nextPosition:y,nodeLookup:u,nodeExtent:l,nodeOrigin:d,onError:r});g.position=m,g.internals.positionAbsolute=v,f.set(g.id,g)}c(f)},[])}const dp=b.createContext(null),F_=dp.Provider;dp.Consumer;const qb=()=>b.useContext(dp),P_=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),eT=(e,t,n)=>l=>{const{connectionClickStartHandle:a,connectionMode:s,connection:i}=l,{fromHandle:r,toHandle:c,isValid:u}=i,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(r==null?void 0:r.nodeId)===e&&(r==null?void 0:r.id)===t&&(r==null?void 0:r.type)===n,connectingTo:d,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,isPossibleEndHandle:s===hs.Strict?(r==null?void 0:r.type)!==n:e!==(r==null?void 0:r.nodeId)||t!==(r==null?void 0:r.id),connectionInProcess:!!r,clickConnectionInProcess:!!a,valid:d&&u}};function tT({type:e="source",position:t=ee.Top,isValidConnection:n,isConnectable:l=!0,isConnectableStart:a=!0,isConnectableEnd:s=!0,id:i,onConnect:r,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var z,k;const x=i||null,S=e==="target",w=Re(),g=qb(),{connectOnClick:y,noPanClassName:m,rfId:v}=fe(P_,ze),{connectingFrom:j,connectingTo:E,clickConnecting:M,isPossibleEndHandle:T,connectionInProcess:C,clickConnectionInProcess:H,valid:A}=fe(eT(g,x,e),ze);g||(k=(z=w.getState()).onError)==null||k.call(z,"010",En.error010());const $=R=>{const{defaultEdgeOptions:D,onConnect:O,hasDefaultEdges:q}=w.getState(),X={...D,...R};if(q){const{edges:L,setEdges:Y}=w.getState();Y(oM(X,L))}O==null||O(X),r==null||r(X)},V=R=>{if(!g)return;const D=cb(R.nativeEvent);if(a&&(D&&R.button===0||!D)){const O=w.getState();Sf.onPointerDown(R.nativeEvent,{handleDomNode:R.currentTarget,autoPanOnConnect:O.autoPanOnConnect,connectionMode:O.connectionMode,connectionRadius:O.connectionRadius,domNode:O.domNode,nodeLookup:O.nodeLookup,lib:O.lib,isTarget:S,handleId:x,nodeId:g,flowId:O.rfId,panBy:O.panBy,cancelConnection:O.cancelConnection,onConnectStart:O.onConnectStart,onConnectEnd:(...q)=>{var X,L;return(L=(X=w.getState()).onConnectEnd)==null?void 0:L.call(X,...q)},updateConnection:O.updateConnection,onConnect:$,isValidConnection:n||((...q)=>{var X,L;return((L=(X=w.getState()).isValidConnection)==null?void 0:L.call(X,...q))??!0}),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:O.autoPanSpeed,dragThreshold:O.connectionDragThreshold})}D?d==null||d(R):f==null||f(R)},N=R=>{const{onClickConnectStart:D,onClickConnectEnd:O,connectionClickStartHandle:q,connectionMode:X,isValidConnection:L,lib:Y,rfId:_,nodeLookup:U,connection:G}=w.getState();if(!g||!q&&!a)return;if(!q){D==null||D(R.nativeEvent,{nodeId:g,handleId:x,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:g,type:e,id:x}});return}const I=rb(R.target),B=n||L,{connection:K,isValid:W}=Sf.isValid(R.nativeEvent,{handle:{nodeId:g,id:x,type:e},connectionMode:X,fromNodeId:q.nodeId,fromHandleId:q.id||null,fromType:q.type,isValidConnection:B,flowId:_,doc:I,lib:Y,nodeLookup:U});W&&K&&$(K);const F=structuredClone(G);delete F.inProgress,F.toPosition=F.toHandle?F.toHandle.position:null,O==null||O(R,F),w.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":x,"data-nodeid":g,"data-handlepos":t,"data-id":`${v}-${g}-${x}-${e}`,className:Ve(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",m,u,{source:!S,target:S,connectable:l,connectablestart:a,connectableend:s,clickconnecting:M,connectingfrom:j,connectingto:E,valid:A,connectionindicator:l&&(!C||T)&&(C||H?s:a)}]),onMouseDown:V,onTouchStart:V,onClick:y?N:void 0,ref:p,...h,children:c})}const vs=b.memo($b(tT));function nT({data:e,isConnectable:t,sourcePosition:n=ee.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(vs,{type:"source",position:n,isConnectable:t})]})}function lT({data:e,isConnectable:t,targetPosition:n=ee.Top,sourcePosition:l=ee.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(vs,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(vs,{type:"source",position:l,isConnectable:t})]})}function aT(){return null}function sT({data:e,isConnectable:t,targetPosition:n=ee.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(vs,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const pc={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},yx={input:nT,default:lT,output:sT,group:aT};function iT(e){var t,n,l,a;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((l=e.style)==null?void 0:l.width),height:e.height??((a=e.style)==null?void 0:a.height)}}const rT=e=>{const{width:t,height:n,x:l,y:a}=cr(e.nodeLookup,{filter:s=>!!s.selected});return{width:sn(t)?t:null,height:sn(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${l}px,${a}px)`}};function oT({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const l=Re(),{width:a,height:s,transformString:i,userSelectionActive:r}=fe(rT,ze),c=Ub(),u=b.useRef(null);b.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!r&&a!==null&&s!==null;if(Bb({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const x=l.getState().nodes.filter(S=>S.selected);e(p,x)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(pc,p.key)&&(p.preventDefault(),c({direction:pc[p.key],factor:p.shiftKey?4:1}))};return o.jsx("div",{className:Ve(["react-flow__nodesselection","react-flow__container",t]),style:{transform:i},children:o.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:a,height:s}})})}const vx=typeof window<"u"?window:void 0,cT=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Yb({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:l,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:i,paneClickDistance:r,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:w,elementsSelectable:g,zoomOnScroll:y,zoomOnPinch:m,panOnScroll:v,panOnScrollSpeed:j,panOnScrollMode:E,zoomOnDoubleClick:M,panOnDrag:T,defaultViewport:C,translateExtent:H,minZoom:A,maxZoom:$,preventScrolling:V,onSelectionContextMenu:N,noWheelClassName:z,noPanClassName:k,disableKeyboardA11y:R,onViewportChange:D,isControlledViewport:O}){const{nodesSelectionActive:q,userSelectionActive:X}=fe(cT,ze),L=Yi(u,{target:vx}),Y=Yi(S,{target:vx}),_=Y||T,U=Y||v,G=d&&_!==!0,I=L||X||G;return V_({deleteKeyCode:c,multiSelectionKeyCode:x}),o.jsx(Q_,{onPaneContextMenu:s,elementsSelectable:g,zoomOnScroll:y,zoomOnPinch:m,panOnScroll:U,panOnScrollSpeed:j,panOnScrollMode:E,zoomOnDoubleClick:M,panOnDrag:!L&&_,defaultViewport:C,translateExtent:H,minZoom:A,maxZoom:$,zoomActivationKeyCode:w,preventScrolling:V,noWheelClassName:z,noPanClassName:k,onViewportChange:D,isControlledViewport:O,paneClickDistance:r,selectionOnDrag:G,children:o.jsxs(W_,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:l,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:_,isSelecting:!!I,selectionMode:f,selectionKeyPressed:L,paneClickDistance:r,selectionOnDrag:G,children:[e,q&&o.jsx(oT,{onSelectionContextMenu:N,noPanClassName:k,disableKeyboardA11y:R})]})})}Yb.displayName="FlowRenderer";const uT=b.memo(Yb),dT=e=>t=>e?np(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function fT(e){return fe(b.useCallback(dT(e),[e]),ze)}const hT=e=>e.updateNodeInternals;function pT(){const e=fe(hT),[t]=b.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const l=new Map;n.forEach(a=>{const s=a.target.getAttribute("data-id");l.set(s,{id:s,nodeElement:a.target,force:!0})}),e(l)}));return b.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function gT({node:e,nodeType:t,hasDimensions:n,resizeObserver:l}){const a=Re(),s=b.useRef(null),i=b.useRef(null),r=b.useRef(e.sourcePosition),c=b.useRef(e.targetPosition),u=b.useRef(t),d=n&&!!e.internals.handleBounds;return b.useEffect(()=>{s.current&&!e.hidden&&(!d||i.current!==s.current)&&(i.current&&(l==null||l.unobserve(i.current)),l==null||l.observe(s.current),i.current=s.current)},[d,e.hidden]),b.useEffect(()=>()=>{i.current&&(l==null||l.unobserve(i.current),i.current=null)},[]),b.useEffect(()=>{if(s.current){const f=u.current!==t,h=r.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||h||p)&&(u.current=t,r.current=e.sourcePosition,c.current=e.targetPosition,a.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function mT({id:e,onClick:t,onMouseEnter:n,onMouseMove:l,onMouseLeave:a,onContextMenu:s,onDoubleClick:i,nodesDraggable:r,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:x,rfId:S,nodeTypes:w,nodeClickDistance:g,onError:y}){const{node:m,internals:v,isParent:j}=fe(B=>{const K=B.nodeLookup.get(e),W=B.parentLookup.has(e);return{node:K,internals:K.internals,isParent:W}},ze);let E=m.type||"default",M=(w==null?void 0:w[E])||yx[E];M===void 0&&(y==null||y("003",En.error003(E)),E="default",M=(w==null?void 0:w.default)||yx.default);const T=!!(m.draggable||r&&typeof m.draggable>"u"),C=!!(m.selectable||c&&typeof m.selectable>"u"),H=!!(m.connectable||u&&typeof m.connectable>"u"),A=!!(m.focusable||d&&typeof m.focusable>"u"),$=Re(),V=sb(m),N=gT({node:m,nodeType:E,hasDimensions:V,resizeObserver:f}),z=Bb({nodeRef:N,disabled:m.hidden||!T,noDragClassName:h,handleSelector:m.dragHandle,nodeId:e,isSelectable:C,nodeClickDistance:g}),k=Ub();if(m.hidden)return null;const R=nl(m),D=iT(m),O=C||T||t||n||l||a,q=n?B=>n(B,{...v.userNode}):void 0,X=l?B=>l(B,{...v.userNode}):void 0,L=a?B=>a(B,{...v.userNode}):void 0,Y=s?B=>s(B,{...v.userNode}):void 0,_=i?B=>i(B,{...v.userNode}):void 0,U=B=>{const{selectNodesOnDrag:K,nodeDragThreshold:W}=$.getState();C&&(!K||!T||W>0)&&jf({id:e,store:$,nodeRef:N}),t&&t(B,{...v.userNode})},G=B=>{if(!(ob(B.nativeEvent)||x)){if(W1.includes(B.key)&&C){const K=B.key==="Escape";jf({id:e,store:$,unselect:K,nodeRef:N})}else if(T&&m.selected&&Object.prototype.hasOwnProperty.call(pc,B.key)){B.preventDefault();const{ariaLabelConfig:K}=$.getState();$.setState({ariaLiveMessage:K["node.a11yDescription.ariaLiveMessage"]({direction:B.key.replace("Arrow","").toLowerCase(),x:~~v.positionAbsolute.x,y:~~v.positionAbsolute.y})}),k({direction:pc[B.key],factor:B.shiftKey?4:1})}}},I=()=>{var ne;if(x||!((ne=N.current)!=null&&ne.matches(":focus-visible")))return;const{transform:B,width:K,height:W,autoPanOnNodeFocus:F,setCenter:J}=$.getState();if(!F)return;np(new Map([[e,m]]),{x:0,y:0,width:K,height:W},B,!0).length>0||J(m.position.x+R.width/2,m.position.y+R.height/2,{zoom:B[2]})};return o.jsx("div",{className:Ve(["react-flow__node",`react-flow__node-${E}`,{[p]:T},m.className,{selected:m.selected,selectable:C,parent:j,draggable:T,dragging:z}]),ref:N,style:{zIndex:v.z,transform:`translate(${v.positionAbsolute.x}px,${v.positionAbsolute.y}px)`,pointerEvents:O?"all":"none",visibility:V?"visible":"hidden",...m.style,...D},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:q,onMouseMove:X,onMouseLeave:L,onContextMenu:Y,onClick:U,onDoubleClick:_,onKeyDown:A?G:void 0,tabIndex:A?0:void 0,onFocus:A?I:void 0,role:m.ariaRole??(A?"group":void 0),"aria-roledescription":"node","aria-describedby":x?void 0:`${Ab}-${S}`,"aria-label":m.ariaLabel,...m.domAttributes,children:o.jsx(F_,{value:e,children:o.jsx(M,{id:e,data:m.data,type:E,positionAbsoluteX:v.positionAbsolute.x,positionAbsoluteY:v.positionAbsolute.y,selected:m.selected??!1,selectable:C,draggable:T,deletable:m.deletable??!0,isConnectable:H,sourcePosition:m.sourcePosition,targetPosition:m.targetPosition,dragging:z,dragHandle:m.dragHandle,zIndex:v.z,parentId:m.parentId,...R})})})}var xT=b.memo(mT);const yT=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Vb(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:l,elementsSelectable:a,onError:s}=fe(yT,ze),i=fT(e.onlyRenderVisibleElements),r=pT();return o.jsx("div",{className:"react-flow__nodes",style:Fc,children:i.map(c=>o.jsx(xT,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:r,nodesDraggable:t,nodesConnectable:n,nodesFocusable:l,elementsSelectable:a,nodeClickDistance:e.nodeClickDistance,onError:s},c))})}Vb.displayName="NodeRenderer";const vT=b.memo(Vb);function bT(e){return fe(b.useCallback(n=>{if(!e)return n.edges.map(a=>a.id);const l=[];if(n.width&&n.height)for(const a of n.edges){const s=n.nodeLookup.get(a.source),i=n.nodeLookup.get(a.target);s&&i&&sM({sourceNode:s,targetNode:i,width:n.width,height:n.height,transform:n.transform})&&l.push(a.id)}return l},[e]),ze)}const wT=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return o.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},ST=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return o.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},bx={[dc.Arrow]:wT,[dc.ArrowClosed]:ST};function NT(e){const t=Re();return b.useMemo(()=>{var a,s;return Object.prototype.hasOwnProperty.call(bx,e)?bx[e]:((s=(a=t.getState()).onError)==null||s.call(a,"009",En.error009(e)),null)},[e])}const jT=({id:e,type:t,color:n,width:l=12.5,height:a=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:r="auto-start-reverse"})=>{const c=NT(t);return c?o.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${l}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:r,refX:"0",refY:"0",children:o.jsx(c,{color:n,strokeWidth:i})}):null},Xb=({defaultColor:e,rfId:t})=>{const n=fe(s=>s.edges),l=fe(s=>s.defaultEdgeOptions),a=b.useMemo(()=>hM(n,{id:t,defaultColor:e,defaultMarkerStart:l==null?void 0:l.markerStart,defaultMarkerEnd:l==null?void 0:l.markerEnd}),[n,l,t,e]);return a.length?o.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:o.jsx("defs",{children:a.map(s=>o.jsx(jT,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};Xb.displayName="MarkerDefinitions";var kT=b.memo(Xb);function Gb({x:e,y:t,label:n,labelStyle:l,labelShowBg:a=!0,labelBgStyle:s,labelBgPadding:i=[2,4],labelBgBorderRadius:r=2,children:c,className:u,...d}){const[f,h]=b.useState({x:1,y:0,width:0,height:0}),p=Ve(["react-flow__edge-textwrapper",u]),x=b.useRef(null);return b.useEffect(()=>{if(x.current){const S=x.current.getBBox();h({x:S.x,y:S.y,width:S.width,height:S.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[a&&o.jsx("rect",{width:f.width+2*i[0],x:-i[0],y:-i[1],height:f.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:r,ry:r}),o.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:x,style:l,children:n}),c]}):null}Gb.displayName="EdgeText";const ET=b.memo(Gb);function Pc({path:e,labelX:t,labelY:n,label:l,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:r,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...d,d:e,fill:"none",className:Ve(["react-flow__edge-path",d.className])}),u?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,l&&sn(t)&&sn(n)?o.jsx(ET,{x:t,y:n,label:l,labelStyle:a,labelShowBg:s,labelBgStyle:i,labelBgPadding:r,labelBgBorderRadius:c}):null]})}function wx({pos:e,x1:t,y1:n,x2:l,y2:a}){return e===ee.Left||e===ee.Right?[.5*(t+l),n]:[t,.5*(n+a)]}function Qb({sourceX:e,sourceY:t,sourcePosition:n=ee.Bottom,targetX:l,targetY:a,targetPosition:s=ee.Top}){const[i,r]=wx({pos:n,x1:e,y1:t,x2:l,y2:a}),[c,u]=wx({pos:s,x1:l,y1:a,x2:e,y2:t}),[d,f,h,p]=ub({sourceX:e,sourceY:t,targetX:l,targetY:a,sourceControlX:i,sourceControlY:r,targetControlX:c,targetControlY:u});return[`M${e},${t} C${i},${r} ${c},${u} ${l},${a}`,d,f,h,p]}function Zb(e){return b.memo(({id:t,sourceX:n,sourceY:l,targetX:a,targetY:s,sourcePosition:i,targetPosition:r,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:x,markerEnd:S,markerStart:w,interactionWidth:g})=>{const[y,m,v]=Qb({sourceX:n,sourceY:l,sourcePosition:i,targetX:a,targetY:s,targetPosition:r}),j=e.isInternal?void 0:t;return o.jsx(Pc,{id:j,path:y,labelX:m,labelY:v,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:x,markerEnd:S,markerStart:w,interactionWidth:g})})}const CT=Zb({isInternal:!1}),Ib=Zb({isInternal:!0});CT.displayName="SimpleBezierEdge";Ib.displayName="SimpleBezierEdgeInternal";function Kb(e){return b.memo(({id:t,sourceX:n,sourceY:l,targetX:a,targetY:s,label:i,labelStyle:r,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=ee.Bottom,targetPosition:x=ee.Top,markerEnd:S,markerStart:w,pathOptions:g,interactionWidth:y})=>{const[m,v,j]=vf({sourceX:n,sourceY:l,sourcePosition:p,targetX:a,targetY:s,targetPosition:x,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset,stepPosition:g==null?void 0:g.stepPosition}),E=e.isInternal?void 0:t;return o.jsx(Pc,{id:E,path:m,labelX:v,labelY:j,label:i,labelStyle:r,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:S,markerStart:w,interactionWidth:y})})}const Wb=Kb({isInternal:!1}),Jb=Kb({isInternal:!0});Wb.displayName="SmoothStepEdge";Jb.displayName="SmoothStepEdgeInternal";function Fb(e){return b.memo(({id:t,...n})=>{var a;const l=e.isInternal?void 0:t;return o.jsx(Wb,{...n,id:l,pathOptions:b.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(a=n.pathOptions)==null?void 0:a.offset])})})}const MT=Fb({isInternal:!1}),Pb=Fb({isInternal:!0});MT.displayName="StepEdge";Pb.displayName="StepEdgeInternal";function e2(e){return b.memo(({id:t,sourceX:n,sourceY:l,targetX:a,targetY:s,label:i,labelStyle:r,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:x,interactionWidth:S})=>{const[w,g,y]=hb({sourceX:n,sourceY:l,targetX:a,targetY:s}),m=e.isInternal?void 0:t;return o.jsx(Pc,{id:m,path:w,labelX:g,labelY:y,label:i,labelStyle:r,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:x,interactionWidth:S})})}const _T=e2({isInternal:!1}),t2=e2({isInternal:!0});_T.displayName="StraightEdge";t2.displayName="StraightEdgeInternal";function n2(e){return b.memo(({id:t,sourceX:n,sourceY:l,targetX:a,targetY:s,sourcePosition:i=ee.Bottom,targetPosition:r=ee.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:x,markerEnd:S,markerStart:w,pathOptions:g,interactionWidth:y})=>{const[m,v,j]=db({sourceX:n,sourceY:l,sourcePosition:i,targetX:a,targetY:s,targetPosition:r,curvature:g==null?void 0:g.curvature}),E=e.isInternal?void 0:t;return o.jsx(Pc,{id:E,path:m,labelX:v,labelY:j,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:x,markerEnd:S,markerStart:w,interactionWidth:y})})}const TT=n2({isInternal:!1}),l2=n2({isInternal:!0});TT.displayName="BezierEdge";l2.displayName="BezierEdgeInternal";const Sx={default:l2,straight:t2,step:Pb,smoothstep:Jb,simplebezier:Ib},Nx={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},AT=(e,t,n)=>n===ee.Left?e-t:n===ee.Right?e+t:e,DT=(e,t,n)=>n===ee.Top?e-t:n===ee.Bottom?e+t:e,jx="react-flow__edgeupdater";function kx({position:e,centerX:t,centerY:n,radius:l=10,onMouseDown:a,onMouseEnter:s,onMouseOut:i,type:r}){return o.jsx("circle",{onMouseDown:a,onMouseEnter:s,onMouseOut:i,className:Ve([jx,`${jx}-${r}`]),cx:AT(t,l,e),cy:DT(n,l,e),r:l,stroke:"transparent",fill:"transparent"})}function zT({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:l,sourceY:a,targetX:s,targetY:i,sourcePosition:r,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const x=Re(),S=(v,j)=>{if(v.button!==0)return;const{autoPanOnConnect:E,domNode:M,connectionMode:T,connectionRadius:C,lib:H,onConnectStart:A,cancelConnection:$,nodeLookup:V,rfId:N,panBy:z,updateConnection:k}=x.getState(),R=j.type==="target",D=(X,L)=>{h(!1),f==null||f(X,n,j.type,L)},O=X=>u==null?void 0:u(n,X),q=(X,L)=>{h(!0),d==null||d(v,n,j.type),A==null||A(X,L)};Sf.onPointerDown(v.nativeEvent,{autoPanOnConnect:E,connectionMode:T,connectionRadius:C,domNode:M,handleId:j.id,nodeId:j.nodeId,nodeLookup:V,isTarget:R,edgeUpdaterType:j.type,lib:H,flowId:N,cancelConnection:$,panBy:z,isValidConnection:(...X)=>{var L,Y;return((Y=(L=x.getState()).isValidConnection)==null?void 0:Y.call(L,...X))??!0},onConnect:O,onConnectStart:q,onConnectEnd:(...X)=>{var L,Y;return(Y=(L=x.getState()).onConnectEnd)==null?void 0:Y.call(L,...X)},onReconnectEnd:D,updateConnection:k,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,dragThreshold:x.getState().connectionDragThreshold,handleDomNode:v.currentTarget})},w=v=>S(v,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),g=v=>S(v,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),y=()=>p(!0),m=()=>p(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(kx,{position:r,centerX:l,centerY:a,radius:t,onMouseDown:w,onMouseEnter:y,onMouseOut:m,type:"source"}),(e===!0||e==="target")&&o.jsx(kx,{position:c,centerX:s,centerY:i,radius:t,onMouseDown:g,onMouseEnter:y,onMouseOut:m,type:"target"})]})}function RT({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:l,onClick:a,onDoubleClick:s,onContextMenu:i,onMouseEnter:r,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:x,edgeTypes:S,noPanClassName:w,onError:g,disableKeyboardA11y:y}){let m=fe(J=>J.edgeLookup.get(e));const v=fe(J=>J.defaultEdgeOptions);m=v?{...v,...m}:m;let j=m.type||"default",E=(S==null?void 0:S[j])||Sx[j];E===void 0&&(g==null||g("011",En.error011(j)),j="default",E=(S==null?void 0:S.default)||Sx.default);const M=!!(m.focusable||t&&typeof m.focusable>"u"),T=typeof f<"u"&&(m.reconnectable||n&&typeof m.reconnectable>"u"),C=!!(m.selectable||l&&typeof m.selectable>"u"),H=b.useRef(null),[A,$]=b.useState(!1),[V,N]=b.useState(!1),z=Re(),{zIndex:k,sourceX:R,sourceY:D,targetX:O,targetY:q,sourcePosition:X,targetPosition:L}=fe(b.useCallback(J=>{const P=J.nodeLookup.get(m.source),ne=J.nodeLookup.get(m.target);if(!P||!ne)return{zIndex:m.zIndex,...Nx};const ae=fM({id:e,sourceNode:P,targetNode:ne,sourceHandle:m.sourceHandle||null,targetHandle:m.targetHandle||null,connectionMode:J.connectionMode,onError:g});return{zIndex:aM({selected:m.selected,zIndex:m.zIndex,sourceNode:P,targetNode:ne,elevateOnSelect:J.elevateEdgesOnSelect,zIndexMode:J.zIndexMode}),...ae||Nx}},[m.source,m.target,m.sourceHandle,m.targetHandle,m.selected,m.zIndex]),ze),Y=b.useMemo(()=>m.markerStart?`url('#${bf(m.markerStart,x)}')`:void 0,[m.markerStart,x]),_=b.useMemo(()=>m.markerEnd?`url('#${bf(m.markerEnd,x)}')`:void 0,[m.markerEnd,x]);if(m.hidden||R===null||D===null||O===null||q===null)return null;const U=J=>{var te;const{addSelectedEdges:P,unselectNodesAndEdges:ne,multiSelectionActive:ae}=z.getState();C&&(z.setState({nodesSelectionActive:!1}),m.selected&&ae?(ne({nodes:[],edges:[m]}),(te=H.current)==null||te.blur()):P([e])),a&&a(J,m)},G=s?J=>{s(J,{...m})}:void 0,I=i?J=>{i(J,{...m})}:void 0,B=r?J=>{r(J,{...m})}:void 0,K=c?J=>{c(J,{...m})}:void 0,W=u?J=>{u(J,{...m})}:void 0,F=J=>{var P;if(!y&&W1.includes(J.key)&&C){const{unselectNodesAndEdges:ne,addSelectedEdges:ae}=z.getState();J.key==="Escape"?((P=H.current)==null||P.blur(),ne({edges:[m]})):ae([e])}};return o.jsx("svg",{style:{zIndex:k},children:o.jsxs("g",{className:Ve(["react-flow__edge",`react-flow__edge-${j}`,m.className,w,{selected:m.selected,animated:m.animated,inactive:!C&&!a,updating:A,selectable:C}]),onClick:U,onDoubleClick:G,onContextMenu:I,onMouseEnter:B,onMouseMove:K,onMouseLeave:W,onKeyDown:M?F:void 0,tabIndex:M?0:void 0,role:m.ariaRole??(M?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":m.ariaLabel===null?void 0:m.ariaLabel||`Edge from ${m.source} to ${m.target}`,"aria-describedby":M?`${Db}-${x}`:void 0,ref:H,...m.domAttributes,children:[!V&&o.jsx(E,{id:e,source:m.source,target:m.target,type:m.type,selected:m.selected,animated:m.animated,selectable:C,deletable:m.deletable??!0,label:m.label,labelStyle:m.labelStyle,labelShowBg:m.labelShowBg,labelBgStyle:m.labelBgStyle,labelBgPadding:m.labelBgPadding,labelBgBorderRadius:m.labelBgBorderRadius,sourceX:R,sourceY:D,targetX:O,targetY:q,sourcePosition:X,targetPosition:L,data:m.data,style:m.style,sourceHandleId:m.sourceHandle,targetHandleId:m.targetHandle,markerStart:Y,markerEnd:_,pathOptions:"pathOptions"in m?m.pathOptions:void 0,interactionWidth:m.interactionWidth}),T&&o.jsx(zT,{edge:m,isReconnectable:T,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:R,sourceY:D,targetX:O,targetY:q,sourcePosition:X,targetPosition:L,setUpdateHover:$,setReconnecting:N})]})})}var OT=b.memo(RT);const HT=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function a2({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:l,noPanClassName:a,onReconnect:s,onEdgeContextMenu:i,onEdgeMouseEnter:r,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:x,disableKeyboardA11y:S}){const{edgesFocusable:w,edgesReconnectable:g,elementsSelectable:y,onError:m}=fe(HT,ze),v=bT(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(kT,{defaultColor:e,rfId:n}),v.map(j=>o.jsx(OT,{id:j,edgesFocusable:w,edgesReconnectable:g,elementsSelectable:y,noPanClassName:a,onReconnect:s,onContextMenu:i,onMouseEnter:r,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:x,rfId:n,onError:m,edgeTypes:l,disableKeyboardA11y:S},j))]})}a2.displayName="EdgeRenderer";const $T=b.memo(a2),LT=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function BT({children:e}){const t=fe(LT);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function UT(e){const t=up(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const qT=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function YT(e){const t=fe(qT),n=Re();return b.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function VT(e){return e.connection.inProgress?{...e.connection,to:dr(e.connection.to,e.transform)}:{...e.connection}}function XT(e){return VT}function GT(e){const t=XT();return fe(t,ze)}const QT=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function ZT({containerStyle:e,style:t,type:n,component:l}){const{nodesConnectable:a,width:s,height:i,isValid:r,inProgress:c}=fe(QT,ze);return!(s&&a&&c)?null:o.jsx("svg",{style:e,width:s,height:i,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:Ve(["react-flow__connection",P1(r)]),children:o.jsx(s2,{style:t,type:n,CustomComponent:l,isValid:r})})})}const s2=({style:e,type:t=xl.Bezier,CustomComponent:n,isValid:l})=>{const{inProgress:a,from:s,fromNode:i,fromHandle:r,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=GT();if(!a)return;if(n)return o.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:i,fromHandle:r,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:P1(l),toNode:d,toHandle:f,pointer:p});let x="";const S={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case xl.Bezier:[x]=db(S);break;case xl.SimpleBezier:[x]=Qb(S);break;case xl.Step:[x]=vf({...S,borderRadius:0});break;case xl.SmoothStep:[x]=vf(S);break;default:[x]=hb(S)}return o.jsx("path",{d:x,fill:"none",className:"react-flow__connection-path",style:e})};s2.displayName="ConnectionLine";const IT={};function Ex(e=IT){b.useRef(e),Re(),b.useEffect(()=>{},[e])}function KT(){Re(),b.useRef(!1),b.useEffect(()=>{},[])}function i2({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:l,onEdgeClick:a,onNodeDoubleClick:s,onEdgeDoubleClick:i,onNodeMouseEnter:r,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:x,connectionLineStyle:S,connectionLineComponent:w,connectionLineContainerStyle:g,selectionKeyCode:y,selectionOnDrag:m,selectionMode:v,multiSelectionKeyCode:j,panActivationKeyCode:E,zoomActivationKeyCode:M,deleteKeyCode:T,onlyRenderVisibleElements:C,elementsSelectable:H,defaultViewport:A,translateExtent:$,minZoom:V,maxZoom:N,preventScrolling:z,defaultMarkerColor:k,zoomOnScroll:R,zoomOnPinch:D,panOnScroll:O,panOnScrollSpeed:q,panOnScrollMode:X,zoomOnDoubleClick:L,panOnDrag:Y,onPaneClick:_,onPaneMouseEnter:U,onPaneMouseMove:G,onPaneMouseLeave:I,onPaneScroll:B,onPaneContextMenu:K,paneClickDistance:W,nodeClickDistance:F,onEdgeContextMenu:J,onEdgeMouseEnter:P,onEdgeMouseMove:ne,onEdgeMouseLeave:ae,reconnectRadius:te,onReconnect:Z,onReconnectStart:ve,onReconnectEnd:xe,noDragClassName:Se,noWheelClassName:Nt,noPanClassName:Ht,disableKeyboardA11y:Wt,nodeExtent:fn,rfId:ll,viewport:Jt,onViewportChange:st}){return Ex(e),Ex(t),KT(),UT(n),YT(Jt),o.jsx(uT,{onPaneClick:_,onPaneMouseEnter:U,onPaneMouseMove:G,onPaneMouseLeave:I,onPaneContextMenu:K,onPaneScroll:B,paneClickDistance:W,deleteKeyCode:T,selectionKeyCode:y,selectionOnDrag:m,selectionMode:v,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:j,panActivationKeyCode:E,zoomActivationKeyCode:M,elementsSelectable:H,zoomOnScroll:R,zoomOnPinch:D,zoomOnDoubleClick:L,panOnScroll:O,panOnScrollSpeed:q,panOnScrollMode:X,panOnDrag:Y,defaultViewport:A,translateExtent:$,minZoom:V,maxZoom:N,onSelectionContextMenu:f,preventScrolling:z,noDragClassName:Se,noWheelClassName:Nt,noPanClassName:Ht,disableKeyboardA11y:Wt,onViewportChange:st,isControlledViewport:!!Jt,children:o.jsxs(BT,{children:[o.jsx($T,{edgeTypes:t,onEdgeClick:a,onEdgeDoubleClick:i,onReconnect:Z,onReconnectStart:ve,onReconnectEnd:xe,onlyRenderVisibleElements:C,onEdgeContextMenu:J,onEdgeMouseEnter:P,onEdgeMouseMove:ne,onEdgeMouseLeave:ae,reconnectRadius:te,defaultMarkerColor:k,noPanClassName:Ht,disableKeyboardA11y:Wt,rfId:ll}),o.jsx(ZT,{style:S,type:x,component:w,containerStyle:g}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(vT,{nodeTypes:e,onNodeClick:l,onNodeDoubleClick:s,onNodeMouseEnter:r,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:F,onlyRenderVisibleElements:C,noPanClassName:Ht,noDragClassName:Se,disableKeyboardA11y:Wt,nodeExtent:fn,rfId:ll}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}i2.displayName="GraphView";const WT=b.memo(i2),Cx=({nodes:e,edges:t,defaultNodes:n,defaultEdges:l,width:a,height:s,fitView:i,fitViewOptions:r,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,x=new Map,S=new Map,w=new Map,g=l??t??[],y=n??e??[],m=d??[0,0],v=f??Li;mb(S,w,g);const{nodesInitialized:j}=wf(y,p,x,{nodeOrigin:m,nodeExtent:v,zIndexMode:h});let E=[0,0,1];if(i&&a&&s){const M=cr(p,{filter:A=>!!((A.width||A.initialWidth)&&(A.height||A.initialHeight))}),{x:T,y:C,zoom:H}=lp(M,a,s,c,u,(r==null?void 0:r.padding)??.1);E=[T,C,H]}return{rfId:"1",width:a??0,height:s??0,transform:E,nodes:y,nodesInitialized:j,nodeLookup:p,parentLookup:x,edges:g,edgeLookup:w,connectionLookup:S,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:l!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Li,nodeExtent:v,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:hs.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:m,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:i??!1,fitViewOptions:r,fitViewResolver:null,connection:{...F1},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:F4,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:J1,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},JT=({nodes:e,edges:t,defaultNodes:n,defaultEdges:l,width:a,height:s,fitView:i,fitViewOptions:r,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>m_((p,x)=>{async function S(){const{nodeLookup:w,panZoom:g,fitViewOptions:y,fitViewResolver:m,width:v,height:j,minZoom:E,maxZoom:M}=x();g&&(await W4({nodes:w,width:v,height:j,panZoom:g,minZoom:E,maxZoom:M},y),m==null||m.resolve(!0),p({fitViewResolver:null}))}return{...Cx({nodes:e,edges:t,width:a,height:s,fitView:i,fitViewOptions:r,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:l,zIndexMode:h}),setNodes:w=>{const{nodeLookup:g,parentLookup:y,nodeOrigin:m,elevateNodesOnSelect:v,fitViewQueued:j,zIndexMode:E,nodesSelectionActive:M}=x(),{nodesInitialized:T,hasSelectedNodes:C}=wf(w,g,y,{nodeOrigin:m,nodeExtent:f,elevateNodesOnSelect:v,checkEquality:!0,zIndexMode:E}),H=M&&C;j&&T?(S(),p({nodes:w,nodesInitialized:T,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:H})):p({nodes:w,nodesInitialized:T,nodesSelectionActive:H})},setEdges:w=>{const{connectionLookup:g,edgeLookup:y}=x();mb(g,y,w),p({edges:w})},setDefaultNodesAndEdges:(w,g)=>{if(w){const{setNodes:y}=x();y(w),p({hasDefaultNodes:!0})}if(g){const{setEdges:y}=x();y(g),p({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:g,nodeLookup:y,parentLookup:m,domNode:v,nodeOrigin:j,nodeExtent:E,debug:M,fitViewQueued:T,zIndexMode:C}=x(),{changes:H,updatedInternals:A}=bM(w,y,m,v,j,E,C);A&&(mM(y,m,{nodeOrigin:j,nodeExtent:E,zIndexMode:C}),T?(S(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(H==null?void 0:H.length)>0&&(M&&console.log("React Flow: trigger node changes",H),g==null||g(H)))},updateNodePositions:(w,g=!1)=>{const y=[];let m=[];const{nodeLookup:v,triggerNodeChanges:j,connection:E,updateConnection:M,onNodesChangeMiddlewareMap:T}=x();for(const[C,H]of w){const A=v.get(C),$=!!(A!=null&&A.expandParent&&(A!=null&&A.parentId)&&(H!=null&&H.position)),V={id:C,type:"position",position:$?{x:Math.max(0,H.position.x),y:Math.max(0,H.position.y)}:H.position,dragging:g};if(A&&E.inProgress&&E.fromNode.id===A.id){const N=pa(A,E.fromHandle,ee.Left,!0);M({...E,from:N})}$&&A.parentId&&y.push({id:C,parentId:A.parentId,rect:{...H.internals.positionAbsolute,width:H.measured.width??0,height:H.measured.height??0}}),m.push(V)}if(y.length>0){const{parentLookup:C,nodeOrigin:H}=x(),A=cp(y,v,C,H);m.push(...A)}for(const C of T.values())m=C(m);j(m)},triggerNodeChanges:w=>{const{onNodesChange:g,setNodes:y,nodes:m,hasDefaultNodes:v,debug:j}=x();if(w!=null&&w.length){if(v){const E=Ob(w,m);y(E)}j&&console.log("React Flow: trigger node changes",w),g==null||g(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:g,setEdges:y,edges:m,hasDefaultEdges:v,debug:j}=x();if(w!=null&&w.length){if(v){const E=Hb(w,m);y(E)}j&&console.log("React Flow: trigger edge changes",w),g==null||g(w)}},addSelectedNodes:w=>{const{multiSelectionActive:g,edgeLookup:y,nodeLookup:m,triggerNodeChanges:v,triggerEdgeChanges:j}=x();if(g){const E=w.map(M=>Il(M,!0));v(E);return}v(Va(m,new Set([...w]),!0)),j(Va(y))},addSelectedEdges:w=>{const{multiSelectionActive:g,edgeLookup:y,nodeLookup:m,triggerNodeChanges:v,triggerEdgeChanges:j}=x();if(g){const E=w.map(M=>Il(M,!0));j(E);return}j(Va(y,new Set([...w]))),v(Va(m,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:g}={})=>{const{edges:y,nodes:m,nodeLookup:v,triggerNodeChanges:j,triggerEdgeChanges:E}=x(),M=w||m,T=g||y,C=[];for(const A of M){if(!A.selected)continue;const $=v.get(A.id);$&&($.selected=!1),C.push(Il(A.id,!1))}const H=[];for(const A of T)A.selected&&H.push(Il(A.id,!1));j(C),E(H)},setMinZoom:w=>{const{panZoom:g,maxZoom:y}=x();g==null||g.setScaleExtent([w,y]),p({minZoom:w})},setMaxZoom:w=>{const{panZoom:g,minZoom:y}=x();g==null||g.setScaleExtent([y,w]),p({maxZoom:w})},setTranslateExtent:w=>{var g;(g=x().panZoom)==null||g.setTranslateExtent(w),p({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:g,triggerNodeChanges:y,triggerEdgeChanges:m,elementsSelectable:v}=x();if(!v)return;const j=g.reduce((M,T)=>T.selected?[...M,Il(T.id,!1)]:M,[]),E=w.reduce((M,T)=>T.selected?[...M,Il(T.id,!1)]:M,[]);y(j),m(E)},setNodeExtent:w=>{const{nodes:g,nodeLookup:y,parentLookup:m,nodeOrigin:v,elevateNodesOnSelect:j,nodeExtent:E,zIndexMode:M}=x();w[0][0]===E[0][0]&&w[0][1]===E[0][1]&&w[1][0]===E[1][0]&&w[1][1]===E[1][1]||(wf(g,y,m,{nodeOrigin:v,nodeExtent:w,elevateNodesOnSelect:j,checkEquality:!1,zIndexMode:M}),p({nodeExtent:w}))},panBy:w=>{const{transform:g,width:y,height:m,panZoom:v,translateExtent:j}=x();return wM({delta:w,panZoom:v,transform:g,translateExtent:j,width:y,height:m})},setCenter:async(w,g,y)=>{const{width:m,height:v,maxZoom:j,panZoom:E}=x();if(!E)return Promise.resolve(!1);const M=typeof(y==null?void 0:y.zoom)<"u"?y.zoom:j;return await E.setViewport({x:m/2-w*M,y:v/2-g*M,zoom:M},{duration:y==null?void 0:y.duration,ease:y==null?void 0:y.ease,interpolate:y==null?void 0:y.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{p({connection:{...F1}})},updateConnection:w=>{p({connection:w})},reset:()=>p({...Cx()})}},Object.is);function FT({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:l,initialWidth:a,initialHeight:s,initialMinZoom:i,initialMaxZoom:r,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[x]=b.useState(()=>JT({nodes:e,edges:t,defaultNodes:n,defaultEdges:l,width:a,height:s,fitView:u,minZoom:i,maxZoom:r,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return o.jsx(x_,{value:x,children:o.jsx(B_,{children:p})})}function PT({children:e,nodes:t,edges:n,defaultNodes:l,defaultEdges:a,width:s,height:i,fitView:r,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return b.useContext(Wc)?o.jsx(o.Fragment,{children:e}):o.jsx(FT,{initialNodes:t,initialEdges:n,defaultNodes:l,defaultEdges:a,initialWidth:s,initialHeight:i,fitView:r,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const eA={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function tA({nodes:e,edges:t,defaultNodes:n,defaultEdges:l,className:a,nodeTypes:s,edgeTypes:i,onNodeClick:r,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:x,onConnectEnd:S,onClickConnectStart:w,onClickConnectEnd:g,onNodeMouseEnter:y,onNodeMouseMove:m,onNodeMouseLeave:v,onNodeContextMenu:j,onNodeDoubleClick:E,onNodeDragStart:M,onNodeDrag:T,onNodeDragStop:C,onNodesDelete:H,onEdgesDelete:A,onDelete:$,onSelectionChange:V,onSelectionDragStart:N,onSelectionDrag:z,onSelectionDragStop:k,onSelectionContextMenu:R,onSelectionStart:D,onSelectionEnd:O,onBeforeDelete:q,connectionMode:X,connectionLineType:L=xl.Bezier,connectionLineStyle:Y,connectionLineComponent:_,connectionLineContainerStyle:U,deleteKeyCode:G="Backspace",selectionKeyCode:I="Shift",selectionOnDrag:B=!1,selectionMode:K=Bi.Full,panActivationKeyCode:W="Space",multiSelectionKeyCode:F=qi()?"Meta":"Control",zoomActivationKeyCode:J=qi()?"Meta":"Control",snapToGrid:P,snapGrid:ne,onlyRenderVisibleElements:ae=!1,selectNodesOnDrag:te,nodesDraggable:Z,autoPanOnNodeFocus:ve,nodesConnectable:xe,nodesFocusable:Se,nodeOrigin:Nt=zb,edgesFocusable:Ht,edgesReconnectable:Wt,elementsSelectable:fn=!0,defaultViewport:ll=T_,minZoom:Jt=.5,maxZoom:st=2,translateExtent:An=Li,preventScrolling:Bl=!0,nodeExtent:wa,defaultMarkerColor:hn="#b1b1b7",zoomOnScroll:fr=!0,zoomOnPinch:eu=!0,panOnScroll:tu=!1,panOnScrollSpeed:Ds=.5,panOnScrollMode:hr=aa.Free,zoomOnDoubleClick:nu=!0,panOnDrag:pr=!0,onPaneClick:lu,onPaneMouseEnter:au,onPaneMouseMove:su,onPaneMouseLeave:Ie,onPaneScroll:it,onPaneContextMenu:rt,paneClickDistance:pn=1,nodeClickDistance:ht=0,children:ot,onReconnect:$t,onReconnectStart:al,onReconnectEnd:Xe,onEdgeContextMenu:gn,onEdgeDoubleClick:Lt,onEdgeMouseEnter:Ft,onEdgeMouseMove:Ul,onEdgeMouseLeave:ql,reconnectRadius:mn=10,onNodesChange:Yl,onEdgesChange:zs,noDragClassName:u2="nodrag",noWheelClassName:d2="nowheel",noPanClassName:fp="nopan",fitView:hp,fitViewOptions:pp,connectOnClick:f2,attributionPosition:h2,proOptions:p2,defaultEdgeOptions:g2,elevateNodesOnSelect:m2=!0,elevateEdgesOnSelect:x2=!1,disableKeyboardA11y:gp=!1,autoPanOnConnect:y2,autoPanOnNodeDrag:v2,autoPanSpeed:b2,connectionRadius:w2,isValidConnection:S2,onError:N2,style:j2,id:mp,nodeDragThreshold:k2,connectionDragThreshold:E2,viewport:C2,onViewportChange:M2,width:_2,height:T2,colorMode:A2="light",debug:D2,onScroll:gr,ariaLabelConfig:z2,zIndexMode:xp="basic",...R2},O2){const iu=mp||"1",H2=R_(A2),$2=b.useCallback(yp=>{yp.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),gr==null||gr(yp)},[gr]);return o.jsx("div",{"data-testid":"rf__wrapper",...R2,onScroll:$2,style:{...j2,...eA},ref:O2,className:Ve(["react-flow",a,H2]),id:mp,role:"application",children:o.jsxs(PT,{nodes:e,edges:t,width:_2,height:T2,fitView:hp,fitViewOptions:pp,minZoom:Jt,maxZoom:st,nodeOrigin:Nt,nodeExtent:wa,zIndexMode:xp,children:[o.jsx(z_,{nodes:e,edges:t,defaultNodes:n,defaultEdges:l,onConnect:p,onConnectStart:x,onConnectEnd:S,onClickConnectStart:w,onClickConnectEnd:g,nodesDraggable:Z,autoPanOnNodeFocus:ve,nodesConnectable:xe,nodesFocusable:Se,edgesFocusable:Ht,edgesReconnectable:Wt,elementsSelectable:fn,elevateNodesOnSelect:m2,elevateEdgesOnSelect:x2,minZoom:Jt,maxZoom:st,nodeExtent:wa,onNodesChange:Yl,onEdgesChange:zs,snapToGrid:P,snapGrid:ne,connectionMode:X,translateExtent:An,connectOnClick:f2,defaultEdgeOptions:g2,fitView:hp,fitViewOptions:pp,onNodesDelete:H,onEdgesDelete:A,onDelete:$,onNodeDragStart:M,onNodeDrag:T,onNodeDragStop:C,onSelectionDrag:z,onSelectionDragStart:N,onSelectionDragStop:k,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:fp,nodeOrigin:Nt,rfId:iu,autoPanOnConnect:y2,autoPanOnNodeDrag:v2,autoPanSpeed:b2,onError:N2,connectionRadius:w2,isValidConnection:S2,selectNodesOnDrag:te,nodeDragThreshold:k2,connectionDragThreshold:E2,onBeforeDelete:q,debug:D2,ariaLabelConfig:z2,zIndexMode:xp}),o.jsx(WT,{onInit:u,onNodeClick:r,onEdgeClick:c,onNodeMouseEnter:y,onNodeMouseMove:m,onNodeMouseLeave:v,onNodeContextMenu:j,onNodeDoubleClick:E,nodeTypes:s,edgeTypes:i,connectionLineType:L,connectionLineStyle:Y,connectionLineComponent:_,connectionLineContainerStyle:U,selectionKeyCode:I,selectionOnDrag:B,selectionMode:K,deleteKeyCode:G,multiSelectionKeyCode:F,panActivationKeyCode:W,zoomActivationKeyCode:J,onlyRenderVisibleElements:ae,defaultViewport:ll,translateExtent:An,minZoom:Jt,maxZoom:st,preventScrolling:Bl,zoomOnScroll:fr,zoomOnPinch:eu,zoomOnDoubleClick:nu,panOnScroll:tu,panOnScrollSpeed:Ds,panOnScrollMode:hr,panOnDrag:pr,onPaneClick:lu,onPaneMouseEnter:au,onPaneMouseMove:su,onPaneMouseLeave:Ie,onPaneScroll:it,onPaneContextMenu:rt,paneClickDistance:pn,nodeClickDistance:ht,onSelectionContextMenu:R,onSelectionStart:D,onSelectionEnd:O,onReconnect:$t,onReconnectStart:al,onReconnectEnd:Xe,onEdgeContextMenu:gn,onEdgeDoubleClick:Lt,onEdgeMouseEnter:Ft,onEdgeMouseMove:Ul,onEdgeMouseLeave:ql,reconnectRadius:mn,defaultMarkerColor:hn,noDragClassName:u2,noWheelClassName:d2,noPanClassName:fp,rfId:iu,disableKeyboardA11y:gp,nodeExtent:wa,viewport:C2,onViewportChange:M2}),o.jsx(__,{onSelectionChange:V}),ot,o.jsx(j_,{proOptions:p2,position:h2}),o.jsx(N_,{rfId:iu,disableKeyboardA11y:gp})]})})}var nA=$b(tA);function lA(e){const[t,n]=b.useState(e),l=b.useCallback(a=>n(s=>Ob(a,s)),[]);return[t,n,l]}function aA(e){const[t,n]=b.useState(e),l=b.useCallback(a=>n(s=>Hb(a,s)),[]);return[t,n,l]}function sA({dimensions:e,lineWidth:t,variant:n,className:l}){return o.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Ve(["react-flow__background-pattern",n,l])})}function iA({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:Ve(["react-flow__background-pattern","dots",t])})}var In;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(In||(In={}));const rA={[In.Dots]:1,[In.Lines]:1,[In.Cross]:6},oA=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function r2({id:e,variant:t=In.Dots,gap:n=20,size:l,lineWidth:a=1,offset:s=0,color:i,bgColor:r,style:c,className:u,patternClassName:d}){const f=b.useRef(null),{transform:h,patternId:p}=fe(oA,ze),x=l||rA[t],S=t===In.Dots,w=t===In.Cross,g=Array.isArray(n)?n:[n,n],y=[g[0]*h[2]||1,g[1]*h[2]||1],m=x*h[2],v=Array.isArray(s)?s:[s,s],j=w?[m,m]:y,E=[v[0]*h[2]||1+j[0]/2,v[1]*h[2]||1+j[1]/2],M=`${p}${e||""}`;return o.jsxs("svg",{className:Ve(["react-flow__background",u]),style:{...c,...Fc,"--xy-background-color-props":r,"--xy-background-pattern-color-props":i},ref:f,"data-testid":"rf__background",children:[o.jsx("pattern",{id:M,x:h[0]%y[0],y:h[1]%y[1],width:y[0],height:y[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:S?o.jsx(iA,{radius:m/2,className:d}):o.jsx(sA,{dimensions:j,lineWidth:a,variant:t,className:d})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${M})`})]})}r2.displayName="Background";const cA=b.memo(r2);function uA(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:o.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function dA(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:o.jsx("path",{d:"M0 0h32v4.2H0z"})})}function fA(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:o.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function hA(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function pA(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Qr({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:Ve(["react-flow__controls-button",t]),...n,children:e})}const gA=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function o2({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:l=!0,fitViewOptions:a,onZoomIn:s,onZoomOut:i,onFitView:r,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const x=Re(),{isInteractive:S,minZoomReached:w,maxZoomReached:g,ariaLabelConfig:y}=fe(gA,ze),{zoomIn:m,zoomOut:v,fitView:j}=up(),E=()=>{m(),s==null||s()},M=()=>{v(),i==null||i()},T=()=>{j(a),r==null||r()},C=()=>{x.setState({nodesDraggable:!S,nodesConnectable:!S,elementsSelectable:!S}),c==null||c(!S)},H=h==="horizontal"?"horizontal":"vertical";return o.jsxs(Jc,{className:Ve(["react-flow__controls",H,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??y["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(Qr,{onClick:E,className:"react-flow__controls-zoomin",title:y["controls.zoomIn.ariaLabel"],"aria-label":y["controls.zoomIn.ariaLabel"],disabled:g,children:o.jsx(uA,{})}),o.jsx(Qr,{onClick:M,className:"react-flow__controls-zoomout",title:y["controls.zoomOut.ariaLabel"],"aria-label":y["controls.zoomOut.ariaLabel"],disabled:w,children:o.jsx(dA,{})})]}),n&&o.jsx(Qr,{className:"react-flow__controls-fitview",onClick:T,title:y["controls.fitView.ariaLabel"],"aria-label":y["controls.fitView.ariaLabel"],children:o.jsx(fA,{})}),l&&o.jsx(Qr,{className:"react-flow__controls-interactive",onClick:C,title:y["controls.interactive.ariaLabel"],"aria-label":y["controls.interactive.ariaLabel"],children:S?o.jsx(pA,{}):o.jsx(hA,{})}),d]})}o2.displayName="Controls";const mA=b.memo(o2);function xA({id:e,x:t,y:n,width:l,height:a,style:s,color:i,strokeColor:r,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:x,backgroundColor:S}=s||{},w=i||x||S;return o.jsx("rect",{className:Ve(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:l,height:a,style:{fill:w,stroke:r,strokeWidth:c},shapeRendering:f,onClick:p?g=>p(g,e):void 0})}const yA=b.memo(xA),vA=e=>e.nodes.map(t=>t.id),sd=e=>e instanceof Function?e:()=>e;function bA({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:l=5,nodeStrokeWidth:a,nodeComponent:s=yA,onClick:i}){const r=fe(vA,ze),c=sd(t),u=sd(e),d=sd(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:r.map(h=>o.jsx(SA,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:l,nodeStrokeWidth:a,NodeComponent:s,onClick:i,shapeRendering:f},h))})}function wA({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:l,nodeBorderRadius:a,nodeStrokeWidth:s,shapeRendering:i,NodeComponent:r,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=fe(x=>{const S=x.nodeLookup.get(e);if(!S)return{node:void 0,x:0,y:0,width:0,height:0};const w=S.internals.userNode,{x:g,y}=S.internals.positionAbsolute,{width:m,height:v}=nl(w);return{node:w,x:g,y,width:m,height:v}},ze);return!u||u.hidden||!sb(u)?null:o.jsx(r,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:l(u),color:t(u),borderRadius:a,strokeColor:n(u),strokeWidth:s,shapeRendering:i,onClick:c,id:u.id})}const SA=b.memo(wA);var NA=b.memo(bA);const jA=200,kA=150,EA=e=>!e.hidden,CA=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?ab(cr(e.nodeLookup,{filter:EA}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},MA="react-flow__minimap-desc";function c2({style:e,className:t,nodeStrokeColor:n,nodeColor:l,nodeClassName:a="",nodeBorderRadius:s=5,nodeStrokeWidth:i,nodeComponent:r,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:x,pannable:S=!1,zoomable:w=!1,ariaLabel:g,inversePan:y,zoomStep:m=1,offsetScale:v=5}){const j=Re(),E=b.useRef(null),{boundingRect:M,viewBB:T,rfId:C,panZoom:H,translateExtent:A,flowWidth:$,flowHeight:V,ariaLabelConfig:N}=fe(CA,ze),z=(e==null?void 0:e.width)??jA,k=(e==null?void 0:e.height)??kA,R=M.width/z,D=M.height/k,O=Math.max(R,D),q=O*z,X=O*k,L=v*O,Y=M.x-(q-M.width)/2-L,_=M.y-(X-M.height)/2-L,U=q+L*2,G=X+L*2,I=`${MA}-${C}`,B=b.useRef(0),K=b.useRef();B.current=O,b.useEffect(()=>{if(E.current&&H)return K.current=TM({domNode:E.current,panZoom:H,getTransform:()=>j.getState().transform,getViewScale:()=>B.current}),()=>{var P;(P=K.current)==null||P.destroy()}},[H]),b.useEffect(()=>{var P;(P=K.current)==null||P.update({translateExtent:A,width:$,height:V,inversePan:y,pannable:S,zoomStep:m,zoomable:w})},[S,w,y,m,A,$,V]);const W=p?P=>{var te;const[ne,ae]=((te=K.current)==null?void 0:te.pointer(P))||[0,0];p(P,{x:ne,y:ae})}:void 0,F=x?b.useCallback((P,ne)=>{const ae=j.getState().nodeLookup.get(ne).internals.userNode;x(P,ae)},[]):void 0,J=g??N["minimap.ariaLabel"];return o.jsx(Jc,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*O:void 0,"--xy-minimap-node-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof i=="number"?i:void 0},className:Ve(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:z,height:k,viewBox:`${Y} ${_} ${U} ${G}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":I,ref:E,onClick:W,children:[J&&o.jsx("title",{id:I,children:J}),o.jsx(NA,{onClick:F,nodeColor:l,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:a,nodeStrokeWidth:i,nodeComponent:r}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${Y-L},${_-L}h${U+L*2}v${G+L*2}h${-U-L*2}z
165
- M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}c2.displayName="MiniMap";const _A=b.memo(c2),TA=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,AA={[xs.Line]:"right",[xs.Handle]:"bottom-right"};function DA({nodeId:e,position:t,variant:n=xs.Handle,className:l,style:a=void 0,children:s,color:i,minWidth:r=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:p=!0,shouldResize:x,onResizeStart:S,onResize:w,onResizeEnd:g}){const y=qb(),m=typeof e=="string"?e:y,v=Re(),j=b.useRef(null),E=n===xs.Handle,M=fe(b.useCallback(TA(E&&p),[E,p]),ze),T=b.useRef(null),C=t??AA[n];b.useEffect(()=>{if(!(!j.current||!m))return T.current||(T.current=XM({domNode:j.current,nodeId:m,getStoreItems:()=>{const{nodeLookup:A,transform:$,snapGrid:V,snapToGrid:N,nodeOrigin:z,domNode:k}=v.getState();return{nodeLookup:A,transform:$,snapGrid:V,snapToGrid:N,nodeOrigin:z,paneDomNode:k}},onChange:(A,$)=>{const{triggerNodeChanges:V,nodeLookup:N,parentLookup:z,nodeOrigin:k}=v.getState(),R=[],D={x:A.x,y:A.y},O=N.get(m);if(O&&O.expandParent&&O.parentId){const q=O.origin??k,X=A.width??O.measured.width??0,L=A.height??O.measured.height??0,Y={id:O.id,parentId:O.parentId,rect:{width:X,height:L,...ib({x:A.x??O.position.x,y:A.y??O.position.y},{width:X,height:L},O.parentId,N,q)}},_=cp([Y],N,z,k);R.push(..._),D.x=A.x?Math.max(q[0]*X,A.x):void 0,D.y=A.y?Math.max(q[1]*L,A.y):void 0}if(D.x!==void 0&&D.y!==void 0){const q={id:m,type:"position",position:{...D}};R.push(q)}if(A.width!==void 0&&A.height!==void 0){const X={id:m,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:A.width,height:A.height}};R.push(X)}for(const q of $){const X={...q,type:"position"};R.push(X)}V(R)},onEnd:({width:A,height:$})=>{const V={id:m,type:"dimensions",resizing:!1,dimensions:{width:A,height:$}};v.getState().triggerNodeChanges([V])}})),T.current.update({controlPosition:C,boundaries:{minWidth:r,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:S,onResize:w,onResizeEnd:g,shouldResize:x}),()=>{var A;(A=T.current)==null||A.destroy()}},[C,r,c,u,d,f,S,w,g,x]);const H=C.split("-");return o.jsx("div",{className:Ve(["react-flow__resize-control","nodrag",...H,n,l]),ref:j,style:{...a,scale:M,...i&&{[E?"backgroundColor":"borderColor"]:i}},children:s})}b.memo(DA);const vn={concepts:{fill:"#f75858",light:"#ff9090",dark:"#be3232",glowRgb:"254,0,0",edgeColor:"rgba(254,0,0,0.55)",hex:"#f75858"},entities:{fill:"#5e89e0",light:"#8cb4ff",dark:"#3658b4",glowRgb:"16,96,255",edgeColor:"rgba(16,96,255,0.55)",hex:"#5e89e0"},summaries:{fill:"#bd68bd",light:"#dc8cdc",dark:"#460f46",glowRgb:"171,49,170",edgeColor:"rgba(171,49,170,0.55)",hex:"#bd68bd"},other:{fill:"#24b550",light:"#82e6a0",dark:"#0c5023",glowRgb:"36,181,80",edgeColor:"rgba(36,181,80,0.55)",hex:"#24b550"}};function id(e){return vn[e.toLowerCase()]??vn.other}function zA(e,t,n=150){const l=e.length,a=new Map,s=new Map,i=Math.min(600,Math.max(150,l*40));e.forEach((c,u)=>{const d=u/l*2*Math.PI;a.set(c.slug,{x:400+i*Math.cos(d),y:400+i*Math.sin(d)}),s.set(c.slug,{vx:0,vy:0})});const r=e.map(c=>c.slug);for(let c=0;c<n;c++){for(let u=0;u<r.length;u++)for(let d=u+1;d<r.length;d++){const f=r[u],h=r[d],p=a.get(f),x=a.get(h),S=x.x-p.x,w=x.y-p.y,g=Math.max(1,S*S+w*w),y=Math.sqrt(g),m=18e3/g,v=S/y*m,j=w/y*m,E=s.get(f),M=s.get(h);E.vx-=v,E.vy-=j,M.vx+=v,M.vy+=j}for(const u of t){const d=a.get(u.source),f=a.get(u.target);if(!d||!f)continue;const h=f.x-d.x,p=f.y-d.y,x=Math.max(1,Math.sqrt(h*h+p*p)),S=x*.02,w=h/x*S,g=p/x*S,y=s.get(u.source),m=s.get(u.target);y&&(y.vx+=w,y.vy+=g),m&&(m.vx-=w,m.vy-=g)}for(const u of r){const d=a.get(u),f=s.get(u);f.vx=Math.max(-20,Math.min(20,f.vx)),f.vy=Math.max(-20,Math.min(20,f.vy)),d.x+=f.vx,d.y+=f.vy,f.vx*=.85,f.vy*=.85}}return a}const RA=5,OA=9;function HA(e){const t=e.data,n=t.radius,l=t.degree,a=t.dimmed,s=t.hovered,i=t.glowRgb,r=t.fill,c=l>=RA,u=l>=OA,d=a?"none":s?`0 0 0 1.5px rgba(${i},0.8), 0 0 10px rgba(${i},1), 0 0 24px rgba(${i},0.7), 0 0 44px rgba(${i},0.3), 0 0 70px rgba(${i},0.12)`:`0 0 0 1px rgba(${i},0.35), 0 0 7px rgba(${i},0.65), 0 0 18px rgba(${i},0.25)`,f=s?"scale(1.28)":"scale(1)";return o.jsxs("div",{style:{position:"relative",width:n*2,height:n*2},children:[c&&!a&&o.jsx("div",{style:{position:"absolute",inset:-(n*.55),borderRadius:"50%",background:`radial-gradient(circle, rgba(${i},0.08) 0%, transparent 70%)`,pointerEvents:"none"}}),c&&!a&&o.jsx("div",{style:{position:"absolute",inset:-(n*.45),borderRadius:"50%",border:`1.5px solid rgba(${i},0.5)`,animation:"wikiNodePulse 2.6s cubic-bezier(0.4,0,0.6,1) infinite",pointerEvents:"none"}}),u&&!a&&o.jsx("div",{style:{position:"absolute",inset:-(n*.8),borderRadius:"50%",border:`1px solid rgba(${i},0.28)`,animation:"wikiNodePulse 3.8s cubic-bezier(0.4,0,0.6,1) infinite 1.1s",pointerEvents:"none"}}),o.jsxs("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:`radial-gradient(circle at 33% 28%, ${t.light} 0%, ${r} 52%, ${t.dark} 100%)`,boxShadow:d,opacity:a?.06:1,transform:f,transition:"transform 0.22s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s ease, opacity 0.18s ease",overflow:"hidden"},children:[o.jsx("div",{style:{position:"absolute",top:"9%",left:"14%",width:"38%",height:"38%",borderRadius:"50%",background:"radial-gradient(circle, rgba(255,255,255,0.62) 0%, rgba(255,255,255,0.1) 55%, transparent 100%)",pointerEvents:"none"}}),o.jsx("div",{style:{position:"absolute",bottom:"10%",right:"12%",width:"22%",height:"22%",borderRadius:"50%",background:"radial-gradient(circle, rgba(255,255,255,0.18) 0%, transparent 100%)",pointerEvents:"none"}})]}),!a&&o.jsx("div",{style:{position:"absolute",top:n*2+5,left:"50%",transform:"translateX(-50%)",whiteSpace:"nowrap",maxWidth:128,overflow:"hidden",textOverflow:"ellipsis",fontSize:s?10:9,fontWeight:s?600:400,color:s?r:"var(--text2)",background:"color-mix(in srgb, var(--bg) 78%, transparent)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",padding:"1px 6px 2px",borderRadius:5,border:s?`1px solid rgba(${i},0.4)`:"1px solid transparent",boxShadow:s?`0 0 8px rgba(${i},0.3)`:"none",transition:"all 0.2s ease",fontFamily:"inherit",letterSpacing:s?"0.025em":"normal",pointerEvents:"none"},children:t.title}),o.jsx(vs,{type:"target",position:ee.Left,style:{opacity:0,pointerEvents:"none"}}),o.jsx(vs,{type:"source",position:ee.Right,style:{opacity:0,pointerEvents:"none"}})]})}const $A={wikiNode:HA},LA=[{label:"Concepts",color:vn.concepts.fill,rgb:vn.concepts.glowRgb},{label:"Entities",color:vn.entities.fill,rgb:vn.entities.glowRgb},{label:"Summaries",color:vn.summaries.fill,rgb:vn.summaries.glowRgb},{label:"Other",color:vn.other.fill,rgb:vn.other.glowRgb}];function BA({graphData:e,loading:t,onNodeClick:n}){const{initNodes:l,initEdges:a,adjacency:s}=b.useMemo(()=>{var M,T;const S=(e==null?void 0:e.nodes)??[],w=(e==null?void 0:e.edges)??[];if(S.length===0)return{initNodes:[],initEdges:[],adjacency:new Map};const g=new Map,y=new Map;for(const C of S)g.set(C.slug,0),y.set(C.slug,C.category);for(const C of w)g.set(C.source,(g.get(C.source)??0)+1),g.set(C.target,(g.get(C.target)??0)+1);const m=new Map;for(const C of S)m.set(C.slug,new Set);for(const C of w)(M=m.get(C.source))==null||M.add(C.target),(T=m.get(C.target))==null||T.add(C.source);const v=zA(S,w,150),j=S.map(C=>{const H=g.get(C.slug)??0,A=Math.min(11,Math.max(4,4+H*.8)),$=v.get(C.slug)??{x:400,y:400},V=id(C.category);return{id:C.slug,type:"wikiNode",position:$,data:{slug:C.slug,title:C.title||(C.slug.split("/").pop()??C.slug),category:C.category,fill:V.fill,light:V.light,dark:V.dark,glowRgb:V.glowRgb,radius:A,degree:H,dimmed:!1,hovered:!1}}}),E=w.map((C,H)=>{const A=id(y.get(C.source)??"other");return{id:`e${H}-${C.source}-${C.target}`,source:C.source,target:C.target,type:"straight",animated:!0,style:{stroke:A.edgeColor,strokeWidth:1.3,opacity:.85}}});return{initNodes:j,initEdges:E,adjacency:m}},[e]),[i,r,c]=lA(l),[u,d,f]=aA(a);b.useEffect(()=>{r(l),d(a)},[l,a,r,d]);const h=b.useCallback((S,w)=>{n(w.id)},[n]),p=b.useCallback((S,w)=>{const g=w.id,y=new Set([g,...s.get(g)??[]]);r(m=>m.map(v=>({...v,data:{...v.data,dimmed:!y.has(v.id),hovered:v.id===g}}))),d(m=>m.map(v=>({...v,style:{...v.style??{},opacity:y.has(v.source)&&y.has(v.target)?1:.05}})))},[s,r,d]),x=b.useCallback(()=>{r(S=>S.map(w=>({...w,data:{...w.data,dimmed:!1,hovered:!1}}))),d(S=>S.map(w=>({...w,style:{...w.style??{},opacity:.85}})))},[r,d]);return t?o.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",style:{color:"var(--muted)"},children:[o.jsx("div",{style:{width:36,height:36,border:"2.5px solid var(--b2)",borderTopColor:"var(--gold)",borderRadius:"50%",animation:"wikiSpin 0.75s linear infinite",boxShadow:"0 0 12px rgba(224,175,104,0.35)"}}),o.jsx("span",{className:"text-[11px]",children:"Building knowledge graph…"})]}):!e||e.nodes.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-center",children:[o.jsx("div",{style:{width:56,height:56,borderRadius:"50%",background:"radial-gradient(circle at 35% 30%, var(--s3), var(--s1))",border:"1px solid var(--b1)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 0 24px rgba(224,175,104,0.08)"},children:o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",style:{color:"var(--gold)",opacity:.5},children:[o.jsx("circle",{cx:"12",cy:"12",r:"2.5"}),o.jsx("circle",{cx:"4.5",cy:"4.5",r:"1.5"}),o.jsx("circle",{cx:"19.5",cy:"4.5",r:"1.5"}),o.jsx("circle",{cx:"4.5",cy:"19.5",r:"1.5"}),o.jsx("circle",{cx:"19.5",cy:"19.5",r:"1.5"}),o.jsx("line",{x1:"12",y1:"9.5",x2:"5.5",y2:"5.5"}),o.jsx("line",{x1:"12",y1:"9.5",x2:"18.5",y2:"5.5"}),o.jsx("line",{x1:"12",y1:"14.5",x2:"5.5",y2:"18.5"}),o.jsx("line",{x1:"12",y1:"14.5",x2:"18.5",y2:"18.5"})]})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--fg)"},children:"Graph is empty"}),o.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--muted)"},children:"Ingest documents to build the knowledge graph"})]}),o.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)",letterSpacing:"0.02em"},children:"ingest plans/spec.md into the wiki"})]}):o.jsxs("div",{style:{width:"100%",height:"100%",position:"relative",background:"var(--bg)"},children:[o.jsxs(nA,{nodes:i,edges:u,onNodesChange:c,onEdgesChange:f,nodeTypes:$A,onNodeClick:h,onNodeMouseEnter:p,onNodeMouseLeave:x,fitView:!0,fitViewOptions:{padding:.2},colorMode:"dark",proOptions:{hideAttribution:!0},style:{background:"var(--bg)"},nodesDraggable:!0,nodesConnectable:!1,elementsSelectable:!1,children:[o.jsx(cA,{variant:In.Dots,gap:26,size:1.2,color:"var(--b1)"}),o.jsx(mA,{}),o.jsx(_A,{nodeColor:S=>id(S.data.category).hex,maskColor:"color-mix(in srgb, var(--s1) 75%, transparent)",style:{background:"color-mix(in srgb, var(--s2) 90%, transparent)",backdropFilter:"blur(8px)",border:"1px solid color-mix(in srgb, var(--b2) 50%, transparent)",borderRadius:10,boxShadow:"0 4px 20px rgba(0,0,0,0.35)"}})]}),o.jsx("div",{style:{position:"absolute",inset:0,background:["radial-gradient(ellipse 75% 75% at 50% 50%, transparent 25%, color-mix(in srgb, var(--s1) 65%, transparent) 100%)","radial-gradient(circle at 25% 80%, rgba(224,175,104,0.03) 0%, transparent 50%)"].join(", "),pointerEvents:"none",zIndex:3}}),o.jsx("div",{style:{position:"absolute",bottom:14,left:14,zIndex:10,display:"flex",flexDirection:"column",gap:6,background:"color-mix(in srgb, var(--s2) 88%, transparent)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",border:"1px solid color-mix(in srgb, var(--b2) 45%, transparent)",borderRadius:11,padding:"9px 13px",pointerEvents:"none",boxShadow:"0 4px 24px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04)"},children:LA.map(({label:S,color:w,rgb:g})=>o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[o.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:w,boxShadow:`0 0 6px rgba(${g},0.7)`,flexShrink:0}}),o.jsx("span",{style:{fontSize:10,color:"var(--text2)",fontFamily:"inherit",letterSpacing:"0.02em"},children:S})]},S))}),o.jsxs("div",{style:{position:"absolute",top:12,left:"50%",transform:"translateX(-50%)",zIndex:10,display:"flex",alignItems:"center",gap:8,background:"color-mix(in srgb, var(--s2) 88%, transparent)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",border:"1px solid color-mix(in srgb, var(--b2) 40%, transparent)",borderRadius:20,padding:"3px 12px",pointerEvents:"none",boxShadow:"0 2px 12px rgba(0,0,0,0.25)"},children:[o.jsxs("span",{style:{fontSize:10,color:"var(--text2)",fontFamily:"inherit",letterSpacing:"0.04em"},children:[o.jsx("span",{style:{color:"var(--gold)",fontWeight:600},children:e.nodes.length})," ","nodes"]}),o.jsx("div",{style:{width:1,height:10,background:"var(--b2)"}}),o.jsxs("span",{style:{fontSize:10,color:"var(--text2)",fontFamily:"inherit",letterSpacing:"0.04em"},children:[o.jsx("span",{style:{color:"var(--gold)",fontWeight:600},children:e.edges.length})," ","connections"]})]})]})}function UA({rpc:e,className:t}){const{ws:n}=_n(),[l,a]=b.useState([]),[s,i]=b.useState(!0),[r,c]=b.useState("browse"),u=b.useRef("browse");u.current=r;const[d,f]=b.useState(null),[h,p]=b.useState(null),[x,S]=b.useState(!1),[w,g]=b.useState(""),[y,m]=b.useState([]),[v,j]=b.useState(!1),[E,M]=b.useState(null),[T,C]=b.useState(!1),[H,A]=b.useState(null),[$,V]=b.useState(null),[N,z]=b.useState(!1),k=b.useCallback(async(Y=!1)=>{if(e){Y||z(!0);try{const _=await e.wikiGraph();V(_??{nodes:[],edges:[]})}catch{V({nodes:[],edges:[]})}finally{Y||z(!1)}}},[e]),R=b.useCallback(async(Y=!1)=>{if(e){Y||i(!0),A(null);try{const _=await e.wikiListPages();a((_==null?void 0:_.pages)??[])}catch(_){A(_ instanceof Error?_.message:"Failed to load wiki")}finally{Y||i(!1)}}},[e]);b.useEffect(()=>{R()},[R]),b.useEffect(()=>{if(n)return n.on("wiki-op",()=>{R(!0),u.current==="graph"&&k(!0)})},[n,R,k]);const D=b.useCallback(async Y=>{if(e){f(Y),c("page"),S(!0),p(null);try{const _=await e.wikiPageGet(Y);p((_==null?void 0:_.content)??(_==null?void 0:_.error)??"Empty page")}catch(_){p(_ instanceof Error?_.message:"Error loading page")}finally{S(!1)}}},[e]),O=b.useCallback(async()=>{if(!(!e||!w.trim())){j(!0),m([]);try{const Y=await e.wikiSearch(w);m(Y??[])}finally{j(!1)}}},[e,w]),q=b.useCallback(async()=>{if(e){c("lint"),C(!0),M(null);try{const Y=await e.wikiLint();M(Y??{orphanPages:[],brokenLinks:[],missingFromIndex:[],staleFrontmatter:[]})}finally{C(!1)}}},[e]),X=l.reduce((Y,_)=>{const U=_.category||"Other";return(Y[U]??(Y[U]=[])).push(_),Y},{}),L=E?E.orphanPages.length+E.brokenLinks.length+E.missingFromIndex.length+E.staleFrontmatter.length:null;return o.jsxs("div",{className:`flex flex-col h-full ${t??""}`,children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--b1)"},children:[o.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:[o.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),o.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"})]}),o.jsx("span",{className:"text-[13px] font-semibold font-display",style:{color:"var(--cream)"},children:"Wiki"}),o.jsxs("span",{className:"text-[11px] font-mono",style:{color:"var(--muted)"},children:[l.length," pages"]}),o.jsx("div",{className:"flex-1"}),o.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:r==="browse"?"var(--s3)":"transparent",color:r==="browse"?"var(--gold)":"var(--muted)",border:r==="browse"?"1px solid var(--b2)":"1px solid transparent"},children:"Browse"}),o.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:r==="search"?"var(--s3)":"transparent",color:r==="search"?"var(--gold)":"var(--muted)",border:r==="search"?"1px solid var(--b2)":"1px solid transparent"},children:"Search"}),o.jsxs("button",{onClick:q,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:r==="lint"?"var(--s3)":"transparent",color:r==="lint"?"var(--gold)":"var(--muted)",border:r==="lint"?"1px solid var(--b2)":"1px solid transparent"},children:["Lint",L!==null&&L>0&&o.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:L})]}),o.jsx("button",{onClick:()=>{c("graph"),!$&&!N&&k()},className:"px-2.5 py-1 rounded-lg text-[11px] font-semibold transition-all duration-150 cursor-pointer",style:{background:r==="graph"?"var(--s3)":"transparent",color:r==="graph"?"var(--gold)":"var(--muted)",border:r==="graph"?"1px solid var(--b2)":"1px solid transparent"},children:"Graph"}),o.jsx("button",{onClick:()=>R(),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:o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("polyline",{points:"23 4 23 10 17 10"}),o.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})})]}),r==="graph"&&o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(BA,{graphData:$,loading:N,onNodeClick:D})}),o.jsxs("div",{className:`flex-1 min-h-0 overflow-y-auto px-4 py-3 scrollbar-thin${r==="graph"?" hidden":""}`,children:[r==="browse"&&o.jsxs(o.Fragment,{children:[s&&o.jsx("div",{className:"flex items-center justify-center h-32 text-xs",style:{color:"var(--muted)"},children:"Loading…"}),H&&o.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:H}),!s&&!H&&l.length===0&&o.jsxs("div",{className:"flex flex-col items-center justify-center h-48 gap-3 text-center",children:[o.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",style:{color:"var(--muted)",opacity:.4},children:[o.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),o.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"})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-[12px] font-semibold",style:{color:"var(--fg)"},children:"Wiki is empty"}),o.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--muted)"},children:"Ask the agent to ingest a document to get started"})]}),o.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(X).map(([Y,_])=>o.jsxs("div",{className:"mb-4",children:[o.jsx("div",{className:"text-[10px] font-mono uppercase tracking-widest mb-1.5 px-1",style:{color:"var(--muted)"},children:Y}),o.jsx("div",{className:"space-y-1",children:_.map(U=>o.jsxs("button",{onClick:()=>D(U.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:[o.jsx("div",{className:"text-[12px] font-medium truncate",children:U.title||U.slug.split("/").pop()}),o.jsx("div",{className:"text-[10px] font-mono mt-0.5 truncate",style:{color:"var(--muted)"},children:U.slug})]},U.slug))})]},Y))]}),r==="page"&&o.jsxs("div",{children:[o.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:[o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:o.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to index"]}),x&&o.jsx("div",{className:"flex items-center justify-center h-32 text-xs",style:{color:"var(--muted)"},children:"Loading…"}),!x&&h!==null&&o.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})]}),r==="search"&&o.jsxs("div",{children:[o.jsxs("div",{className:"flex gap-2 mb-3",children:[o.jsx("input",{type:"text",value:w,onChange:Y=>g(Y.target.value),onKeyDown:Y=>Y.key==="Enter"&&O(),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}),o.jsx("button",{onClick:O,disabled:v||!w.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:v||!w.trim()?.5:1},children:v?"…":"Search"})]}),y.length===0&&!v&&w&&o.jsxs("div",{className:"text-center py-8 text-xs",style:{color:"var(--muted)"},children:['No results for "',w,'"']}),y.length>0&&o.jsx("div",{className:"space-y-1",children:y.map((Y,_)=>o.jsxs("button",{onClick:()=>D(Y.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:[o.jsxs("div",{className:"text-[11px] font-mono",style:{color:"var(--gold)"},children:[Y.slug,":",Y.lineNumber]}),o.jsx("div",{className:"text-[11px] mt-0.5 truncate font-mono",style:{color:"var(--fg)"},children:Y.line.trim()})]},_))})]}),r==="lint"&&o.jsxs("div",{children:[T&&o.jsx("div",{className:"flex items-center justify-center h-32 text-xs",style:{color:"var(--muted)"},children:"Running lint…"}),!T&&E&&o.jsxs("div",{className:"space-y-4",children:[L===0&&o.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:[o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:o.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Wiki looks clean — no issues found"]}),o.jsx(Zr,{title:"Orphan pages",items:E.orphanPages,color:"var(--yellow)",note:"Written but not linked from any other page"}),o.jsx(Zr,{title:"Broken links",items:E.brokenLinks.map(Y=>`${Y.from} → [[${Y.to}]]`),color:"var(--red)",note:"[[wikilinks]] that reference missing pages"}),o.jsx(Zr,{title:"Missing from index",items:E.missingFromIndex,color:"var(--yellow)",note:"Pages not listed in index.md"}),o.jsx(Zr,{title:"Stale frontmatter",items:E.staleFrontmatter,color:"var(--muted)",note:"updated: field older than 30 days"})]})]})]})]})}function Zr({title:e,items:t,color:n,note:l}){return t.length===0?null:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[o.jsx("span",{className:"text-[11px] font-semibold",style:{color:n},children:e}),o.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})]}),o.jsx("div",{className:"text-[10px] mb-2",style:{color:"var(--muted)"},children:l}),o.jsx("div",{className:"space-y-1",children:t.map((a,s)=>o.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:a},s))})]})}const Mx=[["/status","Show version, model, provider, tokens, CWD"],["/help","List all available commands"],["/model [name]","Switch model · opus / sonnet / haiku / gpt4o"],["/mode <mode>","Set approval mode · plan|edit|auto|yolo"],["/theme [name]","Change color theme"],["/debug [on|off]","Toggle debug logging"],["/effort [level]","Set reasoning effort · low|medium|high|max"],["/context","Show context window usage grid"],["/context compact","Compact the context window"],["/context auto","Configure auto-compaction"],["/memory status","View memory file sizes"],["/memory add","Capture a memory"],["/wiki","Open the wiki knowledge base"],["/wiki list","List all wiki pages by category"],["/wiki search <query>","Search wiki pages"],["/wiki lint","Run wiki health check"],["/heartbeat now","Trigger heartbeat immediately"],["/heartbeat enable","Enable heartbeat schedule"],["/remind <msg at time>","Create a reminder"],["/cron list","List all reminders"],["/channels list","Show Telegram channels"],["/mcp list","Show MCP servers"],["/mcp add","Add an MCP server"],["/tools [n]","View/set tool call limit per turn"],["/websearch [n]","Set web search limit per turn"],["/snapshots","List git snapshots"],["/revert","Revert to a snapshot"],["/stats","View usage stats"],["/agent <prompt>","Spawn a subagent"],["/task create","Create a scheduled task"],["/provider <name>","Switch AI provider"],["/init","Run interactive setup wizard"],["/exit","Exit curie-agent"]];function qA({open:e,onClose:t,onPick:n}){const[l,a]=b.useState(""),[s,i]=b.useState(0),r=b.useRef(null),c=l?Mx.filter(([f,h])=>f.includes(l.toLowerCase())||h.toLowerCase().includes(l.toLowerCase())):Mx,u=b.useCallback(f=>{t(),n(f)},[t,n]);b.useEffect(()=>{e&&(a(""),i(0),setTimeout(()=>{var f;return(f=r.current)==null?void 0:f.focus()},50))},[e]);const d=b.useCallback(f=>{if(f.key==="Escape"){t();return}f.key==="ArrowDown"&&(i(h=>Math.min(h+1,c.length-1)),f.preventDefault()),f.key==="ArrowUp"&&(i(h=>Math.max(h-1,0)),f.preventDefault()),f.key==="Enter"&&c[s]&&u(c[s][0])},[c,s,t,u]);return e?o.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:o.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:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-3",style:{borderBottom:"1px solid var(--b1)"},children:[o.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:[o.jsx("circle",{cx:"11",cy:"11",r:"8"}),o.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),o.jsx("input",{ref:r,className:"flex-1 bg-transparent border-0 outline-none font-sans text-sm",style:{color:"var(--cream)"},placeholder:"Search commands...",value:l,onChange:f=>{a(f.target.value),i(0)},onKeyDown:d})]}),o.jsx("div",{className:"gold-divider"}),o.jsxs("div",{className:"max-h-[340px] overflow-y-auto py-1 scrollbar-thin",children:[c.map(([f,h],p)=>o.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:[o.jsx("span",{className:"font-mono text-[12.5px] min-w-[190px]",style:{color:p===s?"var(--gold)":"var(--text)"},children:f}),o.jsx("span",{className:"text-xs text-muted truncate",children:h})]},f)),c.length===0&&o.jsx("div",{className:"px-3 py-6 text-center text-muted text-sm",children:"No commands found"})]})]})}):null}const ka={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 YA({rpc:e,onComplete:t,className:n}){const[l,a]=b.useState("provider"),[s,i]=b.useState(null),[r,c]=b.useState(""),[u,d]=b.useState(""),[f,h]=b.useState(""),[p,x]=b.useState(""),[S,w]=b.useState(""),[g,y]=b.useState(""),[m,v]=b.useState(""),[j,E]=b.useState(!1),[M,T]=b.useState(null),C=b.useCallback(()=>{switch(T(null),l){case"provider":{if(!s)return;const N=ka[s];d(N.defaultModel),a(N.requiresKey?"api_key":"model");break}case"api_key":a("model");break;case"model":a("soul_name");break;case"soul_name":if(!f.trim())return;a("soul_vibe");break;case"soul_vibe":a("user_name");break;case"user_name":if(!S.trim())return;a("user_tz");break;case"user_tz":a("user_lang");break;case"user_lang":a("agents");break;case"agents":a("memory");break;case"memory":a("tools");break;case"tools":a("confirm");break}},[l,s,f,S]),H=b.useCallback(async()=>{if(!(!e||!s)){E(!0),T(null);try{await e.identitySetup({provider:s,apiKey:r,model:u,soulName:f.trim()||"Curie",soulVibe:p.trim()||"AI coding assistant — sharp, resourceful, gets things done",userName:S.trim()||"User",userTimezone:g.trim()||"UTC",userLanguages:m.trim()||"TypeScript, Python"}),t()}catch(N){T(N instanceof Error?N.message:"Setup failed")}finally{E(!1)}}},[e,s,r,u,f,p,S,g,m,t]),A=()=>{switch(l){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"}},$=()=>(["provider","api_key","model","soul_name","soul_vibe","user_name","user_tz","user_lang","agents","memory","tools","confirm"].indexOf(l)+1)/12,V=()=>{switch(l){case"provider":return o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-xs text-muted mb-4",children:"Which LLM provider do you want to use for your AI assistant?"}),o.jsx("div",{className:"grid grid-cols-1 gap-2",children:Object.entries(ka).map(([N,z])=>o.jsxs("button",{type:"button",onClick:()=>i(N),className:`flex items-center gap-3 px-4 py-3 rounded-xl border text-left transition-all duration-100 ${s===N?"border-blue-500 bg-blue-500/10 text-text":"border-b2 bg-s2 text-text hover:border-b3 hover:bg-s2/80"}`,children:[o.jsx("div",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${s===N?"border-blue-500":"border-b3"}`,children:s===N&&o.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs font-medium text-text",children:z.label}),o.jsxs("div",{className:"text-[10.5px] text-muted",children:["Model: ",z.defaultModel]})]})]},N))})]});case"api_key":{const N=ka[s];return o.jsxs("div",{className:"space-y-3",children:[o.jsxs("p",{className:"text-xs text-muted",children:["Enter your ",N.label," API key:"]}),o.jsx("input",{type:"password",value:r,onChange:z=>c(z.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}),o.jsx("p",{className:"text-[10px] text-muted",children:"Saved to ~/.curie-settings.json"})]})}case"model":{const N=ka[s];return o.jsxs("div",{className:"space-y-3",children:[o.jsxs("p",{className:"text-xs text-muted",children:["Suggested model: ",o.jsx("code",{className:"text-text font-mono",children:N.defaultModel})]}),o.jsx("input",{type:"text",value:u,onChange:z=>d(z.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 o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-xs text-muted",children:"What should your AI assistant's name be?"}),o.jsx("input",{type:"text",value:f,onChange:N=>h(N.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 o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-xs text-muted",children:"Describe your assistant's vibe/personality (1 sentence)."}),o.jsx("input",{type:"text",value:p,onChange:N=>x(N.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 o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-xs text-muted",children:"What is your name?"}),o.jsx("input",{type:"text",value:S,onChange:N=>w(N.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 o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-xs text-muted",children:"Your timezone?"}),o.jsx("input",{type:"text",value:g,onChange:N=>y(N.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 o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-xs text-muted",children:"Your primary programming languages?"}),o.jsx("input",{type:"text",value:m,onChange:N=>v(N.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 o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-xs text-muted",children:"Next: I'll create your workspace configuration files."}),o.jsxs("div",{className:"p-3 bg-s2 border border-b1 rounded-xl text-[10.5px] text-text leading-relaxed",children:[o.jsx("p",{className:"font-medium mb-1",children:"AGENTS.md will include:"}),o.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-muted",children:[o.jsx("li",{children:"Session startup instructions"}),o.jsx("li",{children:"Memory system (daily notes + long-term)"}),o.jsx("li",{children:"Coding agent capabilities"}),o.jsx("li",{children:"Red lines and safety boundaries"}),o.jsx("li",{children:"Heartbeat configuration"})]})]})]});case"memory":return o.jsx("div",{className:"space-y-3",children:o.jsx("div",{className:"p-3 bg-s2 border border-b1 rounded-xl text-xs text-text leading-relaxed",children:o.jsx("p",{children:"Auto-creating MEMORY.md with initialization entry..."})})});case"tools":return o.jsx("div",{className:"space-y-3",children:o.jsx("div",{className:"p-3 bg-s2 border border-b1 rounded-xl text-xs text-text leading-relaxed",children:o.jsx("p",{children:"Auto-creating TOOLS.md and HEARTBEAT.md..."})})});case"confirm":return o.jsxs("div",{className:"space-y-4",children:[o.jsx("p",{className:"text-xs text-muted",children:"Review your configuration before creating files:"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(cl,{label:"Provider",value:ka[s].label}),o.jsx(cl,{label:"Model",value:u}),o.jsx(cl,{label:"API Key",value:r?"[set]":"(not set)"}),o.jsx(cl,{label:"Assistant Name",value:f.trim()||"Curie"}),o.jsx(cl,{label:"Vibe",value:p.trim()||"AI coding assistant"}),o.jsx(cl,{label:"Your Name",value:S.trim()||"User"}),o.jsx(cl,{label:"Timezone",value:g.trim()||"UTC"}),o.jsx(cl,{label:"Languages",value:m.trim()||"TypeScript, Python"})]}),o.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:",o.jsxs("ul",{className:"list-disc list-inside mt-1",children:[o.jsx("li",{children:"~/.curie-agent/SOUL.md"}),o.jsx("li",{children:"~/.curie-agent/USER.md"}),o.jsx("li",{children:"~/.curie-agent/AGENTS.md"}),o.jsx("li",{children:"~/.curie-agent/MEMORY.md"}),o.jsx("li",{children:"~/.curie-agent/TOOLS.md"}),o.jsx("li",{children:"~/.curie-agent/HEARTBEAT.md"})]})]})]})}};return o.jsx("div",{className:`flex-1 overflow-y-auto p-7 scrollbar-thin flex flex-col ${n||""}`,children:o.jsxs("div",{className:"max-w-lg mx-auto w-full",children:[o.jsxs("div",{className:"mb-6",children:[o.jsx("h2",{className:"text-base font-semibold text-fg tracking-tight mb-1",children:"Setup Wizard"}),o.jsx("p",{className:"text-[11px] text-muted",children:"Configure your AI assistant — takes about 2 minutes"})]}),o.jsx("div",{className:"mb-5",children:o.jsx("div",{className:"h-1 bg-b2 rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full bg-blue-500 rounded-full transition-all duration-300",style:{width:`${$()*100}%`}})})}),o.jsx("h3",{className:"text-sm font-medium text-text mb-4",children:A()}),o.jsx("div",{className:"mb-6",children:V()}),M&&o.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:[o.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:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),o.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),o.jsx("span",{children:M})]}),o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l!=="provider"&&l!=="confirm"?o.jsxs("button",{type:"button",onClick:()=>{switch(T(null),l){case"api_key":a("provider");break;case"model":a(ka[s].requiresKey?"api_key":"provider");break;case"soul_name":a("provider");break;case"soul_vibe":a("soul_name");break;case"user_name":a("soul_vibe");break;case"user_tz":a("user_name");break;case"user_lang":a("user_tz");break;case"agents":a("user_lang");break;case"memory":a("agents");break;case"tools":a("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:[o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:o.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back"]}):o.jsx("div",{}),l==="confirm"?o.jsx("button",{type:"button",onClick:H,disabled:j,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:j?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"animate-spin h-3.5 w-3.5 text-white",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.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"}):o.jsxs("button",{type:"button",onClick:C,disabled:l==="provider"&&!s||l==="soul_name"&&!f.trim()||l==="user_name"&&!S.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",o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[o.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),o.jsx("polyline",{points:"12 5 19 12 12 19"})]})]})]})]})})}function cl({label:e,value:t}){return o.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-b1/50",children:[o.jsx("span",{className:"text-[10.5px] text-muted",children:e}),o.jsx("span",{className:"text-[10.5px] text-text font-mono",children:t})]})}function VA({onReload:e}){const[t,n]=b.useState(!1);b.useEffect(()=>{const a=()=>n(!0),s=()=>{n(!1),e==null||e()};return window.addEventListener("pwa-update-available",a),window.addEventListener("pwa-controller-updated",s),()=>{window.removeEventListener("pwa-update-available",a),window.removeEventListener("pwa-controller-updated",s)}},[e]);const l=()=>{n(!1),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(a=>{a.waiting&&a.waiting.postMessage("SKIP_WAITING")}),window._pendingUpdateWorker&&window._pendingUpdateWorker.postMessage("SKIP_WAITING")};return t?o.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:[o.jsxs("svg",{className:"animate-bounce shrink-0",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[o.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),o.jsx("polyline",{points:"17 8 12 3 7 8"}),o.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),"Update available",o.jsx("button",{onClick:l,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 XA="0.2.4";function GA({intervalMs:e=3*60*1e3,onNewVersion:t}){const[n,l]=b.useState(!1);return b.useEffect(()=>{async function a(){var i;try{const c=await(await fetch("/health?token="+encodeURIComponent(((i=document.cookie.match(/curie_token=([^;]*)/))==null?void 0:i[1])??""),{cache:"no-store"})).json();c.version&&c.version!==XA&&!n&&(l(!0),t==null||t(c.version),window.dispatchEvent(new CustomEvent("pwa-version-update")))}catch{}}a();const s=setInterval(a,e);return()=>clearInterval(s)},[e,n,t]),null}function QA(){const{rpc:e,ws:t}=_n(),[n,l]=b.useState([]),a=b.useCallback(()=>{e&&e.sessionList().then(s=>{Array.isArray(s)&&l(s)}).catch(()=>{})},[e]);return b.useEffect(()=>{a()},[a]),b.useEffect(()=>{if(!t)return;const s=["user-prompt","assistant-stop","error","session-start","session-resumed"],i=[];for(const r of s)i.push(t.on(r,a));return()=>{for(const r of i)r()}},[t,a]),{sessions:n,refetch:a}}function ZA(e){const{rpc:t,ws:n}=_n(),[l,a]=b.useState(null),[s,i]=b.useState([]),[r,c]=b.useState(!1);b.useEffect(()=>{if(!t||!e){a(null),i([]),c(!1);return}c(!0),t.sessionGet(e).then(d=>{d!=null&&d.info&&a(d.info),d!=null&&d.events&&i(d.events)}).catch(()=>{}).finally(()=>c(!1))},[t,e]),b.useEffect(()=>{if(!n||!e)return;const d=p=>{if(p.type!=="heartbeat-brief"&&p.type!=="cron-task-fired"){const x=p.sessionId||p.id;if(x&&x!==e)return}i(x=>x.slice(-10).some(w=>w.timestamp===p.timestamp&&w.type===p.type&&JSON.stringify(w)===JSON.stringify(p))?x:[...x,p])},f=[],h=["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"];for(const p of h)f.push(n.on(p,d));return()=>{for(const p of f)p()}},[n,e]);const u=b.useCallback(d=>{i(f=>[...f,d])},[]);return{info:l,events:s,loading:r,addLiveEvent:u}}function IA({onAuthorize:e}){const[t,n]=b.useState(""),[l,a]=b.useState(!1),[s,i]=b.useState(null),r=async c=>{if(c.preventDefault(),!!t.trim()){a(!0),i(null);try{(await fetch("/health",{headers:{Authorization:`Bearer ${t.trim()}`}})).ok?e(t.trim()):i("Invalid Access Token. Please verify and try again.")}catch{i("Cannot connect to Curie Daemon. Make sure the daemon is running.")}finally{a(!1)}}};return o.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:[o.jsx("div",{className:"absolute top-[-20%] left-[-20%] w-[60%] h-[60%] rounded-full opacity-30 blur-[120px] pointer-events-none",style:{background:"#2d1f0e"}}),o.jsx("div",{className:"absolute bottom-[-20%] right-[-20%] w-[60%] h-[60%] rounded-full opacity-25 blur-[120px] pointer-events-none",style:{background:"#1e1408"}}),o.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%)"}}),o.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:[o.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px] rounded-t-2xl",style:{background:"linear-gradient(90deg, transparent, #d4a54a, transparent)"}}),o.jsxs("div",{className:"flex flex-col items-center gap-3 mb-6 mt-2",children:[o.jsxs("div",{className:"relative group",children:[o.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)"}}),o.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)"}})]}),o.jsxs("div",{className:"text-center mt-1",children:[o.jsx("span",{className:"text-xl font-display font-bold gold-shimmer block",children:"curie-agent"}),o.jsx("span",{className:"text-[10px] font-mono block mt-0.5",style:{color:"#d4a54a",opacity:.6},children:"v0.2.4"})]})]}),o.jsxs("div",{className:"text-center mb-6",children:[o.jsx("h2",{className:"text-sm font-semibold mb-2",style:{color:"#f5e6d0"},children:"Authorize this device"}),o.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."})]}),o.jsxs("form",{onSubmit:r,className:"w-full space-y-4",children:[o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-wider block ml-1",style:{color:"#d4a54a",opacity:.7},children:"Daemon Access Token"}),o.jsxs("div",{className:"relative group",children:[o.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:o.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:o.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"})})}),o.jsx("input",{type:"password",required:!0,placeholder:"Paste your daemon.token...",value:t,onChange:c=>n(c.target.value),disabled:l,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&&o.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:[o.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:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),o.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),o.jsx("span",{children:s})]}),o.jsx("button",{type:"submit",disabled:l||!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:l?o.jsxs(o.Fragment,{children:[o.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..."]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"Authorize & Connect"}),o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[o.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),o.jsx("polyline",{points:"12 5 19 12 12 19"})]})]})})]}),o.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:[o.jsx("div",{className:"font-semibold",style:{color:"#bfae94"},children:"Where is my token?"}),o.jsx("p",{children:"When starting the daemon, look for the console output in your terminal. It displays the dashboard link containing the secure token."}),o.jsxs("p",{children:["You can also find the raw token inside the file ",o.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 KA=["plan","edit","auto","yolo"],WA=[{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 JA(){const{rpc:e,connected:t,token:n,setToken:l}=_n(),{get:a,set:s,providers:i}=Eh(),[r,c]=b.useState("assistant"),u=a("mode")||"auto",[d,f]=b.useState(!1),[h,p]=b.useState(""),[x,S]=b.useState(null),[w,g]=b.useState(!1),[y,m]=b.useState(null),[v,j]=b.useState(navigator.onLine),[E,M]=b.useState(!1),[T,C]=b.useState(!1),[H,A]=b.useState(!1),[$,V]=b.useState(!1),N=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;b.useEffect(()=>{const B=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone===!0;M(!!B)},[]),b.useEffect(()=>{const B=F=>{F.preventDefault(),m(F)},K=()=>j(!0),W=()=>j(!1);return window.addEventListener("beforeinstallprompt",B),window.addEventListener("online",K),window.addEventListener("offline",W),()=>{window.removeEventListener("beforeinstallprompt",B),window.removeEventListener("online",K),window.removeEventListener("offline",W)}},[]);const z=async()=>{if(y){y.prompt();const{outcome:B}=await y.userChoice;console.log(`PWA install prompt choice: ${B}`),m(null)}else C(!0)},{sessions:k,refetch:R}=QA(),{events:D,addLiveEvent:O}=ZA(x),q=a("theme")||"curie";b.useEffect(()=>{document.documentElement.setAttribute("data-theme",q)},[q]),b.useEffect(()=>{const B=()=>g(window.innerWidth<768);return B(),window.addEventListener("resize",B),()=>window.removeEventListener("resize",B)},[]),b.useEffect(()=>{!t||!e||e.configGet("current_provider").then(B=>{B||A(!0)}).catch(()=>{})},[t,e]);const X=b.useCallback(()=>{S(null)},[]),L=b.useCallback(B=>{S(B)},[]),Y=b.useCallback(B=>{S(B),c("assistant")},[]),_=b.useCallback(B=>{S(B),R()},[R]);b.useEffect(()=>{const B=K=>{(K.metaKey||K.ctrlKey)&&K.key==="k"&&(K.preventDefault(),f(!0))};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[]);const U=b.useCallback(B=>{p(B),f(!1)},[]),G=b.useCallback(()=>{p("")},[]),I=(B,K=18)=>o.jsx("svg",{width:K,height:K,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:o.jsx("path",{d:B.icon})});return n?o.jsxs("div",{className:"flex h-dvh w-screen flex-col overflow-hidden bg-bg coffee-pattern",children:[!v&&o.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:[o.jsxs("svg",{className:"animate-pulse shrink-0",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[o.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"}),o.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),o.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),"Offline Mode — Curie is running on cached local client"]}),o.jsx(VA,{}),o.jsx(GA,{}),o.jsxs("main",{className:"flex flex-1 flex-col overflow-hidden bg-bg",children:[o.jsxs("div",{className:"topbar-wood flex h-12 items-center gap-3 px-4 shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsxs("button",{className:"relative flex items-center justify-center w-8 h-8 rounded-lg transition-all duration-150",style:{color:$?"var(--fg)":"var(--muted)",background:$?"var(--s3)":"transparent",border:$?"1px solid var(--b1)":"1px solid transparent"},onClick:()=>V(!0),title:"Sessions",children:[o.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:o.jsx("path",{d:"M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"})}),k.length>0&&o.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:k.length>99?"99+":k.length})]}),o.jsx("div",{className:"w-px h-5 bg-b1 mx-0.5"}),WA.map(B=>o.jsx("button",{className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all duration-150 cursor-pointer",style:{color:r===B.view?"var(--gold)":"var(--muted)",background:r===B.view?"var(--s3)":"transparent",border:r===B.view?"1px solid var(--b1)":"1px solid transparent"},onClick:()=>c(B.view),title:B.label,children:I(B,18)},B.view))]}),o.jsx("div",{className:"flex-1"}),window.innerWidth>=640&&o.jsx("div",{className:"flex rounded-lg overflow-hidden",style:{border:"1px solid var(--b2)",background:"var(--bg)"},children:KA.map(B=>o.jsx("button",{className:"px-2.5 py-1 text-xs cursor-pointer transition-all duration-150 font-mono select-none",style:{color:u===B?"var(--gold)":"var(--muted)",background:u===B?"var(--s3)":"transparent",borderRight:"1px solid var(--b1)"},onClick:()=>s("mode",B),children:B},B))}),(y||w&&!E)&&o.jsxs("button",{onClick:z,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:[o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[o.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),o.jsx("polyline",{points:"7 10 12 15 17 10"}),o.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),!w&&o.jsx(o.Fragment,{children:"Install"})]}),o.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:[o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[o.jsx("circle",{cx:"11",cy:"11",r:"8"}),o.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),!w&&o.jsx(o.Fragment,{children:"Ctrl+k"})]})]}),o.jsxs("div",{className:"relative flex-1 min-h-0",children:[H&&e?o.jsx(YA,{rpc:e,onComplete:()=>A(!1),className:"absolute inset-0"}):r==="assistant"&&o.jsx(Pj,{cmdResult:h,onClearCmdResult:G,rpc:e,className:"absolute inset-0",activeSessionId:x,onCreateSession:_,events:D,addLiveEvent:O,onSwitchView:B=>c(B)}),r==="channels"&&o.jsx(e5,{rpc:e,className:"absolute inset-0"}),r==="stats"&&o.jsx(t5,{rpc:e,className:"absolute inset-0"}),r==="projects"&&o.jsx(n5,{rpc:e,className:"absolute inset-0"}),r==="agents"&&o.jsx(f5,{rpc:e,onOpenSession:Y,className:"absolute inset-0"}),r==="kanban"&&o.jsx(f3,{rpc:e,className:"absolute inset-0"}),r==="wiki"&&o.jsx(UA,{rpc:e,className:"absolute inset-0"}),r==="settings"&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-muted text-xs",children:"Settings view — coming soon"})]})]}),o.jsx(qA,{open:d,onClose:()=>f(!1),onPick:U}),$&&o.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:()=>V(!1),children:o.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:B=>B.stopPropagation(),children:[o.jsx("div",{className:"flex justify-center pt-3 pb-1 shrink-0",children:o.jsx("div",{className:"w-8 h-1 rounded-full",style:{background:"var(--gold)",opacity:.3}})}),o.jsxs("div",{className:"flex items-center justify-between px-4 pb-3 shrink-0",style:{borderBottom:"1px solid var(--b1)"},children:[o.jsx("span",{className:"text-[13px] font-display font-semibold",style:{color:"var(--cream)"},children:"Sessions"}),o.jsx("button",{onClick:()=>V(!1),className:"text-muted hover:text-fg transition-colors duration-100 p-1",children:o.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--b1)"},children:o.jsxs("button",{onClick:()=>{X(),V(!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:[o.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),o.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),o.jsx("span",{className:"text-[12.5px] font-semibold",children:"New Chat"})]})}),o.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-4 scrollbar-thin",children:[k.sort((B,K)=>K.updatedAt-B.updatedAt).map(B=>o.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:B.id===x?"linear-gradient(135deg, var(--s3) 0%, var(--s2) 100%)":"transparent",border:B.id===x?"1px solid var(--b2)":"1px solid transparent"},onClick:()=>{L(B.id),V(!1)},children:o.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[o.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:B.id===x?"var(--gold)":"transparent",boxShadow:B.id===x?"0 0 4px var(--gold)":"none"}}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-[12.5px] font-medium text-fg truncate",children:B.name||B.provider}),o.jsxs("div",{className:"text-[11px] text-muted",children:[B.provider," · ",(()=>{const K=Date.now()-B.updatedAt;return K<6e4?"just now":K<36e5?`${Math.floor(K/6e4)}m ago`:K<864e5?`${Math.floor(K/36e5)}h ago`:`${Math.floor(K/864e5)}d ago`})()]})]}),B.type&&B.type!=="webui"&&o.jsx("span",{className:"text-[9px] font-mono text-muted bg-s2 px-1.5 py-0.5 rounded shrink-0",children:B.type})]})},B.id)),k.length===0&&o.jsx("div",{className:"text-center py-8 text-xs text-muted",children:"No sessions yet"})]}),x&&o.jsx("div",{className:"border-t border-b1 px-4 py-3 shrink-0",children:(()=>{var ve;const B=D.filter(xe=>xe.type==="usage"),K=B.reduce((xe,Se)=>xe+(Se.inputTokens||0)+(Se.outputTokens||0),0),W=B[B.length-1],F=W&&W.inputTokens||0;function J(xe){return xe<1e3?String(xe):`${(xe/1e3).toFixed(1)}k`}const P=a("current_provider")||"anthropic",ne=(ve=i.find(xe=>xe.name===P))==null?void 0:ve.model_cost,ae=a("model")||"sonnet";function te(xe,Se){if(ne){const[fn,ll]=ne.split(";"),Jt=parseFloat(fn||"0"),st=parseFloat(ll||"0");if(!isNaN(Jt)&&!isNaN(st))return(xe*Jt+Se*st)/1e6}const Nt={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}},Ht=Object.keys(Nt).find(fn=>ae.toLowerCase().includes(fn))||"sonnet",Wt=Nt[Ht];return(xe*Wt.in+Se*Wt.out)/1e6}const Z=B.reduce((xe,Se)=>xe+te(Se.inputTokens||0,Se.outputTokens||0),0);return o.jsxs("div",{className:"grid grid-cols-3 gap-3 text-center",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-[9px] text-muted2 uppercase tracking-wider font-mono",children:"Tokens"}),o.jsx("div",{className:"text-[12px] text-fg font-mono font-semibold",children:J(K)})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-[9px] text-muted2 uppercase tracking-wider font-mono",children:"Context"}),o.jsx("div",{className:"text-[12px] text-fg font-mono font-semibold",children:J(F)})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-[9px] text-muted2 uppercase tracking-wider font-mono",children:"Cost"}),o.jsxs("div",{className:"text-[12px] text-green font-mono font-semibold",children:["$",Z.toFixed(4)]})]})]})})()})]})}),T&&o.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:o.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:[o.jsxs("div",{className:"flex items-center justify-between pb-3 mb-4",style:{borderBottom:"1px solid var(--b1)"},children:[o.jsx("span",{className:"font-bold text-[13.5px] font-display",style:{color:"var(--cream)"},children:"Install Curie Agent"}),o.jsx("button",{onClick:()=>C(!1),className:"text-muted hover:text-fg transition-colors duration-100 cursor-pointer",children:o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsx("div",{className:"space-y-3.5 text-xs text-text leading-relaxed",children:N?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-[12px] text-muted mb-1 px-0.5",children:"Follow these simple steps to add Curie to your home screen:"}),o.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:[o.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:o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:o.jsx("path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8M16 6l-4-4-4 4M12 2v13"})})}),o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold text-fg block mb-0.5",children:"1. Tap the Share Button"}),o.jsx("span",{className:"text-[11px] text-muted",children:"Tap the Share icon in Safari's bottom toolbar."})]})]}),o.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:[o.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:"+"}),o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold text-fg block mb-0.5",children:"2. Add to Home Screen"}),o.jsxs("span",{className:"text-[11px] text-muted",children:["Scroll down and select ",o.jsx("strong",{children:"Add to Home Screen"}),"."]})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-[12px] text-muted mb-1 px-0.5",children:"Follow these simple steps to add Curie to your home screen:"}),o.jsxs("div",{className:"flex gap-3 items-start bg-s1/50 border border-b1 p-3 rounded-xl",children:[o.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-lg bg-blue-500/10 text-blue-400 shrink-0",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[o.jsx("circle",{cx:"12",cy:"12",r:"1"}),o.jsx("circle",{cx:"12",cy:"5",r:"1"}),o.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold text-fg block mb-0.5",children:"1. Open Browser Menu"}),o.jsx("span",{className:"text-[11px] text-muted",children:"Tap the menu icon (three dots) in the top-right corner."})]})]}),o.jsxs("div",{className:"flex gap-3 items-start bg-s1/50 border border-b1 p-3 rounded-xl",children:[o.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-lg bg-blue-500/10 text-blue-400 shrink-0",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[o.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),o.jsx("polyline",{points:"7 10 12 15 17 10"}),o.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}),o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold text-fg block mb-0.5",children:"2. Select Add / Install"}),o.jsxs("span",{className:"text-[11px] text-muted",children:["Tap ",o.jsx("strong",{children:"Add to Home screen"})," or ",o.jsx("strong",{children:"Install app"}),"."]})]})]})]})}),o.jsx("button",{onClick:()=>C(!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"})]})})]}):o.jsx(IA,{onAuthorize:l})}function FA(){return o.jsx(BN,{children:o.jsx(JA,{})})}const PA=ON.createRoot(document.getElementById("root"));PA.render(o.jsx(_e.StrictMode,{children:o.jsx(FA,{})}));"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))});