teleton 0.7.4 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +36 -26
  2. package/dist/{chunk-XDYDA2KV.js → chunk-2GLHOJ5C.js} +268 -59
  3. package/dist/chunk-5UVXJMOX.js +292 -0
  4. package/dist/{chunk-BGC2IUM5.js → chunk-AVDWXYQ7.js} +65 -20
  5. package/dist/{chunk-RMLQS3X6.js → chunk-CB2Y45HA.js} +106 -1
  6. package/dist/{chunk-5PLZ3KSO.js → chunk-DMXTIRUW.js} +5 -6
  7. package/dist/{chunk-YFG2QHLA.js → chunk-G2LLMJXJ.js} +1578 -115
  8. package/dist/{chunk-EK7M5K26.js → chunk-LCCVZ4D2.js} +3 -3
  9. package/dist/{chunk-LAQOUFOJ.js → chunk-OGMVWDVU.js} +3517 -3620
  10. package/dist/{chunk-4DU3C27M.js → chunk-R4YSJ4EY.js} +5 -1
  11. package/dist/{chunk-XBKSS6DM.js → chunk-VFA7QMCZ.js} +5 -3
  12. package/dist/{chunk-VAUJSSD3.js → chunk-XQUHC3JZ.js} +1 -1
  13. package/dist/{chunk-RO62LO6Z.js → chunk-YP25WTQK.js} +2 -0
  14. package/dist/cli/index.js +92 -28
  15. package/dist/{client-RTNALK7W.js → client-O37XDCJB.js} +4 -5
  16. package/dist/index.js +12 -13
  17. package/dist/{memory-JQZ6MTRU.js → memory-KQALFUV3.js} +6 -7
  18. package/dist/{migrate-GS5ACQDA.js → migrate-UV3WEL5D.js} +6 -7
  19. package/dist/{server-TCJOBV3D.js → server-BHHJGUDF.js} +35 -9
  20. package/dist/{setup-server-YHYJLAMA.js → setup-server-G7UG2DI3.js} +21 -9
  21. package/dist/store-H4XPNGC2.js +34 -0
  22. package/dist/{task-dependency-resolver-WKZWJLLM.js → task-dependency-resolver-VMEVJRPO.js} +2 -2
  23. package/dist/{task-executor-PD3H4MLO.js → task-executor-WWSPBJ4V.js} +1 -1
  24. package/dist/{tool-index-6HBRVXVG.js → tool-index-2KH3OB6X.js} +5 -5
  25. package/dist/web/assets/index-BrVqauzj.css +1 -0
  26. package/dist/web/assets/index-Bx8JW3gV.js +72 -0
  27. package/dist/web/assets/{index.es-CqZHj0tz.js → index.es-Pet5-M13.js} +1 -1
  28. package/dist/web/index.html +2 -2
  29. package/package.json +2 -2
  30. package/dist/chunk-JQDLW7IE.js +0 -107
  31. package/dist/chunk-UCN6TI25.js +0 -143
  32. package/dist/web/assets/index-B6M9knfJ.css +0 -1
  33. package/dist/web/assets/index-DAGeQfVZ.js +0 -72
  34. package/scripts/patch-gramjs.sh +0 -46
  35. package/scripts/postinstall.mjs +0 -16
@@ -1,72 +0,0 @@
1
- var of=Object.defineProperty;var af=(s,a,u)=>a in s?of(s,a,{enumerable:!0,configurable:!0,writable:!0,value:u}):s[a]=u;var Ot=(s,a,u)=>af(s,typeof a!="symbol"?a+"":a,u);function uf(s,a){for(var u=0;u<a.length;u++){const c=a[u];if(typeof c!="string"&&!Array.isArray(c)){for(const f in c)if(f!=="default"&&!(f in s)){const h=Object.getOwnPropertyDescriptor(c,f);h&&Object.defineProperty(s,f,h.get?h:{enumerable:!0,get:()=>c[f]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))c(f);new MutationObserver(f=>{for(const h of f)if(h.type==="childList")for(const v of h.addedNodes)v.tagName==="LINK"&&v.rel==="modulepreload"&&c(v)}).observe(document,{childList:!0,subtree:!0});function u(f){const h={};return f.integrity&&(h.integrity=f.integrity),f.referrerPolicy&&(h.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?h.credentials="include":f.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function c(f){if(f.ep)return;f.ep=!0;const h=u(f);fetch(f.href,h)}})();function cf(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var ui={exports:{}},Zr={},ci={exports:{}},ve={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its 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 hc;function df(){if(hc)return ve;hc=1;var s=Symbol.for("react.element"),a=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),v=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),w=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),C=Symbol.iterator;function _(S){return S===null||typeof S!="object"?null:(S=C&&S[C]||S["@@iterator"],typeof S=="function"?S:null)}var V={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},U=Object.assign,g={};function k(S,O,ce){this.props=S,this.context=O,this.refs=g,this.updater=ce||V}k.prototype.isReactComponent={},k.prototype.setState=function(S,O){if(typeof S!="object"&&typeof S!="function"&&S!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,S,O,"setState")},k.prototype.forceUpdate=function(S){this.updater.enqueueForceUpdate(this,S,"forceUpdate")};function z(){}z.prototype=k.prototype;function B(S,O,ce){this.props=S,this.context=O,this.refs=g,this.updater=ce||V}var W=B.prototype=new z;W.constructor=B,U(W,k.prototype),W.isPureReactComponent=!0;var G=Array.isArray,Y=Object.prototype.hasOwnProperty,M={current:null},ee={key:!0,ref:!0,__self:!0,__source:!0};function Q(S,O,ce){var he,xe={},je=null,Pe=null;if(O!=null)for(he in O.ref!==void 0&&(Pe=O.ref),O.key!==void 0&&(je=""+O.key),O)Y.call(O,he)&&!ee.hasOwnProperty(he)&&(xe[he]=O[he]);var Ce=arguments.length-2;if(Ce===1)xe.children=ce;else if(1<Ce){for(var _e=Array(Ce),et=0;et<Ce;et++)_e[et]=arguments[et+2];xe.children=_e}if(S&&S.defaultProps)for(he in Ce=S.defaultProps,Ce)xe[he]===void 0&&(xe[he]=Ce[he]);return{$$typeof:s,type:S,key:je,ref:Pe,props:xe,_owner:M.current}}function F(S,O){return{$$typeof:s,type:S.type,key:O,ref:S.ref,props:S.props,_owner:S._owner}}function A(S){return typeof S=="object"&&S!==null&&S.$$typeof===s}function b(S){var O={"=":"=0",":":"=2"};return"$"+S.replace(/[=:]/g,function(ce){return O[ce]})}var se=/\/+/g;function R(S,O){return typeof S=="object"&&S!==null&&S.key!=null?b(""+S.key):O.toString(36)}function ae(S,O,ce,he,xe){var je=typeof S;(je==="undefined"||je==="boolean")&&(S=null);var Pe=!1;if(S===null)Pe=!0;else switch(je){case"string":case"number":Pe=!0;break;case"object":switch(S.$$typeof){case s:case a:Pe=!0}}if(Pe)return Pe=S,xe=xe(Pe),S=he===""?"."+R(Pe,0):he,G(xe)?(ce="",S!=null&&(ce=S.replace(se,"$&/")+"/"),ae(xe,O,ce,"",function(et){return et})):xe!=null&&(A(xe)&&(xe=F(xe,ce+(!xe.key||Pe&&Pe.key===xe.key?"":(""+xe.key).replace(se,"$&/")+"/")+S)),O.push(xe)),1;if(Pe=0,he=he===""?".":he+":",G(S))for(var Ce=0;Ce<S.length;Ce++){je=S[Ce];var _e=he+R(je,Ce);Pe+=ae(je,O,ce,_e,xe)}else if(_e=_(S),typeof _e=="function")for(S=_e.call(S),Ce=0;!(je=S.next()).done;)je=je.value,_e=he+R(je,Ce++),Pe+=ae(je,O,ce,_e,xe);else if(je==="object")throw O=String(S),Error("Objects are not valid as a React child (found: "+(O==="[object Object]"?"object with keys {"+Object.keys(S).join(", ")+"}":O)+"). If you meant to render a collection of children, use an array instead.");return Pe}function ye(S,O,ce){if(S==null)return S;var he=[],xe=0;return ae(S,he,"","",function(je){return O.call(ce,je,xe++)}),he}function ge(S){if(S._status===-1){var O=S._result;O=O(),O.then(function(ce){(S._status===0||S._status===-1)&&(S._status=1,S._result=ce)},function(ce){(S._status===0||S._status===-1)&&(S._status=2,S._result=ce)}),S._status===-1&&(S._status=0,S._result=O)}if(S._status===1)return S._result.default;throw S._result}var Se={current:null},I={transition:null},q={ReactCurrentDispatcher:Se,ReactCurrentBatchConfig:I,ReactCurrentOwner:M};function D(){throw Error("act(...) is not supported in production builds of React.")}return ve.Children={map:ye,forEach:function(S,O,ce){ye(S,function(){O.apply(this,arguments)},ce)},count:function(S){var O=0;return ye(S,function(){O++}),O},toArray:function(S){return ye(S,function(O){return O})||[]},only:function(S){if(!A(S))throw Error("React.Children.only expected to receive a single React element child.");return S}},ve.Component=k,ve.Fragment=u,ve.Profiler=f,ve.PureComponent=B,ve.StrictMode=c,ve.Suspense=E,ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=q,ve.act=D,ve.cloneElement=function(S,O,ce){if(S==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+S+".");var he=U({},S.props),xe=S.key,je=S.ref,Pe=S._owner;if(O!=null){if(O.ref!==void 0&&(je=O.ref,Pe=M.current),O.key!==void 0&&(xe=""+O.key),S.type&&S.type.defaultProps)var Ce=S.type.defaultProps;for(_e in O)Y.call(O,_e)&&!ee.hasOwnProperty(_e)&&(he[_e]=O[_e]===void 0&&Ce!==void 0?Ce[_e]:O[_e])}var _e=arguments.length-2;if(_e===1)he.children=ce;else if(1<_e){Ce=Array(_e);for(var et=0;et<_e;et++)Ce[et]=arguments[et+2];he.children=Ce}return{$$typeof:s,type:S.type,key:xe,ref:je,props:he,_owner:Pe}},ve.createContext=function(S){return S={$$typeof:v,_currentValue:S,_currentValue2:S,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},S.Provider={$$typeof:h,_context:S},S.Consumer=S},ve.createElement=Q,ve.createFactory=function(S){var O=Q.bind(null,S);return O.type=S,O},ve.createRef=function(){return{current:null}},ve.forwardRef=function(S){return{$$typeof:x,render:S}},ve.isValidElement=A,ve.lazy=function(S){return{$$typeof:j,_payload:{_status:-1,_result:S},_init:ge}},ve.memo=function(S,O){return{$$typeof:w,type:S,compare:O===void 0?null:O}},ve.startTransition=function(S){var O=I.transition;I.transition={};try{S()}finally{I.transition=O}},ve.unstable_act=D,ve.useCallback=function(S,O){return Se.current.useCallback(S,O)},ve.useContext=function(S){return Se.current.useContext(S)},ve.useDebugValue=function(){},ve.useDeferredValue=function(S){return Se.current.useDeferredValue(S)},ve.useEffect=function(S,O){return Se.current.useEffect(S,O)},ve.useId=function(){return Se.current.useId()},ve.useImperativeHandle=function(S,O,ce){return Se.current.useImperativeHandle(S,O,ce)},ve.useInsertionEffect=function(S,O){return Se.current.useInsertionEffect(S,O)},ve.useLayoutEffect=function(S,O){return Se.current.useLayoutEffect(S,O)},ve.useMemo=function(S,O){return Se.current.useMemo(S,O)},ve.useReducer=function(S,O,ce){return Se.current.useReducer(S,O,ce)},ve.useRef=function(S){return Se.current.useRef(S)},ve.useState=function(S){return Se.current.useState(S)},ve.useSyncExternalStore=function(S,O,ce){return Se.current.useSyncExternalStore(S,O,ce)},ve.useTransition=function(){return Se.current.useTransition()},ve.version="18.3.1",ve}var mc;function ji(){return mc||(mc=1,ci.exports=df()),ci.exports}/**
10
- * @license React
11
- * react-jsx-runtime.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its 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 gc;function pf(){if(gc)return Zr;gc=1;var s=ji(),a=Symbol.for("react.element"),u=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,f=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,h={key:!0,ref:!0,__self:!0,__source:!0};function v(x,E,w){var j,C={},_=null,V=null;w!==void 0&&(_=""+w),E.key!==void 0&&(_=""+E.key),E.ref!==void 0&&(V=E.ref);for(j in E)c.call(E,j)&&!h.hasOwnProperty(j)&&(C[j]=E[j]);if(x&&x.defaultProps)for(j in E=x.defaultProps,E)C[j]===void 0&&(C[j]=E[j]);return{$$typeof:a,type:x,key:_,ref:V,props:C,_owner:f.current}}return Zr.Fragment=u,Zr.jsx=v,Zr.jsxs=v,Zr}var yc;function ff(){return yc||(yc=1,ui.exports=pf()),ui.exports}var r=ff(),p=ji();const xs=cf(p),hf=uf({__proto__:null,default:xs},[p]);var hs={},di={exports:{}},ut={},pi={exports:{}},fi={};/**
18
- * @license React
19
- * scheduler.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var xc;function mf(){return xc||(xc=1,(function(s){function a(I,q){var D=I.length;I.push(q);e:for(;0<D;){var S=D-1>>>1,O=I[S];if(0<f(O,q))I[S]=q,I[D]=O,D=S;else break e}}function u(I){return I.length===0?null:I[0]}function c(I){if(I.length===0)return null;var q=I[0],D=I.pop();if(D!==q){I[0]=D;e:for(var S=0,O=I.length,ce=O>>>1;S<ce;){var he=2*(S+1)-1,xe=I[he],je=he+1,Pe=I[je];if(0>f(xe,D))je<O&&0>f(Pe,xe)?(I[S]=Pe,I[je]=D,S=je):(I[S]=xe,I[he]=D,S=he);else if(je<O&&0>f(Pe,D))I[S]=Pe,I[je]=D,S=je;else break e}}return q}function f(I,q){var D=I.sortIndex-q.sortIndex;return D!==0?D:I.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var h=performance;s.unstable_now=function(){return h.now()}}else{var v=Date,x=v.now();s.unstable_now=function(){return v.now()-x}}var E=[],w=[],j=1,C=null,_=3,V=!1,U=!1,g=!1,k=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function W(I){for(var q=u(w);q!==null;){if(q.callback===null)c(w);else if(q.startTime<=I)c(w),q.sortIndex=q.expirationTime,a(E,q);else break;q=u(w)}}function G(I){if(g=!1,W(I),!U)if(u(E)!==null)U=!0,ge(Y);else{var q=u(w);q!==null&&Se(G,q.startTime-I)}}function Y(I,q){U=!1,g&&(g=!1,z(Q),Q=-1),V=!0;var D=_;try{for(W(q),C=u(E);C!==null&&(!(C.expirationTime>q)||I&&!b());){var S=C.callback;if(typeof S=="function"){C.callback=null,_=C.priorityLevel;var O=S(C.expirationTime<=q);q=s.unstable_now(),typeof O=="function"?C.callback=O:C===u(E)&&c(E),W(q)}else c(E);C=u(E)}if(C!==null)var ce=!0;else{var he=u(w);he!==null&&Se(G,he.startTime-q),ce=!1}return ce}finally{C=null,_=D,V=!1}}var M=!1,ee=null,Q=-1,F=5,A=-1;function b(){return!(s.unstable_now()-A<F)}function se(){if(ee!==null){var I=s.unstable_now();A=I;var q=!0;try{q=ee(!0,I)}finally{q?R():(M=!1,ee=null)}}else M=!1}var R;if(typeof B=="function")R=function(){B(se)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,ye=ae.port2;ae.port1.onmessage=se,R=function(){ye.postMessage(null)}}else R=function(){k(se,0)};function ge(I){ee=I,M||(M=!0,R())}function Se(I,q){Q=k(function(){I(s.unstable_now())},q)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(I){I.callback=null},s.unstable_continueExecution=function(){U||V||(U=!0,ge(Y))},s.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<I?Math.floor(1e3/I):5},s.unstable_getCurrentPriorityLevel=function(){return _},s.unstable_getFirstCallbackNode=function(){return u(E)},s.unstable_next=function(I){switch(_){case 1:case 2:case 3:var q=3;break;default:q=_}var D=_;_=q;try{return I()}finally{_=D}},s.unstable_pauseExecution=function(){},s.unstable_requestPaint=function(){},s.unstable_runWithPriority=function(I,q){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var D=_;_=I;try{return q()}finally{_=D}},s.unstable_scheduleCallback=function(I,q,D){var S=s.unstable_now();switch(typeof D=="object"&&D!==null?(D=D.delay,D=typeof D=="number"&&0<D?S+D:S):D=S,I){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=D+O,I={id:j++,callback:q,priorityLevel:I,startTime:D,expirationTime:O,sortIndex:-1},D>S?(I.sortIndex=D,a(w,I),u(E)===null&&I===u(w)&&(g?(z(Q),Q=-1):g=!0,Se(G,D-S))):(I.sortIndex=O,a(E,I),U||V||(U=!0,ge(Y))),I},s.unstable_shouldYield=b,s.unstable_wrapCallback=function(I){var q=_;return function(){var D=_;_=q;try{return I.apply(this,arguments)}finally{_=D}}}})(fi)),fi}var vc;function gf(){return vc||(vc=1,pi.exports=mf()),pi.exports}/**
26
- * @license React
27
- * react-dom.production.min.js
28
- *
29
- * Copyright (c) Facebook, Inc. and its 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 Sc;function yf(){if(Sc)return ut;Sc=1;var s=ji(),a=gf();function u(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;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."}var c=new Set,f={};function h(e,t){v(e,t),v(e+"Capture",t)}function v(e,t){for(f[e]=t,e=0;e<t.length;e++)c.add(t[e])}var x=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),E=Object.prototype.hasOwnProperty,w=/^[: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]*$/,j={},C={};function _(e){return E.call(C,e)?!0:E.call(j,e)?!1:w.test(e)?C[e]=!0:(j[e]=!0,!1)}function V(e,t,n,l){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return l?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function U(e,t,n,l){if(t===null||typeof t>"u"||V(e,t,n,l))return!0;if(l)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function g(e,t,n,l,o,i,d){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=l,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=d}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){k[e]=new g(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];k[t]=new g(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){k[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){k[e]=new g(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){k[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){k[e]=new g(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){k[e]=new g(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){k[e]=new g(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){k[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)});var z=/[\-:]([a-z])/g;function B(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(z,B);k[t]=new g(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(z,B);k[t]=new g(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(z,B);k[t]=new g(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){k[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)}),k.xlinkHref=new g("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){k[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)});function W(e,t,n,l){var o=k.hasOwnProperty(t)?k[t]:null;(o!==null?o.type!==0:l||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(U(t,n,o,l)&&(n=null),l||o===null?_(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,l=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,l?e.setAttributeNS(l,t,n):e.setAttribute(t,n))))}var G=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Y=Symbol.for("react.element"),M=Symbol.for("react.portal"),ee=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),F=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),b=Symbol.for("react.context"),se=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),ae=Symbol.for("react.suspense_list"),ye=Symbol.for("react.memo"),ge=Symbol.for("react.lazy"),Se=Symbol.for("react.offscreen"),I=Symbol.iterator;function q(e){return e===null||typeof e!="object"?null:(e=I&&e[I]||e["@@iterator"],typeof e=="function"?e:null)}var D=Object.assign,S;function O(e){if(S===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);S=t&&t[1]||""}return`
34
- `+S+e}var ce=!1;function he(e,t){if(!e||ce)return"";ce=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(L){var l=L}Reflect.construct(e,[],t)}else{try{t.call()}catch(L){l=L}e.call(t.prototype)}else{try{throw Error()}catch(L){l=L}e()}}catch(L){if(L&&l&&typeof L.stack=="string"){for(var o=L.stack.split(`
35
- `),i=l.stack.split(`
36
- `),d=o.length-1,m=i.length-1;1<=d&&0<=m&&o[d]!==i[m];)m--;for(;1<=d&&0<=m;d--,m--)if(o[d]!==i[m]){if(d!==1||m!==1)do if(d--,m--,0>m||o[d]!==i[m]){var y=`
37
- `+o[d].replace(" at new "," at ");return e.displayName&&y.includes("<anonymous>")&&(y=y.replace("<anonymous>",e.displayName)),y}while(1<=d&&0<=m);break}}}finally{ce=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?O(e):""}function xe(e){switch(e.tag){case 5:return O(e.type);case 16:return O("Lazy");case 13:return O("Suspense");case 19:return O("SuspenseList");case 0:case 2:case 15:return e=he(e.type,!1),e;case 11:return e=he(e.type.render,!1),e;case 1:return e=he(e.type,!0),e;default:return""}}function je(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ee:return"Fragment";case M:return"Portal";case F:return"Profiler";case Q:return"StrictMode";case R:return"Suspense";case ae:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case b:return(e.displayName||"Context")+".Consumer";case A:return(e._context.displayName||"Context")+".Provider";case se:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ye:return t=e.displayName||null,t!==null?t:je(e.type)||"Memo";case ge:t=e._payload,e=e._init;try{return je(e(t))}catch{}}return null}function Pe(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return je(t);case 8:return t===Q?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ce(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function _e(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function et(e){var t=_e(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),l=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(d){l=""+d,i.call(this,d)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return l},setValue:function(d){l=""+d},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function gn(e){e._valueTracker||(e._valueTracker=et(e))}function rl(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=_e(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function In(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}}function fr(e,t){var n=t.checked;return D({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function hr(e,t){var n=t.defaultValue==null?"":t.defaultValue,l=t.checked!=null?t.checked:t.defaultChecked;n=Ce(t.value!=null?t.value:n),e._wrapperState={initialChecked:l,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function An(e,t){t=t.checked,t!=null&&W(e,"checked",t,!1)}function Tt(e,t){An(e,t);var n=Ce(t.value),l=t.type;if(n!=null)l==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(l==="submit"||l==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?te(e,t.type,n):t.hasOwnProperty("defaultValue")&&te(e,t.type,Ce(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Z(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var l=t.type;if(!(l!=="submit"&&l!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function te(e,t,n){(t!=="number"||In(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var X=Array.isArray;function ze(e,t,n,l){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&l&&(e[n].defaultSelected=!0)}else{for(n=""+Ce(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,l&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function Dn(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(u(91));return D({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function mt(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(u(92));if(X(n)){if(1<n.length)throw Error(u(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Ce(n)}}function mr(e,t){var n=Ce(t.value),l=Ce(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),l!=null&&(e.defaultValue=""+l)}function ll(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function gr(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function On(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?gr(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var bn,sl=(function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,l,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,l,o)})}:e})(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(bn=bn||document.createElement("div"),bn.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=bn.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ne(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Rt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Mn=["Webkit","ms","Moz","O"];Object.keys(Rt).forEach(function(e){Mn.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Rt[t]=Rt[e]})});function ol(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Rt.hasOwnProperty(e)&&Rt[e]?(""+t).trim():t+"px"}function Ri(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var l=n.indexOf("--")===0,o=ol(n,t[n],l);n==="float"&&(n="cssFloat"),l?e.setProperty(n,o):e[n]=o}}var dd=D({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ss(e,t){if(t){if(dd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(u(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(u(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(u(61))}if(t.style!=null&&typeof t.style!="object")throw Error(u(62))}}function js(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 ws=null;function ks(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Cs=null,Fn=null,Bn=null;function Li(e){if(e=Mr(e)){if(typeof Cs!="function")throw Error(u(280));var t=e.stateNode;t&&(t=Tl(t),Cs(e.stateNode,e.type,t))}}function zi(e){Fn?Bn?Bn.push(e):Bn=[e]:Fn=e}function Ii(){if(Fn){var e=Fn,t=Bn;if(Bn=Fn=null,Li(e),t)for(e=0;e<t.length;e++)Li(t[e])}}function Ai(e,t){return e(t)}function Di(){}var Ns=!1;function Oi(e,t,n){if(Ns)return e(t,n);Ns=!0;try{return Ai(e,t,n)}finally{Ns=!1,(Fn!==null||Bn!==null)&&(Di(),Ii())}}function yr(e,t){var n=e.stateNode;if(n===null)return null;var l=Tl(n);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(u(231,t,typeof n));return n}var Es=!1;if(x)try{var xr={};Object.defineProperty(xr,"passive",{get:function(){Es=!0}}),window.addEventListener("test",xr,xr),window.removeEventListener("test",xr,xr)}catch{Es=!1}function pd(e,t,n,l,o,i,d,m,y){var L=Array.prototype.slice.call(arguments,3);try{t.apply(n,L)}catch(K){this.onError(K)}}var vr=!1,il=null,al=!1,Ps=null,fd={onError:function(e){vr=!0,il=e}};function hd(e,t,n,l,o,i,d,m,y){vr=!1,il=null,pd.apply(fd,arguments)}function md(e,t,n,l,o,i,d,m,y){if(hd.apply(this,arguments),vr){if(vr){var L=il;vr=!1,il=null}else throw Error(u(198));al||(al=!0,Ps=L)}}function yn(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function bi(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 Mi(e){if(yn(e)!==e)throw Error(u(188))}function gd(e){var t=e.alternate;if(!t){if(t=yn(e),t===null)throw Error(u(188));return t!==e?null:e}for(var n=e,l=t;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(l=o.return,l!==null){n=l;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return Mi(o),e;if(i===l)return Mi(o),t;i=i.sibling}throw Error(u(188))}if(n.return!==l.return)n=o,l=i;else{for(var d=!1,m=o.child;m;){if(m===n){d=!0,n=o,l=i;break}if(m===l){d=!0,l=o,n=i;break}m=m.sibling}if(!d){for(m=i.child;m;){if(m===n){d=!0,n=i,l=o;break}if(m===l){d=!0,l=i,n=o;break}m=m.sibling}if(!d)throw Error(u(189))}}if(n.alternate!==l)throw Error(u(190))}if(n.tag!==3)throw Error(u(188));return n.stateNode.current===n?e:t}function Fi(e){return e=gd(e),e!==null?Bi(e):null}function Bi(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Bi(e);if(t!==null)return t;e=e.sibling}return null}var Ui=a.unstable_scheduleCallback,Wi=a.unstable_cancelCallback,yd=a.unstable_shouldYield,xd=a.unstable_requestPaint,be=a.unstable_now,vd=a.unstable_getCurrentPriorityLevel,_s=a.unstable_ImmediatePriority,$i=a.unstable_UserBlockingPriority,ul=a.unstable_NormalPriority,Sd=a.unstable_LowPriority,Ki=a.unstable_IdlePriority,cl=null,Lt=null;function jd(e){if(Lt&&typeof Lt.onCommitFiberRoot=="function")try{Lt.onCommitFiberRoot(cl,e,void 0,(e.current.flags&128)===128)}catch{}}var wt=Math.clz32?Math.clz32:Cd,wd=Math.log,kd=Math.LN2;function Cd(e){return e>>>=0,e===0?32:31-(wd(e)/kd|0)|0}var dl=64,pl=4194304;function Sr(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function fl(e,t){var n=e.pendingLanes;if(n===0)return 0;var l=0,o=e.suspendedLanes,i=e.pingedLanes,d=n&268435455;if(d!==0){var m=d&~o;m!==0?l=Sr(m):(i&=d,i!==0&&(l=Sr(i)))}else d=n&~o,d!==0?l=Sr(d):i!==0&&(l=Sr(i));if(l===0)return 0;if(t!==0&&t!==l&&(t&o)===0&&(o=l&-l,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if((l&4)!==0&&(l|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=l;0<t;)n=31-wt(t),o=1<<n,l|=e[n],t&=~o;return l}function Nd(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ed(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var d=31-wt(i),m=1<<d,y=o[d];y===-1?((m&n)===0||(m&l)!==0)&&(o[d]=Nd(m,t)):y<=t&&(e.expiredLanes|=m),i&=~m}}function Ts(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Vi(){var e=dl;return dl<<=1,(dl&4194240)===0&&(dl=64),e}function Rs(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function jr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-wt(t),e[t]=n}function Pd(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var l=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-wt(n),i=1<<o;t[o]=0,l[o]=-1,e[o]=-1,n&=~i}}function Ls(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-wt(n),o=1<<l;o&t|e[l]&t&&(e[l]|=t),n&=~o}}var Ee=0;function Hi(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var Qi,zs,Yi,Ji,Gi,Is=!1,hl=[],Qt=null,Yt=null,Jt=null,wr=new Map,kr=new Map,Gt=[],_d="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 submit".split(" ");function qi(e,t){switch(e){case"focusin":case"focusout":Qt=null;break;case"dragenter":case"dragleave":Yt=null;break;case"mouseover":case"mouseout":Jt=null;break;case"pointerover":case"pointerout":wr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":kr.delete(t.pointerId)}}function Cr(e,t,n,l,o,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:l,nativeEvent:i,targetContainers:[o]},t!==null&&(t=Mr(t),t!==null&&zs(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function Td(e,t,n,l,o){switch(t){case"focusin":return Qt=Cr(Qt,e,t,n,l,o),!0;case"dragenter":return Yt=Cr(Yt,e,t,n,l,o),!0;case"mouseover":return Jt=Cr(Jt,e,t,n,l,o),!0;case"pointerover":var i=o.pointerId;return wr.set(i,Cr(wr.get(i)||null,e,t,n,l,o)),!0;case"gotpointercapture":return i=o.pointerId,kr.set(i,Cr(kr.get(i)||null,e,t,n,l,o)),!0}return!1}function Xi(e){var t=xn(e.target);if(t!==null){var n=yn(t);if(n!==null){if(t=n.tag,t===13){if(t=bi(n),t!==null){e.blockedOn=t,Gi(e.priority,function(){Yi(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 ml(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Ds(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);ws=l,n.target.dispatchEvent(l),ws=null}else return t=Mr(n),t!==null&&zs(t),e.blockedOn=n,!1;t.shift()}return!0}function Zi(e,t,n){ml(e)&&n.delete(t)}function Rd(){Is=!1,Qt!==null&&ml(Qt)&&(Qt=null),Yt!==null&&ml(Yt)&&(Yt=null),Jt!==null&&ml(Jt)&&(Jt=null),wr.forEach(Zi),kr.forEach(Zi)}function Nr(e,t){e.blockedOn===t&&(e.blockedOn=null,Is||(Is=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Rd)))}function Er(e){function t(o){return Nr(o,e)}if(0<hl.length){Nr(hl[0],e);for(var n=1;n<hl.length;n++){var l=hl[n];l.blockedOn===e&&(l.blockedOn=null)}}for(Qt!==null&&Nr(Qt,e),Yt!==null&&Nr(Yt,e),Jt!==null&&Nr(Jt,e),wr.forEach(t),kr.forEach(t),n=0;n<Gt.length;n++)l=Gt[n],l.blockedOn===e&&(l.blockedOn=null);for(;0<Gt.length&&(n=Gt[0],n.blockedOn===null);)Xi(n),n.blockedOn===null&&Gt.shift()}var Un=G.ReactCurrentBatchConfig,gl=!0;function Ld(e,t,n,l){var o=Ee,i=Un.transition;Un.transition=null;try{Ee=1,As(e,t,n,l)}finally{Ee=o,Un.transition=i}}function zd(e,t,n,l){var o=Ee,i=Un.transition;Un.transition=null;try{Ee=4,As(e,t,n,l)}finally{Ee=o,Un.transition=i}}function As(e,t,n,l){if(gl){var o=Ds(e,t,n,l);if(o===null)Xs(e,t,l,yl,n),qi(e,l);else if(Td(o,e,t,n,l))l.stopPropagation();else if(qi(e,l),t&4&&-1<_d.indexOf(e)){for(;o!==null;){var i=Mr(o);if(i!==null&&Qi(i),i=Ds(e,t,n,l),i===null&&Xs(e,t,l,yl,n),i===o)break;o=i}o!==null&&l.stopPropagation()}else Xs(e,t,l,null,n)}}var yl=null;function Ds(e,t,n,l){if(yl=null,e=ks(l),e=xn(e),e!==null)if(t=yn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=bi(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 yl=e,null}function ea(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(vd()){case _s:return 1;case $i:return 4;case ul:case Sd:return 16;case Ki:return 536870912;default:return 16}default:return 16}}var qt=null,Os=null,xl=null;function ta(){if(xl)return xl;var e,t=Os,n=t.length,l,o="value"in qt?qt.value:qt.textContent,i=o.length;for(e=0;e<n&&t[e]===o[e];e++);var d=n-e;for(l=1;l<=d&&t[n-l]===o[i-l];l++);return xl=o.slice(e,1<l?1-l:void 0)}function vl(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 Sl(){return!0}function na(){return!1}function dt(e){function t(n,l,o,i,d){this._reactName=n,this._targetInst=o,this.type=l,this.nativeEvent=i,this.target=d,this.currentTarget=null;for(var m in e)e.hasOwnProperty(m)&&(n=e[m],this[m]=n?n(i):i[m]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Sl:na,this.isPropagationStopped=na,this}return D(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=Sl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Sl)},persist:function(){},isPersistent:Sl}),t}var Wn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bs=dt(Wn),Pr=D({},Wn,{view:0,detail:0}),Id=dt(Pr),Ms,Fs,_r,jl=D({},Pr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Us,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!==_r&&(_r&&e.type==="mousemove"?(Ms=e.screenX-_r.screenX,Fs=e.screenY-_r.screenY):Fs=Ms=0,_r=e),Ms)},movementY:function(e){return"movementY"in e?e.movementY:Fs}}),ra=dt(jl),Ad=D({},jl,{dataTransfer:0}),Dd=dt(Ad),Od=D({},Pr,{relatedTarget:0}),Bs=dt(Od),bd=D({},Wn,{animationName:0,elapsedTime:0,pseudoElement:0}),Md=dt(bd),Fd=D({},Wn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Bd=dt(Fd),Ud=D({},Wn,{data:0}),la=dt(Ud),Wd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},$d={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"},Kd={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Vd(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Kd[e])?!!t[e]:!1}function Us(){return Vd}var Hd=D({},Pr,{key:function(e){if(e.key){var t=Wd[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=vl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?$d[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Us,charCode:function(e){return e.type==="keypress"?vl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?vl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Qd=dt(Hd),Yd=D({},jl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),sa=dt(Yd),Jd=D({},Pr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Us}),Gd=dt(Jd),qd=D({},Wn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Xd=dt(qd),Zd=D({},jl,{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}),ep=dt(Zd),tp=[9,13,27,32],Ws=x&&"CompositionEvent"in window,Tr=null;x&&"documentMode"in document&&(Tr=document.documentMode);var np=x&&"TextEvent"in window&&!Tr,oa=x&&(!Ws||Tr&&8<Tr&&11>=Tr),ia=" ",aa=!1;function ua(e,t){switch(e){case"keyup":return tp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ca(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var $n=!1;function rp(e,t){switch(e){case"compositionend":return ca(t);case"keypress":return t.which!==32?null:(aa=!0,ia);case"textInput":return e=t.data,e===ia&&aa?null:e;default:return null}}function lp(e,t){if($n)return e==="compositionend"||!Ws&&ua(e,t)?(e=ta(),xl=Os=qt=null,$n=!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 oa&&t.locale!=="ko"?null:t.data;default:return null}}var sp={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 da(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!sp[e.type]:t==="textarea"}function pa(e,t,n,l){zi(l),t=El(t,"onChange"),0<t.length&&(n=new bs("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var Rr=null,Lr=null;function op(e){Ra(e,0)}function wl(e){var t=Yn(e);if(rl(t))return e}function ip(e,t){if(e==="change")return t}var fa=!1;if(x){var $s;if(x){var Ks="oninput"in document;if(!Ks){var ha=document.createElement("div");ha.setAttribute("oninput","return;"),Ks=typeof ha.oninput=="function"}$s=Ks}else $s=!1;fa=$s&&(!document.documentMode||9<document.documentMode)}function ma(){Rr&&(Rr.detachEvent("onpropertychange",ga),Lr=Rr=null)}function ga(e){if(e.propertyName==="value"&&wl(Lr)){var t=[];pa(t,Lr,e,ks(e)),Oi(op,t)}}function ap(e,t,n){e==="focusin"?(ma(),Rr=t,Lr=n,Rr.attachEvent("onpropertychange",ga)):e==="focusout"&&ma()}function up(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return wl(Lr)}function cp(e,t){if(e==="click")return wl(t)}function dp(e,t){if(e==="input"||e==="change")return wl(t)}function pp(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var kt=typeof Object.is=="function"?Object.is:pp;function zr(e,t){if(kt(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 o=n[l];if(!E.call(t,o)||!kt(e[o],t[o]))return!1}return!0}function ya(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function xa(e,t){var n=ya(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=ya(n)}}function va(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?va(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Sa(){for(var e=window,t=In();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=In(e.document)}return t}function Vs(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")}function fp(e){var t=Sa(),n=e.focusedElem,l=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&va(n.ownerDocument.documentElement,n)){if(l!==null&&Vs(n)){if(t=l.start,e=l.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(l.start,o);l=l.end===void 0?i:Math.min(l.end,o),!e.extend&&i>l&&(o=l,l=i,i=o),o=xa(n,i);var d=xa(n,l);o&&d&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==d.node||e.focusOffset!==d.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>l?(e.addRange(t),e.extend(d.node,d.offset)):(t.setEnd(d.node,d.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var hp=x&&"documentMode"in document&&11>=document.documentMode,Kn=null,Hs=null,Ir=null,Qs=!1;function ja(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Qs||Kn==null||Kn!==In(l)||(l=Kn,"selectionStart"in l&&Vs(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}),Ir&&zr(Ir,l)||(Ir=l,l=El(Hs,"onSelect"),0<l.length&&(t=new bs("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=Kn)))}function kl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Vn={animationend:kl("Animation","AnimationEnd"),animationiteration:kl("Animation","AnimationIteration"),animationstart:kl("Animation","AnimationStart"),transitionend:kl("Transition","TransitionEnd")},Ys={},wa={};x&&(wa=document.createElement("div").style,"AnimationEvent"in window||(delete Vn.animationend.animation,delete Vn.animationiteration.animation,delete Vn.animationstart.animation),"TransitionEvent"in window||delete Vn.transitionend.transition);function Cl(e){if(Ys[e])return Ys[e];if(!Vn[e])return e;var t=Vn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in wa)return Ys[e]=t[n];return e}var ka=Cl("animationend"),Ca=Cl("animationiteration"),Na=Cl("animationstart"),Ea=Cl("transitionend"),Pa=new Map,_a="abort auxClick 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(" ");function Xt(e,t){Pa.set(e,t),h(t,[e])}for(var Js=0;Js<_a.length;Js++){var Gs=_a[Js],mp=Gs.toLowerCase(),gp=Gs[0].toUpperCase()+Gs.slice(1);Xt(mp,"on"+gp)}Xt(ka,"onAnimationEnd"),Xt(Ca,"onAnimationIteration"),Xt(Na,"onAnimationStart"),Xt("dblclick","onDoubleClick"),Xt("focusin","onFocus"),Xt("focusout","onBlur"),Xt(Ea,"onTransitionEnd"),v("onMouseEnter",["mouseout","mouseover"]),v("onMouseLeave",["mouseout","mouseover"]),v("onPointerEnter",["pointerout","pointerover"]),v("onPointerLeave",["pointerout","pointerover"]),h("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),h("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),h("onBeforeInput",["compositionend","keypress","textInput","paste"]),h("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),h("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),h("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ar="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(" "),yp=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ar));function Ta(e,t,n){var l=e.type||"unknown-event";e.currentTarget=n,md(l,t,void 0,e),e.currentTarget=null}function Ra(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var l=e[n],o=l.event;l=l.listeners;e:{var i=void 0;if(t)for(var d=l.length-1;0<=d;d--){var m=l[d],y=m.instance,L=m.currentTarget;if(m=m.listener,y!==i&&o.isPropagationStopped())break e;Ta(o,m,L),i=y}else for(d=0;d<l.length;d++){if(m=l[d],y=m.instance,L=m.currentTarget,m=m.listener,y!==i&&o.isPropagationStopped())break e;Ta(o,m,L),i=y}}}if(al)throw e=Ps,al=!1,Ps=null,e}function Re(e,t){var n=t[lo];n===void 0&&(n=t[lo]=new Set);var l=e+"__bubble";n.has(l)||(La(t,e,2,!1),n.add(l))}function qs(e,t,n){var l=0;t&&(l|=4),La(n,e,l,t)}var Nl="_reactListening"+Math.random().toString(36).slice(2);function Dr(e){if(!e[Nl]){e[Nl]=!0,c.forEach(function(n){n!=="selectionchange"&&(yp.has(n)||qs(n,!1,e),qs(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Nl]||(t[Nl]=!0,qs("selectionchange",!1,t))}}function La(e,t,n,l){switch(ea(t)){case 1:var o=Ld;break;case 4:o=zd;break;default:o=As}n=o.bind(null,t,n,e),o=void 0,!Es||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),l?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Xs(e,t,n,l,o){var i=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var d=l.tag;if(d===3||d===4){var m=l.stateNode.containerInfo;if(m===o||m.nodeType===8&&m.parentNode===o)break;if(d===4)for(d=l.return;d!==null;){var y=d.tag;if((y===3||y===4)&&(y=d.stateNode.containerInfo,y===o||y.nodeType===8&&y.parentNode===o))return;d=d.return}for(;m!==null;){if(d=xn(m),d===null)return;if(y=d.tag,y===5||y===6){l=i=d;continue e}m=m.parentNode}}l=l.return}Oi(function(){var L=i,K=ks(n),H=[];e:{var $=Pa.get(e);if($!==void 0){var ne=bs,le=e;switch(e){case"keypress":if(vl(n)===0)break e;case"keydown":case"keyup":ne=Qd;break;case"focusin":le="focus",ne=Bs;break;case"focusout":le="blur",ne=Bs;break;case"beforeblur":case"afterblur":ne=Bs;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":ne=ra;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ne=Dd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ne=Gd;break;case ka:case Ca:case Na:ne=Md;break;case Ea:ne=Xd;break;case"scroll":ne=Id;break;case"wheel":ne=ep;break;case"copy":case"cut":case"paste":ne=Bd;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ne=sa}var oe=(t&4)!==0,Me=!oe&&e==="scroll",P=oe?$!==null?$+"Capture":null:$;oe=[];for(var N=L,T;N!==null;){T=N;var J=T.stateNode;if(T.tag===5&&J!==null&&(T=J,P!==null&&(J=yr(N,P),J!=null&&oe.push(Or(N,J,T)))),Me)break;N=N.return}0<oe.length&&($=new ne($,le,null,n,K),H.push({event:$,listeners:oe}))}}if((t&7)===0){e:{if($=e==="mouseover"||e==="pointerover",ne=e==="mouseout"||e==="pointerout",$&&n!==ws&&(le=n.relatedTarget||n.fromElement)&&(xn(le)||le[Mt]))break e;if((ne||$)&&($=K.window===K?K:($=K.ownerDocument)?$.defaultView||$.parentWindow:window,ne?(le=n.relatedTarget||n.toElement,ne=L,le=le?xn(le):null,le!==null&&(Me=yn(le),le!==Me||le.tag!==5&&le.tag!==6)&&(le=null)):(ne=null,le=L),ne!==le)){if(oe=ra,J="onMouseLeave",P="onMouseEnter",N="mouse",(e==="pointerout"||e==="pointerover")&&(oe=sa,J="onPointerLeave",P="onPointerEnter",N="pointer"),Me=ne==null?$:Yn(ne),T=le==null?$:Yn(le),$=new oe(J,N+"leave",ne,n,K),$.target=Me,$.relatedTarget=T,J=null,xn(K)===L&&(oe=new oe(P,N+"enter",le,n,K),oe.target=T,oe.relatedTarget=Me,J=oe),Me=J,ne&&le)t:{for(oe=ne,P=le,N=0,T=oe;T;T=Hn(T))N++;for(T=0,J=P;J;J=Hn(J))T++;for(;0<N-T;)oe=Hn(oe),N--;for(;0<T-N;)P=Hn(P),T--;for(;N--;){if(oe===P||P!==null&&oe===P.alternate)break t;oe=Hn(oe),P=Hn(P)}oe=null}else oe=null;ne!==null&&za(H,$,ne,oe,!1),le!==null&&Me!==null&&za(H,Me,le,oe,!0)}}e:{if($=L?Yn(L):window,ne=$.nodeName&&$.nodeName.toLowerCase(),ne==="select"||ne==="input"&&$.type==="file")var ie=ip;else if(da($))if(fa)ie=dp;else{ie=up;var de=ap}else(ne=$.nodeName)&&ne.toLowerCase()==="input"&&($.type==="checkbox"||$.type==="radio")&&(ie=cp);if(ie&&(ie=ie(e,L))){pa(H,ie,n,K);break e}de&&de(e,$,L),e==="focusout"&&(de=$._wrapperState)&&de.controlled&&$.type==="number"&&te($,"number",$.value)}switch(de=L?Yn(L):window,e){case"focusin":(da(de)||de.contentEditable==="true")&&(Kn=de,Hs=L,Ir=null);break;case"focusout":Ir=Hs=Kn=null;break;case"mousedown":Qs=!0;break;case"contextmenu":case"mouseup":case"dragend":Qs=!1,ja(H,n,K);break;case"selectionchange":if(hp)break;case"keydown":case"keyup":ja(H,n,K)}var pe;if(Ws)e:{switch(e){case"compositionstart":var fe="onCompositionStart";break e;case"compositionend":fe="onCompositionEnd";break e;case"compositionupdate":fe="onCompositionUpdate";break e}fe=void 0}else $n?ua(e,n)&&(fe="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(fe="onCompositionStart");fe&&(oa&&n.locale!=="ko"&&($n||fe!=="onCompositionStart"?fe==="onCompositionEnd"&&$n&&(pe=ta()):(qt=K,Os="value"in qt?qt.value:qt.textContent,$n=!0)),de=El(L,fe),0<de.length&&(fe=new la(fe,e,null,n,K),H.push({event:fe,listeners:de}),pe?fe.data=pe:(pe=ca(n),pe!==null&&(fe.data=pe)))),(pe=np?rp(e,n):lp(e,n))&&(L=El(L,"onBeforeInput"),0<L.length&&(K=new la("onBeforeInput","beforeinput",null,n,K),H.push({event:K,listeners:L}),K.data=pe))}Ra(H,t)})}function Or(e,t,n){return{instance:e,listener:t,currentTarget:n}}function El(e,t){for(var n=t+"Capture",l=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=yr(e,n),i!=null&&l.unshift(Or(e,i,o)),i=yr(e,t),i!=null&&l.push(Or(e,i,o))),e=e.return}return l}function Hn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function za(e,t,n,l,o){for(var i=t._reactName,d=[];n!==null&&n!==l;){var m=n,y=m.alternate,L=m.stateNode;if(y!==null&&y===l)break;m.tag===5&&L!==null&&(m=L,o?(y=yr(n,i),y!=null&&d.unshift(Or(n,y,m))):o||(y=yr(n,i),y!=null&&d.push(Or(n,y,m)))),n=n.return}d.length!==0&&e.push({event:t,listeners:d})}var xp=/\r\n?/g,vp=/\u0000|\uFFFD/g;function Ia(e){return(typeof e=="string"?e:""+e).replace(xp,`
38
- `).replace(vp,"")}function Pl(e,t,n){if(t=Ia(t),Ia(e)!==t&&n)throw Error(u(425))}function _l(){}var Zs=null,eo=null;function to(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var no=typeof setTimeout=="function"?setTimeout:void 0,Sp=typeof clearTimeout=="function"?clearTimeout:void 0,Aa=typeof Promise=="function"?Promise:void 0,jp=typeof queueMicrotask=="function"?queueMicrotask:typeof Aa<"u"?function(e){return Aa.resolve(null).then(e).catch(wp)}:no;function wp(e){setTimeout(function(){throw e})}function ro(e,t){var n=t,l=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(l===0){e.removeChild(o),Er(t);return}l--}else n!=="$"&&n!=="$?"&&n!=="$!"||l++;n=o}while(n);Er(t)}function Zt(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==="$?")break;if(t==="/$")return null}}return e}function Da(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Qn=Math.random().toString(36).slice(2),zt="__reactFiber$"+Qn,br="__reactProps$"+Qn,Mt="__reactContainer$"+Qn,lo="__reactEvents$"+Qn,kp="__reactListeners$"+Qn,Cp="__reactHandles$"+Qn;function xn(e){var t=e[zt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Mt]||n[zt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Da(e);e!==null;){if(n=e[zt])return n;e=Da(e)}return t}e=n,n=e.parentNode}return null}function Mr(e){return e=e[zt]||e[Mt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Yn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(u(33))}function Tl(e){return e[br]||null}var so=[],Jn=-1;function en(e){return{current:e}}function Le(e){0>Jn||(e.current=so[Jn],so[Jn]=null,Jn--)}function Te(e,t){Jn++,so[Jn]=e.current,e.current=t}var tn={},Je=en(tn),lt=en(!1),vn=tn;function Gn(e,t){var n=e.type.contextTypes;if(!n)return tn;var l=e.stateNode;if(l&&l.__reactInternalMemoizedUnmaskedChildContext===t)return l.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function st(e){return e=e.childContextTypes,e!=null}function Rl(){Le(lt),Le(Je)}function Oa(e,t,n){if(Je.current!==tn)throw Error(u(168));Te(Je,t),Te(lt,n)}function ba(e,t,n){var l=e.stateNode;if(t=t.childContextTypes,typeof l.getChildContext!="function")return n;l=l.getChildContext();for(var o in l)if(!(o in t))throw Error(u(108,Pe(e)||"Unknown",o));return D({},n,l)}function Ll(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||tn,vn=Je.current,Te(Je,e),Te(lt,lt.current),!0}function Ma(e,t,n){var l=e.stateNode;if(!l)throw Error(u(169));n?(e=ba(e,t,vn),l.__reactInternalMemoizedMergedChildContext=e,Le(lt),Le(Je),Te(Je,e)):Le(lt),Te(lt,n)}var Ft=null,zl=!1,oo=!1;function Fa(e){Ft===null?Ft=[e]:Ft.push(e)}function Np(e){zl=!0,Fa(e)}function nn(){if(!oo&&Ft!==null){oo=!0;var e=0,t=Ee;try{var n=Ft;for(Ee=1;e<n.length;e++){var l=n[e];do l=l(!0);while(l!==null)}Ft=null,zl=!1}catch(o){throw Ft!==null&&(Ft=Ft.slice(e+1)),Ui(_s,nn),o}finally{Ee=t,oo=!1}}return null}var qn=[],Xn=0,Il=null,Al=0,gt=[],yt=0,Sn=null,Bt=1,Ut="";function jn(e,t){qn[Xn++]=Al,qn[Xn++]=Il,Il=e,Al=t}function Ba(e,t,n){gt[yt++]=Bt,gt[yt++]=Ut,gt[yt++]=Sn,Sn=e;var l=Bt;e=Ut;var o=32-wt(l)-1;l&=~(1<<o),n+=1;var i=32-wt(t)+o;if(30<i){var d=o-o%5;i=(l&(1<<d)-1).toString(32),l>>=d,o-=d,Bt=1<<32-wt(t)+o|n<<o|l,Ut=i+e}else Bt=1<<i|n<<o|l,Ut=e}function io(e){e.return!==null&&(jn(e,1),Ba(e,1,0))}function ao(e){for(;e===Il;)Il=qn[--Xn],qn[Xn]=null,Al=qn[--Xn],qn[Xn]=null;for(;e===Sn;)Sn=gt[--yt],gt[yt]=null,Ut=gt[--yt],gt[yt]=null,Bt=gt[--yt],gt[yt]=null}var pt=null,ft=null,Ie=!1,Ct=null;function Ua(e,t){var n=jt(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Wa(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,pt=e,ft=Zt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,pt=e,ft=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Sn!==null?{id:Bt,overflow:Ut}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=jt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,pt=e,ft=null,!0):!1;default:return!1}}function uo(e){return(e.mode&1)!==0&&(e.flags&128)===0}function co(e){if(Ie){var t=ft;if(t){var n=t;if(!Wa(e,t)){if(uo(e))throw Error(u(418));t=Zt(n.nextSibling);var l=pt;t&&Wa(e,t)?Ua(l,n):(e.flags=e.flags&-4097|2,Ie=!1,pt=e)}}else{if(uo(e))throw Error(u(418));e.flags=e.flags&-4097|2,Ie=!1,pt=e}}}function $a(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;pt=e}function Dl(e){if(e!==pt)return!1;if(!Ie)return $a(e),Ie=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!to(e.type,e.memoizedProps)),t&&(t=ft)){if(uo(e))throw Ka(),Error(u(418));for(;t;)Ua(e,t),t=Zt(t.nextSibling)}if($a(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){ft=Zt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}ft=null}}else ft=pt?Zt(e.stateNode.nextSibling):null;return!0}function Ka(){for(var e=ft;e;)e=Zt(e.nextSibling)}function Zn(){ft=pt=null,Ie=!1}function po(e){Ct===null?Ct=[e]:Ct.push(e)}var Ep=G.ReactCurrentBatchConfig;function Fr(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(u(309));var l=n.stateNode}if(!l)throw Error(u(147,e));var o=l,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(d){var m=o.refs;d===null?delete m[i]:m[i]=d},t._stringRef=i,t)}if(typeof e!="string")throw Error(u(284));if(!n._owner)throw Error(u(290,e))}return e}function Ol(e,t){throw e=Object.prototype.toString.call(t),Error(u(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Va(e){var t=e._init;return t(e._payload)}function Ha(e){function t(P,N){if(e){var T=P.deletions;T===null?(P.deletions=[N],P.flags|=16):T.push(N)}}function n(P,N){if(!e)return null;for(;N!==null;)t(P,N),N=N.sibling;return null}function l(P,N){for(P=new Map;N!==null;)N.key!==null?P.set(N.key,N):P.set(N.index,N),N=N.sibling;return P}function o(P,N){return P=dn(P,N),P.index=0,P.sibling=null,P}function i(P,N,T){return P.index=T,e?(T=P.alternate,T!==null?(T=T.index,T<N?(P.flags|=2,N):T):(P.flags|=2,N)):(P.flags|=1048576,N)}function d(P){return e&&P.alternate===null&&(P.flags|=2),P}function m(P,N,T,J){return N===null||N.tag!==6?(N=ri(T,P.mode,J),N.return=P,N):(N=o(N,T),N.return=P,N)}function y(P,N,T,J){var ie=T.type;return ie===ee?K(P,N,T.props.children,J,T.key):N!==null&&(N.elementType===ie||typeof ie=="object"&&ie!==null&&ie.$$typeof===ge&&Va(ie)===N.type)?(J=o(N,T.props),J.ref=Fr(P,N,T),J.return=P,J):(J=os(T.type,T.key,T.props,null,P.mode,J),J.ref=Fr(P,N,T),J.return=P,J)}function L(P,N,T,J){return N===null||N.tag!==4||N.stateNode.containerInfo!==T.containerInfo||N.stateNode.implementation!==T.implementation?(N=li(T,P.mode,J),N.return=P,N):(N=o(N,T.children||[]),N.return=P,N)}function K(P,N,T,J,ie){return N===null||N.tag!==7?(N=Tn(T,P.mode,J,ie),N.return=P,N):(N=o(N,T),N.return=P,N)}function H(P,N,T){if(typeof N=="string"&&N!==""||typeof N=="number")return N=ri(""+N,P.mode,T),N.return=P,N;if(typeof N=="object"&&N!==null){switch(N.$$typeof){case Y:return T=os(N.type,N.key,N.props,null,P.mode,T),T.ref=Fr(P,null,N),T.return=P,T;case M:return N=li(N,P.mode,T),N.return=P,N;case ge:var J=N._init;return H(P,J(N._payload),T)}if(X(N)||q(N))return N=Tn(N,P.mode,T,null),N.return=P,N;Ol(P,N)}return null}function $(P,N,T,J){var ie=N!==null?N.key:null;if(typeof T=="string"&&T!==""||typeof T=="number")return ie!==null?null:m(P,N,""+T,J);if(typeof T=="object"&&T!==null){switch(T.$$typeof){case Y:return T.key===ie?y(P,N,T,J):null;case M:return T.key===ie?L(P,N,T,J):null;case ge:return ie=T._init,$(P,N,ie(T._payload),J)}if(X(T)||q(T))return ie!==null?null:K(P,N,T,J,null);Ol(P,T)}return null}function ne(P,N,T,J,ie){if(typeof J=="string"&&J!==""||typeof J=="number")return P=P.get(T)||null,m(N,P,""+J,ie);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case Y:return P=P.get(J.key===null?T:J.key)||null,y(N,P,J,ie);case M:return P=P.get(J.key===null?T:J.key)||null,L(N,P,J,ie);case ge:var de=J._init;return ne(P,N,T,de(J._payload),ie)}if(X(J)||q(J))return P=P.get(T)||null,K(N,P,J,ie,null);Ol(N,J)}return null}function le(P,N,T,J){for(var ie=null,de=null,pe=N,fe=N=0,Ve=null;pe!==null&&fe<T.length;fe++){pe.index>fe?(Ve=pe,pe=null):Ve=pe.sibling;var ke=$(P,pe,T[fe],J);if(ke===null){pe===null&&(pe=Ve);break}e&&pe&&ke.alternate===null&&t(P,pe),N=i(ke,N,fe),de===null?ie=ke:de.sibling=ke,de=ke,pe=Ve}if(fe===T.length)return n(P,pe),Ie&&jn(P,fe),ie;if(pe===null){for(;fe<T.length;fe++)pe=H(P,T[fe],J),pe!==null&&(N=i(pe,N,fe),de===null?ie=pe:de.sibling=pe,de=pe);return Ie&&jn(P,fe),ie}for(pe=l(P,pe);fe<T.length;fe++)Ve=ne(pe,P,fe,T[fe],J),Ve!==null&&(e&&Ve.alternate!==null&&pe.delete(Ve.key===null?fe:Ve.key),N=i(Ve,N,fe),de===null?ie=Ve:de.sibling=Ve,de=Ve);return e&&pe.forEach(function(pn){return t(P,pn)}),Ie&&jn(P,fe),ie}function oe(P,N,T,J){var ie=q(T);if(typeof ie!="function")throw Error(u(150));if(T=ie.call(T),T==null)throw Error(u(151));for(var de=ie=null,pe=N,fe=N=0,Ve=null,ke=T.next();pe!==null&&!ke.done;fe++,ke=T.next()){pe.index>fe?(Ve=pe,pe=null):Ve=pe.sibling;var pn=$(P,pe,ke.value,J);if(pn===null){pe===null&&(pe=Ve);break}e&&pe&&pn.alternate===null&&t(P,pe),N=i(pn,N,fe),de===null?ie=pn:de.sibling=pn,de=pn,pe=Ve}if(ke.done)return n(P,pe),Ie&&jn(P,fe),ie;if(pe===null){for(;!ke.done;fe++,ke=T.next())ke=H(P,ke.value,J),ke!==null&&(N=i(ke,N,fe),de===null?ie=ke:de.sibling=ke,de=ke);return Ie&&jn(P,fe),ie}for(pe=l(P,pe);!ke.done;fe++,ke=T.next())ke=ne(pe,P,fe,ke.value,J),ke!==null&&(e&&ke.alternate!==null&&pe.delete(ke.key===null?fe:ke.key),N=i(ke,N,fe),de===null?ie=ke:de.sibling=ke,de=ke);return e&&pe.forEach(function(sf){return t(P,sf)}),Ie&&jn(P,fe),ie}function Me(P,N,T,J){if(typeof T=="object"&&T!==null&&T.type===ee&&T.key===null&&(T=T.props.children),typeof T=="object"&&T!==null){switch(T.$$typeof){case Y:e:{for(var ie=T.key,de=N;de!==null;){if(de.key===ie){if(ie=T.type,ie===ee){if(de.tag===7){n(P,de.sibling),N=o(de,T.props.children),N.return=P,P=N;break e}}else if(de.elementType===ie||typeof ie=="object"&&ie!==null&&ie.$$typeof===ge&&Va(ie)===de.type){n(P,de.sibling),N=o(de,T.props),N.ref=Fr(P,de,T),N.return=P,P=N;break e}n(P,de);break}else t(P,de);de=de.sibling}T.type===ee?(N=Tn(T.props.children,P.mode,J,T.key),N.return=P,P=N):(J=os(T.type,T.key,T.props,null,P.mode,J),J.ref=Fr(P,N,T),J.return=P,P=J)}return d(P);case M:e:{for(de=T.key;N!==null;){if(N.key===de)if(N.tag===4&&N.stateNode.containerInfo===T.containerInfo&&N.stateNode.implementation===T.implementation){n(P,N.sibling),N=o(N,T.children||[]),N.return=P,P=N;break e}else{n(P,N);break}else t(P,N);N=N.sibling}N=li(T,P.mode,J),N.return=P,P=N}return d(P);case ge:return de=T._init,Me(P,N,de(T._payload),J)}if(X(T))return le(P,N,T,J);if(q(T))return oe(P,N,T,J);Ol(P,T)}return typeof T=="string"&&T!==""||typeof T=="number"?(T=""+T,N!==null&&N.tag===6?(n(P,N.sibling),N=o(N,T),N.return=P,P=N):(n(P,N),N=ri(T,P.mode,J),N.return=P,P=N),d(P)):n(P,N)}return Me}var er=Ha(!0),Qa=Ha(!1),bl=en(null),Ml=null,tr=null,fo=null;function ho(){fo=tr=Ml=null}function mo(e){var t=bl.current;Le(bl),e._currentValue=t}function go(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 nr(e,t){Ml=e,fo=tr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(ot=!0),e.firstContext=null)}function xt(e){var t=e._currentValue;if(fo!==e)if(e={context:e,memoizedValue:t,next:null},tr===null){if(Ml===null)throw Error(u(308));tr=e,Ml.dependencies={lanes:0,firstContext:e}}else tr=tr.next=e;return t}var wn=null;function yo(e){wn===null?wn=[e]:wn.push(e)}function Ya(e,t,n,l){var o=t.interleaved;return o===null?(n.next=n,yo(t)):(n.next=o.next,o.next=n),t.interleaved=n,Wt(e,l)}function Wt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var rn=!1;function xo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ja(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function $t(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ln(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(we&2)!==0){var o=l.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),l.pending=t,Wt(e,n)}return o=l.interleaved,o===null?(t.next=t,yo(l)):(t.next=o.next,o.next=t),l.interleaved=t,Wt(e,n)}function Fl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,Ls(e,n)}}function Ga(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var d={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=d:i=i.next=d,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:l.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:l.shared,effects:l.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Bl(e,t,n,l){var o=e.updateQueue;rn=!1;var i=o.firstBaseUpdate,d=o.lastBaseUpdate,m=o.shared.pending;if(m!==null){o.shared.pending=null;var y=m,L=y.next;y.next=null,d===null?i=L:d.next=L,d=y;var K=e.alternate;K!==null&&(K=K.updateQueue,m=K.lastBaseUpdate,m!==d&&(m===null?K.firstBaseUpdate=L:m.next=L,K.lastBaseUpdate=y))}if(i!==null){var H=o.baseState;d=0,K=L=y=null,m=i;do{var $=m.lane,ne=m.eventTime;if((l&$)===$){K!==null&&(K=K.next={eventTime:ne,lane:0,tag:m.tag,payload:m.payload,callback:m.callback,next:null});e:{var le=e,oe=m;switch($=t,ne=n,oe.tag){case 1:if(le=oe.payload,typeof le=="function"){H=le.call(ne,H,$);break e}H=le;break e;case 3:le.flags=le.flags&-65537|128;case 0:if(le=oe.payload,$=typeof le=="function"?le.call(ne,H,$):le,$==null)break e;H=D({},H,$);break e;case 2:rn=!0}}m.callback!==null&&m.lane!==0&&(e.flags|=64,$=o.effects,$===null?o.effects=[m]:$.push(m))}else ne={eventTime:ne,lane:$,tag:m.tag,payload:m.payload,callback:m.callback,next:null},K===null?(L=K=ne,y=H):K=K.next=ne,d|=$;if(m=m.next,m===null){if(m=o.shared.pending,m===null)break;$=m,m=$.next,$.next=null,o.lastBaseUpdate=$,o.shared.pending=null}}while(!0);if(K===null&&(y=H),o.baseState=y,o.firstBaseUpdate=L,o.lastBaseUpdate=K,t=o.shared.interleaved,t!==null){o=t;do d|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);Nn|=d,e.lanes=d,e.memoizedState=H}}function qa(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var l=e[t],o=l.callback;if(o!==null){if(l.callback=null,l=n,typeof o!="function")throw Error(u(191,o));o.call(l)}}}var Br={},It=en(Br),Ur=en(Br),Wr=en(Br);function kn(e){if(e===Br)throw Error(u(174));return e}function vo(e,t){switch(Te(Wr,t),Te(Ur,e),Te(It,Br),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:On(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=On(t,e)}Le(It),Te(It,t)}function rr(){Le(It),Le(Ur),Le(Wr)}function Xa(e){kn(Wr.current);var t=kn(It.current),n=On(t,e.type);t!==n&&(Te(Ur,e),Te(It,n))}function So(e){Ur.current===e&&(Le(It),Le(Ur))}var Ae=en(0);function Ul(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)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 jo=[];function wo(){for(var e=0;e<jo.length;e++)jo[e]._workInProgressVersionPrimary=null;jo.length=0}var Wl=G.ReactCurrentDispatcher,ko=G.ReactCurrentBatchConfig,Cn=0,De=null,Ue=null,$e=null,$l=!1,$r=!1,Kr=0,Pp=0;function Ge(){throw Error(u(321))}function Co(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!kt(e[n],t[n]))return!1;return!0}function No(e,t,n,l,o,i){if(Cn=i,De=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Wl.current=e===null||e.memoizedState===null?Lp:zp,e=n(l,o),$r){i=0;do{if($r=!1,Kr=0,25<=i)throw Error(u(301));i+=1,$e=Ue=null,t.updateQueue=null,Wl.current=Ip,e=n(l,o)}while($r)}if(Wl.current=Hl,t=Ue!==null&&Ue.next!==null,Cn=0,$e=Ue=De=null,$l=!1,t)throw Error(u(300));return e}function Eo(){var e=Kr!==0;return Kr=0,e}function At(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $e===null?De.memoizedState=$e=e:$e=$e.next=e,$e}function vt(){if(Ue===null){var e=De.alternate;e=e!==null?e.memoizedState:null}else e=Ue.next;var t=$e===null?De.memoizedState:$e.next;if(t!==null)$e=t,Ue=e;else{if(e===null)throw Error(u(310));Ue=e,e={memoizedState:Ue.memoizedState,baseState:Ue.baseState,baseQueue:Ue.baseQueue,queue:Ue.queue,next:null},$e===null?De.memoizedState=$e=e:$e=$e.next=e}return $e}function Vr(e,t){return typeof t=="function"?t(e):t}function Po(e){var t=vt(),n=t.queue;if(n===null)throw Error(u(311));n.lastRenderedReducer=e;var l=Ue,o=l.baseQueue,i=n.pending;if(i!==null){if(o!==null){var d=o.next;o.next=i.next,i.next=d}l.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,l=l.baseState;var m=d=null,y=null,L=i;do{var K=L.lane;if((Cn&K)===K)y!==null&&(y=y.next={lane:0,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null}),l=L.hasEagerState?L.eagerState:e(l,L.action);else{var H={lane:K,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null};y===null?(m=y=H,d=l):y=y.next=H,De.lanes|=K,Nn|=K}L=L.next}while(L!==null&&L!==i);y===null?d=l:y.next=m,kt(l,t.memoizedState)||(ot=!0),t.memoizedState=l,t.baseState=d,t.baseQueue=y,n.lastRenderedState=l}if(e=n.interleaved,e!==null){o=e;do i=o.lane,De.lanes|=i,Nn|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function _o(e){var t=vt(),n=t.queue;if(n===null)throw Error(u(311));n.lastRenderedReducer=e;var l=n.dispatch,o=n.pending,i=t.memoizedState;if(o!==null){n.pending=null;var d=o=o.next;do i=e(i,d.action),d=d.next;while(d!==o);kt(i,t.memoizedState)||(ot=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,l]}function Za(){}function eu(e,t){var n=De,l=vt(),o=t(),i=!kt(l.memoizedState,o);if(i&&(l.memoizedState=o,ot=!0),l=l.queue,To(ru.bind(null,n,l,e),[e]),l.getSnapshot!==t||i||$e!==null&&$e.memoizedState.tag&1){if(n.flags|=2048,Hr(9,nu.bind(null,n,l,o,t),void 0,null),Ke===null)throw Error(u(349));(Cn&30)!==0||tu(n,t,o)}return o}function tu(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=De.updateQueue,t===null?(t={lastEffect:null,stores:null},De.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function nu(e,t,n,l){t.value=n,t.getSnapshot=l,lu(t)&&su(e)}function ru(e,t,n){return n(function(){lu(t)&&su(e)})}function lu(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!kt(e,n)}catch{return!0}}function su(e){var t=Wt(e,1);t!==null&&_t(t,e,1,-1)}function ou(e){var t=At();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Vr,lastRenderedState:e},t.queue=e,e=e.dispatch=Rp.bind(null,De,e),[t.memoizedState,e]}function Hr(e,t,n,l){return e={tag:e,create:t,destroy:n,deps:l,next:null},t=De.updateQueue,t===null?(t={lastEffect:null,stores:null},De.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(l=n.next,n.next=e,e.next=l,t.lastEffect=e)),e}function iu(){return vt().memoizedState}function Kl(e,t,n,l){var o=At();De.flags|=e,o.memoizedState=Hr(1|t,n,void 0,l===void 0?null:l)}function Vl(e,t,n,l){var o=vt();l=l===void 0?null:l;var i=void 0;if(Ue!==null){var d=Ue.memoizedState;if(i=d.destroy,l!==null&&Co(l,d.deps)){o.memoizedState=Hr(t,n,i,l);return}}De.flags|=e,o.memoizedState=Hr(1|t,n,i,l)}function au(e,t){return Kl(8390656,8,e,t)}function To(e,t){return Vl(2048,8,e,t)}function uu(e,t){return Vl(4,2,e,t)}function cu(e,t){return Vl(4,4,e,t)}function du(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function pu(e,t,n){return n=n!=null?n.concat([e]):null,Vl(4,4,du.bind(null,t,e),n)}function Ro(){}function fu(e,t){var n=vt();t=t===void 0?null:t;var l=n.memoizedState;return l!==null&&t!==null&&Co(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function hu(e,t){var n=vt();t=t===void 0?null:t;var l=n.memoizedState;return l!==null&&t!==null&&Co(t,l[1])?l[0]:(e=e(),n.memoizedState=[e,t],e)}function mu(e,t,n){return(Cn&21)===0?(e.baseState&&(e.baseState=!1,ot=!0),e.memoizedState=n):(kt(n,t)||(n=Vi(),De.lanes|=n,Nn|=n,e.baseState=!0),t)}function _p(e,t){var n=Ee;Ee=n!==0&&4>n?n:4,e(!0);var l=ko.transition;ko.transition={};try{e(!1),t()}finally{Ee=n,ko.transition=l}}function gu(){return vt().memoizedState}function Tp(e,t,n){var l=un(e);if(n={lane:l,action:n,hasEagerState:!1,eagerState:null,next:null},yu(e))xu(t,n);else if(n=Ya(e,t,n,l),n!==null){var o=nt();_t(n,e,l,o),vu(n,t,l)}}function Rp(e,t,n){var l=un(e),o={lane:l,action:n,hasEagerState:!1,eagerState:null,next:null};if(yu(e))xu(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var d=t.lastRenderedState,m=i(d,n);if(o.hasEagerState=!0,o.eagerState=m,kt(m,d)){var y=t.interleaved;y===null?(o.next=o,yo(t)):(o.next=y.next,y.next=o),t.interleaved=o;return}}catch{}finally{}n=Ya(e,t,o,l),n!==null&&(o=nt(),_t(n,e,l,o),vu(n,t,l))}}function yu(e){var t=e.alternate;return e===De||t!==null&&t===De}function xu(e,t){$r=$l=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function vu(e,t,n){if((n&4194240)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,Ls(e,n)}}var Hl={readContext:xt,useCallback:Ge,useContext:Ge,useEffect:Ge,useImperativeHandle:Ge,useInsertionEffect:Ge,useLayoutEffect:Ge,useMemo:Ge,useReducer:Ge,useRef:Ge,useState:Ge,useDebugValue:Ge,useDeferredValue:Ge,useTransition:Ge,useMutableSource:Ge,useSyncExternalStore:Ge,useId:Ge,unstable_isNewReconciler:!1},Lp={readContext:xt,useCallback:function(e,t){return At().memoizedState=[e,t===void 0?null:t],e},useContext:xt,useEffect:au,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Kl(4194308,4,du.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Kl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Kl(4,2,e,t)},useMemo:function(e,t){var n=At();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var l=At();return t=n!==void 0?n(t):t,l.memoizedState=l.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},l.queue=e,e=e.dispatch=Tp.bind(null,De,e),[l.memoizedState,e]},useRef:function(e){var t=At();return e={current:e},t.memoizedState=e},useState:ou,useDebugValue:Ro,useDeferredValue:function(e){return At().memoizedState=e},useTransition:function(){var e=ou(!1),t=e[0];return e=_p.bind(null,e[1]),At().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var l=De,o=At();if(Ie){if(n===void 0)throw Error(u(407));n=n()}else{if(n=t(),Ke===null)throw Error(u(349));(Cn&30)!==0||tu(l,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,au(ru.bind(null,l,i,e),[e]),l.flags|=2048,Hr(9,nu.bind(null,l,i,n,t),void 0,null),n},useId:function(){var e=At(),t=Ke.identifierPrefix;if(Ie){var n=Ut,l=Bt;n=(l&~(1<<32-wt(l)-1)).toString(32)+n,t=":"+t+"R"+n,n=Kr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Pp++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},zp={readContext:xt,useCallback:fu,useContext:xt,useEffect:To,useImperativeHandle:pu,useInsertionEffect:uu,useLayoutEffect:cu,useMemo:hu,useReducer:Po,useRef:iu,useState:function(){return Po(Vr)},useDebugValue:Ro,useDeferredValue:function(e){var t=vt();return mu(t,Ue.memoizedState,e)},useTransition:function(){var e=Po(Vr)[0],t=vt().memoizedState;return[e,t]},useMutableSource:Za,useSyncExternalStore:eu,useId:gu,unstable_isNewReconciler:!1},Ip={readContext:xt,useCallback:fu,useContext:xt,useEffect:To,useImperativeHandle:pu,useInsertionEffect:uu,useLayoutEffect:cu,useMemo:hu,useReducer:_o,useRef:iu,useState:function(){return _o(Vr)},useDebugValue:Ro,useDeferredValue:function(e){var t=vt();return Ue===null?t.memoizedState=e:mu(t,Ue.memoizedState,e)},useTransition:function(){var e=_o(Vr)[0],t=vt().memoizedState;return[e,t]},useMutableSource:Za,useSyncExternalStore:eu,useId:gu,unstable_isNewReconciler:!1};function Nt(e,t){if(e&&e.defaultProps){t=D({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Lo(e,t,n,l){t=e.memoizedState,n=n(l,t),n=n==null?t:D({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ql={isMounted:function(e){return(e=e._reactInternals)?yn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var l=nt(),o=un(e),i=$t(l,o);i.payload=t,n!=null&&(i.callback=n),t=ln(e,i,o),t!==null&&(_t(t,e,o,l),Fl(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=nt(),o=un(e),i=$t(l,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=ln(e,i,o),t!==null&&(_t(t,e,o,l),Fl(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=nt(),l=un(e),o=$t(n,l);o.tag=2,t!=null&&(o.callback=t),t=ln(e,o,l),t!==null&&(_t(t,e,l,n),Fl(t,e,l))}};function Su(e,t,n,l,o,i,d){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,i,d):t.prototype&&t.prototype.isPureReactComponent?!zr(n,l)||!zr(o,i):!0}function ju(e,t,n){var l=!1,o=tn,i=t.contextType;return typeof i=="object"&&i!==null?i=xt(i):(o=st(t)?vn:Je.current,l=t.contextTypes,i=(l=l!=null)?Gn(e,o):tn),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ql,e.stateNode=t,t._reactInternals=e,l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function wu(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&&Ql.enqueueReplaceState(t,t.state,null)}function zo(e,t,n,l){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},xo(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=xt(i):(i=st(t)?vn:Je.current,o.context=Gn(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Lo(e,t,i,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&Ql.enqueueReplaceState(o,o.state,null),Bl(e,n,o,l),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function lr(e,t){try{var n="",l=t;do n+=xe(l),l=l.return;while(l);var o=n}catch(i){o=`
39
- Error generating stack: `+i.message+`
40
- `+i.stack}return{value:e,source:t,stack:o,digest:null}}function Io(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ao(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Ap=typeof WeakMap=="function"?WeakMap:Map;function ku(e,t,n){n=$t(-1,n),n.tag=3,n.payload={element:null};var l=t.value;return n.callback=function(){es||(es=!0,Jo=l),Ao(e,t)},n}function Cu(e,t,n){n=$t(-1,n),n.tag=3;var l=e.type.getDerivedStateFromError;if(typeof l=="function"){var o=t.value;n.payload=function(){return l(o)},n.callback=function(){Ao(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Ao(e,t),typeof l!="function"&&(on===null?on=new Set([this]):on.add(this));var d=t.stack;this.componentDidCatch(t.value,{componentStack:d!==null?d:""})}),n}function Nu(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new Ap;var o=new Set;l.set(t,o)}else o=l.get(t),o===void 0&&(o=new Set,l.set(t,o));o.has(n)||(o.add(n),e=Yp.bind(null,e,t,n),t.then(e,e))}function Eu(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Pu(e,t,n,l,o){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=$t(-1,1),t.tag=2,ln(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=o,e)}var Dp=G.ReactCurrentOwner,ot=!1;function tt(e,t,n,l){t.child=e===null?Qa(t,null,n,l):er(t,e.child,n,l)}function _u(e,t,n,l,o){n=n.render;var i=t.ref;return nr(t,o),l=No(e,t,n,l,i,o),n=Eo(),e!==null&&!ot?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Kt(e,t,o)):(Ie&&n&&io(t),t.flags|=1,tt(e,t,l,o),t.child)}function Tu(e,t,n,l,o){if(e===null){var i=n.type;return typeof i=="function"&&!ni(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Ru(e,t,i,l,o)):(e=os(n.type,null,l,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,(e.lanes&o)===0){var d=i.memoizedProps;if(n=n.compare,n=n!==null?n:zr,n(d,l)&&e.ref===t.ref)return Kt(e,t,o)}return t.flags|=1,e=dn(i,l),e.ref=t.ref,e.return=t,t.child=e}function Ru(e,t,n,l,o){if(e!==null){var i=e.memoizedProps;if(zr(i,l)&&e.ref===t.ref)if(ot=!1,t.pendingProps=l=i,(e.lanes&o)!==0)(e.flags&131072)!==0&&(ot=!0);else return t.lanes=e.lanes,Kt(e,t,o)}return Do(e,t,n,l,o)}function Lu(e,t,n){var l=t.pendingProps,o=l.children,i=e!==null?e.memoizedState:null;if(l.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Te(or,ht),ht|=n;else{if((n&1073741824)===0)return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Te(or,ht),ht|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},l=i!==null?i.baseLanes:n,Te(or,ht),ht|=l}else i!==null?(l=i.baseLanes|n,t.memoizedState=null):l=n,Te(or,ht),ht|=l;return tt(e,t,o,n),t.child}function zu(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Do(e,t,n,l,o){var i=st(n)?vn:Je.current;return i=Gn(t,i),nr(t,o),n=No(e,t,n,l,i,o),l=Eo(),e!==null&&!ot?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Kt(e,t,o)):(Ie&&l&&io(t),t.flags|=1,tt(e,t,n,o),t.child)}function Iu(e,t,n,l,o){if(st(n)){var i=!0;Ll(t)}else i=!1;if(nr(t,o),t.stateNode===null)Jl(e,t),ju(t,n,l),zo(t,n,l,o),l=!0;else if(e===null){var d=t.stateNode,m=t.memoizedProps;d.props=m;var y=d.context,L=n.contextType;typeof L=="object"&&L!==null?L=xt(L):(L=st(n)?vn:Je.current,L=Gn(t,L));var K=n.getDerivedStateFromProps,H=typeof K=="function"||typeof d.getSnapshotBeforeUpdate=="function";H||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(m!==l||y!==L)&&wu(t,d,l,L),rn=!1;var $=t.memoizedState;d.state=$,Bl(t,l,d,o),y=t.memoizedState,m!==l||$!==y||lt.current||rn?(typeof K=="function"&&(Lo(t,n,K,l),y=t.memoizedState),(m=rn||Su(t,n,m,l,$,y,L))?(H||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=y),d.props=l,d.state=y,d.context=L,l=m):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{d=t.stateNode,Ja(e,t),m=t.memoizedProps,L=t.type===t.elementType?m:Nt(t.type,m),d.props=L,H=t.pendingProps,$=d.context,y=n.contextType,typeof y=="object"&&y!==null?y=xt(y):(y=st(n)?vn:Je.current,y=Gn(t,y));var ne=n.getDerivedStateFromProps;(K=typeof ne=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(m!==H||$!==y)&&wu(t,d,l,y),rn=!1,$=t.memoizedState,d.state=$,Bl(t,l,d,o);var le=t.memoizedState;m!==H||$!==le||lt.current||rn?(typeof ne=="function"&&(Lo(t,n,ne,l),le=t.memoizedState),(L=rn||Su(t,n,L,l,$,le,y)||!1)?(K||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(l,le,y),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(l,le,y)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||m===e.memoizedProps&&$===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&$===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=le),d.props=l,d.state=le,d.context=y,l=L):(typeof d.componentDidUpdate!="function"||m===e.memoizedProps&&$===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&$===e.memoizedState||(t.flags|=1024),l=!1)}return Oo(e,t,n,l,i,o)}function Oo(e,t,n,l,o,i){zu(e,t);var d=(t.flags&128)!==0;if(!l&&!d)return o&&Ma(t,n,!1),Kt(e,t,i);l=t.stateNode,Dp.current=t;var m=d&&typeof n.getDerivedStateFromError!="function"?null:l.render();return t.flags|=1,e!==null&&d?(t.child=er(t,e.child,null,i),t.child=er(t,null,m,i)):tt(e,t,m,i),t.memoizedState=l.state,o&&Ma(t,n,!0),t.child}function Au(e){var t=e.stateNode;t.pendingContext?Oa(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Oa(e,t.context,!1),vo(e,t.containerInfo)}function Du(e,t,n,l,o){return Zn(),po(o),t.flags|=256,tt(e,t,n,l),t.child}var bo={dehydrated:null,treeContext:null,retryLane:0};function Mo(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ou(e,t,n){var l=t.pendingProps,o=Ae.current,i=!1,d=(t.flags&128)!==0,m;if((m=d)||(m=e!==null&&e.memoizedState===null?!1:(o&2)!==0),m?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),Te(Ae,o&1),e===null)return co(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(d=l.children,e=l.fallback,i?(l=t.mode,i=t.child,d={mode:"hidden",children:d},(l&1)===0&&i!==null?(i.childLanes=0,i.pendingProps=d):i=is(d,l,0,null),e=Tn(e,l,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Mo(n),t.memoizedState=bo,e):Fo(t,d));if(o=e.memoizedState,o!==null&&(m=o.dehydrated,m!==null))return Op(e,t,d,l,m,o,n);if(i){i=l.fallback,d=t.mode,o=e.child,m=o.sibling;var y={mode:"hidden",children:l.children};return(d&1)===0&&t.child!==o?(l=t.child,l.childLanes=0,l.pendingProps=y,t.deletions=null):(l=dn(o,y),l.subtreeFlags=o.subtreeFlags&14680064),m!==null?i=dn(m,i):(i=Tn(i,d,n,null),i.flags|=2),i.return=t,l.return=t,l.sibling=i,t.child=l,l=i,i=t.child,d=e.child.memoizedState,d=d===null?Mo(n):{baseLanes:d.baseLanes|n,cachePool:null,transitions:d.transitions},i.memoizedState=d,i.childLanes=e.childLanes&~n,t.memoizedState=bo,l}return i=e.child,e=i.sibling,l=dn(i,{mode:"visible",children:l.children}),(t.mode&1)===0&&(l.lanes=n),l.return=t,l.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=l,t.memoizedState=null,l}function Fo(e,t){return t=is({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Yl(e,t,n,l){return l!==null&&po(l),er(t,e.child,null,n),e=Fo(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Op(e,t,n,l,o,i,d){if(n)return t.flags&256?(t.flags&=-257,l=Io(Error(u(422))),Yl(e,t,d,l)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=l.fallback,o=t.mode,l=is({mode:"visible",children:l.children},o,0,null),i=Tn(i,o,d,null),i.flags|=2,l.return=t,i.return=t,l.sibling=i,t.child=l,(t.mode&1)!==0&&er(t,e.child,null,d),t.child.memoizedState=Mo(d),t.memoizedState=bo,i);if((t.mode&1)===0)return Yl(e,t,d,null);if(o.data==="$!"){if(l=o.nextSibling&&o.nextSibling.dataset,l)var m=l.dgst;return l=m,i=Error(u(419)),l=Io(i,l,void 0),Yl(e,t,d,l)}if(m=(d&e.childLanes)!==0,ot||m){if(l=Ke,l!==null){switch(d&-d){case 4:o=2;break;case 16:o=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=(o&(l.suspendedLanes|d))!==0?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,Wt(e,o),_t(l,e,o,-1))}return ti(),l=Io(Error(u(421))),Yl(e,t,d,l)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=Jp.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,ft=Zt(o.nextSibling),pt=t,Ie=!0,Ct=null,e!==null&&(gt[yt++]=Bt,gt[yt++]=Ut,gt[yt++]=Sn,Bt=e.id,Ut=e.overflow,Sn=t),t=Fo(t,l.children),t.flags|=4096,t)}function bu(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),go(e.return,t,n)}function Bo(e,t,n,l,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=l,i.tail=n,i.tailMode=o)}function Mu(e,t,n){var l=t.pendingProps,o=l.revealOrder,i=l.tail;if(tt(e,t,l.children,n),l=Ae.current,(l&2)!==0)l=l&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&bu(e,n,t);else if(e.tag===19)bu(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}l&=1}if(Te(Ae,l),(t.mode&1)===0)t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&Ul(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Bo(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Ul(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Bo(t,!0,n,null,i);break;case"together":Bo(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Jl(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Kt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Nn|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(u(153));if(t.child!==null){for(e=t.child,n=dn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=dn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function bp(e,t,n){switch(t.tag){case 3:Au(t),Zn();break;case 5:Xa(t);break;case 1:st(t.type)&&Ll(t);break;case 4:vo(t,t.stateNode.containerInfo);break;case 10:var l=t.type._context,o=t.memoizedProps.value;Te(bl,l._currentValue),l._currentValue=o;break;case 13:if(l=t.memoizedState,l!==null)return l.dehydrated!==null?(Te(Ae,Ae.current&1),t.flags|=128,null):(n&t.child.childLanes)!==0?Ou(e,t,n):(Te(Ae,Ae.current&1),e=Kt(e,t,n),e!==null?e.sibling:null);Te(Ae,Ae.current&1);break;case 19:if(l=(n&t.childLanes)!==0,(e.flags&128)!==0){if(l)return Mu(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Te(Ae,Ae.current),l)break;return null;case 22:case 23:return t.lanes=0,Lu(e,t,n)}return Kt(e,t,n)}var Fu,Uo,Bu,Uu;Fu=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Uo=function(){},Bu=function(e,t,n,l){var o=e.memoizedProps;if(o!==l){e=t.stateNode,kn(It.current);var i=null;switch(n){case"input":o=fr(e,o),l=fr(e,l),i=[];break;case"select":o=D({},o,{value:void 0}),l=D({},l,{value:void 0}),i=[];break;case"textarea":o=Dn(e,o),l=Dn(e,l),i=[];break;default:typeof o.onClick!="function"&&typeof l.onClick=="function"&&(e.onclick=_l)}Ss(n,l);var d;n=null;for(L in o)if(!l.hasOwnProperty(L)&&o.hasOwnProperty(L)&&o[L]!=null)if(L==="style"){var m=o[L];for(d in m)m.hasOwnProperty(d)&&(n||(n={}),n[d]="")}else L!=="dangerouslySetInnerHTML"&&L!=="children"&&L!=="suppressContentEditableWarning"&&L!=="suppressHydrationWarning"&&L!=="autoFocus"&&(f.hasOwnProperty(L)?i||(i=[]):(i=i||[]).push(L,null));for(L in l){var y=l[L];if(m=o!=null?o[L]:void 0,l.hasOwnProperty(L)&&y!==m&&(y!=null||m!=null))if(L==="style")if(m){for(d in m)!m.hasOwnProperty(d)||y&&y.hasOwnProperty(d)||(n||(n={}),n[d]="");for(d in y)y.hasOwnProperty(d)&&m[d]!==y[d]&&(n||(n={}),n[d]=y[d])}else n||(i||(i=[]),i.push(L,n)),n=y;else L==="dangerouslySetInnerHTML"?(y=y?y.__html:void 0,m=m?m.__html:void 0,y!=null&&m!==y&&(i=i||[]).push(L,y)):L==="children"?typeof y!="string"&&typeof y!="number"||(i=i||[]).push(L,""+y):L!=="suppressContentEditableWarning"&&L!=="suppressHydrationWarning"&&(f.hasOwnProperty(L)?(y!=null&&L==="onScroll"&&Re("scroll",e),i||m===y||(i=[])):(i=i||[]).push(L,y))}n&&(i=i||[]).push("style",n);var L=i;(t.updateQueue=L)&&(t.flags|=4)}},Uu=function(e,t,n,l){n!==l&&(t.flags|=4)};function Qr(e,t){if(!Ie)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 qe(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,l=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,l|=o.subtreeFlags&14680064,l|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,l|=o.subtreeFlags,l|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=l,e.childLanes=n,t}function Mp(e,t,n){var l=t.pendingProps;switch(ao(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qe(t),null;case 1:return st(t.type)&&Rl(),qe(t),null;case 3:return l=t.stateNode,rr(),Le(lt),Le(Je),wo(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Dl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Ct!==null&&(Xo(Ct),Ct=null))),Uo(e,t),qe(t),null;case 5:So(t);var o=kn(Wr.current);if(n=t.type,e!==null&&t.stateNode!=null)Bu(e,t,n,l,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!l){if(t.stateNode===null)throw Error(u(166));return qe(t),null}if(e=kn(It.current),Dl(t)){l=t.stateNode,n=t.type;var i=t.memoizedProps;switch(l[zt]=t,l[br]=i,e=(t.mode&1)!==0,n){case"dialog":Re("cancel",l),Re("close",l);break;case"iframe":case"object":case"embed":Re("load",l);break;case"video":case"audio":for(o=0;o<Ar.length;o++)Re(Ar[o],l);break;case"source":Re("error",l);break;case"img":case"image":case"link":Re("error",l),Re("load",l);break;case"details":Re("toggle",l);break;case"input":hr(l,i),Re("invalid",l);break;case"select":l._wrapperState={wasMultiple:!!i.multiple},Re("invalid",l);break;case"textarea":mt(l,i),Re("invalid",l)}Ss(n,i),o=null;for(var d in i)if(i.hasOwnProperty(d)){var m=i[d];d==="children"?typeof m=="string"?l.textContent!==m&&(i.suppressHydrationWarning!==!0&&Pl(l.textContent,m,e),o=["children",m]):typeof m=="number"&&l.textContent!==""+m&&(i.suppressHydrationWarning!==!0&&Pl(l.textContent,m,e),o=["children",""+m]):f.hasOwnProperty(d)&&m!=null&&d==="onScroll"&&Re("scroll",l)}switch(n){case"input":gn(l),Z(l,i,!0);break;case"textarea":gn(l),ll(l);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(l.onclick=_l)}l=o,t.updateQueue=l,l!==null&&(t.flags|=4)}else{d=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=gr(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=d.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof l.is=="string"?e=d.createElement(n,{is:l.is}):(e=d.createElement(n),n==="select"&&(d=e,l.multiple?d.multiple=!0:l.size&&(d.size=l.size))):e=d.createElementNS(e,n),e[zt]=t,e[br]=l,Fu(e,t,!1,!1),t.stateNode=e;e:{switch(d=js(n,l),n){case"dialog":Re("cancel",e),Re("close",e),o=l;break;case"iframe":case"object":case"embed":Re("load",e),o=l;break;case"video":case"audio":for(o=0;o<Ar.length;o++)Re(Ar[o],e);o=l;break;case"source":Re("error",e),o=l;break;case"img":case"image":case"link":Re("error",e),Re("load",e),o=l;break;case"details":Re("toggle",e),o=l;break;case"input":hr(e,l),o=fr(e,l),Re("invalid",e);break;case"option":o=l;break;case"select":e._wrapperState={wasMultiple:!!l.multiple},o=D({},l,{value:void 0}),Re("invalid",e);break;case"textarea":mt(e,l),o=Dn(e,l),Re("invalid",e);break;default:o=l}Ss(n,o),m=o;for(i in m)if(m.hasOwnProperty(i)){var y=m[i];i==="style"?Ri(e,y):i==="dangerouslySetInnerHTML"?(y=y?y.__html:void 0,y!=null&&sl(e,y)):i==="children"?typeof y=="string"?(n!=="textarea"||y!=="")&&Ne(e,y):typeof y=="number"&&Ne(e,""+y):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(f.hasOwnProperty(i)?y!=null&&i==="onScroll"&&Re("scroll",e):y!=null&&W(e,i,y,d))}switch(n){case"input":gn(e),Z(e,l,!1);break;case"textarea":gn(e),ll(e);break;case"option":l.value!=null&&e.setAttribute("value",""+Ce(l.value));break;case"select":e.multiple=!!l.multiple,i=l.value,i!=null?ze(e,!!l.multiple,i,!1):l.defaultValue!=null&&ze(e,!!l.multiple,l.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=_l)}switch(n){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}}l&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return qe(t),null;case 6:if(e&&t.stateNode!=null)Uu(e,t,e.memoizedProps,l);else{if(typeof l!="string"&&t.stateNode===null)throw Error(u(166));if(n=kn(Wr.current),kn(It.current),Dl(t)){if(l=t.stateNode,n=t.memoizedProps,l[zt]=t,(i=l.nodeValue!==n)&&(e=pt,e!==null))switch(e.tag){case 3:Pl(l.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Pl(l.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else l=(n.nodeType===9?n:n.ownerDocument).createTextNode(l),l[zt]=t,t.stateNode=l}return qe(t),null;case 13:if(Le(Ae),l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ie&&ft!==null&&(t.mode&1)!==0&&(t.flags&128)===0)Ka(),Zn(),t.flags|=98560,i=!1;else if(i=Dl(t),l!==null&&l.dehydrated!==null){if(e===null){if(!i)throw Error(u(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(u(317));i[zt]=t}else Zn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;qe(t),i=!1}else Ct!==null&&(Xo(Ct),Ct=null),i=!0;if(!i)return t.flags&65536?t:null}return(t.flags&128)!==0?(t.lanes=n,t):(l=l!==null,l!==(e!==null&&e.memoizedState!==null)&&l&&(t.child.flags|=8192,(t.mode&1)!==0&&(e===null||(Ae.current&1)!==0?We===0&&(We=3):ti())),t.updateQueue!==null&&(t.flags|=4),qe(t),null);case 4:return rr(),Uo(e,t),e===null&&Dr(t.stateNode.containerInfo),qe(t),null;case 10:return mo(t.type._context),qe(t),null;case 17:return st(t.type)&&Rl(),qe(t),null;case 19:if(Le(Ae),i=t.memoizedState,i===null)return qe(t),null;if(l=(t.flags&128)!==0,d=i.rendering,d===null)if(l)Qr(i,!1);else{if(We!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=Ul(e),d!==null){for(t.flags|=128,Qr(i,!1),l=d.updateQueue,l!==null&&(t.updateQueue=l,t.flags|=4),t.subtreeFlags=0,l=n,n=t.child;n!==null;)i=n,e=l,i.flags&=14680066,d=i.alternate,d===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=d.childLanes,i.lanes=d.lanes,i.child=d.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=d.memoizedProps,i.memoizedState=d.memoizedState,i.updateQueue=d.updateQueue,i.type=d.type,e=d.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Te(Ae,Ae.current&1|2),t.child}e=e.sibling}i.tail!==null&&be()>ir&&(t.flags|=128,l=!0,Qr(i,!1),t.lanes=4194304)}else{if(!l)if(e=Ul(d),e!==null){if(t.flags|=128,l=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Qr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!d.alternate&&!Ie)return qe(t),null}else 2*be()-i.renderingStartTime>ir&&n!==1073741824&&(t.flags|=128,l=!0,Qr(i,!1),t.lanes=4194304);i.isBackwards?(d.sibling=t.child,t.child=d):(n=i.last,n!==null?n.sibling=d:t.child=d,i.last=d)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=be(),t.sibling=null,n=Ae.current,Te(Ae,l?n&1|2:n&1),t):(qe(t),null);case 22:case 23:return ei(),l=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==l&&(t.flags|=8192),l&&(t.mode&1)!==0?(ht&1073741824)!==0&&(qe(t),t.subtreeFlags&6&&(t.flags|=8192)):qe(t),null;case 24:return null;case 25:return null}throw Error(u(156,t.tag))}function Fp(e,t){switch(ao(t),t.tag){case 1:return st(t.type)&&Rl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return rr(),Le(lt),Le(Je),wo(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return So(t),null;case 13:if(Le(Ae),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));Zn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Le(Ae),null;case 4:return rr(),null;case 10:return mo(t.type._context),null;case 22:case 23:return ei(),null;case 24:return null;default:return null}}var Gl=!1,Xe=!1,Bp=typeof WeakSet=="function"?WeakSet:Set,re=null;function sr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(l){Oe(e,t,l)}else n.current=null}function Wo(e,t,n){try{n()}catch(l){Oe(e,t,l)}}var Wu=!1;function Up(e,t){if(Zs=gl,e=Sa(),Vs(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 o=l.anchorOffset,i=l.focusNode;l=l.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var d=0,m=-1,y=-1,L=0,K=0,H=e,$=null;t:for(;;){for(var ne;H!==n||o!==0&&H.nodeType!==3||(m=d+o),H!==i||l!==0&&H.nodeType!==3||(y=d+l),H.nodeType===3&&(d+=H.nodeValue.length),(ne=H.firstChild)!==null;)$=H,H=ne;for(;;){if(H===e)break t;if($===n&&++L===o&&(m=d),$===i&&++K===l&&(y=d),(ne=H.nextSibling)!==null)break;H=$,$=H.parentNode}H=ne}n=m===-1||y===-1?null:{start:m,end:y}}else n=null}n=n||{start:0,end:0}}else n=null;for(eo={focusedElem:e,selectionRange:n},gl=!1,re=t;re!==null;)if(t=re,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,re=e;else for(;re!==null;){t=re;try{var le=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(le!==null){var oe=le.memoizedProps,Me=le.memoizedState,P=t.stateNode,N=P.getSnapshotBeforeUpdate(t.elementType===t.type?oe:Nt(t.type,oe),Me);P.__reactInternalSnapshotBeforeUpdate=N}break;case 3:var T=t.stateNode.containerInfo;T.nodeType===1?T.textContent="":T.nodeType===9&&T.documentElement&&T.removeChild(T.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(u(163))}}catch(J){Oe(t,t.return,J)}if(e=t.sibling,e!==null){e.return=t.return,re=e;break}re=t.return}return le=Wu,Wu=!1,le}function Yr(e,t,n){var l=t.updateQueue;if(l=l!==null?l.lastEffect:null,l!==null){var o=l=l.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Wo(t,n,i)}o=o.next}while(o!==l)}}function ql(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var l=n.create;n.destroy=l()}n=n.next}while(n!==t)}}function $o(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function $u(e){var t=e.alternate;t!==null&&(e.alternate=null,$u(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[zt],delete t[br],delete t[lo],delete t[kp],delete t[Cp])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ku(e){return e.tag===5||e.tag===3||e.tag===4}function Vu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ku(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.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 Ko(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=_l));else if(l!==4&&(e=e.child,e!==null))for(Ko(e,t,n),e=e.sibling;e!==null;)Ko(e,t,n),e=e.sibling}function Vo(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&&(e=e.child,e!==null))for(Vo(e,t,n),e=e.sibling;e!==null;)Vo(e,t,n),e=e.sibling}var He=null,Et=!1;function sn(e,t,n){for(n=n.child;n!==null;)Hu(e,t,n),n=n.sibling}function Hu(e,t,n){if(Lt&&typeof Lt.onCommitFiberUnmount=="function")try{Lt.onCommitFiberUnmount(cl,n)}catch{}switch(n.tag){case 5:Xe||sr(n,t);case 6:var l=He,o=Et;He=null,sn(e,t,n),He=l,Et=o,He!==null&&(Et?(e=He,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):He.removeChild(n.stateNode));break;case 18:He!==null&&(Et?(e=He,n=n.stateNode,e.nodeType===8?ro(e.parentNode,n):e.nodeType===1&&ro(e,n),Er(e)):ro(He,n.stateNode));break;case 4:l=He,o=Et,He=n.stateNode.containerInfo,Et=!0,sn(e,t,n),He=l,Et=o;break;case 0:case 11:case 14:case 15:if(!Xe&&(l=n.updateQueue,l!==null&&(l=l.lastEffect,l!==null))){o=l=l.next;do{var i=o,d=i.destroy;i=i.tag,d!==void 0&&((i&2)!==0||(i&4)!==0)&&Wo(n,t,d),o=o.next}while(o!==l)}sn(e,t,n);break;case 1:if(!Xe&&(sr(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"))try{l.props=n.memoizedProps,l.state=n.memoizedState,l.componentWillUnmount()}catch(m){Oe(n,t,m)}sn(e,t,n);break;case 21:sn(e,t,n);break;case 22:n.mode&1?(Xe=(l=Xe)||n.memoizedState!==null,sn(e,t,n),Xe=l):sn(e,t,n);break;default:sn(e,t,n)}}function Qu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Bp),t.forEach(function(l){var o=Gp.bind(null,e,l);n.has(l)||(n.add(l),l.then(o,o))})}}function Pt(e,t){var n=t.deletions;if(n!==null)for(var l=0;l<n.length;l++){var o=n[l];try{var i=e,d=t,m=d;e:for(;m!==null;){switch(m.tag){case 5:He=m.stateNode,Et=!1;break e;case 3:He=m.stateNode.containerInfo,Et=!0;break e;case 4:He=m.stateNode.containerInfo,Et=!0;break e}m=m.return}if(He===null)throw Error(u(160));Hu(i,d,o),He=null,Et=!1;var y=o.alternate;y!==null&&(y.return=null),o.return=null}catch(L){Oe(o,t,L)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Yu(t,e),t=t.sibling}function Yu(e,t){var n=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Pt(t,e),Dt(e),l&4){try{Yr(3,e,e.return),ql(3,e)}catch(oe){Oe(e,e.return,oe)}try{Yr(5,e,e.return)}catch(oe){Oe(e,e.return,oe)}}break;case 1:Pt(t,e),Dt(e),l&512&&n!==null&&sr(n,n.return);break;case 5:if(Pt(t,e),Dt(e),l&512&&n!==null&&sr(n,n.return),e.flags&32){var o=e.stateNode;try{Ne(o,"")}catch(oe){Oe(e,e.return,oe)}}if(l&4&&(o=e.stateNode,o!=null)){var i=e.memoizedProps,d=n!==null?n.memoizedProps:i,m=e.type,y=e.updateQueue;if(e.updateQueue=null,y!==null)try{m==="input"&&i.type==="radio"&&i.name!=null&&An(o,i),js(m,d);var L=js(m,i);for(d=0;d<y.length;d+=2){var K=y[d],H=y[d+1];K==="style"?Ri(o,H):K==="dangerouslySetInnerHTML"?sl(o,H):K==="children"?Ne(o,H):W(o,K,H,L)}switch(m){case"input":Tt(o,i);break;case"textarea":mr(o,i);break;case"select":var $=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var ne=i.value;ne!=null?ze(o,!!i.multiple,ne,!1):$!==!!i.multiple&&(i.defaultValue!=null?ze(o,!!i.multiple,i.defaultValue,!0):ze(o,!!i.multiple,i.multiple?[]:"",!1))}o[br]=i}catch(oe){Oe(e,e.return,oe)}}break;case 6:if(Pt(t,e),Dt(e),l&4){if(e.stateNode===null)throw Error(u(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(oe){Oe(e,e.return,oe)}}break;case 3:if(Pt(t,e),Dt(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{Er(t.containerInfo)}catch(oe){Oe(e,e.return,oe)}break;case 4:Pt(t,e),Dt(e);break;case 13:Pt(t,e),Dt(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(Yo=be())),l&4&&Qu(e);break;case 22:if(K=n!==null&&n.memoizedState!==null,e.mode&1?(Xe=(L=Xe)||K,Pt(t,e),Xe=L):Pt(t,e),Dt(e),l&8192){if(L=e.memoizedState!==null,(e.stateNode.isHidden=L)&&!K&&(e.mode&1)!==0)for(re=e,K=e.child;K!==null;){for(H=re=K;re!==null;){switch($=re,ne=$.child,$.tag){case 0:case 11:case 14:case 15:Yr(4,$,$.return);break;case 1:sr($,$.return);var le=$.stateNode;if(typeof le.componentWillUnmount=="function"){l=$,n=$.return;try{t=l,le.props=t.memoizedProps,le.state=t.memoizedState,le.componentWillUnmount()}catch(oe){Oe(l,n,oe)}}break;case 5:sr($,$.return);break;case 22:if($.memoizedState!==null){qu(H);continue}}ne!==null?(ne.return=$,re=ne):qu(H)}K=K.sibling}e:for(K=null,H=e;;){if(H.tag===5){if(K===null){K=H;try{o=H.stateNode,L?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(m=H.stateNode,y=H.memoizedProps.style,d=y!=null&&y.hasOwnProperty("display")?y.display:null,m.style.display=ol("display",d))}catch(oe){Oe(e,e.return,oe)}}}else if(H.tag===6){if(K===null)try{H.stateNode.nodeValue=L?"":H.memoizedProps}catch(oe){Oe(e,e.return,oe)}}else if((H.tag!==22&&H.tag!==23||H.memoizedState===null||H===e)&&H.child!==null){H.child.return=H,H=H.child;continue}if(H===e)break e;for(;H.sibling===null;){if(H.return===null||H.return===e)break e;K===H&&(K=null),H=H.return}K===H&&(K=null),H.sibling.return=H.return,H=H.sibling}}break;case 19:Pt(t,e),Dt(e),l&4&&Qu(e);break;case 21:break;default:Pt(t,e),Dt(e)}}function Dt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Ku(n)){var l=n;break e}n=n.return}throw Error(u(160))}switch(l.tag){case 5:var o=l.stateNode;l.flags&32&&(Ne(o,""),l.flags&=-33);var i=Vu(e);Vo(e,i,o);break;case 3:case 4:var d=l.stateNode.containerInfo,m=Vu(e);Ko(e,m,d);break;default:throw Error(u(161))}}catch(y){Oe(e,e.return,y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Wp(e,t,n){re=e,Ju(e)}function Ju(e,t,n){for(var l=(e.mode&1)!==0;re!==null;){var o=re,i=o.child;if(o.tag===22&&l){var d=o.memoizedState!==null||Gl;if(!d){var m=o.alternate,y=m!==null&&m.memoizedState!==null||Xe;m=Gl;var L=Xe;if(Gl=d,(Xe=y)&&!L)for(re=o;re!==null;)d=re,y=d.child,d.tag===22&&d.memoizedState!==null?Xu(o):y!==null?(y.return=d,re=y):Xu(o);for(;i!==null;)re=i,Ju(i),i=i.sibling;re=o,Gl=m,Xe=L}Gu(e)}else(o.subtreeFlags&8772)!==0&&i!==null?(i.return=o,re=i):Gu(e)}}function Gu(e){for(;re!==null;){var t=re;if((t.flags&8772)!==0){var n=t.alternate;try{if((t.flags&8772)!==0)switch(t.tag){case 0:case 11:case 15:Xe||ql(5,t);break;case 1:var l=t.stateNode;if(t.flags&4&&!Xe)if(n===null)l.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:Nt(t.type,n.memoizedProps);l.componentDidUpdate(o,n.memoizedState,l.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&qa(t,i,l);break;case 3:var d=t.updateQueue;if(d!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}qa(t,d,n)}break;case 5:var m=t.stateNode;if(n===null&&t.flags&4){n=m;var y=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":y.autoFocus&&n.focus();break;case"img":y.src&&(n.src=y.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var L=t.alternate;if(L!==null){var K=L.memoizedState;if(K!==null){var H=K.dehydrated;H!==null&&Er(H)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(u(163))}Xe||t.flags&512&&$o(t)}catch($){Oe(t,t.return,$)}}if(t===e){re=null;break}if(n=t.sibling,n!==null){n.return=t.return,re=n;break}re=t.return}}function qu(e){for(;re!==null;){var t=re;if(t===e){re=null;break}var n=t.sibling;if(n!==null){n.return=t.return,re=n;break}re=t.return}}function Xu(e){for(;re!==null;){var t=re;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{ql(4,t)}catch(y){Oe(t,n,y)}break;case 1:var l=t.stateNode;if(typeof l.componentDidMount=="function"){var o=t.return;try{l.componentDidMount()}catch(y){Oe(t,o,y)}}var i=t.return;try{$o(t)}catch(y){Oe(t,i,y)}break;case 5:var d=t.return;try{$o(t)}catch(y){Oe(t,d,y)}}}catch(y){Oe(t,t.return,y)}if(t===e){re=null;break}var m=t.sibling;if(m!==null){m.return=t.return,re=m;break}re=t.return}}var $p=Math.ceil,Xl=G.ReactCurrentDispatcher,Ho=G.ReactCurrentOwner,St=G.ReactCurrentBatchConfig,we=0,Ke=null,Be=null,Qe=0,ht=0,or=en(0),We=0,Jr=null,Nn=0,Zl=0,Qo=0,Gr=null,it=null,Yo=0,ir=1/0,Vt=null,es=!1,Jo=null,on=null,ts=!1,an=null,ns=0,qr=0,Go=null,rs=-1,ls=0;function nt(){return(we&6)!==0?be():rs!==-1?rs:rs=be()}function un(e){return(e.mode&1)===0?1:(we&2)!==0&&Qe!==0?Qe&-Qe:Ep.transition!==null?(ls===0&&(ls=Vi()),ls):(e=Ee,e!==0||(e=window.event,e=e===void 0?16:ea(e.type)),e)}function _t(e,t,n,l){if(50<qr)throw qr=0,Go=null,Error(u(185));jr(e,n,l),((we&2)===0||e!==Ke)&&(e===Ke&&((we&2)===0&&(Zl|=n),We===4&&cn(e,Qe)),at(e,l),n===1&&we===0&&(t.mode&1)===0&&(ir=be()+500,zl&&nn()))}function at(e,t){var n=e.callbackNode;Ed(e,t);var l=fl(e,e===Ke?Qe:0);if(l===0)n!==null&&Wi(n),e.callbackNode=null,e.callbackPriority=0;else if(t=l&-l,e.callbackPriority!==t){if(n!=null&&Wi(n),t===1)e.tag===0?Np(ec.bind(null,e)):Fa(ec.bind(null,e)),jp(function(){(we&6)===0&&nn()}),n=null;else{switch(Hi(l)){case 1:n=_s;break;case 4:n=$i;break;case 16:n=ul;break;case 536870912:n=Ki;break;default:n=ul}n=ac(n,Zu.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Zu(e,t){if(rs=-1,ls=0,(we&6)!==0)throw Error(u(327));var n=e.callbackNode;if(ar()&&e.callbackNode!==n)return null;var l=fl(e,e===Ke?Qe:0);if(l===0)return null;if((l&30)!==0||(l&e.expiredLanes)!==0||t)t=ss(e,l);else{t=l;var o=we;we|=2;var i=nc();(Ke!==e||Qe!==t)&&(Vt=null,ir=be()+500,Pn(e,t));do try{Hp();break}catch(m){tc(e,m)}while(!0);ho(),Xl.current=i,we=o,Be!==null?t=0:(Ke=null,Qe=0,t=We)}if(t!==0){if(t===2&&(o=Ts(e),o!==0&&(l=o,t=qo(e,o))),t===1)throw n=Jr,Pn(e,0),cn(e,l),at(e,be()),n;if(t===6)cn(e,l);else{if(o=e.current.alternate,(l&30)===0&&!Kp(o)&&(t=ss(e,l),t===2&&(i=Ts(e),i!==0&&(l=i,t=qo(e,i))),t===1))throw n=Jr,Pn(e,0),cn(e,l),at(e,be()),n;switch(e.finishedWork=o,e.finishedLanes=l,t){case 0:case 1:throw Error(u(345));case 2:_n(e,it,Vt);break;case 3:if(cn(e,l),(l&130023424)===l&&(t=Yo+500-be(),10<t)){if(fl(e,0)!==0)break;if(o=e.suspendedLanes,(o&l)!==l){nt(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=no(_n.bind(null,e,it,Vt),t);break}_n(e,it,Vt);break;case 4:if(cn(e,l),(l&4194240)===l)break;for(t=e.eventTimes,o=-1;0<l;){var d=31-wt(l);i=1<<d,d=t[d],d>o&&(o=d),l&=~i}if(l=o,l=be()-l,l=(120>l?120:480>l?480:1080>l?1080:1920>l?1920:3e3>l?3e3:4320>l?4320:1960*$p(l/1960))-l,10<l){e.timeoutHandle=no(_n.bind(null,e,it,Vt),l);break}_n(e,it,Vt);break;case 5:_n(e,it,Vt);break;default:throw Error(u(329))}}}return at(e,be()),e.callbackNode===n?Zu.bind(null,e):null}function qo(e,t){var n=Gr;return e.current.memoizedState.isDehydrated&&(Pn(e,t).flags|=256),e=ss(e,t),e!==2&&(t=it,it=n,t!==null&&Xo(t)),e}function Xo(e){it===null?it=e:it.push.apply(it,e)}function Kp(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var l=0;l<n.length;l++){var o=n[l],i=o.getSnapshot;o=o.value;try{if(!kt(i(),o))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 cn(e,t){for(t&=~Qo,t&=~Zl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-wt(t),l=1<<n;e[n]=-1,t&=~l}}function ec(e){if((we&6)!==0)throw Error(u(327));ar();var t=fl(e,0);if((t&1)===0)return at(e,be()),null;var n=ss(e,t);if(e.tag!==0&&n===2){var l=Ts(e);l!==0&&(t=l,n=qo(e,l))}if(n===1)throw n=Jr,Pn(e,0),cn(e,t),at(e,be()),n;if(n===6)throw Error(u(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,_n(e,it,Vt),at(e,be()),null}function Zo(e,t){var n=we;we|=1;try{return e(t)}finally{we=n,we===0&&(ir=be()+500,zl&&nn())}}function En(e){an!==null&&an.tag===0&&(we&6)===0&&ar();var t=we;we|=1;var n=St.transition,l=Ee;try{if(St.transition=null,Ee=1,e)return e()}finally{Ee=l,St.transition=n,we=t,(we&6)===0&&nn()}}function ei(){ht=or.current,Le(or)}function Pn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Sp(n)),Be!==null)for(n=Be.return;n!==null;){var l=n;switch(ao(l),l.tag){case 1:l=l.type.childContextTypes,l!=null&&Rl();break;case 3:rr(),Le(lt),Le(Je),wo();break;case 5:So(l);break;case 4:rr();break;case 13:Le(Ae);break;case 19:Le(Ae);break;case 10:mo(l.type._context);break;case 22:case 23:ei()}n=n.return}if(Ke=e,Be=e=dn(e.current,null),Qe=ht=t,We=0,Jr=null,Qo=Zl=Nn=0,it=Gr=null,wn!==null){for(t=0;t<wn.length;t++)if(n=wn[t],l=n.interleaved,l!==null){n.interleaved=null;var o=l.next,i=n.pending;if(i!==null){var d=i.next;i.next=o,l.next=d}n.pending=l}wn=null}return e}function tc(e,t){do{var n=Be;try{if(ho(),Wl.current=Hl,$l){for(var l=De.memoizedState;l!==null;){var o=l.queue;o!==null&&(o.pending=null),l=l.next}$l=!1}if(Cn=0,$e=Ue=De=null,$r=!1,Kr=0,Ho.current=null,n===null||n.return===null){We=1,Jr=t,Be=null;break}e:{var i=e,d=n.return,m=n,y=t;if(t=Qe,m.flags|=32768,y!==null&&typeof y=="object"&&typeof y.then=="function"){var L=y,K=m,H=K.tag;if((K.mode&1)===0&&(H===0||H===11||H===15)){var $=K.alternate;$?(K.updateQueue=$.updateQueue,K.memoizedState=$.memoizedState,K.lanes=$.lanes):(K.updateQueue=null,K.memoizedState=null)}var ne=Eu(d);if(ne!==null){ne.flags&=-257,Pu(ne,d,m,i,t),ne.mode&1&&Nu(i,L,t),t=ne,y=L;var le=t.updateQueue;if(le===null){var oe=new Set;oe.add(y),t.updateQueue=oe}else le.add(y);break e}else{if((t&1)===0){Nu(i,L,t),ti();break e}y=Error(u(426))}}else if(Ie&&m.mode&1){var Me=Eu(d);if(Me!==null){(Me.flags&65536)===0&&(Me.flags|=256),Pu(Me,d,m,i,t),po(lr(y,m));break e}}i=y=lr(y,m),We!==4&&(We=2),Gr===null?Gr=[i]:Gr.push(i),i=d;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var P=ku(i,y,t);Ga(i,P);break e;case 1:m=y;var N=i.type,T=i.stateNode;if((i.flags&128)===0&&(typeof N.getDerivedStateFromError=="function"||T!==null&&typeof T.componentDidCatch=="function"&&(on===null||!on.has(T)))){i.flags|=65536,t&=-t,i.lanes|=t;var J=Cu(i,m,t);Ga(i,J);break e}}i=i.return}while(i!==null)}lc(n)}catch(ie){t=ie,Be===n&&n!==null&&(Be=n=n.return);continue}break}while(!0)}function nc(){var e=Xl.current;return Xl.current=Hl,e===null?Hl:e}function ti(){(We===0||We===3||We===2)&&(We=4),Ke===null||(Nn&268435455)===0&&(Zl&268435455)===0||cn(Ke,Qe)}function ss(e,t){var n=we;we|=2;var l=nc();(Ke!==e||Qe!==t)&&(Vt=null,Pn(e,t));do try{Vp();break}catch(o){tc(e,o)}while(!0);if(ho(),we=n,Xl.current=l,Be!==null)throw Error(u(261));return Ke=null,Qe=0,We}function Vp(){for(;Be!==null;)rc(Be)}function Hp(){for(;Be!==null&&!yd();)rc(Be)}function rc(e){var t=ic(e.alternate,e,ht);e.memoizedProps=e.pendingProps,t===null?lc(e):Be=t,Ho.current=null}function lc(e){var t=e;do{var n=t.alternate;if(e=t.return,(t.flags&32768)===0){if(n=Mp(n,t,ht),n!==null){Be=n;return}}else{if(n=Fp(n,t),n!==null){n.flags&=32767,Be=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{We=6,Be=null;return}}if(t=t.sibling,t!==null){Be=t;return}Be=t=e}while(t!==null);We===0&&(We=5)}function _n(e,t,n){var l=Ee,o=St.transition;try{St.transition=null,Ee=1,Qp(e,t,n,l)}finally{St.transition=o,Ee=l}return null}function Qp(e,t,n,l){do ar();while(an!==null);if((we&6)!==0)throw Error(u(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(u(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(Pd(e,i),e===Ke&&(Be=Ke=null,Qe=0),(n.subtreeFlags&2064)===0&&(n.flags&2064)===0||ts||(ts=!0,ac(ul,function(){return ar(),null})),i=(n.flags&15990)!==0,(n.subtreeFlags&15990)!==0||i){i=St.transition,St.transition=null;var d=Ee;Ee=1;var m=we;we|=4,Ho.current=null,Up(e,n),Yu(n,e),fp(eo),gl=!!Zs,eo=Zs=null,e.current=n,Wp(n),xd(),we=m,Ee=d,St.transition=i}else e.current=n;if(ts&&(ts=!1,an=e,ns=o),i=e.pendingLanes,i===0&&(on=null),jd(n.stateNode),at(e,be()),t!==null)for(l=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],l(o.value,{componentStack:o.stack,digest:o.digest});if(es)throw es=!1,e=Jo,Jo=null,e;return(ns&1)!==0&&e.tag!==0&&ar(),i=e.pendingLanes,(i&1)!==0?e===Go?qr++:(qr=0,Go=e):qr=0,nn(),null}function ar(){if(an!==null){var e=Hi(ns),t=St.transition,n=Ee;try{if(St.transition=null,Ee=16>e?16:e,an===null)var l=!1;else{if(e=an,an=null,ns=0,(we&6)!==0)throw Error(u(331));var o=we;for(we|=4,re=e.current;re!==null;){var i=re,d=i.child;if((re.flags&16)!==0){var m=i.deletions;if(m!==null){for(var y=0;y<m.length;y++){var L=m[y];for(re=L;re!==null;){var K=re;switch(K.tag){case 0:case 11:case 15:Yr(8,K,i)}var H=K.child;if(H!==null)H.return=K,re=H;else for(;re!==null;){K=re;var $=K.sibling,ne=K.return;if($u(K),K===L){re=null;break}if($!==null){$.return=ne,re=$;break}re=ne}}}var le=i.alternate;if(le!==null){var oe=le.child;if(oe!==null){le.child=null;do{var Me=oe.sibling;oe.sibling=null,oe=Me}while(oe!==null)}}re=i}}if((i.subtreeFlags&2064)!==0&&d!==null)d.return=i,re=d;else e:for(;re!==null;){if(i=re,(i.flags&2048)!==0)switch(i.tag){case 0:case 11:case 15:Yr(9,i,i.return)}var P=i.sibling;if(P!==null){P.return=i.return,re=P;break e}re=i.return}}var N=e.current;for(re=N;re!==null;){d=re;var T=d.child;if((d.subtreeFlags&2064)!==0&&T!==null)T.return=d,re=T;else e:for(d=N;re!==null;){if(m=re,(m.flags&2048)!==0)try{switch(m.tag){case 0:case 11:case 15:ql(9,m)}}catch(ie){Oe(m,m.return,ie)}if(m===d){re=null;break e}var J=m.sibling;if(J!==null){J.return=m.return,re=J;break e}re=m.return}}if(we=o,nn(),Lt&&typeof Lt.onPostCommitFiberRoot=="function")try{Lt.onPostCommitFiberRoot(cl,e)}catch{}l=!0}return l}finally{Ee=n,St.transition=t}}return!1}function sc(e,t,n){t=lr(n,t),t=ku(e,t,1),e=ln(e,t,1),t=nt(),e!==null&&(jr(e,1,t),at(e,t))}function Oe(e,t,n){if(e.tag===3)sc(e,e,n);else for(;t!==null;){if(t.tag===3){sc(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(on===null||!on.has(l))){e=lr(n,e),e=Cu(t,e,1),t=ln(t,e,1),e=nt(),t!==null&&(jr(t,1,e),at(t,e));break}}t=t.return}}function Yp(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),t=nt(),e.pingedLanes|=e.suspendedLanes&n,Ke===e&&(Qe&n)===n&&(We===4||We===3&&(Qe&130023424)===Qe&&500>be()-Yo?Pn(e,0):Qo|=n),at(e,t)}function oc(e,t){t===0&&((e.mode&1)===0?t=1:(t=pl,pl<<=1,(pl&130023424)===0&&(pl=4194304)));var n=nt();e=Wt(e,t),e!==null&&(jr(e,t,n),at(e,n))}function Jp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),oc(e,n)}function Gp(e,t){var n=0;switch(e.tag){case 13:var l=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:l=e.stateNode;break;default:throw Error(u(314))}l!==null&&l.delete(t),oc(e,n)}var ic;ic=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||lt.current)ot=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return ot=!1,bp(e,t,n);ot=(e.flags&131072)!==0}else ot=!1,Ie&&(t.flags&1048576)!==0&&Ba(t,Al,t.index);switch(t.lanes=0,t.tag){case 2:var l=t.type;Jl(e,t),e=t.pendingProps;var o=Gn(t,Je.current);nr(t,n),o=No(null,t,l,e,o,n);var i=Eo();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,st(l)?(i=!0,Ll(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,xo(t),o.updater=Ql,t.stateNode=o,o._reactInternals=t,zo(t,l,e,n),t=Oo(null,t,l,!0,i,n)):(t.tag=0,Ie&&i&&io(t),tt(null,t,o,n),t=t.child),t;case 16:l=t.elementType;e:{switch(Jl(e,t),e=t.pendingProps,o=l._init,l=o(l._payload),t.type=l,o=t.tag=Xp(l),e=Nt(l,e),o){case 0:t=Do(null,t,l,e,n);break e;case 1:t=Iu(null,t,l,e,n);break e;case 11:t=_u(null,t,l,e,n);break e;case 14:t=Tu(null,t,l,Nt(l.type,e),n);break e}throw Error(u(306,l,""))}return t;case 0:return l=t.type,o=t.pendingProps,o=t.elementType===l?o:Nt(l,o),Do(e,t,l,o,n);case 1:return l=t.type,o=t.pendingProps,o=t.elementType===l?o:Nt(l,o),Iu(e,t,l,o,n);case 3:e:{if(Au(t),e===null)throw Error(u(387));l=t.pendingProps,i=t.memoizedState,o=i.element,Ja(e,t),Bl(t,l,null,n);var d=t.memoizedState;if(l=d.element,i.isDehydrated)if(i={element:l,isDehydrated:!1,cache:d.cache,pendingSuspenseBoundaries:d.pendingSuspenseBoundaries,transitions:d.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=lr(Error(u(423)),t),t=Du(e,t,l,n,o);break e}else if(l!==o){o=lr(Error(u(424)),t),t=Du(e,t,l,n,o);break e}else for(ft=Zt(t.stateNode.containerInfo.firstChild),pt=t,Ie=!0,Ct=null,n=Qa(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Zn(),l===o){t=Kt(e,t,n);break e}tt(e,t,l,n)}t=t.child}return t;case 5:return Xa(t),e===null&&co(t),l=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,d=o.children,to(l,o)?d=null:i!==null&&to(l,i)&&(t.flags|=32),zu(e,t),tt(e,t,d,n),t.child;case 6:return e===null&&co(t),null;case 13:return Ou(e,t,n);case 4:return vo(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=er(t,null,l,n):tt(e,t,l,n),t.child;case 11:return l=t.type,o=t.pendingProps,o=t.elementType===l?o:Nt(l,o),_u(e,t,l,o,n);case 7:return tt(e,t,t.pendingProps,n),t.child;case 8:return tt(e,t,t.pendingProps.children,n),t.child;case 12:return tt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(l=t.type._context,o=t.pendingProps,i=t.memoizedProps,d=o.value,Te(bl,l._currentValue),l._currentValue=d,i!==null)if(kt(i.value,d)){if(i.children===o.children&&!lt.current){t=Kt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var m=i.dependencies;if(m!==null){d=i.child;for(var y=m.firstContext;y!==null;){if(y.context===l){if(i.tag===1){y=$t(-1,n&-n),y.tag=2;var L=i.updateQueue;if(L!==null){L=L.shared;var K=L.pending;K===null?y.next=y:(y.next=K.next,K.next=y),L.pending=y}}i.lanes|=n,y=i.alternate,y!==null&&(y.lanes|=n),go(i.return,n,t),m.lanes|=n;break}y=y.next}}else if(i.tag===10)d=i.type===t.type?null:i.child;else if(i.tag===18){if(d=i.return,d===null)throw Error(u(341));d.lanes|=n,m=d.alternate,m!==null&&(m.lanes|=n),go(d,n,t),d=i.sibling}else d=i.child;if(d!==null)d.return=i;else for(d=i;d!==null;){if(d===t){d=null;break}if(i=d.sibling,i!==null){i.return=d.return,d=i;break}d=d.return}i=d}tt(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,l=t.pendingProps.children,nr(t,n),o=xt(o),l=l(o),t.flags|=1,tt(e,t,l,n),t.child;case 14:return l=t.type,o=Nt(l,t.pendingProps),o=Nt(l.type,o),Tu(e,t,l,o,n);case 15:return Ru(e,t,t.type,t.pendingProps,n);case 17:return l=t.type,o=t.pendingProps,o=t.elementType===l?o:Nt(l,o),Jl(e,t),t.tag=1,st(l)?(e=!0,Ll(t)):e=!1,nr(t,n),ju(t,l,o),zo(t,l,o,n),Oo(null,t,l,!0,e,n);case 19:return Mu(e,t,n);case 22:return Lu(e,t,n)}throw Error(u(156,t.tag))};function ac(e,t){return Ui(e,t)}function qp(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.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 jt(e,t,n,l){return new qp(e,t,n,l)}function ni(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xp(e){if(typeof e=="function")return ni(e)?1:0;if(e!=null){if(e=e.$$typeof,e===se)return 11;if(e===ye)return 14}return 2}function dn(e,t){var n=e.alternate;return n===null?(n=jt(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&14680064,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}function os(e,t,n,l,o,i){var d=2;if(l=e,typeof e=="function")ni(e)&&(d=1);else if(typeof e=="string")d=5;else e:switch(e){case ee:return Tn(n.children,o,i,t);case Q:d=8,o|=8;break;case F:return e=jt(12,n,t,o|2),e.elementType=F,e.lanes=i,e;case R:return e=jt(13,n,t,o),e.elementType=R,e.lanes=i,e;case ae:return e=jt(19,n,t,o),e.elementType=ae,e.lanes=i,e;case Se:return is(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case A:d=10;break e;case b:d=9;break e;case se:d=11;break e;case ye:d=14;break e;case ge:d=16,l=null;break e}throw Error(u(130,e==null?e:typeof e,""))}return t=jt(d,n,t,o),t.elementType=e,t.type=l,t.lanes=i,t}function Tn(e,t,n,l){return e=jt(7,e,l,t),e.lanes=n,e}function is(e,t,n,l){return e=jt(22,e,l,t),e.elementType=Se,e.lanes=n,e.stateNode={isHidden:!1},e}function ri(e,t,n){return e=jt(6,e,null,t),e.lanes=n,e}function li(e,t,n){return t=jt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Zp(e,t,n,l,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Rs(0),this.expirationTimes=Rs(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rs(0),this.identifierPrefix=l,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function si(e,t,n,l,o,i,d,m,y){return e=new Zp(e,t,n,m,y),t===1?(t=1,i===!0&&(t|=8)):t=0,i=jt(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:l,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},xo(i),e}function ef(e,t,n){var l=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:M,key:l==null?null:""+l,children:e,containerInfo:t,implementation:n}}function uc(e){if(!e)return tn;e=e._reactInternals;e:{if(yn(e)!==e||e.tag!==1)throw Error(u(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(st(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(u(171))}if(e.tag===1){var n=e.type;if(st(n))return ba(e,n,t)}return t}function cc(e,t,n,l,o,i,d,m,y){return e=si(n,l,!0,e,o,i,d,m,y),e.context=uc(null),n=e.current,l=nt(),o=un(n),i=$t(l,o),i.callback=t??null,ln(n,i,o),e.current.lanes=o,jr(e,o,l),at(e,l),e}function as(e,t,n,l){var o=t.current,i=nt(),d=un(o);return n=uc(n),t.context===null?t.context=n:t.pendingContext=n,t=$t(i,d),t.payload={element:e},l=l===void 0?null:l,l!==null&&(t.callback=l),e=ln(o,t,d),e!==null&&(_t(e,o,d,i),Fl(e,o,d)),d}function us(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function dc(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function oi(e,t){dc(e,t),(e=e.alternate)&&dc(e,t)}function tf(){return null}var pc=typeof reportError=="function"?reportError:function(e){console.error(e)};function ii(e){this._internalRoot=e}cs.prototype.render=ii.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(u(409));as(e,t,null,null)},cs.prototype.unmount=ii.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;En(function(){as(null,e,null,null)}),t[Mt]=null}};function cs(e){this._internalRoot=e}cs.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ji();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Gt.length&&t!==0&&t<Gt[n].priority;n++);Gt.splice(n,0,e),n===0&&Xi(e)}};function ai(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ds(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function fc(){}function nf(e,t,n,l,o){if(o){if(typeof l=="function"){var i=l;l=function(){var L=us(d);i.call(L)}}var d=cc(t,l,e,0,null,!1,!1,"",fc);return e._reactRootContainer=d,e[Mt]=d.current,Dr(e.nodeType===8?e.parentNode:e),En(),d}for(;o=e.lastChild;)e.removeChild(o);if(typeof l=="function"){var m=l;l=function(){var L=us(y);m.call(L)}}var y=si(e,0,!1,null,null,!1,!1,"",fc);return e._reactRootContainer=y,e[Mt]=y.current,Dr(e.nodeType===8?e.parentNode:e),En(function(){as(t,y,n,l)}),y}function ps(e,t,n,l,o){var i=n._reactRootContainer;if(i){var d=i;if(typeof o=="function"){var m=o;o=function(){var y=us(d);m.call(y)}}as(t,d,e,o)}else d=nf(n,t,e,o,l);return us(d)}Qi=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Sr(t.pendingLanes);n!==0&&(Ls(t,n|1),at(t,be()),(we&6)===0&&(ir=be()+500,nn()))}break;case 13:En(function(){var l=Wt(e,1);if(l!==null){var o=nt();_t(l,e,1,o)}}),oi(e,1)}},zs=function(e){if(e.tag===13){var t=Wt(e,134217728);if(t!==null){var n=nt();_t(t,e,134217728,n)}oi(e,134217728)}},Yi=function(e){if(e.tag===13){var t=un(e),n=Wt(e,t);if(n!==null){var l=nt();_t(n,e,t,l)}oi(e,t)}},Ji=function(){return Ee},Gi=function(e,t){var n=Ee;try{return Ee=e,t()}finally{Ee=n}},Cs=function(e,t,n){switch(t){case"input":if(Tt(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var o=Tl(l);if(!o)throw Error(u(90));rl(l),Tt(l,o)}}}break;case"textarea":mr(e,n);break;case"select":t=n.value,t!=null&&ze(e,!!n.multiple,t,!1)}},Ai=Zo,Di=En;var rf={usingClientEntryPoint:!1,Events:[Mr,Yn,Tl,zi,Ii,Zo]},Xr={findFiberByHostInstance:xn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},lf={bundleType:Xr.bundleType,version:Xr.version,rendererPackageName:Xr.rendererPackageName,rendererConfig:Xr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:G.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Fi(e),e===null?null:e.stateNode},findFiberByHostInstance:Xr.findFiberByHostInstance||tf,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fs=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fs.isDisabled&&fs.supportsFiber)try{cl=fs.inject(lf),Lt=fs}catch{}}return ut.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=rf,ut.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ai(t))throw Error(u(200));return ef(e,t,null,n)},ut.createRoot=function(e,t){if(!ai(e))throw Error(u(299));var n=!1,l="",o=pc;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=si(e,1,!1,null,null,n,!1,l,o),e[Mt]=t.current,Dr(e.nodeType===8?e.parentNode:e),new ii(t)},ut.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(u(188)):(e=Object.keys(e).join(","),Error(u(268,e)));return e=Fi(t),e=e===null?null:e.stateNode,e},ut.flushSync=function(e){return En(e)},ut.hydrate=function(e,t,n){if(!ds(t))throw Error(u(200));return ps(null,e,t,!0,n)},ut.hydrateRoot=function(e,t,n){if(!ai(e))throw Error(u(405));var l=n!=null&&n.hydratedSources||null,o=!1,i="",d=pc;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(d=n.onRecoverableError)),t=cc(t,null,e,1,n??null,o,!1,i,d),e[Mt]=t.current,Dr(e),l)for(e=0;e<l.length;e++)n=l[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new cs(t)},ut.render=function(e,t,n){if(!ds(t))throw Error(u(200));return ps(null,e,t,!1,n)},ut.unmountComponentAtNode=function(e){if(!ds(e))throw Error(u(40));return e._reactRootContainer?(En(function(){ps(null,null,e,!1,function(){e._reactRootContainer=null,e[Mt]=null})}),!0):!1},ut.unstable_batchedUpdates=Zo,ut.unstable_renderSubtreeIntoContainer=function(e,t,n,l){if(!ds(n))throw Error(u(200));if(e==null||e._reactInternals===void 0)throw Error(u(38));return ps(e,t,n,!1,l)},ut.version="18.3.1-next-f1338f8080-20240426",ut}var jc;function $c(){if(jc)return di.exports;jc=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(a){console.error(a)}}return s(),di.exports=yf(),di.exports}var wc;function xf(){if(wc)return hs;wc=1;var s=$c();return hs.createRoot=s.createRoot,hs.hydrateRoot=s.hydrateRoot,hs}var vf=xf(),Kc=$c();/**
41
- * @remix-run/router v1.23.2
42
- *
43
- * Copyright (c) Remix Software Inc.
44
- *
45
- * This source code is licensed under the MIT license found in the
46
- * LICENSE.md file in the root directory of this source tree.
47
- *
48
- * @license MIT
49
- */function el(){return el=Object.assign?Object.assign.bind():function(s){for(var a=1;a<arguments.length;a++){var u=arguments[a];for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&(s[c]=u[c])}return s},el.apply(this,arguments)}var fn;(function(s){s.Pop="POP",s.Push="PUSH",s.Replace="REPLACE"})(fn||(fn={}));const kc="popstate";function Sf(s){s===void 0&&(s={});function a(c,f){let{pathname:h,search:v,hash:x}=c.location;return yi("",{pathname:h,search:v,hash:x},f.state&&f.state.usr||null,f.state&&f.state.key||"default")}function u(c,f){return typeof f=="string"?f:ys(f)}return wf(a,u,null,s)}function Fe(s,a){if(s===!1||s===null||typeof s>"u")throw new Error(a)}function wi(s,a){if(!s){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function jf(){return Math.random().toString(36).substr(2,8)}function Cc(s,a){return{usr:s.state,key:s.key,idx:a}}function yi(s,a,u,c){return u===void 0&&(u=null),el({pathname:typeof s=="string"?s:s.pathname,search:"",hash:""},typeof a=="string"?dr(a):a,{state:u,key:a&&a.key||c||jf()})}function ys(s){let{pathname:a="/",search:u="",hash:c=""}=s;return u&&u!=="?"&&(a+=u.charAt(0)==="?"?u:"?"+u),c&&c!=="#"&&(a+=c.charAt(0)==="#"?c:"#"+c),a}function dr(s){let a={};if(s){let u=s.indexOf("#");u>=0&&(a.hash=s.substr(u),s=s.substr(0,u));let c=s.indexOf("?");c>=0&&(a.search=s.substr(c),s=s.substr(0,c)),s&&(a.pathname=s)}return a}function wf(s,a,u,c){c===void 0&&(c={});let{window:f=document.defaultView,v5Compat:h=!1}=c,v=f.history,x=fn.Pop,E=null,w=j();w==null&&(w=0,v.replaceState(el({},v.state,{idx:w}),""));function j(){return(v.state||{idx:null}).idx}function C(){x=fn.Pop;let k=j(),z=k==null?null:k-w;w=k,E&&E({action:x,location:g.location,delta:z})}function _(k,z){x=fn.Push;let B=yi(g.location,k,z);w=j()+1;let W=Cc(B,w),G=g.createHref(B);try{v.pushState(W,"",G)}catch(Y){if(Y instanceof DOMException&&Y.name==="DataCloneError")throw Y;f.location.assign(G)}h&&E&&E({action:x,location:g.location,delta:1})}function V(k,z){x=fn.Replace;let B=yi(g.location,k,z);w=j();let W=Cc(B,w),G=g.createHref(B);v.replaceState(W,"",G),h&&E&&E({action:x,location:g.location,delta:0})}function U(k){let z=f.location.origin!=="null"?f.location.origin:f.location.href,B=typeof k=="string"?k:ys(k);return B=B.replace(/ $/,"%20"),Fe(z,"No window.location.(origin|href) available to create URL for href: "+B),new URL(B,z)}let g={get action(){return x},get location(){return s(f,v)},listen(k){if(E)throw new Error("A history only accepts one active listener");return f.addEventListener(kc,C),E=k,()=>{f.removeEventListener(kc,C),E=null}},createHref(k){return a(f,k)},createURL:U,encodeLocation(k){let z=U(k);return{pathname:z.pathname,search:z.search,hash:z.hash}},push:_,replace:V,go(k){return v.go(k)}};return g}var Nc;(function(s){s.data="data",s.deferred="deferred",s.redirect="redirect",s.error="error"})(Nc||(Nc={}));function kf(s,a,u){return u===void 0&&(u="/"),Cf(s,a,u)}function Cf(s,a,u,c){let f=typeof a=="string"?dr(a):a,h=ki(f.pathname||"/",u);if(h==null)return null;let v=Vc(s);Nf(v);let x=null;for(let E=0;x==null&&E<v.length;++E){let w=bf(h);x=Af(v[E],w)}return x}function Vc(s,a,u,c){a===void 0&&(a=[]),u===void 0&&(u=[]),c===void 0&&(c="");let f=(h,v,x)=>{let E={relativePath:x===void 0?h.path||"":x,caseSensitive:h.caseSensitive===!0,childrenIndex:v,route:h};E.relativePath.startsWith("/")&&(Fe(E.relativePath.startsWith(c),'Absolute route path "'+E.relativePath+'" nested under path '+('"'+c+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),E.relativePath=E.relativePath.slice(c.length));let w=hn([c,E.relativePath]),j=u.concat(E);h.children&&h.children.length>0&&(Fe(h.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+w+'".')),Vc(h.children,a,j,w)),!(h.path==null&&!h.index)&&a.push({path:w,score:zf(w,h.index),routesMeta:j})};return s.forEach((h,v)=>{var x;if(h.path===""||!((x=h.path)!=null&&x.includes("?")))f(h,v);else for(let E of Hc(h.path))f(h,v,E)}),a}function Hc(s){let a=s.split("/");if(a.length===0)return[];let[u,...c]=a,f=u.endsWith("?"),h=u.replace(/\?$/,"");if(c.length===0)return f?[h,""]:[h];let v=Hc(c.join("/")),x=[];return x.push(...v.map(E=>E===""?h:[h,E].join("/"))),f&&x.push(...v),x.map(E=>s.startsWith("/")&&E===""?"/":E)}function Nf(s){s.sort((a,u)=>a.score!==u.score?u.score-a.score:If(a.routesMeta.map(c=>c.childrenIndex),u.routesMeta.map(c=>c.childrenIndex)))}const Ef=/^:[\w-]+$/,Pf=3,_f=2,Tf=1,Rf=10,Lf=-2,Ec=s=>s==="*";function zf(s,a){let u=s.split("/"),c=u.length;return u.some(Ec)&&(c+=Lf),a&&(c+=_f),u.filter(f=>!Ec(f)).reduce((f,h)=>f+(Ef.test(h)?Pf:h===""?Tf:Rf),c)}function If(s,a){return s.length===a.length&&s.slice(0,-1).every((c,f)=>c===a[f])?s[s.length-1]-a[a.length-1]:0}function Af(s,a,u){let{routesMeta:c}=s,f={},h="/",v=[];for(let x=0;x<c.length;++x){let E=c[x],w=x===c.length-1,j=h==="/"?a:a.slice(h.length)||"/",C=Df({path:E.relativePath,caseSensitive:E.caseSensitive,end:w},j),_=E.route;if(!C)return null;Object.assign(f,C.params),v.push({params:f,pathname:hn([h,C.pathname]),pathnameBase:Wf(hn([h,C.pathnameBase])),route:_}),C.pathnameBase!=="/"&&(h=hn([h,C.pathnameBase]))}return v}function Df(s,a){typeof s=="string"&&(s={path:s,caseSensitive:!1,end:!0});let[u,c]=Of(s.path,s.caseSensitive,s.end),f=a.match(u);if(!f)return null;let h=f[0],v=h.replace(/(.)\/+$/,"$1"),x=f.slice(1);return{params:c.reduce((w,j,C)=>{let{paramName:_,isOptional:V}=j;if(_==="*"){let g=x[C]||"";v=h.slice(0,h.length-g.length).replace(/(.)\/+$/,"$1")}const U=x[C];return V&&!U?w[_]=void 0:w[_]=(U||"").replace(/%2F/g,"/"),w},{}),pathname:h,pathnameBase:v,pattern:s}}function Of(s,a,u){a===void 0&&(a=!1),u===void 0&&(u=!0),wi(s==="*"||!s.endsWith("*")||s.endsWith("/*"),'Route path "'+s+'" will be treated as if it were '+('"'+s.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+s.replace(/\*$/,"/*")+'".'));let c=[],f="^"+s.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(v,x,E)=>(c.push({paramName:x,isOptional:E!=null}),E?"/?([^\\/]+)?":"/([^\\/]+)"));return s.endsWith("*")?(c.push({paramName:"*"}),f+=s==="*"||s==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):u?f+="\\/*$":s!==""&&s!=="/"&&(f+="(?:(?=\\/|$))"),[new RegExp(f,a?void 0:"i"),c]}function bf(s){try{return s.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return wi(!1,'The URL path "'+s+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+a+").")),s}}function ki(s,a){if(a==="/")return s;if(!s.toLowerCase().startsWith(a.toLowerCase()))return null;let u=a.endsWith("/")?a.length-1:a.length,c=s.charAt(u);return c&&c!=="/"?null:s.slice(u)||"/"}const Mf=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ff=s=>Mf.test(s);function Bf(s,a){a===void 0&&(a="/");let{pathname:u,search:c="",hash:f=""}=typeof s=="string"?dr(s):s,h;if(u)if(Ff(u))h=u;else{if(u.includes("//")){let v=u;u=u.replace(/\/\/+/g,"/"),wi(!1,"Pathnames cannot have embedded double slashes - normalizing "+(v+" -> "+u))}u.startsWith("/")?h=Pc(u.substring(1),"/"):h=Pc(u,a)}else h=a;return{pathname:h,search:$f(c),hash:Kf(f)}}function Pc(s,a){let u=a.replace(/\/+$/,"").split("/");return s.split("/").forEach(f=>{f===".."?u.length>1&&u.pop():f!=="."&&u.push(f)}),u.length>1?u.join("/"):"/"}function hi(s,a,u,c){return"Cannot include a '"+s+"' character in a manually specified "+("`to."+a+"` field ["+JSON.stringify(c)+"]. Please separate it out to the ")+("`to."+u+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function Uf(s){return s.filter((a,u)=>u===0||a.route.path&&a.route.path.length>0)}function Ci(s,a){let u=Uf(s);return a?u.map((c,f)=>f===u.length-1?c.pathname:c.pathnameBase):u.map(c=>c.pathnameBase)}function Ni(s,a,u,c){c===void 0&&(c=!1);let f;typeof s=="string"?f=dr(s):(f=el({},s),Fe(!f.pathname||!f.pathname.includes("?"),hi("?","pathname","search",f)),Fe(!f.pathname||!f.pathname.includes("#"),hi("#","pathname","hash",f)),Fe(!f.search||!f.search.includes("#"),hi("#","search","hash",f)));let h=s===""||f.pathname==="",v=h?"/":f.pathname,x;if(v==null)x=u;else{let C=a.length-1;if(!c&&v.startsWith("..")){let _=v.split("/");for(;_[0]==="..";)_.shift(),C-=1;f.pathname=_.join("/")}x=C>=0?a[C]:"/"}let E=Bf(f,x),w=v&&v!=="/"&&v.endsWith("/"),j=(h||v===".")&&u.endsWith("/");return!E.pathname.endsWith("/")&&(w||j)&&(E.pathname+="/"),E}const hn=s=>s.join("/").replace(/\/\/+/g,"/"),Wf=s=>s.replace(/\/+$/,"").replace(/^\/*/,"/"),$f=s=>!s||s==="?"?"":s.startsWith("?")?s:"?"+s,Kf=s=>!s||s==="#"?"":s.startsWith("#")?s:"#"+s;function Vf(s){return s!=null&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.internal=="boolean"&&"data"in s}const Qc=["post","put","patch","delete"];new Set(Qc);const Hf=["get",...Qc];new Set(Hf);/**
50
- * React Router v6.30.3
51
- *
52
- * Copyright (c) Remix Software Inc.
53
- *
54
- * This source code is licensed under the MIT license found in the
55
- * LICENSE.md file in the root directory of this source tree.
56
- *
57
- * @license MIT
58
- */function tl(){return tl=Object.assign?Object.assign.bind():function(s){for(var a=1;a<arguments.length;a++){var u=arguments[a];for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&(s[c]=u[c])}return s},tl.apply(this,arguments)}const Ei=p.createContext(null),Qf=p.createContext(null),mn=p.createContext(null),vs=p.createContext(null),Ht=p.createContext({outlet:null,matches:[],isDataRoute:!1}),Yc=p.createContext(null);function Yf(s,a){let{relative:u}=a===void 0?{}:a;pr()||Fe(!1);let{basename:c,navigator:f}=p.useContext(mn),{hash:h,pathname:v,search:x}=Gc(s,{relative:u}),E=v;return c!=="/"&&(E=v==="/"?c:hn([c,v])),f.createHref({pathname:E,search:x,hash:h})}function pr(){return p.useContext(vs)!=null}function zn(){return pr()||Fe(!1),p.useContext(vs).location}function Jc(s){p.useContext(mn).static||p.useLayoutEffect(s)}function Pi(){let{isDataRoute:s}=p.useContext(Ht);return s?uh():Jf()}function Jf(){pr()||Fe(!1);let s=p.useContext(Ei),{basename:a,future:u,navigator:c}=p.useContext(mn),{matches:f}=p.useContext(Ht),{pathname:h}=zn(),v=JSON.stringify(Ci(f,u.v7_relativeSplatPath)),x=p.useRef(!1);return Jc(()=>{x.current=!0}),p.useCallback(function(w,j){if(j===void 0&&(j={}),!x.current)return;if(typeof w=="number"){c.go(w);return}let C=Ni(w,JSON.parse(v),h,j.relative==="path");s==null&&a!=="/"&&(C.pathname=C.pathname==="/"?a:hn([a,C.pathname])),(j.replace?c.replace:c.push)(C,j.state,j)},[a,c,v,h,s])}const Gf=p.createContext(null);function qf(s){let a=p.useContext(Ht).outlet;return a&&p.createElement(Gf.Provider,{value:s},a)}function Gc(s,a){let{relative:u}=a===void 0?{}:a,{future:c}=p.useContext(mn),{matches:f}=p.useContext(Ht),{pathname:h}=zn(),v=JSON.stringify(Ci(f,c.v7_relativeSplatPath));return p.useMemo(()=>Ni(s,JSON.parse(v),h,u==="path"),[s,v,h,u])}function Xf(s,a){return Zf(s,a)}function Zf(s,a,u,c){pr()||Fe(!1);let{navigator:f}=p.useContext(mn),{matches:h}=p.useContext(Ht),v=h[h.length-1],x=v?v.params:{};v&&v.pathname;let E=v?v.pathnameBase:"/";v&&v.route;let w=zn(),j;if(a){var C;let k=typeof a=="string"?dr(a):a;E==="/"||(C=k.pathname)!=null&&C.startsWith(E)||Fe(!1),j=k}else j=w;let _=j.pathname||"/",V=_;if(E!=="/"){let k=E.replace(/^\//,"").split("/");V="/"+_.replace(/^\//,"").split("/").slice(k.length).join("/")}let U=kf(s,{pathname:V}),g=lh(U&&U.map(k=>Object.assign({},k,{params:Object.assign({},x,k.params),pathname:hn([E,f.encodeLocation?f.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?E:hn([E,f.encodeLocation?f.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),h,u,c);return a&&g?p.createElement(vs.Provider,{value:{location:tl({pathname:"/",search:"",hash:"",state:null,key:"default"},j),navigationType:fn.Pop}},g):g}function eh(){let s=ah(),a=Vf(s)?s.status+" "+s.statusText:s instanceof Error?s.message:JSON.stringify(s),u=s instanceof Error?s.stack:null,f={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},a),u?p.createElement("pre",{style:f},u):null,null)}const th=p.createElement(eh,null);class nh extends p.Component{constructor(a){super(a),this.state={location:a.location,revalidation:a.revalidation,error:a.error}}static getDerivedStateFromError(a){return{error:a}}static getDerivedStateFromProps(a,u){return u.location!==a.location||u.revalidation!=="idle"&&a.revalidation==="idle"?{error:a.error,location:a.location,revalidation:a.revalidation}:{error:a.error!==void 0?a.error:u.error,location:u.location,revalidation:a.revalidation||u.revalidation}}componentDidCatch(a,u){console.error("React Router caught the following error during render",a,u)}render(){return this.state.error!==void 0?p.createElement(Ht.Provider,{value:this.props.routeContext},p.createElement(Yc.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function rh(s){let{routeContext:a,match:u,children:c}=s,f=p.useContext(Ei);return f&&f.static&&f.staticContext&&(u.route.errorElement||u.route.ErrorBoundary)&&(f.staticContext._deepestRenderedBoundaryId=u.route.id),p.createElement(Ht.Provider,{value:a},c)}function lh(s,a,u,c){var f;if(a===void 0&&(a=[]),u===void 0&&(u=null),c===void 0&&(c=null),s==null){var h;if(!u)return null;if(u.errors)s=u.matches;else if((h=c)!=null&&h.v7_partialHydration&&a.length===0&&!u.initialized&&u.matches.length>0)s=u.matches;else return null}let v=s,x=(f=u)==null?void 0:f.errors;if(x!=null){let j=v.findIndex(C=>C.route.id&&(x==null?void 0:x[C.route.id])!==void 0);j>=0||Fe(!1),v=v.slice(0,Math.min(v.length,j+1))}let E=!1,w=-1;if(u&&c&&c.v7_partialHydration)for(let j=0;j<v.length;j++){let C=v[j];if((C.route.HydrateFallback||C.route.hydrateFallbackElement)&&(w=j),C.route.id){let{loaderData:_,errors:V}=u,U=C.route.loader&&_[C.route.id]===void 0&&(!V||V[C.route.id]===void 0);if(C.route.lazy||U){E=!0,w>=0?v=v.slice(0,w+1):v=[v[0]];break}}}return v.reduceRight((j,C,_)=>{let V,U=!1,g=null,k=null;u&&(V=x&&C.route.id?x[C.route.id]:void 0,g=C.route.errorElement||th,E&&(w<0&&_===0?(ch("route-fallback"),U=!0,k=null):w===_&&(U=!0,k=C.route.hydrateFallbackElement||null)));let z=a.concat(v.slice(0,_+1)),B=()=>{let W;return V?W=g:U?W=k:C.route.Component?W=p.createElement(C.route.Component,null):C.route.element?W=C.route.element:W=j,p.createElement(rh,{match:C,routeContext:{outlet:j,matches:z,isDataRoute:u!=null},children:W})};return u&&(C.route.ErrorBoundary||C.route.errorElement||_===0)?p.createElement(nh,{location:u.location,revalidation:u.revalidation,component:g,error:V,children:B(),routeContext:{outlet:null,matches:z,isDataRoute:!0}}):B()},null)}var qc=(function(s){return s.UseBlocker="useBlocker",s.UseRevalidator="useRevalidator",s.UseNavigateStable="useNavigate",s})(qc||{}),Xc=(function(s){return s.UseBlocker="useBlocker",s.UseLoaderData="useLoaderData",s.UseActionData="useActionData",s.UseRouteError="useRouteError",s.UseNavigation="useNavigation",s.UseRouteLoaderData="useRouteLoaderData",s.UseMatches="useMatches",s.UseRevalidator="useRevalidator",s.UseNavigateStable="useNavigate",s.UseRouteId="useRouteId",s})(Xc||{});function sh(s){let a=p.useContext(Ei);return a||Fe(!1),a}function oh(s){let a=p.useContext(Qf);return a||Fe(!1),a}function ih(s){let a=p.useContext(Ht);return a||Fe(!1),a}function Zc(s){let a=ih(),u=a.matches[a.matches.length-1];return u.route.id||Fe(!1),u.route.id}function ah(){var s;let a=p.useContext(Yc),u=oh(),c=Zc();return a!==void 0?a:(s=u.errors)==null?void 0:s[c]}function uh(){let{router:s}=sh(qc.UseNavigateStable),a=Zc(Xc.UseNavigateStable),u=p.useRef(!1);return Jc(()=>{u.current=!0}),p.useCallback(function(f,h){h===void 0&&(h={}),u.current&&(typeof f=="number"?s.navigate(f):s.navigate(f,tl({fromRouteId:a},h)))},[s,a])}const _c={};function ch(s,a,u){_c[s]||(_c[s]=!0)}function dh(s,a){s==null||s.v7_startTransition,s==null||s.v7_relativeSplatPath}function ph(s){let{to:a,replace:u,state:c,relative:f}=s;pr()||Fe(!1);let{future:h,static:v}=p.useContext(mn),{matches:x}=p.useContext(Ht),{pathname:E}=zn(),w=Pi(),j=Ni(a,Ci(x,h.v7_relativeSplatPath),E,f==="path"),C=JSON.stringify(j);return p.useEffect(()=>w(JSON.parse(C),{replace:u,state:c,relative:f}),[w,C,f,u,c]),null}function ed(s){return qf(s.context)}function rt(s){Fe(!1)}function fh(s){let{basename:a="/",children:u=null,location:c,navigationType:f=fn.Pop,navigator:h,static:v=!1,future:x}=s;pr()&&Fe(!1);let E=a.replace(/^\/*/,"/"),w=p.useMemo(()=>({basename:E,navigator:h,static:v,future:tl({v7_relativeSplatPath:!1},x)}),[E,x,h,v]);typeof c=="string"&&(c=dr(c));let{pathname:j="/",search:C="",hash:_="",state:V=null,key:U="default"}=c,g=p.useMemo(()=>{let k=ki(j,E);return k==null?null:{location:{pathname:k,search:C,hash:_,state:V,key:U},navigationType:f}},[E,j,C,_,V,U,f]);return g==null?null:p.createElement(mn.Provider,{value:w},p.createElement(vs.Provider,{children:u,value:g}))}function td(s){let{children:a,location:u}=s;return Xf(xi(a),u)}new Promise(()=>{});function xi(s,a){a===void 0&&(a=[]);let u=[];return p.Children.forEach(s,(c,f)=>{if(!p.isValidElement(c))return;let h=[...a,f];if(c.type===p.Fragment){u.push.apply(u,xi(c.props.children,h));return}c.type!==rt&&Fe(!1),!c.props.index||!c.props.children||Fe(!1);let v={id:c.props.id||h.join("-"),caseSensitive:c.props.caseSensitive,element:c.props.element,Component:c.props.Component,index:c.props.index,path:c.props.path,loader:c.props.loader,action:c.props.action,errorElement:c.props.errorElement,ErrorBoundary:c.props.ErrorBoundary,hasErrorBoundary:c.props.ErrorBoundary!=null||c.props.errorElement!=null,shouldRevalidate:c.props.shouldRevalidate,handle:c.props.handle,lazy:c.props.lazy};c.props.children&&(v.children=xi(c.props.children,h)),u.push(v)}),u}/**
59
- * React Router DOM v6.30.3
60
- *
61
- * Copyright (c) Remix Software Inc.
62
- *
63
- * This source code is licensed under the MIT license found in the
64
- * LICENSE.md file in the root directory of this source tree.
65
- *
66
- * @license MIT
67
- */function vi(){return vi=Object.assign?Object.assign.bind():function(s){for(var a=1;a<arguments.length;a++){var u=arguments[a];for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&(s[c]=u[c])}return s},vi.apply(this,arguments)}function hh(s,a){if(s==null)return{};var u={},c=Object.keys(s),f,h;for(h=0;h<c.length;h++)f=c[h],!(a.indexOf(f)>=0)&&(u[f]=s[f]);return u}function mh(s){return!!(s.metaKey||s.altKey||s.ctrlKey||s.shiftKey)}function gh(s,a){return s.button===0&&(!a||a==="_self")&&!mh(s)}function Si(s){return s===void 0&&(s=""),new URLSearchParams(typeof s=="string"||Array.isArray(s)||s instanceof URLSearchParams?s:Object.keys(s).reduce((a,u)=>{let c=s[u];return a.concat(Array.isArray(c)?c.map(f=>[u,f]):[[u,c]])},[]))}function yh(s,a){let u=Si(s);return a&&a.forEach((c,f)=>{u.has(f)||a.getAll(f).forEach(h=>{u.append(f,h)})}),u}const xh=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],vh="6";try{window.__reactRouterVersion=vh}catch{}const Sh="startTransition",Tc=hf[Sh];function nd(s){let{basename:a,children:u,future:c,window:f}=s,h=p.useRef();h.current==null&&(h.current=Sf({window:f,v5Compat:!0}));let v=h.current,[x,E]=p.useState({action:v.action,location:v.location}),{v7_startTransition:w}=c||{},j=p.useCallback(C=>{w&&Tc?Tc(()=>E(C)):E(C)},[E,w]);return p.useLayoutEffect(()=>v.listen(j),[v,j]),p.useEffect(()=>dh(c),[c]),p.createElement(fh,{basename:a,children:u,location:x.location,navigationType:x.action,navigator:v,future:c})}const jh=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",wh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bt=p.forwardRef(function(a,u){let{onClick:c,relative:f,reloadDocument:h,replace:v,state:x,target:E,to:w,preventScrollReset:j,viewTransition:C}=a,_=hh(a,xh),{basename:V}=p.useContext(mn),U,g=!1;if(typeof w=="string"&&wh.test(w)&&(U=w,jh))try{let W=new URL(window.location.href),G=w.startsWith("//")?new URL(W.protocol+w):new URL(w),Y=ki(G.pathname,V);G.origin===W.origin&&Y!=null?w=Y+G.search+G.hash:g=!0}catch{}let k=Yf(w,{relative:f}),z=kh(w,{replace:v,state:x,target:E,preventScrollReset:j,relative:f,viewTransition:C});function B(W){c&&c(W),W.defaultPrevented||z(W)}return p.createElement("a",vi({},_,{href:U||k,onClick:g||h?c:B,ref:u,target:E}))});var Rc;(function(s){s.UseScrollRestoration="useScrollRestoration",s.UseSubmit="useSubmit",s.UseSubmitFetcher="useSubmitFetcher",s.UseFetcher="useFetcher",s.useViewTransitionState="useViewTransitionState"})(Rc||(Rc={}));var Lc;(function(s){s.UseFetcher="useFetcher",s.UseFetchers="useFetchers",s.UseScrollRestoration="useScrollRestoration"})(Lc||(Lc={}));function kh(s,a){let{target:u,replace:c,state:f,preventScrollReset:h,relative:v,viewTransition:x}=a===void 0?{}:a,E=Pi(),w=zn(),j=Gc(s,{relative:v});return p.useCallback(C=>{if(gh(C,u)){C.preventDefault();let _=c!==void 0?c:ys(w)===ys(j);E(s,{replace:_,state:f,preventScrollReset:h,relative:v,viewTransition:x})}},[w,E,j,c,f,u,s,h,v,x])}function Ch(s){let a=p.useRef(Si(s)),u=p.useRef(!1),c=zn(),f=p.useMemo(()=>yh(c.search,u.current?null:a.current),[c.search]),h=Pi(),v=p.useCallback((x,E)=>{const w=Si(typeof x=="function"?x(f):x);u.current=!0,h("?"+w,E)},[h,f]);return[f,v]}function rd({sidebar:s,children:a}){return r.jsxs("div",{className:"container",children:[r.jsxs("aside",{className:"sidebar",children:[r.jsx("div",{className:"sidebar-brand",children:r.jsx("img",{src:"/logo_dark.png",alt:"Teleton",style:{height:"64px"}})}),s]}),r.jsx("main",{className:"main",children:a??r.jsx(ed,{})})]})}const Nh="/api/agent/events",Eh="/api/agent/status",Ph=5,_h=3e4,Th=3e3;function Rh(s){const a=Math.min(1e3*2**s,_h),u=a*.3*Math.random();return a+u}function Lh(){const[s,a]=p.useState("stopped"),[u,c]=p.useState(null),f=p.useRef(!0),h=p.useRef(null),v=p.useRef(0),x=p.useRef(null),E=p.useRef(null),w=p.useRef(!1);return p.useEffect(()=>{f.current=!0;function j(k){if(f.current)try{const z=JSON.parse(k.data);a(z.state),c(z.error??null),v.current=0}catch{}}function C(){h.current&&(h.current.removeEventListener("status",j),h.current.close(),h.current=null)}function _(){E.current&&(clearInterval(E.current),E.current=null)}function V(){if(E.current)return;const k=async()=>{if(f.current)try{const z=await fetch(Eh,{credentials:"include"});if(!z.ok)return;const B=await z.json(),W=B.data??B;f.current&&(a(W.state),c(W.error??null))}catch{}};k(),E.current=setInterval(k,Th)}function U(){if(!f.current)return;C();const k=new EventSource(Nh,{withCredentials:!0});h.current=k,k.addEventListener("status",j),k.addEventListener("open",()=>{v.current=0,w.current=!1,_()}),k.onerror=()=>{if(C(),!!f.current)if(v.current+=1,v.current<=Ph){const z=Rh(v.current-1);x.current=setTimeout(U,z)}else w.current=!0,V()}}function g(){document.hidden?(C(),_(),x.current&&(clearTimeout(x.current),x.current=null)):(v.current=0,w.current=!1,U())}return U(),document.addEventListener("visibilitychange",g),()=>{f.current=!1,C(),_(),x.current&&(clearTimeout(x.current),x.current=null),document.removeEventListener("visibilitychange",g)}},[]),{state:s,error:u}}const zc="/api",zh=3,Ih=[1e3,2e3,4e3];function Ah(s){return s+s*.3*Math.random()}const Dh={stopped:{dot:"var(--text-tertiary)",label:"Stopped",pulse:!1},starting:{dot:"#FFD60A",label:"Starting...",pulse:!0},running:{dot:"var(--green)",label:"Running",pulse:!0},stopping:{dot:"#FF9F0A",label:"Stopping...",pulse:!0},error:{dot:"var(--red)",label:"Error",pulse:!1}};function Oh(){const{state:s,error:a}=Lh(),[u,c]=p.useState(!1),[f,h]=p.useState(!1),[v,x]=p.useState(null),[E,w]=p.useState(!1),j=p.useRef(null),C=p.useRef(null),_=a&&s==="stopped"?"error":s,V=Dh[_],U=p.useCallback(()=>{j.current&&(clearTimeout(j.current),j.current=null),w(!1)},[]),g=p.useCallback(async(Y=0)=>{c(!0),x(null),C.current=new AbortController;try{const M=await fetch(`${zc}/agent/start`,{method:"POST",credentials:"include",signal:AbortSignal.timeout(1e4)}),ee=await M.json();if(!M.ok&&ee.error)throw new Error(ee.error)}catch(M){if(!j.current&&Y<zh){w(!0);const ee=Ah(Ih[Y]??4e3);j.current=setTimeout(()=>{j.current=null,g(Y+1)},ee),x(M instanceof Error?M.message:String(M)),c(!1);return}x(M instanceof Error?M.message:String(M)),w(!1)}finally{c(!1),C.current=null}},[]),k=p.useCallback(async()=>{h(!1),c(!0),x(null),U();try{const Y=await fetch(`${zc}/agent/stop`,{method:"POST",credentials:"include",signal:AbortSignal.timeout(1e4)}),M=await Y.json();if(!Y.ok&&M.error)throw new Error(M.error)}catch(Y){x(Y instanceof Error?Y.message:String(Y))}finally{c(!1)}},[U]),z=()=>{U(),g(0)},B=()=>{h(!0)},W=_==="stopped"||_==="error",G=_==="running";return r.jsxs("div",{style:{padding:"0 12px",marginBottom:"8px"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[r.jsx("span",{style:{display:"inline-block",width:"8px",height:"8px",borderRadius:"50%",backgroundColor:V.dot,animation:V.pulse?"agent-pulse 2s ease-in-out infinite":"none",flexShrink:0}}),r.jsx("span",{style:{fontSize:"12px",fontWeight:500,color:"var(--text-secondary)"},children:V.label})]}),W&&!E&&r.jsx("button",{onClick:z,disabled:u,style:{width:"100%",background:"var(--green-dim)",color:"var(--green)",border:"1px solid rgba(48, 209, 88, 0.2)",fontSize:"12px",padding:"6px 12px"},children:u?"Starting...":"Start Agent"}),G&&r.jsx("button",{onClick:B,disabled:u,className:"btn-danger",style:{width:"100%",fontSize:"12px",padding:"6px 12px"},children:u?"Stopping...":"Stop Agent"}),E&&r.jsx("div",{style:{fontSize:"11px",color:"var(--text-tertiary)",marginTop:"4px"},children:"Retrying..."}),v&&!E&&r.jsx("div",{style:{fontSize:"11px",color:"var(--red)",marginTop:"4px",lineHeight:"1.4",wordBreak:"break-word"},children:v}),f&&Kc.createPortal(r.jsx("div",{className:"modal-overlay",onClick:()=>h(!1),children:r.jsxs("div",{className:"modal",onClick:Y=>Y.stopPropagation(),style:{maxWidth:"360px"},children:[r.jsx("h2",{style:{fontSize:"15px",fontWeight:600,marginBottom:"8px"},children:"Stop Agent?"}),r.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",marginBottom:"20px",lineHeight:"1.5"},children:"Active Telegram sessions will be interrupted."}),r.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[r.jsx("button",{className:"btn-ghost",onClick:()=>h(!1),style:{fontSize:"13px"},children:"Cancel"}),r.jsx("button",{className:"btn-danger",onClick:k,style:{fontSize:"13px"},children:"Stop"})]})]})}),document.body),r.jsx("style",{children:`
68
- @keyframes agent-pulse {
69
- 0%, 100% { opacity: 1; }
70
- 50% { opacity: 0.4; }
71
- }
72
- `})]})}const _i="/api";async function Ze(s,a){const u={"Content-Type":"application/json",...a==null?void 0:a.headers},c=await fetch(`${_i}${s}`,{...a,headers:u});if(!c.ok){const h=await c.json().catch(()=>({error:c.statusText}));throw new Error(h.error||`HTTP ${c.status}`)}const f=await c.json();return f.data!==void 0?f.data:f}async function me(s,a){const u={"Content-Type":"application/json",...a==null?void 0:a.headers},c=await fetch(`${_i}${s}`,{...a,headers:u,credentials:"include"});if(!c.ok){const f=await c.json().catch(()=>({error:c.statusText}));throw new Error(f.error||`HTTP ${c.status}`)}return c.json()}async function bh(){var s;try{const u=await(await fetch("/auth/check",{credentials:"include"})).json();return u.success&&((s=u.data)==null?void 0:s.authenticated)}catch{return!1}}async function Ic(s){try{return(await fetch("/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:s}),credentials:"include"})).ok}catch{return!1}}async function Mh(){await fetch("/auth/logout",{method:"POST",credentials:"include"}).catch(()=>{})}const ue={async getStatus(){return me("/status")},async getTools(){return me("/tools")},async getMemoryStats(){return me("/memory/stats")},async searchKnowledge(s,a=10){return me(`/memory/search?q=${encodeURIComponent(s)}&limit=${a}`)},async getMemorySources(){return me("/memory/sources")},async getSourceChunks(s){return me(`/memory/sources/${encodeURIComponent(s)}`)},async getSoulFile(s){return me(`/soul/${s}`)},async updateSoulFile(s,a){return me(`/soul/${s}`,{method:"PUT",body:JSON.stringify({content:a})})},async getPlugins(){return me("/plugins")},async getToolRag(){return me("/tools/rag")},async updateToolRag(s){return me("/tools/rag",{method:"PUT",body:JSON.stringify(s)})},async getMcpServers(){return me("/mcp")},async addMcpServer(s){return me("/mcp",{method:"POST",body:JSON.stringify(s)})},async removeMcpServer(s){return me(`/mcp/${encodeURIComponent(s)}`,{method:"DELETE"})},async updateToolConfig(s,a){return me(`/tools/${s}`,{method:"PUT",body:JSON.stringify(a)})},async workspaceList(s="",a=!1){const u=new URLSearchParams;s&&u.set("path",s),a&&u.set("recursive","true");const c=u.toString();return me(`/workspace${c?`?${c}`:""}`)},async workspaceRead(s){return me(`/workspace/read?path=${encodeURIComponent(s)}`)},async workspaceWrite(s,a){return me("/workspace/write",{method:"POST",body:JSON.stringify({path:s,content:a})})},async workspaceMkdir(s){return me("/workspace/mkdir",{method:"POST",body:JSON.stringify({path:s})})},async workspaceDelete(s,a=!1){return me("/workspace",{method:"DELETE",body:JSON.stringify({path:s,recursive:a})})},async workspaceRename(s,a){return me("/workspace/rename",{method:"POST",body:JSON.stringify({from:s,to:a})})},async workspaceInfo(){return me("/workspace/info")},workspaceRawUrl(s){return`/api/workspace/raw?path=${encodeURIComponent(s)}`},async tasksList(s){const a=s?`?status=${s}`:"";return me(`/tasks${a}`)},async tasksGet(s){return me(`/tasks/${s}`)},async tasksDelete(s){return me(`/tasks/${s}`,{method:"DELETE"})},async tasksCancel(s){return me(`/tasks/${s}/cancel`,{method:"POST"})},async tasksClean(s){return me("/tasks/clean",{method:"POST",body:JSON.stringify({status:s})})},async tasksCleanDone(){return me("/tasks/clean-done",{method:"POST"})},async getConfigKeys(){return me("/config")},async setConfigKey(s,a){return me(`/config/${s}`,{method:"PUT",body:JSON.stringify({value:a})})},async unsetConfigKey(s){return me(`/config/${s}`,{method:"DELETE"})},async getModelsForProvider(s){return me(`/config/models/${encodeURIComponent(s)}`)},async getProviderMeta(s){return me(`/config/provider-meta/${encodeURIComponent(s)}`)},async validateApiKey(s,a){return me("/config/validate-api-key",{method:"POST",body:JSON.stringify({provider:s,apiKey:a})})},async getMarketplace(s=!1){return me(`/marketplace${s?"?refresh=true":""}`)},async installPlugin(s){return me("/marketplace/install",{method:"POST",body:JSON.stringify({id:s})})},async uninstallPlugin(s){return me("/marketplace/uninstall",{method:"POST",body:JSON.stringify({id:s})})},async updatePlugin(s){return me("/marketplace/update",{method:"POST",body:JSON.stringify({id:s})})},async getPluginSecrets(s){return me(`/marketplace/secrets/${encodeURIComponent(s)}`)},async setPluginSecret(s,a,u){return me(`/marketplace/secrets/${encodeURIComponent(s)}/${encodeURIComponent(a)}`,{method:"PUT",body:JSON.stringify({value:u})})},async unsetPluginSecret(s,a){return me(`/marketplace/secrets/${encodeURIComponent(s)}/${encodeURIComponent(a)}`,{method:"DELETE"})},connectLogs(s,a){const u=`${_i}/logs/stream`,c=new EventSource(u);return c.addEventListener("log",f=>{try{const h=JSON.parse(f.data);s(h)}catch(h){console.error("Failed to parse log entry:",h)}}),c.onerror=f=>{a==null||a(f)},()=>c.close()}},Ye={getStatus:()=>Ze("/setup/status"),getProviders:()=>Ze("/setup/providers"),getModels:s=>Ze(`/setup/models/${encodeURIComponent(s)}`),validateApiKey:(s,a)=>Ze("/setup/validate/api-key",{method:"POST",body:JSON.stringify({provider:s,apiKey:a})}),detectClaudeCodeKey:()=>Ze("/setup/detect-claude-code-key"),validateBotToken:s=>Ze("/setup/validate/bot-token",{method:"POST",body:JSON.stringify({token:s})}),initWorkspace:s=>Ze("/setup/workspace/init",{method:"POST",body:JSON.stringify({agentName:s})}),getWalletStatus:()=>Ze("/setup/wallet/status"),generateWallet:()=>Ze("/setup/wallet/generate",{method:"POST"}),importWallet:s=>Ze("/setup/wallet/import",{method:"POST",body:JSON.stringify({mnemonic:s})}),sendCode:(s,a,u)=>Ze("/setup/telegram/send-code",{method:"POST",body:JSON.stringify({apiId:s,apiHash:a,phone:u})}),verifyCode:(s,a)=>Ze("/setup/telegram/verify-code",{method:"POST",body:JSON.stringify({authSessionId:s,code:a})}),verifyPassword:(s,a)=>Ze("/setup/telegram/verify-password",{method:"POST",body:JSON.stringify({authSessionId:s,password:a})}),resendCode:s=>Ze("/setup/telegram/resend-code",{method:"POST",body:JSON.stringify({authSessionId:s})}),saveConfig:s=>Ze("/setup/config/save",{method:"POST",body:JSON.stringify(s)}),launch:()=>Ze("/setup/launch",{method:"POST"}),pollHealth:async(s=3e4)=>{const a=Date.now(),u=1e3;for(await new Promise(c=>setTimeout(c,1500));Date.now()-a<s;){try{const c=await fetch("/auth/check",{signal:AbortSignal.timeout(2e3)});if(c.ok){const f=await c.json();if(f.success&&f.data&&!f.data.setup)return}}catch{}await new Promise(c=>setTimeout(c,u))}throw new Error("Agent did not start within the expected time")}};function Fh(){const s=zn(),a=c=>s.pathname===c,u=async()=>{await Mh(),window.location.href="/"};return r.jsxs(r.Fragment,{children:[r.jsxs("nav",{children:[r.jsx(bt,{to:"/",className:a("/")?"active":"",children:"Dashboard"}),r.jsx(bt,{to:"/tools",className:a("/tools")?"active":"",children:"Tools"}),r.jsx(bt,{to:"/plugins",className:a("/plugins")?"active":"",children:"Plugins"}),r.jsx(bt,{to:"/soul",className:a("/soul")?"active":"",children:"Soul"}),r.jsx(bt,{to:"/memory",className:a("/memory")?"active":"",children:"Memory"}),r.jsx(bt,{to:"/logs",className:a("/logs")?"active":"",children:"Logs"}),r.jsx(bt,{to:"/workspace",className:a("/workspace")?"active":"",children:"Workspace"}),r.jsx(bt,{to:"/tasks",className:a("/tasks")?"active":"",children:"Tasks"}),r.jsx(bt,{to:"/mcp",className:a("/mcp")?"active":"",children:"MCP"}),r.jsx(bt,{to:"/config",className:a("/config")?"active":"",children:"Config"})]}),r.jsxs("div",{style:{marginTop:"auto"},children:[r.jsx(Oh,{}),r.jsx("div",{style:{padding:"0 12px 14px"},children:r.jsx("button",{onClick:u,style:{width:"100%",opacity:.7,fontSize:"13px"},children:"Logout"})})]})]})}function Bh(){return r.jsx(rd,{sidebar:r.jsx(Fh,{})})}class ld extends p.Component{constructor(){super(...arguments);Ot(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(u){return{hasError:!0,error:u.message}}render(){return this.state.hasError?r.jsxs("div",{className:"card",style:{textAlign:"center",padding:"40px 20px"},children:[r.jsx("h2",{style:{color:"var(--red)",marginBottom:"8px"},children:"Something went wrong"}),r.jsx("p",{style:{color:"var(--text-secondary)",marginBottom:"16px"},children:this.state.error}),r.jsx("button",{onClick:()=>this.setState({hasError:!1,error:null}),children:"Try Again"})]}):this.props.children}}function sd(){const[s,a]=p.useState(null),[u,c]=p.useState(null),[f,h]=p.useState(null),[v,x]=p.useState(!0),[E,w]=p.useState(null),[j,C]=p.useState(null),[_,V]=p.useState([]),[U,g]=p.useState(null),[k,z]=p.useState(null),[B,W]=p.useState(""),[G,Y]=p.useState(!1),[M,ee]=p.useState(null),[Q,F]=p.useState({}),A=p.useCallback(()=>{Promise.all([ue.getStatus(),ue.getMemoryStats(),ue.getConfigKeys(),ue.getToolRag()]).then(([D,S,O,ce])=>{a(D.data),c(S.data),h(ce.data);const he={};for(const xe of O.data)xe.value!=null&&(he[xe.key]=xe.value);F(he),x(!1)}).catch(D=>{w(D.message),x(!1)})},[]);p.useEffect(()=>{A()},[A]);const b=D=>Q[D]??"",se=D=>{C(D),setTimeout(()=>C(null),2e3)},R=async(D,S)=>{if(S.trim())try{w(null),await ue.setConfigKey(D,S.trim()),await A(),se(`Saved ${D.split(".").pop()}`)}catch(O){w(O instanceof Error?O.message:String(O))}},ae=async D=>{try{const S=await ue.updateToolRag(D);h(S.data),se("Tool RAG updated")}catch(S){w(S instanceof Error?S.message:String(S))}},ye=(D,S)=>{F(O=>({...O,[D]:S}))},ge=b("agent.provider");return p.useEffect(()=>{ge&&ue.getModelsForProvider(ge).then(D=>{const S=D.data.map(ce=>({value:ce.value,name:ce.name}));V(S);const O=Q["agent.model"]??"";S.length>0&&!S.some(ce=>ce.value===O)&&R("agent.model",S[0].value)}).catch(()=>V([]))},[ge]),{loading:v,error:E,setError:w,saveSuccess:j,status:s,stats:u,toolRag:f,localInputs:Q,getLocal:b,setLocal:ye,saveConfig:R,saveToolRag:ae,showSuccess:se,modelOptions:_,pendingProvider:U,pendingMeta:k,pendingApiKey:B,setPendingApiKey:W,pendingValidating:G,pendingError:M,setPendingError:ee,handleProviderChange:async D=>{if(D!==ge)try{const O=(await ue.getProviderMeta(D)).data;O.needsKey?(g(D),z(O),W(""),ee(null)):(await R("agent.provider",D),g(null),z(null))}catch(S){w(S instanceof Error?S.message:String(S))}},handleProviderConfirm:async()=>{if(!(!U||!k)){if(k.needsKey&&!B.trim()){ee("API key is required");return}Y(!0),ee(null);try{const D=await ue.validateApiKey(U,B);if(!D.data.valid){ee(D.data.error||"Invalid API key"),Y(!1);return}await ue.setConfigKey("agent.api_key",B.trim()),await R("agent.provider",U),g(null),z(null),W(""),se(`Switched to ${k.displayName}`)}catch(D){ee(D instanceof Error?D.message:String(D))}finally{Y(!1)}}},handleProviderCancel:()=>{g(null),z(null),W(""),ee(null)},loadData:A}}function ct({value:s,options:a,labels:u,onChange:c,style:f}){const[h,v]=p.useState(!1),[x,E]=p.useState(-1),[w,j]=p.useState(null),C=p.useRef(null),_=p.useRef(null),V=p.useRef(Math.random().toString(36).slice(2));p.useEffect(()=>{if(!h)return;const k=z=>{var G,Y;const B=z.target;((G=C.current)==null?void 0:G.contains(B))||((Y=_.current)==null?void 0:Y.contains(B))||v(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[h]),p.useEffect(()=>{if(h&&C.current){const k=C.current.getBoundingClientRect();j({top:k.bottom+4,left:k.left,width:k.width})}else j(null)},[h]),p.useEffect(()=>{if(h){const k=a.indexOf(s);E(k>=0?k:0)}},[h,a,s]),p.useEffect(()=>{if(!h||x<0||!_.current)return;const k=_.current.children[x];k==null||k.scrollIntoView({block:"nearest"})},[h,x]);const U=p.useCallback(k=>{if(!h){(k.key==="Enter"||k.key===" "||k.key==="ArrowDown")&&(k.preventDefault(),v(!0));return}switch(k.key){case"ArrowDown":k.preventDefault(),E(z=>(z+1)%a.length);break;case"ArrowUp":k.preventDefault(),E(z=>(z-1+a.length)%a.length);break;case"Enter":case" ":k.preventDefault(),x>=0&&x<a.length&&(c(a[x]),v(!1));break;case"Escape":k.preventDefault(),v(!1);break;case"Home":k.preventDefault(),E(0);break;case"End":k.preventDefault(),E(a.length-1);break}},[h,x,a,c]),g=`select-menu-${V.current}`;return r.jsxs("div",{ref:C,className:"custom-select",style:f,children:[r.jsxs("button",{type:"button",className:"custom-select-trigger",onClick:()=>v(!h),onKeyDown:U,"aria-haspopup":"listbox","aria-expanded":h,"aria-controls":h?g:void 0,children:[r.jsx("span",{children:u?u[a.indexOf(s)]??s:s}),r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"M6 9l6 6 6-6"})})]}),h&&w&&Kc.createPortal(r.jsx("div",{ref:_,id:g,className:"custom-select-menu",role:"listbox","aria-activedescendant":x>=0?`${g}-opt-${x}`:void 0,style:{position:"fixed",top:w.top,left:w.left,width:w.width},children:a.map((k,z)=>r.jsx("div",{id:`${g}-opt-${z}`,role:"option","aria-selected":k===s,className:`custom-select-option${k===s?" active":""}${z===x?" focused":""}`,onClick:()=>{c(k),v(!1)},onMouseEnter:()=>E(z),children:u?u[z]??k:k},k))}),document.body)]})}function od({getLocal:s,setLocal:a,saveConfig:u,modelOptions:c,pendingProvider:f,pendingMeta:h,pendingApiKey:v,setPendingApiKey:x,pendingValidating:E,pendingError:w,setPendingError:j,handleProviderChange:C,handleProviderConfirm:_,handleProviderCancel:V,compact:U=!1}){return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"section-title",children:"Agent"}),r.jsxs("div",{style:{display:"grid",gap:"16px"},children:[r.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[r.jsx("label",{children:"Provider"}),r.jsx(ct,{value:f??s("agent.provider"),options:["claude-code","anthropic","openai","google","xai","groq","openrouter","moonshot","mistral","cocoon","local"],labels:["Claude Code","Anthropic","OpenAI","Google","xAI","Groq","OpenRouter","Moonshot","Mistral","Cocoon","Local"],onChange:C})]}),f&&h&&r.jsxs("div",{className:"provider-switch-zone",children:[r.jsxs("div",{style:{fontSize:"13px",fontWeight:500,marginBottom:"12px"},children:["Switching to ",h.displayName]}),h.needsKey&&r.jsxs("div",{className:"form-group",style:{marginBottom:"8px"},children:[r.jsx("label",{children:"API Key"}),r.jsx("input",{type:"password",placeholder:h.keyHint,value:v,onChange:g=>{x(g.target.value),j(null)},onKeyDown:g=>g.key==="Enter"&&_(),style:{width:"100%"},autoFocus:!0}),h.consoleUrl&&r.jsxs("a",{href:h.consoleUrl,target:"_blank",rel:"noopener noreferrer",style:{fontSize:"12px",color:"var(--text-secondary)",marginTop:"4px",display:"inline-block"},children:["Get key at ",new URL(h.consoleUrl).hostname," ↗"]})]}),w&&r.jsx("div",{style:{fontSize:"12px",color:"var(--red)",marginBottom:"8px"},children:w}),r.jsxs("div",{style:{display:"flex",gap:"8px"},children:[r.jsx("button",{className:"btn-ghost btn-sm",onClick:V,disabled:E,children:"Cancel"}),r.jsx("button",{className:"btn-sm",onClick:_,disabled:E,children:E?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Validating..."]}):"Validate & Save"})]})]}),r.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[r.jsx("label",{children:"Model"}),r.jsx(ct,{value:s("agent.model"),options:c.map(g=>g.value),labels:c.map(g=>g.name),onChange:g=>u("agent.model",g)})]}),!U&&r.jsxs("div",{style:{display:"grid",gap:"12px"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("label",{style:{fontSize:"13px",color:"var(--text)"},children:"Temperature (0-2)"}),r.jsx("input",{type:"number",min:"0",max:"2",step:"0.1",value:s("agent.temperature"),onChange:g=>a("agent.temperature",g.target.value),onBlur:g=>u("agent.temperature",g.target.value),onKeyDown:g=>g.key==="Enter"&&u("agent.temperature",g.currentTarget.value),style:{width:"120px",textAlign:"right"}})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("label",{style:{fontSize:"13px",color:"var(--text)"},children:"Max Tokens"}),r.jsx("input",{type:"number",min:"1",value:s("agent.max_tokens"),onChange:g=>a("agent.max_tokens",g.target.value),onBlur:g=>u("agent.max_tokens",g.target.value),onKeyDown:g=>g.key==="Enter"&&u("agent.max_tokens",g.currentTarget.value),style:{width:"120px",textAlign:"right"}})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("label",{style:{fontSize:"13px",color:"var(--text)"},children:"Max Iterations (1-20)"}),r.jsx("input",{type:"number",min:"1",max:"20",value:s("agent.max_agentic_iterations"),onChange:g=>a("agent.max_agentic_iterations",g.target.value),onBlur:g=>u("agent.max_agentic_iterations",g.target.value),onKeyDown:g=>g.key==="Enter"&&u("agent.max_agentic_iterations",g.currentTarget.value),style:{width:"120px",textAlign:"right"}})]})]})]})]})}function ms({label:s,configKey:a,getLocal:u,setLocal:c,saveConfig:f}){return r.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[r.jsx("label",{children:s}),r.jsx("input",{type:"text",value:u(a),onChange:h=>c(a,h.target.value),onBlur:h=>f(a,h.target.value),onKeyDown:h=>h.key==="Enter"&&f(a,h.currentTarget.value),style:{width:"100%"}})]})}function id({getLocal:s,setLocal:a,saveConfig:u,extended:c}){return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"section-title",children:"Telegram"}),r.jsxs("div",{style:{display:"grid",gap:"16px"},children:[c&&r.jsxs(r.Fragment,{children:[r.jsx(ms,{label:"Bot Username",configKey:"telegram.bot_username",getLocal:s,setLocal:a,saveConfig:u}),r.jsx(ms,{label:"Owner Name",configKey:"telegram.owner_name",getLocal:s,setLocal:a,saveConfig:u}),r.jsx(ms,{label:"Owner Username",configKey:"telegram.owner_username",getLocal:s,setLocal:a,saveConfig:u})]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[r.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[r.jsx("label",{children:"DM Policy"}),r.jsx(ct,{value:s("telegram.dm_policy"),options:["open","allowlist","disabled"],labels:["Open","Allow Users","Admin Only"],onChange:f=>u("telegram.dm_policy",f)})]}),r.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[r.jsx("label",{children:"Group Policy"}),r.jsx(ct,{value:s("telegram.group_policy"),options:["open","allowlist","disabled"],labels:["Open","Allow Groups","Disabled"],onChange:f=>u("telegram.group_policy",f)})]})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("label",{style:{fontSize:"13px",color:"var(--text)",cursor:"pointer"},htmlFor:"require-mention",children:"Require Mention"}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{id:"require-mention",type:"checkbox",checked:s("telegram.require_mention")==="true",onChange:f=>u("telegram.require_mention",String(f.target.checked))}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]}),c&&r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("label",{style:{fontSize:"13px",color:"var(--text)",cursor:"pointer"},htmlFor:"typing-sim",children:"Typing Simulation"}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{id:"typing-sim",type:"checkbox",checked:s("telegram.typing_simulation")==="true",onChange:f=>u("telegram.typing_simulation",String(f.target.checked))}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]}),c&&r.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[r.jsx("label",{children:"Debounce (ms)"}),r.jsx("input",{type:"number",min:"0",value:s("telegram.debounce_ms"),onChange:f=>a("telegram.debounce_ms",f.target.value),onBlur:f=>u("telegram.debounce_ms",f.target.value),onKeyDown:f=>f.key==="Enter"&&u("telegram.debounce_ms",f.currentTarget.value),style:{width:"100%"}})]}),c&&r.jsx(ms,{label:"Agent Channel",configKey:"telegram.agent_channel",getLocal:s,setLocal:a,saveConfig:u})]})]})}function Uh(){const{loading:s,error:a,setError:u,saveSuccess:c,status:f,stats:h,getLocal:v,setLocal:x,saveConfig:E,modelOptions:w,pendingProvider:j,pendingMeta:C,pendingApiKey:_,setPendingApiKey:V,pendingValidating:U,pendingError:g,setPendingError:k,handleProviderChange:z,handleProviderConfirm:B,handleProviderCancel:W}=sd();return s?r.jsx("div",{className:"loading",children:"Loading..."}):!f||!h?r.jsx("div",{className:"alert error",children:"Failed to load dashboard data"}):r.jsxs("div",{children:[r.jsxs("div",{className:"header",children:[r.jsx("h1",{children:"Dashboard"}),r.jsx("p",{children:"System status and settings"})]}),a&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[a,r.jsx("button",{onClick:()=>u(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),c&&r.jsx("div",{className:"alert success",style:{marginBottom:"16px"},children:c}),r.jsxs("div",{className:"stats",children:[r.jsxs("div",{className:"stat-card",children:[r.jsx("h3",{children:"Uptime"}),r.jsxs("div",{className:"value",children:[Math.floor(f.uptime/60),"m"]})]}),r.jsxs("div",{className:"stat-card",children:[r.jsx("h3",{children:"Model"}),r.jsx("div",{className:"value",style:{fontSize:"14px"},children:f.model})]}),r.jsxs("div",{className:"stat-card",children:[r.jsx("h3",{children:"Sessions"}),r.jsx("div",{className:"value",children:f.sessionCount})]}),r.jsxs("div",{className:"stat-card",children:[r.jsx("h3",{children:"Tools"}),r.jsx("div",{className:"value",children:f.toolCount})]})]}),r.jsxs("div",{className:"card",children:[r.jsx("div",{className:"section-title",children:"Memory"}),r.jsxs("div",{className:"stats",style:{marginBottom:0},children:[r.jsxs("div",{className:"stat-card",children:[r.jsx("h3",{children:"Knowledge"}),r.jsx("div",{className:"value",children:h.knowledge})]}),r.jsxs("div",{className:"stat-card",children:[r.jsx("h3",{children:"Messages"}),r.jsx("div",{className:"value",children:h.messages})]}),r.jsxs("div",{className:"stat-card",children:[r.jsx("h3",{children:"Chats"}),r.jsx("div",{className:"value",children:h.chats})]})]})]}),r.jsx("div",{className:"card",children:r.jsx(od,{compact:!0,getLocal:v,setLocal:x,saveConfig:E,modelOptions:w,pendingProvider:j,pendingMeta:C,pendingApiKey:_,setPendingApiKey:V,pendingValidating:U,pendingError:g,setPendingError:k,handleProviderChange:z,handleProviderConfirm:B,handleProviderCancel:W})}),r.jsx("div",{className:"card",children:r.jsx(id,{getLocal:v,setLocal:x,saveConfig:E})})]})}function ad({tool:s,updating:a,onToggle:u,onScope:c}){return r.jsxs("div",{className:"tool-row",style:{opacity:s.enabled?1:.5,display:"grid",gridTemplateColumns:"1fr auto auto",gap:"10px",alignItems:"center"},children:[r.jsxs("div",{style:{minWidth:0},children:[r.jsx("div",{className:"tool-name",children:s.name}),r.jsx("div",{className:"tool-desc",children:s.description})]}),r.jsx("div",{className:`scope-seg${!s.enabled||a===s.name?" disabled":""}`,children:["always","dm-only","group-only","admin-only"].map(f=>r.jsx("button",{className:s.scope===f?"active":"",disabled:!s.enabled||a===s.name,onClick:()=>c(s.name,f),children:f==="always"?"All":f==="dm-only"?"DM":f==="group-only"?"Group":"Admin"},f))}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{type:"checkbox",checked:s.enabled,onChange:()=>u(s.name,s.enabled),disabled:a===s.name}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]})}function Wh(){const[s,a]=p.useState([]),[u,c]=p.useState(!0),[f,h]=p.useState(null),[v,x]=p.useState(null),[E,w]=p.useState(null),j=()=>(c(!0),ue.getTools().then(z=>{a(z.data),c(!1)}).catch(z=>{h(z instanceof Error?z.message:String(z)),c(!1)}));p.useEffect(()=>{j()},[]);const C=async(z,B)=>{x(z);try{await ue.updateToolConfig(z,{enabled:!B}),await j()}catch(W){h(W instanceof Error?W.message:String(W))}finally{x(null)}},_=async(z,B)=>{x(z);try{await ue.updateToolConfig(z,{scope:B}),await j()}catch(W){h(W instanceof Error?W.message:String(W))}finally{x(null)}},V=async(z,B)=>{x(z.name);try{for(const W of z.tools)W.enabled!==B&&await ue.updateToolConfig(W.name,{enabled:B});await j()}catch(W){h(W instanceof Error?W.message:String(W))}finally{x(null)}},U=async(z,B)=>{x(z.name);try{for(const W of z.tools)W.scope!==B&&await ue.updateToolConfig(W.name,{scope:B});await j()}catch(W){h(W instanceof Error?W.message:String(W))}finally{x(null)}};if(u)return r.jsx("div",{className:"loading",children:"Loading..."});const g=s.filter(z=>!z.isPlugin),k=g.reduce((z,B)=>z+B.toolCount,0);return r.jsxs("div",{children:[r.jsxs("div",{className:"header",children:[r.jsx("h1",{children:"Tools"}),r.jsxs("p",{children:[k," built-in tools across ",g.length," modules"]})]}),f&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("span",{children:f}),r.jsxs("div",{style:{display:"flex",gap:"6px"},children:[r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>h(null),children:"Dismiss"}),r.jsx("button",{className:"btn-sm",onClick:()=>{h(null),j()},children:"Retry"})]})]}),g.map(z=>{const B=E===z.name,W=z.tools.some(F=>F.enabled),G=z.tools.every(F=>!F.enabled),Y=new Set(z.tools.map(F=>F.scope)),M=Y.size>1,ee=M?"":Y.values().next().value??"always",Q=v===z.name;return r.jsxs("div",{className:"card",style:{padding:0},children:[r.jsxs("div",{onClick:()=>w(B?null:z.name),className:"accordion-header",children:[r.jsx("span",{className:"accordion-chevron",children:B?"▼":"▶"}),r.jsx("div",{style:{flex:1,minWidth:0},children:r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx("h2",{style:{margin:0},children:z.name}),r.jsxs("span",{className:"badge count",children:[z.toolCount," tools"]}),G&&r.jsx("span",{className:"badge warn",children:"Disabled"})]})}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},onClick:F=>F.stopPropagation(),children:[r.jsx(ct,{value:ee,options:["","always","dm-only","group-only","admin-only"],labels:[M?"Mixed":"Scope","All","DM only","Group only","Admin only"],onChange:F=>F&&U(z,F),style:{minWidth:"110px"}}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{type:"checkbox",checked:W,onChange:()=>V(z,!W),disabled:Q}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]})]}),B&&r.jsx("div",{style:{borderTop:"1px solid var(--separator)",padding:"10px 16px 16px"},children:r.jsx("div",{style:{display:"grid",gap:"6px"},children:z.tools.map(F=>r.jsx(ad,{tool:F,updating:v,onToggle:C,onScope:_},F.name))})})]},z.name)})]})}function $h(){const[s,a]=p.useState("installed"),[u,c]=p.useState([]),[f,h]=p.useState([]),[v,x]=p.useState(!0),[E,w]=p.useState(null),[j,C]=p.useState(null),[_,V]=p.useState([]),[U,g]=p.useState(!1),[k,z]=p.useState(null),[B,W]=p.useState(""),[G,Y]=p.useState(""),[M,ee]=p.useState(null),[Q,F]=p.useState({}),[A,b]=p.useState(!1),[se,R]=p.useState(null),[ae,ye]=p.useState(null),[ge,Se]=p.useState(null),[I,q]=p.useState(null),[D,S]=p.useState(""),O=()=>(x(!0),Promise.all([ue.getPlugins(),ue.getTools()]).then(([Z,te])=>{c(Z.data),h(te.data.filter(X=>X.isPlugin)),x(!1)}).catch(Z=>{w(Z.message),x(!1)})),ce=(Z=!1)=>(g(!0),ue.getMarketplace(Z).then(te=>{V(te.data),g(!1)}).catch(te=>{w(te.message),g(!1)}));p.useEffect(()=>{O(),ce()},[]);const he=async(Z,te)=>{C(Z);try{await ue.updateToolConfig(Z,{enabled:!te}),await O()}catch(X){w(X instanceof Error?X.message:String(X))}finally{C(null)}},xe=async(Z,te)=>{C(Z);try{await ue.updateToolConfig(Z,{scope:te}),await O()}catch(X){w(X instanceof Error?X.message:String(X))}finally{C(null)}},je=async(Z,te)=>{C(Z.name);try{for(const X of Z.tools)X.enabled!==te&&await ue.updateToolConfig(X.name,{enabled:te});await O()}catch(X){w(X instanceof Error?X.message:String(X))}finally{C(null)}},Pe=async(Z,te)=>{C(Z.name);try{for(const X of Z.tools)X.scope!==te&&await ue.updateToolConfig(X.name,{scope:te});await O()}catch(X){w(X instanceof Error?X.message:String(X))}finally{C(null)}},Ce=async Z=>{const te=_.find(X=>X.id===Z);z(Z);try{if(await ue.installPlugin(Z),await Promise.all([ce(),O()]),te!=null&&te.secrets&&Object.keys(te.secrets).length>0){try{const X=await ue.getPluginSecrets(Z),ze=Object.entries(te.secrets).filter(([,mt])=>mt.required).map(([mt])=>mt);if(ze.every(mt=>X.data.configured.includes(mt))&&ze.length>0)return}catch{}ee({pluginId:Z,pluginName:te.name,secrets:te.secrets}),F({})}}catch(X){w(X instanceof Error?X.message:String(X))}finally{z(null)}},_e=async Z=>{if(confirm(`Uninstall plugin "${Z}"? This will remove its files.`)){z(Z);try{await ue.uninstallPlugin(Z),await Promise.all([ce(),O()])}catch(te){w(te instanceof Error?te.message:String(te))}finally{z(null)}}},et=async Z=>{z(Z);try{await ue.updatePlugin(Z),await Promise.all([ce(),O()])}catch(te){w(te instanceof Error?te.message:String(te))}finally{z(null)}},gn=async()=>{const Z=_.filter(te=>te.status==="updatable");for(const te of Z){z(te.id);try{await ue.updatePlugin(te.id)}catch(X){w(X instanceof Error?X.message:String(X));break}}z(null),await Promise.all([ce(),O()])},rl=async Z=>{if(ae===Z){ye(null),q(null);return}try{const te=await ue.getPluginSecrets(Z);Se(te.data),ye(Z),q(null)}catch(te){w(te instanceof Error?te.message:String(te))}},In=async(Z,te)=>{if(D.trim())try{await ue.setPluginSecret(Z,te,D.trim()),q(null),S("");const X=await ue.getPluginSecrets(Z);Se(X.data)}catch(X){w(X instanceof Error?X.message:String(X))}},fr=async(Z,te)=>{try{await ue.unsetPluginSecret(Z,te);const X=await ue.getPluginSecrets(Z);Se(X.data)}catch(X){w(X instanceof Error?X.message:String(X))}},hr=_.filter(Z=>{if(B){const te=B.toLowerCase();if(!Z.name.toLowerCase().includes(te)&&!Z.description.toLowerCase().includes(te))return!1}return!(G&&!Z.tags.includes(G))}),An=Array.from(new Set(_.flatMap(Z=>Z.tags))).sort(),Tt=_.filter(Z=>Z.status==="updatable").length;return v?r.jsx("div",{className:"loading",children:"Loading..."}):r.jsxs("div",{children:[r.jsxs("div",{className:"header",children:[r.jsx("h1",{children:"Plugins"}),r.jsx("p",{children:"Manage installed plugins and browse the community marketplace"})]}),E&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("span",{children:E}),r.jsxs("div",{style:{display:"flex",gap:"6px"},children:[r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>w(null),children:"Dismiss"}),r.jsx("button",{className:"btn-sm",onClick:()=>{w(null),O()},children:"Retry"})]})]}),r.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center",marginBottom:"16px",flexWrap:"wrap"},children:[r.jsxs("div",{className:"tabs",style:{marginBottom:0,flexShrink:0},children:[r.jsxs("button",{className:`tab ${s==="installed"?"active":""}`,onClick:()=>a("installed"),children:["Installed",r.jsx("span",{className:"tab-count",children:u.length})]}),r.jsxs("button",{className:`tab ${s==="marketplace"?"active":""}`,onClick:()=>a("marketplace"),children:["Marketplace",Tt>0&&r.jsx("span",{className:"tab-count",style:{background:"rgba(255,255,255,0.08)",color:"var(--text-secondary)"},children:Tt})]})]}),r.jsxs("div",{style:{position:"relative",flex:1,minWidth:"120px"},children:[r.jsx("input",{type:"text",placeholder:"Search plugins...",value:B,onChange:Z=>W(Z.target.value),style:{width:"100%",paddingLeft:"34px"}}),r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{position:"absolute",left:"12px",top:"50%",transform:"translateY(-50%)",color:"var(--text-tertiary)",pointerEvents:"none"},children:[r.jsx("circle",{cx:"11",cy:"11",r:"8"}),r.jsx("path",{d:"M21 21l-4.35-4.35"})]})]}),An.length>0&&r.jsx(ct,{value:G,options:["",...An],labels:["All tags",...An],onChange:Z=>Y(Z),style:{minWidth:"140px"}}),s==="installed"&&Tt>0&&r.jsx("button",{className:"btn-sm",onClick:gn,disabled:!!k||U,style:{whiteSpace:"nowrap"},children:k?"Updating...":`Update All (${Tt})`}),s==="marketplace"&&r.jsxs(r.Fragment,{children:[Tt>0?r.jsx("button",{className:"btn-sm",onClick:gn,disabled:!!k||U,style:{whiteSpace:"nowrap"},children:k?"Updating...":`Update All (${Tt})`}):_.length>0?r.jsx("span",{style:{fontSize:"12px",color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:"All up to date"}):null,r.jsx("button",{className:"btn-ghost",onClick:()=>ce(!0),disabled:U,style:{whiteSpace:"nowrap"},children:U?"Refreshing...":"Refresh"})]})]}),s==="installed"&&(()=>{const Z=u.filter(te=>{if(B){const X=B.toLowerCase();if(!te.name.toLowerCase().includes(X)&&!(te.description??"").toLowerCase().includes(X))return!1}if(G){const X=_.find(ze=>ze.name===te.name);if(!X||!X.tags.includes(G))return!1}return!0});return r.jsx(r.Fragment,{children:u.length===0?r.jsxs("div",{className:"card",style:{textAlign:"center",padding:"40px 20px"},children:[r.jsx("p",{style:{color:"var(--text-secondary)",marginBottom:"12px"},children:"No plugins installed yet"}),r.jsx("button",{className:"btn-sm",onClick:()=>a("marketplace"),children:"Browse Marketplace"})]}):Z.length===0?r.jsx("div",{className:"card",style:{textAlign:"center",padding:"20px",color:"var(--text-secondary)"},children:"No installed plugins match your search"}):Z.map(te=>{const X=f.find(Ne=>Ne.name===te.name),ze=_.find(Ne=>Ne.name===te.name),Dn=(ze==null?void 0:ze.secrets)&&Object.keys(ze.secrets).length>0,mt=se===te.name,mr=X?X.tools.some(Ne=>Ne.enabled):!1,ll=X?X.tools.every(Ne=>!Ne.enabled):!0,gr=X?new Set(X.tools.map(Ne=>Ne.scope)):new Set,On=gr.size>1,bn=On?"":gr.values().next().value??"always",sl=j===te.name;return r.jsxs("div",{className:"card",style:{padding:0},children:[r.jsxs("div",{onClick:()=>R(mt?null:te.name),className:"accordion-header",children:[r.jsx("span",{className:"accordion-chevron",children:mt?"▼":"▶"}),r.jsxs("div",{style:{flex:1,minWidth:0},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[r.jsx("h2",{style:{margin:0},children:te.name}),X&&r.jsxs("span",{className:"badge count",children:[X.toolCount," tools"]}),r.jsxs("span",{style:{fontSize:"12px",color:"var(--text-tertiary)"},children:["v",te.version]}),ll&&X&&X.tools.length>0&&r.jsx("span",{className:"badge warn",children:"Disabled"})]}),te.description&&r.jsx("p",{style:{fontSize:"12px",color:"var(--text-secondary)",margin:"4px 0 0"},children:te.description})]}),X&&X.tools.length>0&&r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},onClick:Ne=>Ne.stopPropagation(),children:[r.jsx(ct,{value:bn,options:["","always","dm-only","group-only","admin-only"],labels:[On?"Mixed":"Scope","All","DM only","Group only","Admin only"],onChange:Ne=>Ne&&Pe(X,Ne),style:{minWidth:"110px"}}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{type:"checkbox",checked:mr,onChange:()=>je(X,!mr),disabled:sl}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]})]}),mt&&r.jsxs("div",{style:{borderTop:"1px solid var(--separator)",padding:"10px 16px 16px"},children:[X&&X.tools.length>0&&r.jsx("div",{style:{display:"grid",gap:"6px"},children:X.tools.map(Ne=>r.jsx(ad,{tool:Ne,updating:j,onToggle:he,onScope:xe},Ne.name))}),Dn&&ze&&r.jsxs("div",{style:{marginTop:"10px",borderTop:"1px solid var(--separator)",paddingTop:"10px"},children:[r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>rl(ze.id),children:ae===ze.id?"Hide Secrets":"Manage Secrets"}),ae===ze.id&&ge&&r.jsx("div",{style:{marginTop:"8px",display:"grid",gap:"6px"},children:Object.entries(ge.declared).map(([Ne,Rt])=>{const Mn=ge.configured.includes(Ne);return r.jsxs("div",{className:"tool-row",style:{padding:"8px 12px",flexWrap:"wrap"},children:[r.jsxs("div",{style:{flex:1,minWidth:0},children:[r.jsx("span",{style:{fontWeight:600,fontSize:"13px"},children:Ne}),Rt.required&&r.jsx("span",{style:{color:"var(--text-secondary)",marginLeft:"4px",fontSize:"11px"},children:"required"}),r.jsx("span",{className:`badge ${Mn?"always":"warn"}`,style:{marginLeft:"8px",fontSize:"10px"},children:Mn?"Set":"Not set"}),r.jsx("p",{style:{fontSize:"12px",color:"var(--text-tertiary)",margin:"2px 0 0 0"},children:Rt.description}),Rt.env&&r.jsxs("code",{style:{fontSize:"11px",color:"var(--text-tertiary)",opacity:.7},children:["Env: ",Rt.env]})]}),r.jsx("div",{style:{display:"flex",gap:"4px",alignItems:"center"},children:I===Ne?r.jsxs(r.Fragment,{children:[r.jsx("input",{type:"password",value:D,onChange:ol=>S(ol.target.value),placeholder:"Enter value...",style:{width:"200px"}}),r.jsx("button",{className:"btn-sm",onClick:()=>In(ze.id,Ne),children:"Save"}),r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>q(null),children:"Cancel"})]}):r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>{q(Ne),S("")},children:Mn?"Change":"Set"}),Mn&&r.jsx("button",{className:"btn-danger btn-sm",onClick:()=>fr(ze.id,Ne),children:"Remove"})]})})]},Ne)})})]})]})]},te.name)})})})(),M&&r.jsx("div",{className:"modal-overlay",onClick:()=>!A&&ee(null),children:r.jsxs("div",{className:"modal",onClick:Z=>Z.stopPropagation(),children:[r.jsxs("h2",{style:{marginBottom:"4px"},children:["Configure ",M.pluginName]}),r.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"13px",marginBottom:"16px"},children:"This plugin needs API keys to work. You can configure them now or later."}),Object.entries(M.secrets).map(([Z,te])=>r.jsxs("div",{style:{marginBottom:"12px"},children:[r.jsxs("label",{style:{display:"block",fontSize:"13px",fontWeight:600,marginBottom:"4px"},children:[Z," ",te.required&&r.jsx("span",{style:{color:"var(--text-secondary)"},children:"*"})]}),r.jsx("p",{style:{fontSize:"12px",color:"var(--text-tertiary)",margin:"0 0 4px 0"},children:te.description}),te.env&&r.jsxs("code",{style:{display:"block",fontSize:"11px",color:"var(--text-tertiary)",opacity:.7,marginBottom:"6px"},children:["Env: ",te.env]}),r.jsx("input",{type:"password",placeholder:`Enter ${Z}...`,value:Q[Z]||"",onChange:X=>F(ze=>({...ze,[Z]:X.target.value})),style:{width:"100%"}})]},Z)),r.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",marginTop:"16px"},children:[r.jsx("button",{className:"btn-ghost",onClick:()=>ee(null),children:"Skip"}),r.jsx("button",{className:"btn-sm",disabled:A,onClick:async()=>{b(!0);try{for(const[Z,te]of Object.entries(Q))te.trim()&&await ue.setPluginSecret(M.pluginId,Z,te.trim());ee(null)}catch(Z){w(Z instanceof Error?Z.message:String(Z))}finally{b(!1)}},children:A?"Saving...":"Save"})]})]})}),s==="marketplace"&&r.jsx(r.Fragment,{children:U&&_.length===0?r.jsx("div",{className:"loading",children:"Loading marketplace..."}):hr.length===0?r.jsx("div",{className:"empty",children:B||G?"No plugins match your search":"Marketplace is empty"}):r.jsx("div",{style:{display:"grid",gap:"10px"},children:hr.map(Z=>r.jsx(Kh,{plugin:Z,operating:k,onInstall:Ce,onUninstall:_e,onUpdate:et},Z.id))})})]})}function Kh({plugin:s,operating:a,onInstall:u,onUninstall:c,onUpdate:f}){const h=a===s.id,v=!!a,x=s.secrets&&Object.values(s.secrets).some(E=>E.required);return r.jsx("div",{className:"card",style:{marginBottom:"0"},children:r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"16px"},children:[r.jsxs("div",{style:{flex:1,minWidth:0},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px",flexWrap:"wrap"},children:[r.jsx("h2",{style:{margin:0},children:s.name}),s.status==="installed"&&r.jsx("span",{className:"badge always",style:{fontSize:"10px"},children:"Installed"}),s.status==="updatable"&&r.jsx("span",{className:"badge warn",style:{fontSize:"10px"},children:"Update available"}),x&&s.status==="available"&&r.jsx("span",{className:"badge warn",style:{fontSize:"10px"},children:"Requires API Key"})]}),r.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",margin:"0 0 8px 0",lineHeight:"1.5"},children:s.description}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[s.tags.map(E=>r.jsx("span",{className:"badge",style:{background:"var(--surface)",color:"var(--text-tertiary)"},children:E},E)),r.jsxs("span",{style:{fontSize:"12px",color:"var(--text-tertiary)"},children:["by ",s.author," · v",s.remoteVersion," · ",s.toolCount," tools"]})]})]}),r.jsxs("div",{style:{flexShrink:0,display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"},children:[s.status==="available"&&r.jsx("button",{className:"btn-sm",onClick:()=>u(s.id),disabled:v,children:h?"Installing...":"Install"}),s.status==="installed"&&r.jsx("button",{className:"btn-danger btn-sm",onClick:()=>c(s.id),disabled:v,children:h?"Removing...":"Uninstall"}),s.status==="updatable"&&r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"btn-sm",onClick:()=>f(s.id),disabled:v,children:h?"Updating...":`Update to v${s.remoteVersion}`}),r.jsx("button",{className:"btn-danger btn-sm",onClick:()=>c(s.id),disabled:v,children:"Uninstall"})]})]})]})})}const Ac=["SOUL.md","SECURITY.md","STRATEGY.md","MEMORY.md"];function Vh(){const[s,a]=p.useState(Ac[0]),[u,c]=p.useState(""),[f,h]=p.useState(""),[v,x]=p.useState(!1),[E,w]=p.useState(!1),[j,C]=p.useState(null),_=u!==f,V=p.useCallback(async k=>{x(!0),C(null);try{const z=await ue.getSoulFile(k);c(z.data.content),h(z.data.content)}catch(z){C({type:"error",text:z instanceof Error?z.message:String(z)})}finally{x(!1)}},[]),U=async()=>{w(!0),C(null);try{const k=await ue.updateSoulFile(s,u);h(u),C({type:"success",text:k.data.message})}catch(k){C({type:"error",text:k instanceof Error?k.message:String(k)})}finally{w(!1)}};p.useEffect(()=>{const k=z=>{_&&z.preventDefault()};return window.addEventListener("beforeunload",k),()=>window.removeEventListener("beforeunload",k)},[_]);const g=k=>{k!==s&&(_&&!window.confirm("You have unsaved changes. Discard them?")||a(k))};return p.useEffect(()=>{V(s)},[s,V]),r.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"calc(100vh - 64px)",overflow:"hidden"},children:[r.jsxs("div",{className:"header",style:{marginBottom:"16px"},children:[r.jsx("h1",{children:"Soul Editor"}),r.jsx("p",{children:"Edit system prompt files"})]}),j&&r.jsx("div",{className:`alert ${j.type}`,style:{marginBottom:"8px"},children:j.text}),r.jsxs("div",{className:"card",style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",padding:"12px"},children:[r.jsx("div",{className:"tabs",style:{marginBottom:"8px"},children:Ac.map(k=>r.jsxs("button",{className:`tab ${s===k?"active":""}`,onClick:()=>g(k),children:[k,s===k&&_?" *":""]},k))}),v?r.jsx("div",{className:"loading",children:"Loading..."}):r.jsxs(r.Fragment,{children:[r.jsx("textarea",{value:u,onChange:k=>c(k.target.value),placeholder:`Edit ${s}...`,style:{flex:1,minHeight:"200px"}}),r.jsxs("div",{style:{marginTop:"8px",display:"flex",alignItems:"center",gap:"10px"},children:[r.jsx("button",{onClick:U,disabled:E||!_,children:E?"Saving...":"Save"}),_&&r.jsx("span",{style:{color:"var(--text-secondary)",fontSize:"13px"},children:"Unsaved changes"})]})]})]})]})}function Dc(s){return new Date(s*1e3).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Hh(){const[s,a]=p.useState(""),[u,c]=p.useState([]),[f,h]=p.useState(!0),[v,x]=p.useState(null),[E,w]=p.useState(null),[j,C]=p.useState([]),[_,V]=p.useState(!1),U=p.useCallback(async()=>{h(!0),x(null);try{const B=await ue.getMemorySources();c(B.data??[])}catch(B){x(B instanceof Error?B.message:String(B))}finally{h(!1)}},[]);p.useEffect(()=>{U()},[U]);const g=async B=>{if(E===B){w(null),C([]);return}w(B),V(!0);try{const W=await ue.getSourceChunks(B);C(W.data??[])}catch(W){x(W instanceof Error?W.message:String(W))}finally{V(!1)}},k=s.toLowerCase(),z=k?u.filter(B=>B.source.toLowerCase().includes(k)):u;return r.jsxs("div",{children:[r.jsxs("div",{className:"header",children:[r.jsx("h1",{children:"Memory"}),r.jsx("p",{children:"Browse indexed knowledge sources"})]}),r.jsxs("div",{className:"card",style:{padding:0},children:[r.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center",padding:"12px 14px",borderBottom:"1px solid var(--separator)"},children:[r.jsx("input",{type:"text",value:s,onChange:B=>a(B.target.value),placeholder:"Filter sources...",style:{flex:1,padding:"6px 10px",fontSize:"13px"}}),r.jsx("button",{onClick:U,disabled:f,style:{padding:"4px 12px",fontSize:"12px",opacity:.7},children:f?"Loading...":"Refresh"})]}),v&&r.jsxs("div",{className:"alert error",style:{margin:"12px 14px"},children:[v,r.jsx("button",{onClick:()=>x(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),f?r.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading..."}):z.length===0?r.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--text-secondary)",fontSize:"13px"},children:s?"No matching sources":"No memory files indexed"}):r.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{borderBottom:"1px solid var(--separator)",color:"var(--text-secondary)",fontSize:"11px",textTransform:"uppercase"},children:[r.jsx("th",{style:{textAlign:"left",padding:"8px 14px"},children:"Source"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:"80px"},children:"Chunks"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:"140px"},children:"Last Updated"})]})}),r.jsx("tbody",{children:z.map(B=>{const W=E===B.source;return r.jsxs(xs.Fragment,{children:[r.jsxs("tr",{onClick:()=>g(B.source),style:{cursor:"pointer",borderBottom:W?"none":"1px solid var(--separator)",backgroundColor:W?"rgba(255,255,255,0.03)":void 0},className:"file-row",children:[r.jsxs("td",{style:{padding:"6px 14px"},children:[r.jsx("span",{style:{display:"inline-block",width:"14px",fontSize:"10px",color:"var(--text-secondary)",marginRight:"8px"},children:W?"▼":"▶"}),B.source]}),r.jsx("td",{style:{textAlign:"right",padding:"6px 14px",color:"var(--text-secondary)"},children:B.entryCount}),r.jsx("td",{style:{textAlign:"right",padding:"6px 14px",color:"var(--text-secondary)"},children:Dc(B.lastUpdated)})]}),W&&r.jsx("tr",{style:{backgroundColor:"rgba(255,255,255,0.03)",borderBottom:"1px solid var(--separator)"},children:r.jsx("td",{colSpan:3,style:{padding:"0 14px 14px 14px"},children:_?r.jsx("div",{style:{padding:"12px 0",textAlign:"center",color:"var(--text-secondary)",fontSize:"12px"},children:"Loading chunks..."}):j.length===0?r.jsx("div",{style:{padding:"12px 0",textAlign:"center",color:"var(--text-secondary)",fontSize:"12px"},children:"No chunks"}):r.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px",paddingTop:"8px"},children:j.map(G=>r.jsxs("div",{style:{padding:"10px 12px",border:"1px solid var(--separator)",borderRadius:"4px",backgroundColor:"var(--surface)"},children:[r.jsxs("div",{style:{fontSize:"11px",color:"var(--text-secondary)",marginBottom:"6px"},children:[G.startLine!=null&&G.endLine!=null&&r.jsxs("span",{children:["Lines ",G.startLine,"–",G.endLine," · "]}),Dc(G.updatedAt)]}),r.jsx("pre",{style:{margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:"12px",fontFamily:"monospace",lineHeight:"1.5",maxHeight:"300px",minHeight:"60px",overflow:"auto",resize:"vertical",color:"var(--text)"},children:G.text})]},G.id))})})})]},B.source)})})]})]})]})}const Oc=2e3,mi=1e3,Qh=3e4;class Yh{constructor(){Ot(this,"logs",[]);Ot(this,"snapshot",[]);Ot(this,"listeners",new Set);Ot(this,"disconnect",null);Ot(this,"_connected",!1);Ot(this,"reconnectTimer",null);Ot(this,"reconnectDelay",mi);Ot(this,"shouldReconnect",!1)}connect(){this.disconnect||(this.shouldReconnect=!0,this.reconnectDelay=mi,this.doConnect())}doConnect(){this.disconnect||(this.disconnect=ue.connectLogs(a=>{this.logs.push(a),this.logs.length>Oc&&(this.logs=this.logs.slice(-Oc)),this._connected=!0,this.reconnectDelay=mi,this.snapshot=[...this.logs],this.notify()},()=>{this._connected=!1,this.disconnect&&(this.disconnect(),this.disconnect=null),this.notify(),this.scheduleReconnect()}))}scheduleReconnect(){!this.shouldReconnect||this.reconnectTimer||(this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.shouldReconnect&&!this.disconnect&&this.doConnect()},this.reconnectDelay),this.reconnectDelay=Math.min(this.reconnectDelay*2,Qh))}stop(){this.shouldReconnect=!1,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.disconnect&&(this.disconnect(),this.disconnect=null),this._connected=!1,this.notify()}getLogs(){return this.snapshot}isConnected(){return this._connected}clear(){this.logs=[],this.snapshot=[],this.notify()}subscribe(a){return this.listeners.add(a),()=>this.listeners.delete(a)}notify(){for(const a of this.listeners)a()}}const Rn=new Yh;function Jh(){const s=p.useSyncExternalStore(c=>Rn.subscribe(c),()=>Rn.getLogs()),a=p.useSyncExternalStore(c=>Rn.subscribe(c),()=>Rn.isConnected()),u=p.useRef(null);return p.useEffect(()=>{Rn.connect()},[]),p.useEffect(()=>{var c;(c=u.current)==null||c.scrollIntoView({behavior:"smooth"})},[s]),r.jsxs("div",{children:[r.jsx("div",{className:"header",children:r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[r.jsxs("div",{children:[r.jsx("h1",{children:"Live Logs"}),r.jsxs("p",{children:[r.jsx("span",{className:`status-dot ${a?"connected":"disconnected"}`}),a?"Connected":"Disconnected"]})]}),r.jsx("button",{onClick:()=>Rn.clear(),children:"Clear"})]})}),r.jsxs("div",{style:{height:"calc(100vh - 160px)",overflow:"auto"},children:[s.length===0?r.jsx("div",{className:"empty",children:"Waiting for logs..."}):s.map((c,f)=>r.jsxs("div",{className:"log-entry",children:[r.jsx("span",{className:`badge ${c.level==="warn"?"warn":c.level==="error"?"error":"info"}`,children:c.level.toUpperCase()})," ",r.jsx("span",{style:{color:"var(--text-tertiary)"},children:new Date(c.timestamp).toLocaleTimeString()})," ",c.message]},f)),r.jsx("div",{ref:u})]})]})}function bc(s){return s===0?"—":s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function Gh(s){return new Date(s).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}const qh=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico"]),Xh=new Set(["zip","tar","gz","bin","exe","dll","so","db","sqlite","wasm","pdf"]);function ud(s){var a,u;return((u=(a=s.split("/").pop())==null?void 0:a.split(".").pop())==null?void 0:u.toLowerCase())??""}function Zh(s){return qh.has(ud(s))}function em(s){return Xh.has(ud(s))}function tm(){const[s,a]=p.useState(""),[u,c]=p.useState([]),[f,h]=p.useState(null),[v,x]=p.useState(!0),[E,w]=p.useState(null),[j,C]=p.useState(null),[_,V]=p.useState(""),[U,g]=p.useState(!1),[k,z]=p.useState(!1),[B,W]=p.useState("text"),[G,Y]=p.useState(null),[M,ee]=p.useState(""),Q=p.useCallback(async I=>{x(!0),w(null);try{const q=await ue.workspaceList(I);c(q.data??[]),a(I)}catch(q){w(q instanceof Error?q.message:String(q))}finally{x(!1)}},[]),F=p.useCallback(async()=>{try{const I=await ue.workspaceInfo();h(I.data??null)}catch{}},[]);p.useEffect(()=>{Q(""),F()},[Q,F]),p.useEffect(()=>{if(!U)return;const I=q=>{q.preventDefault()};return window.addEventListener("beforeunload",I),()=>window.removeEventListener("beforeunload",I)},[U]);const A=I=>{R()&&Q(I)},b=s?s.split("/"):[],se=async I=>{var q;try{if(w(null),Zh(I))C(I),W("image"),V(""),g(!1);else if(em(I))C(I),W("binary"),V(""),g(!1);else{const D=await ue.workspaceRead(I);C(I),W("text"),V(((q=D.data)==null?void 0:q.content)??""),g(!1)}}catch(D){w(D instanceof Error?D.message:String(D))}},R=()=>B==="text"&&U&&!confirm("You have unsaved changes. Discard?")?!1:(C(null),V(""),g(!1),W("text"),!0),ae=I=>{if(j===I)R();else{if(!R())return;se(I)}},ye=async()=>{if(j){z(!0);try{await ue.workspaceWrite(j,_),g(!1),Q(s)}catch(I){w(I instanceof Error?I.message:String(I))}finally{z(!1)}}},ge=async I=>{const q=I.isDirectory?"directory":"file";if(confirm(`Delete ${q} "${I.name}"?`))try{await ue.workspaceDelete(I.path,I.isDirectory),j===I.path&&(C(null),V(""),g(!1)),Q(s),F()}catch(D){w(D instanceof Error?D.message:String(D))}},Se=async()=>{const I=M.trim();if(!I||!G)return;const q=s?`${s}/${I}`:I;try{if(G.type==="newFile")await ue.workspaceWrite(q,"");else if(G.type==="newFolder")await ue.workspaceMkdir(q);else if(G.type==="rename"&&G.target){const D=s?`${s}/${I}`:I;await ue.workspaceRename(G.target,D),j===G.target&&(C(null),V(""),g(!1))}Y(null),ee(""),Q(s),F()}catch(D){w(D instanceof Error?D.message:String(D))}};return r.jsxs("div",{children:[r.jsxs("div",{className:"header",children:[r.jsx("h1",{children:"Workspace"}),r.jsxs("p",{children:["Browse and manage agent workspace files",f&&r.jsxs("span",{style:{marginLeft:"12px",fontSize:"12px",color:"var(--text-secondary)"},children:[f.totalFiles," files · ",bc(f.totalSize)]})]})]}),E&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[E,r.jsx("button",{onClick:()=>w(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),r.jsxs("div",{className:"card",style:{padding:"8px 14px",marginBottom:"14px",display:"flex",alignItems:"center",gap:"4px",flexWrap:"wrap"},children:[r.jsx("span",{onClick:()=>A(""),style:{cursor:"pointer",fontWeight:s?"normal":"bold",color:"var(--accent)"},children:"workspace"}),b.map((I,q)=>{const D=b.slice(0,q+1).join("/"),S=q===b.length-1;return r.jsxs("span",{children:[r.jsx("span",{style:{color:"var(--text-secondary)",margin:"0 2px"},children:"/"}),r.jsx("span",{onClick:()=>!S&&A(D),style:{cursor:S?"default":"pointer",fontWeight:S?"bold":"normal",color:S?"var(--text)":"var(--accent)"},children:I})]},D)}),r.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:"6px"},children:[r.jsx("button",{style:{padding:"3px 10px",fontSize:"12px"},onClick:()=>{Y({type:"newFile"}),ee("")},children:"+ File"}),r.jsx("button",{style:{padding:"3px 10px",fontSize:"12px"},onClick:()=>{Y({type:"newFolder"}),ee("")},children:"+ Folder"})]})]}),G&&r.jsxs("div",{className:"card",style:{padding:"10px 14px",marginBottom:"14px",display:"flex",gap:"8px",alignItems:"center"},children:[r.jsx("span",{style:{fontSize:"13px",whiteSpace:"nowrap"},children:G.type==="newFile"?"New file:":G.type==="newFolder"?"New folder:":"Rename to:"}),r.jsx("input",{type:"text",value:M,onChange:I=>ee(I.target.value),onKeyDown:I=>I.key==="Enter"&&Se(),placeholder:"name...",autoFocus:!0,style:{flex:1,padding:"4px 8px",fontSize:"13px"}}),r.jsx("button",{style:{padding:"4px 10px",fontSize:"12px"},onClick:Se,children:"OK"}),r.jsx("button",{style:{padding:"4px 10px",fontSize:"12px",opacity:.7},onClick:()=>Y(null),children:"Cancel"})]}),r.jsx("div",{className:"card",style:{padding:0},children:v?r.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading..."}):u.length===0?r.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--text-secondary)"},children:"Empty directory"}):r.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{borderBottom:"1px solid var(--separator)",color:"var(--text-secondary)",fontSize:"11px",textTransform:"uppercase"},children:[r.jsx("th",{style:{textAlign:"left",padding:"8px 14px"},children:"Name"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:"80px"},children:"Size"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:"140px"},children:"Modified"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:"70px"}})]})}),r.jsxs("tbody",{children:[s&&r.jsxs("tr",{onClick:()=>{const I=s.split("/");I.pop(),A(I.join("/"))},style:{cursor:"pointer",borderBottom:"1px solid var(--separator)"},className:"file-row",children:[r.jsxs("td",{style:{padding:"6px 14px"},children:[r.jsx("span",{style:{marginRight:"8px"},children:"📂"}),".."]}),r.jsx("td",{}),r.jsx("td",{}),r.jsx("td",{})]}),u.map(I=>{const q=!I.isDirectory&&j===I.path;return r.jsxs(xs.Fragment,{children:[r.jsxs("tr",{onClick:()=>I.isDirectory?A(I.path):ae(I.path),style:{cursor:"pointer",borderBottom:q?"none":"1px solid var(--separator)",backgroundColor:q?"rgba(255,255,255,0.03)":void 0},className:"file-row",children:[r.jsxs("td",{style:{padding:"6px 14px"},children:[I.isDirectory?r.jsx("span",{style:{marginRight:"8px"},children:"📂"}):r.jsx("span",{style:{display:"inline-block",width:"14px",fontSize:"10px",color:"var(--text-secondary)",marginRight:"8px"},children:q?"▼":"▶"}),I.name]}),r.jsx("td",{style:{textAlign:"right",padding:"6px 14px",color:"var(--text-secondary)"},children:I.isDirectory?"":bc(I.size)}),r.jsx("td",{style:{textAlign:"right",padding:"6px 14px",color:"var(--text-secondary)"},children:Gh(I.mtime)}),r.jsxs("td",{style:{textAlign:"right",padding:"6px 14px",whiteSpace:"nowrap"},onClick:D=>D.stopPropagation(),children:[r.jsx("button",{className:"icon-button",onClick:()=>{Y({type:"rename",target:I.path}),ee(I.name)},title:"Rename",children:"✎"}),r.jsx("button",{className:"icon-button",onClick:()=>ge(I),title:"Delete",children:"🗑"})]})]}),q&&r.jsx("tr",{style:{backgroundColor:"rgba(255,255,255,0.03)",borderBottom:"1px solid var(--separator)"},children:r.jsxs("td",{colSpan:4,style:{padding:"0 14px 14px 14px"},children:[r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"10px 0"},children:[r.jsxs("span",{style:{fontSize:"13px",fontWeight:600},children:[j,B==="text"&&U&&r.jsx("span",{style:{color:"var(--accent)",marginLeft:"6px"},children:"*"})]}),r.jsxs("div",{style:{display:"flex",gap:"6px"},children:[B==="text"&&r.jsx("button",{style:{padding:"4px 12px",fontSize:"12px"},onClick:ye,disabled:k||!U,children:k?"Saving...":"Save"}),r.jsx("button",{style:{padding:"4px 12px",fontSize:"12px",opacity:.7},onClick:()=>R(),children:"Close"})]})]}),B==="text"&&r.jsx("textarea",{value:_,onChange:D=>{V(D.target.value),g(!0)},onKeyDown:D=>{(D.ctrlKey||D.metaKey)&&D.key==="s"&&(D.preventDefault(),ye())},style:{width:"100%",minHeight:"300px",maxHeight:"500px",fontFamily:"monospace",fontSize:"13px",padding:"10px",border:"1px solid var(--separator)",borderRadius:"4px",backgroundColor:"var(--surface)",color:"var(--text)",resize:"vertical",tabSize:2},spellCheck:!1}),B==="image"&&j&&r.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"20px 0"},children:r.jsx("img",{src:ue.workspaceRawUrl(j),alt:j,style:{maxWidth:"100%",maxHeight:"60vh",objectFit:"contain",borderRadius:"8px"},onError:D=>{D.target.alt="Failed to load image"}})}),B==="binary"&&r.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--text-secondary)",fontSize:"13px"},children:"Binary file — preview not available"})]})})]},I.path)})]})]})})]})}const gs={pending:"#f0ad4e",in_progress:"#5bc0de",done:"#5cb85c",failed:"#d9534f",cancelled:"#777"},cr={pending:"Pending",in_progress:"Running",done:"Done",failed:"Failed",cancelled:"Cancelled"};function Mc({status:s}){return r.jsx("span",{style:{display:"inline-block",padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:600,color:"#fff",backgroundColor:gs[s]},children:cr[s]})}function ur(s){return s?new Date(s).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function nm({priority:s}){if(s===0)return r.jsx("span",{style:{color:"var(--text-secondary)",fontSize:"11px"},children:"—"});const a=Math.min(s,10);return r.jsxs("span",{title:`Priority: ${s}/10`,style:{fontSize:"11px",letterSpacing:"1px"},children:["●".repeat(Math.min(a,5)),"○".repeat(Math.max(0,5-a))]})}function gi(s,a){return s?s.length>a?s.slice(0,a)+"...":s:""}function rm(){const[s,a]=p.useState([]),[u,c]=p.useState(!0),[f,h]=p.useState(null),[v,x]=p.useState(""),[E,w]=p.useState(""),[j,C]=p.useState(null),[_,V]=p.useState(!1),[U,g]=p.useState(null),k=p.useRef(null),z=p.useCallback(async()=>{c(!0),h(null);try{const b=(await ue.tasksList()).data??[];a(b),C(se=>se?b.find(R=>R.id===se.id)??null:null)}catch(A){h(A instanceof Error?A.message:String(A))}finally{c(!1)}},[]);p.useEffect(()=>{z()},[z]),p.useEffect(()=>{function A(b){k.current&&!k.current.contains(b.target)&&V(!1)}if(_)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[_]);const B=async A=>{g(null),V(!1);try{await ue.tasksClean(A),h(null),z(),C(null)}catch(b){h(b instanceof Error?b.message:String(b))}},W=async A=>{if(confirm("Cancel this task?"))try{await ue.tasksCancel(A),z(),(j==null?void 0:j.id)===A&&C(null)}catch(b){h(b instanceof Error?b.message:String(b))}},G=async A=>{if(confirm("Permanently delete this task?"))try{await ue.tasksDelete(A),z(),(j==null?void 0:j.id)===A&&C(null)}catch(b){h(b instanceof Error?b.message:String(b))}},Y=s.reduce((A,b)=>(A[b.status]=(A[b.status]||0)+1,A),{}),M=(Y.done||0)+(Y.failed||0)+(Y.cancelled||0),ee=v?s.filter(A=>A.status===v):s,Q=E.trim().toLowerCase(),F=Q?ee.filter(A=>A.description.toLowerCase().includes(Q)||(A.reason??"").toLowerCase().includes(Q)||A.id.toLowerCase().includes(Q)):ee;return r.jsxs("div",{children:[r.jsxs("div",{className:"header",children:[r.jsx("h1",{children:"Tasks"}),r.jsx("p",{children:"Scheduled and queued agent tasks"})]}),f&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[f,r.jsx("button",{onClick:()=>h(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),r.jsxs("div",{className:"card",style:{padding:"10px 14px",marginBottom:"14px",display:"flex",gap:"16px",alignItems:"center",flexWrap:"wrap",overflow:"visible",position:"relative",zIndex:2},children:[r.jsxs("span",{onClick:()=>x(""),style:{cursor:"pointer",fontWeight:v===""?"bold":"normal",color:v===""?"var(--text)":"var(--text-secondary)",fontSize:"13px"},children:["All (",s.length,")"]}),["pending","in_progress","done","failed","cancelled"].map(A=>r.jsxs("span",{onClick:()=>x(v===A?"":A),style:{cursor:"pointer",fontWeight:v===A?"bold":"normal",color:v===A?gs[A]:"var(--text-secondary)",fontSize:"13px"},children:[cr[A]," (",Y[A]||0,")"]},A)),r.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"8px"},children:[r.jsxs("div",{style:{position:"relative"},children:[r.jsx("input",{type:"text",placeholder:"Search tasks...",value:E,onChange:A=>w(A.target.value),onKeyDown:A=>{A.key==="Escape"&&w("")},style:{padding:"4px 24px 4px 12px",fontSize:"13px",border:"1px solid var(--separator)",borderRadius:"14px",backgroundColor:"transparent",color:"var(--text)",width:"180px",outline:"none"}}),E&&r.jsx("button",{onClick:()=>w(""),style:{position:"absolute",right:"4px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",color:"var(--text-secondary)",cursor:"pointer",padding:"0 2px",fontSize:"14px",lineHeight:1},children:"✕"})]}),Q&&r.jsxs("span",{style:{fontSize:"11px",color:"var(--text-secondary)",whiteSpace:"nowrap"},children:[F.length," of ",ee.length," tasks"]})]}),M>0&&r.jsxs("div",{ref:k,style:{position:"relative"},children:[r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>V(!_),children:"Clean"}),_&&r.jsx("div",{className:"custom-select-menu",style:{position:"absolute",top:"100%",right:0,marginTop:"4px",zIndex:10,minWidth:"170px",width:"auto"},children:["done","failed","cancelled"].filter(A=>(Y[A]||0)>0).map(A=>r.jsxs("div",{className:"custom-select-option",onClick:()=>{V(!1),g(A)},style:{display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:gs[A],flexShrink:0}}),cr[A]," (",Y[A],")"]},A))})]}),r.jsx("button",{style:{padding:"4px 12px",fontSize:"12px",opacity:.7},onClick:z,children:"Refresh"})]}),U&&r.jsx("div",{className:"modal-overlay",onClick:()=>g(null),children:r.jsxs("div",{className:"modal",style:{maxWidth:"380px"},onClick:A=>A.stopPropagation(),children:[r.jsxs("h2",{style:{marginBottom:"4px"},children:["Clean ",cr[U].toLowerCase()," tasks"]}),r.jsxs("p",{style:{color:"var(--text-secondary)",fontSize:"13px",marginBottom:"16px"},children:["Permanently delete all ",Y[U]||0," ",r.jsx("span",{style:{color:gs[U],fontWeight:600},children:cr[U].toLowerCase()})," ","tasks? This cannot be undone."]}),r.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px"},children:[r.jsx("button",{className:"btn-ghost",onClick:()=>g(null),children:"Cancel"}),r.jsxs("button",{className:"btn-danger btn-sm",onClick:()=>B(U),children:["Delete ",Y[U]||0," tasks"]})]})]})}),r.jsx("div",{className:"card",style:{padding:0},children:u?r.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading..."}):F.length===0?r.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--text-secondary)"},children:Q?"No tasks match your search":v?`No ${cr[v].toLowerCase()} tasks`:"No tasks yet"}):r.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px",tableLayout:"fixed"},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{borderBottom:"1px solid var(--separator)",color:"var(--text-secondary)",fontSize:"11px",textTransform:"uppercase"},children:[r.jsx("th",{style:{textAlign:"left",padding:"8px 14px"},children:"Description"}),r.jsx("th",{style:{textAlign:"center",padding:"8px 10px",width:80},children:"Status"}),r.jsx("th",{style:{textAlign:"center",padding:"8px 10px",width:60},children:"Priority"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:120},children:"Scheduled"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:120},children:"Created"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:70}})]})}),r.jsx("tbody",{children:F.map(A=>{const b=(j==null?void 0:j.id)===A.id;return r.jsxs(xs.Fragment,{children:[r.jsxs("tr",{onClick:()=>C(b?null:A),style:{cursor:"pointer",borderBottom:b?"none":"1px solid var(--separator)",backgroundColor:b?"rgba(255,255,255,0.03)":void 0},className:"file-row",children:[r.jsxs("td",{style:{padding:"8px 14px"},children:[r.jsxs("div",{children:[r.jsx("span",{style:{display:"inline-block",width:"14px",fontSize:"10px",color:"var(--text-secondary)"},children:b?"▼":"▶"}),gi(A.description,80)]}),A.reason&&r.jsx("div",{style:{fontSize:"11px",color:"var(--text-secondary)",marginTop:"2px",paddingLeft:"14px"},children:gi(A.reason,60)})]}),r.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},children:r.jsx(Mc,{status:A.status})}),r.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},children:r.jsx(nm,{priority:A.priority})}),r.jsx("td",{style:{textAlign:"right",padding:"8px 14px",color:"var(--text-secondary)"},children:ur(A.scheduledFor)}),r.jsx("td",{style:{textAlign:"right",padding:"8px 14px",color:"var(--text-secondary)"},children:ur(A.createdAt)}),r.jsxs("td",{style:{textAlign:"right",padding:"8px 14px",whiteSpace:"nowrap"},onClick:se=>se.stopPropagation(),children:[(A.status==="pending"||A.status==="in_progress")&&r.jsx("button",{className:"icon-button",onClick:()=>W(A.id),title:"Cancel",children:"✖"}),r.jsx("button",{className:"icon-button",onClick:()=>G(A.id),title:"Delete",children:"🗑"})]})]}),b&&j&&r.jsx("tr",{style:{backgroundColor:"rgba(255,255,255,0.03)",borderBottom:"1px solid var(--separator)"},children:r.jsxs("td",{colSpan:6,style:{padding:"0 14px 14px 14px",overflow:"hidden"},children:[r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"120px 1fr",gap:"6px 12px",fontSize:"13px",padding:"10px 0"},children:[r.jsx("span",{style:{color:"var(--text-secondary)"},children:"ID"}),r.jsx("code",{style:{fontSize:"11px",wordBreak:"break-all"},children:j.id}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Status"}),r.jsx("span",{children:r.jsx(Mc,{status:j.status})}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Priority"}),r.jsxs("span",{children:[j.priority,"/10"]}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Description"}),r.jsx("span",{children:j.description}),j.reason&&r.jsxs(r.Fragment,{children:[r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Reason"}),r.jsx("span",{children:j.reason})]}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Created by"}),r.jsx("span",{children:j.createdBy||"—"}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Created"}),r.jsx("span",{children:ur(j.createdAt)}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Scheduled for"}),r.jsx("span",{children:ur(j.scheduledFor)}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Started"}),r.jsx("span",{children:ur(j.startedAt)}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Completed"}),r.jsx("span",{children:ur(j.completedAt)}),j.dependencies.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Depends on"}),r.jsxs("span",{style:{fontSize:"11px"},children:[j.dependencies.length," task(s)"]})]}),j.dependents.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Dependents"}),r.jsxs("span",{style:{fontSize:"11px"},children:[j.dependents.length," task(s)"]})]})]}),j.payload&&r.jsxs("div",{style:{marginTop:"4px"},children:[r.jsx("div",{style:{fontSize:"12px",color:"var(--text-secondary)",marginBottom:"4px"},children:"Payload"}),r.jsx("pre",{style:{padding:"8px",borderRadius:"4px",backgroundColor:"rgba(0,0,0,0.2)",fontSize:"11px",overflow:"auto",maxHeight:"150px",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:(()=>{try{return JSON.stringify(JSON.parse(j.payload),null,2)}catch{return j.payload}})()})]}),j.result&&r.jsxs("div",{style:{marginTop:"12px"},children:[r.jsx("div",{style:{fontSize:"12px",color:"#5cb85c",marginBottom:"4px"},children:"Result"}),r.jsx("pre",{style:{padding:"8px",borderRadius:"4px",backgroundColor:"rgba(0,0,0,0.2)",fontSize:"11px",overflow:"auto",maxHeight:"200px",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:gi(j.result,2e3)})]}),j.error&&r.jsxs("div",{style:{marginTop:"12px"},children:[r.jsx("div",{style:{fontSize:"12px",color:"#d9534f",marginBottom:"4px"},children:"Error"}),r.jsx("pre",{style:{padding:"8px",borderRadius:"4px",backgroundColor:"rgba(100,0,0,0.15)",fontSize:"11px",overflow:"auto",maxHeight:"150px",margin:0,color:"#f99"},children:j.error})]})]})})]},A.id)})})]})})]})}function lm(){const[s,a]=p.useState([]),[u,c]=p.useState(!0),[f,h]=p.useState(null),[v,x]=p.useState(new Set),[E,w]=p.useState(!1),[j,C]=p.useState(""),[_,V]=p.useState(""),[U,g]=p.useState(""),[k,z]=p.useState([]),[B,W]=p.useState(!1),[G,Y]=p.useState(null),[M,ee]=p.useState(null),Q=(R=!1)=>{R&&c(!0),ue.getMcpServers().then(ae=>{a(ae.data),c(!1)}).catch(ae=>{h(ae instanceof Error?ae.message:String(ae)),c(!1)})};p.useEffect(()=>{Q(!0)},[]);const F=R=>{x(ae=>{const ye=new Set(ae);return ye.has(R)?ye.delete(R):ye.add(R),ye})},A=async()=>{if(j.trim()){W(!0),h(null);try{const R=_.trim()?_.trim().split(/\s+/):void 0,ae=j.startsWith("http://")||j.startsWith("https://"),ye={};for(const Se of k)Se.key.trim()&&(ye[Se.key.trim()]=Se.value);const ge=await ue.addMcpServer({...ae?{url:j.trim()}:{package:j.trim()},name:U.trim()||void 0,args:ae?void 0:R,env:Object.keys(ye).length>0?ye:void 0});ee(ge.data.message),C(""),V(""),g(""),z([]),w(!1),Q()}catch(R){h(R instanceof Error?R.message:String(R))}finally{W(!1)}}},b=async R=>{if(confirm(`Remove MCP server "${R}"?`)){Y(R),h(null);try{const ae=await ue.removeMcpServer(R);ee(ae.data.message),Q()}catch(ae){h(ae instanceof Error?ae.message:String(ae))}finally{Y(null)}}};if(u)return r.jsx("div",{className:"loading",children:"Loading..."});const se=s.filter(R=>R.connected).length;return r.jsxs("div",{children:[r.jsx("div",{className:"header",children:r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[r.jsxs("div",{children:[r.jsx("h1",{children:"MCP Servers"}),r.jsx("p",{children:"External tool servers connected via Model Context Protocol"})]}),r.jsx("button",{onClick:()=>w(!E),style:{fontSize:"13px"},children:E?"Cancel":"+ Add Server"})]})}),f&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[f,r.jsx("button",{onClick:()=>h(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),M&&r.jsxs("div",{className:"alert success",style:{marginBottom:"14px"},children:[M,r.jsx("button",{onClick:()=>ee(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),E&&r.jsxs("div",{className:"card",style:{marginBottom:"14px"},children:[r.jsx("h2",{style:{margin:"0 0 10px"},children:"Add MCP Server"}),r.jsxs("div",{style:{display:"grid",gap:"8px"},children:[r.jsxs("div",{children:[r.jsx("label",{style:{display:"block",fontSize:"12px",color:"var(--text-secondary)",marginBottom:"4px"},children:"Package or URL *"}),r.jsx("input",{type:"text",value:j,onChange:R=>C(R.target.value),placeholder:"@modelcontextprotocol/server-filesystem or http://localhost:3001/mcp",style:{width:"100%",fontSize:"13px"}})]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px"},children:[r.jsxs("div",{children:[r.jsx("label",{style:{display:"block",fontSize:"12px",color:"var(--text-secondary)",marginBottom:"4px"},children:"Arguments (space-separated)"}),r.jsx("input",{type:"text",value:_,onChange:R=>V(R.target.value),placeholder:"/tmp /home/user/docs",style:{width:"100%",fontSize:"13px"}})]}),r.jsxs("div",{children:[r.jsx("label",{style:{display:"block",fontSize:"12px",color:"var(--text-secondary)",marginBottom:"4px"},children:"Name (auto-derived if empty)"}),r.jsx("input",{type:"text",value:U,onChange:R=>g(R.target.value),placeholder:"filesystem",style:{width:"100%",fontSize:"13px"}})]})]}),r.jsxs("div",{children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px"},children:[r.jsx("label",{style:{fontSize:"12px",color:"var(--text-secondary)"},children:"Environment Variables"}),r.jsx("button",{type:"button",onClick:()=>z([...k,{key:"",value:"",id:crypto.randomUUID()}]),style:{fontSize:"11px",padding:"1px 6px",opacity:.7},children:"+ Add"})]}),k.map((R,ae)=>r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 2fr auto",gap:"6px",marginBottom:"4px"},children:[r.jsx("input",{type:"text",value:R.key,onChange:ye=>{const ge=[...k];ge[ae]={...ge[ae],key:ye.target.value},z(ge)},placeholder:"BRAVE_API_KEY",style:{fontSize:"12px",fontFamily:"monospace"}}),r.jsx("input",{type:"password",value:R.value,onChange:ye=>{const ge=[...k];ge[ae]={...ge[ae],value:ye.target.value},z(ge)},placeholder:"sk-xxx...",style:{fontSize:"12px",fontFamily:"monospace"}}),r.jsx("button",{type:"button",onClick:()=>z(k.filter((ye,ge)=>ge!==ae)),style:{fontSize:"11px",padding:"2px 6px",opacity:.6},children:"×"})]},R.id))]}),r.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"4px"},children:[r.jsx("button",{onClick:()=>w(!1),style:{fontSize:"13px",opacity:.7},children:"Cancel"}),r.jsx("button",{onClick:A,disabled:B||!j.trim(),style:{fontSize:"13px"},children:B?"Adding...":"Add Server"})]})]}),r.jsx("p",{style:{fontSize:"11px",color:"var(--text-secondary)",margin:"8px 0 0"},children:"Changes are saved to config.yaml. Restart teleton to connect."})]}),s.length===0&&!E&&r.jsxs("div",{className:"empty",children:[r.jsx("p",{children:"No MCP servers configured"}),r.jsxs("p",{style:{fontSize:"13px",color:"var(--text-secondary)",marginTop:"8px"},children:['Click "+ Add Server" above or use CLI: ',r.jsx("code",{children:"teleton mcp add @modelcontextprotocol/server-filesystem /tmp"})]})]}),s.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{fontSize:"13px",color:"var(--text-secondary)",marginBottom:"14px"},children:[se,"/",s.length," connected · ",s.reduce((R,ae)=>R+ae.toolCount,0)," tools total"]}),s.map(R=>r.jsxs("div",{className:"card",style:{marginBottom:"10px"},children:[r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx("h2",{style:{margin:0},children:R.name}),r.jsx("span",{style:{fontSize:"11px",padding:"1px 6px",borderRadius:"3px",background:"var(--surface)",color:"var(--text-secondary)"},children:R.type}),R.scope!=="always"&&r.jsx("span",{style:{fontSize:"11px",padding:"1px 6px",borderRadius:"3px",background:"var(--surface)",color:"var(--text-secondary)"},children:R.scope})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[r.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"12px",color:R.connected?"var(--green)":"var(--red)"},children:[r.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:R.connected?"var(--green)":"var(--red)"}}),R.connected?"Connected":"Disconnected"]}),!R.enabled&&r.jsx("span",{style:{fontSize:"11px",color:"var(--text-secondary)"},children:"disabled"}),r.jsx("button",{onClick:()=>b(R.name),disabled:G===R.name,style:{fontSize:"11px",padding:"2px 8px",opacity:.6,cursor:G===R.name?"wait":"pointer"},children:G===R.name?"...":"Remove"})]})]}),r.jsx("div",{style:{fontSize:"12px",fontFamily:"monospace",color:"var(--text-secondary)",marginBottom:"8px"},children:R.target}),R.envKeys.length>0&&r.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginBottom:"8px"},children:R.envKeys.map(ae=>r.jsxs("span",{style:{fontSize:"11px",padding:"1px 6px",borderRadius:"3px",background:"var(--surface)",color:"var(--text-secondary)",fontFamily:"monospace"},children:[ae,"=••••"]},ae))}),R.toolCount>0&&r.jsxs("div",{children:[r.jsxs("button",{onClick:()=>F(R.name),style:{background:"none",border:"none",padding:0,fontSize:"12px",color:"var(--accent)",cursor:"pointer"},children:[v.has(R.name)?"▾":"▸"," ",R.toolCount," tools"]}),v.has(R.name)&&r.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"8px"},children:R.tools.map(ae=>r.jsx("span",{style:{fontSize:"11px",padding:"2px 6px",borderRadius:"3px",background:"var(--surface)",color:"var(--text-secondary)"},children:ae},ae))})]})]},R.name))]})]})}function sm({tabs:s,activeTab:a,onTabChange:u}){return r.jsx("div",{className:"pill-bar",children:s.map(c=>r.jsx("button",{className:c.id===a?"active":void 0,onClick:()=>u(c.id),children:c.label},c.id))})}function Fc({value:s,onChange:a,validate:u,placeholder:c,disabled:f}){const[h,v]=p.useState(s),[x,E]=p.useState(""),[w,j]=p.useState(null),[C,_]=p.useState(-1),[V,U]=p.useState(-1),g=p.useRef(null),k=p.useRef([]);p.useEffect(()=>{v(s)},[s]);const z=JSON.stringify(h)!==JSON.stringify(s),B=p.useCallback(F=>{const A=F.trim();if(A){if(u){const b=u(A);if(b){j(b);return}}if(h.includes(A)){j("Duplicate item");return}j(null),v(b=>[...b,A]),E("")}},[h,u]),W=p.useCallback(F=>{var A;if(v(b=>b.filter((se,R)=>R!==F)),h.length<=1)(A=g.current)==null||A.focus(),_(-1);else if(F>=h.length-1){const b=F-1;_(b),setTimeout(()=>{var se;return(se=k.current[b])==null?void 0:se.focus()},0)}else _(F),setTimeout(()=>{var b;return(b=k.current[F])==null?void 0:b.focus()},0)},[h.length]),G=p.useCallback(F=>{var A;if(!F.nativeEvent.isComposing){if(F.key==="Enter")F.preventDefault(),B(x);else if(F.key==="Backspace"&&x===""&&h.length>0){const b=h.length-1;_(b),(A=k.current[b])==null||A.focus()}}},[x,B,h.length]),Y=p.useCallback((F,A)=>{var b,se,R,ae,ye,ge;switch(F.key){case"ArrowLeft":F.preventDefault(),A>0&&(_(A-1),(b=k.current[A-1])==null||b.focus());break;case"ArrowRight":F.preventDefault(),A<h.length-1?(_(A+1),(se=k.current[A+1])==null||se.focus()):(_(-1),(R=g.current)==null||R.focus());break;case"Delete":case"Backspace":F.preventDefault(),W(A);break;case"Escape":F.preventDefault(),_(-1),(ae=g.current)==null||ae.focus();break;case"Home":F.preventDefault(),_(0),(ye=k.current[0])==null||ye.focus();break;case"End":if(F.preventDefault(),h.length>0){const Se=h.length-1;_(Se),(ge=k.current[Se])==null||ge.focus()}break}},[h.length,W]),M=p.useCallback(F=>{const b=F.clipboardData.getData("text").split(/[,;\n\t]+/).map(R=>R.trim()).filter(Boolean);if(b.length<=1)return;F.preventDefault();const se=[];for(const R of b)h.includes(R)||se.includes(R)||u&&u(R)||se.push(R);se.length>0&&(v(R=>[...R,...se]),j(null))},[h,u]),ee=()=>{a(h)},Q=()=>{v(s),j(null)};return r.jsxs("div",{style:{opacity:f?.5:1},children:[h.length>0&&r.jsx("div",{role:"listbox","aria-orientation":"horizontal",style:{display:"flex",flexWrap:"wrap",gap:"6px",marginBottom:"var(--space-sm)"},children:h.map((F,A)=>r.jsxs("div",{ref:b=>{k.current[A]=b},role:"option","aria-selected":"true",tabIndex:C===A?0:-1,onKeyDown:b=>Y(b,A),onFocus:()=>_(A),onBlur:()=>{C===A&&_(-1)},style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"3px 8px",background:"var(--surface)",border:"1px solid var(--glass-border)",color:"var(--text-secondary)",borderRadius:"6px",fontSize:"var(--font-sm)",lineHeight:"1.4",outline:C===A?"2px solid var(--accent)":"none",outlineOffset:C===A?"1px":void 0,cursor:"default"},children:[r.jsx("span",{style:{fontFamily:"var(--font-mono)",letterSpacing:"-0.2px"},children:F}),r.jsx("button",{type:"button","aria-label":`Remove ${F}`,disabled:f,onClick:b=>{b.stopPropagation(),W(A)},onMouseEnter:()=>U(A),onMouseLeave:()=>U(-1),style:{background:"none",border:"none",color:V===A?"var(--red)":"var(--text-tertiary)",cursor:f?"not-allowed":"pointer",padding:"0 1px",fontSize:"13px",lineHeight:"1",transition:"color 0.15s"},children:"×"})]},`${F}-${A}`))}),r.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[r.jsx("input",{ref:g,type:"text",value:x,onChange:F=>{E(F.target.value),j(null)},onKeyDown:G,onPaste:M,placeholder:c??"Add pattern…",disabled:f,"aria-invalid":w?!0:void 0,style:{flex:1,background:"var(--surface)",border:"1px solid var(--glass-border)",borderRadius:"6px",color:"var(--text)",fontSize:"var(--font-sm)",padding:"5px 10px",outline:"none",fontFamily:"var(--font-mono)"},onFocus:F=>{F.target.style.borderColor="var(--glass-border-strong)"},onBlur:F=>{F.target.style.borderColor="var(--glass-border)"}}),r.jsx("button",{type:"button",disabled:f||!x.trim(),onClick:()=>B(x),style:{padding:"4px 10px",fontSize:"var(--font-sm)",borderRadius:"6px",minHeight:"auto",lineHeight:"1.4"},children:"Add"})]}),w&&r.jsx("div",{style:{fontSize:"var(--font-sm)",color:"var(--red)",marginTop:"4px"},children:w}),z&&r.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"var(--space-sm)"},children:[r.jsx("button",{type:"button",onClick:ee,disabled:f,style:{padding:"4px 12px",fontSize:"var(--font-sm)",borderRadius:"6px",minHeight:"auto"},children:"Save"}),r.jsx("button",{type:"button",className:"btn-ghost",onClick:Q,disabled:f,style:{padding:"4px 12px",fontSize:"var(--font-sm)",borderRadius:"6px",minHeight:"auto"},children:"Cancel"})]})]})}const om=[{id:"llm",label:"LLM"},{id:"telegram",label:"Telegram"},{id:"session",label:"Session"},{id:"api-keys",label:"API Keys"},{id:"advanced",label:"Advanced"}],im=["agent.api_key","telegram.bot_token","tavily_api_key","tonapi_key"],am=["telegram.admin_ids","telegram.allow_from","telegram.group_allow_from","telegram.owner_id","telegram.max_message_length","telegram.rate_limit_messages_per_second","telegram.rate_limit_groups_per_minute"],um=["embedding.provider","embedding.model","webui.port","webui.log_requests","deals.enabled","deals.expiry_seconds","deals.buy_max_floor_percent","deals.sell_min_floor_percent","agent.base_url","dev.hot_reload"];function cm(){const[s,a]=Ch(),u=s.get("tab")||"llm",c=sd(),[f,h]=p.useState([]),[v,x]=p.useState(!1),[E,w]=p.useState(null),[j,C]=p.useState(""),[_,V]=p.useState(!1),U=M=>{a({tab:M},{replace:!0})};p.useEffect(()=>{(u==="api-keys"||u==="advanced"||u==="telegram")&&(x(!0),ue.getConfigKeys().then(M=>{h(M.data),x(!1)}).catch(()=>x(!1)))},[u]);const g=()=>{ue.getConfigKeys().then(M=>h(M.data)).catch(()=>{})},k=M=>{var ee;w(M.key),M.type==="boolean"?C(M.set&&M.value!==null?M.value:"true"):M.type==="enum"&&((ee=M.options)!=null&&ee.length)?C(M.set&&M.value!==null?M.value:M.options[0]):C("")},z=async M=>{const ee=f.find(F=>F.key===M);if(!(!((ee==null?void 0:ee.type)==="boolean"||(ee==null?void 0:ee.type)==="enum")&&!j.trim())){V(!0),c.setError(null);try{await ue.setConfigKey(M,j.trim()),w(null),C(""),c.showSuccess(`${M} updated successfully`),g()}catch(F){c.setError(F instanceof Error?F.message:String(F))}finally{V(!1)}}},B=async M=>{V(!0),c.setError(null);try{await ue.unsetConfigKey(M),c.showSuccess(`${M} removed`),g()}catch(ee){c.setError(ee instanceof Error?ee.message:String(ee))}finally{V(!1)}},W=()=>{w(null),C("")},G=async(M,ee)=>{V(!0),c.setError(null);try{await ue.setConfigKey(M,ee),c.showSuccess(`${M} updated successfully`),g()}catch(Q){c.setError(Q instanceof Error?Q.message:String(Q))}finally{V(!1)}};if(c.loading)return r.jsx("div",{className:"loading",children:"Loading..."});const Y=M=>{if(v)return r.jsx("div",{className:"loading",children:"Loading..."});const ee=f.filter(Q=>M.includes(Q.key));return ee.length===0?r.jsx("div",{style:{color:"var(--text-secondary)",fontSize:"13px"},children:"No keys found"}):ee.map((Q,F)=>{var A;return r.jsxs("div",{style:{padding:"12px 0",borderBottom:F<ee.length-1?"1px solid var(--separator)":"none"},children:[r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[r.jsxs("div",{children:[r.jsx("strong",{children:Q.label}),r.jsx("span",{style:{marginLeft:"10px",fontSize:"11px",padding:"2px 8px",borderRadius:"4px",background:Q.set?"var(--accent)":"var(--surface)",color:Q.set?"var(--text-on-accent)":"var(--text-secondary)"},children:Q.set?"Set":"Not set"}),Q.sensitive&&r.jsx("span",{style:{marginLeft:"6px",fontSize:"11px",color:"var(--text-secondary)"},children:"sensitive"}),r.jsx("div",{style:{fontSize:"11px",color:"var(--text-secondary)",fontFamily:"monospace",marginTop:"2px"},children:Q.key})]}),Q.type!=="array"&&r.jsxs("div",{style:{display:"flex",gap:"6px"},children:[r.jsx("button",{onClick:()=>k(Q),style:{padding:"4px 12px",fontSize:"12px"},disabled:_,children:"Edit"}),Q.set&&r.jsx("button",{onClick:()=>B(Q.key),style:{padding:"4px 12px",fontSize:"12px",opacity:.7},disabled:_,children:"Remove"})]})]}),r.jsx("div",{style:{fontSize:"12px",color:"var(--text-secondary)",marginTop:"4px"},children:Q.description}),Q.type==="array"?r.jsx("div",{style:{marginTop:"8px"},children:r.jsx(Fc,{value:Q.value?JSON.parse(Q.value):[],onChange:b=>G(Q.key,b),validate:Q.itemType==="number"?b=>/^\d+$/.test(b)?null:"Must be a number":void 0,placeholder:Q.itemType==="number"?"Enter ID...":"Enter value...",disabled:_})}):r.jsxs(r.Fragment,{children:[Q.set&&Q.value&&E!==Q.key&&r.jsx("div",{style:{marginTop:"6px",fontSize:"13px",color:"var(--text)",fontFamily:"monospace"},children:((A=Q.optionLabels)==null?void 0:A[Q.value])??Q.value}),E===Q.key&&r.jsxs("div",{className:"form-group",style:{marginTop:"10px",marginBottom:0},children:[Q.type==="boolean"?r.jsx(ct,{value:j,options:["true","false"],onChange:C,style:{width:"100%",marginBottom:"8px"}}):Q.type==="enum"&&Q.options?r.jsx(ct,{value:j,options:Q.options,labels:Q.optionLabels?Q.options.map(b=>Q.optionLabels[b]??b):void 0,onChange:C,style:{width:"100%",marginBottom:"8px"}}):r.jsx("input",{type:Q.type==="number"?"number":Q.sensitive?"password":"text",value:j,onChange:b=>C(b.target.value),onKeyDown:b=>b.key==="Enter"&&z(Q.key),placeholder:`Enter value for ${Q.key}...`,autoFocus:!0,style:{width:"100%",marginBottom:"8px"}}),r.jsxs("div",{style:{display:"flex",gap:"6px"},children:[r.jsx("button",{onClick:()=>z(Q.key),disabled:_||Q.type!=="boolean"&&Q.type!=="enum"&&!j.trim(),children:_?"Saving...":"Save"}),r.jsx("button",{onClick:W,style:{opacity:.7},disabled:_,children:"Cancel"})]})]})]})]},Q.key)})};return r.jsxs("div",{children:[r.jsxs("div",{className:"header",children:[r.jsx("h1",{children:"Configuration"}),r.jsx("p",{children:"Manage settings and API keys"})]}),c.error&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[c.error,r.jsx("button",{onClick:()=>c.setError(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),c.saveSuccess&&r.jsx("div",{className:"alert success",style:{marginBottom:"16px"},children:c.saveSuccess}),r.jsx(sm,{tabs:om,activeTab:u,onTabChange:U}),u==="llm"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"card",children:r.jsx(od,{getLocal:c.getLocal,setLocal:c.setLocal,saveConfig:c.saveConfig,modelOptions:c.modelOptions,pendingProvider:c.pendingProvider,pendingMeta:c.pendingMeta,pendingApiKey:c.pendingApiKey,setPendingApiKey:c.setPendingApiKey,pendingValidating:c.pendingValidating,pendingError:c.pendingError,setPendingError:c.setPendingError,handleProviderChange:c.handleProviderChange,handleProviderConfirm:c.handleProviderConfirm,handleProviderCancel:c.handleProviderCancel})}),c.getLocal("agent.provider")==="cocoon"&&r.jsxs("div",{className:"card",children:[r.jsx("div",{className:"section-title",children:"Cocoon"}),r.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[r.jsxs("label",{children:["Proxy Port ",r.jsx("span",{style:{fontSize:"11px",color:"var(--text-secondary)"},children:"(requires restart)"})]}),r.jsx("input",{type:"number",min:"1",max:"65535",value:c.getLocal("cocoon.port"),onChange:M=>c.setLocal("cocoon.port",M.target.value),onBlur:M=>c.saveConfig("cocoon.port",M.target.value),onKeyDown:M=>M.key==="Enter"&&c.saveConfig("cocoon.port",M.currentTarget.value),placeholder:"11434",style:{width:"100%"}})]})]}),c.toolRag&&r.jsxs("div",{className:"card",children:[r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px"},children:[r.jsxs("div",{children:[r.jsx("div",{className:"section-title",style:{marginBottom:"4px"},children:"Tool RAG"}),r.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",margin:0},children:"Semantic tool selection — sends only the most relevant tools to the LLM per message."})]}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{type:"checkbox",checked:c.toolRag.enabled,onChange:()=>c.saveToolRag({enabled:!c.toolRag.enabled})}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]}),r.jsxs("div",{style:{display:"grid",gap:"12px"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("label",{style:{fontSize:"13px",color:"var(--text)"},children:"Indexed"}),r.jsx("span",{style:{fontSize:"13px",color:"var(--text)"},children:c.toolRag.indexed?"Yes":"No"})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("label",{style:{fontSize:"13px",color:"var(--text)"},children:"Top-K"}),r.jsx(ct,{value:String(c.toolRag.topK),options:["10","15","20","25","30","40","50"],onChange:M=>c.saveToolRag({topK:Number(M)}),style:{minWidth:"80px"}})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("label",{style:{fontSize:"13px",color:"var(--text)"},children:"Total Tools"}),r.jsx("span",{style:{fontSize:"13px",color:"var(--text)"},children:c.toolRag.totalTools})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("label",{style:{fontSize:"13px",color:"var(--text)",cursor:"pointer"},htmlFor:"skip-unlimited",children:"Skip Unlimited Providers"}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{id:"skip-unlimited",type:"checkbox",checked:c.toolRag.skipUnlimitedProviders??!1,onChange:()=>c.saveToolRag({skipUnlimitedProviders:!c.toolRag.skipUnlimitedProviders})}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]}),r.jsxs("div",{children:[r.jsx("label",{style:{fontSize:"13px",color:"var(--text)",display:"block",marginBottom:"6px"},children:"Always Include (glob patterns)"}),r.jsx(Fc,{value:c.toolRag.alwaysInclude??[],onChange:M=>c.saveToolRag({alwaysInclude:M}),placeholder:"e.g. telegram_send_*"})]})]})]})]}),u==="telegram"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"card",children:r.jsx(id,{getLocal:c.getLocal,setLocal:c.setLocal,saveConfig:c.saveConfig,extended:!0})}),r.jsxs("div",{className:"card",children:[r.jsx("div",{className:"section-title",children:"Telegram Settings"}),Y(am)]})]}),u==="session"&&r.jsxs("div",{className:"card",children:[r.jsx("div",{className:"section-title",children:"Session"}),r.jsxs("div",{style:{display:"grid",gap:"16px"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("label",{style:{fontSize:"13px",color:"var(--text)",cursor:"pointer"},htmlFor:"daily-reset",children:"Daily Reset"}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{id:"daily-reset",type:"checkbox",checked:c.getLocal("agent.session_reset_policy.daily_reset_enabled")==="true",onChange:M=>c.saveConfig("agent.session_reset_policy.daily_reset_enabled",String(M.target.checked))}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]}),r.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[r.jsx("label",{children:"Reset Hour (0-23)"}),r.jsx(ct,{value:c.getLocal("agent.session_reset_policy.daily_reset_hour"),options:Array.from({length:24},(M,ee)=>String(ee)),onChange:M=>c.saveConfig("agent.session_reset_policy.daily_reset_hour",M)})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("label",{style:{fontSize:"13px",color:"var(--text)",cursor:"pointer"},htmlFor:"idle-expiry",children:"Idle Expiry"}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{id:"idle-expiry",type:"checkbox",checked:c.getLocal("agent.session_reset_policy.idle_expiry_enabled")==="true",onChange:M=>c.saveConfig("agent.session_reset_policy.idle_expiry_enabled",String(M.target.checked))}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]}),r.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[r.jsx("label",{children:"Idle Minutes"}),r.jsx("input",{type:"number",min:"1",value:c.getLocal("agent.session_reset_policy.idle_expiry_minutes"),onChange:M=>c.setLocal("agent.session_reset_policy.idle_expiry_minutes",M.target.value),onBlur:M=>c.saveConfig("agent.session_reset_policy.idle_expiry_minutes",M.target.value),onKeyDown:M=>M.key==="Enter"&&c.saveConfig("agent.session_reset_policy.idle_expiry_minutes",M.currentTarget.value),style:{width:"100%"}})]})]})]}),u==="api-keys"&&r.jsxs("div",{className:"card",children:[r.jsx("div",{className:"section-title",children:"API Keys"}),Y(im)]}),u==="advanced"&&r.jsxs("div",{className:"card",children:[r.jsx("div",{className:"section-title",children:"Advanced"}),Y(um)]})]})}function dm({data:s,onChange:a}){const[u,c]=p.useState(null),[f,h]=p.useState(!0),[v,x]=p.useState(""),[E,w]=p.useState(!1);p.useEffect(()=>{Ye.getStatus().then(C=>c(C)).catch(C=>x(C instanceof Error?C.message:String(C))).finally(()=>h(!1))},[]);const j=async C=>{if(a({...s,riskAccepted:C}),C&&!E)try{await Ye.initWorkspace(s.agentName||void 0),w(!0)}catch(_){x(_ instanceof Error?_.message:String(_))}};return r.jsxs("div",{className:"step-content",children:[r.jsx("h2",{className:"step-title",children:"Welcome to Teleton Setup"}),r.jsx("p",{className:"step-description",children:"Configure your autonomous Telegram agent in a few steps."}),r.jsxs("details",{className:"guide-dropdown",children:[r.jsx("summary",{children:"Security Notice"}),r.jsxs("div",{className:"guide-content",children:["This software is an autonomous AI agent that can:",r.jsxs("ul",{style:{margin:"8px 0 8px 20px"},children:[r.jsx("li",{children:"Send and receive Telegram messages on your behalf"}),r.jsx("li",{children:"Execute cryptocurrency transactions using your wallet"}),r.jsx("li",{children:"Access and store conversation data"}),r.jsx("li",{children:"Make decisions and take actions autonomously"})]}),"You are solely responsible for all actions taken by this agent. By proceeding, you acknowledge that you understand these risks and accept full responsibility for the agent's behavior.",r.jsx("br",{}),r.jsx("br",{}),r.jsx("strong",{children:"Never share your API keys, wallet mnemonics, or session files."})]})]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Agent Name"}),r.jsx("input",{type:"text",value:s.agentName,onChange:C=>a({...s,agentName:C.target.value}),placeholder:"Nova",className:"w-full"}),r.jsx("div",{className:"helper-text",children:"Your agent's display name in conversations."})]}),(u==null?void 0:u.configExists)&&r.jsx("div",{className:"info-box",children:"Existing configuration detected. It will be overwritten when setup completes."}),v&&r.jsx("div",{className:"alert error",children:v}),r.jsx("div",{className:"form-group",children:r.jsxs("label",{className:"label-inline",children:[r.jsx("input",{type:"checkbox",checked:s.riskAccepted,onChange:C=>j(C.target.checked)}),r.jsx("span",{children:"I understand the risks and accept full responsibility"})]})}),f&&r.jsx("div",{className:"loading",children:"Checking workspace..."})]})}function pm({data:s,onChange:a}){const[u,c]=p.useState([]),[f,h]=p.useState(!0),[v,x]=p.useState(""),[E,w]=p.useState(null),[j,C]=p.useState(""),[_,V]=p.useState(!1),U=p.useRef(null),[g,k]=p.useState(null),[z,B]=p.useState(!1),[W,G]=p.useState(!1),[Y,M]=p.useState([]),[ee,Q]=p.useState(!1);p.useEffect(()=>{Ye.getProviders().then(R=>c(R)).catch(R=>x(R instanceof Error?R.message:String(R))).finally(()=>h(!1))},[]);const F=u.find(R=>R.id===s.provider);p.useEffect(()=>{F!=null&&F.autoDetectsKey&&(B(!0),k(null),G(!1),Ye.detectClaudeCodeKey().then(R=>{k(R),R.found&&a({...s,apiKey:""})}).catch(()=>k({found:!1,maskedKey:null,valid:!1})).finally(()=>B(!1)))},[F==null?void 0:F.id]),p.useEffect(()=>{if(!s.provider||s.provider==="cocoon"||s.provider==="local"){M([]);return}Q(!0),Ye.getModels(s.provider).then(R=>{M(R),!s.model&&R.length>0&&a({...s,model:R[0].value})}).catch(()=>M([])).finally(()=>Q(!1))},[s.provider]);const A=R=>{a({...s,provider:R,apiKey:"",model:"",customModel:""}),w(null),C(""),k(null),G(!1),U.current&&clearTimeout(U.current)},b=async(R,ae)=>{if(!(!ae||!R)){V(!0);try{const ye=await Ye.validateApiKey(R,ae);w(ye.valid),C(ye.error||"")}catch{w(null),C("")}finally{V(!1)}}},se=R=>{a({...s,apiKey:R}),w(null),C(""),U.current&&clearTimeout(U.current),R.length>0&&s.provider&&(U.current=setTimeout(()=>b(s.provider,R),500))};return f?r.jsx("div",{className:"loading",children:"Loading providers..."}):v?r.jsx("div",{className:"alert error",children:v}):r.jsxs("div",{className:"step-content",children:[r.jsx("h2",{className:"step-title",children:"Choose Your LLM Provider"}),r.jsx("p",{className:"step-description",children:"This is the AI model that powers your agent's intelligence. Pick the one you have an API key for."}),r.jsx("div",{className:"provider-grid",children:u.map(R=>r.jsxs("div",{className:`provider-card${s.provider===R.id?" selected":""}`,onClick:()=>A(R.id),children:[r.jsx("h3",{children:R.displayName}),r.jsx("div",{className:"provider-meta",children:R.defaultModel}),R.toolLimit===null&&r.jsx("span",{className:"badge always",style:{marginTop:"6px"},children:"Recommended"})]},R.id))}),F&&F.toolLimit!==null&&r.jsxs("div",{className:"info-box",style:{marginTop:"16px"},children:["Teleton has ~116 tools. With a ",F.toolLimit,"-tool limit, some tools may be truncated or unavailable."]}),F&&F.autoDetectsKey&&r.jsxs("div",{style:{marginTop:"16px"},children:[z&&r.jsxs("div",{className:"info-panel",children:[r.jsx("span",{className:"spinner sm"})," Detecting Claude Code credentials..."]}),!z&&(g==null?void 0:g.found)&&r.jsxs("div",{className:"info-panel",children:[r.jsx("div",{style:{marginBottom:"4px",color:"var(--color-success, #4caf50)"},children:r.jsx("strong",{children:"Credentials auto-detected from Claude Code"})}),r.jsx("code",{style:{fontSize:"0.85em",opacity:.8},children:g.maskedKey}),r.jsx("div",{className:"helper-text",style:{marginTop:"6px"},children:"Token will auto-refresh when it expires. No configuration needed."})]}),!z&&g&&!g.found&&!W&&r.jsxs("div",{className:"info-panel",style:{borderColor:"var(--color-warning, #ff9800)"},children:[r.jsxs("div",{style:{marginBottom:"8px"},children:["Claude Code credentials not found. Make sure Claude Code is installed and authenticated (",r.jsx("code",{children:"claude login"}),")."]}),r.jsx("button",{className:"btn btn-sm",onClick:()=>G(!0),children:"Enter API key manually instead"})]}),!z&&W&&r.jsxs("div",{className:"form-group",style:{marginTop:"8px"},children:[r.jsx("label",{children:"API Key (fallback)"}),r.jsx("input",{type:"password",value:s.apiKey,onChange:R=>se(R.target.value),placeholder:F.keyPrefix?`${F.keyPrefix}...`:"Enter API key",className:"w-full"}),_&&r.jsxs("div",{className:"helper-text",children:[r.jsx("span",{className:"spinner sm"})," Validating..."]}),!_&&E===!0&&r.jsx("div",{className:"helper-text success",children:"Key format looks valid."}),!_&&E===!1&&j&&r.jsx("div",{className:"helper-text error",children:j}),r.jsxs("div",{className:"helper-text",children:["Get your key at:"," ",r.jsx("a",{href:"https://console.anthropic.com/",target:"_blank",rel:"noopener noreferrer",children:"https://console.anthropic.com/"})]})]})]}),F&&F.requiresApiKey&&r.jsxs("div",{className:"form-group",style:{marginTop:"16px"},children:[r.jsx("label",{children:"API Key"}),r.jsx("input",{type:"password",value:s.apiKey,onChange:R=>se(R.target.value),placeholder:F.keyPrefix?`${F.keyPrefix}...`:"Enter API key",className:"w-full"}),_&&r.jsxs("div",{className:"helper-text",children:[r.jsx("span",{className:"spinner sm"})," Validating..."]}),!_&&E===!0&&r.jsx("div",{className:"helper-text success",children:"Key format looks valid."}),!_&&E===!1&&j&&r.jsx("div",{className:"helper-text error",children:j}),F.consoleUrl&&r.jsxs("div",{className:"helper-text",children:["Get your key at:"," ",r.jsx("a",{href:F.consoleUrl,target:"_blank",rel:"noopener noreferrer",children:F.consoleUrl})]})]}),F&&!F.requiresApiKey&&F.id==="cocoon"&&r.jsxs("div",{style:{marginTop:"16px"},children:[r.jsx("div",{className:"info-panel",children:"Cocoon Network uses a local proxy. No API key required."}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Cocoon Proxy Port"}),r.jsx("input",{type:"number",value:s.cocoonPort,onChange:R=>a({...s,cocoonPort:parseInt(R.target.value)||0}),min:1,max:65535,className:"w-full"}),r.jsx("div",{className:"helper-text",children:"Port where the Cocoon client proxy is running (1-65535)."})]})]}),F&&F.id==="local"&&r.jsxs("div",{style:{marginTop:"16px"},children:[r.jsx("div",{className:"info-panel",children:"Connect to any OpenAI-compatible server (Ollama, vLLM, LM Studio, llama.cpp). No API key required."}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Server URL"}),r.jsx("input",{type:"url",value:s.localUrl,onChange:R=>a({...s,localUrl:R.target.value}),placeholder:"http://localhost:11434/v1",className:"w-full"}),r.jsx("div",{className:"helper-text",children:"Ollama :11434 · vLLM :8000 · LM Studio :1234 · llama.cpp :8080"})]})]}),F&&F.id!=="cocoon"&&F.id!=="local"&&r.jsxs("div",{className:"form-group",style:{marginTop:"16px"},children:[r.jsx("label",{children:"Model"}),ee?r.jsxs("div",{className:"text-muted",children:[r.jsx("span",{className:"spinner sm"})," Loading models..."]}):r.jsx(ct,{value:s.model,options:Y.map(R=>R.value),labels:Y.map(R=>R.isCustom?"Custom...":`${R.name} - ${R.description}`),onChange:R=>a({...s,model:R}),style:{width:"100%"}}),s.model==="__custom__"&&r.jsx("input",{type:"text",value:s.customModel,onChange:R=>a({...s,customModel:R.target.value}),placeholder:"Enter custom model ID",className:"w-full",style:{marginTop:"8px"}})]})]})}function fm({data:s,onChange:a}){return r.jsxs("div",{className:"step-content",children:[r.jsx("h2",{className:"step-title",children:"Telegram Credentials"}),r.jsx("p",{className:"step-description",children:"These credentials allow your agent to use your Telegram account to send and receive messages."}),r.jsxs("details",{className:"guide-dropdown",children:[r.jsx("summary",{children:"How to get these credentials"}),r.jsxs("div",{className:"guide-content",children:[r.jsxs("div",{className:"guide-section",children:[r.jsx("strong",{children:"API ID & API Hash"}),r.jsxs("ol",{children:[r.jsxs("li",{children:["Open ",r.jsx("a",{href:"https://my.telegram.org",target:"_blank",rel:"noopener noreferrer",children:"my.telegram.org"})," in your browser"]}),r.jsx("li",{children:"Log in with your phone number (the one linked to your Telegram account)"}),r.jsxs("li",{children:["Click ",r.jsx("strong",{children:"API development tools"})]}),r.jsx("li",{children:`If prompted, create a new app — the name and platform don't matter (e.g. "MyApp", Desktop)`}),r.jsxs("li",{children:["Copy ",r.jsx("strong",{children:"App api_id"})," (a number) and ",r.jsx("strong",{children:"App api_hash"})," (a hex string)"]})]})]}),r.jsxs("div",{className:"guide-section",children:[r.jsx("strong",{children:"Phone Number"}),r.jsx("p",{children:"The phone number linked to your Telegram account, with country code (e.g. +33612345678)."})]})]})]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"API ID"}),r.jsx("input",{type:"number",value:s.apiId||"",onChange:u=>a({...s,apiId:parseInt(u.target.value)||0}),placeholder:"12345678",className:"w-full"})]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"API Hash"}),r.jsx("input",{type:"text",value:s.apiHash,onChange:u=>a({...s,apiHash:u.target.value}),placeholder:"abcdef0123456789abcdef0123456789",className:"w-full"}),s.apiHash.length>0&&s.apiHash.length<10&&r.jsx("div",{className:"helper-text",children:"API Hash should be at least 10 characters."})]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Phone Number"}),r.jsx("input",{type:"text",value:s.phone,onChange:u=>a({...s,phone:u.target.value}),placeholder:"+33612345678",className:"w-full"}),s.phone.length>0&&!s.phone.startsWith("+")&&r.jsx("div",{className:"helper-text",children:'Phone number must start with "+"'})]})]})}function hm({data:s,onChange:a}){const[u,c]=p.useState(!1),[f,h]=p.useState(null),[v,x]=p.useState(!1),[E,w]=p.useState(""),j=async()=>{if(s.botToken){c(!0),w(""),h(null),x(!1);try{const g=await Ye.validateBotToken(s.botToken);g.valid&&g.bot?(h(!0),a({...s,botUsername:g.bot.username})):g.networkError?x(!0):(h(!1),w(g.error||"Invalid bot token"))}catch(g){w(g instanceof Error?g.message:String(g))}finally{c(!1)}}},C=["open","allowlist","disabled"],_=["Open","Allowlist","Disabled"],V={open:"Anyone can message the agent in DMs.",allowlist:"Only admin users can DM the agent.",disabled:"Agent ignores all DMs."},U={open:"Agent responds in any group it's added to.",allowlist:"Agent only responds in groups explicitly allowed by admins.",disabled:"Agent ignores all group messages."};return r.jsxs("div",{className:"step-content",children:[r.jsx("h2",{className:"step-title",children:"Configuration"}),r.jsx("p",{className:"step-description",children:"Configure your agent's behavior policies. Defaults are pre-filled — adjust what you need."}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Admin User ID"}),r.jsx("input",{type:"number",value:s.userId||"",onChange:g=>a({...s,userId:parseInt(g.target.value)||0}),placeholder:"123456789",className:"w-full"}),r.jsxs("div",{className:"helper-text",children:["This account will have admin control over the agent in DMs and groups. Get your ID from ",r.jsx("a",{href:"https://t.me/userinfobot",target:"_blank",rel:"noopener noreferrer",children:"@userinfobot"})," on Telegram."]})]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"DM Policy"}),r.jsx(ct,{value:s.dmPolicy,options:C,labels:_,onChange:g=>a({...s,dmPolicy:g}),style:{width:"100%"}}),r.jsx("div",{className:"helper-text",children:V[s.dmPolicy]||""})]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Group Policy"}),r.jsx(ct,{value:s.groupPolicy,options:C,labels:_,onChange:g=>a({...s,groupPolicy:g}),style:{width:"100%"}}),r.jsx("div",{className:"helper-text",children:U[s.groupPolicy]||""})]}),r.jsxs("div",{className:"form-group",children:[r.jsxs("div",{className:"card-toggle",children:[r.jsx("span",{style:{fontSize:"13px",fontWeight:500},children:"Require @mention in groups"}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{type:"checkbox",checked:s.requireMention,onChange:g=>a({...s,requireMention:g.target.checked})}),r.jsx("div",{className:"toggle-track"}),r.jsx("div",{className:"toggle-thumb"})]})]}),r.jsx("div",{className:"helper-text",children:"When enabled, the agent only responds when mentioned by name in group chats."})]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Max Agentic Iterations"}),r.jsx("input",{type:"number",value:s.maxIterations,onChange:g=>a({...s,maxIterations:parseInt(g.target.value)||1}),min:1,max:50,className:"w-full"}),r.jsx("div",{className:"helper-text",children:"Maximum tool-call loops per message (1-50). Higher values allow more complex tasks."})]}),r.jsx("h3",{style:{fontSize:"14px",fontWeight:600,marginTop:"24px",marginBottom:"12px"},children:"Optional API Keys"}),r.jsxs("div",{className:"module-list",children:[r.jsxs("div",{className:"module-item",children:[r.jsxs("div",{className:"form-row",style:{gap:"12px",alignItems:"center"},children:[r.jsxs("div",{style:{flex:1},children:[r.jsx("strong",{style:{fontSize:"var(--font-md)"},children:"Bot Token"}),r.jsx("span",{className:"module-desc",style:{marginLeft:"8px"},children:"(recommended)"})]}),r.jsx("input",{type:"password",value:s.botToken,onChange:g=>{a({...s,botToken:g.target.value,botUsername:""}),h(null),x(!1),w("")},placeholder:"123456:ABC-DEF...",style:{flex:1}}),r.jsx("button",{onClick:j,disabled:u||!s.botToken,type:"button",children:u?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Validating"]}):"Validate"})]}),f&&s.botUsername&&r.jsxs("div",{className:"alert success",children:["Bot verified: @",s.botUsername]}),v&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"info-box",children:"Could not reach Telegram API. Enter the bot username manually."}),r.jsxs("div",{className:"form-row",style:{gap:"12px",alignItems:"center",marginTop:"8px"},children:[r.jsx("div",{style:{flex:1},children:r.jsx("strong",{style:{fontSize:"var(--font-md)"},children:"Bot Username"})}),r.jsx("input",{type:"text",value:s.botUsername,onChange:g=>a({...s,botUsername:g.target.value}),placeholder:"my_bot",style:{flex:1}})]})]}),f===!1&&E&&r.jsx("div",{className:"alert error",children:E}),r.jsxs("div",{className:"helper-text",children:["Inline buttons and rich interactions. Create via ",r.jsx("a",{href:"https://t.me/BotFather",target:"_blank",rel:"noopener noreferrer",children:"@BotFather"}),"."]})]}),r.jsxs("div",{className:"module-item",children:[r.jsxs("div",{className:"form-row",style:{gap:"12px",alignItems:"center"},children:[r.jsxs("div",{style:{flex:1},children:[r.jsx("strong",{style:{fontSize:"var(--font-md)"},children:"TonAPI Key"}),r.jsx("span",{className:"module-desc",style:{marginLeft:"8px"},children:"(optional)"})]}),r.jsx("input",{type:"text",value:s.tonapiKey,onChange:g=>a({...s,tonapiKey:g.target.value}),placeholder:"Your TonAPI key",style:{flex:1}})]}),r.jsxs("div",{className:"helper-text",children:["Enhanced blockchain queries. Free key from ",r.jsx("a",{href:"https://t.me/tonapibot",target:"_blank",rel:"noopener noreferrer",children:"@tonapibot"}),"."]})]}),r.jsxs("div",{className:"module-item",children:[r.jsxs("div",{className:"form-row",style:{gap:"12px",alignItems:"center"},children:[r.jsxs("div",{style:{flex:1},children:[r.jsx("strong",{style:{fontSize:"var(--font-md)"},children:"Web Search"}),r.jsx("span",{className:"module-desc",style:{marginLeft:"8px"},children:"(optional)"})]}),r.jsx("input",{type:"text",value:s.tavilyKey,onChange:g=>a({...s,tavilyKey:g.target.value}),placeholder:"tvly-...",style:{flex:1}})]}),r.jsxs("div",{className:"helper-text",children:["Tavily web search. Free plan at ",r.jsx("a",{href:"https://tavily.com",target:"_blank",rel:"noopener noreferrer",children:"tavily.com"}),"."]})]})]})]})}function Bc({text:s}){const[a,u]=p.useState(!1),c=p.useCallback(()=>{navigator.clipboard.writeText(s).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)})},[s]);return r.jsx("button",{type:"button",className:"btn-ghost btn-sm",onClick:c,style:{marginLeft:"8px"},children:a?"Copied":"Copy"})}function mm({data:s,onChange:a}){const[u,c]=p.useState(null),[f,h]=p.useState(!0),[v,x]=p.useState(!1),[E,w]=p.useState(""),[j,C]=p.useState([]);p.useEffect(()=>{Ye.getWalletStatus().then(g=>{c(g),g.exists&&g.address&&a({...s,walletAddress:g.address,walletAction:"keep"})}).catch(g=>w(g instanceof Error?g.message:String(g))).finally(()=>h(!1))},[]);const _=async()=>{x(!0),w("");try{if(s.walletAction==="import"){const g=s.mnemonic.trim().split(/\s+/);if(g.length!==24){w("Mnemonic must be exactly 24 words."),x(!1);return}const k=await Ye.importWallet(s.mnemonic.trim());a({...s,walletAddress:k.address}),C(g)}else{const g=await Ye.generateWallet();a({...s,walletAddress:g.address}),C(g.mnemonic)}}catch(g){w(g instanceof Error?g.message:String(g))}finally{x(!1)}};if(f)return r.jsx("div",{className:"loading",children:"Checking wallet..."});const V=j.length>0,U=s.walletAction!=="keep"&&!V;return r.jsxs("div",{className:"step-content",children:[r.jsx("h2",{className:"step-title",children:"TON Wallet"}),r.jsx("p",{className:"step-description",children:"Your agent needs a TON wallet to send and receive crypto. You can create a new one or import an existing wallet."}),E&&r.jsx("div",{className:"alert error",children:E}),(u==null?void 0:u.exists)&&u.address&&!V&&r.jsxs("div",{className:"card",children:[r.jsx("div",{className:"helper-text",style:{marginTop:0,marginBottom:"4px"},children:"Current wallet"}),r.jsx("div",{className:"mono",style:{fontSize:"13px",wordBreak:"break-all"},children:u.address})]}),!V&&r.jsx("div",{className:"form-group",children:(u!=null&&u.exists?["keep","generate","import"]:["generate","import"]).map(g=>r.jsxs("label",{className:"label-inline",style:{marginBottom:"8px"},children:[r.jsx("input",{type:"radio",name:"walletAction",value:g,checked:s.walletAction===g,onChange:()=>{a({...s,walletAction:g,mnemonic:"",mnemonicSaved:!1})}}),r.jsxs("span",{children:[g==="keep"&&"Keep existing wallet",g==="generate"&&"Generate new wallet",g==="import"&&"Import from mnemonic"]})]},g))}),s.walletAction==="import"&&!V&&r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Recovery Phrase (24 words)"}),r.jsx("textarea",{value:s.mnemonic,onChange:g=>a({...s,mnemonic:g.target.value}),placeholder:"word1 word2 word3 ... word24",className:"w-full mono",style:{minHeight:"80px"}})]}),U&&s.walletAction!=="keep"&&r.jsx("button",{onClick:_,disabled:v||s.walletAction==="import"&&s.mnemonic.trim().split(/\s+/).length!==24,type:"button",children:v?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Working..."]}):s.walletAction==="generate"?"Generate Wallet":"Import Wallet"}),V&&r.jsxs(r.Fragment,{children:[s.walletAddress&&r.jsxs("div",{className:"card",style:{marginBottom:"16px"},children:[r.jsx("div",{style:{fontSize:"12px",color:"var(--text-secondary)",marginBottom:"4px"},children:"Wallet Address"}),r.jsxs("div",{className:"form-row",style:{alignItems:"center"},children:[r.jsx("span",{className:"mono",style:{fontWeight:600,fontSize:"14px",wordBreak:"break-all",color:"var(--text)"},children:s.walletAddress}),r.jsx(Bc,{text:s.walletAddress})]})]}),r.jsxs("div",{className:"warning-card",children:[r.jsx("strong",{children:"WRITE DOWN THESE 24 WORDS"}),r.jsx("br",{}),"This is your only way to recover your wallet. Store them securely offline. Never share them."]}),r.jsx("ol",{className:"mnemonic-grid",children:j.map((g,k)=>r.jsxs("li",{className:"mnemonic-word",children:[r.jsxs("span",{className:"num",children:[k+1,"."]}),g]},k))}),r.jsx("div",{className:"form-row",style:{justifyContent:"flex-end",marginBottom:"8px"},children:r.jsx(Bc,{text:j.join(" ")})}),r.jsx("div",{className:"form-group",style:{marginTop:"16px"},children:r.jsxs("label",{className:"label-inline",style:{color:"var(--text)"},children:[r.jsx("input",{type:"checkbox",checked:s.mnemonicSaved,onChange:g=>a({...s,mnemonicSaved:g.target.checked})}),r.jsx("span",{style:{fontWeight:500},children:"I have saved my recovery phrase"})]})})]})]})}const gm="modulepreload",ym=function(s){return"/"+s},Uc={},nl=function(a,u,c){let f=Promise.resolve();if(u&&u.length>0){let v=function(w){return Promise.all(w.map(j=>Promise.resolve(j).then(C=>({status:"fulfilled",value:C}),C=>({status:"rejected",reason:C}))))};document.getElementsByTagName("link");const x=document.querySelector("meta[property=csp-nonce]"),E=(x==null?void 0:x.nonce)||(x==null?void 0:x.getAttribute("nonce"));f=v(u.map(w=>{if(w=ym(w),w in Uc)return;Uc[w]=!0;const j=w.endsWith(".css"),C=j?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${w}"]${C}`))return;const _=document.createElement("link");if(_.rel=j?"stylesheet":gm,j||(_.as="script"),_.crossOrigin="",_.href=w,E&&_.setAttribute("nonce",E),document.head.appendChild(_),j)return new Promise((V,U)=>{_.addEventListener("load",V),_.addEventListener("error",()=>U(new Error(`Unable to preload CSS for ${w}`)))})}))}function h(v){const x=new Event("vite:preloadError",{cancelable:!0});if(x.payload=v,window.dispatchEvent(x),!x.defaultPrevented)throw v}return f.then(v=>{for(const x of v||[])x.status==="rejected"&&h(x.reason);return a().catch(h)})},xm=p.lazy(()=>nl(()=>import("./index.es-CqZHj0tz.js"),[])),vm=()=>nl(()=>import("./run-DOrDowjK.js"),[]).then(s=>s.default),Sm=()=>nl(()=>import("./login-telegram-BP7CJDmx.js"),[]).then(s=>s.default);function Wc({loader:s,size:a}){const[u,c]=p.useState(null);return p.useEffect(()=>{s().then(c)},[]),u?r.jsx(p.Suspense,{fallback:r.jsx("div",{style:{width:a,height:a,margin:"0 auto 16px"}}),children:r.jsx(xm,{animationData:u,loop:!0,style:{width:a,height:a,margin:"0 auto 16px"}})}):r.jsx("div",{style:{width:a,height:a,margin:"0 auto 16px"}})}function jm({data:s,onChange:a}){const[u,c]=p.useState("idle"),[f,h]=p.useState(!1),[v,x]=p.useState(""),[E,w]=p.useState(""),[j,C]=p.useState(""),[_,V]=p.useState(""),[U,g]=p.useState("sms"),[k,z]=p.useState(""),[B,W]=p.useState(!1),[G,Y]=p.useState(0),M=p.useRef(null);p.useEffect(()=>{if(!(G<=0))return M.current=setInterval(()=>{Y(b=>b<=1?(M.current&&clearInterval(M.current),0):b-1)},1e3),()=>{M.current&&clearInterval(M.current)}},[G>0]),p.useEffect(()=>{if(u!=="code_sent")return;const b=setTimeout(()=>W(!0),3e4);return()=>clearTimeout(b)},[u]),p.useEffect(()=>{s.telegramUser&&c("done")},[]);const ee=async()=>{var b;h(!0),x("");try{const se=await Ye.sendCode(s.apiId,s.apiHash,s.phone);a({...s,authSessionId:se.authSessionId}),g(se.codeDelivery),se.fragmentUrl&&z(se.fragmentUrl),c("code_sent"),W(!1)}catch(se){const R=se instanceof Error?se.message:String(se);if(R.includes("FLOOD")){const ae=parseInt(((b=R.match(/(\d+)/))==null?void 0:b[1])||"60");Y(ae)}x(R)}finally{h(!1)}},Q=async b=>{if(w(b),!(b.length<5)){h(!0),x("");try{const se=await Ye.verifyCode(s.authSessionId,b);se.status==="authenticated"&&se.user?(a({...s,telegramUser:se.user,skipConnect:!1}),c("done")):se.status==="2fa_required"&&(V(se.passwordHint||""),c("2fa"))}catch(se){const R=se instanceof Error?se.message:String(se);x(R)}finally{h(!1)}}},F=async()=>{h(!0),x("");try{const b=await Ye.verifyPassword(s.authSessionId,j);b.status==="authenticated"&&b.user&&(a({...s,telegramUser:b.user,skipConnect:!1}),c("done"))}catch(b){x(b instanceof Error?b.message:String(b))}finally{h(!1)}},A=async()=>{h(!0),x("");try{const b=await Ye.resendCode(s.authSessionId);g(b.codeDelivery),b.fragmentUrl&&z(b.fragmentUrl),w(""),W(!1)}catch(b){x(b instanceof Error?b.message:String(b))}finally{h(!1)}};return r.jsxs("div",{className:"step-content",children:[r.jsx("h2",{className:"step-title",children:"Connect to Telegram"}),r.jsx("p",{className:"step-description",children:"Authenticate with your Telegram account. This lets the agent send and receive messages as you."}),v&&r.jsx("div",{className:"alert error",children:v}),u==="idle"&&r.jsxs("div",{className:"text-center",style:{padding:"20px 0"},children:[r.jsx(Wc,{loader:vm,size:200}),r.jsx("button",{onClick:ee,disabled:f||G>0,type:"button",className:"btn-lg",children:f?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Connecting..."]}):G>0?`Wait ${G}s`:"Connect to Telegram"})]}),u==="code_sent"&&r.jsxs("div",{className:"text-center",style:{padding:"20px 0"},children:[r.jsx(Wc,{loader:Sm,size:180}),U==="fragment"?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"info-panel",style:{textAlign:"left",marginBottom:"16px"},children:[r.jsx("strong",{children:"Anonymous number detected (+888)"}),r.jsx("p",{className:"text-muted",style:{margin:"8px 0"},children:'Your number is an anonymous number purchased on Fragment. To receive the login code, open Fragment.com, connect your TON wallet, and navigate to "My Assets" to find the code.'}),k&&r.jsxs("a",{href:k,target:"_blank",rel:"noopener noreferrer",className:"btn-lg btn-ghost",style:{display:"inline-flex",alignItems:"center",gap:"6px",marginTop:"4px"},children:["Open Fragment.com",r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),r.jsx("polyline",{points:"15 3 21 3 21 9"}),r.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})]})]}),r.jsx("div",{className:"text-muted",style:{marginBottom:"16px"},children:"Enter the code shown on Fragment"})]}):r.jsxs("div",{className:"text-muted",style:{marginBottom:"16px"},children:["Code sent via ",U==="app"?"Telegram app":"SMS"]}),r.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"16px"},children:r.jsx("input",{className:"code-input",type:"text",inputMode:"numeric",value:E,onChange:b=>{const se=b.target.value.replace(/\D/g,"").slice(0,5);Q(se)},placeholder:"12345",maxLength:5,autoFocus:!0,disabled:f})}),f&&r.jsxs("div",{className:"text-muted",children:[r.jsx("span",{className:"spinner sm"})," Verifying..."]}),B&&!f&&r.jsx("button",{type:"button",className:"btn-ghost",onClick:A,children:"Resend code"})]}),u==="2fa"&&r.jsxs("div",{style:{padding:"20px 0"},children:[r.jsx("div",{className:"text-muted text-center",style:{marginBottom:"12px"},children:"Two-factor authentication required"}),_&&r.jsxs("div",{className:"info-panel text-center",children:["Hint: ",_]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Password"}),r.jsx("input",{type:"password",value:j,onChange:b=>C(b.target.value),onKeyDown:b=>b.key==="Enter"&&F(),placeholder:"Enter your 2FA password",className:"w-full",autoFocus:!0})]}),r.jsx("button",{onClick:F,disabled:f||!j,type:"button",children:f?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Verifying..."]}):"Submit"})]}),u==="done"&&s.telegramUser&&r.jsxs("div",{className:"alert success text-center",style:{padding:"20px"},children:["Connected as ",r.jsx("strong",{children:s.telegramUser.firstName}),s.telegramUser.username&&r.jsxs(r.Fragment,{children:[" (@",s.telegramUser.username,")"]})]})]})}const Ln=[{id:"welcome",label:"Welcome"},{id:"provider",label:"Provider"},{id:"config",label:"Config"},{id:"wallet",label:"Wallet"},{id:"telegram",label:"Telegram"},{id:"connect",label:"Connect"}],wm={riskAccepted:!1,agentName:"Nova",provider:"",apiKey:"",cocoonPort:11435,localUrl:"http://localhost:11434/v1",apiId:0,apiHash:"",phone:"",userId:0,mode:"quick",model:"",customModel:"",dmPolicy:"open",groupPolicy:"allowlist",requireMention:!0,maxIterations:5,botToken:"",botUsername:"",tonapiKey:"",tavilyKey:"",customizeThresholds:!1,buyMaxFloor:95,sellMinFloor:105,walletAction:"generate",mnemonic:"",walletAddress:"",mnemonicSaved:!1,authSessionId:"",telegramUser:null,skipConnect:!1,webuiEnabled:!1};function km(s,a){switch(s){case 0:return a.riskAccepted;case 1:if(!a.provider)return!1;if(a.provider==="cocoon")return a.cocoonPort>=1&&a.cocoonPort<=65535;if(a.provider==="local")try{return new URL(a.localUrl),!0}catch{return!1}return a.provider==="claude-code"?!0:a.apiKey.length>0;case 2:return a.provider!=="cocoon"&&a.provider!=="local"&&!(a.model==="__custom__"?a.customModel:a.model)?!1:a.userId>0&&a.maxIterations>=1&&a.maxIterations<=50;case 3:return a.walletAction==="keep"?!0:a.walletAddress?a.mnemonicSaved:!1;case 4:return a.apiId>0&&a.apiHash.length>=10&&a.phone.startsWith("+");case 5:return a.telegramUser!==null||a.skipConnect;default:return!1}}const cd=p.createContext(null);function Ti(){const s=p.useContext(cd);if(!s)throw new Error("useSetup must be used inside SetupProvider");return s}function Cm({children:s}){const[a,u]=p.useState(0),[c,f]=p.useState(wm),[h,v]=p.useState(!1),[x,E]=p.useState(""),[w,j]=p.useState(!1),[C,_]=p.useState(!1),[V,U]=p.useState(""),g=km(a,c),k=p.useCallback(()=>{g&&u(Y=>Math.min(Y+1,Ln.length-1))},[g]),z=p.useCallback(()=>{u(Y=>Math.max(Y-1,0))},[]),B=p.useCallback(async()=>{v(!0),E("");try{const Y=c.model==="__custom__"?c.customModel:c.model||void 0,M={agent:{provider:c.provider,...c.provider!=="cocoon"&&c.provider!=="local"&&c.apiKey?{api_key:c.apiKey}:{},...c.provider==="local"?{base_url:c.localUrl}:{},...Y?{model:Y}:{},max_agentic_iterations:c.maxIterations},telegram:{api_id:c.apiId,api_hash:c.apiHash,phone:c.phone,admin_ids:[c.userId],owner_id:c.userId,dm_policy:c.dmPolicy,group_policy:c.groupPolicy,require_mention:c.requireMention,...c.botToken?{bot_token:c.botToken}:{},...c.botUsername?{bot_username:c.botUsername}:{}},...c.provider==="cocoon"?{cocoon:{port:c.cocoonPort}}:{},deals:{enabled:!!c.botToken,...c.customizeThresholds?{buy_max_floor_percent:c.buyMaxFloor,sell_min_floor_percent:c.sellMinFloor}:{}},...c.tonapiKey?{tonapi_key:c.tonapiKey}:{},...c.tavilyKey?{tavily_api_key:c.tavilyKey}:{},webui:{enabled:!0}};await Ye.saveConfig(M),j(!0)}catch(Y){E(Y instanceof Error?Y.message:String(Y))}finally{v(!1)}},[c]),W=p.useCallback(async()=>{_(!0),U("");try{const{token:Y}=await Ye.launch();await Ye.pollHealth(3e4),window.location.href=`/auth/exchange?token=${encodeURIComponent(Y)}`}catch(Y){U(Y instanceof Error?Y.message:String(Y))}finally{_(!1)}},[]),G=p.useRef(B);return G.current=B,p.useEffect(()=>{a===Ln.length-1&&c.telegramUser&&!w&&!h&&G.current()},[a,c.telegramUser,w,h]),r.jsx(cd.Provider,{value:{step:a,data:c,loading:h,error:x,saved:w,launching:C,launchError:V,canAdvance:g,setData:f,next:k,prev:z,handleSave:B,handleLaunch:W},children:s})}const Nm=p.lazy(()=>nl(()=>import("./index.es-CqZHj0tz.js"),[])),Em=()=>nl(()=>import("./complete-fZLnb5Ot.js"),[]).then(s=>s.default);function Pm(){const[s,a]=p.useState(null);p.useEffect(()=>{Em().then(a)},[]);const u=200;return s?r.jsx(p.Suspense,{fallback:r.jsx("div",{style:{width:u,height:u,margin:"0 auto 24px"}}),children:r.jsx(Nm,{animationData:s,loop:!0,style:{width:u,height:u,margin:"0 auto 24px"}})}):r.jsx("div",{style:{width:u,height:u,margin:"0 auto 24px"}})}function _m(){const{launching:s,launchError:a,handleLaunch:u}=Ti();return r.jsxs("div",{className:"step-content text-center",style:{paddingTop:"40px"},children:[r.jsx(Pm,{}),r.jsx("h2",{style:{fontSize:"20px",fontWeight:600,letterSpacing:"-0.3px",marginBottom:"8px"},children:"Your Agent is ready"}),r.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"14px",marginBottom:"32px"},children:"Configuration saved. Start your agent to begin."}),r.jsx("button",{onClick:u,disabled:s,className:"btn-lg",style:{minWidth:"200px"},children:s?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Starting..."]}):"Start Agent"}),s&&r.jsx("p",{className:"helper-text",style:{marginTop:"16px"},children:"Booting your agent... this may take a few seconds."}),a&&r.jsxs("div",{style:{marginTop:"20px"},children:[r.jsx("div",{className:"alert error",children:a}),r.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"13px",marginTop:"8px"},children:"Start manually:"}),r.jsx("code",{className:"code-block",style:{marginTop:"8px"},children:"teleton start"})]})]})}const Tm=[dm,pm,hm,mm,fm,jm];function Rm(){const{step:s,data:a,loading:u,error:c,saved:f,canAdvance:h,setData:v,next:x,prev:E}=Ti();if(f)return r.jsx(_m,{});const w=Tm[s],j=s<Ln.length-1?Ln[s+1].label:"";return r.jsxs(r.Fragment,{children:[r.jsx(w,{data:a,onChange:v}),c&&r.jsx("div",{className:"alert error",children:c}),r.jsxs("div",{className:"setup-nav",children:[s>0&&r.jsx("button",{className:"btn-ghost",onClick:E,type:"button",children:"Back"}),r.jsx("div",{style:{flex:1}}),s<Ln.length-1&&r.jsx("button",{onClick:x,disabled:!h||u,type:"button",children:u?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Next"]}):`Next: ${j}`})]})]})}function Lm(){const{step:s}=Ti();return r.jsx("div",{className:"step-indicator",children:Ln.map((a,u)=>{const c=u<s,f=u===s;return r.jsxs("div",{className:"step-cell",children:[r.jsxs("div",{className:"step-cell-top",children:[r.jsx("div",{className:`step-dot${f?" active":""}${c?" completed":""}`,children:c?r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})}):r.jsx("span",{children:u+1})}),u<Ln.length-1&&r.jsx("div",{className:`step-line${c?" completed":""}`})]}),r.jsx("div",{className:`step-label${f?" active":""}${c?" completed":""}`,children:a.label})]},a.id)})})}const zm=[{label:"Dashboard",path:"/"},{label:"Tools",path:"/tools"},{label:"Plugins",path:"/plugins"},{label:"Soul",path:"/soul"},{label:"Memory",path:"/memory"},{label:"Logs",path:"/logs"},{label:"Workspace",path:"/workspace"},{label:"Tasks",path:"/tasks"},{label:"MCP",path:"/mcp"},{label:"Config",path:"/config"}];function Im(){return r.jsx("nav",{children:zm.map(s=>r.jsx("span",{className:"sidebar-link-disabled",children:s.label},s.path))})}function Am(){return r.jsxs(r.Fragment,{children:[r.jsx(Lm,{}),r.jsx(ed,{})]})}function Dm(){return r.jsx(Cm,{children:r.jsx(rd,{sidebar:r.jsx(Im,{}),children:r.jsx(Am,{})})})}function Om(){return window.location.pathname.startsWith("/setup")?r.jsx(nd,{children:r.jsx(ld,{children:r.jsx(td,{children:r.jsx(rt,{path:"/setup",element:r.jsx(Dm,{}),children:r.jsx(rt,{index:!0,element:r.jsx(Rm,{})})})})})}):r.jsx(bm,{})}function bm(){const[s,a]=p.useState(!1),[u,c]=p.useState(!0),[f,h]=p.useState(""),[v,x]=p.useState("");p.useEffect(()=>{const j=new URLSearchParams(window.location.search).get("token");if(window.location.pathname==="/auth/exchange"&&j){Ic(j).then(C=>{C?window.location.href="/":(c(!1),x("Token exchange failed"))});return}bh().then(C=>{a(C),c(!1)})},[]),p.useEffect(()=>{s&&Rn.connect()},[s]);const E=async()=>{const w=f.trim();if(!w)return;x(""),await Ic(w)?a(!0):x("Invalid token")};return u?r.jsx("div",{className:"login-container",children:r.jsx("div",{className:"login-card",children:r.jsx("p",{children:"Loading..."})})}):s?r.jsx(nd,{children:r.jsx(ld,{children:r.jsx(td,{children:r.jsxs(rt,{path:"/",element:r.jsx(Bh,{}),children:[r.jsx(rt,{index:!0,element:r.jsx(Uh,{})}),r.jsx(rt,{path:"tools",element:r.jsx(Wh,{})}),r.jsx(rt,{path:"plugins",element:r.jsx($h,{})}),r.jsx(rt,{path:"soul",element:r.jsx(Vh,{})}),r.jsx(rt,{path:"memory",element:r.jsx(Hh,{})}),r.jsx(rt,{path:"logs",element:r.jsx(Jh,{})}),r.jsx(rt,{path:"workspace",element:r.jsx(tm,{})}),r.jsx(rt,{path:"tasks",element:r.jsx(rm,{})}),r.jsx(rt,{path:"mcp",element:r.jsx(lm,{})}),r.jsx(rt,{path:"config",element:r.jsx(cm,{})}),r.jsx(rt,{path:"*",element:r.jsx(ph,{to:"/",replace:!0})})]})})})}):r.jsx("div",{className:"login-container",children:r.jsxs("div",{className:"login-card",children:[r.jsx("h1",{children:"Teleton"}),r.jsx("p",{children:"Enter your authentication token to access the dashboard."}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Token"}),r.jsx("input",{type:"password",value:f,onChange:w=>h(w.target.value),onKeyDown:w=>w.key==="Enter"&&E(),placeholder:"Paste token from config...",style:{width:"100%"}})]}),v&&r.jsx("div",{className:"alert error",style:{marginBottom:"1rem"},children:v}),r.jsx("button",{onClick:E,style:{width:"100%"},children:"Sign In"})]})})}vf.createRoot(document.getElementById("root")).render(r.jsx(p.StrictMode,{children:r.jsx(Om,{})}));export{xs as R,cf as g,p as r};