nestor-sh 3.0.0 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,597 @@
1
+ var cb=Object.defineProperty;var ob=(n,i,d)=>i in n?cb(n,i,{enumerable:!0,configurable:!0,writable:!0,value:d}):n[i]=d;var hd=(n,i,d)=>ob(n,typeof i!="symbol"?i+"":i,d);(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const m of document.querySelectorAll('link[rel="modulepreload"]'))c(m);new MutationObserver(m=>{for(const f of m)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function d(m){const f={};return m.integrity&&(f.integrity=m.integrity),m.referrerPolicy&&(f.referrerPolicy=m.referrerPolicy),m.crossOrigin==="use-credentials"?f.credentials="include":m.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function c(m){if(m.ep)return;m.ep=!0;const f=d(m);fetch(m.href,f)}})();var pd={exports:{}},Yl={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var mh;function db(){if(mh)return Yl;mh=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function d(c,m,f){var h=null;if(f!==void 0&&(h=""+f),m.key!==void 0&&(h=""+m.key),"key"in m){f={};for(var b in m)b!=="key"&&(f[b]=m[b])}else f=m;return m=f.ref,{$$typeof:n,type:c,key:h,ref:m!==void 0?m:null,props:f}}return Yl.Fragment=i,Yl.jsx=d,Yl.jsxs=d,Yl}var xh;function ub(){return xh||(xh=1,pd.exports=db()),pd.exports}var t=ub(),gd={exports:{}},Ne={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var fh;function mb(){if(fh)return Ne;fh=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),h=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),y=Symbol.iterator;function k(T){return T===null||typeof T!="object"?null:(T=y&&T[y]||T["@@iterator"],typeof T=="function"?T:null)}var z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,S={};function C(T,Y,ie){this.props=T,this.context=Y,this.refs=S,this.updater=ie||z}C.prototype.isReactComponent={},C.prototype.setState=function(T,Y){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,Y,"setState")},C.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function O(){}O.prototype=C.prototype;function M(T,Y,ie){this.props=T,this.context=Y,this.refs=S,this.updater=ie||z}var E=M.prototype=new O;E.constructor=M,N(E,C.prototype),E.isPureReactComponent=!0;var ae=Array.isArray;function ce(){}var B={H:null,A:null,T:null,S:null},q=Object.prototype.hasOwnProperty;function I(T,Y,ie){var $=ie.ref;return{$$typeof:n,type:T,key:Y,ref:$!==void 0?$:null,props:ie}}function W(T,Y){return I(T.type,Y,T.props)}function X(T){return typeof T=="object"&&T!==null&&T.$$typeof===n}function le(T){var Y={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(ie){return Y[ie]})}var J=/\/+/g;function re(T,Y){return typeof T=="object"&&T!==null&&T.key!=null?le(""+T.key):Y.toString(36)}function ge(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(ce,ce):(T.status="pending",T.then(function(Y){T.status==="pending"&&(T.status="fulfilled",T.value=Y)},function(Y){T.status==="pending"&&(T.status="rejected",T.reason=Y)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function G(T,Y,ie,$,de){var me=typeof T;(me==="undefined"||me==="boolean")&&(T=null);var be=!1;if(T===null)be=!0;else switch(me){case"bigint":case"string":case"number":be=!0;break;case"object":switch(T.$$typeof){case n:case i:be=!0;break;case w:return be=T._init,G(be(T._payload),Y,ie,$,de)}}if(be)return de=de(T),be=$===""?"."+re(T,0):$,ae(de)?(ie="",be!=null&&(ie=be.replace(J,"$&/")+"/"),G(de,Y,ie,"",function(Ze){return Ze})):de!=null&&(X(de)&&(de=W(de,ie+(de.key==null||T&&T.key===de.key?"":(""+de.key).replace(J,"$&/")+"/")+be)),Y.push(de)),1;be=0;var Ce=$===""?".":$+":";if(ae(T))for(var je=0;je<T.length;je++)$=T[je],me=Ce+re($,je),be+=G($,Y,ie,me,de);else if(je=k(T),typeof je=="function")for(T=je.call(T),je=0;!($=T.next()).done;)$=$.value,me=Ce+re($,je++),be+=G($,Y,ie,me,de);else if(me==="object"){if(typeof T.then=="function")return G(ge(T),Y,ie,$,de);throw Y=String(T),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return be}function ee(T,Y,ie){if(T==null)return T;var $=[],de=0;return G(T,$,"","",function(me){return Y.call(ie,me,de++)}),$}function xe(T){if(T._status===-1){var Y=T._result;Y=Y(),Y.then(function(ie){(T._status===0||T._status===-1)&&(T._status=1,T._result=ie)},function(ie){(T._status===0||T._status===-1)&&(T._status=2,T._result=ie)}),T._status===-1&&(T._status=0,T._result=Y)}if(T._status===1)return T._result.default;throw T._result}var oe=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},we={map:ee,forEach:function(T,Y,ie){ee(T,function(){Y.apply(this,arguments)},ie)},count:function(T){var Y=0;return ee(T,function(){Y++}),Y},toArray:function(T){return ee(T,function(Y){return Y})||[]},only:function(T){if(!X(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return Ne.Activity=v,Ne.Children=we,Ne.Component=C,Ne.Fragment=d,Ne.Profiler=m,Ne.PureComponent=M,Ne.StrictMode=c,Ne.Suspense=g,Ne.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=B,Ne.__COMPILER_RUNTIME={__proto__:null,c:function(T){return B.H.useMemoCache(T)}},Ne.cache=function(T){return function(){return T.apply(null,arguments)}},Ne.cacheSignal=function(){return null},Ne.cloneElement=function(T,Y,ie){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var $=N({},T.props),de=T.key;if(Y!=null)for(me in Y.key!==void 0&&(de=""+Y.key),Y)!q.call(Y,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&Y.ref===void 0||($[me]=Y[me]);var me=arguments.length-2;if(me===1)$.children=ie;else if(1<me){for(var be=Array(me),Ce=0;Ce<me;Ce++)be[Ce]=arguments[Ce+2];$.children=be}return I(T.type,de,$)},Ne.createContext=function(T){return T={$$typeof:h,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:f,_context:T},T},Ne.createElement=function(T,Y,ie){var $,de={},me=null;if(Y!=null)for($ in Y.key!==void 0&&(me=""+Y.key),Y)q.call(Y,$)&&$!=="key"&&$!=="__self"&&$!=="__source"&&(de[$]=Y[$]);var be=arguments.length-2;if(be===1)de.children=ie;else if(1<be){for(var Ce=Array(be),je=0;je<be;je++)Ce[je]=arguments[je+2];de.children=Ce}if(T&&T.defaultProps)for($ in be=T.defaultProps,be)de[$]===void 0&&(de[$]=be[$]);return I(T,me,de)},Ne.createRef=function(){return{current:null}},Ne.forwardRef=function(T){return{$$typeof:b,render:T}},Ne.isValidElement=X,Ne.lazy=function(T){return{$$typeof:w,_payload:{_status:-1,_result:T},_init:xe}},Ne.memo=function(T,Y){return{$$typeof:p,type:T,compare:Y===void 0?null:Y}},Ne.startTransition=function(T){var Y=B.T,ie={};B.T=ie;try{var $=T(),de=B.S;de!==null&&de(ie,$),typeof $=="object"&&$!==null&&typeof $.then=="function"&&$.then(ce,oe)}catch(me){oe(me)}finally{Y!==null&&ie.types!==null&&(Y.types=ie.types),B.T=Y}},Ne.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},Ne.use=function(T){return B.H.use(T)},Ne.useActionState=function(T,Y,ie){return B.H.useActionState(T,Y,ie)},Ne.useCallback=function(T,Y){return B.H.useCallback(T,Y)},Ne.useContext=function(T){return B.H.useContext(T)},Ne.useDebugValue=function(){},Ne.useDeferredValue=function(T,Y){return B.H.useDeferredValue(T,Y)},Ne.useEffect=function(T,Y){return B.H.useEffect(T,Y)},Ne.useEffectEvent=function(T){return B.H.useEffectEvent(T)},Ne.useId=function(){return B.H.useId()},Ne.useImperativeHandle=function(T,Y,ie){return B.H.useImperativeHandle(T,Y,ie)},Ne.useInsertionEffect=function(T,Y){return B.H.useInsertionEffect(T,Y)},Ne.useLayoutEffect=function(T,Y){return B.H.useLayoutEffect(T,Y)},Ne.useMemo=function(T,Y){return B.H.useMemo(T,Y)},Ne.useOptimistic=function(T,Y){return B.H.useOptimistic(T,Y)},Ne.useReducer=function(T,Y,ie){return B.H.useReducer(T,Y,ie)},Ne.useRef=function(T){return B.H.useRef(T)},Ne.useState=function(T){return B.H.useState(T)},Ne.useSyncExternalStore=function(T,Y,ie){return B.H.useSyncExternalStore(T,Y,ie)},Ne.useTransition=function(){return B.H.useTransition()},Ne.version="19.2.4",Ne}var hh;function Kd(){return hh||(hh=1,gd.exports=mb()),gd.exports}var u=Kd(),bd={exports:{}},Xl={},yd={exports:{}},vd={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var ph;function xb(){return ph||(ph=1,(function(n){function i(G,ee){var xe=G.length;G.push(ee);e:for(;0<xe;){var oe=xe-1>>>1,we=G[oe];if(0<m(we,ee))G[oe]=ee,G[xe]=we,xe=oe;else break e}}function d(G){return G.length===0?null:G[0]}function c(G){if(G.length===0)return null;var ee=G[0],xe=G.pop();if(xe!==ee){G[0]=xe;e:for(var oe=0,we=G.length,T=we>>>1;oe<T;){var Y=2*(oe+1)-1,ie=G[Y],$=Y+1,de=G[$];if(0>m(ie,xe))$<we&&0>m(de,ie)?(G[oe]=de,G[$]=xe,oe=$):(G[oe]=ie,G[Y]=xe,oe=Y);else if($<we&&0>m(de,xe))G[oe]=de,G[$]=xe,oe=$;else break e}}return ee}function m(G,ee){var xe=G.sortIndex-ee.sortIndex;return xe!==0?xe:G.id-ee.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var h=Date,b=h.now();n.unstable_now=function(){return h.now()-b}}var g=[],p=[],w=1,v=null,y=3,k=!1,z=!1,N=!1,S=!1,C=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function E(G){for(var ee=d(p);ee!==null;){if(ee.callback===null)c(p);else if(ee.startTime<=G)c(p),ee.sortIndex=ee.expirationTime,i(g,ee);else break;ee=d(p)}}function ae(G){if(N=!1,E(G),!z)if(d(g)!==null)z=!0,ce||(ce=!0,le());else{var ee=d(p);ee!==null&&ge(ae,ee.startTime-G)}}var ce=!1,B=-1,q=5,I=-1;function W(){return S?!0:!(n.unstable_now()-I<q)}function X(){if(S=!1,ce){var G=n.unstable_now();I=G;var ee=!0;try{e:{z=!1,N&&(N=!1,O(B),B=-1),k=!0;var xe=y;try{t:{for(E(G),v=d(g);v!==null&&!(v.expirationTime>G&&W());){var oe=v.callback;if(typeof oe=="function"){v.callback=null,y=v.priorityLevel;var we=oe(v.expirationTime<=G);if(G=n.unstable_now(),typeof we=="function"){v.callback=we,E(G),ee=!0;break t}v===d(g)&&c(g),E(G)}else c(g);v=d(g)}if(v!==null)ee=!0;else{var T=d(p);T!==null&&ge(ae,T.startTime-G),ee=!1}}break e}finally{v=null,y=xe,k=!1}ee=void 0}}finally{ee?le():ce=!1}}}var le;if(typeof M=="function")le=function(){M(X)};else if(typeof MessageChannel<"u"){var J=new MessageChannel,re=J.port2;J.port1.onmessage=X,le=function(){re.postMessage(null)}}else le=function(){C(X,0)};function ge(G,ee){B=C(function(){G(n.unstable_now())},ee)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(G){G.callback=null},n.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):q=0<G?Math.floor(1e3/G):5},n.unstable_getCurrentPriorityLevel=function(){return y},n.unstable_next=function(G){switch(y){case 1:case 2:case 3:var ee=3;break;default:ee=y}var xe=y;y=ee;try{return G()}finally{y=xe}},n.unstable_requestPaint=function(){S=!0},n.unstable_runWithPriority=function(G,ee){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var xe=y;y=G;try{return ee()}finally{y=xe}},n.unstable_scheduleCallback=function(G,ee,xe){var oe=n.unstable_now();switch(typeof xe=="object"&&xe!==null?(xe=xe.delay,xe=typeof xe=="number"&&0<xe?oe+xe:oe):xe=oe,G){case 1:var we=-1;break;case 2:we=250;break;case 5:we=1073741823;break;case 4:we=1e4;break;default:we=5e3}return we=xe+we,G={id:w++,callback:ee,priorityLevel:G,startTime:xe,expirationTime:we,sortIndex:-1},xe>oe?(G.sortIndex=xe,i(p,G),d(g)===null&&G===d(p)&&(N?(O(B),B=-1):N=!0,ge(ae,xe-oe))):(G.sortIndex=we,i(g,G),z||k||(z=!0,ce||(ce=!0,le()))),G},n.unstable_shouldYield=W,n.unstable_wrapCallback=function(G){var ee=y;return function(){var xe=y;y=ee;try{return G.apply(this,arguments)}finally{y=xe}}}})(vd)),vd}var gh;function fb(){return gh||(gh=1,yd.exports=xb()),yd.exports}var jd={exports:{}},kt={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var bh;function hb(){if(bh)return kt;bh=1;var n=Kd();function i(g){var p="https://react.dev/errors/"+g;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var w=2;w<arguments.length;w++)p+="&args[]="+encodeURIComponent(arguments[w])}return"Minified React error #"+g+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function d(){}var c={d:{f:d,r:function(){throw Error(i(522))},D:d,C:d,L:d,m:d,X:d,S:d,M:d},p:0,findDOMNode:null},m=Symbol.for("react.portal");function f(g,p,w){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:m,key:v==null?null:""+v,children:g,containerInfo:p,implementation:w}}var h=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function b(g,p){if(g==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return kt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c,kt.createPortal=function(g,p){var w=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(i(299));return f(g,p,null,w)},kt.flushSync=function(g){var p=h.T,w=c.p;try{if(h.T=null,c.p=2,g)return g()}finally{h.T=p,c.p=w,c.d.f()}},kt.preconnect=function(g,p){typeof g=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,c.d.C(g,p))},kt.prefetchDNS=function(g){typeof g=="string"&&c.d.D(g)},kt.preinit=function(g,p){if(typeof g=="string"&&p&&typeof p.as=="string"){var w=p.as,v=b(w,p.crossOrigin),y=typeof p.integrity=="string"?p.integrity:void 0,k=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;w==="style"?c.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:y,fetchPriority:k}):w==="script"&&c.d.X(g,{crossOrigin:v,integrity:y,fetchPriority:k,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},kt.preinitModule=function(g,p){if(typeof g=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var w=b(p.as,p.crossOrigin);c.d.M(g,{crossOrigin:w,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&c.d.M(g)},kt.preload=function(g,p){if(typeof g=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var w=p.as,v=b(w,p.crossOrigin);c.d.L(g,w,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},kt.preloadModule=function(g,p){if(typeof g=="string")if(p){var w=b(p.as,p.crossOrigin);c.d.m(g,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:w,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else c.d.m(g)},kt.requestFormReset=function(g){c.d.r(g)},kt.unstable_batchedUpdates=function(g,p){return g(p)},kt.useFormState=function(g,p,w){return h.H.useFormState(g,p,w)},kt.useFormStatus=function(){return h.H.useHostTransitionStatus()},kt.version="19.2.4",kt}var yh;function pb(){if(yh)return jd.exports;yh=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),jd.exports=hb(),jd.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var vh;function gb(){if(vh)return Xl;vh=1;var n=fb(),i=Kd(),d=pb();function c(e){var a="https://react.dev/errors/"+e;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)a+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+e+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function m(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var a=e,s=e;if(e.alternate)for(;a.return;)a=a.return;else{e=a;do a=e,(a.flags&4098)!==0&&(s=a.return),e=a.return;while(e)}return a.tag===3?s:null}function h(e){if(e.tag===13){var a=e.memoizedState;if(a===null&&(e=e.alternate,e!==null&&(a=e.memoizedState)),a!==null)return a.dehydrated}return null}function b(e){if(e.tag===31){var a=e.memoizedState;if(a===null&&(e=e.alternate,e!==null&&(a=e.memoizedState)),a!==null)return a.dehydrated}return null}function g(e){if(f(e)!==e)throw Error(c(188))}function p(e){var a=e.alternate;if(!a){if(a=f(e),a===null)throw Error(c(188));return a!==e?null:e}for(var s=e,l=a;;){var r=s.return;if(r===null)break;var o=r.alternate;if(o===null){if(l=r.return,l!==null){s=l;continue}break}if(r.child===o.child){for(o=r.child;o;){if(o===s)return g(r),e;if(o===l)return g(r),a;o=o.sibling}throw Error(c(188))}if(s.return!==l.return)s=r,l=o;else{for(var x=!1,j=r.child;j;){if(j===s){x=!0,s=r,l=o;break}if(j===l){x=!0,l=r,s=o;break}j=j.sibling}if(!x){for(j=o.child;j;){if(j===s){x=!0,s=o,l=r;break}if(j===l){x=!0,l=o,s=r;break}j=j.sibling}if(!x)throw Error(c(189))}}if(s.alternate!==l)throw Error(c(190))}if(s.tag!==3)throw Error(c(188));return s.stateNode.current===s?e:a}function w(e){var a=e.tag;if(a===5||a===26||a===27||a===6)return e;for(e=e.child;e!==null;){if(a=w(e),a!==null)return a;e=e.sibling}return null}var v=Object.assign,y=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),z=Symbol.for("react.portal"),N=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),M=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),ae=Symbol.for("react.suspense"),ce=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),W=Symbol.for("react.memo_cache_sentinel"),X=Symbol.iterator;function le(e){return e===null||typeof e!="object"?null:(e=X&&e[X]||e["@@iterator"],typeof e=="function"?e:null)}var J=Symbol.for("react.client.reference");function re(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===J?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case N:return"Fragment";case C:return"Profiler";case S:return"StrictMode";case ae:return"Suspense";case ce:return"SuspenseList";case I:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case z:return"Portal";case M:return e.displayName||"Context";case O:return(e._context.displayName||"Context")+".Consumer";case E:var a=e.render;return e=e.displayName,e||(e=a.displayName||a.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case B:return a=e.displayName||null,a!==null?a:re(e.type)||"Memo";case q:a=e._payload,e=e._init;try{return re(e(a))}catch{}}return null}var ge=Array.isArray,G=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee=d.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,xe={pending:!1,data:null,method:null,action:null},oe=[],we=-1;function T(e){return{current:e}}function Y(e){0>we||(e.current=oe[we],oe[we]=null,we--)}function ie(e,a){we++,oe[we]=e.current,e.current=a}var $=T(null),de=T(null),me=T(null),be=T(null);function Ce(e,a){switch(ie(me,a),ie(de,e),ie($,null),a.nodeType){case 9:case 11:e=(e=a.documentElement)&&(e=e.namespaceURI)?Lf(e):0;break;default:if(e=a.tagName,a=a.namespaceURI)a=Lf(a),e=_f(a,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Y($),ie($,e)}function je(){Y($),Y(de),Y(me)}function Ze(e){e.memoizedState!==null&&ie(be,e);var a=$.current,s=_f(a,e.type);a!==s&&(ie(de,e),ie($,s))}function Pe(e){de.current===e&&(Y($),Y(de)),be.current===e&&(Y(be),ql._currentValue=xe)}var Gt,Pa;function Et(e){if(Gt===void 0)try{throw Error()}catch(s){var a=s.stack.trim().match(/\n( *(at )?)/);Gt=a&&a[1]||"",Pa=-1<s.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+Gt+e+Pa}var ga=!1;function Ge(e,a){if(!e||ga)return"";ga=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(a){var F=function(){throw Error()};if(Object.defineProperty(F.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(F,[])}catch(K){var H=K}Reflect.construct(e,[],F)}else{try{F.call()}catch(K){H=K}e.call(F.prototype)}}else{try{throw Error()}catch(K){H=K}(F=e())&&typeof F.catch=="function"&&F.catch(function(){})}}catch(K){if(K&&H&&typeof K.stack=="string")return[K.stack,H.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=l.DetermineComponentFrameRoot(),x=o[0],j=o[1];if(x&&j){var A=x.split(`
44
+ `),U=j.split(`
45
+ `);for(r=l=0;l<A.length&&!A[l].includes("DetermineComponentFrameRoot");)l++;for(;r<U.length&&!U[r].includes("DetermineComponentFrameRoot");)r++;if(l===A.length||r===U.length)for(l=A.length-1,r=U.length-1;1<=l&&0<=r&&A[l]!==U[r];)r--;for(;1<=l&&0<=r;l--,r--)if(A[l]!==U[r]){if(l!==1||r!==1)do if(l--,r--,0>r||A[l]!==U[r]){var V=`
46
+ `+A[l].replace(" at new "," at ");return e.displayName&&V.includes("<anonymous>")&&(V=V.replace("<anonymous>",e.displayName)),V}while(1<=l&&0<=r);break}}}finally{ga=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?Et(s):""}function xt(e,a){switch(e.tag){case 26:case 27:case 5:return Et(e.type);case 16:return Et("Lazy");case 13:return e.child!==a&&a!==null?Et("Suspense Fallback"):Et("Suspense");case 19:return Et("SuspenseList");case 0:case 15:return Ge(e.type,!1);case 11:return Ge(e.type.render,!1);case 1:return Ge(e.type,!0);case 31:return Et("Activity");default:return""}}function D(e){try{var a="",s=null;do a+=xt(e,s),s=e,e=e.return;while(e);return a}catch(l){return`
47
+ Error generating stack: `+l.message+`
48
+ `+l.stack}}var P=Object.prototype.hasOwnProperty,ve=n.unstable_scheduleCallback,Je=n.unstable_cancelCallback,Q=n.unstable_shouldYield,se=n.unstable_requestPaint,pe=n.unstable_now,ze=n.unstable_getCurrentPriorityLevel,Ve=n.unstable_ImmediatePriority,St=n.unstable_UserBlockingPriority,Wa=n.unstable_NormalPriority,tc=n.unstable_LowPriority,es=n.unstable_IdlePriority,di=n.log,fu=n.unstable_setDisableYieldValue,ba=null,bt=null;function ua(e){if(typeof di=="function"&&fu(e),bt&&typeof bt.setStrictMode=="function")try{bt.setStrictMode(ba,e)}catch{}}var Tt=Math.clz32?Math.clz32:Z0,X0=Math.log,Q0=Math.LN2;function Z0(e){return e>>>=0,e===0?32:31-(X0(e)/Q0|0)|0}var ui=256,mi=262144,xi=4194304;function Os(e){var a=e&42;if(a!==0)return a;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function fi(e,a,s){var l=e.pendingLanes;if(l===0)return 0;var r=0,o=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var j=l&134217727;return j!==0?(l=j&~o,l!==0?r=Os(l):(x&=j,x!==0?r=Os(x):s||(s=j&~e,s!==0&&(r=Os(s))))):(j=l&~o,j!==0?r=Os(j):x!==0?r=Os(x):s||(s=l&~e,s!==0&&(r=Os(s)))),r===0?0:a!==0&&a!==r&&(a&o)===0&&(o=r&-r,s=a&-a,o>=s||o===32&&(s&4194048)!==0)?a:r}function el(e,a){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&a)===0}function J0(e,a){switch(e){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function hu(){var e=xi;return xi<<=1,(xi&62914560)===0&&(xi=4194304),e}function ac(e){for(var a=[],s=0;31>s;s++)a.push(e);return a}function tl(e,a){e.pendingLanes|=a,a!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function F0(e,a,s,l,r,o){var x=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var j=e.entanglements,A=e.expirationTimes,U=e.hiddenUpdates;for(s=x&~s;0<s;){var V=31-Tt(s),F=1<<V;j[V]=0,A[V]=-1;var H=U[V];if(H!==null)for(U[V]=null,V=0;V<H.length;V++){var K=H[V];K!==null&&(K.lane&=-536870913)}s&=~F}l!==0&&pu(e,l,0),o!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=o&~(x&~a))}function pu(e,a,s){e.pendingLanes|=a,e.suspendedLanes&=~a;var l=31-Tt(a);e.entangledLanes|=a,e.entanglements[l]=e.entanglements[l]|1073741824|s&261930}function gu(e,a){var s=e.entangledLanes|=a;for(e=e.entanglements;s;){var l=31-Tt(s),r=1<<l;r&a|e[l]&a&&(e[l]|=a),s&=~r}}function bu(e,a){var s=a&-a;return s=(s&42)!==0?1:sc(s),(s&(e.suspendedLanes|a))!==0?0:s}function sc(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function nc(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function yu(){var e=ee.p;return e!==0?e:(e=window.event,e===void 0?32:lh(e.type))}function vu(e,a){var s=ee.p;try{return ee.p=e,a()}finally{ee.p=s}}var ts=Math.random().toString(36).slice(2),yt="__reactFiber$"+ts,Ot="__reactProps$"+ts,nn="__reactContainer$"+ts,lc="__reactEvents$"+ts,I0="__reactListeners$"+ts,P0="__reactHandles$"+ts,ju="__reactResources$"+ts,al="__reactMarker$"+ts;function ic(e){delete e[yt],delete e[Ot],delete e[lc],delete e[I0],delete e[P0]}function ln(e){var a=e[yt];if(a)return a;for(var s=e.parentNode;s;){if(a=s[nn]||s[yt]){if(s=a.alternate,a.child!==null||s!==null&&s.child!==null)for(e=Kf(e);e!==null;){if(s=e[yt])return s;e=Kf(e)}return a}e=s,s=e.parentNode}return null}function rn(e){if(e=e[yt]||e[nn]){var a=e.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return e}return null}function sl(e){var a=e.tag;if(a===5||a===26||a===27||a===6)return e.stateNode;throw Error(c(33))}function cn(e){var a=e[ju];return a||(a=e[ju]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function ft(e){e[al]=!0}var Nu=new Set,wu={};function Ls(e,a){on(e,a),on(e+"Capture",a)}function on(e,a){for(wu[e]=a,e=0;e<a.length;e++)Nu.add(a[e])}var W0=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Su={},ku={};function ep(e){return P.call(ku,e)?!0:P.call(Su,e)?!1:W0.test(e)?ku[e]=!0:(Su[e]=!0,!1)}function hi(e,a,s){if(ep(a))if(s===null)e.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":e.removeAttribute(a);return;case"boolean":var l=a.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(a);return}}e.setAttribute(a,""+s)}}function pi(e,a,s){if(s===null)e.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttribute(a,""+s)}}function Aa(e,a,s,l){if(l===null)e.removeAttribute(s);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttributeNS(a,s,""+l)}}function Pt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function zu(e){var a=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function tp(e,a,s){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,a);if(!e.hasOwnProperty(a)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var r=l.get,o=l.set;return Object.defineProperty(e,a,{configurable:!0,get:function(){return r.call(this)},set:function(x){s=""+x,o.call(this,x)}}),Object.defineProperty(e,a,{enumerable:l.enumerable}),{getValue:function(){return s},setValue:function(x){s=""+x},stopTracking:function(){e._valueTracker=null,delete e[a]}}}}function rc(e){if(!e._valueTracker){var a=zu(e)?"checked":"value";e._valueTracker=tp(e,a,""+e[a])}}function Cu(e){if(!e)return!1;var a=e._valueTracker;if(!a)return!0;var s=a.getValue(),l="";return e&&(l=zu(e)?e.checked?"true":"false":e.value),e=l,e!==s?(a.setValue(e),!0):!1}function gi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var ap=/[\n"\\]/g;function Wt(e){return e.replace(ap,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function cc(e,a,s,l,r,o,x,j){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),a!=null?x==="number"?(a===0&&e.value===""||e.value!=a)&&(e.value=""+Pt(a)):e.value!==""+Pt(a)&&(e.value=""+Pt(a)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),a!=null?oc(e,x,Pt(a)):s!=null?oc(e,x,Pt(s)):l!=null&&e.removeAttribute("value"),r==null&&o!=null&&(e.defaultChecked=!!o),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?e.name=""+Pt(j):e.removeAttribute("name")}function Au(e,a,s,l,r,o,x,j){if(o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.type=o),a!=null||s!=null){if(!(o!=="submit"&&o!=="reset"||a!=null)){rc(e);return}s=s!=null?""+Pt(s):"",a=a!=null?""+Pt(a):s,j||a===e.value||(e.value=a),e.defaultValue=a}l=l??r,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=j?e.checked:!!l,e.defaultChecked=!!l,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),rc(e)}function oc(e,a,s){a==="number"&&gi(e.ownerDocument)===e||e.defaultValue===""+s||(e.defaultValue=""+s)}function dn(e,a,s,l){if(e=e.options,a){a={};for(var r=0;r<s.length;r++)a["$"+s[r]]=!0;for(s=0;s<e.length;s++)r=a.hasOwnProperty("$"+e[s].value),e[s].selected!==r&&(e[s].selected=r),r&&l&&(e[s].defaultSelected=!0)}else{for(s=""+Pt(s),a=null,r=0;r<e.length;r++){if(e[r].value===s){e[r].selected=!0,l&&(e[r].defaultSelected=!0);return}a!==null||e[r].disabled||(a=e[r])}a!==null&&(a.selected=!0)}}function Eu(e,a,s){if(a!=null&&(a=""+Pt(a),a!==e.value&&(e.value=a),s==null)){e.defaultValue!==a&&(e.defaultValue=a);return}e.defaultValue=s!=null?""+Pt(s):""}function Tu(e,a,s,l){if(a==null){if(l!=null){if(s!=null)throw Error(c(92));if(ge(l)){if(1<l.length)throw Error(c(93));l=l[0]}s=l}s==null&&(s=""),a=s}s=Pt(a),e.defaultValue=s,l=e.textContent,l===s&&l!==""&&l!==null&&(e.value=l),rc(e)}function un(e,a){if(a){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=a;return}}e.textContent=a}var sp=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Ru(e,a,s){var l=a.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?l?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="":l?e.setProperty(a,s):typeof s!="number"||s===0||sp.has(a)?a==="float"?e.cssFloat=s:e[a]=(""+s).trim():e[a]=s+"px"}function Mu(e,a,s){if(a!=null&&typeof a!="object")throw Error(c(62));if(e=e.style,s!=null){for(var l in s)!s.hasOwnProperty(l)||a!=null&&a.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var r in a)l=a[r],a.hasOwnProperty(r)&&s[r]!==l&&Ru(e,r,l)}else for(var o in a)a.hasOwnProperty(o)&&Ru(e,o,a[o])}function dc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var np=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),lp=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function bi(e){return lp.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ea(){}var uc=null;function mc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var mn=null,xn=null;function Du(e){var a=rn(e);if(a&&(e=a.stateNode)){var s=e[Ot]||null;e:switch(e=a.stateNode,a.type){case"input":if(cc(e,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),a=s.name,s.type==="radio"&&a!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+Wt(""+a)+'"][type="radio"]'),a=0;a<s.length;a++){var l=s[a];if(l!==e&&l.form===e.form){var r=l[Ot]||null;if(!r)throw Error(c(90));cc(l,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(a=0;a<s.length;a++)l=s[a],l.form===e.form&&Cu(l)}break e;case"textarea":Eu(e,s.value,s.defaultValue);break e;case"select":a=s.value,a!=null&&dn(e,!!s.multiple,a,!1)}}}var xc=!1;function Ou(e,a,s){if(xc)return e(a,s);xc=!0;try{var l=e(a);return l}finally{if(xc=!1,(mn!==null||xn!==null)&&(lr(),mn&&(a=mn,e=xn,xn=mn=null,Du(a),e)))for(a=0;a<e.length;a++)Du(e[a])}}function nl(e,a){var s=e.stateNode;if(s===null)return null;var l=s[Ot]||null;if(l===null)return null;s=l[a];e:switch(a){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(s&&typeof s!="function")throw Error(c(231,a,typeof s));return s}var Ta=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fc=!1;if(Ta)try{var ll={};Object.defineProperty(ll,"passive",{get:function(){fc=!0}}),window.addEventListener("test",ll,ll),window.removeEventListener("test",ll,ll)}catch{fc=!1}var as=null,hc=null,yi=null;function Lu(){if(yi)return yi;var e,a=hc,s=a.length,l,r="value"in as?as.value:as.textContent,o=r.length;for(e=0;e<s&&a[e]===r[e];e++);var x=s-e;for(l=1;l<=x&&a[s-l]===r[o-l];l++);return yi=r.slice(e,1<l?1-l:void 0)}function vi(e){var a=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&a===13&&(e=13)):e=a,e===10&&(e=13),32<=e||e===13?e:0}function ji(){return!0}function _u(){return!1}function Lt(e){function a(s,l,r,o,x){this._reactName=s,this._targetInst=r,this.type=l,this.nativeEvent=o,this.target=x,this.currentTarget=null;for(var j in e)e.hasOwnProperty(j)&&(s=e[j],this[j]=s?s(o):o[j]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?ji:_u,this.isPropagationStopped=_u,this}return v(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=ji)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=ji)},persist:function(){},isPersistent:ji}),a}var _s={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ni=Lt(_s),il=v({},_s,{view:0,detail:0}),ip=Lt(il),pc,gc,rl,wi=v({},il,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:yc,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!==rl&&(rl&&e.type==="mousemove"?(pc=e.screenX-rl.screenX,gc=e.screenY-rl.screenY):gc=pc=0,rl=e),pc)},movementY:function(e){return"movementY"in e?e.movementY:gc}}),Uu=Lt(wi),rp=v({},wi,{dataTransfer:0}),cp=Lt(rp),op=v({},il,{relatedTarget:0}),bc=Lt(op),dp=v({},_s,{animationName:0,elapsedTime:0,pseudoElement:0}),up=Lt(dp),mp=v({},_s,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),xp=Lt(mp),fp=v({},_s,{data:0}),Bu=Lt(fp),hp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pp={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"},gp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bp(e){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(e):(e=gp[e])?!!a[e]:!1}function yc(){return bp}var yp=v({},il,{key:function(e){if(e.key){var a=hp[e.key]||e.key;if(a!=="Unidentified")return a}return e.type==="keypress"?(e=vi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?pp[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:yc,charCode:function(e){return e.type==="keypress"?vi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?vi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),vp=Lt(yp),jp=v({},wi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$u=Lt(jp),Np=v({},il,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:yc}),wp=Lt(Np),Sp=v({},_s,{propertyName:0,elapsedTime:0,pseudoElement:0}),kp=Lt(Sp),zp=v({},wi,{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}),Cp=Lt(zp),Ap=v({},_s,{newState:0,oldState:0}),Ep=Lt(Ap),Tp=[9,13,27,32],vc=Ta&&"CompositionEvent"in window,cl=null;Ta&&"documentMode"in document&&(cl=document.documentMode);var Rp=Ta&&"TextEvent"in window&&!cl,Hu=Ta&&(!vc||cl&&8<cl&&11>=cl),qu=" ",Gu=!1;function Ku(e,a){switch(e){case"keyup":return Tp.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var fn=!1;function Mp(e,a){switch(e){case"compositionend":return Vu(a);case"keypress":return a.which!==32?null:(Gu=!0,qu);case"textInput":return e=a.data,e===qu&&Gu?null:e;default:return null}}function Dp(e,a){if(fn)return e==="compositionend"||!vc&&Ku(e,a)?(e=Lu(),yi=hc=as=null,fn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Hu&&a.locale!=="ko"?null:a.data;default:return null}}var Op={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 Yu(e){var a=e&&e.nodeName&&e.nodeName.toLowerCase();return a==="input"?!!Op[e.type]:a==="textarea"}function Xu(e,a,s,l){mn?xn?xn.push(l):xn=[l]:mn=l,a=mr(a,"onChange"),0<a.length&&(s=new Ni("onChange","change",null,s,l),e.push({event:s,listeners:a}))}var ol=null,dl=null;function Lp(e){Ef(e,0)}function Si(e){var a=sl(e);if(Cu(a))return e}function Qu(e,a){if(e==="change")return a}var Zu=!1;if(Ta){var jc;if(Ta){var Nc="oninput"in document;if(!Nc){var Ju=document.createElement("div");Ju.setAttribute("oninput","return;"),Nc=typeof Ju.oninput=="function"}jc=Nc}else jc=!1;Zu=jc&&(!document.documentMode||9<document.documentMode)}function Fu(){ol&&(ol.detachEvent("onpropertychange",Iu),dl=ol=null)}function Iu(e){if(e.propertyName==="value"&&Si(dl)){var a=[];Xu(a,dl,e,mc(e)),Ou(Lp,a)}}function _p(e,a,s){e==="focusin"?(Fu(),ol=a,dl=s,ol.attachEvent("onpropertychange",Iu)):e==="focusout"&&Fu()}function Up(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Si(dl)}function Bp(e,a){if(e==="click")return Si(a)}function $p(e,a){if(e==="input"||e==="change")return Si(a)}function Hp(e,a){return e===a&&(e!==0||1/e===1/a)||e!==e&&a!==a}var Kt=typeof Object.is=="function"?Object.is:Hp;function ul(e,a){if(Kt(e,a))return!0;if(typeof e!="object"||e===null||typeof a!="object"||a===null)return!1;var s=Object.keys(e),l=Object.keys(a);if(s.length!==l.length)return!1;for(l=0;l<s.length;l++){var r=s[l];if(!P.call(a,r)||!Kt(e[r],a[r]))return!1}return!0}function Pu(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Wu(e,a){var s=Pu(e);e=0;for(var l;s;){if(s.nodeType===3){if(l=e+s.textContent.length,e<=a&&l>=a)return{node:s,offset:a-e};e=l}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Pu(s)}}function em(e,a){return e&&a?e===a?!0:e&&e.nodeType===3?!1:a&&a.nodeType===3?em(e,a.parentNode):"contains"in e?e.contains(a):e.compareDocumentPosition?!!(e.compareDocumentPosition(a)&16):!1:!1}function tm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var a=gi(e.document);a instanceof e.HTMLIFrameElement;){try{var s=typeof a.contentWindow.location.href=="string"}catch{s=!1}if(s)e=a.contentWindow;else break;a=gi(e.document)}return a}function wc(e){var a=e&&e.nodeName&&e.nodeName.toLowerCase();return a&&(a==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||a==="textarea"||e.contentEditable==="true")}var qp=Ta&&"documentMode"in document&&11>=document.documentMode,hn=null,Sc=null,ml=null,kc=!1;function am(e,a,s){var l=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;kc||hn==null||hn!==gi(l)||(l=hn,"selectionStart"in l&&wc(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}),ml&&ul(ml,l)||(ml=l,l=mr(Sc,"onSelect"),0<l.length&&(a=new Ni("onSelect","select",null,a,s),e.push({event:a,listeners:l}),a.target=hn)))}function Us(e,a){var s={};return s[e.toLowerCase()]=a.toLowerCase(),s["Webkit"+e]="webkit"+a,s["Moz"+e]="moz"+a,s}var pn={animationend:Us("Animation","AnimationEnd"),animationiteration:Us("Animation","AnimationIteration"),animationstart:Us("Animation","AnimationStart"),transitionrun:Us("Transition","TransitionRun"),transitionstart:Us("Transition","TransitionStart"),transitioncancel:Us("Transition","TransitionCancel"),transitionend:Us("Transition","TransitionEnd")},zc={},sm={};Ta&&(sm=document.createElement("div").style,"AnimationEvent"in window||(delete pn.animationend.animation,delete pn.animationiteration.animation,delete pn.animationstart.animation),"TransitionEvent"in window||delete pn.transitionend.transition);function Bs(e){if(zc[e])return zc[e];if(!pn[e])return e;var a=pn[e],s;for(s in a)if(a.hasOwnProperty(s)&&s in sm)return zc[e]=a[s];return e}var nm=Bs("animationend"),lm=Bs("animationiteration"),im=Bs("animationstart"),Gp=Bs("transitionrun"),Kp=Bs("transitionstart"),Vp=Bs("transitioncancel"),rm=Bs("transitionend"),cm=new Map,Cc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Cc.push("scrollEnd");function ma(e,a){cm.set(e,a),Ls(a,[e])}var ki=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},ea=[],gn=0,Ac=0;function zi(){for(var e=gn,a=Ac=gn=0;a<e;){var s=ea[a];ea[a++]=null;var l=ea[a];ea[a++]=null;var r=ea[a];ea[a++]=null;var o=ea[a];if(ea[a++]=null,l!==null&&r!==null){var x=l.pending;x===null?r.next=r:(r.next=x.next,x.next=r),l.pending=r}o!==0&&om(s,r,o)}}function Ci(e,a,s,l){ea[gn++]=e,ea[gn++]=a,ea[gn++]=s,ea[gn++]=l,Ac|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Ec(e,a,s,l){return Ci(e,a,s,l),Ai(e)}function $s(e,a){return Ci(e,null,null,a),Ai(e)}function om(e,a,s){e.lanes|=s;var l=e.alternate;l!==null&&(l.lanes|=s);for(var r=!1,o=e.return;o!==null;)o.childLanes|=s,l=o.alternate,l!==null&&(l.childLanes|=s),o.tag===22&&(e=o.stateNode,e===null||e._visibility&1||(r=!0)),e=o,o=o.return;return e.tag===3?(o=e.stateNode,r&&a!==null&&(r=31-Tt(s),e=o.hiddenUpdates,l=e[r],l===null?e[r]=[a]:l.push(a),a.lane=s|536870912),o):null}function Ai(e){if(50<Ol)throw Ol=0,$o=null,Error(c(185));for(var a=e.return;a!==null;)e=a,a=e.return;return e.tag===3?e.stateNode:null}var bn={};function Yp(e,a,s,l){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,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 Vt(e,a,s,l){return new Yp(e,a,s,l)}function Tc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ra(e,a){var s=e.alternate;return s===null?(s=Vt(e.tag,a,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=a,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&65011712,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,a=e.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s.refCleanup=e.refCleanup,s}function dm(e,a){e.flags&=65011714;var s=e.alternate;return s===null?(e.childLanes=0,e.lanes=a,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=s.childLanes,e.lanes=s.lanes,e.child=s.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=s.memoizedProps,e.memoizedState=s.memoizedState,e.updateQueue=s.updateQueue,e.type=s.type,a=s.dependencies,e.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),e}function Ei(e,a,s,l,r,o){var x=0;if(l=e,typeof e=="function")Tc(e)&&(x=1);else if(typeof e=="string")x=Fg(e,s,$.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case I:return e=Vt(31,s,a,r),e.elementType=I,e.lanes=o,e;case N:return Hs(s.children,r,o,a);case S:x=8,r|=24;break;case C:return e=Vt(12,s,a,r|2),e.elementType=C,e.lanes=o,e;case ae:return e=Vt(13,s,a,r),e.elementType=ae,e.lanes=o,e;case ce:return e=Vt(19,s,a,r),e.elementType=ce,e.lanes=o,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case M:x=10;break e;case O:x=9;break e;case E:x=11;break e;case B:x=14;break e;case q:x=16,l=null;break e}x=29,s=Error(c(130,e===null?"null":typeof e,"")),l=null}return a=Vt(x,s,a,r),a.elementType=e,a.type=l,a.lanes=o,a}function Hs(e,a,s,l){return e=Vt(7,e,l,a),e.lanes=s,e}function Rc(e,a,s){return e=Vt(6,e,null,a),e.lanes=s,e}function um(e){var a=Vt(18,null,null,0);return a.stateNode=e,a}function Mc(e,a,s){return a=Vt(4,e.children!==null?e.children:[],e.key,a),a.lanes=s,a.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},a}var mm=new WeakMap;function ta(e,a){if(typeof e=="object"&&e!==null){var s=mm.get(e);return s!==void 0?s:(a={value:e,source:a,stack:D(a)},mm.set(e,a),a)}return{value:e,source:a,stack:D(a)}}var yn=[],vn=0,Ti=null,xl=0,aa=[],sa=0,ss=null,ya=1,va="";function Ma(e,a){yn[vn++]=xl,yn[vn++]=Ti,Ti=e,xl=a}function xm(e,a,s){aa[sa++]=ya,aa[sa++]=va,aa[sa++]=ss,ss=e;var l=ya;e=va;var r=32-Tt(l)-1;l&=~(1<<r),s+=1;var o=32-Tt(a)+r;if(30<o){var x=r-r%5;o=(l&(1<<x)-1).toString(32),l>>=x,r-=x,ya=1<<32-Tt(a)+r|s<<r|l,va=o+e}else ya=1<<o|s<<r|l,va=e}function Dc(e){e.return!==null&&(Ma(e,1),xm(e,1,0))}function Oc(e){for(;e===Ti;)Ti=yn[--vn],yn[vn]=null,xl=yn[--vn],yn[vn]=null;for(;e===ss;)ss=aa[--sa],aa[sa]=null,va=aa[--sa],aa[sa]=null,ya=aa[--sa],aa[sa]=null}function fm(e,a){aa[sa++]=ya,aa[sa++]=va,aa[sa++]=ss,ya=a.id,va=a.overflow,ss=e}var vt=null,Xe=null,Me=!1,ns=null,na=!1,Lc=Error(c(519));function ls(e){var a=Error(c(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw fl(ta(a,e)),Lc}function hm(e){var a=e.stateNode,s=e.type,l=e.memoizedProps;switch(a[yt]=e,a[Ot]=l,s){case"dialog":Ee("cancel",a),Ee("close",a);break;case"iframe":case"object":case"embed":Ee("load",a);break;case"video":case"audio":for(s=0;s<_l.length;s++)Ee(_l[s],a);break;case"source":Ee("error",a);break;case"img":case"image":case"link":Ee("error",a),Ee("load",a);break;case"details":Ee("toggle",a);break;case"input":Ee("invalid",a),Au(a,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ee("invalid",a);break;case"textarea":Ee("invalid",a),Tu(a,l.value,l.defaultValue,l.children)}s=l.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||a.textContent===""+s||l.suppressHydrationWarning===!0||Df(a.textContent,s)?(l.popover!=null&&(Ee("beforetoggle",a),Ee("toggle",a)),l.onScroll!=null&&Ee("scroll",a),l.onScrollEnd!=null&&Ee("scrollend",a),l.onClick!=null&&(a.onclick=Ea),a=!0):a=!1,a||ls(e,!0)}function pm(e){for(vt=e.return;vt;)switch(vt.tag){case 5:case 31:case 13:na=!1;return;case 27:case 3:na=!0;return;default:vt=vt.return}}function jn(e){if(e!==vt)return!1;if(!Me)return pm(e),Me=!0,!1;var a=e.tag,s;if((s=a!==3&&a!==27)&&((s=a===5)&&(s=e.type,s=!(s!=="form"&&s!=="button")||ed(e.type,e.memoizedProps)),s=!s),s&&Xe&&ls(e),pm(e),a===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));Xe=Gf(e)}else if(a===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));Xe=Gf(e)}else a===27?(a=Xe,ys(e.type)?(e=ld,ld=null,Xe=e):Xe=a):Xe=vt?ia(e.stateNode.nextSibling):null;return!0}function qs(){Xe=vt=null,Me=!1}function _c(){var e=ns;return e!==null&&($t===null?$t=e:$t.push.apply($t,e),ns=null),e}function fl(e){ns===null?ns=[e]:ns.push(e)}var Uc=T(null),Gs=null,Da=null;function is(e,a,s){ie(Uc,a._currentValue),a._currentValue=s}function Oa(e){e._currentValue=Uc.current,Y(Uc)}function Bc(e,a,s){for(;e!==null;){var l=e.alternate;if((e.childLanes&a)!==a?(e.childLanes|=a,l!==null&&(l.childLanes|=a)):l!==null&&(l.childLanes&a)!==a&&(l.childLanes|=a),e===s)break;e=e.return}}function $c(e,a,s,l){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var o=r.dependencies;if(o!==null){var x=r.child;o=o.firstContext;e:for(;o!==null;){var j=o;o=r;for(var A=0;A<a.length;A++)if(j.context===a[A]){o.lanes|=s,j=o.alternate,j!==null&&(j.lanes|=s),Bc(o.return,s,e),l||(x=null);break e}o=j.next}}else if(r.tag===18){if(x=r.return,x===null)throw Error(c(341));x.lanes|=s,o=x.alternate,o!==null&&(o.lanes|=s),Bc(x,s,e),x=null}else x=r.child;if(x!==null)x.return=r;else for(x=r;x!==null;){if(x===e){x=null;break}if(r=x.sibling,r!==null){r.return=x.return,x=r;break}x=x.return}r=x}}function Nn(e,a,s,l){e=null;for(var r=a,o=!1;r!==null;){if(!o){if((r.flags&524288)!==0)o=!0;else if((r.flags&262144)!==0)break}if(r.tag===10){var x=r.alternate;if(x===null)throw Error(c(387));if(x=x.memoizedProps,x!==null){var j=r.type;Kt(r.pendingProps.value,x.value)||(e!==null?e.push(j):e=[j])}}else if(r===be.current){if(x=r.alternate,x===null)throw Error(c(387));x.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(ql):e=[ql])}r=r.return}e!==null&&$c(a,e,s,l),a.flags|=262144}function Ri(e){for(e=e.firstContext;e!==null;){if(!Kt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ks(e){Gs=e,Da=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function jt(e){return gm(Gs,e)}function Mi(e,a){return Gs===null&&Ks(e),gm(e,a)}function gm(e,a){var s=a._currentValue;if(a={context:a,memoizedValue:s,next:null},Da===null){if(e===null)throw Error(c(308));Da=a,e.dependencies={lanes:0,firstContext:a},e.flags|=524288}else Da=Da.next=a;return s}var Xp=typeof AbortController<"u"?AbortController:function(){var e=[],a=this.signal={aborted:!1,addEventListener:function(s,l){e.push(l)}};this.abort=function(){a.aborted=!0,e.forEach(function(s){return s()})}},Qp=n.unstable_scheduleCallback,Zp=n.unstable_NormalPriority,lt={$$typeof:M,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Hc(){return{controller:new Xp,data:new Map,refCount:0}}function hl(e){e.refCount--,e.refCount===0&&Qp(Zp,function(){e.controller.abort()})}var pl=null,qc=0,wn=0,Sn=null;function Jp(e,a){if(pl===null){var s=pl=[];qc=0,wn=Yo(),Sn={status:"pending",value:void 0,then:function(l){s.push(l)}}}return qc++,a.then(bm,bm),a}function bm(){if(--qc===0&&pl!==null){Sn!==null&&(Sn.status="fulfilled");var e=pl;pl=null,wn=0,Sn=null;for(var a=0;a<e.length;a++)(0,e[a])()}}function Fp(e,a){var s=[],l={status:"pending",value:null,reason:null,then:function(r){s.push(r)}};return e.then(function(){l.status="fulfilled",l.value=a;for(var r=0;r<s.length;r++)(0,s[r])(a)},function(r){for(l.status="rejected",l.reason=r,r=0;r<s.length;r++)(0,s[r])(void 0)}),l}var ym=G.S;G.S=function(e,a){af=pe(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&Jp(e,a),ym!==null&&ym(e,a)};var Vs=T(null);function Gc(){var e=Vs.current;return e!==null?e:Ke.pooledCache}function Di(e,a){a===null?ie(Vs,Vs.current):ie(Vs,a.pool)}function vm(){var e=Gc();return e===null?null:{parent:lt._currentValue,pool:e}}var kn=Error(c(460)),Kc=Error(c(474)),Oi=Error(c(542)),Li={then:function(){}};function jm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Nm(e,a,s){switch(s=e[s],s===void 0?e.push(a):s!==a&&(a.then(Ea,Ea),a=s),a.status){case"fulfilled":return a.value;case"rejected":throw e=a.reason,Sm(e),e;default:if(typeof a.status=="string")a.then(Ea,Ea);else{if(e=Ke,e!==null&&100<e.shellSuspendCounter)throw Error(c(482));e=a,e.status="pending",e.then(function(l){if(a.status==="pending"){var r=a;r.status="fulfilled",r.value=l}},function(l){if(a.status==="pending"){var r=a;r.status="rejected",r.reason=l}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw e=a.reason,Sm(e),e}throw Xs=a,kn}}function Ys(e){try{var a=e._init;return a(e._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(Xs=s,kn):s}}var Xs=null;function wm(){if(Xs===null)throw Error(c(459));var e=Xs;return Xs=null,e}function Sm(e){if(e===kn||e===Oi)throw Error(c(483))}var zn=null,gl=0;function _i(e){var a=gl;return gl+=1,zn===null&&(zn=[]),Nm(zn,e,a)}function bl(e,a){a=a.props.ref,e.ref=a!==void 0?a:null}function Ui(e,a){throw a.$$typeof===y?Error(c(525)):(e=Object.prototype.toString.call(a),Error(c(31,e==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":e)))}function km(e){function a(L,R){if(e){var _=L.deletions;_===null?(L.deletions=[R],L.flags|=16):_.push(R)}}function s(L,R){if(!e)return null;for(;R!==null;)a(L,R),R=R.sibling;return null}function l(L){for(var R=new Map;L!==null;)L.key!==null?R.set(L.key,L):R.set(L.index,L),L=L.sibling;return R}function r(L,R){return L=Ra(L,R),L.index=0,L.sibling=null,L}function o(L,R,_){return L.index=_,e?(_=L.alternate,_!==null?(_=_.index,_<R?(L.flags|=67108866,R):_):(L.flags|=67108866,R)):(L.flags|=1048576,R)}function x(L){return e&&L.alternate===null&&(L.flags|=67108866),L}function j(L,R,_,Z){return R===null||R.tag!==6?(R=Rc(_,L.mode,Z),R.return=L,R):(R=r(R,_),R.return=L,R)}function A(L,R,_,Z){var he=_.type;return he===N?V(L,R,_.props.children,Z,_.key):R!==null&&(R.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===q&&Ys(he)===R.type)?(R=r(R,_.props),bl(R,_),R.return=L,R):(R=Ei(_.type,_.key,_.props,null,L.mode,Z),bl(R,_),R.return=L,R)}function U(L,R,_,Z){return R===null||R.tag!==4||R.stateNode.containerInfo!==_.containerInfo||R.stateNode.implementation!==_.implementation?(R=Mc(_,L.mode,Z),R.return=L,R):(R=r(R,_.children||[]),R.return=L,R)}function V(L,R,_,Z,he){return R===null||R.tag!==7?(R=Hs(_,L.mode,Z,he),R.return=L,R):(R=r(R,_),R.return=L,R)}function F(L,R,_){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=Rc(""+R,L.mode,_),R.return=L,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case k:return _=Ei(R.type,R.key,R.props,null,L.mode,_),bl(_,R),_.return=L,_;case z:return R=Mc(R,L.mode,_),R.return=L,R;case q:return R=Ys(R),F(L,R,_)}if(ge(R)||le(R))return R=Hs(R,L.mode,_,null),R.return=L,R;if(typeof R.then=="function")return F(L,_i(R),_);if(R.$$typeof===M)return F(L,Mi(L,R),_);Ui(L,R)}return null}function H(L,R,_,Z){var he=R!==null?R.key:null;if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return he!==null?null:j(L,R,""+_,Z);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case k:return _.key===he?A(L,R,_,Z):null;case z:return _.key===he?U(L,R,_,Z):null;case q:return _=Ys(_),H(L,R,_,Z)}if(ge(_)||le(_))return he!==null?null:V(L,R,_,Z,null);if(typeof _.then=="function")return H(L,R,_i(_),Z);if(_.$$typeof===M)return H(L,R,Mi(L,_),Z);Ui(L,_)}return null}function K(L,R,_,Z,he){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return L=L.get(_)||null,j(R,L,""+Z,he);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case k:return L=L.get(Z.key===null?_:Z.key)||null,A(R,L,Z,he);case z:return L=L.get(Z.key===null?_:Z.key)||null,U(R,L,Z,he);case q:return Z=Ys(Z),K(L,R,_,Z,he)}if(ge(Z)||le(Z))return L=L.get(_)||null,V(R,L,Z,he,null);if(typeof Z.then=="function")return K(L,R,_,_i(Z),he);if(Z.$$typeof===M)return K(L,R,_,Mi(R,Z),he);Ui(R,Z)}return null}function ue(L,R,_,Z){for(var he=null,Oe=null,fe=R,ke=R=0,Re=null;fe!==null&&ke<_.length;ke++){fe.index>ke?(Re=fe,fe=null):Re=fe.sibling;var Le=H(L,fe,_[ke],Z);if(Le===null){fe===null&&(fe=Re);break}e&&fe&&Le.alternate===null&&a(L,fe),R=o(Le,R,ke),Oe===null?he=Le:Oe.sibling=Le,Oe=Le,fe=Re}if(ke===_.length)return s(L,fe),Me&&Ma(L,ke),he;if(fe===null){for(;ke<_.length;ke++)fe=F(L,_[ke],Z),fe!==null&&(R=o(fe,R,ke),Oe===null?he=fe:Oe.sibling=fe,Oe=fe);return Me&&Ma(L,ke),he}for(fe=l(fe);ke<_.length;ke++)Re=K(fe,L,ke,_[ke],Z),Re!==null&&(e&&Re.alternate!==null&&fe.delete(Re.key===null?ke:Re.key),R=o(Re,R,ke),Oe===null?he=Re:Oe.sibling=Re,Oe=Re);return e&&fe.forEach(function(Ss){return a(L,Ss)}),Me&&Ma(L,ke),he}function ye(L,R,_,Z){if(_==null)throw Error(c(151));for(var he=null,Oe=null,fe=R,ke=R=0,Re=null,Le=_.next();fe!==null&&!Le.done;ke++,Le=_.next()){fe.index>ke?(Re=fe,fe=null):Re=fe.sibling;var Ss=H(L,fe,Le.value,Z);if(Ss===null){fe===null&&(fe=Re);break}e&&fe&&Ss.alternate===null&&a(L,fe),R=o(Ss,R,ke),Oe===null?he=Ss:Oe.sibling=Ss,Oe=Ss,fe=Re}if(Le.done)return s(L,fe),Me&&Ma(L,ke),he;if(fe===null){for(;!Le.done;ke++,Le=_.next())Le=F(L,Le.value,Z),Le!==null&&(R=o(Le,R,ke),Oe===null?he=Le:Oe.sibling=Le,Oe=Le);return Me&&Ma(L,ke),he}for(fe=l(fe);!Le.done;ke++,Le=_.next())Le=K(fe,L,ke,Le.value,Z),Le!==null&&(e&&Le.alternate!==null&&fe.delete(Le.key===null?ke:Le.key),R=o(Le,R,ke),Oe===null?he=Le:Oe.sibling=Le,Oe=Le);return e&&fe.forEach(function(rb){return a(L,rb)}),Me&&Ma(L,ke),he}function qe(L,R,_,Z){if(typeof _=="object"&&_!==null&&_.type===N&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case k:e:{for(var he=_.key;R!==null;){if(R.key===he){if(he=_.type,he===N){if(R.tag===7){s(L,R.sibling),Z=r(R,_.props.children),Z.return=L,L=Z;break e}}else if(R.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===q&&Ys(he)===R.type){s(L,R.sibling),Z=r(R,_.props),bl(Z,_),Z.return=L,L=Z;break e}s(L,R);break}else a(L,R);R=R.sibling}_.type===N?(Z=Hs(_.props.children,L.mode,Z,_.key),Z.return=L,L=Z):(Z=Ei(_.type,_.key,_.props,null,L.mode,Z),bl(Z,_),Z.return=L,L=Z)}return x(L);case z:e:{for(he=_.key;R!==null;){if(R.key===he)if(R.tag===4&&R.stateNode.containerInfo===_.containerInfo&&R.stateNode.implementation===_.implementation){s(L,R.sibling),Z=r(R,_.children||[]),Z.return=L,L=Z;break e}else{s(L,R);break}else a(L,R);R=R.sibling}Z=Mc(_,L.mode,Z),Z.return=L,L=Z}return x(L);case q:return _=Ys(_),qe(L,R,_,Z)}if(ge(_))return ue(L,R,_,Z);if(le(_)){if(he=le(_),typeof he!="function")throw Error(c(150));return _=he.call(_),ye(L,R,_,Z)}if(typeof _.then=="function")return qe(L,R,_i(_),Z);if(_.$$typeof===M)return qe(L,R,Mi(L,_),Z);Ui(L,_)}return typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint"?(_=""+_,R!==null&&R.tag===6?(s(L,R.sibling),Z=r(R,_),Z.return=L,L=Z):(s(L,R),Z=Rc(_,L.mode,Z),Z.return=L,L=Z),x(L)):s(L,R)}return function(L,R,_,Z){try{gl=0;var he=qe(L,R,_,Z);return zn=null,he}catch(fe){if(fe===kn||fe===Oi)throw fe;var Oe=Vt(29,fe,null,L.mode);return Oe.lanes=Z,Oe.return=L,Oe}finally{}}}var Qs=km(!0),zm=km(!1),rs=!1;function Vc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Yc(e,a){e=e.updateQueue,a.updateQueue===e&&(a.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function cs(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function os(e,a,s){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(_e&2)!==0){var r=l.pending;return r===null?a.next=a:(a.next=r.next,r.next=a),l.pending=a,a=Ai(e),om(e,null,s),a}return Ci(e,l,a,s),Ai(e)}function yl(e,a,s){if(a=a.updateQueue,a!==null&&(a=a.shared,(s&4194048)!==0)){var l=a.lanes;l&=e.pendingLanes,s|=l,a.lanes=s,gu(e,s)}}function Xc(e,a){var s=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,s===l)){var r=null,o=null;if(s=s.firstBaseUpdate,s!==null){do{var x={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};o===null?r=o=x:o=o.next=x,s=s.next}while(s!==null);o===null?r=o=a:o=o.next=a}else r=o=a;s={baseState:l.baseState,firstBaseUpdate:r,lastBaseUpdate:o,shared:l.shared,callbacks:l.callbacks},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=a:e.next=a,s.lastBaseUpdate=a}var Qc=!1;function vl(){if(Qc){var e=Sn;if(e!==null)throw e}}function jl(e,a,s,l){Qc=!1;var r=e.updateQueue;rs=!1;var o=r.firstBaseUpdate,x=r.lastBaseUpdate,j=r.shared.pending;if(j!==null){r.shared.pending=null;var A=j,U=A.next;A.next=null,x===null?o=U:x.next=U,x=A;var V=e.alternate;V!==null&&(V=V.updateQueue,j=V.lastBaseUpdate,j!==x&&(j===null?V.firstBaseUpdate=U:j.next=U,V.lastBaseUpdate=A))}if(o!==null){var F=r.baseState;x=0,V=U=A=null,j=o;do{var H=j.lane&-536870913,K=H!==j.lane;if(K?(Te&H)===H:(l&H)===H){H!==0&&H===wn&&(Qc=!0),V!==null&&(V=V.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var ue=e,ye=j;H=a;var qe=s;switch(ye.tag){case 1:if(ue=ye.payload,typeof ue=="function"){F=ue.call(qe,F,H);break e}F=ue;break e;case 3:ue.flags=ue.flags&-65537|128;case 0:if(ue=ye.payload,H=typeof ue=="function"?ue.call(qe,F,H):ue,H==null)break e;F=v({},F,H);break e;case 2:rs=!0}}H=j.callback,H!==null&&(e.flags|=64,K&&(e.flags|=8192),K=r.callbacks,K===null?r.callbacks=[H]:K.push(H))}else K={lane:H,tag:j.tag,payload:j.payload,callback:j.callback,next:null},V===null?(U=V=K,A=F):V=V.next=K,x|=H;if(j=j.next,j===null){if(j=r.shared.pending,j===null)break;K=j,j=K.next,K.next=null,r.lastBaseUpdate=K,r.shared.pending=null}}while(!0);V===null&&(A=F),r.baseState=A,r.firstBaseUpdate=U,r.lastBaseUpdate=V,o===null&&(r.shared.lanes=0),fs|=x,e.lanes=x,e.memoizedState=F}}function Cm(e,a){if(typeof e!="function")throw Error(c(191,e));e.call(a)}function Am(e,a){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)Cm(s[e],a)}var Cn=T(null),Bi=T(0);function Em(e,a){e=Ka,ie(Bi,e),ie(Cn,a),Ka=e|a.baseLanes}function Zc(){ie(Bi,Ka),ie(Cn,Cn.current)}function Jc(){Ka=Bi.current,Y(Cn),Y(Bi)}var Yt=T(null),la=null;function ds(e){var a=e.alternate;ie(at,at.current&1),ie(Yt,e),la===null&&(a===null||Cn.current!==null||a.memoizedState!==null)&&(la=e)}function Fc(e){ie(at,at.current),ie(Yt,e),la===null&&(la=e)}function Tm(e){e.tag===22?(ie(at,at.current),ie(Yt,e),la===null&&(la=e)):us()}function us(){ie(at,at.current),ie(Yt,Yt.current)}function Xt(e){Y(Yt),la===e&&(la=null),Y(at)}var at=T(0);function $i(e){for(var a=e;a!==null;){if(a.tag===13){var s=a.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||sd(s)||nd(s)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===e)break;for(;a.sibling===null;){if(a.return===null||a.return===e)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var La=0,Se=null,$e=null,it=null,Hi=!1,An=!1,Zs=!1,qi=0,Nl=0,En=null,Ip=0;function We(){throw Error(c(321))}function Ic(e,a){if(a===null)return!1;for(var s=0;s<a.length&&s<e.length;s++)if(!Kt(e[s],a[s]))return!1;return!0}function Pc(e,a,s,l,r,o){return La=o,Se=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,G.H=e===null||e.memoizedState===null?xx:fo,Zs=!1,o=s(l,r),Zs=!1,An&&(o=Mm(a,s,l,r)),Rm(e),o}function Rm(e){G.H=kl;var a=$e!==null&&$e.next!==null;if(La=0,it=$e=Se=null,Hi=!1,Nl=0,En=null,a)throw Error(c(300));e===null||rt||(e=e.dependencies,e!==null&&Ri(e)&&(rt=!0))}function Mm(e,a,s,l){Se=e;var r=0;do{if(An&&(En=null),Nl=0,An=!1,25<=r)throw Error(c(301));if(r+=1,it=$e=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}G.H=fx,o=a(s,l)}while(An);return o}function Pp(){var e=G.H,a=e.useState()[0];return a=typeof a.then=="function"?wl(a):a,e=e.useState()[0],($e!==null?$e.memoizedState:null)!==e&&(Se.flags|=1024),a}function Wc(){var e=qi!==0;return qi=0,e}function eo(e,a,s){a.updateQueue=e.updateQueue,a.flags&=-2053,e.lanes&=~s}function to(e){if(Hi){for(e=e.memoizedState;e!==null;){var a=e.queue;a!==null&&(a.pending=null),e=e.next}Hi=!1}La=0,it=$e=Se=null,An=!1,Nl=qi=0,En=null}function Rt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return it===null?Se.memoizedState=it=e:it=it.next=e,it}function st(){if($e===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=$e.next;var a=it===null?Se.memoizedState:it.next;if(a!==null)it=a,$e=e;else{if(e===null)throw Se.alternate===null?Error(c(467)):Error(c(310));$e=e,e={memoizedState:$e.memoizedState,baseState:$e.baseState,baseQueue:$e.baseQueue,queue:$e.queue,next:null},it===null?Se.memoizedState=it=e:it=it.next=e}return it}function Gi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function wl(e){var a=Nl;return Nl+=1,En===null&&(En=[]),e=Nm(En,e,a),a=Se,(it===null?a.memoizedState:it.next)===null&&(a=a.alternate,G.H=a===null||a.memoizedState===null?xx:fo),e}function Ki(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return wl(e);if(e.$$typeof===M)return jt(e)}throw Error(c(438,String(e)))}function ao(e){var a=null,s=Se.updateQueue;if(s!==null&&(a=s.memoCache),a==null){var l=Se.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(a={data:l.data.map(function(r){return r.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),s===null&&(s=Gi(),Se.updateQueue=s),s.memoCache=a,s=a.data[a.index],s===void 0)for(s=a.data[a.index]=Array(e),l=0;l<e;l++)s[l]=W;return a.index++,s}function _a(e,a){return typeof a=="function"?a(e):a}function Vi(e){var a=st();return so(a,$e,e)}function so(e,a,s){var l=e.queue;if(l===null)throw Error(c(311));l.lastRenderedReducer=s;var r=e.baseQueue,o=l.pending;if(o!==null){if(r!==null){var x=r.next;r.next=o.next,o.next=x}a.baseQueue=r=o,l.pending=null}if(o=e.baseState,r===null)e.memoizedState=o;else{a=r.next;var j=x=null,A=null,U=a,V=!1;do{var F=U.lane&-536870913;if(F!==U.lane?(Te&F)===F:(La&F)===F){var H=U.revertLane;if(H===0)A!==null&&(A=A.next={lane:0,revertLane:0,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),F===wn&&(V=!0);else if((La&H)===H){U=U.next,H===wn&&(V=!0);continue}else F={lane:0,revertLane:U.revertLane,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},A===null?(j=A=F,x=o):A=A.next=F,Se.lanes|=H,fs|=H;F=U.action,Zs&&s(o,F),o=U.hasEagerState?U.eagerState:s(o,F)}else H={lane:F,revertLane:U.revertLane,gesture:U.gesture,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},A===null?(j=A=H,x=o):A=A.next=H,Se.lanes|=F,fs|=F;U=U.next}while(U!==null&&U!==a);if(A===null?x=o:A.next=j,!Kt(o,e.memoizedState)&&(rt=!0,V&&(s=Sn,s!==null)))throw s;e.memoizedState=o,e.baseState=x,e.baseQueue=A,l.lastRenderedState=o}return r===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function no(e){var a=st(),s=a.queue;if(s===null)throw Error(c(311));s.lastRenderedReducer=e;var l=s.dispatch,r=s.pending,o=a.memoizedState;if(r!==null){s.pending=null;var x=r=r.next;do o=e(o,x.action),x=x.next;while(x!==r);Kt(o,a.memoizedState)||(rt=!0),a.memoizedState=o,a.baseQueue===null&&(a.baseState=o),s.lastRenderedState=o}return[o,l]}function Dm(e,a,s){var l=Se,r=st(),o=Me;if(o){if(s===void 0)throw Error(c(407));s=s()}else s=a();var x=!Kt(($e||r).memoizedState,s);if(x&&(r.memoizedState=s,rt=!0),r=r.queue,ro(_m.bind(null,l,r,e),[e]),r.getSnapshot!==a||x||it!==null&&it.memoizedState.tag&1){if(l.flags|=2048,Tn(9,{destroy:void 0},Lm.bind(null,l,r,s,a),null),Ke===null)throw Error(c(349));o||(La&127)!==0||Om(l,a,s)}return s}function Om(e,a,s){e.flags|=16384,e={getSnapshot:a,value:s},a=Se.updateQueue,a===null?(a=Gi(),Se.updateQueue=a,a.stores=[e]):(s=a.stores,s===null?a.stores=[e]:s.push(e))}function Lm(e,a,s,l){a.value=s,a.getSnapshot=l,Um(a)&&Bm(e)}function _m(e,a,s){return s(function(){Um(a)&&Bm(e)})}function Um(e){var a=e.getSnapshot;e=e.value;try{var s=a();return!Kt(e,s)}catch{return!0}}function Bm(e){var a=$s(e,2);a!==null&&Ht(a,e,2)}function lo(e){var a=Rt();if(typeof e=="function"){var s=e;if(e=s(),Zs){ua(!0);try{s()}finally{ua(!1)}}}return a.memoizedState=a.baseState=e,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_a,lastRenderedState:e},a}function $m(e,a,s,l){return e.baseState=s,so(e,$e,typeof l=="function"?l:_a)}function Wp(e,a,s,l,r){if(Qi(e))throw Error(c(485));if(e=a.action,e!==null){var o={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){o.listeners.push(x)}};G.T!==null?s(!0):o.isTransition=!1,l(o),s=a.pending,s===null?(o.next=a.pending=o,Hm(a,o)):(o.next=s.next,a.pending=s.next=o)}}function Hm(e,a){var s=a.action,l=a.payload,r=e.state;if(a.isTransition){var o=G.T,x={};G.T=x;try{var j=s(r,l),A=G.S;A!==null&&A(x,j),qm(e,a,j)}catch(U){io(e,a,U)}finally{o!==null&&x.types!==null&&(o.types=x.types),G.T=o}}else try{o=s(r,l),qm(e,a,o)}catch(U){io(e,a,U)}}function qm(e,a,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(l){Gm(e,a,l)},function(l){return io(e,a,l)}):Gm(e,a,s)}function Gm(e,a,s){a.status="fulfilled",a.value=s,Km(a),e.state=s,a=e.pending,a!==null&&(s=a.next,s===a?e.pending=null:(s=s.next,a.next=s,Hm(e,s)))}function io(e,a,s){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do a.status="rejected",a.reason=s,Km(a),a=a.next;while(a!==l)}e.action=null}function Km(e){e=e.listeners;for(var a=0;a<e.length;a++)(0,e[a])()}function Vm(e,a){return a}function Ym(e,a){if(Me){var s=Ke.formState;if(s!==null){e:{var l=Se;if(Me){if(Xe){t:{for(var r=Xe,o=na;r.nodeType!==8;){if(!o){r=null;break t}if(r=ia(r.nextSibling),r===null){r=null;break t}}o=r.data,r=o==="F!"||o==="F"?r:null}if(r){Xe=ia(r.nextSibling),l=r.data==="F!";break e}}ls(l)}l=!1}l&&(a=s[0])}}return s=Rt(),s.memoizedState=s.baseState=a,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vm,lastRenderedState:a},s.queue=l,s=dx.bind(null,Se,l),l.dispatch=s,l=lo(!1),o=xo.bind(null,Se,!1,l.queue),l=Rt(),r={state:a,dispatch:null,action:e,pending:null},l.queue=r,s=Wp.bind(null,Se,r,o,s),r.dispatch=s,l.memoizedState=e,[a,s,!1]}function Xm(e){var a=st();return Qm(a,$e,e)}function Qm(e,a,s){if(a=so(e,a,Vm)[0],e=Vi(_a)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var l=wl(a)}catch(x){throw x===kn?Oi:x}else l=a;a=st();var r=a.queue,o=r.dispatch;return s!==a.memoizedState&&(Se.flags|=2048,Tn(9,{destroy:void 0},eg.bind(null,r,s),null)),[l,o,e]}function eg(e,a){e.action=a}function Zm(e){var a=st(),s=$e;if(s!==null)return Qm(a,s,e);st(),a=a.memoizedState,s=st();var l=s.queue.dispatch;return s.memoizedState=e,[a,l,!1]}function Tn(e,a,s,l){return e={tag:e,create:s,deps:l,inst:a,next:null},a=Se.updateQueue,a===null&&(a=Gi(),Se.updateQueue=a),s=a.lastEffect,s===null?a.lastEffect=e.next=e:(l=s.next,s.next=e,e.next=l,a.lastEffect=e),e}function Jm(){return st().memoizedState}function Yi(e,a,s,l){var r=Rt();Se.flags|=e,r.memoizedState=Tn(1|a,{destroy:void 0},s,l===void 0?null:l)}function Xi(e,a,s,l){var r=st();l=l===void 0?null:l;var o=r.memoizedState.inst;$e!==null&&l!==null&&Ic(l,$e.memoizedState.deps)?r.memoizedState=Tn(a,o,s,l):(Se.flags|=e,r.memoizedState=Tn(1|a,o,s,l))}function Fm(e,a){Yi(8390656,8,e,a)}function ro(e,a){Xi(2048,8,e,a)}function tg(e){Se.flags|=4;var a=Se.updateQueue;if(a===null)a=Gi(),Se.updateQueue=a,a.events=[e];else{var s=a.events;s===null?a.events=[e]:s.push(e)}}function Im(e){var a=st().memoizedState;return tg({ref:a,nextImpl:e}),function(){if((_e&2)!==0)throw Error(c(440));return a.impl.apply(void 0,arguments)}}function Pm(e,a){return Xi(4,2,e,a)}function Wm(e,a){return Xi(4,4,e,a)}function ex(e,a){if(typeof a=="function"){e=e();var s=a(e);return function(){typeof s=="function"?s():a(null)}}if(a!=null)return e=e(),a.current=e,function(){a.current=null}}function tx(e,a,s){s=s!=null?s.concat([e]):null,Xi(4,4,ex.bind(null,a,e),s)}function co(){}function ax(e,a){var s=st();a=a===void 0?null:a;var l=s.memoizedState;return a!==null&&Ic(a,l[1])?l[0]:(s.memoizedState=[e,a],e)}function sx(e,a){var s=st();a=a===void 0?null:a;var l=s.memoizedState;if(a!==null&&Ic(a,l[1]))return l[0];if(l=e(),Zs){ua(!0);try{e()}finally{ua(!1)}}return s.memoizedState=[l,a],l}function oo(e,a,s){return s===void 0||(La&1073741824)!==0&&(Te&261930)===0?e.memoizedState=a:(e.memoizedState=s,e=nf(),Se.lanes|=e,fs|=e,s)}function nx(e,a,s,l){return Kt(s,a)?s:Cn.current!==null?(e=oo(e,s,l),Kt(e,a)||(rt=!0),e):(La&42)===0||(La&1073741824)!==0&&(Te&261930)===0?(rt=!0,e.memoizedState=s):(e=nf(),Se.lanes|=e,fs|=e,a)}function lx(e,a,s,l,r){var o=ee.p;ee.p=o!==0&&8>o?o:8;var x=G.T,j={};G.T=j,xo(e,!1,a,s);try{var A=r(),U=G.S;if(U!==null&&U(j,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var V=Fp(A,l);Sl(e,a,V,Jt(e))}else Sl(e,a,l,Jt(e))}catch(F){Sl(e,a,{then:function(){},status:"rejected",reason:F},Jt())}finally{ee.p=o,x!==null&&j.types!==null&&(x.types=j.types),G.T=x}}function ag(){}function uo(e,a,s,l){if(e.tag!==5)throw Error(c(476));var r=ix(e).queue;lx(e,r,a,xe,s===null?ag:function(){return rx(e),s(l)})}function ix(e){var a=e.memoizedState;if(a!==null)return a;a={memoizedState:xe,baseState:xe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_a,lastRenderedState:xe},next:null};var s={};return a.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_a,lastRenderedState:s},next:null},e.memoizedState=a,e=e.alternate,e!==null&&(e.memoizedState=a),a}function rx(e){var a=ix(e);a.next===null&&(a=e.alternate.memoizedState),Sl(e,a.next.queue,{},Jt())}function mo(){return jt(ql)}function cx(){return st().memoizedState}function ox(){return st().memoizedState}function sg(e){for(var a=e.return;a!==null;){switch(a.tag){case 24:case 3:var s=Jt();e=cs(s);var l=os(a,e,s);l!==null&&(Ht(l,a,s),yl(l,a,s)),a={cache:Hc()},e.payload=a;return}a=a.return}}function ng(e,a,s){var l=Jt();s={lane:l,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Qi(e)?ux(a,s):(s=Ec(e,a,s,l),s!==null&&(Ht(s,e,l),mx(s,a,l)))}function dx(e,a,s){var l=Jt();Sl(e,a,s,l)}function Sl(e,a,s,l){var r={lane:l,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Qi(e))ux(a,r);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=a.lastRenderedReducer,o!==null))try{var x=a.lastRenderedState,j=o(x,s);if(r.hasEagerState=!0,r.eagerState=j,Kt(j,x))return Ci(e,a,r,0),Ke===null&&zi(),!1}catch{}finally{}if(s=Ec(e,a,r,l),s!==null)return Ht(s,e,l),mx(s,a,l),!0}return!1}function xo(e,a,s,l){if(l={lane:2,revertLane:Yo(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Qi(e)){if(a)throw Error(c(479))}else a=Ec(e,s,l,2),a!==null&&Ht(a,e,2)}function Qi(e){var a=e.alternate;return e===Se||a!==null&&a===Se}function ux(e,a){An=Hi=!0;var s=e.pending;s===null?a.next=a:(a.next=s.next,s.next=a),e.pending=a}function mx(e,a,s){if((s&4194048)!==0){var l=a.lanes;l&=e.pendingLanes,s|=l,a.lanes=s,gu(e,s)}}var kl={readContext:jt,use:Ki,useCallback:We,useContext:We,useEffect:We,useImperativeHandle:We,useLayoutEffect:We,useInsertionEffect:We,useMemo:We,useReducer:We,useRef:We,useState:We,useDebugValue:We,useDeferredValue:We,useTransition:We,useSyncExternalStore:We,useId:We,useHostTransitionStatus:We,useFormState:We,useActionState:We,useOptimistic:We,useMemoCache:We,useCacheRefresh:We};kl.useEffectEvent=We;var xx={readContext:jt,use:Ki,useCallback:function(e,a){return Rt().memoizedState=[e,a===void 0?null:a],e},useContext:jt,useEffect:Fm,useImperativeHandle:function(e,a,s){s=s!=null?s.concat([e]):null,Yi(4194308,4,ex.bind(null,a,e),s)},useLayoutEffect:function(e,a){return Yi(4194308,4,e,a)},useInsertionEffect:function(e,a){Yi(4,2,e,a)},useMemo:function(e,a){var s=Rt();a=a===void 0?null:a;var l=e();if(Zs){ua(!0);try{e()}finally{ua(!1)}}return s.memoizedState=[l,a],l},useReducer:function(e,a,s){var l=Rt();if(s!==void 0){var r=s(a);if(Zs){ua(!0);try{s(a)}finally{ua(!1)}}}else r=a;return l.memoizedState=l.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},l.queue=e,e=e.dispatch=ng.bind(null,Se,e),[l.memoizedState,e]},useRef:function(e){var a=Rt();return e={current:e},a.memoizedState=e},useState:function(e){e=lo(e);var a=e.queue,s=dx.bind(null,Se,a);return a.dispatch=s,[e.memoizedState,s]},useDebugValue:co,useDeferredValue:function(e,a){var s=Rt();return oo(s,e,a)},useTransition:function(){var e=lo(!1);return e=lx.bind(null,Se,e.queue,!0,!1),Rt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,a,s){var l=Se,r=Rt();if(Me){if(s===void 0)throw Error(c(407));s=s()}else{if(s=a(),Ke===null)throw Error(c(349));(Te&127)!==0||Om(l,a,s)}r.memoizedState=s;var o={value:s,getSnapshot:a};return r.queue=o,Fm(_m.bind(null,l,o,e),[e]),l.flags|=2048,Tn(9,{destroy:void 0},Lm.bind(null,l,o,s,a),null),s},useId:function(){var e=Rt(),a=Ke.identifierPrefix;if(Me){var s=va,l=ya;s=(l&~(1<<32-Tt(l)-1)).toString(32)+s,a="_"+a+"R_"+s,s=qi++,0<s&&(a+="H"+s.toString(32)),a+="_"}else s=Ip++,a="_"+a+"r_"+s.toString(32)+"_";return e.memoizedState=a},useHostTransitionStatus:mo,useFormState:Ym,useActionState:Ym,useOptimistic:function(e){var a=Rt();a.memoizedState=a.baseState=e;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=s,a=xo.bind(null,Se,!0,s),s.dispatch=a,[e,a]},useMemoCache:ao,useCacheRefresh:function(){return Rt().memoizedState=sg.bind(null,Se)},useEffectEvent:function(e){var a=Rt(),s={impl:e};return a.memoizedState=s,function(){if((_e&2)!==0)throw Error(c(440));return s.impl.apply(void 0,arguments)}}},fo={readContext:jt,use:Ki,useCallback:ax,useContext:jt,useEffect:ro,useImperativeHandle:tx,useInsertionEffect:Pm,useLayoutEffect:Wm,useMemo:sx,useReducer:Vi,useRef:Jm,useState:function(){return Vi(_a)},useDebugValue:co,useDeferredValue:function(e,a){var s=st();return nx(s,$e.memoizedState,e,a)},useTransition:function(){var e=Vi(_a)[0],a=st().memoizedState;return[typeof e=="boolean"?e:wl(e),a]},useSyncExternalStore:Dm,useId:cx,useHostTransitionStatus:mo,useFormState:Xm,useActionState:Xm,useOptimistic:function(e,a){var s=st();return $m(s,$e,e,a)},useMemoCache:ao,useCacheRefresh:ox};fo.useEffectEvent=Im;var fx={readContext:jt,use:Ki,useCallback:ax,useContext:jt,useEffect:ro,useImperativeHandle:tx,useInsertionEffect:Pm,useLayoutEffect:Wm,useMemo:sx,useReducer:no,useRef:Jm,useState:function(){return no(_a)},useDebugValue:co,useDeferredValue:function(e,a){var s=st();return $e===null?oo(s,e,a):nx(s,$e.memoizedState,e,a)},useTransition:function(){var e=no(_a)[0],a=st().memoizedState;return[typeof e=="boolean"?e:wl(e),a]},useSyncExternalStore:Dm,useId:cx,useHostTransitionStatus:mo,useFormState:Zm,useActionState:Zm,useOptimistic:function(e,a){var s=st();return $e!==null?$m(s,$e,e,a):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:ao,useCacheRefresh:ox};fx.useEffectEvent=Im;function ho(e,a,s,l){a=e.memoizedState,s=s(l,a),s=s==null?a:v({},a,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var po={enqueueSetState:function(e,a,s){e=e._reactInternals;var l=Jt(),r=cs(l);r.payload=a,s!=null&&(r.callback=s),a=os(e,r,l),a!==null&&(Ht(a,e,l),yl(a,e,l))},enqueueReplaceState:function(e,a,s){e=e._reactInternals;var l=Jt(),r=cs(l);r.tag=1,r.payload=a,s!=null&&(r.callback=s),a=os(e,r,l),a!==null&&(Ht(a,e,l),yl(a,e,l))},enqueueForceUpdate:function(e,a){e=e._reactInternals;var s=Jt(),l=cs(s);l.tag=2,a!=null&&(l.callback=a),a=os(e,l,s),a!==null&&(Ht(a,e,s),yl(a,e,s))}};function hx(e,a,s,l,r,o,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,o,x):a.prototype&&a.prototype.isPureReactComponent?!ul(s,l)||!ul(r,o):!0}function px(e,a,s,l){e=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(s,l),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(s,l),a.state!==e&&po.enqueueReplaceState(a,a.state,null)}function Js(e,a){var s=a;if("ref"in a){s={};for(var l in a)l!=="ref"&&(s[l]=a[l])}if(e=e.defaultProps){s===a&&(s=v({},s));for(var r in e)s[r]===void 0&&(s[r]=e[r])}return s}function gx(e){ki(e)}function bx(e){console.error(e)}function yx(e){ki(e)}function Zi(e,a){try{var s=e.onUncaughtError;s(a.value,{componentStack:a.stack})}catch(l){setTimeout(function(){throw l})}}function vx(e,a,s){try{var l=e.onCaughtError;l(s.value,{componentStack:s.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function go(e,a,s){return s=cs(s),s.tag=3,s.payload={element:null},s.callback=function(){Zi(e,a)},s}function jx(e){return e=cs(e),e.tag=3,e}function Nx(e,a,s,l){var r=s.type.getDerivedStateFromError;if(typeof r=="function"){var o=l.value;e.payload=function(){return r(o)},e.callback=function(){vx(a,s,l)}}var x=s.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){vx(a,s,l),typeof r!="function"&&(hs===null?hs=new Set([this]):hs.add(this));var j=l.stack;this.componentDidCatch(l.value,{componentStack:j!==null?j:""})})}function lg(e,a,s,l,r){if(s.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(a=s.alternate,a!==null&&Nn(a,s,r,!0),s=Yt.current,s!==null){switch(s.tag){case 31:case 13:return la===null?ir():s.alternate===null&&et===0&&(et=3),s.flags&=-257,s.flags|=65536,s.lanes=r,l===Li?s.flags|=16384:(a=s.updateQueue,a===null?s.updateQueue=new Set([l]):a.add(l),Go(e,l,r)),!1;case 22:return s.flags|=65536,l===Li?s.flags|=16384:(a=s.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([l])},s.updateQueue=a):(s=a.retryQueue,s===null?a.retryQueue=new Set([l]):s.add(l)),Go(e,l,r)),!1}throw Error(c(435,s.tag))}return Go(e,l,r),ir(),!1}if(Me)return a=Yt.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=r,l!==Lc&&(e=Error(c(422),{cause:l}),fl(ta(e,s)))):(l!==Lc&&(a=Error(c(423),{cause:l}),fl(ta(a,s))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,l=ta(l,s),r=go(e.stateNode,l,r),Xc(e,r),et!==4&&(et=2)),!1;var o=Error(c(520),{cause:l});if(o=ta(o,s),Dl===null?Dl=[o]:Dl.push(o),et!==4&&(et=2),a===null)return!0;l=ta(l,s),s=a;do{switch(s.tag){case 3:return s.flags|=65536,e=r&-r,s.lanes|=e,e=go(s.stateNode,l,e),Xc(s,e),!1;case 1:if(a=s.type,o=s.stateNode,(s.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||o!==null&&typeof o.componentDidCatch=="function"&&(hs===null||!hs.has(o))))return s.flags|=65536,r&=-r,s.lanes|=r,r=jx(r),Nx(r,e,s,l),Xc(s,r),!1}s=s.return}while(s!==null);return!1}var bo=Error(c(461)),rt=!1;function Nt(e,a,s,l){a.child=e===null?zm(a,null,s,l):Qs(a,e.child,s,l)}function wx(e,a,s,l,r){s=s.render;var o=a.ref;if("ref"in l){var x={};for(var j in l)j!=="ref"&&(x[j]=l[j])}else x=l;return Ks(a),l=Pc(e,a,s,x,o,r),j=Wc(),e!==null&&!rt?(eo(e,a,r),Ua(e,a,r)):(Me&&j&&Dc(a),a.flags|=1,Nt(e,a,l,r),a.child)}function Sx(e,a,s,l,r){if(e===null){var o=s.type;return typeof o=="function"&&!Tc(o)&&o.defaultProps===void 0&&s.compare===null?(a.tag=15,a.type=o,kx(e,a,o,l,r)):(e=Ei(s.type,null,l,a,a.mode,r),e.ref=a.ref,e.return=a,a.child=e)}if(o=e.child,!zo(e,r)){var x=o.memoizedProps;if(s=s.compare,s=s!==null?s:ul,s(x,l)&&e.ref===a.ref)return Ua(e,a,r)}return a.flags|=1,e=Ra(o,l),e.ref=a.ref,e.return=a,a.child=e}function kx(e,a,s,l,r){if(e!==null){var o=e.memoizedProps;if(ul(o,l)&&e.ref===a.ref)if(rt=!1,a.pendingProps=l=o,zo(e,r))(e.flags&131072)!==0&&(rt=!0);else return a.lanes=e.lanes,Ua(e,a,r)}return yo(e,a,s,l,r)}function zx(e,a,s,l){var r=l.children,o=e!==null?e.memoizedState:null;if(e===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((a.flags&128)!==0){if(o=o!==null?o.baseLanes|s:s,e!==null){for(l=a.child=e.child,r=0;l!==null;)r=r|l.lanes|l.childLanes,l=l.sibling;l=r&~o}else l=0,a.child=null;return Cx(e,a,o,s,l)}if((s&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},e!==null&&Di(a,o!==null?o.cachePool:null),o!==null?Em(a,o):Zc(),Tm(a);else return l=a.lanes=536870912,Cx(e,a,o!==null?o.baseLanes|s:s,s,l)}else o!==null?(Di(a,o.cachePool),Em(a,o),us(),a.memoizedState=null):(e!==null&&Di(a,null),Zc(),us());return Nt(e,a,r,s),a.child}function zl(e,a){return e!==null&&e.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Cx(e,a,s,l,r){var o=Gc();return o=o===null?null:{parent:lt._currentValue,pool:o},a.memoizedState={baseLanes:s,cachePool:o},e!==null&&Di(a,null),Zc(),Tm(a),e!==null&&Nn(e,a,l,!0),a.childLanes=r,null}function Ji(e,a){return a=Ii({mode:a.mode,children:a.children},e.mode),a.ref=e.ref,e.child=a,a.return=e,a}function Ax(e,a,s){return Qs(a,e.child,null,s),e=Ji(a,a.pendingProps),e.flags|=2,Xt(a),a.memoizedState=null,e}function ig(e,a,s){var l=a.pendingProps,r=(a.flags&128)!==0;if(a.flags&=-129,e===null){if(Me){if(l.mode==="hidden")return e=Ji(a,l),a.lanes=536870912,zl(null,e);if(Fc(a),(e=Xe)?(e=qf(e,na),e=e!==null&&e.data==="&"?e:null,e!==null&&(a.memoizedState={dehydrated:e,treeContext:ss!==null?{id:ya,overflow:va}:null,retryLane:536870912,hydrationErrors:null},s=um(e),s.return=a,a.child=s,vt=a,Xe=null)):e=null,e===null)throw ls(a);return a.lanes=536870912,null}return Ji(a,l)}var o=e.memoizedState;if(o!==null){var x=o.dehydrated;if(Fc(a),r)if(a.flags&256)a.flags&=-257,a=Ax(e,a,s);else if(a.memoizedState!==null)a.child=e.child,a.flags|=128,a=null;else throw Error(c(558));else if(rt||Nn(e,a,s,!1),r=(s&e.childLanes)!==0,rt||r){if(l=Ke,l!==null&&(x=bu(l,s),x!==0&&x!==o.retryLane))throw o.retryLane=x,$s(e,x),Ht(l,e,x),bo;ir(),a=Ax(e,a,s)}else e=o.treeContext,Xe=ia(x.nextSibling),vt=a,Me=!0,ns=null,na=!1,e!==null&&fm(a,e),a=Ji(a,l),a.flags|=4096;return a}return e=Ra(e.child,{mode:l.mode,children:l.children}),e.ref=a.ref,a.child=e,e.return=a,e}function Fi(e,a){var s=a.ref;if(s===null)e!==null&&e.ref!==null&&(a.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(c(284));(e===null||e.ref!==s)&&(a.flags|=4194816)}}function yo(e,a,s,l,r){return Ks(a),s=Pc(e,a,s,l,void 0,r),l=Wc(),e!==null&&!rt?(eo(e,a,r),Ua(e,a,r)):(Me&&l&&Dc(a),a.flags|=1,Nt(e,a,s,r),a.child)}function Ex(e,a,s,l,r,o){return Ks(a),a.updateQueue=null,s=Mm(a,l,s,r),Rm(e),l=Wc(),e!==null&&!rt?(eo(e,a,o),Ua(e,a,o)):(Me&&l&&Dc(a),a.flags|=1,Nt(e,a,s,o),a.child)}function Tx(e,a,s,l,r){if(Ks(a),a.stateNode===null){var o=bn,x=s.contextType;typeof x=="object"&&x!==null&&(o=jt(x)),o=new s(l,o),a.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=po,a.stateNode=o,o._reactInternals=a,o=a.stateNode,o.props=l,o.state=a.memoizedState,o.refs={},Vc(a),x=s.contextType,o.context=typeof x=="object"&&x!==null?jt(x):bn,o.state=a.memoizedState,x=s.getDerivedStateFromProps,typeof x=="function"&&(ho(a,s,x,l),o.state=a.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(x=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),x!==o.state&&po.enqueueReplaceState(o,o.state,null),jl(a,l,o,r),vl(),o.state=a.memoizedState),typeof o.componentDidMount=="function"&&(a.flags|=4194308),l=!0}else if(e===null){o=a.stateNode;var j=a.memoizedProps,A=Js(s,j);o.props=A;var U=o.context,V=s.contextType;x=bn,typeof V=="object"&&V!==null&&(x=jt(V));var F=s.getDerivedStateFromProps;V=typeof F=="function"||typeof o.getSnapshotBeforeUpdate=="function",j=a.pendingProps!==j,V||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(j||U!==x)&&px(a,o,l,x),rs=!1;var H=a.memoizedState;o.state=H,jl(a,l,o,r),vl(),U=a.memoizedState,j||H!==U||rs?(typeof F=="function"&&(ho(a,s,F,l),U=a.memoizedState),(A=rs||hx(a,s,A,l,H,U,x))?(V||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(a.flags|=4194308)):(typeof o.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=l,a.memoizedState=U),o.props=l,o.state=U,o.context=x,l=A):(typeof o.componentDidMount=="function"&&(a.flags|=4194308),l=!1)}else{o=a.stateNode,Yc(e,a),x=a.memoizedProps,V=Js(s,x),o.props=V,F=a.pendingProps,H=o.context,U=s.contextType,A=bn,typeof U=="object"&&U!==null&&(A=jt(U)),j=s.getDerivedStateFromProps,(U=typeof j=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(x!==F||H!==A)&&px(a,o,l,A),rs=!1,H=a.memoizedState,o.state=H,jl(a,l,o,r),vl();var K=a.memoizedState;x!==F||H!==K||rs||e!==null&&e.dependencies!==null&&Ri(e.dependencies)?(typeof j=="function"&&(ho(a,s,j,l),K=a.memoizedState),(V=rs||hx(a,s,V,l,H,K,A)||e!==null&&e.dependencies!==null&&Ri(e.dependencies))?(U||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(l,K,A),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(l,K,A)),typeof o.componentDidUpdate=="function"&&(a.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof o.componentDidUpdate!="function"||x===e.memoizedProps&&H===e.memoizedState||(a.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&H===e.memoizedState||(a.flags|=1024),a.memoizedProps=l,a.memoizedState=K),o.props=l,o.state=K,o.context=A,l=V):(typeof o.componentDidUpdate!="function"||x===e.memoizedProps&&H===e.memoizedState||(a.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&H===e.memoizedState||(a.flags|=1024),l=!1)}return o=l,Fi(e,a),l=(a.flags&128)!==0,o||l?(o=a.stateNode,s=l&&typeof s.getDerivedStateFromError!="function"?null:o.render(),a.flags|=1,e!==null&&l?(a.child=Qs(a,e.child,null,r),a.child=Qs(a,null,s,r)):Nt(e,a,s,r),a.memoizedState=o.state,e=a.child):e=Ua(e,a,r),e}function Rx(e,a,s,l){return qs(),a.flags|=256,Nt(e,a,s,l),a.child}var vo={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function jo(e){return{baseLanes:e,cachePool:vm()}}function No(e,a,s){return e=e!==null?e.childLanes&~s:0,a&&(e|=Zt),e}function Mx(e,a,s){var l=a.pendingProps,r=!1,o=(a.flags&128)!==0,x;if((x=o)||(x=e!==null&&e.memoizedState===null?!1:(at.current&2)!==0),x&&(r=!0,a.flags&=-129),x=(a.flags&32)!==0,a.flags&=-33,e===null){if(Me){if(r?ds(a):us(),(e=Xe)?(e=qf(e,na),e=e!==null&&e.data!=="&"?e:null,e!==null&&(a.memoizedState={dehydrated:e,treeContext:ss!==null?{id:ya,overflow:va}:null,retryLane:536870912,hydrationErrors:null},s=um(e),s.return=a,a.child=s,vt=a,Xe=null)):e=null,e===null)throw ls(a);return nd(e)?a.lanes=32:a.lanes=536870912,null}var j=l.children;return l=l.fallback,r?(us(),r=a.mode,j=Ii({mode:"hidden",children:j},r),l=Hs(l,r,s,null),j.return=a,l.return=a,j.sibling=l,a.child=j,l=a.child,l.memoizedState=jo(s),l.childLanes=No(e,x,s),a.memoizedState=vo,zl(null,l)):(ds(a),wo(a,j))}var A=e.memoizedState;if(A!==null&&(j=A.dehydrated,j!==null)){if(o)a.flags&256?(ds(a),a.flags&=-257,a=So(e,a,s)):a.memoizedState!==null?(us(),a.child=e.child,a.flags|=128,a=null):(us(),j=l.fallback,r=a.mode,l=Ii({mode:"visible",children:l.children},r),j=Hs(j,r,s,null),j.flags|=2,l.return=a,j.return=a,l.sibling=j,a.child=l,Qs(a,e.child,null,s),l=a.child,l.memoizedState=jo(s),l.childLanes=No(e,x,s),a.memoizedState=vo,a=zl(null,l));else if(ds(a),nd(j)){if(x=j.nextSibling&&j.nextSibling.dataset,x)var U=x.dgst;x=U,l=Error(c(419)),l.stack="",l.digest=x,fl({value:l,source:null,stack:null}),a=So(e,a,s)}else if(rt||Nn(e,a,s,!1),x=(s&e.childLanes)!==0,rt||x){if(x=Ke,x!==null&&(l=bu(x,s),l!==0&&l!==A.retryLane))throw A.retryLane=l,$s(e,l),Ht(x,e,l),bo;sd(j)||ir(),a=So(e,a,s)}else sd(j)?(a.flags|=192,a.child=e.child,a=null):(e=A.treeContext,Xe=ia(j.nextSibling),vt=a,Me=!0,ns=null,na=!1,e!==null&&fm(a,e),a=wo(a,l.children),a.flags|=4096);return a}return r?(us(),j=l.fallback,r=a.mode,A=e.child,U=A.sibling,l=Ra(A,{mode:"hidden",children:l.children}),l.subtreeFlags=A.subtreeFlags&65011712,U!==null?j=Ra(U,j):(j=Hs(j,r,s,null),j.flags|=2),j.return=a,l.return=a,l.sibling=j,a.child=l,zl(null,l),l=a.child,j=e.child.memoizedState,j===null?j=jo(s):(r=j.cachePool,r!==null?(A=lt._currentValue,r=r.parent!==A?{parent:A,pool:A}:r):r=vm(),j={baseLanes:j.baseLanes|s,cachePool:r}),l.memoizedState=j,l.childLanes=No(e,x,s),a.memoizedState=vo,zl(e.child,l)):(ds(a),s=e.child,e=s.sibling,s=Ra(s,{mode:"visible",children:l.children}),s.return=a,s.sibling=null,e!==null&&(x=a.deletions,x===null?(a.deletions=[e],a.flags|=16):x.push(e)),a.child=s,a.memoizedState=null,s)}function wo(e,a){return a=Ii({mode:"visible",children:a},e.mode),a.return=e,e.child=a}function Ii(e,a){return e=Vt(22,e,null,a),e.lanes=0,e}function So(e,a,s){return Qs(a,e.child,null,s),e=wo(a,a.pendingProps.children),e.flags|=2,a.memoizedState=null,e}function Dx(e,a,s){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a),Bc(e.return,a,s)}function ko(e,a,s,l,r,o){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:l,tail:s,tailMode:r,treeForkCount:o}:(x.isBackwards=a,x.rendering=null,x.renderingStartTime=0,x.last=l,x.tail=s,x.tailMode=r,x.treeForkCount=o)}function Ox(e,a,s){var l=a.pendingProps,r=l.revealOrder,o=l.tail;l=l.children;var x=at.current,j=(x&2)!==0;if(j?(x=x&1|2,a.flags|=128):x&=1,ie(at,x),Nt(e,a,l,s),l=Me?xl:0,!j&&e!==null&&(e.flags&128)!==0)e:for(e=a.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Dx(e,s,a);else if(e.tag===19)Dx(e,s,a);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===a)break e;for(;e.sibling===null;){if(e.return===null||e.return===a)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(r){case"forwards":for(s=a.child,r=null;s!==null;)e=s.alternate,e!==null&&$i(e)===null&&(r=s),s=s.sibling;s=r,s===null?(r=a.child,a.child=null):(r=s.sibling,s.sibling=null),ko(a,!1,r,s,o,l);break;case"backwards":case"unstable_legacy-backwards":for(s=null,r=a.child,a.child=null;r!==null;){if(e=r.alternate,e!==null&&$i(e)===null){a.child=r;break}e=r.sibling,r.sibling=s,s=r,r=e}ko(a,!0,s,null,o,l);break;case"together":ko(a,!1,null,null,void 0,l);break;default:a.memoizedState=null}return a.child}function Ua(e,a,s){if(e!==null&&(a.dependencies=e.dependencies),fs|=a.lanes,(s&a.childLanes)===0)if(e!==null){if(Nn(e,a,s,!1),(s&a.childLanes)===0)return null}else return null;if(e!==null&&a.child!==e.child)throw Error(c(153));if(a.child!==null){for(e=a.child,s=Ra(e,e.pendingProps),a.child=s,s.return=a;e.sibling!==null;)e=e.sibling,s=s.sibling=Ra(e,e.pendingProps),s.return=a;s.sibling=null}return a.child}function zo(e,a){return(e.lanes&a)!==0?!0:(e=e.dependencies,!!(e!==null&&Ri(e)))}function rg(e,a,s){switch(a.tag){case 3:Ce(a,a.stateNode.containerInfo),is(a,lt,e.memoizedState.cache),qs();break;case 27:case 5:Ze(a);break;case 4:Ce(a,a.stateNode.containerInfo);break;case 10:is(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Fc(a),null;break;case 13:var l=a.memoizedState;if(l!==null)return l.dehydrated!==null?(ds(a),a.flags|=128,null):(s&a.child.childLanes)!==0?Mx(e,a,s):(ds(a),e=Ua(e,a,s),e!==null?e.sibling:null);ds(a);break;case 19:var r=(e.flags&128)!==0;if(l=(s&a.childLanes)!==0,l||(Nn(e,a,s,!1),l=(s&a.childLanes)!==0),r){if(l)return Ox(e,a,s);a.flags|=128}if(r=a.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),ie(at,at.current),l)break;return null;case 22:return a.lanes=0,zx(e,a,s,a.pendingProps);case 24:is(a,lt,e.memoizedState.cache)}return Ua(e,a,s)}function Lx(e,a,s){if(e!==null)if(e.memoizedProps!==a.pendingProps)rt=!0;else{if(!zo(e,s)&&(a.flags&128)===0)return rt=!1,rg(e,a,s);rt=(e.flags&131072)!==0}else rt=!1,Me&&(a.flags&1048576)!==0&&xm(a,xl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var l=a.pendingProps;if(e=Ys(a.elementType),a.type=e,typeof e=="function")Tc(e)?(l=Js(e,l),a.tag=1,a=Tx(null,a,e,l,s)):(a.tag=0,a=yo(null,a,e,l,s));else{if(e!=null){var r=e.$$typeof;if(r===E){a.tag=11,a=wx(null,a,e,l,s);break e}else if(r===B){a.tag=14,a=Sx(null,a,e,l,s);break e}}throw a=re(e)||e,Error(c(306,a,""))}}return a;case 0:return yo(e,a,a.type,a.pendingProps,s);case 1:return l=a.type,r=Js(l,a.pendingProps),Tx(e,a,l,r,s);case 3:e:{if(Ce(a,a.stateNode.containerInfo),e===null)throw Error(c(387));l=a.pendingProps;var o=a.memoizedState;r=o.element,Yc(e,a),jl(a,l,null,s);var x=a.memoizedState;if(l=x.cache,is(a,lt,l),l!==o.cache&&$c(a,[lt],s,!0),vl(),l=x.element,o.isDehydrated)if(o={element:l,isDehydrated:!1,cache:x.cache},a.updateQueue.baseState=o,a.memoizedState=o,a.flags&256){a=Rx(e,a,l,s);break e}else if(l!==r){r=ta(Error(c(424)),a),fl(r),a=Rx(e,a,l,s);break e}else{switch(e=a.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Xe=ia(e.firstChild),vt=a,Me=!0,ns=null,na=!0,s=zm(a,null,l,s),a.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if(qs(),l===r){a=Ua(e,a,s);break e}Nt(e,a,l,s)}a=a.child}return a;case 26:return Fi(e,a),e===null?(s=Qf(a.type,null,a.pendingProps,null))?a.memoizedState=s:Me||(s=a.type,e=a.pendingProps,l=xr(me.current).createElement(s),l[yt]=a,l[Ot]=e,wt(l,s,e),ft(l),a.stateNode=l):a.memoizedState=Qf(a.type,e.memoizedProps,a.pendingProps,e.memoizedState),null;case 27:return Ze(a),e===null&&Me&&(l=a.stateNode=Vf(a.type,a.pendingProps,me.current),vt=a,na=!0,r=Xe,ys(a.type)?(ld=r,Xe=ia(l.firstChild)):Xe=r),Nt(e,a,a.pendingProps.children,s),Fi(e,a),e===null&&(a.flags|=4194304),a.child;case 5:return e===null&&Me&&((r=l=Xe)&&(l=Ug(l,a.type,a.pendingProps,na),l!==null?(a.stateNode=l,vt=a,Xe=ia(l.firstChild),na=!1,r=!0):r=!1),r||ls(a)),Ze(a),r=a.type,o=a.pendingProps,x=e!==null?e.memoizedProps:null,l=o.children,ed(r,o)?l=null:x!==null&&ed(r,x)&&(a.flags|=32),a.memoizedState!==null&&(r=Pc(e,a,Pp,null,null,s),ql._currentValue=r),Fi(e,a),Nt(e,a,l,s),a.child;case 6:return e===null&&Me&&((e=s=Xe)&&(s=Bg(s,a.pendingProps,na),s!==null?(a.stateNode=s,vt=a,Xe=null,e=!0):e=!1),e||ls(a)),null;case 13:return Mx(e,a,s);case 4:return Ce(a,a.stateNode.containerInfo),l=a.pendingProps,e===null?a.child=Qs(a,null,l,s):Nt(e,a,l,s),a.child;case 11:return wx(e,a,a.type,a.pendingProps,s);case 7:return Nt(e,a,a.pendingProps,s),a.child;case 8:return Nt(e,a,a.pendingProps.children,s),a.child;case 12:return Nt(e,a,a.pendingProps.children,s),a.child;case 10:return l=a.pendingProps,is(a,a.type,l.value),Nt(e,a,l.children,s),a.child;case 9:return r=a.type._context,l=a.pendingProps.children,Ks(a),r=jt(r),l=l(r),a.flags|=1,Nt(e,a,l,s),a.child;case 14:return Sx(e,a,a.type,a.pendingProps,s);case 15:return kx(e,a,a.type,a.pendingProps,s);case 19:return Ox(e,a,s);case 31:return ig(e,a,s);case 22:return zx(e,a,s,a.pendingProps);case 24:return Ks(a),l=jt(lt),e===null?(r=Gc(),r===null&&(r=Ke,o=Hc(),r.pooledCache=o,o.refCount++,o!==null&&(r.pooledCacheLanes|=s),r=o),a.memoizedState={parent:l,cache:r},Vc(a),is(a,lt,r)):((e.lanes&s)!==0&&(Yc(e,a),jl(a,null,null,s),vl()),r=e.memoizedState,o=a.memoizedState,r.parent!==l?(r={parent:l,cache:l},a.memoizedState=r,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=r),is(a,lt,l)):(l=o.cache,is(a,lt,l),l!==r.cache&&$c(a,[lt],s,!0))),Nt(e,a,a.pendingProps.children,s),a.child;case 29:throw a.pendingProps}throw Error(c(156,a.tag))}function Ba(e){e.flags|=4}function Co(e,a,s,l,r){if((a=(e.mode&32)!==0)&&(a=!1),a){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(of())e.flags|=8192;else throw Xs=Li,Kc}else e.flags&=-16777217}function _x(e,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Pf(a))if(of())e.flags|=8192;else throw Xs=Li,Kc}function Pi(e,a){a!==null&&(e.flags|=4),e.flags&16384&&(a=e.tag!==22?hu():536870912,e.lanes|=a,On|=a)}function Cl(e,a){if(!Me)switch(e.tailMode){case"hidden":a=e.tail;for(var s=null;a!==null;)a.alternate!==null&&(s=a),a=a.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var l=null;s!==null;)s.alternate!==null&&(l=s),s=s.sibling;l===null?a||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function Qe(e){var a=e.alternate!==null&&e.alternate.child===e.child,s=0,l=0;if(a)for(var r=e.child;r!==null;)s|=r.lanes|r.childLanes,l|=r.subtreeFlags&65011712,l|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)s|=r.lanes|r.childLanes,l|=r.subtreeFlags,l|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=l,e.childLanes=s,a}function cg(e,a,s){var l=a.pendingProps;switch(Oc(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qe(a),null;case 1:return Qe(a),null;case 3:return s=a.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),a.memoizedState.cache!==l&&(a.flags|=2048),Oa(lt),je(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(jn(a)?Ba(a):e===null||e.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,_c())),Qe(a),null;case 26:var r=a.type,o=a.memoizedState;return e===null?(Ba(a),o!==null?(Qe(a),_x(a,o)):(Qe(a),Co(a,r,null,l,s))):o?o!==e.memoizedState?(Ba(a),Qe(a),_x(a,o)):(Qe(a),a.flags&=-16777217):(e=e.memoizedProps,e!==l&&Ba(a),Qe(a),Co(a,r,e,l,s)),null;case 27:if(Pe(a),s=me.current,r=a.type,e!==null&&a.stateNode!=null)e.memoizedProps!==l&&Ba(a);else{if(!l){if(a.stateNode===null)throw Error(c(166));return Qe(a),null}e=$.current,jn(a)?hm(a):(e=Vf(r,l,s),a.stateNode=e,Ba(a))}return Qe(a),null;case 5:if(Pe(a),r=a.type,e!==null&&a.stateNode!=null)e.memoizedProps!==l&&Ba(a);else{if(!l){if(a.stateNode===null)throw Error(c(166));return Qe(a),null}if(o=$.current,jn(a))hm(a);else{var x=xr(me.current);switch(o){case 1:o=x.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:o=x.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":o=x.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":o=x.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":o=x.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof l.is=="string"?x.createElement("select",{is:l.is}):x.createElement("select"),l.multiple?o.multiple=!0:l.size&&(o.size=l.size);break;default:o=typeof l.is=="string"?x.createElement(r,{is:l.is}):x.createElement(r)}}o[yt]=a,o[Ot]=l;e:for(x=a.child;x!==null;){if(x.tag===5||x.tag===6)o.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===a)break e;for(;x.sibling===null;){if(x.return===null||x.return===a)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}a.stateNode=o;e:switch(wt(o,r,l),r){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Ba(a)}}return Qe(a),Co(a,a.type,e===null?null:e.memoizedProps,a.pendingProps,s),null;case 6:if(e&&a.stateNode!=null)e.memoizedProps!==l&&Ba(a);else{if(typeof l!="string"&&a.stateNode===null)throw Error(c(166));if(e=me.current,jn(a)){if(e=a.stateNode,s=a.memoizedProps,l=null,r=vt,r!==null)switch(r.tag){case 27:case 5:l=r.memoizedProps}e[yt]=a,e=!!(e.nodeValue===s||l!==null&&l.suppressHydrationWarning===!0||Df(e.nodeValue,s)),e||ls(a,!0)}else e=xr(e).createTextNode(l),e[yt]=a,a.stateNode=e}return Qe(a),null;case 31:if(s=a.memoizedState,e===null||e.memoizedState!==null){if(l=jn(a),s!==null){if(e===null){if(!l)throw Error(c(318));if(e=a.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(557));e[yt]=a}else qs(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Qe(a),e=!1}else s=_c(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return a.flags&256?(Xt(a),a):(Xt(a),null);if((a.flags&128)!==0)throw Error(c(558))}return Qe(a),null;case 13:if(l=a.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=jn(a),l!==null&&l.dehydrated!==null){if(e===null){if(!r)throw Error(c(318));if(r=a.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(c(317));r[yt]=a}else qs(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Qe(a),r=!1}else r=_c(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return a.flags&256?(Xt(a),a):(Xt(a),null)}return Xt(a),(a.flags&128)!==0?(a.lanes=s,a):(s=l!==null,e=e!==null&&e.memoizedState!==null,s&&(l=a.child,r=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(r=l.alternate.memoizedState.cachePool.pool),o=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(o=l.memoizedState.cachePool.pool),o!==r&&(l.flags|=2048)),s!==e&&s&&(a.child.flags|=8192),Pi(a,a.updateQueue),Qe(a),null);case 4:return je(),e===null&&Jo(a.stateNode.containerInfo),Qe(a),null;case 10:return Oa(a.type),Qe(a),null;case 19:if(Y(at),l=a.memoizedState,l===null)return Qe(a),null;if(r=(a.flags&128)!==0,o=l.rendering,o===null)if(r)Cl(l,!1);else{if(et!==0||e!==null&&(e.flags&128)!==0)for(e=a.child;e!==null;){if(o=$i(e),o!==null){for(a.flags|=128,Cl(l,!1),e=o.updateQueue,a.updateQueue=e,Pi(a,e),a.subtreeFlags=0,e=s,s=a.child;s!==null;)dm(s,e),s=s.sibling;return ie(at,at.current&1|2),Me&&Ma(a,l.treeForkCount),a.child}e=e.sibling}l.tail!==null&&pe()>sr&&(a.flags|=128,r=!0,Cl(l,!1),a.lanes=4194304)}else{if(!r)if(e=$i(o),e!==null){if(a.flags|=128,r=!0,e=e.updateQueue,a.updateQueue=e,Pi(a,e),Cl(l,!0),l.tail===null&&l.tailMode==="hidden"&&!o.alternate&&!Me)return Qe(a),null}else 2*pe()-l.renderingStartTime>sr&&s!==536870912&&(a.flags|=128,r=!0,Cl(l,!1),a.lanes=4194304);l.isBackwards?(o.sibling=a.child,a.child=o):(e=l.last,e!==null?e.sibling=o:a.child=o,l.last=o)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=pe(),e.sibling=null,s=at.current,ie(at,r?s&1|2:s&1),Me&&Ma(a,l.treeForkCount),e):(Qe(a),null);case 22:case 23:return Xt(a),Jc(),l=a.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(a.flags|=8192):l&&(a.flags|=8192),l?(s&536870912)!==0&&(a.flags&128)===0&&(Qe(a),a.subtreeFlags&6&&(a.flags|=8192)):Qe(a),s=a.updateQueue,s!==null&&Pi(a,s.retryQueue),s=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),l=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(l=a.memoizedState.cachePool.pool),l!==s&&(a.flags|=2048),e!==null&&Y(Vs),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),a.memoizedState.cache!==s&&(a.flags|=2048),Oa(lt),Qe(a),null;case 25:return null;case 30:return null}throw Error(c(156,a.tag))}function og(e,a){switch(Oc(a),a.tag){case 1:return e=a.flags,e&65536?(a.flags=e&-65537|128,a):null;case 3:return Oa(lt),je(),e=a.flags,(e&65536)!==0&&(e&128)===0?(a.flags=e&-65537|128,a):null;case 26:case 27:case 5:return Pe(a),null;case 31:if(a.memoizedState!==null){if(Xt(a),a.alternate===null)throw Error(c(340));qs()}return e=a.flags,e&65536?(a.flags=e&-65537|128,a):null;case 13:if(Xt(a),e=a.memoizedState,e!==null&&e.dehydrated!==null){if(a.alternate===null)throw Error(c(340));qs()}return e=a.flags,e&65536?(a.flags=e&-65537|128,a):null;case 19:return Y(at),null;case 4:return je(),null;case 10:return Oa(a.type),null;case 22:case 23:return Xt(a),Jc(),e!==null&&Y(Vs),e=a.flags,e&65536?(a.flags=e&-65537|128,a):null;case 24:return Oa(lt),null;case 25:return null;default:return null}}function Ux(e,a){switch(Oc(a),a.tag){case 3:Oa(lt),je();break;case 26:case 27:case 5:Pe(a);break;case 4:je();break;case 31:a.memoizedState!==null&&Xt(a);break;case 13:Xt(a);break;case 19:Y(at);break;case 10:Oa(a.type);break;case 22:case 23:Xt(a),Jc(),e!==null&&Y(Vs);break;case 24:Oa(lt)}}function Al(e,a){try{var s=a.updateQueue,l=s!==null?s.lastEffect:null;if(l!==null){var r=l.next;s=r;do{if((s.tag&e)===e){l=void 0;var o=s.create,x=s.inst;l=o(),x.destroy=l}s=s.next}while(s!==r)}}catch(j){Be(a,a.return,j)}}function ms(e,a,s){try{var l=a.updateQueue,r=l!==null?l.lastEffect:null;if(r!==null){var o=r.next;l=o;do{if((l.tag&e)===e){var x=l.inst,j=x.destroy;if(j!==void 0){x.destroy=void 0,r=a;var A=s,U=j;try{U()}catch(V){Be(r,A,V)}}}l=l.next}while(l!==o)}}catch(V){Be(a,a.return,V)}}function Bx(e){var a=e.updateQueue;if(a!==null){var s=e.stateNode;try{Am(a,s)}catch(l){Be(e,e.return,l)}}}function $x(e,a,s){s.props=Js(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(l){Be(e,a,l)}}function El(e,a){try{var s=e.ref;if(s!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof s=="function"?e.refCleanup=s(l):s.current=l}}catch(r){Be(e,a,r)}}function ja(e,a){var s=e.ref,l=e.refCleanup;if(s!==null)if(typeof l=="function")try{l()}catch(r){Be(e,a,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(r){Be(e,a,r)}else s.current=null}function Hx(e){var a=e.type,s=e.memoizedProps,l=e.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":s.autoFocus&&l.focus();break e;case"img":s.src?l.src=s.src:s.srcSet&&(l.srcset=s.srcSet)}}catch(r){Be(e,e.return,r)}}function Ao(e,a,s){try{var l=e.stateNode;Rg(l,e.type,s,a),l[Ot]=a}catch(r){Be(e,e.return,r)}}function qx(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ys(e.type)||e.tag===4}function Eo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qx(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ys(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function To(e,a,s){var l=e.tag;if(l===5||l===6)e=e.stateNode,a?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(e,a):(a=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,a.appendChild(e),s=s._reactRootContainer,s!=null||a.onclick!==null||(a.onclick=Ea));else if(l!==4&&(l===27&&ys(e.type)&&(s=e.stateNode,a=null),e=e.child,e!==null))for(To(e,a,s),e=e.sibling;e!==null;)To(e,a,s),e=e.sibling}function Wi(e,a,s){var l=e.tag;if(l===5||l===6)e=e.stateNode,a?s.insertBefore(e,a):s.appendChild(e);else if(l!==4&&(l===27&&ys(e.type)&&(s=e.stateNode),e=e.child,e!==null))for(Wi(e,a,s),e=e.sibling;e!==null;)Wi(e,a,s),e=e.sibling}function Gx(e){var a=e.stateNode,s=e.memoizedProps;try{for(var l=e.type,r=a.attributes;r.length;)a.removeAttributeNode(r[0]);wt(a,l,s),a[yt]=e,a[Ot]=s}catch(o){Be(e,e.return,o)}}var $a=!1,ct=!1,Ro=!1,Kx=typeof WeakSet=="function"?WeakSet:Set,ht=null;function dg(e,a){if(e=e.containerInfo,Po=vr,e=tm(e),wc(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var l=s.getSelection&&s.getSelection();if(l&&l.rangeCount!==0){s=l.anchorNode;var r=l.anchorOffset,o=l.focusNode;l=l.focusOffset;try{s.nodeType,o.nodeType}catch{s=null;break e}var x=0,j=-1,A=-1,U=0,V=0,F=e,H=null;t:for(;;){for(var K;F!==s||r!==0&&F.nodeType!==3||(j=x+r),F!==o||l!==0&&F.nodeType!==3||(A=x+l),F.nodeType===3&&(x+=F.nodeValue.length),(K=F.firstChild)!==null;)H=F,F=K;for(;;){if(F===e)break t;if(H===s&&++U===r&&(j=x),H===o&&++V===l&&(A=x),(K=F.nextSibling)!==null)break;F=H,H=F.parentNode}F=K}s=j===-1||A===-1?null:{start:j,end:A}}else s=null}s=s||{start:0,end:0}}else s=null;for(Wo={focusedElem:e,selectionRange:s},vr=!1,ht=a;ht!==null;)if(a=ht,e=a.child,(a.subtreeFlags&1028)!==0&&e!==null)e.return=a,ht=e;else for(;ht!==null;){switch(a=ht,o=a.alternate,e=a.flags,a.tag){case 0:if((e&4)!==0&&(e=a.updateQueue,e=e!==null?e.events:null,e!==null))for(s=0;s<e.length;s++)r=e[s],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&o!==null){e=void 0,s=a,r=o.memoizedProps,o=o.memoizedState,l=s.stateNode;try{var ue=Js(s.type,r);e=l.getSnapshotBeforeUpdate(ue,o),l.__reactInternalSnapshotBeforeUpdate=e}catch(ye){Be(s,s.return,ye)}}break;case 3:if((e&1024)!==0){if(e=a.stateNode.containerInfo,s=e.nodeType,s===9)ad(e);else if(s===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":ad(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(c(163))}if(e=a.sibling,e!==null){e.return=a.return,ht=e;break}ht=a.return}}function Vx(e,a,s){var l=s.flags;switch(s.tag){case 0:case 11:case 15:qa(e,s),l&4&&Al(5,s);break;case 1:if(qa(e,s),l&4)if(e=s.stateNode,a===null)try{e.componentDidMount()}catch(x){Be(s,s.return,x)}else{var r=Js(s.type,a.memoizedProps);a=a.memoizedState;try{e.componentDidUpdate(r,a,e.__reactInternalSnapshotBeforeUpdate)}catch(x){Be(s,s.return,x)}}l&64&&Bx(s),l&512&&El(s,s.return);break;case 3:if(qa(e,s),l&64&&(e=s.updateQueue,e!==null)){if(a=null,s.child!==null)switch(s.child.tag){case 27:case 5:a=s.child.stateNode;break;case 1:a=s.child.stateNode}try{Am(e,a)}catch(x){Be(s,s.return,x)}}break;case 27:a===null&&l&4&&Gx(s);case 26:case 5:qa(e,s),a===null&&l&4&&Hx(s),l&512&&El(s,s.return);break;case 12:qa(e,s);break;case 31:qa(e,s),l&4&&Qx(e,s);break;case 13:qa(e,s),l&4&&Zx(e,s),l&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=yg.bind(null,s),$g(e,s))));break;case 22:if(l=s.memoizedState!==null||$a,!l){a=a!==null&&a.memoizedState!==null||ct,r=$a;var o=ct;$a=l,(ct=a)&&!o?Ga(e,s,(s.subtreeFlags&8772)!==0):qa(e,s),$a=r,ct=o}break;case 30:break;default:qa(e,s)}}function Yx(e){var a=e.alternate;a!==null&&(e.alternate=null,Yx(a)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(a=e.stateNode,a!==null&&ic(a)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Fe=null,_t=!1;function Ha(e,a,s){for(s=s.child;s!==null;)Xx(e,a,s),s=s.sibling}function Xx(e,a,s){if(bt&&typeof bt.onCommitFiberUnmount=="function")try{bt.onCommitFiberUnmount(ba,s)}catch{}switch(s.tag){case 26:ct||ja(s,a),Ha(e,a,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:ct||ja(s,a);var l=Fe,r=_t;ys(s.type)&&(Fe=s.stateNode,_t=!1),Ha(e,a,s),Bl(s.stateNode),Fe=l,_t=r;break;case 5:ct||ja(s,a);case 6:if(l=Fe,r=_t,Fe=null,Ha(e,a,s),Fe=l,_t=r,Fe!==null)if(_t)try{(Fe.nodeType===9?Fe.body:Fe.nodeName==="HTML"?Fe.ownerDocument.body:Fe).removeChild(s.stateNode)}catch(o){Be(s,a,o)}else try{Fe.removeChild(s.stateNode)}catch(o){Be(s,a,o)}break;case 18:Fe!==null&&(_t?(e=Fe,$f(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),Gn(e)):$f(Fe,s.stateNode));break;case 4:l=Fe,r=_t,Fe=s.stateNode.containerInfo,_t=!0,Ha(e,a,s),Fe=l,_t=r;break;case 0:case 11:case 14:case 15:ms(2,s,a),ct||ms(4,s,a),Ha(e,a,s);break;case 1:ct||(ja(s,a),l=s.stateNode,typeof l.componentWillUnmount=="function"&&$x(s,a,l)),Ha(e,a,s);break;case 21:Ha(e,a,s);break;case 22:ct=(l=ct)||s.memoizedState!==null,Ha(e,a,s),ct=l;break;default:Ha(e,a,s)}}function Qx(e,a){if(a.memoizedState===null&&(e=a.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Gn(e)}catch(s){Be(a,a.return,s)}}}function Zx(e,a){if(a.memoizedState===null&&(e=a.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Gn(e)}catch(s){Be(a,a.return,s)}}function ug(e){switch(e.tag){case 31:case 13:case 19:var a=e.stateNode;return a===null&&(a=e.stateNode=new Kx),a;case 22:return e=e.stateNode,a=e._retryCache,a===null&&(a=e._retryCache=new Kx),a;default:throw Error(c(435,e.tag))}}function er(e,a){var s=ug(e);a.forEach(function(l){if(!s.has(l)){s.add(l);var r=vg.bind(null,e,l);l.then(r,r)}})}function Ut(e,a){var s=a.deletions;if(s!==null)for(var l=0;l<s.length;l++){var r=s[l],o=e,x=a,j=x;e:for(;j!==null;){switch(j.tag){case 27:if(ys(j.type)){Fe=j.stateNode,_t=!1;break e}break;case 5:Fe=j.stateNode,_t=!1;break e;case 3:case 4:Fe=j.stateNode.containerInfo,_t=!0;break e}j=j.return}if(Fe===null)throw Error(c(160));Xx(o,x,r),Fe=null,_t=!1,o=r.alternate,o!==null&&(o.return=null),r.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Jx(a,e),a=a.sibling}var xa=null;function Jx(e,a){var s=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ut(a,e),Bt(e),l&4&&(ms(3,e,e.return),Al(3,e),ms(5,e,e.return));break;case 1:Ut(a,e),Bt(e),l&512&&(ct||s===null||ja(s,s.return)),l&64&&$a&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(s=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=s===null?l:s.concat(l))));break;case 26:var r=xa;if(Ut(a,e),Bt(e),l&512&&(ct||s===null||ja(s,s.return)),l&4){var o=s!==null?s.memoizedState:null;if(l=e.memoizedState,s===null)if(l===null)if(e.stateNode===null){e:{l=e.type,s=e.memoizedProps,r=r.ownerDocument||r;t:switch(l){case"title":o=r.getElementsByTagName("title")[0],(!o||o[al]||o[yt]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=r.createElement(l),r.head.insertBefore(o,r.querySelector("head > title"))),wt(o,l,s),o[yt]=e,ft(o),l=o;break e;case"link":var x=Ff("link","href",r).get(l+(s.href||""));if(x){for(var j=0;j<x.length;j++)if(o=x[j],o.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&o.getAttribute("rel")===(s.rel==null?null:s.rel)&&o.getAttribute("title")===(s.title==null?null:s.title)&&o.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){x.splice(j,1);break t}}o=r.createElement(l),wt(o,l,s),r.head.appendChild(o);break;case"meta":if(x=Ff("meta","content",r).get(l+(s.content||""))){for(j=0;j<x.length;j++)if(o=x[j],o.getAttribute("content")===(s.content==null?null:""+s.content)&&o.getAttribute("name")===(s.name==null?null:s.name)&&o.getAttribute("property")===(s.property==null?null:s.property)&&o.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&o.getAttribute("charset")===(s.charSet==null?null:s.charSet)){x.splice(j,1);break t}}o=r.createElement(l),wt(o,l,s),r.head.appendChild(o);break;default:throw Error(c(468,l))}o[yt]=e,ft(o),l=o}e.stateNode=l}else If(r,e.type,e.stateNode);else e.stateNode=Jf(r,l,e.memoizedProps);else o!==l?(o===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):o.count--,l===null?If(r,e.type,e.stateNode):Jf(r,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Ao(e,e.memoizedProps,s.memoizedProps)}break;case 27:Ut(a,e),Bt(e),l&512&&(ct||s===null||ja(s,s.return)),s!==null&&l&4&&Ao(e,e.memoizedProps,s.memoizedProps);break;case 5:if(Ut(a,e),Bt(e),l&512&&(ct||s===null||ja(s,s.return)),e.flags&32){r=e.stateNode;try{un(r,"")}catch(ue){Be(e,e.return,ue)}}l&4&&e.stateNode!=null&&(r=e.memoizedProps,Ao(e,r,s!==null?s.memoizedProps:r)),l&1024&&(Ro=!0);break;case 6:if(Ut(a,e),Bt(e),l&4){if(e.stateNode===null)throw Error(c(162));l=e.memoizedProps,s=e.stateNode;try{s.nodeValue=l}catch(ue){Be(e,e.return,ue)}}break;case 3:if(pr=null,r=xa,xa=fr(a.containerInfo),Ut(a,e),xa=r,Bt(e),l&4&&s!==null&&s.memoizedState.isDehydrated)try{Gn(a.containerInfo)}catch(ue){Be(e,e.return,ue)}Ro&&(Ro=!1,Fx(e));break;case 4:l=xa,xa=fr(e.stateNode.containerInfo),Ut(a,e),Bt(e),xa=l;break;case 12:Ut(a,e),Bt(e);break;case 31:Ut(a,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,er(e,l)));break;case 13:Ut(a,e),Bt(e),e.child.flags&8192&&e.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(ar=pe()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,er(e,l)));break;case 22:r=e.memoizedState!==null;var A=s!==null&&s.memoizedState!==null,U=$a,V=ct;if($a=U||r,ct=V||A,Ut(a,e),ct=V,$a=U,Bt(e),l&8192)e:for(a=e.stateNode,a._visibility=r?a._visibility&-2:a._visibility|1,r&&(s===null||A||$a||ct||Fs(e)),s=null,a=e;;){if(a.tag===5||a.tag===26){if(s===null){A=s=a;try{if(o=A.stateNode,r)x=o.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{j=A.stateNode;var F=A.memoizedProps.style,H=F!=null&&F.hasOwnProperty("display")?F.display:null;j.style.display=H==null||typeof H=="boolean"?"":(""+H).trim()}}catch(ue){Be(A,A.return,ue)}}}else if(a.tag===6){if(s===null){A=a;try{A.stateNode.nodeValue=r?"":A.memoizedProps}catch(ue){Be(A,A.return,ue)}}}else if(a.tag===18){if(s===null){A=a;try{var K=A.stateNode;r?Hf(K,!0):Hf(A.stateNode,!1)}catch(ue){Be(A,A.return,ue)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===e)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===e)break e;for(;a.sibling===null;){if(a.return===null||a.return===e)break e;s===a&&(s=null),a=a.return}s===a&&(s=null),a.sibling.return=a.return,a=a.sibling}l&4&&(l=e.updateQueue,l!==null&&(s=l.retryQueue,s!==null&&(l.retryQueue=null,er(e,s))));break;case 19:Ut(a,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,er(e,l)));break;case 30:break;case 21:break;default:Ut(a,e),Bt(e)}}function Bt(e){var a=e.flags;if(a&2){try{for(var s,l=e.return;l!==null;){if(qx(l)){s=l;break}l=l.return}if(s==null)throw Error(c(160));switch(s.tag){case 27:var r=s.stateNode,o=Eo(e);Wi(e,o,r);break;case 5:var x=s.stateNode;s.flags&32&&(un(x,""),s.flags&=-33);var j=Eo(e);Wi(e,j,x);break;case 3:case 4:var A=s.stateNode.containerInfo,U=Eo(e);To(e,U,A);break;default:throw Error(c(161))}}catch(V){Be(e,e.return,V)}e.flags&=-3}a&4096&&(e.flags&=-4097)}function Fx(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var a=e;Fx(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),e=e.sibling}}function qa(e,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Vx(e,a.alternate,a),a=a.sibling}function Fs(e){for(e=e.child;e!==null;){var a=e;switch(a.tag){case 0:case 11:case 14:case 15:ms(4,a,a.return),Fs(a);break;case 1:ja(a,a.return);var s=a.stateNode;typeof s.componentWillUnmount=="function"&&$x(a,a.return,s),Fs(a);break;case 27:Bl(a.stateNode);case 26:case 5:ja(a,a.return),Fs(a);break;case 22:a.memoizedState===null&&Fs(a);break;case 30:Fs(a);break;default:Fs(a)}e=e.sibling}}function Ga(e,a,s){for(s=s&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var l=a.alternate,r=e,o=a,x=o.flags;switch(o.tag){case 0:case 11:case 15:Ga(r,o,s),Al(4,o);break;case 1:if(Ga(r,o,s),l=o,r=l.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(U){Be(l,l.return,U)}if(l=o,r=l.updateQueue,r!==null){var j=l.stateNode;try{var A=r.shared.hiddenCallbacks;if(A!==null)for(r.shared.hiddenCallbacks=null,r=0;r<A.length;r++)Cm(A[r],j)}catch(U){Be(l,l.return,U)}}s&&x&64&&Bx(o),El(o,o.return);break;case 27:Gx(o);case 26:case 5:Ga(r,o,s),s&&l===null&&x&4&&Hx(o),El(o,o.return);break;case 12:Ga(r,o,s);break;case 31:Ga(r,o,s),s&&x&4&&Qx(r,o);break;case 13:Ga(r,o,s),s&&x&4&&Zx(r,o);break;case 22:o.memoizedState===null&&Ga(r,o,s),El(o,o.return);break;case 30:break;default:Ga(r,o,s)}a=a.sibling}}function Mo(e,a){var s=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),e=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(e=a.memoizedState.cachePool.pool),e!==s&&(e!=null&&e.refCount++,s!=null&&hl(s))}function Do(e,a){e=null,a.alternate!==null&&(e=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==e&&(a.refCount++,e!=null&&hl(e))}function fa(e,a,s,l){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Ix(e,a,s,l),a=a.sibling}function Ix(e,a,s,l){var r=a.flags;switch(a.tag){case 0:case 11:case 15:fa(e,a,s,l),r&2048&&Al(9,a);break;case 1:fa(e,a,s,l);break;case 3:fa(e,a,s,l),r&2048&&(e=null,a.alternate!==null&&(e=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==e&&(a.refCount++,e!=null&&hl(e)));break;case 12:if(r&2048){fa(e,a,s,l),e=a.stateNode;try{var o=a.memoizedProps,x=o.id,j=o.onPostCommit;typeof j=="function"&&j(x,a.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(A){Be(a,a.return,A)}}else fa(e,a,s,l);break;case 31:fa(e,a,s,l);break;case 13:fa(e,a,s,l);break;case 23:break;case 22:o=a.stateNode,x=a.alternate,a.memoizedState!==null?o._visibility&2?fa(e,a,s,l):Tl(e,a):o._visibility&2?fa(e,a,s,l):(o._visibility|=2,Rn(e,a,s,l,(a.subtreeFlags&10256)!==0||!1)),r&2048&&Mo(x,a);break;case 24:fa(e,a,s,l),r&2048&&Do(a.alternate,a);break;default:fa(e,a,s,l)}}function Rn(e,a,s,l,r){for(r=r&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var o=e,x=a,j=s,A=l,U=x.flags;switch(x.tag){case 0:case 11:case 15:Rn(o,x,j,A,r),Al(8,x);break;case 23:break;case 22:var V=x.stateNode;x.memoizedState!==null?V._visibility&2?Rn(o,x,j,A,r):Tl(o,x):(V._visibility|=2,Rn(o,x,j,A,r)),r&&U&2048&&Mo(x.alternate,x);break;case 24:Rn(o,x,j,A,r),r&&U&2048&&Do(x.alternate,x);break;default:Rn(o,x,j,A,r)}a=a.sibling}}function Tl(e,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var s=e,l=a,r=l.flags;switch(l.tag){case 22:Tl(s,l),r&2048&&Mo(l.alternate,l);break;case 24:Tl(s,l),r&2048&&Do(l.alternate,l);break;default:Tl(s,l)}a=a.sibling}}var Rl=8192;function Mn(e,a,s){if(e.subtreeFlags&Rl)for(e=e.child;e!==null;)Px(e,a,s),e=e.sibling}function Px(e,a,s){switch(e.tag){case 26:Mn(e,a,s),e.flags&Rl&&e.memoizedState!==null&&Ig(s,xa,e.memoizedState,e.memoizedProps);break;case 5:Mn(e,a,s);break;case 3:case 4:var l=xa;xa=fr(e.stateNode.containerInfo),Mn(e,a,s),xa=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Rl,Rl=16777216,Mn(e,a,s),Rl=l):Mn(e,a,s));break;default:Mn(e,a,s)}}function Wx(e){var a=e.alternate;if(a!==null&&(e=a.child,e!==null)){a.child=null;do a=e.sibling,e.sibling=null,e=a;while(e!==null)}}function Ml(e){var a=e.deletions;if((e.flags&16)!==0){if(a!==null)for(var s=0;s<a.length;s++){var l=a[s];ht=l,tf(l,e)}Wx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)ef(e),e=e.sibling}function ef(e){switch(e.tag){case 0:case 11:case 15:Ml(e),e.flags&2048&&ms(9,e,e.return);break;case 3:Ml(e);break;case 12:Ml(e);break;case 22:var a=e.stateNode;e.memoizedState!==null&&a._visibility&2&&(e.return===null||e.return.tag!==13)?(a._visibility&=-3,tr(e)):Ml(e);break;default:Ml(e)}}function tr(e){var a=e.deletions;if((e.flags&16)!==0){if(a!==null)for(var s=0;s<a.length;s++){var l=a[s];ht=l,tf(l,e)}Wx(e)}for(e=e.child;e!==null;){switch(a=e,a.tag){case 0:case 11:case 15:ms(8,a,a.return),tr(a);break;case 22:s=a.stateNode,s._visibility&2&&(s._visibility&=-3,tr(a));break;default:tr(a)}e=e.sibling}}function tf(e,a){for(;ht!==null;){var s=ht;switch(s.tag){case 0:case 11:case 15:ms(8,s,a);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var l=s.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:hl(s.memoizedState.cache)}if(l=s.child,l!==null)l.return=s,ht=l;else e:for(s=e;ht!==null;){l=ht;var r=l.sibling,o=l.return;if(Yx(l),l===s){ht=null;break e}if(r!==null){r.return=o,ht=r;break e}ht=o}}}var mg={getCacheForType:function(e){var a=jt(lt),s=a.data.get(e);return s===void 0&&(s=e(),a.data.set(e,s)),s},cacheSignal:function(){return jt(lt).controller.signal}},xg=typeof WeakMap=="function"?WeakMap:Map,_e=0,Ke=null,Ae=null,Te=0,Ue=0,Qt=null,xs=!1,Dn=!1,Oo=!1,Ka=0,et=0,fs=0,Is=0,Lo=0,Zt=0,On=0,Dl=null,$t=null,_o=!1,ar=0,af=0,sr=1/0,nr=null,hs=null,dt=0,ps=null,Ln=null,Va=0,Uo=0,Bo=null,sf=null,Ol=0,$o=null;function Jt(){return(_e&2)!==0&&Te!==0?Te&-Te:G.T!==null?Yo():yu()}function nf(){if(Zt===0)if((Te&536870912)===0||Me){var e=mi;mi<<=1,(mi&3932160)===0&&(mi=262144),Zt=e}else Zt=536870912;return e=Yt.current,e!==null&&(e.flags|=32),Zt}function Ht(e,a,s){(e===Ke&&(Ue===2||Ue===9)||e.cancelPendingCommit!==null)&&(_n(e,0),gs(e,Te,Zt,!1)),tl(e,s),((_e&2)===0||e!==Ke)&&(e===Ke&&((_e&2)===0&&(Is|=s),et===4&&gs(e,Te,Zt,!1)),Na(e))}function lf(e,a,s){if((_e&6)!==0)throw Error(c(327));var l=!s&&(a&127)===0&&(a&e.expiredLanes)===0||el(e,a),r=l?pg(e,a):qo(e,a,!0),o=l;do{if(r===0){Dn&&!l&&gs(e,a,0,!1);break}else{if(s=e.current.alternate,o&&!fg(s)){r=qo(e,a,!1),o=!1;continue}if(r===2){if(o=a,e.errorRecoveryDisabledLanes&o)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){a=x;e:{var j=e;r=Dl;var A=j.current.memoizedState.isDehydrated;if(A&&(_n(j,x).flags|=256),x=qo(j,x,!1),x!==2){if(Oo&&!A){j.errorRecoveryDisabledLanes|=o,Is|=o,r=4;break e}o=$t,$t=r,o!==null&&($t===null?$t=o:$t.push.apply($t,o))}r=x}if(o=!1,r!==2)continue}}if(r===1){_n(e,0),gs(e,a,0,!0);break}e:{switch(l=e,o=r,o){case 0:case 1:throw Error(c(345));case 4:if((a&4194048)!==a)break;case 6:gs(l,a,Zt,!xs);break e;case 2:$t=null;break;case 3:case 5:break;default:throw Error(c(329))}if((a&62914560)===a&&(r=ar+300-pe(),10<r)){if(gs(l,a,Zt,!xs),fi(l,0,!0)!==0)break e;Va=a,l.timeoutHandle=Uf(rf.bind(null,l,s,$t,nr,_o,a,Zt,Is,On,xs,o,"Throttled",-0,0),r);break e}rf(l,s,$t,nr,_o,a,Zt,Is,On,xs,o,null,-0,0)}}break}while(!0);Na(e)}function rf(e,a,s,l,r,o,x,j,A,U,V,F,H,K){if(e.timeoutHandle=-1,F=a.subtreeFlags,F&8192||(F&16785408)===16785408){F={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ea},Px(a,o,F);var ue=(o&62914560)===o?ar-pe():(o&4194048)===o?af-pe():0;if(ue=Pg(F,ue),ue!==null){Va=o,e.cancelPendingCommit=ue(hf.bind(null,e,a,o,s,l,r,x,j,A,V,F,null,H,K)),gs(e,o,x,!U);return}}hf(e,a,o,s,l,r,x,j,A)}function fg(e){for(var a=e;;){var s=a.tag;if((s===0||s===11||s===15)&&a.flags&16384&&(s=a.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var l=0;l<s.length;l++){var r=s[l],o=r.getSnapshot;r=r.value;try{if(!Kt(o(),r))return!1}catch{return!1}}if(s=a.child,a.subtreeFlags&16384&&s!==null)s.return=a,a=s;else{if(a===e)break;for(;a.sibling===null;){if(a.return===null||a.return===e)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function gs(e,a,s,l){a&=~Lo,a&=~Is,e.suspendedLanes|=a,e.pingedLanes&=~a,l&&(e.warmLanes|=a),l=e.expirationTimes;for(var r=a;0<r;){var o=31-Tt(r),x=1<<o;l[o]=-1,r&=~x}s!==0&&pu(e,s,a)}function lr(){return(_e&6)===0?(Ll(0),!1):!0}function Ho(){if(Ae!==null){if(Ue===0)var e=Ae.return;else e=Ae,Da=Gs=null,to(e),zn=null,gl=0,e=Ae;for(;e!==null;)Ux(e.alternate,e),e=e.return;Ae=null}}function _n(e,a){var s=e.timeoutHandle;s!==-1&&(e.timeoutHandle=-1,Og(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),Va=0,Ho(),Ke=e,Ae=s=Ra(e.current,null),Te=a,Ue=0,Qt=null,xs=!1,Dn=el(e,a),Oo=!1,On=Zt=Lo=Is=fs=et=0,$t=Dl=null,_o=!1,(a&8)!==0&&(a|=a&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=a;0<l;){var r=31-Tt(l),o=1<<r;a|=e[r],l&=~o}return Ka=a,zi(),s}function cf(e,a){Se=null,G.H=kl,a===kn||a===Oi?(a=wm(),Ue=3):a===Kc?(a=wm(),Ue=4):Ue=a===bo?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Qt=a,Ae===null&&(et=1,Zi(e,ta(a,e.current)))}function of(){var e=Yt.current;return e===null?!0:(Te&4194048)===Te?la===null:(Te&62914560)===Te||(Te&536870912)!==0?e===la:!1}function df(){var e=G.H;return G.H=kl,e===null?kl:e}function uf(){var e=G.A;return G.A=mg,e}function ir(){et=4,xs||(Te&4194048)!==Te&&Yt.current!==null||(Dn=!0),(fs&134217727)===0&&(Is&134217727)===0||Ke===null||gs(Ke,Te,Zt,!1)}function qo(e,a,s){var l=_e;_e|=2;var r=df(),o=uf();(Ke!==e||Te!==a)&&(nr=null,_n(e,a)),a=!1;var x=et;e:do try{if(Ue!==0&&Ae!==null){var j=Ae,A=Qt;switch(Ue){case 8:Ho(),x=6;break e;case 3:case 2:case 9:case 6:Yt.current===null&&(a=!0);var U=Ue;if(Ue=0,Qt=null,Un(e,j,A,U),s&&Dn){x=0;break e}break;default:U=Ue,Ue=0,Qt=null,Un(e,j,A,U)}}hg(),x=et;break}catch(V){cf(e,V)}while(!0);return a&&e.shellSuspendCounter++,Da=Gs=null,_e=l,G.H=r,G.A=o,Ae===null&&(Ke=null,Te=0,zi()),x}function hg(){for(;Ae!==null;)mf(Ae)}function pg(e,a){var s=_e;_e|=2;var l=df(),r=uf();Ke!==e||Te!==a?(nr=null,sr=pe()+500,_n(e,a)):Dn=el(e,a);e:do try{if(Ue!==0&&Ae!==null){a=Ae;var o=Qt;t:switch(Ue){case 1:Ue=0,Qt=null,Un(e,a,o,1);break;case 2:case 9:if(jm(o)){Ue=0,Qt=null,xf(a);break}a=function(){Ue!==2&&Ue!==9||Ke!==e||(Ue=7),Na(e)},o.then(a,a);break e;case 3:Ue=7;break e;case 4:Ue=5;break e;case 7:jm(o)?(Ue=0,Qt=null,xf(a)):(Ue=0,Qt=null,Un(e,a,o,7));break;case 5:var x=null;switch(Ae.tag){case 26:x=Ae.memoizedState;case 5:case 27:var j=Ae;if(x?Pf(x):j.stateNode.complete){Ue=0,Qt=null;var A=j.sibling;if(A!==null)Ae=A;else{var U=j.return;U!==null?(Ae=U,rr(U)):Ae=null}break t}}Ue=0,Qt=null,Un(e,a,o,5);break;case 6:Ue=0,Qt=null,Un(e,a,o,6);break;case 8:Ho(),et=6;break e;default:throw Error(c(462))}}gg();break}catch(V){cf(e,V)}while(!0);return Da=Gs=null,G.H=l,G.A=r,_e=s,Ae!==null?0:(Ke=null,Te=0,zi(),et)}function gg(){for(;Ae!==null&&!Q();)mf(Ae)}function mf(e){var a=Lx(e.alternate,e,Ka);e.memoizedProps=e.pendingProps,a===null?rr(e):Ae=a}function xf(e){var a=e,s=a.alternate;switch(a.tag){case 15:case 0:a=Ex(s,a,a.pendingProps,a.type,void 0,Te);break;case 11:a=Ex(s,a,a.pendingProps,a.type.render,a.ref,Te);break;case 5:to(a);default:Ux(s,a),a=Ae=dm(a,Ka),a=Lx(s,a,Ka)}e.memoizedProps=e.pendingProps,a===null?rr(e):Ae=a}function Un(e,a,s,l){Da=Gs=null,to(a),zn=null,gl=0;var r=a.return;try{if(lg(e,r,a,s,Te)){et=1,Zi(e,ta(s,e.current)),Ae=null;return}}catch(o){if(r!==null)throw Ae=r,o;et=1,Zi(e,ta(s,e.current)),Ae=null;return}a.flags&32768?(Me||l===1?e=!0:Dn||(Te&536870912)!==0?e=!1:(xs=e=!0,(l===2||l===9||l===3||l===6)&&(l=Yt.current,l!==null&&l.tag===13&&(l.flags|=16384))),ff(a,e)):rr(a)}function rr(e){var a=e;do{if((a.flags&32768)!==0){ff(a,xs);return}e=a.return;var s=cg(a.alternate,a,Ka);if(s!==null){Ae=s;return}if(a=a.sibling,a!==null){Ae=a;return}Ae=a=e}while(a!==null);et===0&&(et=5)}function ff(e,a){do{var s=og(e.alternate,e);if(s!==null){s.flags&=32767,Ae=s;return}if(s=e.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!a&&(e=e.sibling,e!==null)){Ae=e;return}Ae=e=s}while(e!==null);et=6,Ae=null}function hf(e,a,s,l,r,o,x,j,A){e.cancelPendingCommit=null;do cr();while(dt!==0);if((_e&6)!==0)throw Error(c(327));if(a!==null){if(a===e.current)throw Error(c(177));if(o=a.lanes|a.childLanes,o|=Ac,F0(e,s,o,x,j,A),e===Ke&&(Ae=Ke=null,Te=0),Ln=a,ps=e,Va=s,Uo=o,Bo=r,sf=l,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,jg(Wa,function(){return vf(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||l){l=G.T,G.T=null,r=ee.p,ee.p=2,x=_e,_e|=4;try{dg(e,a,s)}finally{_e=x,ee.p=r,G.T=l}}dt=1,pf(),gf(),bf()}}function pf(){if(dt===1){dt=0;var e=ps,a=Ln,s=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||s){s=G.T,G.T=null;var l=ee.p;ee.p=2;var r=_e;_e|=4;try{Jx(a,e);var o=Wo,x=tm(e.containerInfo),j=o.focusedElem,A=o.selectionRange;if(x!==j&&j&&j.ownerDocument&&em(j.ownerDocument.documentElement,j)){if(A!==null&&wc(j)){var U=A.start,V=A.end;if(V===void 0&&(V=U),"selectionStart"in j)j.selectionStart=U,j.selectionEnd=Math.min(V,j.value.length);else{var F=j.ownerDocument||document,H=F&&F.defaultView||window;if(H.getSelection){var K=H.getSelection(),ue=j.textContent.length,ye=Math.min(A.start,ue),qe=A.end===void 0?ye:Math.min(A.end,ue);!K.extend&&ye>qe&&(x=qe,qe=ye,ye=x);var L=Wu(j,ye),R=Wu(j,qe);if(L&&R&&(K.rangeCount!==1||K.anchorNode!==L.node||K.anchorOffset!==L.offset||K.focusNode!==R.node||K.focusOffset!==R.offset)){var _=F.createRange();_.setStart(L.node,L.offset),K.removeAllRanges(),ye>qe?(K.addRange(_),K.extend(R.node,R.offset)):(_.setEnd(R.node,R.offset),K.addRange(_))}}}}for(F=[],K=j;K=K.parentNode;)K.nodeType===1&&F.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;j<F.length;j++){var Z=F[j];Z.element.scrollLeft=Z.left,Z.element.scrollTop=Z.top}}vr=!!Po,Wo=Po=null}finally{_e=r,ee.p=l,G.T=s}}e.current=a,dt=2}}function gf(){if(dt===2){dt=0;var e=ps,a=Ln,s=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||s){s=G.T,G.T=null;var l=ee.p;ee.p=2;var r=_e;_e|=4;try{Vx(e,a.alternate,a)}finally{_e=r,ee.p=l,G.T=s}}dt=3}}function bf(){if(dt===4||dt===3){dt=0,se();var e=ps,a=Ln,s=Va,l=sf;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?dt=5:(dt=0,Ln=ps=null,yf(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(hs=null),nc(s),a=a.stateNode,bt&&typeof bt.onCommitFiberRoot=="function")try{bt.onCommitFiberRoot(ba,a,void 0,(a.current.flags&128)===128)}catch{}if(l!==null){a=G.T,r=ee.p,ee.p=2,G.T=null;try{for(var o=e.onRecoverableError,x=0;x<l.length;x++){var j=l[x];o(j.value,{componentStack:j.stack})}}finally{G.T=a,ee.p=r}}(Va&3)!==0&&cr(),Na(e),r=e.pendingLanes,(s&261930)!==0&&(r&42)!==0?e===$o?Ol++:(Ol=0,$o=e):Ol=0,Ll(0)}}function yf(e,a){(e.pooledCacheLanes&=a)===0&&(a=e.pooledCache,a!=null&&(e.pooledCache=null,hl(a)))}function cr(){return pf(),gf(),bf(),vf()}function vf(){if(dt!==5)return!1;var e=ps,a=Uo;Uo=0;var s=nc(Va),l=G.T,r=ee.p;try{ee.p=32>s?32:s,G.T=null,s=Bo,Bo=null;var o=ps,x=Va;if(dt=0,Ln=ps=null,Va=0,(_e&6)!==0)throw Error(c(331));var j=_e;if(_e|=4,ef(o.current),Ix(o,o.current,x,s),_e=j,Ll(0,!1),bt&&typeof bt.onPostCommitFiberRoot=="function")try{bt.onPostCommitFiberRoot(ba,o)}catch{}return!0}finally{ee.p=r,G.T=l,yf(e,a)}}function jf(e,a,s){a=ta(s,a),a=go(e.stateNode,a,2),e=os(e,a,2),e!==null&&(tl(e,2),Na(e))}function Be(e,a,s){if(e.tag===3)jf(e,e,s);else for(;a!==null;){if(a.tag===3){jf(a,e,s);break}else if(a.tag===1){var l=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(hs===null||!hs.has(l))){e=ta(s,e),s=jx(2),l=os(a,s,2),l!==null&&(Nx(s,l,a,e),tl(l,2),Na(l));break}}a=a.return}}function Go(e,a,s){var l=e.pingCache;if(l===null){l=e.pingCache=new xg;var r=new Set;l.set(a,r)}else r=l.get(a),r===void 0&&(r=new Set,l.set(a,r));r.has(s)||(Oo=!0,r.add(s),e=bg.bind(null,e,a,s),a.then(e,e))}function bg(e,a,s){var l=e.pingCache;l!==null&&l.delete(a),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,Ke===e&&(Te&s)===s&&(et===4||et===3&&(Te&62914560)===Te&&300>pe()-ar?(_e&2)===0&&_n(e,0):Lo|=s,On===Te&&(On=0)),Na(e)}function Nf(e,a){a===0&&(a=hu()),e=$s(e,a),e!==null&&(tl(e,a),Na(e))}function yg(e){var a=e.memoizedState,s=0;a!==null&&(s=a.retryLane),Nf(e,s)}function vg(e,a){var s=0;switch(e.tag){case 31:case 13:var l=e.stateNode,r=e.memoizedState;r!==null&&(s=r.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(c(314))}l!==null&&l.delete(a),Nf(e,s)}function jg(e,a){return ve(e,a)}var or=null,Bn=null,Ko=!1,dr=!1,Vo=!1,bs=0;function Na(e){e!==Bn&&e.next===null&&(Bn===null?or=Bn=e:Bn=Bn.next=e),dr=!0,Ko||(Ko=!0,wg())}function Ll(e,a){if(!Vo&&dr){Vo=!0;do for(var s=!1,l=or;l!==null;){if(e!==0){var r=l.pendingLanes;if(r===0)var o=0;else{var x=l.suspendedLanes,j=l.pingedLanes;o=(1<<31-Tt(42|e)+1)-1,o&=r&~(x&~j),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(s=!0,zf(l,o))}else o=Te,o=fi(l,l===Ke?o:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(o&3)===0||el(l,o)||(s=!0,zf(l,o));l=l.next}while(s);Vo=!1}}function Ng(){wf()}function wf(){dr=Ko=!1;var e=0;bs!==0&&Dg()&&(e=bs);for(var a=pe(),s=null,l=or;l!==null;){var r=l.next,o=Sf(l,a);o===0?(l.next=null,s===null?or=r:s.next=r,r===null&&(Bn=s)):(s=l,(e!==0||(o&3)!==0)&&(dr=!0)),l=r}dt!==0&&dt!==5||Ll(e),bs!==0&&(bs=0)}function Sf(e,a){for(var s=e.suspendedLanes,l=e.pingedLanes,r=e.expirationTimes,o=e.pendingLanes&-62914561;0<o;){var x=31-Tt(o),j=1<<x,A=r[x];A===-1?((j&s)===0||(j&l)!==0)&&(r[x]=J0(j,a)):A<=a&&(e.expiredLanes|=j),o&=~j}if(a=Ke,s=Te,s=fi(e,e===a?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,s===0||e===a&&(Ue===2||Ue===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Je(l),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||el(e,s)){if(a=s&-s,a===e.callbackPriority)return a;switch(l!==null&&Je(l),nc(s)){case 2:case 8:s=St;break;case 32:s=Wa;break;case 268435456:s=es;break;default:s=Wa}return l=kf.bind(null,e),s=ve(s,l),e.callbackPriority=a,e.callbackNode=s,a}return l!==null&&l!==null&&Je(l),e.callbackPriority=2,e.callbackNode=null,2}function kf(e,a){if(dt!==0&&dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(cr()&&e.callbackNode!==s)return null;var l=Te;return l=fi(e,e===Ke?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(lf(e,l,a),Sf(e,pe()),e.callbackNode!=null&&e.callbackNode===s?kf.bind(null,e):null)}function zf(e,a){if(cr())return null;lf(e,a,!0)}function wg(){Lg(function(){(_e&6)!==0?ve(Ve,Ng):wf()})}function Yo(){if(bs===0){var e=wn;e===0&&(e=ui,ui<<=1,(ui&261888)===0&&(ui=256)),bs=e}return bs}function Cf(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:bi(""+e)}function Af(e,a){var s=a.ownerDocument.createElement("input");return s.name=a.name,s.value=a.value,e.id&&s.setAttribute("form",e.id),a.parentNode.insertBefore(s,a),e=new FormData(e),s.parentNode.removeChild(s),e}function Sg(e,a,s,l,r){if(a==="submit"&&s&&s.stateNode===r){var o=Cf((r[Ot]||null).action),x=l.submitter;x&&(a=(a=x[Ot]||null)?Cf(a.formAction):x.getAttribute("formAction"),a!==null&&(o=a,x=null));var j=new Ni("action","action",null,l,r);e.push({event:j,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(bs!==0){var A=x?Af(r,x):new FormData(r);uo(s,{pending:!0,data:A,method:r.method,action:o},null,A)}}else typeof o=="function"&&(j.preventDefault(),A=x?Af(r,x):new FormData(r),uo(s,{pending:!0,data:A,method:r.method,action:o},o,A))},currentTarget:r}]})}}for(var Xo=0;Xo<Cc.length;Xo++){var Qo=Cc[Xo],kg=Qo.toLowerCase(),zg=Qo[0].toUpperCase()+Qo.slice(1);ma(kg,"on"+zg)}ma(nm,"onAnimationEnd"),ma(lm,"onAnimationIteration"),ma(im,"onAnimationStart"),ma("dblclick","onDoubleClick"),ma("focusin","onFocus"),ma("focusout","onBlur"),ma(Gp,"onTransitionRun"),ma(Kp,"onTransitionStart"),ma(Vp,"onTransitionCancel"),ma(rm,"onTransitionEnd"),on("onMouseEnter",["mouseout","mouseover"]),on("onMouseLeave",["mouseout","mouseover"]),on("onPointerEnter",["pointerout","pointerover"]),on("onPointerLeave",["pointerout","pointerover"]),Ls("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ls("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ls("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ls("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ls("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ls("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var _l="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(" "),Cg=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(_l));function Ef(e,a){a=(a&4)!==0;for(var s=0;s<e.length;s++){var l=e[s],r=l.event;l=l.listeners;e:{var o=void 0;if(a)for(var x=l.length-1;0<=x;x--){var j=l[x],A=j.instance,U=j.currentTarget;if(j=j.listener,A!==o&&r.isPropagationStopped())break e;o=j,r.currentTarget=U;try{o(r)}catch(V){ki(V)}r.currentTarget=null,o=A}else for(x=0;x<l.length;x++){if(j=l[x],A=j.instance,U=j.currentTarget,j=j.listener,A!==o&&r.isPropagationStopped())break e;o=j,r.currentTarget=U;try{o(r)}catch(V){ki(V)}r.currentTarget=null,o=A}}}}function Ee(e,a){var s=a[lc];s===void 0&&(s=a[lc]=new Set);var l=e+"__bubble";s.has(l)||(Tf(a,e,2,!1),s.add(l))}function Zo(e,a,s){var l=0;a&&(l|=4),Tf(s,e,l,a)}var ur="_reactListening"+Math.random().toString(36).slice(2);function Jo(e){if(!e[ur]){e[ur]=!0,Nu.forEach(function(s){s!=="selectionchange"&&(Cg.has(s)||Zo(s,!1,e),Zo(s,!0,e))});var a=e.nodeType===9?e:e.ownerDocument;a===null||a[ur]||(a[ur]=!0,Zo("selectionchange",!1,a))}}function Tf(e,a,s,l){switch(lh(a)){case 2:var r=tb;break;case 8:r=ab;break;default:r=dd}s=r.bind(null,a,s,e),r=void 0,!fc||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(r=!0),l?r!==void 0?e.addEventListener(a,s,{capture:!0,passive:r}):e.addEventListener(a,s,!0):r!==void 0?e.addEventListener(a,s,{passive:r}):e.addEventListener(a,s,!1)}function Fo(e,a,s,l,r){var o=l;if((a&1)===0&&(a&2)===0&&l!==null)e:for(;;){if(l===null)return;var x=l.tag;if(x===3||x===4){var j=l.stateNode.containerInfo;if(j===r)break;if(x===4)for(x=l.return;x!==null;){var A=x.tag;if((A===3||A===4)&&x.stateNode.containerInfo===r)return;x=x.return}for(;j!==null;){if(x=ln(j),x===null)return;if(A=x.tag,A===5||A===6||A===26||A===27){l=o=x;continue e}j=j.parentNode}}l=l.return}Ou(function(){var U=o,V=mc(s),F=[];e:{var H=cm.get(e);if(H!==void 0){var K=Ni,ue=e;switch(e){case"keypress":if(vi(s)===0)break e;case"keydown":case"keyup":K=vp;break;case"focusin":ue="focus",K=bc;break;case"focusout":ue="blur",K=bc;break;case"beforeblur":case"afterblur":K=bc;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":K=Uu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=cp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=wp;break;case nm:case lm:case im:K=up;break;case rm:K=kp;break;case"scroll":case"scrollend":K=ip;break;case"wheel":K=Cp;break;case"copy":case"cut":case"paste":K=xp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=$u;break;case"toggle":case"beforetoggle":K=Ep}var ye=(a&4)!==0,qe=!ye&&(e==="scroll"||e==="scrollend"),L=ye?H!==null?H+"Capture":null:H;ye=[];for(var R=U,_;R!==null;){var Z=R;if(_=Z.stateNode,Z=Z.tag,Z!==5&&Z!==26&&Z!==27||_===null||L===null||(Z=nl(R,L),Z!=null&&ye.push(Ul(R,Z,_))),qe)break;R=R.return}0<ye.length&&(H=new K(H,ue,null,s,V),F.push({event:H,listeners:ye}))}}if((a&7)===0){e:{if(H=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",H&&s!==uc&&(ue=s.relatedTarget||s.fromElement)&&(ln(ue)||ue[nn]))break e;if((K||H)&&(H=V.window===V?V:(H=V.ownerDocument)?H.defaultView||H.parentWindow:window,K?(ue=s.relatedTarget||s.toElement,K=U,ue=ue?ln(ue):null,ue!==null&&(qe=f(ue),ye=ue.tag,ue!==qe||ye!==5&&ye!==27&&ye!==6)&&(ue=null)):(K=null,ue=U),K!==ue)){if(ye=Uu,Z="onMouseLeave",L="onMouseEnter",R="mouse",(e==="pointerout"||e==="pointerover")&&(ye=$u,Z="onPointerLeave",L="onPointerEnter",R="pointer"),qe=K==null?H:sl(K),_=ue==null?H:sl(ue),H=new ye(Z,R+"leave",K,s,V),H.target=qe,H.relatedTarget=_,Z=null,ln(V)===U&&(ye=new ye(L,R+"enter",ue,s,V),ye.target=_,ye.relatedTarget=qe,Z=ye),qe=Z,K&&ue)t:{for(ye=Ag,L=K,R=ue,_=0,Z=L;Z;Z=ye(Z))_++;Z=0;for(var he=R;he;he=ye(he))Z++;for(;0<_-Z;)L=ye(L),_--;for(;0<Z-_;)R=ye(R),Z--;for(;_--;){if(L===R||R!==null&&L===R.alternate){ye=L;break t}L=ye(L),R=ye(R)}ye=null}else ye=null;K!==null&&Rf(F,H,K,ye,!1),ue!==null&&qe!==null&&Rf(F,qe,ue,ye,!0)}}e:{if(H=U?sl(U):window,K=H.nodeName&&H.nodeName.toLowerCase(),K==="select"||K==="input"&&H.type==="file")var Oe=Qu;else if(Yu(H))if(Zu)Oe=$p;else{Oe=Up;var fe=_p}else K=H.nodeName,!K||K.toLowerCase()!=="input"||H.type!=="checkbox"&&H.type!=="radio"?U&&dc(U.elementType)&&(Oe=Qu):Oe=Bp;if(Oe&&(Oe=Oe(e,U))){Xu(F,Oe,s,V);break e}fe&&fe(e,H,U),e==="focusout"&&U&&H.type==="number"&&U.memoizedProps.value!=null&&oc(H,"number",H.value)}switch(fe=U?sl(U):window,e){case"focusin":(Yu(fe)||fe.contentEditable==="true")&&(hn=fe,Sc=U,ml=null);break;case"focusout":ml=Sc=hn=null;break;case"mousedown":kc=!0;break;case"contextmenu":case"mouseup":case"dragend":kc=!1,am(F,s,V);break;case"selectionchange":if(qp)break;case"keydown":case"keyup":am(F,s,V)}var ke;if(vc)e:{switch(e){case"compositionstart":var Re="onCompositionStart";break e;case"compositionend":Re="onCompositionEnd";break e;case"compositionupdate":Re="onCompositionUpdate";break e}Re=void 0}else fn?Ku(e,s)&&(Re="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(Re="onCompositionStart");Re&&(Hu&&s.locale!=="ko"&&(fn||Re!=="onCompositionStart"?Re==="onCompositionEnd"&&fn&&(ke=Lu()):(as=V,hc="value"in as?as.value:as.textContent,fn=!0)),fe=mr(U,Re),0<fe.length&&(Re=new Bu(Re,e,null,s,V),F.push({event:Re,listeners:fe}),ke?Re.data=ke:(ke=Vu(s),ke!==null&&(Re.data=ke)))),(ke=Rp?Mp(e,s):Dp(e,s))&&(Re=mr(U,"onBeforeInput"),0<Re.length&&(fe=new Bu("onBeforeInput","beforeinput",null,s,V),F.push({event:fe,listeners:Re}),fe.data=ke)),Sg(F,e,U,s,V)}Ef(F,a)})}function Ul(e,a,s){return{instance:e,listener:a,currentTarget:s}}function mr(e,a){for(var s=a+"Capture",l=[];e!==null;){var r=e,o=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||o===null||(r=nl(e,s),r!=null&&l.unshift(Ul(e,r,o)),r=nl(e,a),r!=null&&l.push(Ul(e,r,o))),e.tag===3)return l;e=e.return}return[]}function Ag(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Rf(e,a,s,l,r){for(var o=a._reactName,x=[];s!==null&&s!==l;){var j=s,A=j.alternate,U=j.stateNode;if(j=j.tag,A!==null&&A===l)break;j!==5&&j!==26&&j!==27||U===null||(A=U,r?(U=nl(s,o),U!=null&&x.unshift(Ul(s,U,A))):r||(U=nl(s,o),U!=null&&x.push(Ul(s,U,A)))),s=s.return}x.length!==0&&e.push({event:a,listeners:x})}var Eg=/\r\n?/g,Tg=/\u0000|\uFFFD/g;function Mf(e){return(typeof e=="string"?e:""+e).replace(Eg,`
49
+ `).replace(Tg,"")}function Df(e,a){return a=Mf(a),Mf(e)===a}function He(e,a,s,l,r,o){switch(s){case"children":typeof l=="string"?a==="body"||a==="textarea"&&l===""||un(e,l):(typeof l=="number"||typeof l=="bigint")&&a!=="body"&&un(e,""+l);break;case"className":pi(e,"class",l);break;case"tabIndex":pi(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":pi(e,s,l);break;case"style":Mu(e,l,o);break;case"data":if(a!=="object"){pi(e,"data",l);break}case"src":case"href":if(l===""&&(a!=="a"||s!=="href")){e.removeAttribute(s);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(s);break}l=bi(""+l),e.setAttribute(s,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(s,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof o=="function"&&(s==="formAction"?(a!=="input"&&He(e,a,"name",r.name,r,null),He(e,a,"formEncType",r.formEncType,r,null),He(e,a,"formMethod",r.formMethod,r,null),He(e,a,"formTarget",r.formTarget,r,null)):(He(e,a,"encType",r.encType,r,null),He(e,a,"method",r.method,r,null),He(e,a,"target",r.target,r,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(s);break}l=bi(""+l),e.setAttribute(s,l);break;case"onClick":l!=null&&(e.onclick=Ea);break;case"onScroll":l!=null&&Ee("scroll",e);break;case"onScrollEnd":l!=null&&Ee("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(c(61));if(s=l.__html,s!=null){if(r.children!=null)throw Error(c(60));e.innerHTML=s}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}s=bi(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(s,""+l):e.removeAttribute(s);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(s,""):e.removeAttribute(s);break;case"capture":case"download":l===!0?e.setAttribute(s,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(s,l):e.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(s,l):e.removeAttribute(s);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(s):e.setAttribute(s,l);break;case"popover":Ee("beforetoggle",e),Ee("toggle",e),hi(e,"popover",l);break;case"xlinkActuate":Aa(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Aa(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Aa(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Aa(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Aa(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Aa(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Aa(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Aa(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Aa(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":hi(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=np.get(s)||s,hi(e,s,l))}}function Io(e,a,s,l,r,o){switch(s){case"style":Mu(e,l,o);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(c(61));if(s=l.__html,s!=null){if(r.children!=null)throw Error(c(60));e.innerHTML=s}}break;case"children":typeof l=="string"?un(e,l):(typeof l=="number"||typeof l=="bigint")&&un(e,""+l);break;case"onScroll":l!=null&&Ee("scroll",e);break;case"onScrollEnd":l!=null&&Ee("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Ea);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!wu.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(r=s.endsWith("Capture"),a=s.slice(2,r?s.length-7:void 0),o=e[Ot]||null,o=o!=null?o[s]:null,typeof o=="function"&&e.removeEventListener(a,o,r),typeof l=="function")){typeof o!="function"&&o!==null&&(s in e?e[s]=null:e.hasAttribute(s)&&e.removeAttribute(s)),e.addEventListener(a,l,r);break e}s in e?e[s]=l:l===!0?e.setAttribute(s,""):hi(e,s,l)}}}function wt(e,a,s){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ee("error",e),Ee("load",e);var l=!1,r=!1,o;for(o in s)if(s.hasOwnProperty(o)){var x=s[o];if(x!=null)switch(o){case"src":l=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(c(137,a));default:He(e,a,o,x,s,null)}}r&&He(e,a,"srcSet",s.srcSet,s,null),l&&He(e,a,"src",s.src,s,null);return;case"input":Ee("invalid",e);var j=o=x=r=null,A=null,U=null;for(l in s)if(s.hasOwnProperty(l)){var V=s[l];if(V!=null)switch(l){case"name":r=V;break;case"type":x=V;break;case"checked":A=V;break;case"defaultChecked":U=V;break;case"value":o=V;break;case"defaultValue":j=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(c(137,a));break;default:He(e,a,l,V,s,null)}}Au(e,o,j,A,U,x,r,!1);return;case"select":Ee("invalid",e),l=x=o=null;for(r in s)if(s.hasOwnProperty(r)&&(j=s[r],j!=null))switch(r){case"value":o=j;break;case"defaultValue":x=j;break;case"multiple":l=j;default:He(e,a,r,j,s,null)}a=o,s=x,e.multiple=!!l,a!=null?dn(e,!!l,a,!1):s!=null&&dn(e,!!l,s,!0);return;case"textarea":Ee("invalid",e),o=r=l=null;for(x in s)if(s.hasOwnProperty(x)&&(j=s[x],j!=null))switch(x){case"value":l=j;break;case"defaultValue":r=j;break;case"children":o=j;break;case"dangerouslySetInnerHTML":if(j!=null)throw Error(c(91));break;default:He(e,a,x,j,s,null)}Tu(e,l,r,o);return;case"option":for(A in s)if(s.hasOwnProperty(A)&&(l=s[A],l!=null))switch(A){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:He(e,a,A,l,s,null)}return;case"dialog":Ee("beforetoggle",e),Ee("toggle",e),Ee("cancel",e),Ee("close",e);break;case"iframe":case"object":Ee("load",e);break;case"video":case"audio":for(l=0;l<_l.length;l++)Ee(_l[l],e);break;case"image":Ee("error",e),Ee("load",e);break;case"details":Ee("toggle",e);break;case"embed":case"source":case"link":Ee("error",e),Ee("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(U in s)if(s.hasOwnProperty(U)&&(l=s[U],l!=null))switch(U){case"children":case"dangerouslySetInnerHTML":throw Error(c(137,a));default:He(e,a,U,l,s,null)}return;default:if(dc(a)){for(V in s)s.hasOwnProperty(V)&&(l=s[V],l!==void 0&&Io(e,a,V,l,s,void 0));return}}for(j in s)s.hasOwnProperty(j)&&(l=s[j],l!=null&&He(e,a,j,l,s,null))}function Rg(e,a,s,l){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,o=null,x=null,j=null,A=null,U=null,V=null;for(K in s){var F=s[K];if(s.hasOwnProperty(K)&&F!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":A=F;default:l.hasOwnProperty(K)||He(e,a,K,null,l,F)}}for(var H in l){var K=l[H];if(F=s[H],l.hasOwnProperty(H)&&(K!=null||F!=null))switch(H){case"type":o=K;break;case"name":r=K;break;case"checked":U=K;break;case"defaultChecked":V=K;break;case"value":x=K;break;case"defaultValue":j=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(c(137,a));break;default:K!==F&&He(e,a,H,K,l,F)}}cc(e,x,j,A,U,V,o,r);return;case"select":K=x=j=H=null;for(o in s)if(A=s[o],s.hasOwnProperty(o)&&A!=null)switch(o){case"value":break;case"multiple":K=A;default:l.hasOwnProperty(o)||He(e,a,o,null,l,A)}for(r in l)if(o=l[r],A=s[r],l.hasOwnProperty(r)&&(o!=null||A!=null))switch(r){case"value":H=o;break;case"defaultValue":j=o;break;case"multiple":x=o;default:o!==A&&He(e,a,r,o,l,A)}a=j,s=x,l=K,H!=null?dn(e,!!s,H,!1):!!l!=!!s&&(a!=null?dn(e,!!s,a,!0):dn(e,!!s,s?[]:"",!1));return;case"textarea":K=H=null;for(j in s)if(r=s[j],s.hasOwnProperty(j)&&r!=null&&!l.hasOwnProperty(j))switch(j){case"value":break;case"children":break;default:He(e,a,j,null,l,r)}for(x in l)if(r=l[x],o=s[x],l.hasOwnProperty(x)&&(r!=null||o!=null))switch(x){case"value":H=r;break;case"defaultValue":K=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(c(91));break;default:r!==o&&He(e,a,x,r,l,o)}Eu(e,H,K);return;case"option":for(var ue in s)if(H=s[ue],s.hasOwnProperty(ue)&&H!=null&&!l.hasOwnProperty(ue))switch(ue){case"selected":e.selected=!1;break;default:He(e,a,ue,null,l,H)}for(A in l)if(H=l[A],K=s[A],l.hasOwnProperty(A)&&H!==K&&(H!=null||K!=null))switch(A){case"selected":e.selected=H&&typeof H!="function"&&typeof H!="symbol";break;default:He(e,a,A,H,l,K)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ye in s)H=s[ye],s.hasOwnProperty(ye)&&H!=null&&!l.hasOwnProperty(ye)&&He(e,a,ye,null,l,H);for(U in l)if(H=l[U],K=s[U],l.hasOwnProperty(U)&&H!==K&&(H!=null||K!=null))switch(U){case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(c(137,a));break;default:He(e,a,U,H,l,K)}return;default:if(dc(a)){for(var qe in s)H=s[qe],s.hasOwnProperty(qe)&&H!==void 0&&!l.hasOwnProperty(qe)&&Io(e,a,qe,void 0,l,H);for(V in l)H=l[V],K=s[V],!l.hasOwnProperty(V)||H===K||H===void 0&&K===void 0||Io(e,a,V,H,l,K);return}}for(var L in s)H=s[L],s.hasOwnProperty(L)&&H!=null&&!l.hasOwnProperty(L)&&He(e,a,L,null,l,H);for(F in l)H=l[F],K=s[F],!l.hasOwnProperty(F)||H===K||H==null&&K==null||He(e,a,F,H,l,K)}function Of(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Mg(){if(typeof performance.getEntriesByType=="function"){for(var e=0,a=0,s=performance.getEntriesByType("resource"),l=0;l<s.length;l++){var r=s[l],o=r.transferSize,x=r.initiatorType,j=r.duration;if(o&&j&&Of(x)){for(x=0,j=r.responseEnd,l+=1;l<s.length;l++){var A=s[l],U=A.startTime;if(U>j)break;var V=A.transferSize,F=A.initiatorType;V&&Of(F)&&(A=A.responseEnd,x+=V*(A<j?1:(j-U)/(A-U)))}if(--l,a+=8*(o+x)/(r.duration/1e3),e++,10<e)break}}if(0<e)return a/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Po=null,Wo=null;function xr(e){return e.nodeType===9?e:e.ownerDocument}function Lf(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function _f(e,a){if(e===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&a==="foreignObject"?0:e}function ed(e,a){return e==="textarea"||e==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var td=null;function Dg(){var e=window.event;return e&&e.type==="popstate"?e===td?!1:(td=e,!0):(td=null,!1)}var Uf=typeof setTimeout=="function"?setTimeout:void 0,Og=typeof clearTimeout=="function"?clearTimeout:void 0,Bf=typeof Promise=="function"?Promise:void 0,Lg=typeof queueMicrotask=="function"?queueMicrotask:typeof Bf<"u"?function(e){return Bf.resolve(null).then(e).catch(_g)}:Uf;function _g(e){setTimeout(function(){throw e})}function ys(e){return e==="head"}function $f(e,a){var s=a,l=0;do{var r=s.nextSibling;if(e.removeChild(s),r&&r.nodeType===8)if(s=r.data,s==="/$"||s==="/&"){if(l===0){e.removeChild(r),Gn(a);return}l--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")l++;else if(s==="html")Bl(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,Bl(s);for(var o=s.firstChild;o;){var x=o.nextSibling,j=o.nodeName;o[al]||j==="SCRIPT"||j==="STYLE"||j==="LINK"&&o.rel.toLowerCase()==="stylesheet"||s.removeChild(o),o=x}}else s==="body"&&Bl(e.ownerDocument.body);s=r}while(s);Gn(a)}function Hf(e,a){var s=e;e=0;do{var l=s.nextSibling;if(s.nodeType===1?a?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(a?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),l&&l.nodeType===8)if(s=l.data,s==="/$"){if(e===0)break;e--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||e++;s=l}while(s)}function ad(e){var a=e.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var s=a;switch(a=a.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":ad(s),ic(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function Ug(e,a,s,l){for(;e.nodeType===1;){var r=s;if(e.nodeName.toLowerCase()!==a.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[al])switch(a){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(o=e.getAttribute("rel"),o==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(o!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(o=e.getAttribute("src"),(o!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(a==="input"&&e.type==="hidden"){var o=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===o)return e}else return e;if(e=ia(e.nextSibling),e===null)break}return null}function Bg(e,a,s){if(a==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=ia(e.nextSibling),e===null))return null;return e}function qf(e,a){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=ia(e.nextSibling),e===null))return null;return e}function sd(e){return e.data==="$?"||e.data==="$~"}function nd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function $g(e,a){var s=e.ownerDocument;if(e.data==="$~")e._reactRetry=a;else if(e.data!=="$?"||s.readyState!=="loading")a();else{var l=function(){a(),s.removeEventListener("DOMContentLoaded",l)};s.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function ia(e){for(;e!=null;e=e.nextSibling){var a=e.nodeType;if(a===1||a===3)break;if(a===8){if(a=e.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return e}var ld=null;function Gf(e){e=e.nextSibling;for(var a=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(a===0)return ia(e.nextSibling);a--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||a++}e=e.nextSibling}return null}function Kf(e){e=e.previousSibling;for(var a=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(a===0)return e;a--}else s!=="/$"&&s!=="/&"||a++}e=e.previousSibling}return null}function Vf(e,a,s){switch(a=xr(s),e){case"html":if(e=a.documentElement,!e)throw Error(c(452));return e;case"head":if(e=a.head,!e)throw Error(c(453));return e;case"body":if(e=a.body,!e)throw Error(c(454));return e;default:throw Error(c(451))}}function Bl(e){for(var a=e.attributes;a.length;)e.removeAttributeNode(a[0]);ic(e)}var ra=new Map,Yf=new Set;function fr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ya=ee.d;ee.d={f:Hg,r:qg,D:Gg,C:Kg,L:Vg,m:Yg,X:Qg,S:Xg,M:Zg};function Hg(){var e=Ya.f(),a=lr();return e||a}function qg(e){var a=rn(e);a!==null&&a.tag===5&&a.type==="form"?rx(a):Ya.r(e)}var $n=typeof document>"u"?null:document;function Xf(e,a,s){var l=$n;if(l&&typeof a=="string"&&a){var r=Wt(a);r='link[rel="'+e+'"][href="'+r+'"]',typeof s=="string"&&(r+='[crossorigin="'+s+'"]'),Yf.has(r)||(Yf.add(r),e={rel:e,crossOrigin:s,href:a},l.querySelector(r)===null&&(a=l.createElement("link"),wt(a,"link",e),ft(a),l.head.appendChild(a)))}}function Gg(e){Ya.D(e),Xf("dns-prefetch",e,null)}function Kg(e,a){Ya.C(e,a),Xf("preconnect",e,a)}function Vg(e,a,s){Ya.L(e,a,s);var l=$n;if(l&&e&&a){var r='link[rel="preload"][as="'+Wt(a)+'"]';a==="image"&&s&&s.imageSrcSet?(r+='[imagesrcset="'+Wt(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(r+='[imagesizes="'+Wt(s.imageSizes)+'"]')):r+='[href="'+Wt(e)+'"]';var o=r;switch(a){case"style":o=Hn(e);break;case"script":o=qn(e)}ra.has(o)||(e=v({rel:"preload",href:a==="image"&&s&&s.imageSrcSet?void 0:e,as:a},s),ra.set(o,e),l.querySelector(r)!==null||a==="style"&&l.querySelector($l(o))||a==="script"&&l.querySelector(Hl(o))||(a=l.createElement("link"),wt(a,"link",e),ft(a),l.head.appendChild(a)))}}function Yg(e,a){Ya.m(e,a);var s=$n;if(s&&e){var l=a&&typeof a.as=="string"?a.as:"script",r='link[rel="modulepreload"][as="'+Wt(l)+'"][href="'+Wt(e)+'"]',o=r;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=qn(e)}if(!ra.has(o)&&(e=v({rel:"modulepreload",href:e},a),ra.set(o,e),s.querySelector(r)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(Hl(o)))return}l=s.createElement("link"),wt(l,"link",e),ft(l),s.head.appendChild(l)}}}function Xg(e,a,s){Ya.S(e,a,s);var l=$n;if(l&&e){var r=cn(l).hoistableStyles,o=Hn(e);a=a||"default";var x=r.get(o);if(!x){var j={loading:0,preload:null};if(x=l.querySelector($l(o)))j.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":a},s),(s=ra.get(o))&&id(e,s);var A=x=l.createElement("link");ft(A),wt(A,"link",e),A._p=new Promise(function(U,V){A.onload=U,A.onerror=V}),A.addEventListener("load",function(){j.loading|=1}),A.addEventListener("error",function(){j.loading|=2}),j.loading|=4,hr(x,a,l)}x={type:"stylesheet",instance:x,count:1,state:j},r.set(o,x)}}}function Qg(e,a){Ya.X(e,a);var s=$n;if(s&&e){var l=cn(s).hoistableScripts,r=qn(e),o=l.get(r);o||(o=s.querySelector(Hl(r)),o||(e=v({src:e,async:!0},a),(a=ra.get(r))&&rd(e,a),o=s.createElement("script"),ft(o),wt(o,"link",e),s.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},l.set(r,o))}}function Zg(e,a){Ya.M(e,a);var s=$n;if(s&&e){var l=cn(s).hoistableScripts,r=qn(e),o=l.get(r);o||(o=s.querySelector(Hl(r)),o||(e=v({src:e,async:!0,type:"module"},a),(a=ra.get(r))&&rd(e,a),o=s.createElement("script"),ft(o),wt(o,"link",e),s.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},l.set(r,o))}}function Qf(e,a,s,l){var r=(r=me.current)?fr(r):null;if(!r)throw Error(c(446));switch(e){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(a=Hn(s.href),s=cn(r).hoistableStyles,l=s.get(a),l||(l={type:"style",instance:null,count:0,state:null},s.set(a,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){e=Hn(s.href);var o=cn(r).hoistableStyles,x=o.get(e);if(x||(r=r.ownerDocument||r,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(e,x),(o=r.querySelector($l(e)))&&!o._p&&(x.instance=o,x.state.loading=5),ra.has(e)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},ra.set(e,s),o||Jg(r,e,s,x.state))),a&&l===null)throw Error(c(528,""));return x}if(a&&l!==null)throw Error(c(529,""));return null;case"script":return a=s.async,s=s.src,typeof s=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=qn(s),s=cn(r).hoistableScripts,l=s.get(a),l||(l={type:"script",instance:null,count:0,state:null},s.set(a,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,e))}}function Hn(e){return'href="'+Wt(e)+'"'}function $l(e){return'link[rel="stylesheet"]['+e+"]"}function Zf(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function Jg(e,a,s,l){e.querySelector('link[rel="preload"][as="style"]['+a+"]")?l.loading=1:(a=e.createElement("link"),l.preload=a,a.addEventListener("load",function(){return l.loading|=1}),a.addEventListener("error",function(){return l.loading|=2}),wt(a,"link",s),ft(a),e.head.appendChild(a))}function qn(e){return'[src="'+Wt(e)+'"]'}function Hl(e){return"script[async]"+e}function Jf(e,a,s){if(a.count++,a.instance===null)switch(a.type){case"style":var l=e.querySelector('style[data-href~="'+Wt(s.href)+'"]');if(l)return a.instance=l,ft(l),l;var r=v({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),ft(l),wt(l,"style",r),hr(l,s.precedence,e),a.instance=l;case"stylesheet":r=Hn(s.href);var o=e.querySelector($l(r));if(o)return a.state.loading|=4,a.instance=o,ft(o),o;l=Zf(s),(r=ra.get(r))&&id(l,r),o=(e.ownerDocument||e).createElement("link"),ft(o);var x=o;return x._p=new Promise(function(j,A){x.onload=j,x.onerror=A}),wt(o,"link",l),a.state.loading|=4,hr(o,s.precedence,e),a.instance=o;case"script":return o=qn(s.src),(r=e.querySelector(Hl(o)))?(a.instance=r,ft(r),r):(l=s,(r=ra.get(o))&&(l=v({},s),rd(l,r)),e=e.ownerDocument||e,r=e.createElement("script"),ft(r),wt(r,"link",l),e.head.appendChild(r),a.instance=r);case"void":return null;default:throw Error(c(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(l=a.instance,a.state.loading|=4,hr(l,s.precedence,e));return a.instance}function hr(e,a,s){for(var l=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=l.length?l[l.length-1]:null,o=r,x=0;x<l.length;x++){var j=l[x];if(j.dataset.precedence===a)o=j;else if(o!==r)break}o?o.parentNode.insertBefore(e,o.nextSibling):(a=s.nodeType===9?s.head:s,a.insertBefore(e,a.firstChild))}function id(e,a){e.crossOrigin==null&&(e.crossOrigin=a.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=a.referrerPolicy),e.title==null&&(e.title=a.title)}function rd(e,a){e.crossOrigin==null&&(e.crossOrigin=a.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=a.referrerPolicy),e.integrity==null&&(e.integrity=a.integrity)}var pr=null;function Ff(e,a,s){if(pr===null){var l=new Map,r=pr=new Map;r.set(s,l)}else r=pr,l=r.get(s),l||(l=new Map,r.set(s,l));if(l.has(e))return l;for(l.set(e,null),s=s.getElementsByTagName(e),r=0;r<s.length;r++){var o=s[r];if(!(o[al]||o[yt]||e==="link"&&o.getAttribute("rel")==="stylesheet")&&o.namespaceURI!=="http://www.w3.org/2000/svg"){var x=o.getAttribute(a)||"";x=e+x;var j=l.get(x);j?j.push(o):l.set(x,[o])}}return l}function If(e,a,s){e=e.ownerDocument||e,e.head.insertBefore(s,a==="title"?e.querySelector("head > title"):null)}function Fg(e,a,s){if(s===1||a.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return e=a.disabled,typeof a.precedence=="string"&&e==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Pf(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Ig(e,a,s,l){if(s.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var r=Hn(l.href),o=a.querySelector($l(r));if(o){a=o._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(e.count++,e=gr.bind(e),a.then(e,e)),s.state.loading|=4,s.instance=o,ft(o);return}o=a.ownerDocument||a,l=Zf(l),(r=ra.get(r))&&id(l,r),o=o.createElement("link"),ft(o);var x=o;x._p=new Promise(function(j,A){x.onload=j,x.onerror=A}),wt(o,"link",l),s.instance=o}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(s,a),(a=s.state.preload)&&(s.state.loading&3)===0&&(e.count++,s=gr.bind(e),a.addEventListener("load",s),a.addEventListener("error",s))}}var cd=0;function Pg(e,a){return e.stylesheets&&e.count===0&&yr(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var l=setTimeout(function(){if(e.stylesheets&&yr(e,e.stylesheets),e.unsuspend){var o=e.unsuspend;e.unsuspend=null,o()}},6e4+a);0<e.imgBytes&&cd===0&&(cd=62500*Mg());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&yr(e,e.stylesheets),e.unsuspend)){var o=e.unsuspend;e.unsuspend=null,o()}},(e.imgBytes>cd?50:800)+a);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(r)}}:null}function gr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)yr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var br=null;function yr(e,a){e.stylesheets=null,e.unsuspend!==null&&(e.count++,br=new Map,a.forEach(Wg,e),br=null,gr.call(e))}function Wg(e,a){if(!(a.state.loading&4)){var s=br.get(e);if(s)var l=s.get(null);else{s=new Map,br.set(e,s);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<r.length;o++){var x=r[o];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(s.set(x.dataset.precedence,x),l=x)}l&&s.set(null,l)}r=a.instance,x=r.getAttribute("data-precedence"),o=s.get(x)||l,o===l&&s.set(null,r),s.set(x,r),this.count++,l=gr.bind(this),r.addEventListener("load",l),r.addEventListener("error",l),o?o.parentNode.insertBefore(r,o.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),a.state.loading|=4}}var ql={$$typeof:M,Provider:null,Consumer:null,_currentValue:xe,_currentValue2:xe,_threadCount:0};function eb(e,a,s,l,r,o,x,j,A){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ac(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ac(0),this.hiddenUpdates=ac(null),this.identifierPrefix=l,this.onUncaughtError=r,this.onCaughtError=o,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=A,this.incompleteTransitions=new Map}function Wf(e,a,s,l,r,o,x,j,A,U,V,F){return e=new eb(e,a,s,x,A,U,V,F,j),a=1,o===!0&&(a|=24),o=Vt(3,null,null,a),e.current=o,o.stateNode=e,a=Hc(),a.refCount++,e.pooledCache=a,a.refCount++,o.memoizedState={element:l,isDehydrated:s,cache:a},Vc(o),e}function eh(e){return e?(e=bn,e):bn}function th(e,a,s,l,r,o){r=eh(r),l.context===null?l.context=r:l.pendingContext=r,l=cs(a),l.payload={element:s},o=o===void 0?null:o,o!==null&&(l.callback=o),s=os(e,l,a),s!==null&&(Ht(s,e,a),yl(s,e,a))}function ah(e,a){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<a?s:a}}function od(e,a){ah(e,a),(e=e.alternate)&&ah(e,a)}function sh(e){if(e.tag===13||e.tag===31){var a=$s(e,67108864);a!==null&&Ht(a,e,67108864),od(e,67108864)}}function nh(e){if(e.tag===13||e.tag===31){var a=Jt();a=sc(a);var s=$s(e,a);s!==null&&Ht(s,e,a),od(e,a)}}var vr=!0;function tb(e,a,s,l){var r=G.T;G.T=null;var o=ee.p;try{ee.p=2,dd(e,a,s,l)}finally{ee.p=o,G.T=r}}function ab(e,a,s,l){var r=G.T;G.T=null;var o=ee.p;try{ee.p=8,dd(e,a,s,l)}finally{ee.p=o,G.T=r}}function dd(e,a,s,l){if(vr){var r=ud(l);if(r===null)Fo(e,a,l,jr,s),ih(e,l);else if(nb(r,e,a,s,l))l.stopPropagation();else if(ih(e,l),a&4&&-1<sb.indexOf(e)){for(;r!==null;){var o=rn(r);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var x=Os(o.pendingLanes);if(x!==0){var j=o;for(j.pendingLanes|=2,j.entangledLanes|=2;x;){var A=1<<31-Tt(x);j.entanglements[1]|=A,x&=~A}Na(o),(_e&6)===0&&(sr=pe()+500,Ll(0))}}break;case 31:case 13:j=$s(o,2),j!==null&&Ht(j,o,2),lr(),od(o,2)}if(o=ud(l),o===null&&Fo(e,a,l,jr,s),o===r)break;r=o}r!==null&&l.stopPropagation()}else Fo(e,a,l,null,s)}}function ud(e){return e=mc(e),md(e)}var jr=null;function md(e){if(jr=null,e=ln(e),e!==null){var a=f(e);if(a===null)e=null;else{var s=a.tag;if(s===13){if(e=h(a),e!==null)return e;e=null}else if(s===31){if(e=b(a),e!==null)return e;e=null}else if(s===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;e=null}else a!==e&&(e=null)}}return jr=e,null}function lh(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ze()){case Ve:return 2;case St:return 8;case Wa:case tc:return 32;case es:return 268435456;default:return 32}default:return 32}}var xd=!1,vs=null,js=null,Ns=null,Gl=new Map,Kl=new Map,ws=[],sb="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function ih(e,a){switch(e){case"focusin":case"focusout":vs=null;break;case"dragenter":case"dragleave":js=null;break;case"mouseover":case"mouseout":Ns=null;break;case"pointerover":case"pointerout":Gl.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Kl.delete(a.pointerId)}}function Vl(e,a,s,l,r,o){return e===null||e.nativeEvent!==o?(e={blockedOn:a,domEventName:s,eventSystemFlags:l,nativeEvent:o,targetContainers:[r]},a!==null&&(a=rn(a),a!==null&&sh(a)),e):(e.eventSystemFlags|=l,a=e.targetContainers,r!==null&&a.indexOf(r)===-1&&a.push(r),e)}function nb(e,a,s,l,r){switch(a){case"focusin":return vs=Vl(vs,e,a,s,l,r),!0;case"dragenter":return js=Vl(js,e,a,s,l,r),!0;case"mouseover":return Ns=Vl(Ns,e,a,s,l,r),!0;case"pointerover":var o=r.pointerId;return Gl.set(o,Vl(Gl.get(o)||null,e,a,s,l,r)),!0;case"gotpointercapture":return o=r.pointerId,Kl.set(o,Vl(Kl.get(o)||null,e,a,s,l,r)),!0}return!1}function rh(e){var a=ln(e.target);if(a!==null){var s=f(a);if(s!==null){if(a=s.tag,a===13){if(a=h(s),a!==null){e.blockedOn=a,vu(e.priority,function(){nh(s)});return}}else if(a===31){if(a=b(s),a!==null){e.blockedOn=a,vu(e.priority,function(){nh(s)});return}}else if(a===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Nr(e){if(e.blockedOn!==null)return!1;for(var a=e.targetContainers;0<a.length;){var s=ud(e.nativeEvent);if(s===null){s=e.nativeEvent;var l=new s.constructor(s.type,s);uc=l,s.target.dispatchEvent(l),uc=null}else return a=rn(s),a!==null&&sh(a),e.blockedOn=s,!1;a.shift()}return!0}function ch(e,a,s){Nr(e)&&s.delete(a)}function lb(){xd=!1,vs!==null&&Nr(vs)&&(vs=null),js!==null&&Nr(js)&&(js=null),Ns!==null&&Nr(Ns)&&(Ns=null),Gl.forEach(ch),Kl.forEach(ch)}function wr(e,a){e.blockedOn===a&&(e.blockedOn=null,xd||(xd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,lb)))}var Sr=null;function oh(e){Sr!==e&&(Sr=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Sr===e&&(Sr=null);for(var a=0;a<e.length;a+=3){var s=e[a],l=e[a+1],r=e[a+2];if(typeof l!="function"){if(md(l||s)===null)continue;break}var o=rn(s);o!==null&&(e.splice(a,3),a-=3,uo(o,{pending:!0,data:r,method:s.method,action:l},l,r))}}))}function Gn(e){function a(A){return wr(A,e)}vs!==null&&wr(vs,e),js!==null&&wr(js,e),Ns!==null&&wr(Ns,e),Gl.forEach(a),Kl.forEach(a);for(var s=0;s<ws.length;s++){var l=ws[s];l.blockedOn===e&&(l.blockedOn=null)}for(;0<ws.length&&(s=ws[0],s.blockedOn===null);)rh(s),s.blockedOn===null&&ws.shift();if(s=(e.ownerDocument||e).$$reactFormReplay,s!=null)for(l=0;l<s.length;l+=3){var r=s[l],o=s[l+1],x=r[Ot]||null;if(typeof o=="function")x||oh(s);else if(x){var j=null;if(o&&o.hasAttribute("formAction")){if(r=o,x=o[Ot]||null)j=x.formAction;else if(md(r)!==null)continue}else j=x.action;typeof j=="function"?s[l+1]=j:(s.splice(l,3),l-=3),oh(s)}}}function dh(){function e(o){o.canIntercept&&o.info==="react-transition"&&o.intercept({handler:function(){return new Promise(function(x){return r=x})},focusReset:"manual",scroll:"manual"})}function a(){r!==null&&(r(),r=null),l||setTimeout(s,20)}function s(){if(!l&&!navigation.transition){var o=navigation.currentEntry;o&&o.url!=null&&navigation.navigate(o.url,{state:o.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(s,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),r!==null&&(r(),r=null)}}}function fd(e){this._internalRoot=e}kr.prototype.render=fd.prototype.render=function(e){var a=this._internalRoot;if(a===null)throw Error(c(409));var s=a.current,l=Jt();th(s,l,e,a,null,null)},kr.prototype.unmount=fd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var a=e.containerInfo;th(e.current,2,null,e,null,null),lr(),a[nn]=null}};function kr(e){this._internalRoot=e}kr.prototype.unstable_scheduleHydration=function(e){if(e){var a=yu();e={blockedOn:null,target:e,priority:a};for(var s=0;s<ws.length&&a!==0&&a<ws[s].priority;s++);ws.splice(s,0,e),s===0&&rh(e)}};var uh=i.version;if(uh!=="19.2.4")throw Error(c(527,uh,"19.2.4"));ee.findDOMNode=function(e){var a=e._reactInternals;if(a===void 0)throw typeof e.render=="function"?Error(c(188)):(e=Object.keys(e).join(","),Error(c(268,e)));return e=p(a),e=e!==null?w(e):null,e=e===null?null:e.stateNode,e};var ib={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:G,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var zr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zr.isDisabled&&zr.supportsFiber)try{ba=zr.inject(ib),bt=zr}catch{}}return Xl.createRoot=function(e,a){if(!m(e))throw Error(c(299));var s=!1,l="",r=gx,o=bx,x=yx;return a!=null&&(a.unstable_strictMode===!0&&(s=!0),a.identifierPrefix!==void 0&&(l=a.identifierPrefix),a.onUncaughtError!==void 0&&(r=a.onUncaughtError),a.onCaughtError!==void 0&&(o=a.onCaughtError),a.onRecoverableError!==void 0&&(x=a.onRecoverableError)),a=Wf(e,1,!1,null,null,s,l,null,r,o,x,dh),e[nn]=a.current,Jo(e),new fd(a)},Xl.hydrateRoot=function(e,a,s){if(!m(e))throw Error(c(299));var l=!1,r="",o=gx,x=bx,j=yx,A=null;return s!=null&&(s.unstable_strictMode===!0&&(l=!0),s.identifierPrefix!==void 0&&(r=s.identifierPrefix),s.onUncaughtError!==void 0&&(o=s.onUncaughtError),s.onCaughtError!==void 0&&(x=s.onCaughtError),s.onRecoverableError!==void 0&&(j=s.onRecoverableError),s.formState!==void 0&&(A=s.formState)),a=Wf(e,1,!0,a,s??null,l,r,A,o,x,j,dh),a.context=eh(null),s=a.current,l=Jt(),l=sc(l),r=cs(l),r.callback=null,os(s,r,l),s=l,a.current.lanes=s,tl(a,s),Na(a),e[nn]=a.current,Jo(e),new kr(a)},Xl.version="19.2.4",Xl}var jh;function bb(){if(jh)return bd.exports;jh=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),bd.exports=gb(),bd.exports}var yb=bb();/**
50
+ * react-router v7.13.2
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */var Nh="popstate";function wh(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function vb(n={}){function i(c,m){var p;let f=(p=m.state)==null?void 0:p.masked,{pathname:h,search:b,hash:g}=f||c.location;return Dd("",{pathname:h,search:b,hash:g},m.state&&m.state.usr||null,m.state&&m.state.key||"default",f?{pathname:c.location.pathname,search:c.location.search,hash:c.location.hash}:void 0)}function d(c,m){return typeof m=="string"?m:Wl(m)}return Nb(i,d,null,n)}function Ie(n,i){if(n===!1||n===null||typeof n>"u")throw new Error(i)}function oa(n,i){if(!n){typeof console<"u"&&console.warn(i);try{throw new Error(i)}catch{}}}function jb(){return Math.random().toString(36).substring(2,10)}function Sh(n,i){return{usr:n.state,key:n.key,idx:i,masked:n.unstable_mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function Dd(n,i,d=null,c,m){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof i=="string"?Qn(i):i,state:d,key:i&&i.key||c||jb(),unstable_mask:m}}function Wl({pathname:n="/",search:i="",hash:d=""}){return i&&i!=="?"&&(n+=i.charAt(0)==="?"?i:"?"+i),d&&d!=="#"&&(n+=d.charAt(0)==="#"?d:"#"+d),n}function Qn(n){let i={};if(n){let d=n.indexOf("#");d>=0&&(i.hash=n.substring(d),n=n.substring(0,d));let c=n.indexOf("?");c>=0&&(i.search=n.substring(c),n=n.substring(0,c)),n&&(i.pathname=n)}return i}function Nb(n,i,d,c={}){let{window:m=document.defaultView,v5Compat:f=!1}=c,h=m.history,b="POP",g=null,p=w();p==null&&(p=0,h.replaceState({...h.state,idx:p},""));function w(){return(h.state||{idx:null}).idx}function v(){b="POP";let S=w(),C=S==null?null:S-p;p=S,g&&g({action:b,location:N.location,delta:C})}function y(S,C){b="PUSH";let O=wh(S)?S:Dd(N.location,S,C);p=w()+1;let M=Sh(O,p),E=N.createHref(O.unstable_mask||O);try{h.pushState(M,"",E)}catch(ae){if(ae instanceof DOMException&&ae.name==="DataCloneError")throw ae;m.location.assign(E)}f&&g&&g({action:b,location:N.location,delta:1})}function k(S,C){b="REPLACE";let O=wh(S)?S:Dd(N.location,S,C);p=w();let M=Sh(O,p),E=N.createHref(O.unstable_mask||O);h.replaceState(M,"",E),f&&g&&g({action:b,location:N.location,delta:0})}function z(S){return wb(S)}let N={get action(){return b},get location(){return n(m,h)},listen(S){if(g)throw new Error("A history only accepts one active listener");return m.addEventListener(Nh,v),g=S,()=>{m.removeEventListener(Nh,v),g=null}},createHref(S){return i(m,S)},createURL:z,encodeLocation(S){let C=z(S);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:y,replace:k,go(S){return h.go(S)}};return N}function wb(n,i=!1){let d="http://localhost";typeof window<"u"&&(d=window.location.origin!=="null"?window.location.origin:window.location.href),Ie(d,"No window.location.(origin|href) available to create URL");let c=typeof n=="string"?n:Wl(n);return c=c.replace(/ $/,"%20"),!i&&c.startsWith("//")&&(c=d+c),new URL(c,d)}function Ph(n,i,d="/"){return Sb(n,i,d,!1)}function Sb(n,i,d,c){let m=typeof i=="string"?Qn(i):i,f=Za(m.pathname||"/",d);if(f==null)return null;let h=Wh(n);kb(h);let b=null;for(let g=0;b==null&&g<h.length;++g){let p=_b(f);b=Ob(h[g],p,c)}return b}function Wh(n,i=[],d=[],c="",m=!1){let f=(h,b,g=m,p)=>{let w={relativePath:p===void 0?h.path||"":p,caseSensitive:h.caseSensitive===!0,childrenIndex:b,route:h};if(w.relativePath.startsWith("/")){if(!w.relativePath.startsWith(c)&&g)return;Ie(w.relativePath.startsWith(c),`Absolute route path "${w.relativePath}" nested under path "${c}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),w.relativePath=w.relativePath.slice(c.length)}let v=wa([c,w.relativePath]),y=d.concat(w);h.children&&h.children.length>0&&(Ie(h.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),Wh(h.children,i,y,v,g)),!(h.path==null&&!h.index)&&i.push({path:v,score:Mb(v,h.index),routesMeta:y})};return n.forEach((h,b)=>{var g;if(h.path===""||!((g=h.path)!=null&&g.includes("?")))f(h,b);else for(let p of e0(h.path))f(h,b,!0,p)}),i}function e0(n){let i=n.split("/");if(i.length===0)return[];let[d,...c]=i,m=d.endsWith("?"),f=d.replace(/\?$/,"");if(c.length===0)return m?[f,""]:[f];let h=e0(c.join("/")),b=[];return b.push(...h.map(g=>g===""?f:[f,g].join("/"))),m&&b.push(...h),b.map(g=>n.startsWith("/")&&g===""?"/":g)}function kb(n){n.sort((i,d)=>i.score!==d.score?d.score-i.score:Db(i.routesMeta.map(c=>c.childrenIndex),d.routesMeta.map(c=>c.childrenIndex)))}var zb=/^:[\w-]+$/,Cb=3,Ab=2,Eb=1,Tb=10,Rb=-2,kh=n=>n==="*";function Mb(n,i){let d=n.split("/"),c=d.length;return d.some(kh)&&(c+=Rb),i&&(c+=Ab),d.filter(m=>!kh(m)).reduce((m,f)=>m+(zb.test(f)?Cb:f===""?Eb:Tb),c)}function Db(n,i){return n.length===i.length&&n.slice(0,-1).every((c,m)=>c===i[m])?n[n.length-1]-i[i.length-1]:0}function Ob(n,i,d=!1){let{routesMeta:c}=n,m={},f="/",h=[];for(let b=0;b<c.length;++b){let g=c[b],p=b===c.length-1,w=f==="/"?i:i.slice(f.length)||"/",v=qr({path:g.relativePath,caseSensitive:g.caseSensitive,end:p},w),y=g.route;if(!v&&p&&d&&!c[c.length-1].route.index&&(v=qr({path:g.relativePath,caseSensitive:g.caseSensitive,end:!1},w)),!v)return null;Object.assign(m,v.params),h.push({params:m,pathname:wa([f,v.pathname]),pathnameBase:Hb(wa([f,v.pathnameBase])),route:y}),v.pathnameBase!=="/"&&(f=wa([f,v.pathnameBase]))}return h}function qr(n,i){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[d,c]=Lb(n.path,n.caseSensitive,n.end),m=i.match(d);if(!m)return null;let f=m[0],h=f.replace(/(.)\/+$/,"$1"),b=m.slice(1);return{params:c.reduce((p,{paramName:w,isOptional:v},y)=>{if(w==="*"){let z=b[y]||"";h=f.slice(0,f.length-z.length).replace(/(.)\/+$/,"$1")}const k=b[y];return v&&!k?p[w]=void 0:p[w]=(k||"").replace(/%2F/g,"/"),p},{}),pathname:f,pathnameBase:h,pattern:n}}function Lb(n,i=!1,d=!0){oa(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let c=[],m="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(h,b,g,p,w)=>{if(c.push({paramName:b,isOptional:g!=null}),g){let v=w.charAt(p+h.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(c.push({paramName:"*"}),m+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):d?m+="\\/*$":n!==""&&n!=="/"&&(m+="(?:(?=\\/|$))"),[new RegExp(m,i?void 0:"i"),c]}function _b(n){try{return n.split("/").map(i=>decodeURIComponent(i).replace(/\//g,"%2F")).join("/")}catch(i){return oa(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${i}).`),n}}function Za(n,i){if(i==="/")return n;if(!n.toLowerCase().startsWith(i.toLowerCase()))return null;let d=i.endsWith("/")?i.length-1:i.length,c=n.charAt(d);return c&&c!=="/"?null:n.slice(d)||"/"}var Ub=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Bb(n,i="/"){let{pathname:d,search:c="",hash:m=""}=typeof n=="string"?Qn(n):n,f;return d?(d=d.replace(/\/\/+/g,"/"),d.startsWith("/")?f=zh(d.substring(1),"/"):f=zh(d,i)):f=i,{pathname:f,search:qb(c),hash:Gb(m)}}function zh(n,i){let d=i.replace(/\/+$/,"").split("/");return n.split("/").forEach(m=>{m===".."?d.length>1&&d.pop():m!=="."&&d.push(m)}),d.length>1?d.join("/"):"/"}function Nd(n,i,d,c){return`Cannot include a '${n}' character in a manually specified \`to.${i}\` field [${JSON.stringify(c)}]. Please separate it out to the \`to.${d}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function $b(n){return n.filter((i,d)=>d===0||i.route.path&&i.route.path.length>0)}function Vd(n){let i=$b(n);return i.map((d,c)=>c===i.length-1?d.pathname:d.pathnameBase)}function Vr(n,i,d,c=!1){let m;typeof n=="string"?m=Qn(n):(m={...n},Ie(!m.pathname||!m.pathname.includes("?"),Nd("?","pathname","search",m)),Ie(!m.pathname||!m.pathname.includes("#"),Nd("#","pathname","hash",m)),Ie(!m.search||!m.search.includes("#"),Nd("#","search","hash",m)));let f=n===""||m.pathname==="",h=f?"/":m.pathname,b;if(h==null)b=d;else{let v=i.length-1;if(!c&&h.startsWith("..")){let y=h.split("/");for(;y[0]==="..";)y.shift(),v-=1;m.pathname=y.join("/")}b=v>=0?i[v]:"/"}let g=Bb(m,b),p=h&&h!=="/"&&h.endsWith("/"),w=(f||h===".")&&d.endsWith("/");return!g.pathname.endsWith("/")&&(p||w)&&(g.pathname+="/"),g}var wa=n=>n.join("/").replace(/\/\/+/g,"/"),Hb=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),qb=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,Gb=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,Kb=class{constructor(n,i,d,c=!1){this.status=n,this.statusText=i||"",this.internal=c,d instanceof Error?(this.data=d.toString(),this.error=d):this.data=d}};function Vb(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function Yb(n){return n.map(i=>i.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var t0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function a0(n,i){let d=n;if(typeof d!="string"||!Ub.test(d))return{absoluteURL:void 0,isExternal:!1,to:d};let c=d,m=!1;if(t0)try{let f=new URL(window.location.href),h=d.startsWith("//")?new URL(f.protocol+d):new URL(d),b=Za(h.pathname,i);h.origin===f.origin&&b!=null?d=b+h.search+h.hash:m=!0}catch{oa(!1,`<Link to="${d}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:c,isExternal:m,to:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var s0=["POST","PUT","PATCH","DELETE"];new Set(s0);var Xb=["GET",...s0];new Set(Xb);var Zn=u.createContext(null);Zn.displayName="DataRouter";var Yr=u.createContext(null);Yr.displayName="DataRouterState";var Qb=u.createContext(!1),n0=u.createContext({isTransitioning:!1});n0.displayName="ViewTransition";var Zb=u.createContext(new Map);Zb.displayName="Fetchers";var Jb=u.createContext(null);Jb.displayName="Await";var It=u.createContext(null);It.displayName="Navigation";var li=u.createContext(null);li.displayName="Location";var da=u.createContext({outlet:null,matches:[],isDataRoute:!1});da.displayName="Route";var Yd=u.createContext(null);Yd.displayName="RouteError";var l0="REACT_ROUTER_ERROR",Fb="REDIRECT",Ib="ROUTE_ERROR_RESPONSE";function Pb(n){if(n.startsWith(`${l0}:${Fb}:{`))try{let i=JSON.parse(n.slice(28));if(typeof i=="object"&&i&&typeof i.status=="number"&&typeof i.statusText=="string"&&typeof i.location=="string"&&typeof i.reloadDocument=="boolean"&&typeof i.replace=="boolean")return i}catch{}}function Wb(n){if(n.startsWith(`${l0}:${Ib}:{`))try{let i=JSON.parse(n.slice(40));if(typeof i=="object"&&i&&typeof i.status=="number"&&typeof i.statusText=="string")return new Kb(i.status,i.statusText,i.data)}catch{}}function ey(n,{relative:i}={}){Ie(Jn(),"useHref() may be used only in the context of a <Router> component.");let{basename:d,navigator:c}=u.useContext(It),{hash:m,pathname:f,search:h}=ii(n,{relative:i}),b=f;return d!=="/"&&(b=f==="/"?d:wa([d,f])),c.createHref({pathname:b,search:h,hash:m})}function Jn(){return u.useContext(li)!=null}function pa(){return Ie(Jn(),"useLocation() may be used only in the context of a <Router> component."),u.useContext(li).location}var i0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function r0(n){u.useContext(It).static||u.useLayoutEffect(n)}function Dt(){let{isDataRoute:n}=u.useContext(da);return n?hy():ty()}function ty(){Ie(Jn(),"useNavigate() may be used only in the context of a <Router> component.");let n=u.useContext(Zn),{basename:i,navigator:d}=u.useContext(It),{matches:c}=u.useContext(da),{pathname:m}=pa(),f=JSON.stringify(Vd(c)),h=u.useRef(!1);return r0(()=>{h.current=!0}),u.useCallback((g,p={})=>{if(oa(h.current,i0),!h.current)return;if(typeof g=="number"){d.go(g);return}let w=Vr(g,JSON.parse(f),m,p.relative==="path");n==null&&i!=="/"&&(w.pathname=w.pathname==="/"?i:wa([i,w.pathname])),(p.replace?d.replace:d.push)(w,p.state,p)},[i,d,f,m,n])}var ay=u.createContext(null);function sy(n){let i=u.useContext(da).outlet;return u.useMemo(()=>i&&u.createElement(ay.Provider,{value:n},i),[i,n])}function Fn(){let{matches:n}=u.useContext(da),i=n[n.length-1];return i?i.params:{}}function ii(n,{relative:i}={}){let{matches:d}=u.useContext(da),{pathname:c}=pa(),m=JSON.stringify(Vd(d));return u.useMemo(()=>Vr(n,JSON.parse(m),c,i==="path"),[n,m,c,i])}function ny(n,i){return c0(n,i)}function c0(n,i,d){var S;Ie(Jn(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:c}=u.useContext(It),{matches:m}=u.useContext(da),f=m[m.length-1],h=f?f.params:{},b=f?f.pathname:"/",g=f?f.pathnameBase:"/",p=f&&f.route;{let C=p&&p.path||"";d0(b,!p||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${b}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
+
60
+ Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let w=pa(),v;if(i){let C=typeof i=="string"?Qn(i):i;Ie(g==="/"||((S=C.pathname)==null?void 0:S.startsWith(g)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${g}" but pathname "${C.pathname}" was given in the \`location\` prop.`),v=C}else v=w;let y=v.pathname||"/",k=y;if(g!=="/"){let C=g.replace(/^\//,"").split("/");k="/"+y.replace(/^\//,"").split("/").slice(C.length).join("/")}let z=Ph(n,{pathname:k});oa(p||z!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),oa(z==null||z[z.length-1].route.element!==void 0||z[z.length-1].route.Component!==void 0||z[z.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let N=oy(z&&z.map(C=>Object.assign({},C,{params:Object.assign({},h,C.params),pathname:wa([g,c.encodeLocation?c.encodeLocation(C.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?g:wa([g,c.encodeLocation?c.encodeLocation(C.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),m,d);return i&&N?u.createElement(li.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...v},navigationType:"POP"}},N):N}function ly(){let n=fy(),i=Vb(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),d=n instanceof Error?n.stack:null,c="rgba(200,200,200, 0.5)",m={padding:"0.5rem",backgroundColor:c},f={padding:"2px 4px",backgroundColor:c},h=null;return console.error("Error handled by React Router default ErrorBoundary:",n),h=u.createElement(u.Fragment,null,u.createElement("p",null,"💿 Hey developer 👋"),u.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",u.createElement("code",{style:f},"ErrorBoundary")," or"," ",u.createElement("code",{style:f},"errorElement")," prop on your route.")),u.createElement(u.Fragment,null,u.createElement("h2",null,"Unexpected Application Error!"),u.createElement("h3",{style:{fontStyle:"italic"}},i),d?u.createElement("pre",{style:m},d):null,h)}var iy=u.createElement(ly,null),o0=class extends u.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,i){return i.location!==n.location||i.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:i.error,location:i.location,revalidation:n.revalidation||i.revalidation}}componentDidCatch(n,i){this.props.onError?this.props.onError(n,i):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const d=Wb(n.digest);d&&(n=d)}let i=n!==void 0?u.createElement(da.Provider,{value:this.props.routeContext},u.createElement(Yd.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?u.createElement(ry,{error:n},i):i}};o0.contextType=Qb;var wd=new WeakMap;function ry({children:n,error:i}){let{basename:d}=u.useContext(It);if(typeof i=="object"&&i&&"digest"in i&&typeof i.digest=="string"){let c=Pb(i.digest);if(c){let m=wd.get(i);if(m)throw m;let f=a0(c.location,d);if(t0&&!wd.get(i))if(f.isExternal||c.reloadDocument)window.location.href=f.absoluteURL||f.to;else{const h=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(f.to,{replace:c.replace}));throw wd.set(i,h),h}return u.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f.absoluteURL||f.to}`})}}return n}function cy({routeContext:n,match:i,children:d}){let c=u.useContext(Zn);return c&&c.static&&c.staticContext&&(i.route.errorElement||i.route.ErrorBoundary)&&(c.staticContext._deepestRenderedBoundaryId=i.route.id),u.createElement(da.Provider,{value:n},d)}function oy(n,i=[],d){let c=d==null?void 0:d.state;if(n==null){if(!c)return null;if(c.errors)n=c.matches;else if(i.length===0&&!c.initialized&&c.matches.length>0)n=c.matches;else return null}let m=n,f=c==null?void 0:c.errors;if(f!=null){let w=m.findIndex(v=>v.route.id&&(f==null?void 0:f[v.route.id])!==void 0);Ie(w>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),m=m.slice(0,Math.min(m.length,w+1))}let h=!1,b=-1;if(d&&c){h=c.renderFallback;for(let w=0;w<m.length;w++){let v=m[w];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(b=w),v.route.id){let{loaderData:y,errors:k}=c,z=v.route.loader&&!y.hasOwnProperty(v.route.id)&&(!k||k[v.route.id]===void 0);if(v.route.lazy||z){d.isStatic&&(h=!0),b>=0?m=m.slice(0,b+1):m=[m[0]];break}}}}let g=d==null?void 0:d.onError,p=c&&g?(w,v)=>{var y,k;g(w,{location:c.location,params:((k=(y=c.matches)==null?void 0:y[0])==null?void 0:k.params)??{},unstable_pattern:Yb(c.matches),errorInfo:v})}:void 0;return m.reduceRight((w,v,y)=>{let k,z=!1,N=null,S=null;c&&(k=f&&v.route.id?f[v.route.id]:void 0,N=v.route.errorElement||iy,h&&(b<0&&y===0?(d0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),z=!0,S=null):b===y&&(z=!0,S=v.route.hydrateFallbackElement||null)));let C=i.concat(m.slice(0,y+1)),O=()=>{let M;return k?M=N:z?M=S:v.route.Component?M=u.createElement(v.route.Component,null):v.route.element?M=v.route.element:M=w,u.createElement(cy,{match:v,routeContext:{outlet:w,matches:C,isDataRoute:c!=null},children:M})};return c&&(v.route.ErrorBoundary||v.route.errorElement||y===0)?u.createElement(o0,{location:c.location,revalidation:c.revalidation,component:N,error:k,children:O(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:p}):O()},null)}function Xd(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function dy(n){let i=u.useContext(Zn);return Ie(i,Xd(n)),i}function uy(n){let i=u.useContext(Yr);return Ie(i,Xd(n)),i}function my(n){let i=u.useContext(da);return Ie(i,Xd(n)),i}function Qd(n){let i=my(n),d=i.matches[i.matches.length-1];return Ie(d.route.id,`${n} can only be used on routes that contain a unique "id"`),d.route.id}function xy(){return Qd("useRouteId")}function fy(){var c;let n=u.useContext(Yd),i=uy("useRouteError"),d=Qd("useRouteError");return n!==void 0?n:(c=i.errors)==null?void 0:c[d]}function hy(){let{router:n}=dy("useNavigate"),i=Qd("useNavigate"),d=u.useRef(!1);return r0(()=>{d.current=!0}),u.useCallback(async(m,f={})=>{oa(d.current,i0),d.current&&(typeof m=="number"?await n.navigate(m):await n.navigate(m,{fromRouteId:i,...f}))},[n,i])}var Ch={};function d0(n,i,d){!i&&!Ch[n]&&(Ch[n]=!0,oa(!1,d))}u.memo(py);function py({routes:n,future:i,state:d,isStatic:c,onError:m}){return c0(n,void 0,{state:d,isStatic:c,onError:m})}function Ah({to:n,replace:i,state:d,relative:c}){Ie(Jn(),"<Navigate> may be used only in the context of a <Router> component.");let{static:m}=u.useContext(It);oa(!m,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:f}=u.useContext(da),{pathname:h}=pa(),b=Dt(),g=Vr(n,Vd(f),h,c==="path"),p=JSON.stringify(g);return u.useEffect(()=>{b(JSON.parse(p),{replace:i,state:d,relative:c})},[b,p,c,i,d]),null}function gy(n){return sy(n.context)}function De(n){Ie(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function by({basename:n="/",children:i=null,location:d,navigationType:c="POP",navigator:m,static:f=!1,unstable_useTransitions:h}){Ie(!Jn(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let b=n.replace(/^\/*/,"/"),g=u.useMemo(()=>({basename:b,navigator:m,static:f,unstable_useTransitions:h,future:{}}),[b,m,f,h]);typeof d=="string"&&(d=Qn(d));let{pathname:p="/",search:w="",hash:v="",state:y=null,key:k="default",unstable_mask:z}=d,N=u.useMemo(()=>{let S=Za(p,b);return S==null?null:{location:{pathname:S,search:w,hash:v,state:y,key:k,unstable_mask:z},navigationType:c}},[b,p,w,v,y,k,c,z]);return oa(N!=null,`<Router basename="${b}"> is not able to match the URL "${p}${w}${v}" because it does not start with the basename, so the <Router> won't render anything.`),N==null?null:u.createElement(It.Provider,{value:g},u.createElement(li.Provider,{children:i,value:N}))}function u0({children:n,location:i}){return ny(Od(n),i)}function Od(n,i=[]){let d=[];return u.Children.forEach(n,(c,m)=>{if(!u.isValidElement(c))return;let f=[...i,m];if(c.type===u.Fragment){d.push.apply(d,Od(c.props.children,f));return}Ie(c.type===De,`[${typeof c.type=="string"?c.type:c.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ie(!c.props.index||!c.props.children,"An index route cannot have child routes.");let h={id:c.props.id||f.join("-"),caseSensitive:c.props.caseSensitive,element:c.props.element,Component:c.props.Component,index:c.props.index,path:c.props.path,middleware:c.props.middleware,loader:c.props.loader,action:c.props.action,hydrateFallbackElement:c.props.hydrateFallbackElement,HydrateFallback:c.props.HydrateFallback,errorElement:c.props.errorElement,ErrorBoundary:c.props.ErrorBoundary,hasErrorBoundary:c.props.hasErrorBoundary===!0||c.props.ErrorBoundary!=null||c.props.errorElement!=null,shouldRevalidate:c.props.shouldRevalidate,handle:c.props.handle,lazy:c.props.lazy};c.props.children&&(h.children=Od(c.props.children,f)),d.push(h)}),d}var Br="get",$r="application/x-www-form-urlencoded";function Xr(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function yy(n){return Xr(n)&&n.tagName.toLowerCase()==="button"}function vy(n){return Xr(n)&&n.tagName.toLowerCase()==="form"}function jy(n){return Xr(n)&&n.tagName.toLowerCase()==="input"}function Ny(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function wy(n,i){return n.button===0&&(!i||i==="_self")&&!Ny(n)}function Ld(n=""){return new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((i,d)=>{let c=n[d];return i.concat(Array.isArray(c)?c.map(m=>[d,m]):[[d,c]])},[]))}function Sy(n,i){let d=Ld(n);return i&&i.forEach((c,m)=>{d.has(m)||i.getAll(m).forEach(f=>{d.append(m,f)})}),d}var Cr=null;function ky(){if(Cr===null)try{new FormData(document.createElement("form"),0),Cr=!1}catch{Cr=!0}return Cr}var zy=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Sd(n){return n!=null&&!zy.has(n)?(oa(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${$r}"`),null):n}function Cy(n,i){let d,c,m,f,h;if(vy(n)){let b=n.getAttribute("action");c=b?Za(b,i):null,d=n.getAttribute("method")||Br,m=Sd(n.getAttribute("enctype"))||$r,f=new FormData(n)}else if(yy(n)||jy(n)&&(n.type==="submit"||n.type==="image")){let b=n.form;if(b==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let g=n.getAttribute("formaction")||b.getAttribute("action");if(c=g?Za(g,i):null,d=n.getAttribute("formmethod")||b.getAttribute("method")||Br,m=Sd(n.getAttribute("formenctype"))||Sd(b.getAttribute("enctype"))||$r,f=new FormData(b,n),!ky()){let{name:p,type:w,value:v}=n;if(w==="image"){let y=p?`${p}.`:"";f.append(`${y}x`,"0"),f.append(`${y}y`,"0")}else p&&f.append(p,v)}}else{if(Xr(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');d=Br,c=null,m=$r,h=n}return f&&m==="text/plain"&&(h=f,f=void 0),{action:c,method:d.toLowerCase(),encType:m,formData:f,body:h}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Zd(n,i){if(n===!1||n===null||typeof n>"u")throw new Error(i)}function Ay(n,i,d,c){let m=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return d?m.pathname.endsWith("/")?m.pathname=`${m.pathname}_.${c}`:m.pathname=`${m.pathname}.${c}`:m.pathname==="/"?m.pathname=`_root.${c}`:i&&Za(m.pathname,i)==="/"?m.pathname=`${i.replace(/\/$/,"")}/_root.${c}`:m.pathname=`${m.pathname.replace(/\/$/,"")}.${c}`,m}async function Ey(n,i){if(n.id in i)return i[n.id];try{let d=await import(n.module);return i[n.id]=d,d}catch(d){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(d),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Ty(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function Ry(n,i,d){let c=await Promise.all(n.map(async m=>{let f=i.routes[m.route.id];if(f){let h=await Ey(f,d);return h.links?h.links():[]}return[]}));return Ly(c.flat(1).filter(Ty).filter(m=>m.rel==="stylesheet"||m.rel==="preload").map(m=>m.rel==="stylesheet"?{...m,rel:"prefetch",as:"style"}:{...m,rel:"prefetch"}))}function Eh(n,i,d,c,m,f){let h=(g,p)=>d[p]?g.route.id!==d[p].route.id:!0,b=(g,p)=>{var w;return d[p].pathname!==g.pathname||((w=d[p].route.path)==null?void 0:w.endsWith("*"))&&d[p].params["*"]!==g.params["*"]};return f==="assets"?i.filter((g,p)=>h(g,p)||b(g,p)):f==="data"?i.filter((g,p)=>{var v;let w=c.routes[g.route.id];if(!w||!w.hasLoader)return!1;if(h(g,p)||b(g,p))return!0;if(g.route.shouldRevalidate){let y=g.route.shouldRevalidate({currentUrl:new URL(m.pathname+m.search+m.hash,window.origin),currentParams:((v=d[0])==null?void 0:v.params)||{},nextUrl:new URL(n,window.origin),nextParams:g.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function My(n,i,{includeHydrateFallback:d}={}){return Dy(n.map(c=>{let m=i.routes[c.route.id];if(!m)return[];let f=[m.module];return m.clientActionModule&&(f=f.concat(m.clientActionModule)),m.clientLoaderModule&&(f=f.concat(m.clientLoaderModule)),d&&m.hydrateFallbackModule&&(f=f.concat(m.hydrateFallbackModule)),m.imports&&(f=f.concat(m.imports)),f}).flat(1))}function Dy(n){return[...new Set(n)]}function Oy(n){let i={},d=Object.keys(n).sort();for(let c of d)i[c]=n[c];return i}function Ly(n,i){let d=new Set;return new Set(i),n.reduce((c,m)=>{let f=JSON.stringify(Oy(m));return d.has(f)||(d.add(f),c.push({key:f,link:m})),c},[])}function m0(){let n=u.useContext(Zn);return Zd(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function _y(){let n=u.useContext(Yr);return Zd(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var Jd=u.createContext(void 0);Jd.displayName="FrameworkContext";function x0(){let n=u.useContext(Jd);return Zd(n,"You must render this element inside a <HydratedRouter> element"),n}function Uy(n,i){let d=u.useContext(Jd),[c,m]=u.useState(!1),[f,h]=u.useState(!1),{onFocus:b,onBlur:g,onMouseEnter:p,onMouseLeave:w,onTouchStart:v}=i,y=u.useRef(null);u.useEffect(()=>{if(n==="render"&&h(!0),n==="viewport"){let N=C=>{C.forEach(O=>{h(O.isIntersecting)})},S=new IntersectionObserver(N,{threshold:.5});return y.current&&S.observe(y.current),()=>{S.disconnect()}}},[n]),u.useEffect(()=>{if(c){let N=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(N)}}},[c]);let k=()=>{m(!0)},z=()=>{m(!1),h(!1)};return d?n!=="intent"?[f,y,{}]:[f,y,{onFocus:Ql(b,k),onBlur:Ql(g,z),onMouseEnter:Ql(p,k),onMouseLeave:Ql(w,z),onTouchStart:Ql(v,k)}]:[!1,y,{}]}function Ql(n,i){return d=>{n&&n(d),d.defaultPrevented||i(d)}}function By({page:n,...i}){let{router:d}=m0(),c=u.useMemo(()=>Ph(d.routes,n,d.basename),[d.routes,n,d.basename]);return c?u.createElement(Hy,{page:n,matches:c,...i}):null}function $y(n){let{manifest:i,routeModules:d}=x0(),[c,m]=u.useState([]);return u.useEffect(()=>{let f=!1;return Ry(n,i,d).then(h=>{f||m(h)}),()=>{f=!0}},[n,i,d]),c}function Hy({page:n,matches:i,...d}){let c=pa(),{future:m,manifest:f,routeModules:h}=x0(),{basename:b}=m0(),{loaderData:g,matches:p}=_y(),w=u.useMemo(()=>Eh(n,i,p,f,c,"data"),[n,i,p,f,c]),v=u.useMemo(()=>Eh(n,i,p,f,c,"assets"),[n,i,p,f,c]),y=u.useMemo(()=>{if(n===c.pathname+c.search+c.hash)return[];let N=new Set,S=!1;if(i.forEach(O=>{var E;let M=f.routes[O.route.id];!M||!M.hasLoader||(!w.some(ae=>ae.route.id===O.route.id)&&O.route.id in g&&((E=h[O.route.id])!=null&&E.shouldRevalidate)||M.hasClientLoader?S=!0:N.add(O.route.id))}),N.size===0)return[];let C=Ay(n,b,m.unstable_trailingSlashAwareDataRequests,"data");return S&&N.size>0&&C.searchParams.set("_routes",i.filter(O=>N.has(O.route.id)).map(O=>O.route.id).join(",")),[C.pathname+C.search]},[b,m.unstable_trailingSlashAwareDataRequests,g,c,f,w,i,n,h]),k=u.useMemo(()=>My(v,f),[v,f]),z=$y(v);return u.createElement(u.Fragment,null,y.map(N=>u.createElement("link",{key:N,rel:"prefetch",as:"fetch",href:N,...d})),k.map(N=>u.createElement("link",{key:N,rel:"modulepreload",href:N,...d})),z.map(({key:N,link:S})=>u.createElement("link",{key:N,nonce:d.nonce,...S,crossOrigin:S.crossOrigin??d.crossOrigin})))}function qy(...n){return i=>{n.forEach(d=>{typeof d=="function"?d(i):d!=null&&(d.current=i)})}}var Gy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Gy&&(window.__reactRouterVersion="7.13.2")}catch{}function Ky({basename:n,children:i,unstable_useTransitions:d,window:c}){let m=u.useRef();m.current==null&&(m.current=vb({window:c,v5Compat:!0}));let f=m.current,[h,b]=u.useState({action:f.action,location:f.location}),g=u.useCallback(p=>{d===!1?b(p):u.startTransition(()=>b(p))},[d]);return u.useLayoutEffect(()=>f.listen(g),[f,g]),u.createElement(by,{basename:n,children:i,location:h.location,navigationType:h.action,navigator:f,unstable_useTransitions:d})}var f0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Xa=u.forwardRef(function({onClick:i,discover:d="render",prefetch:c="none",relative:m,reloadDocument:f,replace:h,unstable_mask:b,state:g,target:p,to:w,preventScrollReset:v,viewTransition:y,unstable_defaultShouldRevalidate:k,...z},N){let{basename:S,navigator:C,unstable_useTransitions:O}=u.useContext(It),M=typeof w=="string"&&f0.test(w),E=a0(w,S);w=E.to;let ae=ey(w,{relative:m}),ce=pa(),B=null;if(b){let ge=Vr(b,[],ce.unstable_mask?ce.unstable_mask.pathname:"/",!0);S!=="/"&&(ge.pathname=ge.pathname==="/"?S:wa([S,ge.pathname])),B=C.createHref(ge)}let[q,I,W]=Uy(c,z),X=Xy(w,{replace:h,unstable_mask:b,state:g,target:p,preventScrollReset:v,relative:m,viewTransition:y,unstable_defaultShouldRevalidate:k,unstable_useTransitions:O});function le(ge){i&&i(ge),ge.defaultPrevented||X(ge)}let J=!(E.isExternal||f),re=u.createElement("a",{...z,...W,href:(J?B:void 0)||E.absoluteURL||ae,onClick:J?le:i,ref:qy(N,I),target:p,"data-discover":!M&&d==="render"?"true":void 0});return q&&!M?u.createElement(u.Fragment,null,re,u.createElement(By,{page:ae})):re});Xa.displayName="Link";var Il=u.forwardRef(function({"aria-current":i="page",caseSensitive:d=!1,className:c="",end:m=!1,style:f,to:h,viewTransition:b,children:g,...p},w){let v=ii(h,{relative:p.relative}),y=pa(),k=u.useContext(Yr),{navigator:z,basename:N}=u.useContext(It),S=k!=null&&Py(v)&&b===!0,C=z.encodeLocation?z.encodeLocation(v).pathname:v.pathname,O=y.pathname,M=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;d||(O=O.toLowerCase(),M=M?M.toLowerCase():null,C=C.toLowerCase()),M&&N&&(M=Za(M,N)||M);const E=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let ae=O===C||!m&&O.startsWith(C)&&O.charAt(E)==="/",ce=M!=null&&(M===C||!m&&M.startsWith(C)&&M.charAt(C.length)==="/"),B={isActive:ae,isPending:ce,isTransitioning:S},q=ae?i:void 0,I;typeof c=="function"?I=c(B):I=[c,ae?"active":null,ce?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let W=typeof f=="function"?f(B):f;return u.createElement(Xa,{...p,"aria-current":q,className:I,ref:w,style:W,to:h,viewTransition:b},typeof g=="function"?g(B):g)});Il.displayName="NavLink";var Vy=u.forwardRef(({discover:n="render",fetcherKey:i,navigate:d,reloadDocument:c,replace:m,state:f,method:h=Br,action:b,onSubmit:g,relative:p,preventScrollReset:w,viewTransition:v,unstable_defaultShouldRevalidate:y,...k},z)=>{let{unstable_useTransitions:N}=u.useContext(It),S=Fy(),C=Iy(b,{relative:p}),O=h.toLowerCase()==="get"?"get":"post",M=typeof b=="string"&&f0.test(b),E=ae=>{if(g&&g(ae),ae.defaultPrevented)return;ae.preventDefault();let ce=ae.nativeEvent.submitter,B=(ce==null?void 0:ce.getAttribute("formmethod"))||h,q=()=>S(ce||ae.currentTarget,{fetcherKey:i,method:B,navigate:d,replace:m,state:f,relative:p,preventScrollReset:w,viewTransition:v,unstable_defaultShouldRevalidate:y});N&&d!==!1?u.startTransition(()=>q()):q()};return u.createElement("form",{ref:z,method:O,action:C,onSubmit:c?g:E,...k,"data-discover":!M&&n==="render"?"true":void 0})});Vy.displayName="Form";function Yy(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function h0(n){let i=u.useContext(Zn);return Ie(i,Yy(n)),i}function Xy(n,{target:i,replace:d,unstable_mask:c,state:m,preventScrollReset:f,relative:h,viewTransition:b,unstable_defaultShouldRevalidate:g,unstable_useTransitions:p}={}){let w=Dt(),v=pa(),y=ii(n,{relative:h});return u.useCallback(k=>{if(wy(k,i)){k.preventDefault();let z=d!==void 0?d:Wl(v)===Wl(y),N=()=>w(n,{replace:z,unstable_mask:c,state:m,preventScrollReset:f,relative:h,viewTransition:b,unstable_defaultShouldRevalidate:g});p?u.startTransition(()=>N()):N()}},[v,w,y,d,c,m,i,n,f,h,b,g,p])}function Qy(n){oa(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let i=u.useRef(Ld(n)),d=u.useRef(!1),c=pa(),m=u.useMemo(()=>Sy(c.search,d.current?null:i.current),[c.search]),f=Dt(),h=u.useCallback((b,g)=>{const p=Ld(typeof b=="function"?b(new URLSearchParams(m)):b);d.current=!0,f("?"+p,g)},[f,m]);return[m,h]}var Zy=0,Jy=()=>`__${String(++Zy)}__`;function Fy(){let{router:n}=h0("useSubmit"),{basename:i}=u.useContext(It),d=xy(),c=n.fetch,m=n.navigate;return u.useCallback(async(f,h={})=>{let{action:b,method:g,encType:p,formData:w,body:v}=Cy(f,i);if(h.navigate===!1){let y=h.fetcherKey||Jy();await c(y,d,h.action||b,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:w,body:v,formMethod:h.method||g,formEncType:h.encType||p,flushSync:h.flushSync})}else await m(h.action||b,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:w,body:v,formMethod:h.method||g,formEncType:h.encType||p,replace:h.replace,state:h.state,fromRouteId:d,flushSync:h.flushSync,viewTransition:h.viewTransition})},[c,m,i,d])}function Iy(n,{relative:i}={}){let{basename:d}=u.useContext(It),c=u.useContext(da);Ie(c,"useFormAction must be used inside a RouteContext");let[m]=c.matches.slice(-1),f={...ii(n||".",{relative:i})},h=pa();if(n==null){f.search=h.search;let b=new URLSearchParams(f.search),g=b.getAll("index");if(g.some(w=>w==="")){b.delete("index"),g.filter(v=>v).forEach(v=>b.append("index",v));let w=b.toString();f.search=w?`?${w}`:""}}return(!n||n===".")&&m.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),d!=="/"&&(f.pathname=f.pathname==="/"?d:wa([d,f.pathname])),Wl(f)}function Py(n,{relative:i}={}){let d=u.useContext(n0);Ie(d!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:c}=h0("useViewTransitionState"),m=ii(n,{relative:i});if(!d.isTransitioning)return!1;let f=Za(d.currentLocation.pathname,c)||d.currentLocation.pathname,h=Za(d.nextLocation.pathname,c)||d.nextLocation.pathname;return qr(m.pathname,h)!=null||qr(m.pathname,f)!=null}/**
61
+ * @license lucide-react v0.468.0 - ISC
62
+ *
63
+ * This source code is licensed under the ISC license.
64
+ * See the LICENSE file in the root directory of this source tree.
65
+ */const Wy=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),p0=(...n)=>n.filter((i,d,c)=>!!i&&i.trim()!==""&&c.indexOf(i)===d).join(" ").trim();/**
66
+ * @license lucide-react v0.468.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */var ev={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
71
+ * @license lucide-react v0.468.0 - ISC
72
+ *
73
+ * This source code is licensed under the ISC license.
74
+ * See the LICENSE file in the root directory of this source tree.
75
+ */const tv=u.forwardRef(({color:n="currentColor",size:i=24,strokeWidth:d=2,absoluteStrokeWidth:c,className:m="",children:f,iconNode:h,...b},g)=>u.createElement("svg",{ref:g,...ev,width:i,height:i,stroke:n,strokeWidth:c?Number(d)*24/Number(i):d,className:p0("lucide",m),...b},[...h.map(([p,w])=>u.createElement(p,w)),...Array.isArray(f)?f:[f]]));/**
76
+ * @license lucide-react v0.468.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */const te=(n,i)=>{const d=u.forwardRef(({className:c,...m},f)=>u.createElement(tv,{ref:f,iconNode:i,className:p0(`lucide-${Wy(n)}`,c),...m}));return d.displayName=`${n}`,d};/**
81
+ * @license lucide-react v0.468.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */const Ft=te("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
86
+ * @license lucide-react v0.468.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */const Yn=te("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
91
+ * @license lucide-react v0.468.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */const g0=te("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
96
+ * @license lucide-react v0.468.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */const av=te("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
101
+ * @license lucide-react v0.468.0 - ISC
102
+ *
103
+ * This source code is licensed under the ISC license.
104
+ * See the LICENSE file in the root directory of this source tree.
105
+ */const Ja=te("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
106
+ * @license lucide-react v0.468.0 - ISC
107
+ *
108
+ * This source code is licensed under the ISC license.
109
+ * See the LICENSE file in the root directory of this source tree.
110
+ */const Es=te("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
111
+ * @license lucide-react v0.468.0 - ISC
112
+ *
113
+ * This source code is licensed under the ISC license.
114
+ * See the LICENSE file in the root directory of this source tree.
115
+ */const sv=te("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/**
116
+ * @license lucide-react v0.468.0 - ISC
117
+ *
118
+ * This source code is licensed under the ISC license.
119
+ * See the LICENSE file in the root directory of this source tree.
120
+ */const b0=te("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/**
121
+ * @license lucide-react v0.468.0 - ISC
122
+ *
123
+ * This source code is licensed under the ISC license.
124
+ * See the LICENSE file in the root directory of this source tree.
125
+ */const Fd=te("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
126
+ * @license lucide-react v0.468.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ */const nv=te("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/**
131
+ * @license lucide-react v0.468.0 - ISC
132
+ *
133
+ * This source code is licensed under the ISC license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */const lv=te("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
136
+ * @license lucide-react v0.468.0 - ISC
137
+ *
138
+ * This source code is licensed under the ISC license.
139
+ * See the LICENSE file in the root directory of this source tree.
140
+ */const ka=te("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
141
+ * @license lucide-react v0.468.0 - ISC
142
+ *
143
+ * This source code is licensed under the ISC license.
144
+ * See the LICENSE file in the root directory of this source tree.
145
+ */const ut=te("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
146
+ * @license lucide-react v0.468.0 - ISC
147
+ *
148
+ * This source code is licensed under the ISC license.
149
+ * See the LICENSE file in the root directory of this source tree.
150
+ */const Fa=te("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
151
+ * @license lucide-react v0.468.0 - ISC
152
+ *
153
+ * This source code is licensed under the ISC license.
154
+ * See the LICENSE file in the root directory of this source tree.
155
+ */const Th=te("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
156
+ * @license lucide-react v0.468.0 - ISC
157
+ *
158
+ * This source code is licensed under the ISC license.
159
+ * See the LICENSE file in the root directory of this source tree.
160
+ */const ca=te("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
161
+ * @license lucide-react v0.468.0 - ISC
162
+ *
163
+ * This source code is licensed under the ISC license.
164
+ * See the LICENSE file in the root directory of this source tree.
165
+ */const ei=te("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
166
+ * @license lucide-react v0.468.0 - ISC
167
+ *
168
+ * This source code is licensed under the ISC license.
169
+ * See the LICENSE file in the root directory of this source tree.
170
+ */const ti=te("CircleArrowRight",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]);/**
171
+ * @license lucide-react v0.468.0 - ISC
172
+ *
173
+ * This source code is licensed under the ISC license.
174
+ * See the LICENSE file in the root directory of this source tree.
175
+ */const pt=te("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
176
+ * @license lucide-react v0.468.0 - ISC
177
+ *
178
+ * This source code is licensed under the ISC license.
179
+ * See the LICENSE file in the root directory of this source tree.
180
+ */const Id=te("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
181
+ * @license lucide-react v0.468.0 - ISC
182
+ *
183
+ * This source code is licensed under the ISC license.
184
+ * See the LICENSE file in the root directory of this source tree.
185
+ */const iv=te("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/**
186
+ * @license lucide-react v0.468.0 - ISC
187
+ *
188
+ * This source code is licensed under the ISC license.
189
+ * See the LICENSE file in the root directory of this source tree.
190
+ */const y0=te("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/**
191
+ * @license lucide-react v0.468.0 - ISC
192
+ *
193
+ * This source code is licensed under the ISC license.
194
+ * See the LICENSE file in the root directory of this source tree.
195
+ */const At=te("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
196
+ * @license lucide-react v0.468.0 - ISC
197
+ *
198
+ * This source code is licensed under the ISC license.
199
+ * See the LICENSE file in the root directory of this source tree.
200
+ */const kd=te("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
201
+ * @license lucide-react v0.468.0 - ISC
202
+ *
203
+ * This source code is licensed under the ISC license.
204
+ * See the LICENSE file in the root directory of this source tree.
205
+ */const rv=te("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
206
+ * @license lucide-react v0.468.0 - ISC
207
+ *
208
+ * This source code is licensed under the ISC license.
209
+ * See the LICENSE file in the root directory of this source tree.
210
+ */const Xn=te("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
211
+ * @license lucide-react v0.468.0 - ISC
212
+ *
213
+ * This source code is licensed under the ISC license.
214
+ * See the LICENSE file in the root directory of this source tree.
215
+ */const cv=te("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
216
+ * @license lucide-react v0.468.0 - ISC
217
+ *
218
+ * This source code is licensed under the ISC license.
219
+ * See the LICENSE file in the root directory of this source tree.
220
+ */const ov=te("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
221
+ * @license lucide-react v0.468.0 - ISC
222
+ *
223
+ * This source code is licensed under the ISC license.
224
+ * See the LICENSE file in the root directory of this source tree.
225
+ */const v0=te("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
226
+ * @license lucide-react v0.468.0 - ISC
227
+ *
228
+ * This source code is licensed under the ISC license.
229
+ * See the LICENSE file in the root directory of this source tree.
230
+ */const Ca=te("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
231
+ * @license lucide-react v0.468.0 - ISC
232
+ *
233
+ * This source code is licensed under the ISC license.
234
+ * See the LICENSE file in the root directory of this source tree.
235
+ */const ai=te("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
236
+ * @license lucide-react v0.468.0 - ISC
237
+ *
238
+ * This source code is licensed under the ISC license.
239
+ * See the LICENSE file in the root directory of this source tree.
240
+ */const Vn=te("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
241
+ * @license lucide-react v0.468.0 - ISC
242
+ *
243
+ * This source code is licensed under the ISC license.
244
+ * See the LICENSE file in the root directory of this source tree.
245
+ */const Pd=te("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
246
+ * @license lucide-react v0.468.0 - ISC
247
+ *
248
+ * This source code is licensed under the ISC license.
249
+ * See the LICENSE file in the root directory of this source tree.
250
+ */const Qr=te("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
251
+ * @license lucide-react v0.468.0 - ISC
252
+ *
253
+ * This source code is licensed under the ISC license.
254
+ * See the LICENSE file in the root directory of this source tree.
255
+ */const an=te("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
256
+ * @license lucide-react v0.468.0 - ISC
257
+ *
258
+ * This source code is licensed under the ISC license.
259
+ * See the LICENSE file in the root directory of this source tree.
260
+ */const j0=te("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
261
+ * @license lucide-react v0.468.0 - ISC
262
+ *
263
+ * This source code is licensed under the ISC license.
264
+ * See the LICENSE file in the root directory of this source tree.
265
+ */const Rh=te("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/**
266
+ * @license lucide-react v0.468.0 - ISC
267
+ *
268
+ * This source code is licensed under the ISC license.
269
+ * See the LICENSE file in the root directory of this source tree.
270
+ */const zd=te("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);/**
271
+ * @license lucide-react v0.468.0 - ISC
272
+ *
273
+ * This source code is licensed under the ISC license.
274
+ * See the LICENSE file in the root directory of this source tree.
275
+ */const dv=te("FolderSearch",[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]);/**
276
+ * @license lucide-react v0.468.0 - ISC
277
+ *
278
+ * This source code is licensed under the ISC license.
279
+ * See the LICENSE file in the root directory of this source tree.
280
+ */const Gr=te("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
281
+ * @license lucide-react v0.468.0 - ISC
282
+ *
283
+ * This source code is licensed under the ISC license.
284
+ * See the LICENSE file in the root directory of this source tree.
285
+ */const Wd=te("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
286
+ * @license lucide-react v0.468.0 - ISC
287
+ *
288
+ * This source code is licensed under the ISC license.
289
+ * See the LICENSE file in the root directory of this source tree.
290
+ */const Mh=te("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
291
+ * @license lucide-react v0.468.0 - ISC
292
+ *
293
+ * This source code is licensed under the ISC license.
294
+ * See the LICENSE file in the root directory of this source tree.
295
+ */const uv=te("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
296
+ * @license lucide-react v0.468.0 - ISC
297
+ *
298
+ * This source code is licensed under the ISC license.
299
+ * See the LICENSE file in the root directory of this source tree.
300
+ */const ri=te("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
301
+ * @license lucide-react v0.468.0 - ISC
302
+ *
303
+ * This source code is licensed under the ISC license.
304
+ * See the LICENSE file in the root directory of this source tree.
305
+ */const mv=te("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
306
+ * @license lucide-react v0.468.0 - ISC
307
+ *
308
+ * This source code is licensed under the ISC license.
309
+ * See the LICENSE file in the root directory of this source tree.
310
+ */const eu=te("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
311
+ * @license lucide-react v0.468.0 - ISC
312
+ *
313
+ * This source code is licensed under the ISC license.
314
+ * See the LICENSE file in the root directory of this source tree.
315
+ */const _d=te("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
316
+ * @license lucide-react v0.468.0 - ISC
317
+ *
318
+ * This source code is licensed under the ISC license.
319
+ * See the LICENSE file in the root directory of this source tree.
320
+ */const ot=te("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
321
+ * @license lucide-react v0.468.0 - ISC
322
+ *
323
+ * This source code is licensed under the ISC license.
324
+ * See the LICENSE file in the root directory of this source tree.
325
+ */const xv=te("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/**
326
+ * @license lucide-react v0.468.0 - ISC
327
+ *
328
+ * This source code is licensed under the ISC license.
329
+ * See the LICENSE file in the root directory of this source tree.
330
+ */const Ud=te("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
331
+ * @license lucide-react v0.468.0 - ISC
332
+ *
333
+ * This source code is licensed under the ISC license.
334
+ * See the LICENSE file in the root directory of this source tree.
335
+ */const fv=te("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/**
336
+ * @license lucide-react v0.468.0 - ISC
337
+ *
338
+ * This source code is licensed under the ISC license.
339
+ * See the LICENSE file in the root directory of this source tree.
340
+ */const hv=te("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
341
+ * @license lucide-react v0.468.0 - ISC
342
+ *
343
+ * This source code is licensed under the ISC license.
344
+ * See the LICENSE file in the root directory of this source tree.
345
+ */const pv=te("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
346
+ * @license lucide-react v0.468.0 - ISC
347
+ *
348
+ * This source code is licensed under the ISC license.
349
+ * See the LICENSE file in the root directory of this source tree.
350
+ */const Ts=te("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
351
+ * @license lucide-react v0.468.0 - ISC
352
+ *
353
+ * This source code is licensed under the ISC license.
354
+ * See the LICENSE file in the root directory of this source tree.
355
+ */const gv=te("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
356
+ * @license lucide-react v0.468.0 - ISC
357
+ *
358
+ * This source code is licensed under the ISC license.
359
+ * See the LICENSE file in the root directory of this source tree.
360
+ */const bv=te("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
361
+ * @license lucide-react v0.468.0 - ISC
362
+ *
363
+ * This source code is licensed under the ISC license.
364
+ * See the LICENSE file in the root directory of this source tree.
365
+ */const yv=te("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
366
+ * @license lucide-react v0.468.0 - ISC
367
+ *
368
+ * This source code is licensed under the ISC license.
369
+ * See the LICENSE file in the root directory of this source tree.
370
+ */const vv=te("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
371
+ * @license lucide-react v0.468.0 - ISC
372
+ *
373
+ * This source code is licensed under the ISC license.
374
+ * See the LICENSE file in the root directory of this source tree.
375
+ */const Zr=te("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
376
+ * @license lucide-react v0.468.0 - ISC
377
+ *
378
+ * This source code is licensed under the ISC license.
379
+ * See the LICENSE file in the root directory of this source tree.
380
+ */const jv=te("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
381
+ * @license lucide-react v0.468.0 - ISC
382
+ *
383
+ * This source code is licensed under the ISC license.
384
+ * See the LICENSE file in the root directory of this source tree.
385
+ */const tu=te("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
386
+ * @license lucide-react v0.468.0 - ISC
387
+ *
388
+ * This source code is licensed under the ISC license.
389
+ * See the LICENSE file in the root directory of this source tree.
390
+ */const Ct=te("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
391
+ * @license lucide-react v0.468.0 - ISC
392
+ *
393
+ * This source code is licensed under the ISC license.
394
+ * See the LICENSE file in the root directory of this source tree.
395
+ */const gt=te("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
396
+ * @license lucide-react v0.468.0 - ISC
397
+ *
398
+ * This source code is licensed under the ISC license.
399
+ * See the LICENSE file in the root directory of this source tree.
400
+ */const Jr=te("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/**
401
+ * @license lucide-react v0.468.0 - ISC
402
+ *
403
+ * This source code is licensed under the ISC license.
404
+ * See the LICENSE file in the root directory of this source tree.
405
+ */const N0=te("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/**
406
+ * @license lucide-react v0.468.0 - ISC
407
+ *
408
+ * This source code is licensed under the ISC license.
409
+ * See the LICENSE file in the root directory of this source tree.
410
+ */const Mt=te("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
411
+ * @license lucide-react v0.468.0 - ISC
412
+ *
413
+ * This source code is licensed under the ISC license.
414
+ * See the LICENSE file in the root directory of this source tree.
415
+ */const w0=te("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
416
+ * @license lucide-react v0.468.0 - ISC
417
+ *
418
+ * This source code is licensed under the ISC license.
419
+ * See the LICENSE file in the root directory of this source tree.
420
+ */const Fr=te("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
421
+ * @license lucide-react v0.468.0 - ISC
422
+ *
423
+ * This source code is licensed under the ISC license.
424
+ * See the LICENSE file in the root directory of this source tree.
425
+ */const Rs=te("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
426
+ * @license lucide-react v0.468.0 - ISC
427
+ *
428
+ * This source code is licensed under the ISC license.
429
+ * See the LICENSE file in the root directory of this source tree.
430
+ */const au=te("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
431
+ * @license lucide-react v0.468.0 - ISC
432
+ *
433
+ * This source code is licensed under the ISC license.
434
+ * See the LICENSE file in the root directory of this source tree.
435
+ */const su=te("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
436
+ * @license lucide-react v0.468.0 - ISC
437
+ *
438
+ * This source code is licensed under the ISC license.
439
+ * See the LICENSE file in the root directory of this source tree.
440
+ */const In=te("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
441
+ * @license lucide-react v0.468.0 - ISC
442
+ *
443
+ * This source code is licensed under the ISC license.
444
+ * See the LICENSE file in the root directory of this source tree.
445
+ */const za=te("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
446
+ * @license lucide-react v0.468.0 - ISC
447
+ *
448
+ * This source code is licensed under the ISC license.
449
+ * See the LICENSE file in the root directory of this source tree.
450
+ */const nu=te("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
451
+ * @license lucide-react v0.468.0 - ISC
452
+ *
453
+ * This source code is licensed under the ISC license.
454
+ * See the LICENSE file in the root directory of this source tree.
455
+ */const Ms=te("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
456
+ * @license lucide-react v0.468.0 - ISC
457
+ *
458
+ * This source code is licensed under the ISC license.
459
+ * See the LICENSE file in the root directory of this source tree.
460
+ */const Nv=te("SkipBack",[["polygon",{points:"19 20 9 12 19 4 19 20",key:"o2sva"}],["line",{x1:"5",x2:"5",y1:"19",y2:"5",key:"1ocqjk"}]]);/**
461
+ * @license lucide-react v0.468.0 - ISC
462
+ *
463
+ * This source code is licensed under the ISC license.
464
+ * See the LICENSE file in the root directory of this source tree.
465
+ */const wv=te("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);/**
466
+ * @license lucide-react v0.468.0 - ISC
467
+ *
468
+ * This source code is licensed under the ISC license.
469
+ * See the LICENSE file in the root directory of this source tree.
470
+ */const Sv=te("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
471
+ * @license lucide-react v0.468.0 - ISC
472
+ *
473
+ * This source code is licensed under the ISC license.
474
+ * See the LICENSE file in the root directory of this source tree.
475
+ */const kv=te("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
476
+ * @license lucide-react v0.468.0 - ISC
477
+ *
478
+ * This source code is licensed under the ISC license.
479
+ * See the LICENSE file in the root directory of this source tree.
480
+ */const en=te("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
481
+ * @license lucide-react v0.468.0 - ISC
482
+ *
483
+ * This source code is licensed under the ISC license.
484
+ * See the LICENSE file in the root directory of this source tree.
485
+ */const S0=te("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
486
+ * @license lucide-react v0.468.0 - ISC
487
+ *
488
+ * This source code is licensed under the ISC license.
489
+ * See the LICENSE file in the root directory of this source tree.
490
+ */const si=te("TestTube",[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]]);/**
491
+ * @license lucide-react v0.468.0 - ISC
492
+ *
493
+ * This source code is licensed under the ISC license.
494
+ * See the LICENSE file in the root directory of this source tree.
495
+ */const Bd=te("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]]);/**
496
+ * @license lucide-react v0.468.0 - ISC
497
+ *
498
+ * This source code is licensed under the ISC license.
499
+ * See the LICENSE file in the root directory of this source tree.
500
+ */const ni=te("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/**
501
+ * @license lucide-react v0.468.0 - ISC
502
+ *
503
+ * This source code is licensed under the ISC license.
504
+ * See the LICENSE file in the root directory of this source tree.
505
+ */const zv=te("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
506
+ * @license lucide-react v0.468.0 - ISC
507
+ *
508
+ * This source code is licensed under the ISC license.
509
+ * See the LICENSE file in the root directory of this source tree.
510
+ */const Cv=te("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]);/**
511
+ * @license lucide-react v0.468.0 - ISC
512
+ *
513
+ * This source code is licensed under the ISC license.
514
+ * See the LICENSE file in the root directory of this source tree.
515
+ */const Av=te("ToggleRight",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]]);/**
516
+ * @license lucide-react v0.468.0 - ISC
517
+ *
518
+ * This source code is licensed under the ISC license.
519
+ * See the LICENSE file in the root directory of this source tree.
520
+ */const qt=te("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
521
+ * @license lucide-react v0.468.0 - ISC
522
+ *
523
+ * This source code is licensed under the ISC license.
524
+ * See the LICENSE file in the root directory of this source tree.
525
+ */const Ev=te("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/**
526
+ * @license lucide-react v0.468.0 - ISC
527
+ *
528
+ * This source code is licensed under the ISC license.
529
+ * See the LICENSE file in the root directory of this source tree.
530
+ */const lu=te("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
531
+ * @license lucide-react v0.468.0 - ISC
532
+ *
533
+ * This source code is licensed under the ISC license.
534
+ * See the LICENSE file in the root directory of this source tree.
535
+ */const mt=te("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
536
+ * @license lucide-react v0.468.0 - ISC
537
+ *
538
+ * This source code is licensed under the ISC license.
539
+ * See the LICENSE file in the root directory of this source tree.
540
+ */const Kn=te("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/**
541
+ * @license lucide-react v0.468.0 - ISC
542
+ *
543
+ * This source code is licensed under the ISC license.
544
+ * See the LICENSE file in the root directory of this source tree.
545
+ */const Tv=te("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
546
+ * @license lucide-react v0.468.0 - ISC
547
+ *
548
+ * This source code is licensed under the ISC license.
549
+ * See the LICENSE file in the root directory of this source tree.
550
+ */const Pn=te("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
551
+ * @license lucide-react v0.468.0 - ISC
552
+ *
553
+ * This source code is licensed under the ISC license.
554
+ * See the LICENSE file in the root directory of this source tree.
555
+ */const Rv=te("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
556
+ * @license lucide-react v0.468.0 - ISC
557
+ *
558
+ * This source code is licensed under the ISC license.
559
+ * See the LICENSE file in the root directory of this source tree.
560
+ */const Mv=te("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/**
561
+ * @license lucide-react v0.468.0 - ISC
562
+ *
563
+ * This source code is licensed under the ISC license.
564
+ * See the LICENSE file in the root directory of this source tree.
565
+ */const Wn=te("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
566
+ * @license lucide-react v0.468.0 - ISC
567
+ *
568
+ * This source code is licensed under the ISC license.
569
+ * See the LICENSE file in the root directory of this source tree.
570
+ */const tt=te("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
571
+ * @license lucide-react v0.468.0 - ISC
572
+ *
573
+ * This source code is licensed under the ISC license.
574
+ * See the LICENSE file in the root directory of this source tree.
575
+ */const Qa=te("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),$d={en:"English",fr:"Français",es:"Español",de:"Deutsch",pt:"Português",ja:"日本語",zh:"中文",ko:"한국어",ar:"العربية",ru:"Русский",it:"Italiano",nl:"Nederlands"},Dv=["ar"],Ov=Object.keys($d);function Hd(n){return Ov.includes(n)}function Lv(n){if(!n)return"en";const i=n.toLowerCase();if(Hd(i))return i;const d=i.split("-")[0];return Hd(d)?d:"en"}const Dh={en:{"nav.missions":"Missions","nav.chat":"Chat","nav.history":"History","nav.dashboard":"Dashboard","nav.agents":"Agents","nav.workflows":"Workflows","nav.skills":"Skills","nav.runs":"Runs","nav.approvals":"Approvals","nav.handoffs":"Handoffs","nav.apiKeys":"API Keys","nav.settings":"Settings","nav.users":"Users","nav.prompts":"Prompts","dashboard.title":"Dashboard","dashboard.activeAgents":"Active Agents","dashboard.runningTasks":"Running Tasks","dashboard.costToday":"Cost Today","dashboard.skillsInstalled":"Skills Installed","dashboard.recentActivity":"Recent Activity","dashboard.quickActions":"Quick Actions","dashboard.systemHealth":"System Health","dashboard.createAgent":"Create Agent","dashboard.runWorkflow":"Run Workflow","dashboard.installSkill":"Install Skill","agents.title":"Agents","agents.create":"Create Agent","agents.empty":"No agents configured yet.","agents.emptyDesc":"Create your first AI agent to get started with automated tasks.","agent.overview":"Overview","agent.runs":"Runs","agent.events":"Events","agent.configuration":"Configuration","agent.budget":"Budget","agent.recentRuns":"Recent Runs","agent.delete":"Delete Agent","agent.start":"Start","agent.stop":"Stop","agent.run":"Run","workflows.title":"Workflows","workflows.create":"Create Workflow","workflows.empty":"No workflows defined yet.","workflows.emptyDesc":"Design your first workflow to orchestrate multiple agents.","workflows.nodes":"{count} nodes","workflows.edit":"Edit","workflow.editor":"Workflow Editor","workflow.addNode":"Add Node","workflow.save":"Save","workflow.run":"Run Workflow","skills.title":"Skills","skills.install":"Install Skill","skills.empty":"No skills installed yet.","skills.emptyDesc":"Browse and install skills to extend your agents' capabilities.","skills.scan":"Scan Directory","skills.source":"Source URL or path","runs.title":"Runs","runs.empty":"No runs recorded yet.","runs.emptyDesc":"Run an agent or workflow to see execution history.","runs.filter":"Filter","run.events":"Events","run.output":"Output","run.cost":"Cost Breakdown","run.duration":"Duration","approvals.title":"Approval Queue","approvals.empty":"No pending approvals.","approvals.emptyDesc":"All clear. Dangerous actions will appear here for review.","approvals.approve":"Approve","approvals.deny":"Deny","approvals.pending":"Pending","nav.analytics":"Analytics","nav.budget":"Budget","nav.traces":"Traces","nav.memory":"Memory","nav.goals":"Goals","nav.plans":"Plans","nav.guardrails":"Guardrails","analytics.title":"Cost Analytics","analytics.description":"Track spending, token usage, and budget utilization across agents.","analytics.totalSpend":"Total Spend","analytics.totalRuns":"Total Runs","analytics.avgCostPerRun":"Avg Cost/Run","analytics.monthlyEstimate":"Monthly Estimate","analytics.dailyCosts":"Daily Costs (30 days)","analytics.agentBreakdown":"Cost by Agent","analytics.modelBreakdown":"Cost by Model","analytics.budgetUtilization":"Budget Utilization","analytics.runs":"Runs","analytics.totalCost":"Total Cost","analytics.avgCost":"Avg Cost","analytics.model":"Model","analytics.tokens":"Tokens","analytics.cost":"Cost","analytics.noAgentData":"No agent cost data yet.","analytics.noModelData":"No model cost data yet.","settings.title":"Settings","settings.general":"General","settings.security":"Security","settings.llm":"LLM","settings.budget":"Budget","settings.save":"Save Changes","settings.saved":"Settings saved successfully.","settings.language":"Language","common.loading":"Loading...","common.error":"An error occurred.","common.retry":"Retry","common.cancel":"Cancel","common.save":"Save","common.delete":"Delete","common.close":"Close","common.search":"Search...","common.noResults":"No results found.","common.name":"Name","common.description":"Description","common.status":"Status","common.type":"Type","common.actions":"Actions","common.created":"Created","common.updated":"Updated","status.running":"Running","status.completed":"Completed","status.failed":"Failed","status.pending":"Pending","status.paused":"Paused","status.cancelled":"Cancelled","status.idle":"Idle","trust.builtin":"Built-in","trust.official":"Official","trust.trusted":"Trusted","trust.community":"Community","trust.local":"Local"},fr:{"nav.missions":"Missions","nav.chat":"Chat","nav.history":"Historique","nav.dashboard":"Tableau de bord","nav.agents":"Agents","nav.workflows":"Workflows","nav.skills":"Compétences","nav.runs":"Exécutions","nav.approvals":"Approbations","nav.handoffs":"Transferts","nav.apiKeys":"Clés API","nav.settings":"Paramètres","nav.users":"Utilisateurs","nav.prompts":"Prompts","dashboard.title":"Tableau de bord","dashboard.activeAgents":"Agents actifs","dashboard.runningTasks":"Tâches en cours","dashboard.costToday":"Coût aujourd'hui","dashboard.skillsInstalled":"Compétences installées","dashboard.recentActivity":"Activité récente","dashboard.quickActions":"Actions rapides","dashboard.systemHealth":"Santé système","dashboard.createAgent":"Créer un agent","dashboard.runWorkflow":"Lancer un workflow","dashboard.installSkill":"Installer une compétence","agents.title":"Agents","agents.create":"Créer un agent","agents.empty":"Aucun agent configuré.","agents.emptyDesc":"Créez votre premier agent IA pour automatiser vos tâches.","agent.overview":"Aperçu","agent.runs":"Exécutions","agent.events":"Événements","agent.configuration":"Configuration","agent.budget":"Budget","agent.recentRuns":"Exécutions récentes","agent.delete":"Supprimer l'agent","agent.start":"Démarrer","agent.stop":"Arrêter","agent.run":"Exécuter","workflows.title":"Workflows","workflows.create":"Créer un workflow","workflows.empty":"Aucun workflow défini.","workflows.emptyDesc":"Concevez votre premier workflow pour orchestrer vos agents.","workflows.nodes":"{count} nœuds","workflows.edit":"Modifier","workflow.editor":"Éditeur de workflow","workflow.addNode":"Ajouter un nœud","workflow.save":"Enregistrer","workflow.run":"Lancer le workflow","skills.title":"Compétences","skills.install":"Installer","skills.empty":"Aucune compétence installée.","skills.emptyDesc":"Parcourez et installez des compétences pour étendre les capacités de vos agents.","skills.scan":"Scanner un répertoire","skills.source":"URL ou chemin source","runs.title":"Exécutions","runs.empty":"Aucune exécution enregistrée.","runs.emptyDesc":"Lancez un agent ou un workflow pour voir l'historique.","runs.filter":"Filtrer","run.events":"Événements","run.output":"Sortie","run.cost":"Détail des coûts","run.duration":"Durée","approvals.title":"File d'approbation","approvals.empty":"Aucune approbation en attente.","approvals.emptyDesc":"Tout est clair. Les actions dangereuses apparaîtront ici.","approvals.approve":"Approuver","approvals.deny":"Refuser","approvals.pending":"En attente","nav.analytics":"Analytique","nav.budget":"Budget","nav.traces":"Traces","nav.memory":"Mémoire","nav.goals":"Objectifs","nav.plans":"Plans","nav.guardrails":"Garde-fous","analytics.title":"Analytique des coûts","analytics.description":"Suivez les dépenses, l'utilisation des tokens et le budget par agent.","analytics.totalSpend":"Dépense totale","analytics.totalRuns":"Total exécutions","analytics.avgCostPerRun":"Coût moyen/exéc.","analytics.monthlyEstimate":"Estimation mensuelle","analytics.dailyCosts":"Coûts quotidiens (30 jours)","analytics.agentBreakdown":"Coûts par agent","analytics.modelBreakdown":"Coûts par modèle","analytics.budgetUtilization":"Utilisation du budget","analytics.runs":"Exécutions","analytics.totalCost":"Coût total","analytics.avgCost":"Coût moyen","analytics.model":"Modèle","analytics.tokens":"Tokens","analytics.cost":"Coût","analytics.noAgentData":"Aucune donnée de coût par agent.","analytics.noModelData":"Aucune donnée de coût par modèle.","settings.title":"Paramètres","settings.general":"Général","settings.security":"Sécurité","settings.llm":"LLM","settings.budget":"Budget","settings.save":"Enregistrer","settings.saved":"Paramètres sauvegardés.","settings.language":"Langue","common.loading":"Chargement...","common.error":"Une erreur est survenue.","common.retry":"Réessayer","common.cancel":"Annuler","common.save":"Enregistrer","common.delete":"Supprimer","common.close":"Fermer","common.search":"Rechercher...","common.noResults":"Aucun résultat.","common.name":"Nom","common.description":"Description","common.status":"Statut","common.type":"Type","common.actions":"Actions","common.created":"Créé","common.updated":"Mis à jour","status.running":"En cours","status.completed":"Terminé","status.failed":"Échoué","status.pending":"En attente","status.paused":"En pause","status.cancelled":"Annulé","status.idle":"Inactif","trust.builtin":"Intégré","trust.official":"Officiel","trust.trusted":"Vérifié","trust.community":"Communautaire","trust.local":"Local"},es:{"nav.dashboard":"Panel","nav.agents":"Agentes","nav.workflows":"Flujos de trabajo","nav.skills":"Habilidades","nav.runs":"Ejecuciones","nav.approvals":"Aprobaciones","nav.handoffs":"Transferencias","nav.apiKeys":"Claves API","nav.settings":"Configuración","nav.users":"Usuarios","nav.prompts":"Prompts","dashboard.title":"Panel","dashboard.activeAgents":"Agentes activos","dashboard.runningTasks":"Tareas en ejecución","dashboard.costToday":"Coste hoy","dashboard.skillsInstalled":"Habilidades instaladas","dashboard.recentActivity":"Actividad reciente","dashboard.quickActions":"Acciones rápidas","dashboard.systemHealth":"Estado del sistema","dashboard.createAgent":"Crear agente","dashboard.runWorkflow":"Ejecutar flujo","dashboard.installSkill":"Instalar habilidad","agents.title":"Agentes","agents.create":"Crear agente","agents.empty":"No hay agentes configurados.","agents.emptyDesc":"Crea tu primer agente IA para empezar con tareas automatizadas.","agent.overview":"Resumen","agent.runs":"Ejecuciones","agent.events":"Eventos","agent.configuration":"Configuración","agent.budget":"Presupuesto","agent.recentRuns":"Ejecuciones recientes","agent.delete":"Eliminar agente","agent.start":"Iniciar","agent.stop":"Detener","agent.run":"Ejecutar","workflows.title":"Flujos de trabajo","workflows.create":"Crear flujo","workflows.empty":"No hay flujos definidos.","workflows.emptyDesc":"Diseña tu primer flujo de trabajo para orquestar múltiples agentes.","workflows.nodes":"{count} nodos","workflows.edit":"Editar","workflow.editor":"Editor de flujo","workflow.addNode":"Añadir nodo","workflow.save":"Guardar","workflow.run":"Ejecutar flujo","skills.title":"Habilidades","skills.install":"Instalar","skills.empty":"No hay habilidades instaladas.","skills.emptyDesc":"Explora e instala habilidades para ampliar las capacidades de tus agentes.","skills.scan":"Escanear directorio","skills.source":"URL o ruta de origen","runs.title":"Ejecuciones","runs.empty":"No hay ejecuciones registradas.","runs.emptyDesc":"Ejecuta un agente o flujo para ver el historial.","runs.filter":"Filtrar","run.events":"Eventos","run.output":"Salida","run.cost":"Desglose de costes","run.duration":"Duración","approvals.title":"Cola de aprobación","approvals.empty":"Sin aprobaciones pendientes.","approvals.emptyDesc":"Todo despejado. Las acciones peligrosas aparecerán aquí.","approvals.approve":"Aprobar","approvals.deny":"Denegar","approvals.pending":"Pendiente","nav.analytics":"Analíticas","nav.budget":"Presupuesto","nav.traces":"Trazas","nav.memory":"Memoria","nav.goals":"Objetivos","nav.plans":"Planes","nav.guardrails":"Salvaguardas","analytics.title":"Analíticas de coste","analytics.description":"Seguimiento de gastos, uso de tokens y presupuesto por agente.","analytics.totalSpend":"Gasto total","analytics.totalRuns":"Total ejecuciones","analytics.avgCostPerRun":"Coste medio/ejec.","analytics.monthlyEstimate":"Estimación mensual","analytics.dailyCosts":"Costes diarios (30 días)","analytics.agentBreakdown":"Coste por agente","analytics.modelBreakdown":"Coste por modelo","analytics.budgetUtilization":"Uso del presupuesto","analytics.runs":"Ejecuciones","analytics.totalCost":"Coste total","analytics.avgCost":"Coste medio","analytics.model":"Modelo","analytics.tokens":"Tokens","analytics.cost":"Coste","analytics.noAgentData":"Sin datos de coste por agente.","analytics.noModelData":"Sin datos de coste por modelo.","settings.title":"Configuración","settings.general":"General","settings.security":"Seguridad","settings.llm":"LLM","settings.budget":"Presupuesto","settings.save":"Guardar cambios","settings.saved":"Configuración guardada.","settings.language":"Idioma","common.loading":"Cargando...","common.error":"Se produjo un error.","common.retry":"Reintentar","common.cancel":"Cancelar","common.save":"Guardar","common.delete":"Eliminar","common.close":"Cerrar","common.search":"Buscar...","common.noResults":"Sin resultados.","common.name":"Nombre","common.description":"Descripción","common.status":"Estado","common.type":"Tipo","common.actions":"Acciones","common.created":"Creado","common.updated":"Actualizado","status.running":"En ejecución","status.completed":"Completado","status.failed":"Fallido","status.pending":"Pendiente","status.paused":"En pausa","status.cancelled":"Cancelado","status.idle":"Inactivo","trust.builtin":"Integrado","trust.official":"Oficial","trust.trusted":"Verificado","trust.community":"Comunidad","trust.local":"Local"},de:{"nav.dashboard":"Dashboard","nav.agents":"Agenten","nav.workflows":"Workflows","nav.skills":"Fähigkeiten","nav.runs":"Ausführungen","nav.approvals":"Genehmigungen","nav.handoffs":"Übergaben","nav.apiKeys":"API-Schlüssel","nav.settings":"Einstellungen","nav.users":"Benutzer","nav.prompts":"Prompts","dashboard.title":"Dashboard","dashboard.activeAgents":"Aktive Agenten","dashboard.runningTasks":"Laufende Aufgaben","dashboard.costToday":"Kosten heute","dashboard.skillsInstalled":"Installierte Fähigkeiten","dashboard.recentActivity":"Letzte Aktivität","dashboard.quickActions":"Schnellaktionen","dashboard.systemHealth":"Systemstatus","dashboard.createAgent":"Agent erstellen","dashboard.runWorkflow":"Workflow starten","dashboard.installSkill":"Fähigkeit installieren","agents.title":"Agenten","agents.create":"Agent erstellen","agents.empty":"Keine Agenten konfiguriert.","agents.emptyDesc":"Erstellen Sie Ihren ersten KI-Agenten für automatisierte Aufgaben.","agent.overview":"Übersicht","agent.runs":"Ausführungen","agent.events":"Ereignisse","agent.configuration":"Konfiguration","agent.budget":"Budget","agent.recentRuns":"Letzte Ausführungen","agent.delete":"Agent löschen","agent.start":"Starten","agent.stop":"Stoppen","agent.run":"Ausführen","workflows.title":"Workflows","workflows.create":"Workflow erstellen","workflows.empty":"Keine Workflows definiert.","workflows.emptyDesc":"Entwerfen Sie Ihren ersten Workflow zur Orchestrierung mehrerer Agenten.","workflows.nodes":"{count} Knoten","workflows.edit":"Bearbeiten","workflow.editor":"Workflow-Editor","workflow.addNode":"Knoten hinzufügen","workflow.save":"Speichern","workflow.run":"Workflow starten","skills.title":"Fähigkeiten","skills.install":"Installieren","skills.empty":"Keine Fähigkeiten installiert.","skills.emptyDesc":"Durchsuchen und installieren Sie Fähigkeiten, um die Möglichkeiten Ihrer Agenten zu erweitern.","skills.scan":"Verzeichnis scannen","skills.source":"Quell-URL oder -pfad","runs.title":"Ausführungen","runs.empty":"Keine Ausführungen aufgezeichnet.","runs.emptyDesc":"Starten Sie einen Agenten oder Workflow, um den Verlauf anzuzeigen.","runs.filter":"Filtern","run.events":"Ereignisse","run.output":"Ausgabe","run.cost":"Kostenaufschlüsselung","run.duration":"Dauer","approvals.title":"Genehmigungswarteschlange","approvals.empty":"Keine ausstehenden Genehmigungen.","approvals.emptyDesc":"Alles in Ordnung. Gefährliche Aktionen erscheinen hier zur Überprüfung.","approvals.approve":"Genehmigen","approvals.deny":"Ablehnen","approvals.pending":"Ausstehend","nav.analytics":"Analytik","nav.budget":"Budget","nav.traces":"Traces","nav.memory":"Speicher","nav.goals":"Ziele","nav.plans":"Pläne","nav.guardrails":"Leitplanken","analytics.title":"Kostenanalytik","analytics.description":"Ausgaben, Token-Nutzung und Budgetauslastung pro Agent verfolgen.","analytics.totalSpend":"Gesamtausgaben","analytics.totalRuns":"Gesamtausführungen","analytics.avgCostPerRun":"Ø Kosten/Ausf.","analytics.monthlyEstimate":"Monatliche Schätzung","analytics.dailyCosts":"Tägliche Kosten (30 Tage)","analytics.agentBreakdown":"Kosten pro Agent","analytics.modelBreakdown":"Kosten pro Modell","analytics.budgetUtilization":"Budgetauslastung","analytics.runs":"Ausführungen","analytics.totalCost":"Gesamtkosten","analytics.avgCost":"Ø Kosten","analytics.model":"Modell","analytics.tokens":"Tokens","analytics.cost":"Kosten","analytics.noAgentData":"Noch keine Kostendaten pro Agent.","analytics.noModelData":"Noch keine Kostendaten pro Modell.","settings.title":"Einstellungen","settings.general":"Allgemein","settings.security":"Sicherheit","settings.llm":"LLM","settings.budget":"Budget","settings.save":"Änderungen speichern","settings.saved":"Einstellungen gespeichert.","settings.language":"Sprache","common.loading":"Laden...","common.error":"Ein Fehler ist aufgetreten.","common.retry":"Erneut versuchen","common.cancel":"Abbrechen","common.save":"Speichern","common.delete":"Löschen","common.close":"Schließen","common.search":"Suchen...","common.noResults":"Keine Ergebnisse.","common.name":"Name","common.description":"Beschreibung","common.status":"Status","common.type":"Typ","common.actions":"Aktionen","common.created":"Erstellt","common.updated":"Aktualisiert","status.running":"Läuft","status.completed":"Abgeschlossen","status.failed":"Fehlgeschlagen","status.pending":"Ausstehend","status.paused":"Pausiert","status.cancelled":"Abgebrochen","status.idle":"Inaktiv","trust.builtin":"Integriert","trust.official":"Offiziell","trust.trusted":"Vertrauenswürdig","trust.community":"Community","trust.local":"Lokal"},pt:{"nav.dashboard":"Painel","nav.agents":"Agentes","nav.workflows":"Fluxos de trabalho","nav.skills":"Habilidades","nav.runs":"Execuções","nav.approvals":"Aprovações","nav.handoffs":"Transferências","nav.apiKeys":"Chaves API","nav.settings":"Configurações","nav.users":"Usuários","nav.prompts":"Prompts","dashboard.title":"Painel","dashboard.activeAgents":"Agentes ativos","dashboard.runningTasks":"Tarefas em execução","dashboard.costToday":"Custo hoje","dashboard.skillsInstalled":"Habilidades instaladas","dashboard.recentActivity":"Atividade recente","dashboard.quickActions":"Ações rápidas","dashboard.systemHealth":"Saúde do sistema","dashboard.createAgent":"Criar agente","dashboard.runWorkflow":"Executar fluxo","dashboard.installSkill":"Instalar habilidade","agents.title":"Agentes","agents.create":"Criar agente","agents.empty":"Nenhum agente configurado.","agents.emptyDesc":"Crie seu primeiro agente de IA para começar com tarefas automatizadas.","agent.overview":"Visão geral","agent.runs":"Execuções","agent.events":"Eventos","agent.configuration":"Configuração","agent.budget":"Orçamento","agent.recentRuns":"Execuções recentes","agent.delete":"Excluir agente","agent.start":"Iniciar","agent.stop":"Parar","agent.run":"Executar","workflows.title":"Fluxos de trabalho","workflows.create":"Criar fluxo","workflows.empty":"Nenhum fluxo definido.","workflows.emptyDesc":"Projete seu primeiro fluxo de trabalho para orquestrar múltiplos agentes.","workflows.nodes":"{count} nós","workflows.edit":"Editar","workflow.editor":"Editor de fluxo","workflow.addNode":"Adicionar nó","workflow.save":"Salvar","workflow.run":"Executar fluxo","skills.title":"Habilidades","skills.install":"Instalar","skills.empty":"Nenhuma habilidade instalada.","skills.emptyDesc":"Explore e instale habilidades para ampliar as capacidades dos seus agentes.","skills.scan":"Escanear diretório","skills.source":"URL ou caminho de origem","runs.title":"Execuções","runs.empty":"Nenhuma execução registrada.","runs.emptyDesc":"Execute um agente ou fluxo para ver o histórico.","runs.filter":"Filtrar","run.events":"Eventos","run.output":"Saída","run.cost":"Detalhamento de custos","run.duration":"Duração","approvals.title":"Fila de aprovação","approvals.empty":"Sem aprovações pendentes.","approvals.emptyDesc":"Tudo limpo. Ações perigosas aparecerão aqui para revisão.","approvals.approve":"Aprovar","approvals.deny":"Negar","approvals.pending":"Pendente","nav.analytics":"Análises","nav.budget":"Orçamento","nav.traces":"Rastros","nav.memory":"Memória","nav.goals":"Objetivos","nav.plans":"Planos","nav.guardrails":"Proteções","analytics.title":"Análise de custos","analytics.description":"Acompanhe gastos, uso de tokens e orçamento por agente.","analytics.totalSpend":"Gasto total","analytics.totalRuns":"Total de execuções","analytics.avgCostPerRun":"Custo médio/exec.","analytics.monthlyEstimate":"Estimativa mensal","analytics.dailyCosts":"Custos diários (30 dias)","analytics.agentBreakdown":"Custo por agente","analytics.modelBreakdown":"Custo por modelo","analytics.budgetUtilization":"Utilização do orçamento","analytics.runs":"Execuções","analytics.totalCost":"Custo total","analytics.avgCost":"Custo médio","analytics.model":"Modelo","analytics.tokens":"Tokens","analytics.cost":"Custo","analytics.noAgentData":"Sem dados de custo por agente.","analytics.noModelData":"Sem dados de custo por modelo.","settings.title":"Configurações","settings.general":"Geral","settings.security":"Segurança","settings.llm":"LLM","settings.budget":"Orçamento","settings.save":"Salvar alterações","settings.saved":"Configurações salvas.","settings.language":"Idioma","common.loading":"Carregando...","common.error":"Ocorreu um erro.","common.retry":"Tentar novamente","common.cancel":"Cancelar","common.save":"Salvar","common.delete":"Excluir","common.close":"Fechar","common.search":"Pesquisar...","common.noResults":"Nenhum resultado.","common.name":"Nome","common.description":"Descrição","common.status":"Status","common.type":"Tipo","common.actions":"Ações","common.created":"Criado","common.updated":"Atualizado","status.running":"Em execução","status.completed":"Concluído","status.failed":"Falhou","status.pending":"Pendente","status.paused":"Pausado","status.cancelled":"Cancelado","status.idle":"Inativo","trust.builtin":"Integrado","trust.official":"Oficial","trust.trusted":"Verificado","trust.community":"Comunidade","trust.local":"Local"},ja:{"nav.dashboard":"ダッシュボード","nav.agents":"エージェント","nav.workflows":"ワークフロー","nav.skills":"スキル","nav.runs":"実行履歴","nav.approvals":"承認","nav.handoffs":"引き継ぎ","nav.apiKeys":"APIキー","nav.settings":"設定","nav.users":"ユーザー","nav.prompts":"プロンプト","dashboard.title":"ダッシュボード","dashboard.activeAgents":"アクティブなエージェント","dashboard.runningTasks":"実行中のタスク","dashboard.costToday":"本日のコスト","dashboard.skillsInstalled":"インストール済みスキル","dashboard.recentActivity":"最近のアクティビティ","dashboard.quickActions":"クイックアクション","dashboard.systemHealth":"システム状態","dashboard.createAgent":"エージェント作成","dashboard.runWorkflow":"ワークフロー実行","dashboard.installSkill":"スキルインストール","agents.title":"エージェント","agents.create":"エージェント作成","agents.empty":"エージェントが構成されていません。","agents.emptyDesc":"最初のAIエージェントを作成して自動化タスクを始めましょう。","agent.overview":"概要","agent.runs":"実行履歴","agent.events":"イベント","agent.configuration":"構成","agent.budget":"予算","agent.recentRuns":"最近の実行","agent.delete":"エージェント削除","agent.start":"開始","agent.stop":"停止","agent.run":"実行","workflows.title":"ワークフロー","workflows.create":"ワークフロー作成","workflows.empty":"ワークフローが定義されていません。","workflows.emptyDesc":"最初のワークフローを設計して複数のエージェントをオーケストレーションしましょう。","workflows.nodes":"{count} ノード","workflows.edit":"編集","workflow.editor":"ワークフローエディタ","workflow.addNode":"ノード追加","workflow.save":"保存","workflow.run":"ワークフロー実行","skills.title":"スキル","skills.install":"インストール","skills.empty":"スキルがインストールされていません。","skills.emptyDesc":"スキルを参照・インストールしてエージェントの機能を拡張しましょう。","skills.scan":"ディレクトリスキャン","skills.source":"ソースURLまたはパス","runs.title":"実行履歴","runs.empty":"実行記録がありません。","runs.emptyDesc":"エージェントまたはワークフローを実行して履歴を確認しましょう。","runs.filter":"フィルター","run.events":"イベント","run.output":"出力","run.cost":"コスト内訳","run.duration":"所要時間","approvals.title":"承認キュー","approvals.empty":"保留中の承認はありません。","approvals.emptyDesc":"問題なし。危険なアクションはここに表示されます。","approvals.approve":"承認","approvals.deny":"拒否","approvals.pending":"保留中","nav.analytics":"アナリティクス","nav.budget":"予算","nav.traces":"トレース","nav.memory":"メモリ","nav.goals":"目標","nav.plans":"プラン","nav.guardrails":"ガードレール","analytics.title":"コスト分析","analytics.description":"エージェントごとの支出、トークン使用量、予算利用状況を追跡。","analytics.totalSpend":"総支出","analytics.totalRuns":"総実行数","analytics.avgCostPerRun":"平均コスト/実行","analytics.monthlyEstimate":"月間見積もり","analytics.dailyCosts":"日次コスト(30日間)","analytics.agentBreakdown":"エージェント別コスト","analytics.modelBreakdown":"モデル別コスト","analytics.budgetUtilization":"予算利用率","analytics.runs":"実行回数","analytics.totalCost":"総コスト","analytics.avgCost":"平均コスト","analytics.model":"モデル","analytics.tokens":"トークン","analytics.cost":"コスト","analytics.noAgentData":"エージェントコストデータがまだありません。","analytics.noModelData":"モデルコストデータがまだありません。","settings.title":"設定","settings.general":"一般","settings.security":"セキュリティ","settings.llm":"LLM","settings.budget":"予算","settings.save":"変更を保存","settings.saved":"設定が保存されました。","settings.language":"言語","common.loading":"読み込み中...","common.error":"エラーが発生しました。","common.retry":"再試行","common.cancel":"キャンセル","common.save":"保存","common.delete":"削除","common.close":"閉じる","common.search":"検索...","common.noResults":"結果が見つかりません。","common.name":"名前","common.description":"説明","common.status":"ステータス","common.type":"タイプ","common.actions":"アクション","common.created":"作成日","common.updated":"更新日","status.running":"実行中","status.completed":"完了","status.failed":"失敗","status.pending":"保留中","status.paused":"一時停止","status.cancelled":"キャンセル済み","status.idle":"アイドル","trust.builtin":"組み込み","trust.official":"公式","trust.trusted":"信頼済み","trust.community":"コミュニティ","trust.local":"ローカル"},zh:{"nav.dashboard":"仪表盘","nav.agents":"代理","nav.workflows":"工作流","nav.skills":"技能","nav.runs":"执行记录","nav.approvals":"审批","nav.handoffs":"交接","nav.apiKeys":"API密钥","nav.settings":"设置","nav.users":"用户","nav.prompts":"提示词","dashboard.title":"仪表盘","dashboard.activeAgents":"活跃代理","dashboard.runningTasks":"运行中的任务","dashboard.costToday":"今日费用","dashboard.skillsInstalled":"已安装技能","dashboard.recentActivity":"最近活动","dashboard.quickActions":"快捷操作","dashboard.systemHealth":"系统状态","dashboard.createAgent":"创建代理","dashboard.runWorkflow":"运行工作流","dashboard.installSkill":"安装技能","agents.title":"代理","agents.create":"创建代理","agents.empty":"尚无已配置的代理。","agents.emptyDesc":"创建您的第一个AI代理以开始自动化任务。","agent.overview":"概览","agent.runs":"执行记录","agent.events":"事件","agent.configuration":"配置","agent.budget":"预算","agent.recentRuns":"最近执行","agent.delete":"删除代理","agent.start":"启动","agent.stop":"停止","agent.run":"运行","workflows.title":"工作流","workflows.create":"创建工作流","workflows.empty":"尚无已定义的工作流。","workflows.emptyDesc":"设计您的第一个工作流以编排多个代理。","workflows.nodes":"{count} 个节点","workflows.edit":"编辑","workflow.editor":"工作流编辑器","workflow.addNode":"添加节点","workflow.save":"保存","workflow.run":"运行工作流","skills.title":"技能","skills.install":"安装","skills.empty":"尚无已安装的技能。","skills.emptyDesc":"浏览并安装技能以扩展代理的能力。","skills.scan":"扫描目录","skills.source":"源URL或路径","runs.title":"执行记录","runs.empty":"尚无执行记录。","runs.emptyDesc":"运行代理或工作流以查看执行历史。","runs.filter":"筛选","run.events":"事件","run.output":"输出","run.cost":"费用明细","run.duration":"持续时间","approvals.title":"审批队列","approvals.empty":"没有待审批项。","approvals.emptyDesc":"一切正常。危险操作将在此显示以供审查。","approvals.approve":"批准","approvals.deny":"拒绝","approvals.pending":"待处理","nav.analytics":"分析","nav.budget":"预算","nav.traces":"追踪","nav.memory":"记忆","nav.goals":"目标","nav.plans":"计划","nav.guardrails":"护栏","analytics.title":"费用分析","analytics.description":"追踪各代理的支出、令牌使用量和预算利用率。","analytics.totalSpend":"总支出","analytics.totalRuns":"总执行次数","analytics.avgCostPerRun":"平均费用/次","analytics.monthlyEstimate":"月度估算","analytics.dailyCosts":"每日费用(30天)","analytics.agentBreakdown":"按代理的费用","analytics.modelBreakdown":"按模型的费用","analytics.budgetUtilization":"预算利用率","analytics.runs":"执行次数","analytics.totalCost":"总费用","analytics.avgCost":"平均费用","analytics.model":"模型","analytics.tokens":"令牌","analytics.cost":"费用","analytics.noAgentData":"尚无代理费用数据。","analytics.noModelData":"尚无模型费用数据。","settings.title":"设置","settings.general":"通用","settings.security":"安全","settings.llm":"LLM","settings.budget":"预算","settings.save":"保存更改","settings.saved":"设置已保存。","settings.language":"语言","common.loading":"加载中...","common.error":"发生错误。","common.retry":"重试","common.cancel":"取消","common.save":"保存","common.delete":"删除","common.close":"关闭","common.search":"搜索...","common.noResults":"未找到结果。","common.name":"名称","common.description":"描述","common.status":"状态","common.type":"类型","common.actions":"操作","common.created":"创建时间","common.updated":"更新时间","status.running":"运行中","status.completed":"已完成","status.failed":"失败","status.pending":"待处理","status.paused":"已暂停","status.cancelled":"已取消","status.idle":"空闲","trust.builtin":"内置","trust.official":"官方","trust.trusted":"受信任","trust.community":"社区","trust.local":"本地"},ko:{"nav.dashboard":"대시보드","nav.agents":"에이전트","nav.workflows":"워크플로우","nav.skills":"스킬","nav.runs":"실행 기록","nav.approvals":"승인","nav.handoffs":"인수인계","nav.apiKeys":"API 키","nav.settings":"설정","nav.users":"사용자","nav.prompts":"프롬프트","dashboard.title":"대시보드","dashboard.activeAgents":"활성 에이전트","dashboard.runningTasks":"실행 중인 작업","dashboard.costToday":"오늘 비용","dashboard.skillsInstalled":"설치된 스킬","dashboard.recentActivity":"최근 활동","dashboard.quickActions":"빠른 작업","dashboard.systemHealth":"시스템 상태","dashboard.createAgent":"에이전트 생성","dashboard.runWorkflow":"워크플로우 실행","dashboard.installSkill":"스킬 설치","agents.title":"에이전트","agents.create":"에이전트 생성","agents.empty":"구성된 에이전트가 없습니다.","agents.emptyDesc":"첫 번째 AI 에이전트를 만들어 자동화 작업을 시작하세요.","agent.overview":"개요","agent.runs":"실행 기록","agent.events":"이벤트","agent.configuration":"구성","agent.budget":"예산","agent.recentRuns":"최근 실행","agent.delete":"에이전트 삭제","agent.start":"시작","agent.stop":"중지","agent.run":"실행","workflows.title":"워크플로우","workflows.create":"워크플로우 생성","workflows.empty":"정의된 워크플로우가 없습니다.","workflows.emptyDesc":"첫 번째 워크플로우를 설계하여 여러 에이전트를 조율하세요.","workflows.nodes":"{count}개 노드","workflows.edit":"편집","workflow.editor":"워크플로우 편집기","workflow.addNode":"노드 추가","workflow.save":"저장","workflow.run":"워크플로우 실행","skills.title":"스킬","skills.install":"설치","skills.empty":"설치된 스킬이 없습니다.","skills.emptyDesc":"스킬을 탐색하고 설치하여 에이전트의 기능을 확장하세요.","skills.scan":"디렉토리 스캔","skills.source":"소스 URL 또는 경로","runs.title":"실행 기록","runs.empty":"기록된 실행이 없습니다.","runs.emptyDesc":"에이전트 또는 워크플로우를 실행하여 실행 기록을 확인하세요.","runs.filter":"필터","run.events":"이벤트","run.output":"출력","run.cost":"비용 내역","run.duration":"소요 시간","approvals.title":"승인 대기열","approvals.empty":"대기 중인 승인이 없습니다.","approvals.emptyDesc":"문제 없음. 위험한 작업은 여기에 검토를 위해 표시됩니다.","approvals.approve":"승인","approvals.deny":"거부","approvals.pending":"대기 중","nav.analytics":"분석","nav.budget":"예산","nav.traces":"추적","nav.memory":"메모리","nav.goals":"목표","nav.plans":"계획","nav.guardrails":"가드레일","analytics.title":"비용 분석","analytics.description":"에이전트별 지출, 토큰 사용량 및 예산 활용도를 추적합니다.","analytics.totalSpend":"총 지출","analytics.totalRuns":"총 실행 수","analytics.avgCostPerRun":"평균 비용/실행","analytics.monthlyEstimate":"월간 추정","analytics.dailyCosts":"일별 비용 (30일)","analytics.agentBreakdown":"에이전트별 비용","analytics.modelBreakdown":"모델별 비용","analytics.budgetUtilization":"예산 활용률","analytics.runs":"실행 횟수","analytics.totalCost":"총 비용","analytics.avgCost":"평균 비용","analytics.model":"모델","analytics.tokens":"토큰","analytics.cost":"비용","analytics.noAgentData":"에이전트 비용 데이터가 없습니다.","analytics.noModelData":"모델 비용 데이터가 없습니다.","settings.title":"설정","settings.general":"일반","settings.security":"보안","settings.llm":"LLM","settings.budget":"예산","settings.save":"변경 사항 저장","settings.saved":"설정이 저장되었습니다.","settings.language":"언어","common.loading":"로딩 중...","common.error":"오류가 발생했습니다.","common.retry":"재시도","common.cancel":"취소","common.save":"저장","common.delete":"삭제","common.close":"닫기","common.search":"검색...","common.noResults":"결과를 찾을 수 없습니다.","common.name":"이름","common.description":"설명","common.status":"상태","common.type":"유형","common.actions":"작업","common.created":"생성일","common.updated":"수정일","status.running":"실행 중","status.completed":"완료","status.failed":"실패","status.pending":"대기 중","status.paused":"일시 중지","status.cancelled":"취소됨","status.idle":"유휴","trust.builtin":"내장","trust.official":"공식","trust.trusted":"신뢰됨","trust.community":"커뮤니티","trust.local":"로컬"},ar:{"nav.dashboard":"لوحة التحكم","nav.agents":"الوكلاء","nav.workflows":"مسارات العمل","nav.skills":"المهارات","nav.runs":"عمليات التنفيذ","nav.approvals":"الموافقات","nav.handoffs":"التسليمات","nav.apiKeys":"مفاتيح API","nav.settings":"الإعدادات","nav.users":"المستخدمون","nav.prompts":"التعليمات","dashboard.title":"لوحة التحكم","dashboard.activeAgents":"الوكلاء النشطون","dashboard.runningTasks":"المهام قيد التشغيل","dashboard.costToday":"تكلفة اليوم","dashboard.skillsInstalled":"المهارات المثبتة","dashboard.recentActivity":"النشاط الأخير","dashboard.quickActions":"إجراءات سريعة","dashboard.systemHealth":"حالة النظام","dashboard.createAgent":"إنشاء وكيل","dashboard.runWorkflow":"تشغيل مسار عمل","dashboard.installSkill":"تثبيت مهارة","agents.title":"الوكلاء","agents.create":"إنشاء وكيل","agents.empty":"لا توجد وكلاء مهيأة بعد.","agents.emptyDesc":"أنشئ أول وكيل ذكاء اصطناعي لبدء المهام الآلية.","agent.overview":"نظرة عامة","agent.runs":"عمليات التنفيذ","agent.events":"الأحداث","agent.configuration":"التكوين","agent.budget":"الميزانية","agent.recentRuns":"آخر عمليات التنفيذ","agent.delete":"حذف الوكيل","agent.start":"بدء","agent.stop":"إيقاف","agent.run":"تشغيل","workflows.title":"مسارات العمل","workflows.create":"إنشاء مسار عمل","workflows.empty":"لا توجد مسارات عمل معرّفة بعد.","workflows.emptyDesc":"صمّم أول مسار عمل لتنسيق عدة وكلاء.","workflows.nodes":"{count} عقدة","workflows.edit":"تعديل","workflow.editor":"محرر مسار العمل","workflow.addNode":"إضافة عقدة","workflow.save":"حفظ","workflow.run":"تشغيل مسار العمل","skills.title":"المهارات","skills.install":"تثبيت","skills.empty":"لا توجد مهارات مثبتة بعد.","skills.emptyDesc":"تصفّح وثبّت المهارات لتوسيع قدرات وكلائك.","skills.scan":"فحص المجلد","skills.source":"عنوان URL أو مسار المصدر","runs.title":"عمليات التنفيذ","runs.empty":"لا توجد عمليات تنفيذ مسجلة بعد.","runs.emptyDesc":"شغّل وكيلًا أو مسار عمل لعرض سجل التنفيذ.","runs.filter":"تصفية","run.events":"الأحداث","run.output":"المخرجات","run.cost":"تفصيل التكاليف","run.duration":"المدة","approvals.title":"قائمة الموافقات","approvals.empty":"لا توجد موافقات معلقة.","approvals.emptyDesc":"كل شيء على ما يرام. ستظهر الإجراءات الخطيرة هنا للمراجعة.","approvals.approve":"موافقة","approvals.deny":"رفض","approvals.pending":"معلّق","nav.analytics":"التحليلات","nav.budget":"الميزانية","nav.traces":"التتبع","nav.memory":"الذاكرة","nav.goals":"الأهداف","nav.plans":"الخطط","nav.guardrails":"الحواجز","analytics.title":"تحليل التكاليف","analytics.description":"تتبع الإنفاق واستخدام الرموز وميزانية كل وكيل.","analytics.totalSpend":"إجمالي الإنفاق","analytics.totalRuns":"إجمالي عمليات التنفيذ","analytics.avgCostPerRun":"متوسط التكلفة/تنفيذ","analytics.monthlyEstimate":"التقدير الشهري","analytics.dailyCosts":"التكاليف اليومية (30 يومًا)","analytics.agentBreakdown":"التكلفة حسب الوكيل","analytics.modelBreakdown":"التكلفة حسب النموذج","analytics.budgetUtilization":"استخدام الميزانية","analytics.runs":"عمليات التنفيذ","analytics.totalCost":"التكلفة الإجمالية","analytics.avgCost":"متوسط التكلفة","analytics.model":"النموذج","analytics.tokens":"الرموز","analytics.cost":"التكلفة","analytics.noAgentData":"لا توجد بيانات تكلفة للوكلاء بعد.","analytics.noModelData":"لا توجد بيانات تكلفة للنماذج بعد.","settings.title":"الإعدادات","settings.general":"عام","settings.security":"الأمان","settings.llm":"LLM","settings.budget":"الميزانية","settings.save":"حفظ التغييرات","settings.saved":"تم حفظ الإعدادات بنجاح.","settings.language":"اللغة","common.loading":"جارٍ التحميل...","common.error":"حدث خطأ.","common.retry":"إعادة المحاولة","common.cancel":"إلغاء","common.save":"حفظ","common.delete":"حذف","common.close":"إغلاق","common.search":"بحث...","common.noResults":"لم يتم العثور على نتائج.","common.name":"الاسم","common.description":"الوصف","common.status":"الحالة","common.type":"النوع","common.actions":"الإجراءات","common.created":"تاريخ الإنشاء","common.updated":"تاريخ التحديث","status.running":"قيد التشغيل","status.completed":"مكتمل","status.failed":"فشل","status.pending":"معلّق","status.paused":"متوقف مؤقتًا","status.cancelled":"ملغى","status.idle":"خامل","trust.builtin":"مدمج","trust.official":"رسمي","trust.trusted":"موثوق","trust.community":"مجتمعي","trust.local":"محلي"},ru:{"nav.dashboard":"Панель управления","nav.agents":"Агенты","nav.workflows":"Рабочие процессы","nav.skills":"Навыки","nav.runs":"Запуски","nav.approvals":"Одобрения","nav.handoffs":"Передачи","nav.apiKeys":"API-ключи","nav.settings":"Настройки","nav.users":"Пользователи","nav.prompts":"Промпты","dashboard.title":"Панель управления","dashboard.activeAgents":"Активные агенты","dashboard.runningTasks":"Запущенные задачи","dashboard.costToday":"Расходы сегодня","dashboard.skillsInstalled":"Установленные навыки","dashboard.recentActivity":"Последняя активность","dashboard.quickActions":"Быстрые действия","dashboard.systemHealth":"Состояние системы","dashboard.createAgent":"Создать агента","dashboard.runWorkflow":"Запустить процесс","dashboard.installSkill":"Установить навык","agents.title":"Агенты","agents.create":"Создать агента","agents.empty":"Нет настроенных агентов.","agents.emptyDesc":"Создайте первого ИИ-агента для автоматизации задач.","agent.overview":"Обзор","agent.runs":"Запуски","agent.events":"События","agent.configuration":"Конфигурация","agent.budget":"Бюджет","agent.recentRuns":"Последние запуски","agent.delete":"Удалить агента","agent.start":"Запустить","agent.stop":"Остановить","agent.run":"Выполнить","workflows.title":"Рабочие процессы","workflows.create":"Создать процесс","workflows.empty":"Нет определённых процессов.","workflows.emptyDesc":"Создайте первый рабочий процесс для оркестрации агентов.","workflows.nodes":"{count} узлов","workflows.edit":"Редактировать","workflow.editor":"Редактор процессов","workflow.addNode":"Добавить узел","workflow.save":"Сохранить","workflow.run":"Запустить процесс","skills.title":"Навыки","skills.install":"Установить","skills.empty":"Нет установленных навыков.","skills.emptyDesc":"Просматривайте и устанавливайте навыки для расширения возможностей агентов.","skills.scan":"Сканировать каталог","skills.source":"URL или путь к источнику","runs.title":"Запуски","runs.empty":"Нет записей о запусках.","runs.emptyDesc":"Запустите агента или процесс, чтобы увидеть историю выполнения.","runs.filter":"Фильтр","run.events":"События","run.output":"Вывод","run.cost":"Разбивка стоимости","run.duration":"Длительность","approvals.title":"Очередь одобрений","approvals.empty":"Нет ожидающих одобрений.","approvals.emptyDesc":"Всё в порядке. Опасные действия появятся здесь для проверки.","approvals.approve":"Одобрить","approvals.deny":"Отклонить","approvals.pending":"Ожидает","nav.analytics":"Аналитика","nav.budget":"Бюджет","nav.traces":"Трассировки","nav.memory":"Память","nav.goals":"Цели","nav.plans":"Планы","nav.guardrails":"Ограждения","analytics.title":"Аналитика расходов","analytics.description":"Отслеживание расходов, использования токенов и бюджета по агентам.","analytics.totalSpend":"Общие расходы","analytics.totalRuns":"Всего запусков","analytics.avgCostPerRun":"Ср. стоимость/запуск","analytics.monthlyEstimate":"Месячная оценка","analytics.dailyCosts":"Ежедневные расходы (30 дней)","analytics.agentBreakdown":"Расходы по агентам","analytics.modelBreakdown":"Расходы по моделям","analytics.budgetUtilization":"Использование бюджета","analytics.runs":"Запуски","analytics.totalCost":"Общая стоимость","analytics.avgCost":"Ср. стоимость","analytics.model":"Модель","analytics.tokens":"Токены","analytics.cost":"Стоимость","analytics.noAgentData":"Нет данных о расходах по агентам.","analytics.noModelData":"Нет данных о расходах по моделям.","settings.title":"Настройки","settings.general":"Общие","settings.security":"Безопасность","settings.llm":"LLM","settings.budget":"Бюджет","settings.save":"Сохранить изменения","settings.saved":"Настройки сохранены.","settings.language":"Язык","common.loading":"Загрузка...","common.error":"Произошла ошибка.","common.retry":"Повторить","common.cancel":"Отмена","common.save":"Сохранить","common.delete":"Удалить","common.close":"Закрыть","common.search":"Поиск...","common.noResults":"Результатов не найдено.","common.name":"Название","common.description":"Описание","common.status":"Статус","common.type":"Тип","common.actions":"Действия","common.created":"Создано","common.updated":"Обновлено","status.running":"Выполняется","status.completed":"Завершено","status.failed":"Ошибка","status.pending":"Ожидание","status.paused":"Пауза","status.cancelled":"Отменено","status.idle":"Простой","trust.builtin":"Встроенный","trust.official":"Официальный","trust.trusted":"Доверенный","trust.community":"Сообщество","trust.local":"Локальный"},it:{"nav.dashboard":"Pannello","nav.agents":"Agenti","nav.workflows":"Flussi di lavoro","nav.skills":"Competenze","nav.runs":"Esecuzioni","nav.approvals":"Approvazioni","nav.handoffs":"Passaggi","nav.apiKeys":"Chiavi API","nav.settings":"Impostazioni","nav.users":"Utenti","nav.prompts":"Prompt","dashboard.title":"Pannello","dashboard.activeAgents":"Agenti attivi","dashboard.runningTasks":"Attività in corso","dashboard.costToday":"Costo oggi","dashboard.skillsInstalled":"Competenze installate","dashboard.recentActivity":"Attività recente","dashboard.quickActions":"Azioni rapide","dashboard.systemHealth":"Stato del sistema","dashboard.createAgent":"Crea agente","dashboard.runWorkflow":"Esegui flusso","dashboard.installSkill":"Installa competenza","agents.title":"Agenti","agents.create":"Crea agente","agents.empty":"Nessun agente configurato.","agents.emptyDesc":"Crea il tuo primo agente IA per iniziare con le attività automatizzate.","agent.overview":"Panoramica","agent.runs":"Esecuzioni","agent.events":"Eventi","agent.configuration":"Configurazione","agent.budget":"Budget","agent.recentRuns":"Esecuzioni recenti","agent.delete":"Elimina agente","agent.start":"Avvia","agent.stop":"Arresta","agent.run":"Esegui","workflows.title":"Flussi di lavoro","workflows.create":"Crea flusso","workflows.empty":"Nessun flusso di lavoro definito.","workflows.emptyDesc":"Progetta il tuo primo flusso di lavoro per orchestrare più agenti.","workflows.nodes":"{count} nodi","workflows.edit":"Modifica","workflow.editor":"Editor del flusso","workflow.addNode":"Aggiungi nodo","workflow.save":"Salva","workflow.run":"Esegui flusso","skills.title":"Competenze","skills.install":"Installa","skills.empty":"Nessuna competenza installata.","skills.emptyDesc":"Esplora e installa competenze per ampliare le capacità dei tuoi agenti.","skills.scan":"Scansiona directory","skills.source":"URL o percorso sorgente","runs.title":"Esecuzioni","runs.empty":"Nessuna esecuzione registrata.","runs.emptyDesc":"Esegui un agente o un flusso per vedere la cronologia.","runs.filter":"Filtra","run.events":"Eventi","run.output":"Output","run.cost":"Dettaglio costi","run.duration":"Durata","approvals.title":"Coda di approvazione","approvals.empty":"Nessuna approvazione in sospeso.","approvals.emptyDesc":"Tutto a posto. Le azioni pericolose appariranno qui per la revisione.","approvals.approve":"Approva","approvals.deny":"Nega","approvals.pending":"In sospeso","nav.analytics":"Analisi","nav.budget":"Budget","nav.traces":"Tracce","nav.memory":"Memoria","nav.goals":"Obiettivi","nav.plans":"Piani","nav.guardrails":"Protezioni","analytics.title":"Analisi dei costi","analytics.description":"Monitora spese, utilizzo dei token e budget per agente.","analytics.totalSpend":"Spesa totale","analytics.totalRuns":"Esecuzioni totali","analytics.avgCostPerRun":"Costo medio/esec.","analytics.monthlyEstimate":"Stima mensile","analytics.dailyCosts":"Costi giornalieri (30 giorni)","analytics.agentBreakdown":"Costo per agente","analytics.modelBreakdown":"Costo per modello","analytics.budgetUtilization":"Utilizzo del budget","analytics.runs":"Esecuzioni","analytics.totalCost":"Costo totale","analytics.avgCost":"Costo medio","analytics.model":"Modello","analytics.tokens":"Token","analytics.cost":"Costo","analytics.noAgentData":"Nessun dato di costo per agente.","analytics.noModelData":"Nessun dato di costo per modello.","settings.title":"Impostazioni","settings.general":"Generale","settings.security":"Sicurezza","settings.llm":"LLM","settings.budget":"Budget","settings.save":"Salva modifiche","settings.saved":"Impostazioni salvate.","settings.language":"Lingua","common.loading":"Caricamento...","common.error":"Si è verificato un errore.","common.retry":"Riprova","common.cancel":"Annulla","common.save":"Salva","common.delete":"Elimina","common.close":"Chiudi","common.search":"Cerca...","common.noResults":"Nessun risultato.","common.name":"Nome","common.description":"Descrizione","common.status":"Stato","common.type":"Tipo","common.actions":"Azioni","common.created":"Creato","common.updated":"Aggiornato","status.running":"In esecuzione","status.completed":"Completato","status.failed":"Fallito","status.pending":"In sospeso","status.paused":"In pausa","status.cancelled":"Annullato","status.idle":"Inattivo","trust.builtin":"Integrato","trust.official":"Ufficiale","trust.trusted":"Affidabile","trust.community":"Comunità","trust.local":"Locale"},nl:{"nav.dashboard":"Dashboard","nav.agents":"Agents","nav.workflows":"Workflows","nav.skills":"Vaardigheden","nav.runs":"Uitvoeringen","nav.approvals":"Goedkeuringen","nav.handoffs":"Overdrachten","nav.apiKeys":"API-sleutels","nav.settings":"Instellingen","nav.users":"Gebruikers","nav.prompts":"Prompts","dashboard.title":"Dashboard","dashboard.activeAgents":"Actieve agents","dashboard.runningTasks":"Lopende taken","dashboard.costToday":"Kosten vandaag","dashboard.skillsInstalled":"Geïnstalleerde vaardigheden","dashboard.recentActivity":"Recente activiteit","dashboard.quickActions":"Snelle acties","dashboard.systemHealth":"Systeemstatus","dashboard.createAgent":"Agent aanmaken","dashboard.runWorkflow":"Workflow uitvoeren","dashboard.installSkill":"Vaardigheid installeren","agents.title":"Agents","agents.create":"Agent aanmaken","agents.empty":"Geen agents geconfigureerd.","agents.emptyDesc":"Maak uw eerste AI-agent aan om te beginnen met geautomatiseerde taken.","agent.overview":"Overzicht","agent.runs":"Uitvoeringen","agent.events":"Gebeurtenissen","agent.configuration":"Configuratie","agent.budget":"Budget","agent.recentRuns":"Recente uitvoeringen","agent.delete":"Agent verwijderen","agent.start":"Starten","agent.stop":"Stoppen","agent.run":"Uitvoeren","workflows.title":"Workflows","workflows.create":"Workflow aanmaken","workflows.empty":"Geen workflows gedefinieerd.","workflows.emptyDesc":"Ontwerp uw eerste workflow om meerdere agents te orkestreren.","workflows.nodes":"{count} knooppunten","workflows.edit":"Bewerken","workflow.editor":"Workflow-editor","workflow.addNode":"Knooppunt toevoegen","workflow.save":"Opslaan","workflow.run":"Workflow uitvoeren","skills.title":"Vaardigheden","skills.install":"Installeren","skills.empty":"Geen vaardigheden geïnstalleerd.","skills.emptyDesc":"Blader door en installeer vaardigheden om de mogelijkheden van uw agents uit te breiden.","skills.scan":"Map scannen","skills.source":"Bron-URL of pad","runs.title":"Uitvoeringen","runs.empty":"Geen uitvoeringen geregistreerd.","runs.emptyDesc":"Voer een agent of workflow uit om de uitvoeringsgeschiedenis te bekijken.","runs.filter":"Filteren","run.events":"Gebeurtenissen","run.output":"Uitvoer","run.cost":"Kostenoverzicht","run.duration":"Duur","approvals.title":"Goedkeuringswachtrij","approvals.empty":"Geen wachtende goedkeuringen.","approvals.emptyDesc":"Alles in orde. Gevaarlijke acties verschijnen hier ter beoordeling.","approvals.approve":"Goedkeuren","approvals.deny":"Weigeren","approvals.pending":"In afwachting","nav.analytics":"Analyse","nav.budget":"Budget","nav.traces":"Traces","nav.memory":"Geheugen","nav.goals":"Doelen","nav.plans":"Plannen","nav.guardrails":"Vangrails","analytics.title":"Kostenanalyse","analytics.description":"Volg uitgaven, tokengebruik en budgetbenutting per agent.","analytics.totalSpend":"Totale uitgaven","analytics.totalRuns":"Totaal uitvoeringen","analytics.avgCostPerRun":"Gem. kosten/uitv.","analytics.monthlyEstimate":"Maandelijkse schatting","analytics.dailyCosts":"Dagelijkse kosten (30 dagen)","analytics.agentBreakdown":"Kosten per agent","analytics.modelBreakdown":"Kosten per model","analytics.budgetUtilization":"Budgetbenutting","analytics.runs":"Uitvoeringen","analytics.totalCost":"Totale kosten","analytics.avgCost":"Gem. kosten","analytics.model":"Model","analytics.tokens":"Tokens","analytics.cost":"Kosten","analytics.noAgentData":"Nog geen kostengegevens per agent.","analytics.noModelData":"Nog geen kostengegevens per model.","settings.title":"Instellingen","settings.general":"Algemeen","settings.security":"Beveiliging","settings.llm":"LLM","settings.budget":"Budget","settings.save":"Wijzigingen opslaan","settings.saved":"Instellingen opgeslagen.","settings.language":"Taal","common.loading":"Laden...","common.error":"Er is een fout opgetreden.","common.retry":"Opnieuw proberen","common.cancel":"Annuleren","common.save":"Opslaan","common.delete":"Verwijderen","common.close":"Sluiten","common.search":"Zoeken...","common.noResults":"Geen resultaten gevonden.","common.name":"Naam","common.description":"Beschrijving","common.status":"Status","common.type":"Type","common.actions":"Acties","common.created":"Aangemaakt","common.updated":"Bijgewerkt","status.running":"Actief","status.completed":"Voltooid","status.failed":"Mislukt","status.pending":"In afwachting","status.paused":"Gepauzeerd","status.cancelled":"Geannuleerd","status.idle":"Inactief","trust.builtin":"Ingebouwd","trust.official":"Officieel","trust.trusted":"Vertrouwd","trust.community":"Community","trust.local":"Lokaal"}},k0=u.createContext({lang:"en",setLang:()=>{},t:n=>n,isRTL:!1});function _v({children:n}){const[i,d]=u.useState(()=>{const h=localStorage.getItem("nestor_lang");return h&&Hd(h)?h:Lv(navigator.language)}),c=Dv.includes(i);u.useEffect(()=>{document.documentElement.dir=c?"rtl":"ltr",document.documentElement.lang=i},[i,c]);const m=u.useCallback(h=>{d(h),localStorage.setItem("nestor_lang",h)},[]),f=u.useCallback((h,b)=>{var p;let g=((p=Dh[i])==null?void 0:p[h])??Dh.en[h]??h;if(b)for(const[w,v]of Object.entries(b))g=g.replace(`{${w}}`,String(v));return g},[i]);return t.jsx(k0.Provider,{value:{lang:i,setLang:m,t:f,isRTL:c},children:n})}function nt(){return u.useContext(k0)}const Uv={admin:{agents:["create","read","update","delete","execute","admin"],workflows:["create","read","update","delete","execute","admin"],skills:["create","read","update","delete","admin"],settings:["read","update","admin"],users:["create","read","update","delete","admin"],prompts:["create","read","update","delete","admin"]},member:{agents:["create","read","update","execute"],workflows:["create","read","update","execute"],skills:["read","create"],settings:["read"],prompts:["read","create","update"]},viewer:{agents:["read"],workflows:["read"],skills:["read"],settings:["read"],prompts:["read"]}},z0=u.createContext({user:null,loading:!0,login:async()=>{},logout:async()=>{},register:async()=>{},isAdmin:!1,hasPermission:()=>!1}),Bv="/api";function $v(){const n=document.cookie.match(/(?:^|; )nestor-csrf=([^;]*)/);return n?decodeURIComponent(n[1]):null}async function Zl(n,i){var h;const d={"Content-Type":"application/json",...(i==null?void 0:i.headers)||{}},c=((i==null?void 0:i.method)||"GET").toUpperCase();if(c!=="GET"&&c!=="HEAD"){const b=$v();b&&(d["X-CSRF-Token"]=b)}const m=await fetch(`${Bv}${n}`,{credentials:"include",headers:d,...i}),f=await m.json().catch(()=>({}));if(!m.ok)throw new Error(((h=f==null?void 0:f.error)==null?void 0:h.message)||`Request failed (${m.status})`);return f}function Hv({children:n}){const[i,d]=u.useState(null),[c,m]=u.useState(!0);u.useEffect(()=>{Zl("/auth/me").then(w=>{var v;(v=w.data)!=null&&v.user&&typeof w.data.user=="object"&&d(w.data.user)}).catch(async()=>{try{(await Zl("/health")).status==="ok"&&d({id:"local",email:"admin@localhost",name:"Admin",role:"admin"})}catch{}}).finally(()=>m(!1))},[]);const f=u.useCallback(async(w,v)=>{const y=await Zl("/auth/login",{method:"POST",body:JSON.stringify({email:w,password:v})});d(y.data.user)},[]),h=u.useCallback(async()=>{await Zl("/auth/logout",{method:"POST"}).catch(()=>{}),d(null)},[]),b=u.useCallback(async(w,v,y)=>{await Zl("/auth/register",{method:"POST",body:JSON.stringify({email:w,password:v,name:y})})},[]),g=(i==null?void 0:i.role)==="admin",p=u.useCallback((w,v)=>{if(!i)return!1;const y=Uv[i.role];if(!y)return!1;const k=y[w];return k?k.includes(v)||k.includes("admin"):!1},[i]);return t.jsx(z0.Provider,{value:{user:i,loading:c,login:f,logout:h,register:b,isAdmin:g,hasPermission:p},children:n})}function ci(){return u.useContext(z0)}const qv=[{to:"/missions",icon:Qa,labelKey:"nav.missions"},{to:"/chat",icon:Ts,labelKey:"nav.chat"},{to:"/agents",icon:Ja,labelKey:"nav.agents"},{to:"/workflows",icon:Gr,labelKey:"nav.workflows"},{to:"/runs",icon:Ct,labelKey:"nav.history"}],C0=[{key:"tools",label:"Tools",defaultOpen:!1,items:[{to:"/skills",icon:Jr,labelKey:"nav.skills"},{to:"/memory",icon:Es,labelKey:"nav.memory"},{to:"/plans",icon:rv,labelKey:"nav.plans"},{to:"/guardrails",icon:Ms,labelKey:"nav.guardrails"}]},{key:"monitoring",label:"Monitoring",defaultOpen:!1,items:[{to:"/analytics",icon:ka,labelKey:"nav.analytics"},{to:"/budget",icon:Ca,labelKey:"nav.budget"},{to:"/traces",icon:Ft,labelKey:"nav.traces"},{to:"/approvals",icon:nu,labelKey:"nav.approvals"}]},{key:"advanced",label:"Advanced",defaultOpen:!1,items:[{to:"/goals",icon:en,labelKey:"nav.goals"},{to:"/handoffs",icon:ti,labelKey:"nav.handoffs"},{to:"/keys",icon:ri,labelKey:"nav.apiKeys"},{to:"/settings",icon:In,labelKey:"nav.settings"}]}],Gv=[{to:"/users",icon:Pn,labelKey:"nav.users"},{to:"/admin",icon:In,labelKey:"nav.admin"}],A0="nestor_sidebar_sections";function Kv(){try{const i=localStorage.getItem(A0);if(i)return JSON.parse(i)}catch{}const n={};for(const i of C0)n[i.key]=i.defaultOpen;return n}function Vv(n){try{localStorage.setItem(A0,JSON.stringify(n))}catch{}}function Yv({onNavigate:n}){const{t:i}=nt(),{user:d,isAdmin:c,logout:m}=ci(),[f,h]=u.useState(Kv);u.useEffect(()=>{Vv(f)},[f]);const b=u.useCallback(p=>{h(w=>({...w,[p]:!w[p]}))},[]),g=({isActive:p})=>`flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors ${p?"bg-purple-500/10 text-purple-400":"text-zinc-400 hover:bg-surface-hover hover:text-zinc-200"}`;return t.jsxs("aside",{className:"fixed inset-y-0 left-0 z-30 flex w-60 flex-col border-r border-border bg-surface",children:[t.jsxs("div",{className:"flex h-14 items-center gap-2.5 px-5 border-b border-border",children:[t.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-purple-600 text-white",children:t.jsx(Qa,{className:"h-4 w-4"})}),t.jsxs("span",{className:"text-lg font-semibold text-white tracking-tight",children:["Nestor ",t.jsx("span",{className:"text-xs font-normal text-zinc-500",children:"Studio"})]})]}),t.jsxs("nav",{className:"flex-1 space-y-0.5 px-3 py-4 overflow-y-auto",children:[qv.map(p=>{const w=p.icon;return t.jsxs(Il,{to:p.to,end:p.to==="/chat",onClick:n,className:g,children:[t.jsx(w,{className:"h-4 w-4 flex-shrink-0"}),i(p.labelKey)]},p.to)}),C0.map(p=>t.jsxs("div",{className:"mt-2",children:[t.jsxs("button",{onClick:()=>b(p.key),className:"flex items-center gap-2 w-full px-3 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-zinc-600 hover:text-zinc-400 transition-colors",children:[f[p.key]?t.jsx(Fa,{className:"h-3 w-3"}):t.jsx(ca,{className:"h-3 w-3"}),p.label]}),f[p.key]&&t.jsx("div",{className:"space-y-0.5",children:p.items.map(w=>{const v=w.icon;return t.jsxs(Il,{to:w.to,onClick:n,className:g,children:[t.jsx(v,{className:"h-4 w-4 flex-shrink-0"}),i(w.labelKey)]},w.to)})})]},p.key)),c&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"my-2 border-t border-border/50"}),t.jsx("div",{className:"px-3 py-1 text-[10px] font-semibold uppercase tracking-wider text-zinc-600",children:"Admin"}),Gv.map(p=>{const w=p.icon;return t.jsxs(Il,{to:p.to,onClick:n,className:g,children:[t.jsx(w,{className:"h-4 w-4 flex-shrink-0"}),i(p.labelKey)]},p.to)})]})]}),t.jsxs("div",{className:"border-t border-border px-4 py-3",children:[d&&t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-medium text-zinc-200",children:d.name}),t.jsx("p",{className:"truncate text-xs text-zinc-500",children:d.role})]}),t.jsx("button",{onClick:m,className:"rounded p-1.5 text-zinc-400 transition-colors hover:bg-surface-hover hover:text-zinc-200",title:"Sign out",children:t.jsx(hv,{className:"h-4 w-4"})})]}),t.jsx("p",{className:"mt-2 text-xs text-zinc-600",children:"Nestor v3.1.0"})]})]})}const Xv=["system","agents","runs","approvals"],Qv=10,Zv=1e3,Jv=3e4,Fv=3e4,Iv=200;function Pv(n,i,d){const c=Math.min(i*2**n,d),m=c*Math.random()*.25;return c+m}function Wv(){const n=window.location.protocol==="https:"?"wss:":"ws:",i=window.location.host,d=localStorage.getItem("nestor_token"),c=d?`?token=${encodeURIComponent(d)}`:"";return`${n}//${i}/ws${c}`}function iu(n=Xv,i){const{reconnect:d=!0,maxRetries:c=Qv,baseDelay:m=Zv,maxDelay:f=Jv}={},[h,b]=u.useState([]),[g,p]=u.useState("disconnected"),[w,v]=u.useState(0),y=u.useRef(null),k=u.useRef(),z=u.useRef(),N=u.useRef(n),S=u.useRef(!1),C=u.useRef(0);N.current=n;const O=u.useCallback(()=>{k.current&&(clearTimeout(k.current),k.current=void 0)},[]),M=u.useCallback(()=>{z.current&&(clearInterval(z.current),z.current=void 0)},[]),E=u.useCallback(le=>{M(),z.current=setInterval(()=>{le.readyState===WebSocket.OPEN&&le.send(JSON.stringify({type:"ping"}))},Fv)},[M]),ae=u.useCallback((le,J)=>{for(const re of J)le.readyState===WebSocket.OPEN&&le.send(JSON.stringify({type:"subscribe",channel:re}))},[]),ce=u.useCallback(le=>{if(!d||S.current)return;if(C.current>=c){console.warn(`[Nestor WS] Max retries (${c}) reached. Giving up.`),p("disconnected");return}const J=Pv(C.current,m,f);console.info(`[Nestor WS] Reconnecting in ${Math.round(J)}ms (attempt ${C.current+1}/${c})`),p("reconnecting"),O(),k.current=setTimeout(()=>{C.current+=1,v(C.current),le()},J)},[d,c,m,f,O]),B=u.useCallback(()=>{if(!(y.current&&(y.current.readyState===WebSocket.OPEN||y.current.readyState===WebSocket.CONNECTING)))try{const le=Wv(),J=new WebSocket(le);y.current=J,p("connecting"),J.onopen=()=>{console.info("[Nestor WS] Connected"),p("connected"),C.current=0,v(0),S.current=!1,ae(J,N.current),E(J)},J.onmessage=re=>{try{const ge=JSON.parse(re.data);if(ge.type==="ping"){J.send(JSON.stringify({type:"pong"}));return}if(ge.type==="pong")return;if(ge.type==="event"){const G=ge;b(ee=>[...ee.slice(-(Iv-1)),G])}}catch{}},J.onclose=re=>{if(console.info(`[Nestor WS] Closed (code=${re.code}, reason=${re.reason||"none"})`),y.current=null,M(),S.current){p("disconnected");return}ce(B)},J.onerror=re=>{console.error("[Nestor WS] Error:",re),J.close()}}catch{ce(B)}},[ae,E,M,ce]);u.useEffect(()=>(S.current=!1,B(),()=>{S.current=!0,O(),M(),y.current&&(y.current.close(1e3,"Component unmount"),y.current=null)}),[B,O,M]),u.useEffect(()=>{const le=y.current;!le||le.readyState!==WebSocket.OPEN||ae(le,n)},[n,ae]);const q=u.useCallback(le=>{const J=y.current;J&&J.readyState===WebSocket.OPEN&&J.send(JSON.stringify({type:"subscribe",channel:le}))},[]),I=u.useCallback(le=>{const J=y.current;J&&J.readyState===WebSocket.OPEN&&J.send(JSON.stringify({type:"unsubscribe",channel:le}))},[]),W=u.useCallback(()=>{b([])},[]),X=u.useCallback(()=>{S.current=!0,O(),M(),y.current&&(y.current.close(1e3,"Manual close"),y.current=null),p("disconnected")},[O,M]);return{events:h,connected:g==="connected",status:g,retryCount:w,subscribe:q,unsubscribe:I,clearEvents:W,close:X}}const ej="/api";class tj extends Error{constructor(i,d,c){super(`API Error ${i}: ${d}`),this.status=i,this.statusText=d,this.body=c,this.name="ApiError"}}function aj(n){const i=document.cookie.match(new RegExp(`(?:^|; )${n}=([^;]*)`));return i?decodeURIComponent(i[1]):null}async function ne(n,i={}){const d=`${ej}${n}`,c={"Content-Type":"application/json",...i.headers},m=localStorage.getItem("nestor_token");m&&(c.Authorization=`Bearer ${m}`);const f=(i.method||"GET").toUpperCase();if(f!=="GET"&&f!=="HEAD"){const g=aj("nestor-csrf");g&&(c["X-CSRF-Token"]=g)}const h=localStorage.getItem("nestor_tenant_id");h&&(c["X-Tenant-ID"]=h);const b=await fetch(d,{...i,headers:c});if(!b.ok){let g;try{g=await b.json()}catch{g=await b.text()}throw new tj(b.status,b.statusText,g)}if(b.status!==204)return b.json()}const Ds={list:n=>{const i=new URLSearchParams;n!=null&&n.limit&&i.set("limit",String(n.limit)),n!=null&&n.offset&&i.set("offset",String(n.offset));const d=i.toString();return ne(`/agents${d?`?${d}`:""}`)},get:n=>ne(`/agents/${n}`),create:n=>ne("/agents",{method:"POST",body:JSON.stringify(n)}),update:(n,i)=>ne(`/agents/${n}`,{method:"PATCH",body:JSON.stringify(i)}),delete:n=>ne(`/agents/${n}`,{method:"DELETE"}),run:(n,i)=>ne(`/agents/${n}/run`,{method:"POST",body:JSON.stringify({prompt:i})}),getStatus:n=>ne(`/agents/${n}/status`),start:(n,i="daemon")=>ne(`/agents/${n}/start`,{method:"POST",body:JSON.stringify({mode:i})}),stop:n=>ne(`/agents/${n}/stop`,{method:"POST"})},ru={list:n=>{const i=new URLSearchParams;n!=null&&n.limit&&i.set("limit",String(n.limit)),n!=null&&n.offset&&i.set("offset",String(n.offset));const d=i.toString();return ne(`/workflows${d?`?${d}`:""}`)},get:n=>ne(`/workflows/${n}`),create:n=>ne("/workflows",{method:"POST",body:JSON.stringify(n)}),run:(n,i={})=>ne(`/workflows/${n}/run`,{method:"POST",body:JSON.stringify({input:i})})},Ws={list:n=>{const i=new URLSearchParams;n!=null&&n.limit&&i.set("limit",String(n.limit)),n!=null&&n.offset&&i.set("offset",String(n.offset)),n!=null&&n.status&&i.set("status",n.status),n!=null&&n.agentId&&i.set("agentId",n.agentId),n!=null&&n.workflowId&&i.set("workflowId",n.workflowId);const d=i.toString();return ne(`/runs${d?`?${d}`:""}`)},get:n=>ne(`/runs/${n}`),getEvents:n=>ne(`/runs/${n}/events`),abort:n=>ne(`/runs/${n}/abort`,{method:"POST"}),delete:n=>ne(`/runs/${n}`,{method:"DELETE"})},Hr={list:n=>{const i=new URLSearchParams;n!=null&&n.limit&&i.set("limit",String(n.limit)),n!=null&&n.offset&&i.set("offset",String(n.offset));const d=i.toString();return ne(`/skills${d?`?${d}`:""}`)},install:n=>ne("/skills/install",{method:"POST",body:JSON.stringify(n)}),scan:n=>ne("/skills/scan",{method:"POST",body:JSON.stringify({path:n})}),delete:n=>ne(`/skills/${n}`,{method:"DELETE"})},Sa={stats:()=>ne("/system/stats"),health:()=>ne("/health"),getConfig:()=>ne("/system/config"),updateConfig:n=>ne("/system/config",{method:"PUT",body:JSON.stringify(n)})},Ar={summary:n=>{const i=new URLSearchParams;n!=null&&n.from&&i.set("from",String(n.from)),n!=null&&n.to&&i.set("to",String(n.to)),n!=null&&n.agentId&&i.set("agentId",n.agentId);const d=i.toString();return ne(`/analytics/summary${d?`?${d}`:""}`)},daily:(n=30)=>ne(`/analytics/daily?days=${n}`),budget:()=>ne("/analytics/budget"),estimate:()=>ne("/analytics/estimate"),agentBreakdown:n=>ne(`/analytics/agents/${n}`),qualityOverview:(n=30)=>ne(`/analytics/quality?days=${n}`),qualityAgent:(n,i=30)=>ne(`/analytics/quality/${n}?days=${i}`)},Cd={list:n=>{const i=new URLSearchParams;n!=null&&n.limit&&i.set("limit",String(n.limit)),n!=null&&n.status&&i.set("status",n.status);const d=i.toString();return ne(`/traces${d?`?${d}`:""}`)},get:n=>ne(`/traces/${n}`),clear:()=>ne("/traces",{method:"DELETE"})},Oh={list:()=>ne("/tenants"),get:n=>ne(`/tenants/${n}`),create:n=>ne("/tenants",{method:"POST",body:JSON.stringify(n)}),update:(n,i)=>ne(`/tenants/${n}`,{method:"PUT",body:JSON.stringify(i)}),delete:n=>ne(`/tenants/${n}`,{method:"DELETE"}),switch:n=>ne(`/tenants/${n}/switch`,{method:"POST"})},Jl={tree:()=>ne("/goals"),get:n=>ne(`/goals/${n}`),create:n=>ne("/goals",{method:"POST",body:JSON.stringify(n)}),update:(n,i)=>ne(`/goals/${n}`,{method:"PUT",body:JSON.stringify(i)}),delete:n=>ne(`/goals/${n}`,{method:"DELETE"}),ancestry:n=>ne(`/goals/${n}/ancestry`),assign:(n,i)=>ne(`/goals/${n}/assign/${i}`,{method:"POST"}),agentGoals:n=>ne(`/agents/${n}/goals`)},Fl={list:n=>{const i=new URLSearchParams;n!=null&&n.status&&i.set("status",n.status),n!=null&&n.agentId&&i.set("agentId",n.agentId),n!=null&&n.type&&i.set("type",n.type),n!=null&&n.limit&&i.set("limit",String(n.limit)),n!=null&&n.offset&&i.set("offset",String(n.offset));const d=i.toString();return ne(`/approvals${d?`?${d}`:""}`)},create:n=>ne("/approvals",{method:"POST",body:JSON.stringify(n)}),get:n=>ne(`/approvals/${n}`),approve:(n,i)=>ne(`/approvals/${n}/approve`,{method:"POST",body:JSON.stringify({decidedBy:(i==null?void 0:i.reviewerId)??"user",comment:i==null?void 0:i.comment})}),reject:(n,i)=>ne(`/approvals/${n}/reject`,{method:"POST",body:JSON.stringify({decidedBy:(i==null?void 0:i.reviewerId)??"user",reason:i==null?void 0:i.reason})}),history:n=>{const i=new URLSearchParams;n!=null&&n.limit&&i.set("limit",String(n.limit)),n!=null&&n.agentId&&i.set("agentId",n.agentId);const d=i.toString();return ne(`/approvals/history${d?`?${d}`:""}`)},stats:()=>ne("/approvals/stats")},Ad={forRun:n=>ne(`/runs/${n}/annotations`),create:(n,i)=>ne(`/runs/${n}/annotate`,{method:"POST",body:JSON.stringify(i)}),delete:n=>ne(`/annotations/${n}`,{method:"DELETE"})},Kr={list:n=>{const i=new URLSearchParams;n!=null&&n.status&&i.set("status",n.status);const d=i.toString();return ne(`/handoffs${d?`?${d}`:""}`)},get:n=>ne(`/handoffs/${n}`),create:(n,i)=>ne(`/runs/${n}/handoff`,{method:"POST",body:JSON.stringify(i)}),resume:(n,i)=>ne(`/handoffs/${n}/resume`,{method:"POST",body:JSON.stringify({humanResolution:i})})},zt={overview:()=>ne("/admin/overview"),tenants:{list:()=>ne("/tenants"),create:n=>ne("/tenants",{method:"POST",body:JSON.stringify(n)}),get:n=>ne(`/tenants/${n}`),update:(n,i)=>ne(`/tenants/${n}`,{method:"PUT",body:JSON.stringify(i)})},users:{list:n=>{const i=new URLSearchParams;n!=null&&n.tenantId&&i.set("tenantId",n.tenantId),n!=null&&n.role&&i.set("role",n.role);const d=i.toString();return ne(`/users${d?`?${d}`:""}`)},updateRole:(n,i)=>ne(`/users/${n}`,{method:"PATCH",body:JSON.stringify({role:i})}),lock:n=>ne(`/users/${n}`,{method:"PATCH",body:JSON.stringify({isActive:!1})}),unlock:n=>ne(`/users/${n}`,{method:"PATCH",body:JSON.stringify({isActive:!0})})},system:{info:()=>ne("/admin/system-info"),dbStats:()=>ne("/admin/db-stats"),rateLimitStats:()=>ne("/admin/rate-limit-stats")},audit:{query:n=>{const i=new URLSearchParams;n!=null&&n.userId&&i.set("userId",n.userId),n!=null&&n.resourceType&&i.set("resourceType",n.resourceType),n!=null&&n.action&&i.set("action",n.action),n!=null&&n.limit&&i.set("limit",String(n.limit));const d=i.toString();return ne(`/users/audit${d?`?${d}`:""}`)},export:n=>ne(`/users/audit?limit=10000&format=${n}`)},security:{failedLogins:(n=24)=>ne(`/admin/security/failed-logins?hours=${n}`),lockedAccounts:()=>ne("/admin/security/locked-accounts"),activeSessions:()=>ne("/admin/security/active-sessions"),rateLimitViolations:(n=100)=>ne(`/admin/security/rate-violations?limit=${n}`)}},Lh={status:()=>ne("/providers/status"),test:n=>ne("/providers/test",{method:"POST",body:JSON.stringify(n)})},ha={list:()=>ne("/keys"),set:(n,i,d)=>ne("/keys",{method:"POST",body:JSON.stringify({provider:n,key:i,label:d})}),remove:n=>ne(`/keys/${n}`,{method:"DELETE"}),test:n=>ne(`/keys/test/${n}`)},ks={plan:(n,i)=>ne("/missions/plan",{method:"POST",body:JSON.stringify({objective:n,...i})}),list:()=>ne("/missions"),get:n=>ne(`/missions/${n}`),getReport:(n,i)=>ne(`/missions/${n}/report${i==="md"?"?format=md":""}`),cancel:n=>ne(`/missions/${n}/cancel`,{method:"POST"})};function sj({onMenuClick:n,showMenu:i}){const{lang:d,setLang:c,t:m}=nt(),{connected:f}=iu(),[h,b]=u.useState([]),[g,p]=u.useState(()=>localStorage.getItem("nestor_tenant_id")??"default"),[w,v]=u.useState(!1),[y,k]=u.useState(!1),z=u.useRef(null),N=u.useRef(null),S=h.find(E=>E.id===g)??null,C=u.useCallback(async()=>{try{const E=await Oh.list();b(E.data)}catch{}},[]);u.useEffect(()=>{C()},[C]),u.useEffect(()=>{const E=ae=>{z.current&&!z.current.contains(ae.target)&&v(!1),N.current&&!N.current.contains(ae.target)&&k(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]);const O=async E=>{try{await Oh.switch(E.id),localStorage.setItem("nestor_tenant_id",E.id),p(E.id),v(!1),window.location.reload()}catch(ae){console.error("Failed to switch tenant:",ae)}},M=Object.keys($d);return t.jsxs("header",{className:"header sticky top-0 z-20 flex h-14 items-center justify-between border-b border-border bg-[#0a0a0f]/80 px-6 backdrop-blur-sm",children:[t.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[i&&t.jsx("button",{onClick:n,className:"p-2 hover:bg-surface-hover rounded-lg transition-colors","aria-label":"Toggle menu",children:t.jsx(pv,{className:"h-5 w-5 text-zinc-400"})}),t.jsxs("div",{className:"relative max-w-md flex-1",children:[t.jsx(Rs,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),t.jsx("input",{type:"text",placeholder:m("common.search"),className:"input pl-9 max-w-sm"})]})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[h.length>0&&t.jsxs("div",{className:"relative hidden sm:block",ref:z,children:[t.jsxs("button",{onClick:()=>v(!w),className:"flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-1.5 text-sm transition-colors hover:border-zinc-600",children:[t.jsx(Fd,{className:"h-3.5 w-3.5 text-indigo-400"}),t.jsx("span",{className:"text-zinc-200 max-w-[120px] truncate",children:(S==null?void 0:S.name)??"Default"}),t.jsx(Fa,{className:`h-3.5 w-3.5 text-zinc-500 transition-transform ${w?"rotate-180":""}`})]}),w&&t.jsxs("div",{className:"absolute right-0 top-full mt-1 w-56 rounded-lg border border-border bg-surface shadow-xl z-50",children:[t.jsx("div",{className:"px-3 py-2 text-[10px] font-semibold uppercase tracking-wider text-zinc-600",children:"Switch Tenant"}),t.jsx("div",{className:"max-h-64 overflow-y-auto py-1",children:h.map(E=>t.jsxs("button",{onClick:()=>O(E),className:"flex w-full items-center gap-2 px-3 py-2 text-sm text-zinc-300 transition-colors hover:bg-surface-hover",children:[E.id===g?t.jsx(ut,{className:"h-3.5 w-3.5 text-indigo-400"}):t.jsx("div",{className:"h-3.5 w-3.5"}),t.jsxs("div",{className:"flex-1 text-left",children:[t.jsx("div",{className:"font-medium",children:E.name}),t.jsx("div",{className:"text-xs text-zinc-500",children:E.slug})]})]},E.id))})]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[f?t.jsx(Mv,{className:"h-4 w-4 text-green-400"}):t.jsx(Rv,{className:"h-4 w-4 text-zinc-500"}),t.jsx("span",{className:`text-xs hidden sm:inline ${f?"text-green-400":"text-zinc-500"}`,children:f?"Connected":"Offline"})]}),t.jsxs("div",{className:"relative",ref:N,children:[t.jsxs("button",{onClick:()=>k(!y),className:"btn-ghost btn-sm flex items-center gap-1.5",title:"Switch language",children:[t.jsx(Wd,{className:"h-4 w-4"}),t.jsx("span",{className:"text-xs uppercase",children:d}),t.jsx(Fa,{className:`h-3 w-3 text-zinc-500 transition-transform ${y?"rotate-180":""}`})]}),y&&t.jsx("div",{className:"absolute right-0 top-full mt-1 w-48 rounded-lg border border-border bg-surface shadow-xl z-50 max-h-80 overflow-y-auto",children:M.map(E=>t.jsxs("button",{onClick:()=>{c(E),k(!1)},className:"flex w-full items-center gap-2 px-3 py-2 text-sm text-zinc-300 transition-colors hover:bg-surface-hover",children:[E===d?t.jsx(ut,{className:"h-3.5 w-3.5 text-indigo-400"}):t.jsx("div",{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"flex-1 text-left",children:$d[E]}),t.jsx("span",{className:"text-xs text-zinc-500 uppercase",children:E})]},E))})]})]})]})}const nj=[{to:"/",icon:Ts,labelKey:"nav.chat"},{to:"/agents",icon:Ja,labelKey:"nav.agents"},{to:"/dashboard",icon:eu,labelKey:"nav.dashboard"},{to:"/runs",icon:Ct,labelKey:"nav.history"},{to:"/settings",icon:In,labelKey:"nav.settings"}];function lj(){const{t:n}=nt();return t.jsx("nav",{className:"mobile-bottom-nav",children:nj.map(i=>{const d=i.icon;return t.jsxs(Il,{to:i.to,end:i.to==="/",className:({isActive:c})=>`mobile-bottom-nav-item ${c?"active":""}`,children:[t.jsx(d,{className:"h-5 w-5"}),t.jsx("span",{className:"mobile-bottom-nav-label",children:n(i.labelKey)})]},i.to)})})}function ij(){const[n,i]=u.useState(!1),[d,c]=u.useState(!1);u.useEffect(()=>{const f=()=>c(window.innerWidth<769);return f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[]);const m=()=>{d&&i(!1)};return t.jsxs("div",{className:"flex min-h-screen bg-[#0a0a0f]",children:[d&&n&&t.jsx("div",{className:"sidebar-overlay",onClick:()=>i(!1)}),t.jsx("div",{className:`sidebar ${d&&n?"open":""}`,children:t.jsx(Yv,{onNavigate:m})}),t.jsxs("div",{className:`flex flex-1 flex-col ${d?"":"pl-60"}`,children:[t.jsx(sj,{onMenuClick:()=>i(!n),showMenu:d}),t.jsx("main",{className:`main-content flex-1 p-6 ${d?"pb-20":""}`,children:t.jsx(gy,{})}),d&&t.jsx(lj,{})]})]})}class rj extends u.Component{constructor(){super(...arguments);hd(this,"state",{hasError:!1,error:null});hd(this,"handleReset",()=>{this.setState({hasError:!1,error:null})})}static getDerivedStateFromError(d){return{hasError:!0,error:d}}componentDidCatch(d,c){var m,f;console.error("[Nestor] UI Error:",d,c),(f=(m=this.props).onError)==null||f.call(m,d,c)}render(){var d;return this.state.hasError?this.props.fallback?this.props.fallback:t.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] p-8",children:[t.jsx("div",{className:"text-red-500 text-xl mb-4",children:"Something went wrong"}),t.jsx("pre",{className:"bg-gray-100 dark:bg-gray-800 p-4 rounded-lg text-sm max-w-lg overflow-auto mb-4",children:(d=this.state.error)==null?void 0:d.message}),t.jsx("button",{onClick:this.handleReset,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:"Try Again"})]}):this.props.children}}function cj(){const n=Dt();return t.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh] p-8 text-center",children:[t.jsx("div",{className:"w-16 h-16 mb-6 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:t.jsx("svg",{className:"w-8 h-8 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})})}),t.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-gray-100 mb-2",children:"Page Error"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-8 max-w-md",children:"An unexpected error occurred while rendering this page. The error has been logged for investigation."}),t.jsxs("div",{className:"flex gap-3",children:[t.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:"Reload Page"}),t.jsx("button",{onClick:()=>n("/"),className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:"Go Home"})]})]})}const oj={node_started:{icon:Ct,color:"text-blue-400"},node_completed:{icon:pt,color:"text-green-400"},node_failed:{icon:At,color:"text-red-400"},tool_call_requested:{icon:Qa,color:"text-amber-400"},tool_call_approved:{icon:pt,color:"text-green-400"},tool_call_denied:{icon:za,color:"text-red-400"},tool_call_completed:{icon:pt,color:"text-emerald-400"},approval_requested:{icon:za,color:"text-amber-400"},approval_resolved:{icon:pt,color:"text-green-400"},budget_warning:{icon:mt,color:"text-amber-400"},budget_exceeded:{icon:Ca,color:"text-red-400"},run_paused:{icon:Zr,color:"text-blue-400"},run_resumed:{icon:w0,color:"text-blue-400"}};function dj(n){try{return new Date(n).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return n}}function uj(n,i){switch(n){case"node_started":return`Node started: ${i.nodeId??i.label??""}`;case"node_completed":return`Node completed: ${i.nodeId??i.label??""}`;case"node_failed":return`Node failed: ${i.error??i.nodeId??""}`;case"tool_call_requested":return`Tool call: ${i.toolName??""}`;case"tool_call_approved":return`Tool approved: ${i.toolName??""}`;case"tool_call_denied":return`Tool denied: ${i.toolName??""}`;case"tool_call_completed":return`Tool completed: ${i.toolName??""}`;case"approval_requested":return`Approval required: ${i.toolName??i.action??""}`;case"approval_resolved":return`Approval resolved: ${i.decision??""}`;case"budget_warning":return`Budget warning: ${i.percent??""}% used`;case"budget_exceeded":return"Budget exceeded";case"run_paused":return"Run paused";case"run_resumed":return"Run resumed";default:return n.replace(/_/g," ")}}function cu({events:n,maxHeight:i="400px"}){return n.length===0?t.jsxs("div",{className:"flex items-center justify-center py-8 text-sm text-zinc-500",children:[t.jsx(Xn,{className:"mr-2 h-4 w-4"}),"Waiting for events..."]}):t.jsx("div",{className:"overflow-y-auto",style:{maxHeight:i},children:t.jsx("div",{className:"space-y-0.5",children:[...n].reverse().map(d=>{const c=oj[d.type]??{icon:Qa,color:"text-zinc-400"},m=c.icon;return t.jsxs("div",{className:"flex items-start gap-3 rounded-lg px-3 py-2 hover:bg-surface-hover transition-colors",children:[t.jsx("div",{className:`mt-0.5 flex-shrink-0 ${c.color}`,children:t.jsx(m,{className:"h-4 w-4"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-sm text-zinc-300 truncate",children:uj(d.type,d.data)}),d.nodeId&&t.jsxs("p",{className:"text-xs text-zinc-500 truncate",children:["Node: ",d.nodeId]})]}),t.jsx("time",{className:"flex-shrink-0 text-xs text-zinc-500",children:dj(d.timestamp)})]},d.id)})})})}function Er({label:n,value:i,icon:d,color:c,bgColor:m}){return t.jsx("div",{className:"card",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-zinc-400",children:n}),t.jsx("p",{className:"mt-1 text-2xl font-semibold text-white",children:i})]}),t.jsx("div",{className:`flex h-11 w-11 items-center justify-center rounded-xl ${m}`,children:t.jsx(d,{className:`h-5 w-5 ${c}`})})]})})}function mj(){const{t:n}=nt(),{events:i}=iu(),[d,c]=u.useState(null),[m,f]=u.useState("healthy"),[h,b]=u.useState(!0),[g,p]=u.useState(null);u.useEffect(()=>{Sa.stats().then(z=>{c(z.data),f("healthy"),p(null)}).catch(z=>{f("down"),p(z instanceof Error?z.message:"Failed to connect to server")}).finally(()=>{b(!1)}),Sa.health().then(z=>{f(z.status==="healthy"?"healthy":"degraded")}).catch(()=>{f("down")})},[]),u.useEffect(()=>{i.length!==0&&Sa.stats().then(z=>c(z.data)).catch(()=>{})},[i.length]);const v={healthy:{icon:pt,color:"text-green-400",bg:"bg-green-500/10",label:"All systems operational"},degraded:{icon:mt,color:"text-amber-400",bg:"bg-amber-500/10",label:"Some services degraded"},down:{icon:At,color:"text-red-400",bg:"bg-red-500/10",label:"Services unavailable"}}[m],y=v.icon,k=i.map((z,N)=>{var S;return{id:String(N),type:typeof z.data=="object"&&z.data!==null&&"kind"in z.data?z.data.kind:z.channel,data:z.data??{},timestamp:((S=z.data)==null?void 0:S.timestamp)??new Date().toISOString()}});return h?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:n("dashboard.title")}),g&&t.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-4 text-sm text-red-400",children:["Unable to connect to the Nestor server. Make sure the server is running.",t.jsx("span",{className:"ml-2 text-xs text-red-500/70",children:g})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[t.jsx(Er,{label:n("dashboard.activeAgents"),value:(d==null?void 0:d.agents.total)??0,icon:Ja,color:"text-indigo-400",bgColor:"bg-indigo-500/10"}),t.jsx(Er,{label:n("dashboard.runningTasks"),value:(d==null?void 0:d.runs.running)??0,icon:Ct,color:"text-emerald-400",bgColor:"bg-emerald-500/10"}),t.jsx(Er,{label:n("dashboard.costToday"),value:"$0.00",icon:Ca,color:"text-amber-400",bgColor:"bg-amber-500/10"}),t.jsx(Er,{label:n("dashboard.skillsInstalled"),value:(d==null?void 0:d.skills.total)??0,icon:Jr,color:"text-violet-400",bgColor:"bg-violet-500/10"})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-3",children:[t.jsxs("div",{className:"card lg:col-span-2",children:[t.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[t.jsx("h2",{className:"text-lg font-medium text-zinc-200",children:n("dashboard.recentActivity")}),t.jsx(Ft,{className:"h-4 w-4 text-zinc-500"})]}),t.jsx(cu,{events:k,maxHeight:"300px"})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"mb-4 text-lg font-medium text-zinc-200",children:n("dashboard.quickActions")}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(Xa,{to:"/agents",className:"btn-secondary w-full justify-start",children:[t.jsx(gt,{className:"h-4 w-4"}),n("dashboard.createAgent")]}),t.jsxs(Xa,{to:"/workflows",className:"btn-secondary w-full justify-start",children:[t.jsx(Gr,{className:"h-4 w-4"}),n("dashboard.runWorkflow")]}),t.jsxs(Xa,{to:"/skills",className:"btn-secondary w-full justify-start",children:[t.jsx(ai,{className:"h-4 w-4"}),n("dashboard.installSkill")]})]})]}),t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"mb-4 text-lg font-medium text-zinc-200",children:n("dashboard.systemHealth")}),t.jsxs("div",{className:`flex items-center gap-3 rounded-lg p-3 ${v.bg}`,children:[t.jsx(y,{className:`h-5 w-5 ${v.color}`}),t.jsxs("div",{children:[t.jsx("p",{className:`text-sm font-medium ${v.color}`,children:v.label}),t.jsx("p",{className:"text-xs text-zinc-500",children:d?`${d.agents.total} agents | ${d.workflows.total} workflows | ${d.runs.today} runs today`:"Loading..."})]})]}),(d==null?void 0:d.server)&&t.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 text-xs",children:[t.jsxs("div",{className:"rounded bg-[#0a0a0f] p-2",children:[t.jsx("span",{className:"text-zinc-500",children:"Version"}),t.jsx("p",{className:"text-zinc-300 font-mono",children:d.server.version})]}),t.jsxs("div",{className:"rounded bg-[#0a0a0f] p-2",children:[t.jsx("span",{className:"text-zinc-500",children:"Uptime"}),t.jsxs("p",{className:"text-zinc-300 font-mono",children:[Math.floor(d.server.uptime/3600),"h ",Math.floor(d.server.uptime%3600/60),"m"]})]}),t.jsxs("div",{className:"rounded bg-[#0a0a0f] p-2",children:[t.jsx("span",{className:"text-zinc-500",children:"Memory (RSS)"}),t.jsxs("p",{className:"text-zinc-300 font-mono",children:[d.server.memoryUsage.rss," MB"]})]}),t.jsxs("div",{className:"rounded bg-[#0a0a0f] p-2",children:[t.jsx("span",{className:"text-zinc-500",children:"WS Connections"}),t.jsx("p",{className:"text-zinc-300 font-mono",children:d.websocket.connections})]})]})]})]})]})]})}function xj(){const[n,i]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(null),h=u.useCallback(async()=>{c(!0),f(null);try{const b=await Ds.list({limit:200});i(b.data)}catch(b){f(b instanceof Error?b.message:"Failed to fetch agents")}finally{c(!1)}},[]);return u.useEffect(()=>{h()},[h]),{agents:n,loading:d,error:m,refetch:h}}function fj(n){const[i,d]=u.useState(null),[c,m]=u.useState(!0),[f,h]=u.useState(null),b=u.useCallback(async()=>{if(n){m(!0),h(null);try{const g=await Ds.get(n);d(g.data)}catch(g){h(g instanceof Error?g.message:"Failed to fetch agent")}finally{m(!1)}}},[n]);return u.useEffect(()=>{b()},[b]),{agent:i,loading:c,error:f,refetch:b}}const _h={running:{bg:"bg-emerald-500/10",text:"text-emerald-400",dot:"bg-emerald-400"},completed:{bg:"bg-green-500/10",text:"text-green-400",dot:"bg-green-400"},failed:{bg:"bg-red-500/10",text:"text-red-400",dot:"bg-red-400"},pending:{bg:"bg-amber-500/10",text:"text-amber-400",dot:"bg-amber-400"},paused:{bg:"bg-blue-500/10",text:"text-blue-400",dot:"bg-blue-400"},cancelled:{bg:"bg-zinc-500/10",text:"text-zinc-400",dot:"bg-zinc-400"},idle:{bg:"bg-zinc-500/10",text:"text-zinc-500",dot:"bg-zinc-500"}};function oi({status:n,pulse:i}){const{t:d}=nt(),c=_h[n]??_h.idle;return t.jsxs("span",{className:`badge ${c.bg} ${c.text}`,children:[t.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${c.dot} ${i&&n==="running"?"animate-pulse":""}`}),d(`status.${n}`)]})}const hj={builtin:{bg:"bg-indigo-500/10",text:"text-indigo-400"},official:{bg:"bg-blue-500/10",text:"text-blue-400"},trusted:{bg:"bg-emerald-500/10",text:"text-emerald-400"},community:{bg:"bg-amber-500/10",text:"text-amber-400"},local:{bg:"bg-zinc-500/10",text:"text-zinc-400"}};function ou({level:n}){const{t:i}=nt(),d=hj[n];return t.jsxs("span",{className:`badge ${d.bg} ${d.text}`,children:[n==="builtin"||n==="official"?t.jsx("svg",{className:"h-3 w-3",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M6.267 3.455a3.066 3.066 0 001.745-.723 3.066 3.066 0 013.976 0 3.066 3.066 0 001.745.723 3.066 3.066 0 012.812 2.812c.051.643.304 1.254.723 1.745a3.066 3.066 0 010 3.976 3.066 3.066 0 00-.723 1.745 3.066 3.066 0 01-2.812 2.812 3.066 3.066 0 00-1.745.723 3.066 3.066 0 01-3.976 0 3.066 3.066 0 00-1.745-.723 3.066 3.066 0 01-2.812-2.812 3.066 3.066 0 00-.723-1.745 3.066 3.066 0 010-3.976 3.066 3.066 0 00.723-1.745 3.066 3.066 0 012.812-2.812zm7.44 5.252a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}):null,i(`trust.${n}`)]})}function E0({spent:n,limit:i,currency:d="$"}){const c=i>0?Math.min(n/i*100,100):0,m=c>=75,f=c>=90,h=f?"bg-red-500":m?"bg-amber-500":"bg-indigo-500";return t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between text-xs",children:[t.jsxs("span",{className:"text-zinc-400",children:[d,n.toFixed(2)," / ",d,i.toFixed(2)]}),t.jsxs("span",{className:`font-medium ${f?"text-red-400":m?"text-amber-400":"text-zinc-400"}`,children:[c.toFixed(0),"%"]})]}),t.jsx("div",{className:"h-1.5 w-full rounded-full bg-zinc-800",children:t.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${h}`,style:{width:`${c}%`}})})]})}const pj={anthropic:Ja,openai:Ja,local:ov};function gj({agent:n,status:i="idle",budgetSpent:d=0,budgetLimit:c=10}){const m=pj[n.adapterType]??Ja;return t.jsxs(Xa,{to:`/agents/${n.id}`,className:"card group hover:border-indigo-500/30 hover:bg-surface-hover transition-all duration-200",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-indigo-500/10 text-indigo-400 group-hover:bg-indigo-500/20 transition-colors",children:t.jsx(m,{className:"h-5 w-5"})}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-zinc-200 group-hover:text-white transition-colors",children:n.name}),t.jsxs("p",{className:"text-xs text-zinc-500",children:[n.adapterType," ",n.adapterConfig.model?`/ ${n.adapterConfig.model}`:""]})]})]}),t.jsx(oi,{status:i,pulse:!0})]}),n.description&&t.jsx("p",{className:"mt-3 text-sm text-zinc-400 line-clamp-2",children:n.description}),t.jsx("div",{className:"mt-4 flex items-center justify-between",children:t.jsx(ou,{level:n.trustLevel})}),t.jsx("div",{className:"mt-3",children:t.jsx(E0,{spent:d,limit:c})})]})}function tn({icon:n,title:i,description:d,action:c}){return t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4 text-center",children:[t.jsx("div",{className:"mb-4 rounded-2xl bg-surface p-4 text-zinc-500",children:n??t.jsx(uv,{className:"h-8 w-8"})}),t.jsx("h3",{className:"text-lg font-medium text-zinc-300",children:i}),d&&t.jsx("p",{className:"mt-1.5 max-w-sm text-sm text-zinc-500",children:d}),c&&t.jsx("div",{className:"mt-4",children:c})]})}function bj(){const{t:n}=nt(),{agents:i,loading:d,error:c,refetch:m}=xj(),[f,h]=u.useState(!1),[b,g]=u.useState(!1),[p,w]=u.useState({name:"",description:"",adapterType:"anthropic",model:"",trustLevel:"community"}),v=async()=>{if(p.name.trim()){g(!0);try{await Ds.create({name:p.name,description:p.description||void 0,adapterType:p.adapterType,adapterConfig:p.model?{model:p.model}:{},trustLevel:p.trustLevel}),h(!1),w({name:"",description:"",adapterType:"anthropic",model:"",trustLevel:"community"}),m()}catch(y){console.error("Failed to create agent:",y)}finally{g(!1)}}};return d?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:n("agents.title")}),t.jsxs("button",{onClick:()=>h(!0),className:"btn-primary",children:[t.jsx(gt,{className:"h-4 w-4"}),n("agents.create")]})]}),c&&t.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-4 text-sm text-red-400",children:[c,t.jsx("button",{onClick:m,className:"ml-3 underline",children:"Retry"})]}),i.length===0&&!c?t.jsx(tn,{icon:t.jsx(Ja,{className:"h-8 w-8"}),title:n("agents.empty"),description:n("agents.emptyDesc"),action:t.jsxs("button",{onClick:()=>h(!0),className:"btn-primary",children:[t.jsx(gt,{className:"h-4 w-4"}),n("agents.create")]})}):t.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:i.map(y=>t.jsx(gj,{agent:y},y.id))}),f&&t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:t.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border bg-surface p-6 shadow-2xl",children:[t.jsxs("div",{className:"flex items-center justify-between mb-5",children:[t.jsx("h2",{className:"text-lg font-semibold text-white",children:n("agents.create")}),t.jsx("button",{onClick:()=>h(!1),className:"btn-ghost btn-sm",children:t.jsx(tt,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:n("common.name")}),t.jsx("input",{className:"input",value:p.name,onChange:y=>w({...p,name:y.target.value}),placeholder:"My Agent"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:n("common.description")}),t.jsx("textarea",{className:"input min-h-[80px] resize-none",value:p.description,onChange:y=>w({...p,description:y.target.value}),placeholder:"What does this agent do?"})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Adapter"}),t.jsxs("select",{className:"input",value:p.adapterType,onChange:y=>w({...p,adapterType:y.target.value}),children:[t.jsx("option",{value:"anthropic",children:"Anthropic (Claude)"}),t.jsx("option",{value:"openai",children:"OpenAI (GPT)"}),t.jsx("option",{value:"gemini",children:"Google (Gemini)"}),t.jsx("option",{value:"grok",children:"xAI (Grok)"}),t.jsx("option",{value:"mistral",children:"Mistral AI"}),t.jsx("option",{value:"ollama",children:"Ollama (Local)"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Model"}),t.jsx("input",{className:"input",value:p.model,onChange:y=>w({...p,model:y.target.value}),placeholder:"claude-sonnet-4-20250514"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Trust Level"}),t.jsxs("select",{className:"input",value:p.trustLevel,onChange:y=>w({...p,trustLevel:y.target.value}),children:[t.jsx("option",{value:"builtin",children:"Built-in"}),t.jsx("option",{value:"official",children:"Official"}),t.jsx("option",{value:"trusted",children:"Trusted"}),t.jsx("option",{value:"community",children:"Community"}),t.jsx("option",{value:"local",children:"Local"})]})]})]}),t.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[t.jsx("button",{onClick:()=>h(!1),className:"btn-secondary",children:n("common.cancel")}),t.jsx("button",{onClick:v,disabled:!p.name.trim()||b,className:"btn-primary",children:n(b?"common.loading":"agents.create")})]})]})})]})}const yj="/api";async function vj(n){const i=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};i&&(d.Authorization=`Bearer ${i}`);const c=localStorage.getItem("nestor_tenant_id");c&&(d["X-Tenant-ID"]=c);try{const m=await fetch(`${yj}/agents/${n}/quality`,{headers:d});return m.ok?(await m.json()).data??null:null}catch{return null}}function Uh(n){return`${(n*100).toFixed(0)}%`}function Tr({icon:n,label:i,value:d,subtext:c,color:m}){return t.jsxs("div",{className:"rounded-lg bg-zinc-800/50 p-4 border border-zinc-700/50",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx(n,{className:`h-4 w-4 ${m}`}),t.jsx("span",{className:"text-xs text-zinc-500 uppercase tracking-wide",children:i})]}),t.jsx("p",{className:`text-2xl font-bold ${m}`,children:d}),c&&t.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:c})]})}function jj({agentId:n}){const[i,d]=u.useState(null),[c,m]=u.useState(!0),f=u.useCallback(async()=>{m(!0);const N=await vj(n);d(N),m(!1)},[n]);if(u.useEffect(()=>{f()},[f]),c)return t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"mb-4 text-lg font-medium text-zinc-200",children:"Quality"}),t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})})]});if(!i)return t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"mb-4 text-lg font-medium text-zinc-200",children:"Quality"}),t.jsx("p",{className:"text-sm text-zinc-500",children:"No quality data available yet."})]});const h=i.satisfactionRate>=.8?"text-green-400":i.satisfactionRate>=.5?"text-yellow-400":"text-red-400",b=i.successRate>=.8?"text-green-400":i.successRate>=.5?"text-yellow-400":"text-red-400",g=i.recentFeedback.filter(N=>N.rating===1).length,p=i.recentFeedback.length,w=p>0?g/p:0,v=i.satisfactionRate,y=p<3?"stable":w>v+.1?"improving":w<v-.1?"declining":"stable",k=y==="improving"?lu:y==="declining"?Ev:gv,z=y==="improving"?"text-green-400":y==="declining"?"text-red-400":"text-zinc-400";return t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("h2",{className:"text-lg font-medium text-zinc-200",children:"Quality"}),t.jsxs("div",{className:`flex items-center gap-1 text-xs ${z}`,children:[t.jsx(k,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"capitalize",children:y})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[t.jsx(Tr,{icon:ni,label:"Satisfaction",value:Uh(i.satisfactionRate),subtext:`${i.positiveFeedback}/${i.totalFeedback} positive`,color:h}),t.jsx(Tr,{icon:pt,label:"Success Rate",value:Uh(i.successRate),subtext:`${i.completedRuns} completed, ${i.failedRuns} failed`,color:b}),t.jsx(Tr,{icon:Ca,label:"Avg Cost / Run",value:`$${i.avgCostPerRun.toFixed(4)}`,subtext:`${i.totalRuns} total runs`,color:"text-blue-400"}),t.jsx(Tr,{icon:ka,label:"Total Runs",value:i.totalRuns.toString(),subtext:`${i.totalFeedback} rated`,color:"text-indigo-400"})]}),i.recentFeedback.length>0&&t.jsxs("div",{className:"mt-4",children:[t.jsx("h3",{className:"text-xs font-medium text-zinc-500 uppercase tracking-wide mb-2",children:"Recent Feedback"}),t.jsx("div",{className:"space-y-1 max-h-40 overflow-y-auto",children:i.recentFeedback.slice(0,10).map((N,S)=>t.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[t.jsx("span",{className:N.rating===1?"text-green-400":"text-red-400",children:N.rating===1?"+":"-"}),t.jsx("span",{className:"text-zinc-400 flex-1",children:N.comment??(N.rating===1?"Positive":"Negative")}),t.jsx("span",{className:"text-zinc-600 shrink-0",children:new Date(N.createdAt).toLocaleDateString()})]},S))})]})]})}function Nj({event:n}){switch(n.type){case"tool_start":return t.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-amber-500/20 bg-amber-500/5 px-3 py-1.5",children:[t.jsx(Wn,{className:"h-3.5 w-3.5 text-amber-400"}),t.jsx("span",{className:"text-xs text-amber-300 font-medium",children:n.name}),t.jsx(ot,{className:"h-3 w-3 text-amber-400 animate-spin"})]});case"tool_result":return t.jsxs("div",{className:`flex items-center gap-2 rounded-md border px-3 py-1.5 ${n.success?"border-emerald-500/20 bg-emerald-500/5":"border-red-500/20 bg-red-500/5"}`,children:[n.success?t.jsx(pt,{className:"h-3.5 w-3.5 text-emerald-400"}):t.jsx(At,{className:"h-3.5 w-3.5 text-red-400"}),t.jsxs("span",{className:`text-xs font-medium ${n.success?"text-emerald-300":"text-red-300"}`,children:[n.name," ",n.success?"completed":"failed"]})]});case"reasoning":return t.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-yellow-500/20 bg-yellow-500/5 px-3 py-1.5",children:[t.jsx(_d,{className:"h-3.5 w-3.5 text-yellow-400 mt-0.5 shrink-0"}),t.jsxs("div",{className:"min-w-0",children:[n.phase&&t.jsx("span",{className:"text-[10px] uppercase text-yellow-600 font-mono",children:n.phase}),t.jsx("p",{className:"text-xs text-yellow-200/80 break-words",children:n.reasoning}),n.confidence!=null&&t.jsxs("span",{className:"text-[10px] text-yellow-600",children:["confidence: ",(n.confidence*100).toFixed(0),"%"]})]})]});case"error":return t.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-red-500/20 bg-red-500/5 px-3 py-1.5",children:[t.jsx(At,{className:"h-3.5 w-3.5 text-red-400"}),t.jsx("span",{className:"text-xs text-red-300",children:n.text})]});default:return null}}function wj({runId:n,onComplete:i}){const[d,c]=u.useState(""),[m,f]=u.useState([]),[h,b]=u.useState(!0),g=u.useRef(null),p=u.useRef(0),{subscribe:w,unsubscribe:v,events:y,connected:k}=iu([`run:${n}`]);return u.useEffect(()=>(k&&w(`run:${n}`),()=>{v(`run:${n}`)}),[k,n,w,v]),u.useEffect(()=>{for(const z of y){if(z.channel!==`run:${n}`)continue;const N=z.data;if(!N||N.runId!==n)continue;const S=N.type,C=++p.current;switch(S){case"token":c(O=>O+(N.text??""));break;case"tool_start":f(O=>[...O,{id:C,type:"tool_start",name:N.name,args:N.args,timestamp:Date.now()}]);break;case"tool_result":f(O=>[...O,{id:C,type:"tool_result",name:N.name,result:N.result,success:N.success,timestamp:Date.now()}]);break;case"reasoning":{const O=N.entry;f(M=>[...M,{id:C,type:"reasoning",reasoning:(O==null?void 0:O.reasoning)??N.reasoning??"",phase:(O==null?void 0:O.phase)??void 0,confidence:(O==null?void 0:O.confidence)??void 0,timestamp:Date.now()}]);break}case"error":f(O=>[...O,{id:C,type:"error",text:N.message,timestamp:Date.now()}]);break;case"done":b(!1),i==null||i();break}}},[y,n,i]),u.useEffect(()=>{g.current&&(g.current.scrollTop=g.current.scrollHeight)},[d]),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(N0,{className:`h-3.5 w-3.5 ${h?"text-green-400 animate-pulse":"text-zinc-500"}`}),t.jsx("span",{className:"text-xs font-medium text-zinc-400",children:h?"Live Output":"Run Completed"}),!k&&t.jsx("span",{className:"text-[10px] text-red-400 ml-auto",children:"Disconnected"})]}),t.jsx("div",{ref:g,className:"bg-gray-900 p-4 rounded-lg max-h-96 overflow-y-auto whitespace-pre-wrap font-mono text-sm text-zinc-200 border border-zinc-700",children:d||t.jsx("span",{className:"text-zinc-500 italic",children:h?"Waiting for output...":"No output produced."})}),m.length>0&&t.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:m.map(z=>t.jsx(Nj,{event:z},z.id))})]})}function Sj(){const{id:n}=Fn(),i=Dt(),{t:d}=nt(),{agent:c,loading:m,error:f}=fj(n),[h,b]=u.useState("overview"),[g,p]=u.useState(""),[w,v]=u.useState(!1),[y,k]=u.useState(null);if(m)return t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})});if(f||!c)return t.jsxs("div",{className:"flex flex-col items-center justify-center py-20",children:[t.jsx("p",{className:"text-red-400",children:f??"Agent not found"}),t.jsxs("button",{onClick:()=>i("/agents"),className:"btn-secondary mt-4",children:[t.jsx(Yn,{className:"h-4 w-4"})," Back to Agents"]})]});const z=async()=>{var C;if(!(!g.trim()||!n)){v(!0);try{const O=await Ds.run(n,g),M=((C=O==null?void 0:O.data)==null?void 0:C.id)??null;k(M),p("")}catch(O){console.error("Run failed:",O)}finally{v(!1)}}},N=async()=>{if(n&&window.confirm(`Delete agent "${c.name}"?`))try{await Ds.delete(n),i("/agents")}catch(C){console.error("Delete failed:",C)}},S=[{key:"overview",label:d("agent.overview"),icon:ka},{key:"quality",label:"Quality",icon:Ft},{key:"runs",label:d("agent.runs"),icon:Ct},{key:"events",label:d("agent.events"),icon:Ft},{key:"configuration",label:d("agent.configuration"),icon:In}];return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("button",{onClick:()=>i("/agents"),className:"btn-ghost btn-sm",children:t.jsx(Yn,{className:"h-4 w-4"})}),t.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl bg-indigo-500/10 text-indigo-400",children:t.jsx(Ja,{className:"h-6 w-6"})}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:c.name}),t.jsx(oi,{status:"idle"})]}),t.jsxs("p",{className:"text-sm text-zinc-400",children:[c.adapterType,c.adapterConfig.model?` / ${c.adapterConfig.model}`:"",t.jsx("span",{className:"mx-2 text-zinc-600",children:"|"}),t.jsx(ou,{level:c.trustLevel})]})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{className:"btn-secondary btn-sm",children:[t.jsx(Ct,{className:"h-3.5 w-3.5"})," ",d("agent.start")]}),t.jsxs("button",{className:"btn-secondary btn-sm",children:[t.jsx(Sv,{className:"h-3.5 w-3.5"})," ",d("agent.stop")]}),t.jsxs("button",{onClick:N,className:"btn-danger btn-sm",children:[t.jsx(qt,{className:"h-3.5 w-3.5"})," ",d("agent.delete")]})]})]}),t.jsx("div",{className:"card",children:t.jsxs("div",{className:"flex gap-3",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(S0,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),t.jsx("input",{className:"input pl-9",placeholder:"Enter a prompt to run this agent...",value:g,onChange:C=>p(C.target.value),onKeyDown:C=>C.key==="Enter"&&z()})]}),t.jsxs("button",{onClick:z,disabled:!g.trim()||w,className:"btn-primary",children:[t.jsx(Ct,{className:"h-4 w-4"}),d(w?"common.loading":"agent.run")]})]})}),y&&t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(N0,{className:"h-4 w-4 text-green-400 animate-pulse"}),t.jsx("h3",{className:"text-sm font-medium text-zinc-200",children:"Live Output"}),t.jsxs("span",{className:"text-[10px] font-mono text-zinc-500",children:[y.slice(0,12),"..."]})]}),t.jsx("button",{onClick:()=>k(null),className:"text-xs text-zinc-500 hover:text-zinc-300 transition-colors",children:"Dismiss"})]}),t.jsx(wj,{runId:y,onComplete:()=>{}})]}),t.jsx("div",{className:"flex gap-1 border-b border-border",children:S.map(({key:C,label:O,icon:M})=>t.jsxs("button",{onClick:()=>b(C),className:`flex items-center gap-2 px-4 py-2.5 text-sm font-medium transition-colors border-b-2 ${h===C?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-400 hover:text-zinc-200"}`,children:[t.jsx(M,{className:"h-4 w-4"}),O]},C))}),h==="quality"&&n&&t.jsx(jj,{agentId:n}),h==="overview"&&t.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[t.jsxs("div",{className:"card",children:[t.jsx("h3",{className:"mb-4 text-lg font-medium text-zinc-200",children:d("agent.budget")}),t.jsx(E0,{spent:0,limit:10}),t.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"rounded-lg bg-[#0a0a0f] p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Total Spent"}),t.jsx("p",{className:"text-lg font-semibold text-white",children:"$0.00"})]}),t.jsxs("div",{className:"rounded-lg bg-[#0a0a0f] p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Runs Today"}),t.jsx("p",{className:"text-lg font-semibold text-white",children:"0"})]})]})]}),t.jsxs("div",{className:"card",children:[t.jsx("h3",{className:"mb-4 text-lg font-medium text-zinc-200",children:d("agent.recentRuns")}),t.jsx("p",{className:"text-sm text-zinc-500",children:"No runs recorded yet."})]}),c.description&&t.jsxs("div",{className:"card lg:col-span-2",children:[t.jsx("h3",{className:"mb-2 text-lg font-medium text-zinc-200",children:d("common.description")}),t.jsx("p",{className:"text-sm text-zinc-400",children:c.description})]})]}),h==="runs"&&t.jsx("div",{className:"card",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border text-left",children:[t.jsx("th",{className:"pb-3 pr-4 text-zinc-400 font-medium",children:"Run ID"}),t.jsx("th",{className:"pb-3 pr-4 text-zinc-400 font-medium",children:d("common.status")}),t.jsx("th",{className:"pb-3 pr-4 text-zinc-400 font-medium",children:d("run.duration")}),t.jsx("th",{className:"pb-3 pr-4 text-zinc-400 font-medium",children:"Cost"}),t.jsx("th",{className:"pb-3 text-zinc-400 font-medium",children:d("common.created")})]})}),t.jsx("tbody",{children:t.jsx("tr",{children:t.jsx("td",{colSpan:5,className:"py-8 text-center text-zinc-500",children:"No runs recorded for this agent."})})})]})})}),h==="events"&&t.jsx("div",{className:"card",children:t.jsx(cu,{events:[],maxHeight:"500px"})}),h==="configuration"&&t.jsxs("div",{className:"card",children:[t.jsx("h3",{className:"mb-4 text-lg font-medium text-zinc-200",children:"Agent Configuration"}),t.jsx("pre",{className:"overflow-auto rounded-lg bg-[#0a0a0f] p-4 text-sm text-zinc-300",children:JSON.stringify(c,null,2)})]})]})}function kj(){const[n,i]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(null),h=u.useCallback(async()=>{c(!0),f(null);try{const b=await ru.list({limit:200});i(b.data)}catch(b){f(b instanceof Error?b.message:"Failed to fetch workflows")}finally{c(!1)}},[]);return u.useEffect(()=>{h()},[h]),{workflows:n,loading:d,error:m,refetch:h}}function zj(n){const[i,d]=u.useState(null),[c,m]=u.useState(!0),[f,h]=u.useState(null),b=u.useCallback(async()=>{if(n){m(!0),h(null);try{const g=await ru.get(n);d(g.data)}catch(g){h(g instanceof Error?g.message:"Failed to fetch workflow")}finally{m(!1)}}},[n]);return u.useEffect(()=>{b()},[b]),{workflow:i,loading:c,error:f,refetch:b}}function Cj(){const{t:n}=nt(),{workflows:i,loading:d,error:c,refetch:m}=kj(),[f,h]=u.useState(!1),[b,g]=u.useState(!1),[p,w]=u.useState({name:"",description:""}),v=async()=>{if(p.name.trim()){g(!0);try{const y={id:"start",type:"agent",label:"Start",config:{},next:[]};await ru.create({name:p.name,description:p.description||void 0,nodes:[y],entryNodeId:"start"}),h(!1),w({name:"",description:""}),m()}catch(y){console.error("Failed to create workflow:",y)}finally{g(!1)}}};return d?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:n("workflows.title")}),t.jsxs("button",{onClick:()=>h(!0),className:"btn-primary",children:[t.jsx(gt,{className:"h-4 w-4"}),n("workflows.create")]})]}),c&&t.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-4 text-sm text-red-400",children:[c,t.jsx("button",{onClick:m,className:"ml-3 underline",children:"Retry"})]}),i.length===0&&!c?t.jsx(tn,{icon:t.jsx(Gr,{className:"h-8 w-8"}),title:n("workflows.empty"),description:n("workflows.emptyDesc"),action:t.jsxs("button",{onClick:()=>h(!0),className:"btn-primary",children:[t.jsx(gt,{className:"h-4 w-4"}),n("workflows.create")]})}):t.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:i.map(y=>t.jsxs("div",{className:"card group hover:border-indigo-500/30 transition-colors",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-blue-500/10 text-blue-400",children:t.jsx(Gr,{className:"h-5 w-5"})}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-zinc-200",children:y.name}),t.jsxs("p",{className:"text-xs text-zinc-500",children:["v",y.currentVersion]})]})]}),t.jsx(oi,{status:"idle"})]}),y.description&&t.jsx("p",{className:"mt-3 text-sm text-zinc-400 line-clamp-2",children:y.description}),t.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[t.jsxs("span",{className:"text-xs text-zinc-500",children:[n("common.updated"),": ",new Date(y.updatedAt).toLocaleDateString()]}),t.jsxs("div",{className:"flex gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.jsx(Xa,{to:`/workflows/${y.id}/edit`,className:"btn-ghost btn-sm",children:t.jsx(tu,{className:"h-3.5 w-3.5"})}),t.jsx("button",{className:"btn-ghost btn-sm text-green-400",children:t.jsx(Ct,{className:"h-3.5 w-3.5"})})]})]})]},y.id))}),f&&t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:t.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border bg-surface p-6 shadow-2xl",children:[t.jsxs("div",{className:"flex items-center justify-between mb-5",children:[t.jsx("h2",{className:"text-lg font-semibold text-white",children:n("workflows.create")}),t.jsx("button",{onClick:()=>h(!1),className:"btn-ghost btn-sm",children:t.jsx(tt,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:n("common.name")}),t.jsx("input",{className:"input",value:p.name,onChange:y=>w({...p,name:y.target.value}),placeholder:"My Workflow"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:n("common.description")}),t.jsx("textarea",{className:"input min-h-[80px] resize-none",value:p.description,onChange:y=>w({...p,description:y.target.value}),placeholder:"What does this workflow do?"})]})]}),t.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[t.jsx("button",{onClick:()=>h(!1),className:"btn-secondary",children:n("common.cancel")}),t.jsx("button",{onClick:v,disabled:!p.name.trim()||b,className:"btn-primary",children:n(b?"common.loading":"workflows.create")})]})]})})]})}const Bh={agent:"border-indigo-500 bg-indigo-500/10",tool:"border-emerald-500 bg-emerald-500/10",condition:"border-amber-500 bg-amber-500/10",parallel:"border-blue-500 bg-blue-500/10",loop:"border-violet-500 bg-violet-500/10",human:"border-rose-500 bg-rose-500/10"},Rr={agent:"Agent",tool:"Tool",condition:"Condition",parallel:"Parallel",loop:"Loop",human:"Human"};function Aj(n,i){var g;const d=new Map;if(n.length===0)return d;const c=new Set,m=[],f=new Map,h=i??((g=n[0])==null?void 0:g.id);for(h&&m.push({id:h,depth:0,index:0});m.length>0;){const{id:p,depth:w}=m.shift();if(c.has(p))continue;c.add(p);const v=f.get(w)??0;f.set(w,v+1),d.set(p,{x:80+v*220,y:60+w*120});const y=n.find(k=>k.id===p);if(y)for(const k of y.next)c.has(k)||m.push({id:k,depth:w+1,index:0})}let b=(f.get(0)??0)*220+80;for(const p of n)c.has(p.id)||(d.set(p.id,{x:b,y:60}),b+=220);return d}function Ej(){const{id:n}=Fn(),i=Dt(),{t:d}=nt(),{workflow:c,loading:m,error:f}=zj(n),[h,b]=u.useState([]),[g,p]=u.useState(),[w,v]=u.useState(null),[y,k]=u.useState(!1),[z,N]=u.useState({label:"",type:"agent"});u.useEffect(()=>{c!=null&&c.nodes&&(b(c.nodes),p(c.entryNodeId))},[c]);const S=u.useMemo(()=>Aj(h,g),[h,g]),C=Math.max(800,...Array.from(S.values()).map(B=>B.x+200)),O=Math.max(400,...Array.from(S.values()).map(B=>B.y+100)),M=u.useMemo(()=>{const B=[];for(const q of h){const I=S.get(q.id);if(I)for(const W of q.next){const X=S.get(W);X&&B.push({from:I,to:X,fromId:q.id,toId:W})}}return B},[h,S]),E=u.useCallback(()=>{if(!z.label.trim())return;const B=`node_${Date.now()}`;b(q=>[...q,{id:B,type:z.type,label:z.label,config:{},next:[]}]),h.length===0&&p(B),N({label:"",type:"agent"}),k(!1)},[z,h.length]),ae=u.useCallback(B=>{var q;b(I=>I.filter(X=>X.id!==B).map(X=>({...X,next:X.next.filter(le=>le!==B)}))),w===B&&v(null),g===B&&p((q=h.find(I=>I.id!==B))==null?void 0:q.id)},[w,g,h]),ce=h.find(B=>B.id===w);return m?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):f?t.jsxs("div",{className:"flex flex-col items-center justify-center py-20",children:[t.jsx("p",{className:"text-red-400",children:f}),t.jsxs("button",{onClick:()=>i("/workflows"),className:"btn-secondary mt-4",children:[t.jsx(Yn,{className:"h-4 w-4"})," Back to Workflows"]})]}):t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("button",{onClick:()=>i("/workflows"),className:"btn-ghost btn-sm",children:t.jsx(Yn,{className:"h-4 w-4"})}),t.jsx("h1",{className:"text-2xl font-semibold text-white",children:(c==null?void 0:c.name)??d("workflow.editor")})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{onClick:()=>k(!0),className:"btn-secondary btn-sm",children:[t.jsx(gt,{className:"h-3.5 w-3.5"})," ",d("workflow.addNode")]}),t.jsxs("button",{className:"btn-secondary btn-sm",children:[t.jsx(Fr,{className:"h-3.5 w-3.5"})," ",d("workflow.save")]}),t.jsxs("button",{className:"btn-primary btn-sm",children:[t.jsx(Ct,{className:"h-3.5 w-3.5"})," ",d("workflow.run")]})]})]}),t.jsxs("div",{className:"flex gap-4",children:[t.jsxs("div",{className:"card flex-1 overflow-auto p-0",style:{minHeight:"500px"},children:[t.jsxs("svg",{width:C,height:O,className:"w-full",children:[M.map((B,q)=>{const I=B.from.x+80,W=B.from.y+40,X=B.to.x+80,le=B.to.y,J=(W+le)/2;return t.jsx("path",{d:`M ${I} ${W} C ${I} ${J}, ${X} ${J}, ${X} ${le}`,fill:"none",stroke:"#2a2a35",strokeWidth:"2",markerEnd:"url(#arrowhead)"},q)}),t.jsx("defs",{children:t.jsx("marker",{id:"arrowhead",markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto",children:t.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:"#2a2a35"})})})]}),t.jsx("div",{className:"absolute inset-0",style:{width:C,height:O},children:h.map(B=>{const q=S.get(B.id);if(!q)return null;const I=B.id===g,W=B.id===w;return t.jsxs("div",{className:`absolute cursor-pointer rounded-lg border-2 px-4 py-2.5 text-sm transition-all ${Bh[B.type]} ${W?"ring-2 ring-indigo-500 ring-offset-2 ring-offset-[#0a0a0f]":""} ${I?"shadow-lg":""}`,style:{left:q.x,top:q.y,width:160},onClick:()=>v(B.id),children:[t.jsx("div",{className:"font-medium text-zinc-200 truncate",children:B.label}),t.jsx("div",{className:"text-xs text-zinc-500 mt-0.5",children:Rr[B.type]}),I&&t.jsx("div",{className:"absolute -top-2 -right-2 h-4 w-4 rounded-full bg-indigo-500 border-2 border-[#0a0a0f]"})]},B.id)})}),h.length===0&&t.jsx("div",{className:"flex items-center justify-center h-full text-zinc-500 text-sm",children:"Add nodes to build your workflow DAG"})]}),ce&&t.jsxs("div",{className:"w-72 card space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"font-medium text-zinc-200",children:"Node Properties"}),t.jsx("button",{onClick:()=>v(null),className:"btn-ghost btn-sm",children:t.jsx(tt,{className:"h-3.5 w-3.5"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Label"}),t.jsx("input",{className:"input",value:ce.label,onChange:B=>b(q=>q.map(I=>I.id===ce.id?{...I,label:B.target.value}:I))})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:d("common.type")}),t.jsx("select",{className:"input",value:ce.type,onChange:B=>b(q=>q.map(I=>I.id===ce.id?{...I,type:B.target.value}:I)),children:Object.entries(Rr).map(([B,q])=>t.jsx("option",{value:B,children:q},B))})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Agent ID"}),t.jsx("input",{className:"input",value:ce.agentId??"",onChange:B=>b(q=>q.map(I=>I.id===ce.id?{...I,agentId:B.target.value||void 0}:I)),placeholder:"Optional agent ID"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Connect to"}),t.jsxs("select",{className:"input",value:"",onChange:B=>{B.target.value&&b(q=>q.map(I=>I.id===ce.id&&!I.next.includes(B.target.value)?{...I,next:[...I.next,B.target.value]}:I))},children:[t.jsx("option",{value:"",children:"Select a node..."}),h.filter(B=>B.id!==ce.id&&!ce.next.includes(B.id)).map(B=>t.jsx("option",{value:B.id,children:B.label},B.id))]}),ce.next.length>0&&t.jsx("div",{className:"mt-2 space-y-1",children:ce.next.map(B=>{const q=h.find(I=>I.id===B);return t.jsxs("div",{className:"flex items-center justify-between rounded bg-[#0a0a0f] px-2 py-1 text-xs",children:[t.jsx("span",{className:"text-zinc-400",children:(q==null?void 0:q.label)??B}),t.jsx("button",{onClick:()=>b(I=>I.map(W=>W.id===ce.id?{...W,next:W.next.filter(X=>X!==B)}:W)),className:"text-zinc-500 hover:text-red-400",children:t.jsx(tt,{className:"h-3 w-3"})})]},B)})})]}),t.jsxs("button",{onClick:()=>ae(ce.id),className:"btn-danger w-full",children:[t.jsx(qt,{className:"h-3.5 w-3.5"}),"Delete Node"]})]})]}),y&&t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:t.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-surface p-6 shadow-2xl",children:[t.jsxs("div",{className:"flex items-center justify-between mb-5",children:[t.jsx("h2",{className:"text-lg font-semibold text-white",children:d("workflow.addNode")}),t.jsx("button",{onClick:()=>k(!1),className:"btn-ghost btn-sm",children:t.jsx(tt,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Label"}),t.jsx("input",{className:"input",value:z.label,onChange:B=>N({...z,label:B.target.value}),placeholder:"Node label"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:d("common.type")}),t.jsx("div",{className:"grid grid-cols-3 gap-2",children:Object.keys(Rr).map(B=>t.jsx("button",{onClick:()=>N({...z,type:B}),className:`rounded-lg border-2 p-2.5 text-center text-xs font-medium transition-colors ${z.type===B?Bh[B]:"border-border text-zinc-400 hover:border-zinc-600"}`,children:Rr[B]},B))})]})]}),t.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[t.jsx("button",{onClick:()=>k(!1),className:"btn-secondary",children:d("common.cancel")}),t.jsx("button",{onClick:E,disabled:!z.label.trim(),className:"btn-primary",children:d("workflow.addNode")})]})]})})]})}function Tj(){const[n,i]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(null),h=u.useCallback(async()=>{c(!0),f(null);try{const b=await Hr.list({limit:200});i(b.data)}catch(b){f(b instanceof Error?b.message:"Failed to fetch skills")}finally{c(!1)}},[]);return u.useEffect(()=>{h()},[h]),{skills:n,loading:d,error:m,refetch:h}}function Rj({skill:n,onDelete:i}){return t.jsxs("div",{className:"card group hover:border-indigo-500/30 transition-colors",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-violet-500/10 text-violet-400",children:t.jsx(Jr,{className:"h-5 w-5"})}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-zinc-200",children:n.name}),t.jsxs("p",{className:"text-xs text-zinc-500",children:["v",n.version," by ",n.author]})]})]}),t.jsx(ou,{level:n.trustLevel})]}),n.description&&t.jsx("p",{className:"mt-3 text-sm text-zinc-400 line-clamp-2",children:n.description}),t.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[n.tags.slice(0,3).map(d=>t.jsx("span",{className:"rounded-md bg-zinc-800 px-2 py-0.5 text-xs text-zinc-400",children:d},d)),n.tags.length>3&&t.jsxs("span",{className:"text-xs text-zinc-500",children:["+",n.tags.length-3]})]}),i&&t.jsx("button",{onClick:d=>{d.preventDefault(),i(n.id)},className:"btn-ghost btn-sm text-zinc-500 hover:text-red-400 opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(qt,{className:"h-3.5 w-3.5"})})]})]})}function Mj(){const{t:n}=nt(),{skills:i,loading:d,error:c,refetch:m}=Tj(),[f,h]=u.useState(!1),[b,g]=u.useState(!1),[p,w]=u.useState(""),[v,y]=u.useState({source:"",type:"local",name:"",trustLevel:"community"}),[k,z]=u.useState(null),N=async()=>{if(v.source.trim()){g(!0);try{await Hr.install({source:v.source,type:v.type,name:v.name||void 0,trustLevel:v.trustLevel}),h(!1),y({source:"",type:"local",name:"",trustLevel:"community"}),m()}catch(M){console.error("Failed to install skill:",M)}finally{g(!1)}}},S=async M=>{if(window.confirm("Remove this skill?"))try{await Hr.delete(M),m()}catch(E){console.error("Failed to delete skill:",E)}},C=async()=>{if(v.source.trim())try{const M=await Hr.scan(v.source);z(M)}catch(M){console.error("Scan failed:",M)}},O=i.filter(M=>!p||M.name.toLowerCase().includes(p.toLowerCase())||M.description.toLowerCase().includes(p.toLowerCase())||M.tags.some(E=>E.toLowerCase().includes(p.toLowerCase())));return d?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:n("skills.title")}),t.jsxs("button",{onClick:()=>h(!0),className:"btn-primary",children:[t.jsx(gt,{className:"h-4 w-4"}),n("skills.install")]})]}),i.length>0&&t.jsxs("div",{className:"relative max-w-md",children:[t.jsx(Rs,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),t.jsx("input",{type:"text",className:"input pl-9",placeholder:n("common.search"),value:p,onChange:M=>w(M.target.value)})]}),c&&t.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-4 text-sm text-red-400",children:[c,t.jsx("button",{onClick:m,className:"ml-3 underline",children:"Retry"})]}),i.length===0&&!c?t.jsx(tn,{icon:t.jsx(Jr,{className:"h-8 w-8"}),title:n("skills.empty"),description:n("skills.emptyDesc"),action:t.jsxs("button",{onClick:()=>h(!0),className:"btn-primary",children:[t.jsx(gt,{className:"h-4 w-4"}),n("skills.install")]})}):O.length===0?t.jsx("div",{className:"py-8 text-center text-sm text-zinc-500",children:n("common.noResults")}):t.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:O.map(M=>t.jsx(Rj,{skill:M,onDelete:S},M.id))}),f&&t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:t.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border bg-surface p-6 shadow-2xl",children:[t.jsxs("div",{className:"flex items-center justify-between mb-5",children:[t.jsx("h2",{className:"text-lg font-semibold text-white",children:n("skills.install")}),t.jsx("button",{onClick:()=>{h(!1),z(null)},className:"btn-ghost btn-sm",children:t.jsx(tt,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:n("skills.source")}),t.jsx("input",{className:"input",value:v.source,onChange:M=>y({...v,source:M.target.value}),placeholder:"/path/to/skill or https://..."})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:n("common.type")}),t.jsxs("select",{className:"input",value:v.type,onChange:M=>y({...v,type:M.target.value}),children:[t.jsx("option",{value:"local",children:"Local"}),t.jsx("option",{value:"npm",children:"NPM"}),t.jsx("option",{value:"git",children:"Git"}),t.jsx("option",{value:"url",children:"URL"})]})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"label",children:[n("common.name")," (optional)"]}),t.jsx("input",{className:"input",value:v.name,onChange:M=>y({...v,name:M.target.value}),placeholder:"my-skill"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Trust Level"}),t.jsxs("select",{className:"input",value:v.trustLevel,onChange:M=>y({...v,trustLevel:M.target.value}),children:[t.jsx("option",{value:"builtin",children:"Built-in"}),t.jsx("option",{value:"official",children:"Official"}),t.jsx("option",{value:"trusted",children:"Trusted"}),t.jsx("option",{value:"community",children:"Community"}),t.jsx("option",{value:"local",children:"Local"})]})]}),k&&t.jsxs("div",{className:"rounded-lg bg-[#0a0a0f] p-4",children:[t.jsx("h4",{className:"text-sm font-medium text-zinc-300 mb-2",children:"Scan Results"}),t.jsx("pre",{className:"text-xs text-zinc-400 overflow-auto max-h-40",children:JSON.stringify(k,null,2)})]})]}),t.jsxs("div",{className:"mt-6 flex justify-between",children:[t.jsxs("button",{onClick:C,disabled:!v.source.trim(),className:"btn-secondary",children:[t.jsx(dv,{className:"h-4 w-4"}),n("skills.scan")]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsx("button",{onClick:()=>{h(!1),z(null)},className:"btn-secondary",children:n("common.cancel")}),t.jsx("button",{onClick:N,disabled:!v.source.trim()||b,className:"btn-primary",children:n(b?"common.loading":"skills.install")})]})]})]})})]})}function Dj(){const{t:n}=nt(),[i,d]=u.useState([]),[c,m]=u.useState(!0),[f,h]=u.useState(null),[b,g]=u.useState("all"),p=u.useCallback(async()=>{m(!0),h(null);try{const y={limit:100};b!=="all"&&(y.status=b);const k=await Ws.list(y);d(k.data)}catch(y){h(y instanceof Error?y.message:"Failed to fetch runs"),d([])}finally{m(!1)}},[b]);u.useEffect(()=>{p()},[p]);const w=async y=>{try{await Ws.abort(y),p()}catch(k){console.error("Abort failed:",k)}},v=async y=>{if(window.confirm("Delete this run record?"))try{await Ws.delete(y),d(k=>k.filter(z=>z.id!==y))}catch(k){console.error("Delete failed:",k)}};return c?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:n("runs.title")}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("button",{onClick:p,className:"btn-ghost btn-sm",children:t.jsx(Mt,{className:"h-4 w-4"})}),t.jsx(j0,{className:"h-4 w-4 text-zinc-500"}),t.jsxs("select",{className:"input w-auto",value:b,onChange:y=>g(y.target.value),children:[t.jsx("option",{value:"all",children:"All Status"}),t.jsx("option",{value:"running",children:n("status.running")}),t.jsx("option",{value:"completed",children:n("status.completed")}),t.jsx("option",{value:"failed",children:n("status.failed")}),t.jsx("option",{value:"pending",children:n("status.pending")}),t.jsx("option",{value:"paused",children:n("status.paused")}),t.jsx("option",{value:"cancelled",children:n("status.cancelled")})]})]})]}),f&&t.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-4 text-sm text-red-400",children:[f,t.jsx("button",{onClick:p,className:"ml-3 underline",children:n("common.retry")})]}),i.length===0&&!f?t.jsx(tn,{icon:t.jsx(Ct,{className:"h-8 w-8"}),title:n("runs.empty"),description:n("runs.emptyDesc")}):i.length>0?t.jsx("div",{className:"card overflow-hidden p-0",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border bg-surface",children:[t.jsx("th",{className:"px-5 py-3 text-left text-zinc-400 font-medium",children:"Run ID"}),t.jsx("th",{className:"px-5 py-3 text-left text-zinc-400 font-medium",children:"Workflow"}),t.jsx("th",{className:"px-5 py-3 text-left text-zinc-400 font-medium",children:n("common.status")}),t.jsx("th",{className:"px-5 py-3 text-left text-zinc-400 font-medium",children:"Started"}),t.jsx("th",{className:"px-5 py-3 text-left text-zinc-400 font-medium",children:n("run.duration")}),t.jsx("th",{className:"px-5 py-3 text-left text-zinc-400 font-medium",children:n("common.actions")})]})}),t.jsx("tbody",{children:i.map(y=>{var z;const k=y.completedAt&&y.startedAt?Math.round((new Date(y.completedAt).getTime()-new Date(y.startedAt).getTime())/1e3):null;return t.jsxs("tr",{className:"border-b border-border hover:bg-surface-hover transition-colors",children:[t.jsx("td",{className:"px-5 py-3",children:t.jsxs(Xa,{to:`/runs/${y.id}`,className:"text-indigo-400 hover:text-indigo-300 font-mono text-xs",children:[y.id.slice(0,8),"..."]})}),t.jsxs("td",{className:"px-5 py-3 text-zinc-300 font-mono text-xs",children:[((z=y.workflowId)==null?void 0:z.slice(0,8))??"—","..."]}),t.jsx("td",{className:"px-5 py-3",children:t.jsx(oi,{status:y.status,pulse:!0})}),t.jsx("td",{className:"px-5 py-3 text-zinc-400 text-xs",children:new Date(y.startedAt).toLocaleString()}),t.jsx("td",{className:"px-5 py-3 text-zinc-400 text-xs",children:k!==null?`${k}s`:"—"}),t.jsx("td",{className:"px-5 py-3",children:t.jsxs("div",{className:"flex gap-1",children:[(y.status==="running"||y.status==="pending")&&t.jsx("button",{onClick:()=>w(y.id),className:"btn-ghost btn-sm text-amber-400",title:"Abort run",children:t.jsx(y0,{className:"h-3.5 w-3.5"})}),(y.status==="completed"||y.status==="failed"||y.status==="cancelled")&&t.jsx("button",{onClick:()=>v(y.id),className:"btn-ghost btn-sm text-zinc-400 hover:text-red-400",title:"Delete run",children:t.jsx(qt,{className:"h-3.5 w-3.5"})})]})})]},y.id)})})]})})}):null]})}const T0="/api";async function Oj(n){const i=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};i&&(d.Authorization=`Bearer ${i}`);const c=localStorage.getItem("nestor_tenant_id");c&&(d["X-Tenant-ID"]=c);const m=await fetch(`${T0}/runs/${n}/feedback`,{headers:d});return m.ok?(await m.json()).data??[]:[]}async function $h(n,i,d,c){const m=localStorage.getItem("nestor_token"),f={"Content-Type":"application/json"};m&&(f.Authorization=`Bearer ${m}`);const h=localStorage.getItem("nestor_tenant_id");h&&(f["X-Tenant-ID"]=h),await fetch(`${T0}/runs/${n}/feedback`,{method:"POST",headers:f,body:JSON.stringify({rating:i,comment:d||void 0,agentId:c})})}function Lj({runId:n,agentId:i}){const[d,c]=u.useState([]),[m,f]=u.useState(!1),[h,b]=u.useState(null),[g,p]=u.useState(""),[w,v]=u.useState(!1),y=u.useCallback(async()=>{const N=await Oj(n);c(N),N.length>0&&(f(!0),b(N[0].rating))},[n]);u.useEffect(()=>{y()},[y]);const k=async N=>{m||(b(N),N===1?(await $h(n,N,void 0,i),f(!0),y()):v(!0))},z=async()=>{h!==null&&(await $h(n,h,g||void 0,i),f(!0),v(!1),y())};return t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"text-sm font-medium text-zinc-400",children:"Was this helpful?"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:()=>k(1),disabled:m,className:`rounded-lg p-2 transition-colors ${h===1?"bg-green-500/20 text-green-400":m?"text-zinc-600 cursor-not-allowed":"text-zinc-400 hover:bg-green-500/10 hover:text-green-400"}`,title:"Helpful",children:t.jsx(ni,{className:"h-5 w-5"})}),t.jsx("button",{onClick:()=>k(-1),disabled:m,className:`rounded-lg p-2 transition-colors ${h===-1?"bg-red-500/20 text-red-400":m?"text-zinc-600 cursor-not-allowed":"text-zinc-400 hover:bg-red-500/10 hover:text-red-400"}`,title:"Not helpful",children:t.jsx(Bd,{className:"h-5 w-5"})})]})]}),w&&!m&&t.jsxs("div",{className:"mt-3 flex gap-2",children:[t.jsx("input",{type:"text",value:g,onChange:N=>p(N.target.value),placeholder:"What could be improved? (optional)",className:"flex-1 rounded-lg bg-zinc-800 px-3 py-2 text-sm text-zinc-200 placeholder-zinc-500 border border-zinc-700 focus:border-indigo-500 focus:outline-none",onKeyDown:N=>{N.key==="Enter"&&z()}}),t.jsx("button",{onClick:z,className:"rounded-lg bg-indigo-600 px-3 py-2 text-sm text-white hover:bg-indigo-500 transition-colors",children:t.jsx(au,{className:"h-4 w-4"})})]}),m&&t.jsxs("p",{className:"mt-2 text-xs text-zinc-500",children:[h===1?"Thanks for the positive feedback!":"Thanks for your feedback.",d.length>0&&d[0].comment&&t.jsxs("span",{className:"text-zinc-600",children:[" — “",d[0].comment,"”"]})]})]})}const _j={llm_request:{icon:Es,color:"text-purple-400",bgColor:"bg-purple-500/10",label:"LLM Request"},llm_response:{icon:Ts,color:"text-blue-400",bgColor:"bg-blue-500/10",label:"LLM Response"},tool_call_requested:{icon:Wn,color:"text-amber-400",bgColor:"bg-amber-500/10",label:"Tool Call"},tool_call_completed:{icon:pt,color:"text-emerald-400",bgColor:"bg-emerald-500/10",label:"Tool Result"},tool_call_denied:{icon:At,color:"text-red-400",bgColor:"bg-red-500/10",label:"Tool Denied"},node_started:{icon:Ct,color:"text-blue-400",bgColor:"bg-blue-500/10",label:"Step Started"},node_completed:{icon:pt,color:"text-green-400",bgColor:"bg-green-500/10",label:"Step Completed"},node_failed:{icon:At,color:"text-red-400",bgColor:"bg-red-500/10",label:"Step Failed"},thinking:{icon:_d,color:"text-yellow-400",bgColor:"bg-yellow-500/10",label:"Thinking"},reasoning:{icon:_d,color:"text-yellow-400",bgColor:"bg-yellow-500/10",label:"Reasoning"},approval_requested:{icon:za,color:"text-amber-400",bgColor:"bg-amber-500/10",label:"Approval Requested"},budget_warning:{icon:mt,color:"text-amber-400",bgColor:"bg-amber-500/10",label:"Budget Warning"},budget_exceeded:{icon:Ca,color:"text-red-400",bgColor:"bg-red-500/10",label:"Budget Exceeded"},error:{icon:mt,color:"text-red-400",bgColor:"bg-red-500/10",label:"Error"}},Uj={icon:Ct,color:"text-zinc-400",bgColor:"bg-zinc-500/10",label:"Event"};function Bj(n){try{return new Date(n).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3})}catch{return n}}function Hh(n,i){try{return new Date(i).getTime()-new Date(n).getTime()}catch{return 0}}function $j(n){return n<1e3?`${n}ms`:n<6e4?`${(n/1e3).toFixed(1)}s`:`${Math.floor(n/6e4)}m ${Math.floor(n%6e4/1e3)}s`}function Hj(n){const i=n.data;if(!i)return"";if(typeof i.reasoning=="string")return i.reasoning;if(typeof i.content=="string")return i.content;if(typeof i.text=="string")return i.text;if(typeof i.output=="string")return i.output;if(typeof i.prompt=="string")return i.prompt;if(typeof i.error=="string")return i.error;if(typeof i.tool=="string"){const c=i.args?` (${JSON.stringify(i.args).slice(0,120)})`:"";return`${i.tool}${c}`}const d=JSON.stringify(i,null,2);return d.length>300?d.slice(0,300)+"...":d}function qj(n,i){let d=0;for(let c=0;c<=i&&c<n.length;c++){const m=n[c].data;typeof m.estimatedCostUsd=="number"?d=m.estimatedCostUsd:typeof m.cost=="number"&&(d+=m.cost)}return d}function Gj({runId:n}){const[i,d]=u.useState([]),[c,m]=u.useState(!0),[f,h]=u.useState(null),[b,g]=u.useState(-1),[p,w]=u.useState(!1),[v,y]=u.useState(1),k=u.useRef(null),z=u.useRef(null),N=u.useRef(new Map);u.useEffect(()=>{let W=!1;return m(!0),h(null),Ws.getEvents(n).then(X=>{W||d(X.data.sort((le,J)=>new Date(le.timestamp).getTime()-new Date(J.timestamp).getTime()))}).catch(X=>{W||h(X instanceof Error?X.message:"Failed to load events")}).finally(()=>{W||m(!1)}),()=>{W=!0}},[n]);const S=u.useCallback(()=>{w(!1),k.current&&(clearTimeout(k.current),k.current=null)},[]),C=u.useCallback(()=>{g(W=>{const X=W+1;if(X>=i.length)return S(),W;const le=i[W]??i[0],J=i[X];if(le&&J){const re=Hh(le.timestamp,J.timestamp),ge=Math.max(50,Math.min(re/v,2e3/v));k.current=setTimeout(C,ge)}return X})},[i,v,S]),O=u.useCallback(()=>{i.length!==0&&(w(!0),g(W=>{const X=W>=i.length-1?0:W,le=300/v;return k.current=setTimeout(C,le),X}))},[i,v,C]),M=u.useCallback(()=>{p?S():O()},[p,S,O]),E=u.useCallback(()=>{S(),g(W=>Math.min(W+1,i.length-1))},[i.length,S]),ae=u.useCallback(()=>{S(),g(W=>Math.max(W-1,0))},[S]),ce=u.useCallback(W=>{S(),g(W)},[S]),B=u.useCallback(()=>{y(W=>{const X=[1,2,4,8],le=X.indexOf(W);return X[(le+1)%X.length]})},[]);if(u.useEffect(()=>{if(b>=0){const W=N.current.get(b);W==null||W.scrollIntoView({behavior:"smooth",block:"nearest"})}},[b]),u.useEffect(()=>()=>{k.current&&clearTimeout(k.current)},[]),c)return t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"}),t.jsx("span",{className:"ml-3 text-sm text-zinc-400",children:"Loading events..."})]});if(f)return t.jsx("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-4",children:t.jsx("p",{className:"text-sm text-red-400",children:f})});if(i.length===0)return t.jsx("div",{className:"rounded-lg border border-zinc-700 bg-zinc-800/50 p-6 text-center",children:t.jsx("p",{className:"text-sm text-zinc-500",children:"No events recorded for this run."})});const q=i.length>0?(b+1)/i.length*100:0,I=b>=0?qj(i,b):0;return t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-zinc-700 bg-zinc-800/80 px-4 py-3",children:[t.jsx("button",{onClick:ae,disabled:b<=0,className:"rounded p-1.5 text-zinc-400 transition-colors hover:bg-zinc-700 hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",title:"Step backward",children:t.jsx(Nv,{className:"h-4 w-4"})}),t.jsx("button",{onClick:M,className:"flex h-9 w-9 items-center justify-center rounded-full bg-indigo-600 text-white transition-colors hover:bg-indigo-500",title:p?"Pause":"Play",children:p?t.jsx(Zr,{className:"h-4 w-4"}):t.jsx(Ct,{className:"h-4 w-4 ml-0.5"})}),t.jsx("button",{onClick:E,disabled:b>=i.length-1,className:"rounded p-1.5 text-zinc-400 transition-colors hover:bg-zinc-700 hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",title:"Step forward",children:t.jsx(wv,{className:"h-4 w-4"})}),t.jsxs("button",{onClick:B,className:"rounded border border-zinc-600 px-2 py-1 text-xs font-mono text-zinc-300 transition-colors hover:bg-zinc-700",title:"Cycle playback speed",children:[v,"x"]}),t.jsx("div",{className:"flex-1 mx-2",children:t.jsxs("div",{className:"relative h-2 rounded-full bg-zinc-700 cursor-pointer",onClick:W=>{const X=W.currentTarget.getBoundingClientRect(),le=(W.clientX-X.left)/X.width,J=Math.round(le*(i.length-1));ce(Math.max(0,Math.min(J,i.length-1)))},children:[t.jsx("div",{className:"absolute top-0 left-0 h-full rounded-full bg-indigo-500 transition-all duration-150",style:{width:`${q}%`}}),t.jsx("div",{className:"absolute top-1/2 -translate-y-1/2 h-3.5 w-3.5 rounded-full border-2 border-indigo-400 bg-zinc-900 transition-all duration-150",style:{left:`calc(${q}% - 7px)`}})]})}),t.jsxs("span",{className:"text-xs font-mono text-zinc-500 whitespace-nowrap",children:[b+1," / ",i.length]}),I>0&&t.jsxs("span",{className:"flex items-center gap-1 text-xs font-mono text-amber-400 whitespace-nowrap",children:[t.jsx(Ca,{className:"h-3 w-3"}),I.toFixed(4)]})]}),t.jsx("div",{ref:z,className:"max-h-[600px] overflow-y-auto rounded-lg border border-zinc-700 bg-zinc-900/50",children:t.jsx("div",{className:"divide-y divide-zinc-800",children:i.map((W,X)=>{const le=_j[W.type]??Uj,J=le.icon,re=X===b,ge=b<0||X<=b,G=Hj(W),ee=X>0?Hh(i[X-1].timestamp,W.timestamp):0;return t.jsxs("div",{ref:xe=>{xe&&N.current.set(X,xe)},className:`
576
+ flex items-start gap-3 px-4 py-3 cursor-pointer transition-all duration-200
577
+ ${re?"bg-indigo-500/10 border-l-2 border-l-indigo-500":"border-l-2 border-l-transparent"}
578
+ ${ge?"opacity-100":"opacity-30"}
579
+ hover:bg-zinc-800/50
580
+ `,onClick:()=>ce(X),children:[t.jsx("span",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded text-[10px] font-mono text-zinc-600",children:X+1}),t.jsx("div",{className:`mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-lg ${le.bgColor}`,children:t.jsx(J,{className:`h-3.5 w-3.5 ${le.color}`})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:`text-xs font-medium ${le.color}`,children:le.label}),t.jsx("span",{className:"text-[10px] font-mono text-zinc-600",children:Bj(W.timestamp)}),ee>0&&t.jsxs("span",{className:"text-[10px] text-zinc-600",children:["+",$j(ee)]})]}),G&&ge&&t.jsx("pre",{className:`mt-1 text-xs whitespace-pre-wrap break-words ${re?"text-zinc-200":"text-zinc-500"} max-h-40 overflow-hidden`,children:G.length>500?G.slice(0,500)+"...":G})]}),re&&t.jsx(ca,{className:"mt-1.5 h-3.5 w-3.5 shrink-0 text-indigo-400"})]},W.id)})})})]})}function Kj(){const{id:n}=Fn(),i=Dt(),{t:d}=nt(),[c,m]=u.useState(null),[f,h]=u.useState([]),[b,g]=u.useState([]),[p,w]=u.useState([]),[v,y]=u.useState(!0),[k,z]=u.useState(null),[N,S]=u.useState(null),[C,O]=u.useState(""),[M,E]=u.useState("details"),ae=u.useCallback(async()=>{if(n)try{const J=await Ws.get(n);m(J.data)}catch(J){z(J instanceof Error?J.message:"Failed to load run")}},[n]),ce=u.useCallback(async()=>{if(n)try{const J=await Ws.getEvents(n);h(J.data)}catch{}},[n]),B=u.useCallback(async()=>{if(n)try{const J=await Ad.forRun(n);g(J.data)}catch{}},[n]),q=u.useCallback(async()=>{if(n)try{const J=await Kr.list();w(J.data.filter(re=>re.runId===n))}catch{}},[n]);u.useEffect(()=>{n&&(y(!0),z(null),Promise.all([ae(),ce(),B(),q()]).finally(()=>{y(!1)}))},[n,ae,ce,B,q]),u.useEffect(()=>{if(!c||c.status==="completed"||c.status==="failed"||c.status==="cancelled")return;const J=setInterval(()=>{ae(),ce()},3e3);return()=>clearInterval(J)},[c==null?void 0:c.status,ae,ce]);const I=async()=>{if(n)try{await Ws.abort(n),ae()}catch(J){console.error("Abort failed:",J)}};if(v)return t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})});if(k||!c)return t.jsxs("div",{className:"flex flex-col items-center justify-center py-20",children:[t.jsx("p",{className:"text-red-400",children:k??"Run not found"}),t.jsxs("button",{onClick:()=>i("/runs"),className:"btn-secondary mt-4",children:[t.jsx(Yn,{className:"h-4 w-4"})," Back to Runs"]})]});const W=c.completedAt&&c.startedAt?Math.round((new Date(c.completedAt).getTime()-new Date(c.startedAt).getTime())/1e3):null,X=c.status==="completed"?t.jsx(pt,{className:"h-5 w-5 text-green-400"}):c.status==="failed"?t.jsx(At,{className:"h-5 w-5 text-red-400"}):t.jsx(Ct,{className:"h-5 w-5 text-blue-400"}),le=c.status==="running"||c.status==="pending";return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("button",{onClick:()=>i("/runs"),className:"btn-ghost btn-sm",children:t.jsx(Yn,{className:"h-4 w-4"})}),t.jsxs("div",{className:"flex items-center gap-3",children:[X,t.jsxs("div",{children:[t.jsxs("h1",{className:"text-2xl font-semibold text-white",children:["Run ",t.jsxs("span",{className:"font-mono text-lg text-zinc-400",children:[c.id.slice(0,12),"..."]})]}),t.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[t.jsx(oi,{status:c.status,pulse:!0}),t.jsxs("span",{className:"text-xs text-zinc-500",children:["Started: ",new Date(c.startedAt).toLocaleString()]})]})]})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:()=>{ae(),ce()},className:"btn-ghost btn-sm",children:t.jsx(Mt,{className:"h-3.5 w-3.5"})}),le&&t.jsxs("button",{onClick:I,className:"btn-danger btn-sm",children:[t.jsx(y0,{className:"h-3.5 w-3.5"})," Abort"]})]})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[t.jsx("div",{className:"card",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-blue-500/10",children:t.jsx(zv,{className:"h-4 w-4 text-blue-400"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:d("run.duration")}),t.jsx("p",{className:"text-lg font-semibold text-white",children:W!==null?`${W}s`:"In progress..."})]})]})}),t.jsx("div",{className:"card",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-amber-500/10",children:t.jsx(Ca,{className:"h-4 w-4 text-amber-400"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:d("run.cost")}),t.jsx("p",{className:"text-lg font-semibold text-white",children:"$0.00"})]})]})}),t.jsx("div",{className:"card",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-violet-500/10",children:t.jsx(Xn,{className:"h-4 w-4 text-violet-400"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Events"}),t.jsx("p",{className:"text-lg font-semibold text-white",children:f.length})]})]})})]}),t.jsxs("div",{className:"flex items-center gap-1 border-b border-zinc-700",children:[t.jsx("button",{onClick:()=>E("details"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${M==="details"?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-500 hover:text-zinc-300"}`,children:"Details"}),t.jsxs("button",{onClick:()=>E("replay"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors flex items-center gap-1.5 ${M==="replay"?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-500 hover:text-zinc-300"}`,children:[t.jsx(Ct,{className:"h-3.5 w-3.5"}),"Replay"]})]}),M==="replay"&&t.jsx(Gj,{runId:n}),M==="details"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[t.jsx(Lj,{runId:n}),t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"mb-4 text-lg font-medium text-zinc-200",children:d("run.events")}),t.jsx(cu,{events:f,maxHeight:"500px"})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"mb-4 text-lg font-medium text-zinc-200",children:d("run.output")}),c.output?t.jsx("pre",{className:"overflow-auto rounded-lg bg-[#0a0a0f] p-4 text-sm text-zinc-300 max-h-64",children:JSON.stringify(c.output,null,2)}):t.jsx("p",{className:"text-sm text-zinc-500",children:"No output available yet."})]}),c.error&&t.jsxs("div",{className:"card border-red-500/20",children:[t.jsx("h2",{className:"mb-2 text-lg font-medium text-red-400",children:"Error"}),t.jsx("pre",{className:"overflow-auto rounded-lg bg-red-500/5 p-4 text-sm text-red-300",children:c.error})]}),t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"mb-4 text-lg font-medium text-zinc-200",children:"Input"}),t.jsx("pre",{className:"overflow-auto rounded-lg bg-[#0a0a0f] p-4 text-sm text-zinc-300 max-h-40",children:JSON.stringify(c.input,null,2)})]})]})]}),p.filter(J=>J.status==="pending").map(J=>t.jsxs("div",{className:"card border-amber-500/30 bg-amber-500/5",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.jsx(ti,{className:"h-5 w-5 text-amber-400"}),t.jsx("h2",{className:"text-lg font-semibold text-amber-300",children:"Handoff Pending"})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1",children:"Accomplished"}),t.jsx("p",{className:"text-zinc-300",children:J.accomplished})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1",children:"Blocking"}),t.jsx("p",{className:"text-red-400",children:J.blocking})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1",children:"Suggestions"}),t.jsx("p",{className:"text-zinc-300",children:J.suggestions})]})]}),t.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[t.jsx("input",{type:"text",className:"flex-1 rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-2 text-sm text-zinc-200 placeholder-zinc-500 focus:border-indigo-500 focus:outline-none",placeholder:"Describe how you resolved the blocking issue...",value:C,onChange:re=>O(re.target.value)}),t.jsx("button",{className:"btn-primary btn-sm",disabled:!C.trim(),onClick:async()=>{try{await Kr.resume(J.id,C),O(""),q()}catch(re){console.error("Resume failed:",re)}},children:"Resume"})]})]},J.id)),t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("h2",{className:"text-lg font-medium text-zinc-200",children:"Annotations"}),t.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>S(N?null:{type:"note",content:""}),children:N?"Cancel":"+ Add"})]}),N&&t.jsxs("div",{className:"mb-4 rounded-lg border border-zinc-700 p-3 space-y-2",children:[t.jsx("div",{className:"flex gap-2",children:["good","bad","wrong_approach","note"].map(J=>{const re={good:t.jsx(ni,{className:"h-3.5 w-3.5"}),bad:t.jsx(Bd,{className:"h-3.5 w-3.5"}),wrong_approach:t.jsx(Rh,{className:"h-3.5 w-3.5"}),note:t.jsx(Ts,{className:"h-3.5 w-3.5"})},ge={good:"text-green-400 border-green-500/30",bad:"text-red-400 border-red-500/30",wrong_approach:"text-amber-400 border-amber-500/30",note:"text-blue-400 border-blue-500/30"};return t.jsxs("button",{className:`flex items-center gap-1.5 rounded-md border px-2 py-1 text-xs ${N.type===J?ge[J]+" bg-zinc-800":"border-zinc-700 text-zinc-500 hover:text-zinc-300"}`,onClick:()=>S({...N,type:J}),children:[re[J]," ",J.replace("_"," ")]},J)})}),t.jsx("textarea",{className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-2 text-sm text-zinc-200 placeholder-zinc-500 focus:border-indigo-500 focus:outline-none",rows:2,placeholder:"Add your annotation...",value:N.content,onChange:J=>S({...N,content:J.target.value})}),t.jsx("button",{className:"btn-primary btn-sm",disabled:!N.content.trim(),onClick:async()=>{if(!(!n||!N.content.trim()))try{await Ad.create(n,{type:N.type,content:N.content}),S(null),B()}catch(J){console.error("Failed to add annotation:",J)}},children:"Save Annotation"})]}),b.length===0?t.jsx("p",{className:"text-sm text-zinc-500",children:"No annotations yet."}):t.jsx("div",{className:"space-y-2",children:b.map(J=>{const re={good:"border-green-500/30 bg-green-500/5",bad:"border-red-500/30 bg-red-500/5",wrong_approach:"border-amber-500/30 bg-amber-500/5",note:"border-blue-500/30 bg-blue-500/5",handoff:"border-purple-500/30 bg-purple-500/5"},ge={good:t.jsx(ni,{className:"h-3.5 w-3.5 text-green-400"}),bad:t.jsx(Bd,{className:"h-3.5 w-3.5 text-red-400"}),wrong_approach:t.jsx(Rh,{className:"h-3.5 w-3.5 text-amber-400"}),note:t.jsx(Ts,{className:"h-3.5 w-3.5 text-blue-400"}),handoff:t.jsx(ti,{className:"h-3.5 w-3.5 text-purple-400"})};return t.jsxs("div",{className:`flex items-start gap-2 rounded-lg border p-2 text-sm ${re[J.type]??"border-zinc-700"}`,children:[t.jsx("span",{className:"mt-0.5",children:ge[J.type]}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-zinc-300",children:J.content}),t.jsxs("p",{className:"text-xs text-zinc-500 mt-1",children:[J.author," · ",new Date(J.createdAt).toLocaleString(),J.eventIndex!=null&&` &middot; Event #${J.eventIndex}`]})]}),t.jsx("button",{className:"text-zinc-600 hover:text-red-400 transition-colors",title:"Delete annotation",onClick:async()=>{try{await Ad.delete(J.id),B()}catch(G){console.error("Delete failed:",G)}},children:t.jsx(At,{className:"h-3.5 w-3.5"})})]},J.id)})})]})]})]})}function Vj(){const{t:n}=nt(),[i,d]=u.useState("general"),[c,m]=u.useState(null),[f,h]=u.useState(!0),[b,g]=u.useState(!1),[p,w]=u.useState(!1),[v,y]=u.useState(null);u.useEffect(()=>{Sa.getConfig().then(C=>m(C.data)).catch(()=>{m({server:{host:"127.0.0.1",port:3100},security:{defaultTrustLevel:"community",approvalMode:"manual",maxConcurrentRuns:10},budget:{enabled:!1,defaultMaxCostPerRunUsd:1,defaultMaxTokensPerRun:1e5,warningThresholdPercent:80},logging:{level:"info",format:"pretty"}})}).finally(()=>h(!1))},[]);const k=async()=>{if(c){g(!0),w(!1),y(null);try{const C=await Sa.updateConfig(c);m(C.data),w(!0),setTimeout(()=>w(!1),3e3)}catch(C){y(C instanceof Error?C.message:"Failed to save")}finally{g(!1)}}},z=async()=>{h(!0);try{const C=await Sa.getConfig();m(C.data),y(null)}catch{y("Failed to refresh config")}finally{h(!1)}},N=(C,O,M)=>{c&&m({...c,[C]:{...c[C],[O]:M}})},S=[{key:"general",label:n("settings.general")},{key:"security",label:n("settings.security")},{key:"budget",label:n("settings.budget")},{key:"apikeys",label:"API Keys"},{key:"studio",label:"Studio"}];return f?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):c?t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:n("settings.title")}),t.jsxs("div",{className:"flex items-center gap-3",children:[p&&t.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-green-400",children:[t.jsx(ut,{className:"h-4 w-4"}),n("settings.saved")]}),v&&t.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-red-400",children:[t.jsx(ei,{className:"h-4 w-4"}),v]}),t.jsx("button",{onClick:z,className:"btn-ghost btn-sm",children:t.jsx(Mt,{className:"h-4 w-4"})}),t.jsxs("button",{onClick:k,disabled:b,className:"btn-primary",children:[t.jsx(Fr,{className:"h-4 w-4"}),n(b?"common.loading":"settings.save")]})]})]}),t.jsx("div",{className:"flex gap-1 border-b border-border",children:S.map(({key:C,label:O})=>t.jsx("button",{onClick:()=>d(C),className:`px-4 py-2.5 text-sm font-medium transition-colors border-b-2 ${i===C?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-400 hover:text-zinc-200"}`,children:O},C))}),i==="general"&&t.jsxs("div",{className:"card space-y-6",children:[t.jsx("h2",{className:"text-lg font-medium text-zinc-200",children:"Server Configuration"}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Host"}),t.jsx("input",{className:"input",value:c.server.host,onChange:C=>N("server","host",C.target.value)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Port"}),t.jsx("input",{className:"input",type:"number",value:c.server.port,onChange:C=>N("server","port",parseInt(C.target.value)||3100)})]})]}),t.jsx("h2",{className:"text-lg font-medium text-zinc-200 pt-4",children:"Logging"}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Level"}),t.jsxs("select",{className:"input",value:c.logging.level,onChange:C=>N("logging","level",C.target.value),children:[t.jsx("option",{value:"debug",children:"Debug"}),t.jsx("option",{value:"info",children:"Info"}),t.jsx("option",{value:"warn",children:"Warn"}),t.jsx("option",{value:"error",children:"Error"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Format"}),t.jsxs("select",{className:"input",value:c.logging.format,onChange:C=>N("logging","format",C.target.value),children:[t.jsx("option",{value:"json",children:"JSON"}),t.jsx("option",{value:"pretty",children:"Pretty"})]})]})]})]}),i==="security"&&t.jsxs("div",{className:"card space-y-6",children:[t.jsx("h2",{className:"text-lg font-medium text-zinc-200",children:"Security Settings"}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Default Trust Level"}),t.jsxs("select",{className:"input",value:c.security.defaultTrustLevel,onChange:C=>N("security","defaultTrustLevel",C.target.value),children:[t.jsx("option",{value:"builtin",children:"Built-in"}),t.jsx("option",{value:"official",children:"Official"}),t.jsx("option",{value:"trusted",children:"Trusted"}),t.jsx("option",{value:"community",children:"Community"}),t.jsx("option",{value:"local",children:"Local"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Approval Mode"}),t.jsxs("select",{className:"input",value:c.security.approvalMode,onChange:C=>N("security","approvalMode",C.target.value),children:[t.jsx("option",{value:"manual",children:"Manual"}),t.jsx("option",{value:"smart",children:"Smart"}),t.jsx("option",{value:"off",children:"Off"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Max Concurrent Runs"}),t.jsx("input",{className:"input",type:"number",value:c.security.maxConcurrentRuns,onChange:C=>N("security","maxConcurrentRuns",parseInt(C.target.value)||10)})]})]})]}),i==="budget"&&t.jsxs("div",{className:"card space-y-6",children:[t.jsx("h2",{className:"text-lg font-medium text-zinc-200",children:"Budget Configuration"}),t.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[t.jsxs("label",{className:"relative inline-flex cursor-pointer items-center",children:[t.jsx("input",{type:"checkbox",checked:c.budget.enabled,onChange:C=>N("budget","enabled",C.target.checked),className:"peer sr-only"}),t.jsx("div",{className:"h-6 w-11 rounded-full bg-zinc-700 after:absolute after:left-[2px] after:top-0.5 after:h-5 after:w-5 after:rounded-full after:bg-white after:transition-all peer-checked:bg-indigo-600 peer-checked:after:translate-x-full"})]}),t.jsx("span",{className:"text-sm text-zinc-300",children:"Enable Budget Tracking"})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Default Max Cost Per Run (USD)"}),t.jsx("input",{className:"input",type:"number",step:"0.01",value:c.budget.defaultMaxCostPerRunUsd,onChange:C=>N("budget","defaultMaxCostPerRunUsd",parseFloat(C.target.value)||1)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Default Max Tokens Per Run"}),t.jsx("input",{className:"input",type:"number",value:c.budget.defaultMaxTokensPerRun,onChange:C=>N("budget","defaultMaxTokensPerRun",parseInt(C.target.value)||1e5)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Warning Threshold (%)"}),t.jsx("input",{className:"input",type:"number",min:0,max:100,value:c.budget.warningThresholdPercent,onChange:C=>N("budget","warningThresholdPercent",parseInt(C.target.value)||80)})]})]})]}),i==="apikeys"&&t.jsx(Yj,{}),i==="studio"&&t.jsxs("div",{className:"card space-y-6",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(bv,{className:"h-5 w-5 text-indigo-400"}),t.jsx("h2",{className:"text-lg font-medium text-zinc-200",children:"Studio Web UI"})]}),t.jsx("p",{className:"text-sm text-zinc-400",children:"The Studio web UI provides a browser-based dashboard for managing agents, workflows, and monitoring runs. You are currently viewing the Studio interface."}),t.jsxs("div",{className:"rounded-lg border border-border bg-zinc-900/50 p-4",children:[t.jsx("h3",{className:"text-sm font-medium text-zinc-200",children:"Current Configuration"}),t.jsx("pre",{className:"mt-2 text-xs text-zinc-400 overflow-auto max-h-40 rounded bg-[#0a0a0f] p-3",children:JSON.stringify(c,null,2)})]}),t.jsxs("div",{className:"text-xs text-zinc-500",children:["Changes are applied to the runtime config and take effect immediately. To persist changes across restarts, update the Nestor config file.",t.jsx("code",{className:"ml-1 rounded bg-zinc-800 px-1.5 py-0.5 text-zinc-300",children:"npx nestor-sh config edit"})]})]})]}):null}const qh=[{id:"gemini",name:"Gemini",provider:"Google",emoji:"🔵",color:"text-blue-400",defaultModel:"gemini-2.5-flash",keyUrl:"https://aistudio.google.com/apikey",keyUrlLabel:"aistudio.google.com",needsKey:!0},{id:"claude",name:"Claude",provider:"Anthropic",emoji:"🟣",color:"text-purple-400",defaultModel:"claude-sonnet-4-6",keyUrl:"https://console.anthropic.com/settings/keys",keyUrlLabel:"console.anthropic.com",needsKey:!0},{id:"openai",name:"GPT-4o",provider:"OpenAI",emoji:"🟢",color:"text-green-400",defaultModel:"gpt-4o",keyUrl:"https://platform.openai.com/api-keys",keyUrlLabel:"platform.openai.com",needsKey:!0},{id:"grok",name:"Grok",provider:"xAI",emoji:"⚪",color:"text-zinc-300",defaultModel:"grok-3",keyUrl:"https://console.x.ai/",keyUrlLabel:"console.x.ai",needsKey:!0},{id:"mistral",name:"Mistral",provider:"Mistral AI",emoji:"🟠",color:"text-orange-400",defaultModel:"mistral-large-latest",keyUrl:"https://console.mistral.ai/api-keys",keyUrlLabel:"console.mistral.ai",needsKey:!0},{id:"ollama",name:"Ollama",provider:"Local",emoji:"🦙",color:"text-amber-400",defaultModel:"llama3.1",keyUrl:"https://ollama.ai/download",keyUrlLabel:"ollama.ai",needsKey:!1}];function Yj(){const[n,i]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(null),[h,b]=u.useState(""),[g,p]=u.useState(!1),[w,v]=u.useState(null),[y,k]=u.useState(null),[z,N]=u.useState({}),S=u.useCallback(async()=>{try{const q=await ha.list();i(q.data)}catch{}finally{c(!1)}},[]);u.useEffect(()=>{S()},[S]);const C=q=>n.find(I=>I.provider===q),O=q=>{f(q),b(""),p(!1)},M=()=>{f(null),b(""),p(!1)},E=async q=>{if(h.trim()){v(q);try{await ha.set(q,h.trim()),f(null),b(""),await S()}catch{}finally{v(null)}}},ae=async q=>{k(q);try{const I=await ha.test(q);N(W=>({...W,[q]:I.data}))}catch(I){N(W=>({...W,[q]:{valid:!1,message:I instanceof Error?I.message:"Test failed"}}))}finally{k(null)}},ce=async q=>{try{await ha.remove(q),N(I=>{const W={...I};return delete W[q],W}),await S()}catch{}};if(d)return t.jsx("div",{className:"flex items-center justify-center py-16",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-purple-500 border-t-transparent"})});const B=n.filter(q=>q.configured).length;return t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"rounded-xl border border-border bg-surface/50 p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(Ms,{className:"h-5 w-5 text-purple-400 mt-0.5 flex-shrink-0"}),t.jsxs("div",{className:"text-xs text-zinc-400 space-y-1",children:[t.jsx("p",{children:"API keys are encrypted with AES-256-GCM and stored locally in the Nestor database. Keys set via environment variables take precedence over database-stored keys."}),t.jsxs("p",{className:"text-zinc-500",children:[B,"/",qh.length," providers configured."]})]})]})}),t.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:qh.map(q=>{const I=C(q.id),W=(I==null?void 0:I.configured)??!1,X=m===q.id,le=y===q.id,J=w===q.id,re=z[q.id];return t.jsxs("div",{className:`rounded-xl border bg-surface p-5 transition-all hover:shadow-lg hover:shadow-black/20 ${W?"border-border":"border-border/50"}`,children:[t.jsxs("div",{className:"flex items-start justify-between mb-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-2xl",children:q.emoji}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold text-white",children:q.name}),t.jsx("p",{className:"text-xs text-zinc-500",children:q.provider})]})]}),W?t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-green-500/10 px-2.5 py-0.5 text-xs font-medium text-green-400",children:[t.jsx(ut,{className:"h-3 w-3"}),"Configured"]}):t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-red-500/10 px-2.5 py-0.5 text-xs font-medium text-red-400",children:[t.jsx(tt,{className:"h-3 w-3"}),"Not set"]})]}),t.jsxs("p",{className:"text-xs text-zinc-500 mb-3",children:["Default model: ",t.jsx("code",{className:"text-zinc-400",children:q.defaultModel})]}),W&&(I==null?void 0:I.maskedKey)&&!X&&t.jsxs("div",{className:"mb-3 rounded-lg bg-background/50 px-3 py-2",children:[t.jsx("p",{className:"font-mono text-xs text-zinc-400",children:I.maskedKey}),I.source==="env"&&t.jsx("p",{className:"text-[10px] text-yellow-500/80 mt-0.5",children:"From environment variable"}),I.source==="db"&&I.label&&t.jsx("p",{className:"text-[10px] text-zinc-600 mt-0.5",children:I.label})]}),X&&t.jsxs("div",{className:"mb-3 space-y-2",children:[t.jsxs("div",{className:"relative",children:[t.jsx("input",{type:g?"text":"password",value:h,onChange:ge=>b(ge.target.value),placeholder:`Enter ${q.provider} API key`,className:"w-full rounded-lg border border-border bg-background px-3 py-2 pr-10 text-sm text-zinc-200 focus:border-purple-500 focus:outline-none placeholder:text-zinc-600",autoFocus:!0}),t.jsx("button",{type:"button",onClick:()=>p(!g),className:"absolute right-3 top-1/2 -translate-y-1/2 text-zinc-500 hover:text-zinc-300",children:g?t.jsx(Pd,{className:"h-3.5 w-3.5"}):t.jsx(Qr,{className:"h-3.5 w-3.5"})})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{onClick:()=>E(q.id),disabled:!h.trim()||J,className:"inline-flex items-center gap-1.5 rounded-lg bg-purple-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-purple-700 disabled:opacity-50 disabled:cursor-not-allowed",children:[J?t.jsx(ot,{className:"h-3 w-3 animate-spin"}):t.jsx(ut,{className:"h-3 w-3"}),"Save"]}),t.jsx("button",{onClick:M,className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-zinc-400 transition-colors hover:bg-surface-hover",children:"Cancel"})]})]}),re&&t.jsxs("div",{className:`mb-3 rounded-lg border p-2.5 text-xs ${re.valid?"border-green-500/20 bg-green-500/5 text-green-400":"border-red-500/20 bg-red-500/5 text-red-400"}`,children:[t.jsxs("div",{className:"flex items-center gap-1.5 font-medium",children:[re.valid?t.jsx(ut,{className:"h-3 w-3"}):t.jsx(ei,{className:"h-3 w-3"}),re.valid?"Working":"Failed"]}),t.jsx("p",{className:"mt-0.5 text-[10px] opacity-80",children:re.message}),re.models&&re.models.length>0&&t.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1",children:[re.models.slice(0,4).map(ge=>t.jsx("span",{className:"rounded bg-white/5 px-1.5 py-0.5 text-[9px] font-mono",children:ge},ge)),re.models.length>4&&t.jsxs("span",{className:"rounded bg-white/5 px-1.5 py-0.5 text-[9px]",children:["+",re.models.length-4]})]})]}),t.jsx("div",{className:"flex items-center gap-2",children:W&&!X?t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:()=>ae(q.id),disabled:le,className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-zinc-400 transition-colors hover:bg-surface-hover hover:text-zinc-200 disabled:opacity-50",children:[le?t.jsx(ot,{className:"h-3 w-3 animate-spin"}):t.jsx(si,{className:"h-3 w-3"}),"Test"]}),q.needsKey&&t.jsxs("button",{onClick:()=>O(q.id),className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-zinc-400 transition-colors hover:bg-surface-hover hover:text-zinc-200",children:[t.jsx(ri,{className:"h-3 w-3"}),"Edit"]}),(I==null?void 0:I.source)==="db"&&t.jsxs("button",{onClick:()=>ce(q.id),className:"inline-flex items-center gap-1.5 rounded-lg border border-red-500/20 px-3 py-1.5 text-xs font-medium text-red-400 transition-colors hover:bg-red-500/10",children:[t.jsx(qt,{className:"h-3 w-3"}),"Remove"]})]}):X?null:q.needsKey?t.jsxs("button",{onClick:()=>O(q.id),className:"inline-flex items-center gap-1.5 rounded-lg bg-purple-600 px-4 py-1.5 text-xs font-medium text-white transition-colors hover:bg-purple-700",children:[t.jsx(gt,{className:"h-3 w-3"}),"Add Key"]}):t.jsxs("button",{onClick:()=>ae(q.id),disabled:le,className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-zinc-400 transition-colors hover:bg-surface-hover hover:text-zinc-200 disabled:opacity-50",children:[le?t.jsx(ot,{className:"h-3 w-3 animate-spin"}):t.jsx(si,{className:"h-3 w-3"}),"Test Connection"]})}),t.jsx("div",{className:"mt-3 border-t border-border/50 pt-2.5",children:t.jsxs("a",{href:q.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[10px] text-zinc-600 hover:text-zinc-400 transition-colors",children:[t.jsx(Vn,{className:"h-2.5 w-2.5"}),"Get API Key at ",q.keyUrlLabel]})})]},q.id)})})]})}const Gh={low:{bg:"bg-green-500/10",text:"text-green-400",icon:nu},medium:{bg:"bg-amber-500/10",text:"text-amber-400",icon:mt},high:{bg:"bg-orange-500/10",text:"text-orange-400",icon:za},critical:{bg:"bg-red-500/10",text:"text-red-400",icon:av}},du={command:"Command",budget:"Budget",config:"Config",hire:"Hire",strategy:"Strategy",deploy:"Deploy",custom:"Custom"},Xj={pending:"bg-amber-500/10 text-amber-400",approved:"bg-green-500/10 text-green-400",rejected:"bg-red-500/10 text-red-400",expired:"bg-zinc-500/10 text-zinc-400"};function Kh({approval:n,onApprove:i,onReject:d,actionLoading:c,showActions:m}){const[f,h]=u.useState(""),b=Gh[n.riskLevel]??Gh.medium,g=b.icon,p=c===n.id;return t.jsx("div",{className:"card hover:border-amber-500/20 transition-colors",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:[t.jsx("div",{className:`flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-lg ${b.bg}`,children:t.jsx(g,{className:`h-5 w-5 ${b.text}`})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx("span",{className:"font-medium text-zinc-200",children:n.title}),t.jsx("span",{className:`badge ${b.bg} ${b.text} uppercase text-[10px]`,children:n.riskLevel}),t.jsx("span",{className:"badge bg-zinc-700/50 text-zinc-400 text-[10px]",children:du[n.type]??n.type}),n.status!=="pending"&&t.jsx("span",{className:`badge ${Xj[n.status]} uppercase text-[10px]`,children:n.status})]}),n.description&&t.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:n.description}),t.jsxs("p",{className:"mt-1 text-sm text-zinc-500",children:["Agent: ",t.jsx("span",{className:"text-zinc-300",children:n.agentId})]}),Object.keys(n.payload).length>0&&t.jsx("pre",{className:"mt-2 max-h-24 overflow-auto rounded-lg bg-[#0a0a0f] p-3 text-xs text-zinc-400",children:JSON.stringify(n.payload,null,2)}),t.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-zinc-500",children:[t.jsx("span",{children:new Date(n.createdAt).toLocaleString()}),n.reviewerId&&t.jsxs("span",{children:["Reviewed by: ",t.jsx("span",{className:"text-zinc-400",children:n.reviewerId})]}),n.reviewComment&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Ts,{className:"h-3 w-3"}),n.reviewComment]})]})]})]}),m&&n.status==="pending"&&t.jsxs("div",{className:"flex flex-col gap-2 flex-shrink-0",children:[t.jsx("input",{type:"text",placeholder:"Comment...",value:f,onChange:w=>h(w.target.value),className:"input text-xs w-40"}),t.jsxs("button",{onClick:()=>i==null?void 0:i(n.id,f),disabled:p,className:"btn-primary btn-sm",children:[t.jsx(ut,{className:"h-3.5 w-3.5"}),"Approve"]}),t.jsxs("button",{onClick:()=>d==null?void 0:d(n.id,f),disabled:p,className:"btn-danger btn-sm",children:[t.jsx(tt,{className:"h-3.5 w-3.5"}),"Reject"]})]})]})})}function Qj({stats:n}){const d=n.pending+n.approved+n.rejected+n.expired>0?Math.round(n.approved/(n.approved+n.rejected||1)*100):0;return t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[t.jsxs("div",{className:"card text-center",children:[t.jsx("p",{className:"text-2xl font-bold text-amber-400",children:n.pending}),t.jsx("p",{className:"text-xs text-zinc-500",children:"Pending"})]}),t.jsxs("div",{className:"card text-center",children:[t.jsx("p",{className:"text-2xl font-bold text-green-400",children:n.approved}),t.jsx("p",{className:"text-xs text-zinc-500",children:"Approved"})]}),t.jsxs("div",{className:"card text-center",children:[t.jsx("p",{className:"text-2xl font-bold text-red-400",children:n.rejected}),t.jsx("p",{className:"text-xs text-zinc-500",children:"Rejected"})]}),t.jsxs("div",{className:"card text-center",children:[t.jsx("p",{className:"text-2xl font-bold text-zinc-400",children:n.expired}),t.jsx("p",{className:"text-xs text-zinc-500",children:"Expired"})]})]}),t.jsxs("div",{className:"card",children:[t.jsx("h3",{className:"text-sm font-medium text-zinc-300 mb-3",children:"Approval Rate"}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex-1 h-2 rounded-full bg-zinc-800",children:t.jsx("div",{className:"h-full rounded-full bg-green-500",style:{width:`${d}%`}})}),t.jsxs("span",{className:"text-sm font-medium text-zinc-300",children:[d,"%"]})]})]}),Object.keys(n.byType).length>0&&t.jsxs("div",{className:"card",children:[t.jsx("h3",{className:"text-sm font-medium text-zinc-300 mb-3",children:"By Type"}),t.jsx("div",{className:"space-y-2",children:Object.entries(n.byType).map(([c,m])=>t.jsxs("div",{className:"flex items-center justify-between text-sm",children:[t.jsx("span",{className:"text-zinc-400",children:du[c]??c}),t.jsx("span",{className:"font-medium text-zinc-200",children:m})]},c))})]})]})}function Zj(){const{t:n}=nt(),[i,d]=u.useState("pending"),[c,m]=u.useState([]),[f,h]=u.useState([]),[b,g]=u.useState(null),[p,w]=u.useState(!0),[v,y]=u.useState(null),[k,z]=u.useState(null),[N,S]=u.useState(""),[C,O]=u.useState(""),M=u.useCallback(async()=>{try{y(null);const q={status:"pending"};N&&(q.type=N);let W=(await Fl.list(q)).data;C&&(W=W.filter(X=>X.riskLevel===C)),m(W)}catch(q){y(q instanceof Error?q.message:"Failed to fetch approvals"),m([])}finally{w(!1)}},[N,C]),E=u.useCallback(async()=>{try{const q=await Fl.history({limit:100});h(q.data)}catch{h([])}},[]),ae=u.useCallback(async()=>{try{const q=await Fl.stats();g(q.data)}catch{g(null)}},[]);u.useEffect(()=>{i==="pending"?M():i==="history"?E():i==="stats"&&ae()},[i,M,E,ae]),u.useEffect(()=>{if(i==="pending"){const q=setInterval(M,5e3);return()=>clearInterval(q)}},[i,M]);const ce=async(q,I)=>{z(q);try{await Fl.approve(q,{comment:I||void 0}),m(W=>W.filter(X=>X.id!==q))}catch(W){console.error("Approve failed:",W)}finally{z(null)}},B=async(q,I)=>{z(q);try{await Fl.reject(q,{reason:I||void 0}),m(W=>W.filter(X=>X.id!==q))}catch(W){console.error("Reject failed:",W)}finally{z(null)}};return p&&i==="pending"?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:n("approvals.title")}),c.length>0&&i==="pending"&&t.jsxs("span",{className:"badge bg-amber-500/10 text-amber-400",children:[c.length," pending"]})]}),t.jsx("button",{onClick:()=>{i==="pending"?M():i==="history"?E():ae()},className:"btn-ghost btn-sm",children:t.jsx(Mt,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:[{key:"pending",label:"Pending",icon:za},{key:"history",label:"History",icon:Mh},{key:"stats",label:"Stats",icon:ka}].map(({key:q,label:I,icon:W})=>t.jsxs("button",{onClick:()=>d(q),className:`flex items-center gap-2 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors ${i===q?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-500 hover:text-zinc-300"}`,children:[t.jsx(W,{className:"h-4 w-4"}),I]},q))}),i==="pending"&&t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(j0,{className:"h-4 w-4 text-zinc-500"}),t.jsxs("select",{value:N,onChange:q=>S(q.target.value),className:"input text-sm w-40",children:[t.jsx("option",{value:"",children:"All Types"}),Object.entries(du).map(([q,I])=>t.jsx("option",{value:q,children:I},q))]}),t.jsxs("select",{value:C,onChange:q=>O(q.target.value),className:"input text-sm w-40",children:[t.jsx("option",{value:"",children:"All Risk Levels"}),t.jsx("option",{value:"low",children:"Low"}),t.jsx("option",{value:"medium",children:"Medium"}),t.jsx("option",{value:"high",children:"High"}),t.jsx("option",{value:"critical",children:"Critical"})]})]}),v&&t.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-4 text-sm text-red-400",children:[v,t.jsx("button",{onClick:M,className:"ml-3 underline",children:"Retry"})]}),i==="pending"&&(c.length===0&&!v?t.jsx(tn,{icon:t.jsx(nu,{className:"h-8 w-8"}),title:n("approvals.empty"),description:n("approvals.emptyDesc"),action:t.jsxs("div",{className:"mt-2 space-y-3 text-left max-w-md",children:[t.jsx("p",{className:"text-sm text-zinc-400",children:"Approvals appear when an agent requests permission for a risky action (shell commands, file deletions, config changes, etc.)."}),t.jsxs("div",{className:"rounded-lg bg-zinc-900 border border-zinc-800 p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1.5 font-medium",children:"To enable approval mode:"}),t.jsx("code",{className:"text-xs text-indigo-400 font-mono",children:"npx nestor-sh config set security.approvalMode smart"})]}),t.jsxs("p",{className:"text-xs text-zinc-500",children:["Modes: ",t.jsx("span",{className:"text-zinc-400",children:"auto"})," (no approvals) ·"," ",t.jsx("span",{className:"text-zinc-400",children:"smart"})," (risky actions only) ·"," ",t.jsx("span",{className:"text-zinc-400",children:"manual"})," (all actions)"]})]})}):t.jsx("div",{className:"space-y-3",children:c.map(q=>t.jsx(Kh,{approval:q,onApprove:ce,onReject:B,actionLoading:k,showActions:!0},q.id))})),i==="history"&&(f.length===0?t.jsx(tn,{icon:t.jsx(Mh,{className:"h-8 w-8"}),title:"No history",description:"Approval history will appear here after decisions are made."}):t.jsx("div",{className:"space-y-3",children:f.map(q=>t.jsx(Kh,{approval:q,actionLoading:null,showActions:!1},q.id))})),i==="stats"&&b&&t.jsx(Qj,{stats:b})]})}const Jj="/api";async function Fj(n=30){const i=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};i&&(d.Authorization=`Bearer ${i}`);const c=localStorage.getItem("nestor_tenant_id");c&&(d["X-Tenant-ID"]=c);try{const m=await fetch(`${Jj}/analytics/quality?days=${n}`,{headers:d});return m.ok?(await m.json()).data??null:null}catch{return null}}function Ir(n){return`${(n*100).toFixed(0)}%`}function R0(n){return n>0?`+${(n*100).toFixed(0)}%`:`${(n*100).toFixed(0)}%`}function Mr({label:n,value:i,icon:d,color:c,bgColor:m,subtitle:f}){return t.jsx("div",{className:"card",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-zinc-400",children:n}),t.jsx("p",{className:"mt-1 text-2xl font-semibold text-white",children:i}),f&&t.jsx("p",{className:"mt-0.5 text-xs text-zinc-500",children:f})]}),t.jsx("div",{className:`flex h-11 w-11 items-center justify-center rounded-xl ${m}`,children:t.jsx(d,{className:`h-5 w-5 ${c}`})})]})})}function Ij({data:n}){return n.length===0?t.jsx("div",{className:"flex h-48 items-center justify-center text-zinc-500 text-sm",children:"No data available"}):t.jsx("div",{className:"flex items-end gap-1 h-48",children:n.map(i=>{const d=Math.max(i.successRate*100,2),c=i.successRate>=.8?"bg-emerald-500 hover:bg-emerald-400":i.successRate>=.5?"bg-amber-500 hover:bg-amber-400":"bg-red-500 hover:bg-red-400";return t.jsxs("div",{className:"flex-1 flex flex-col items-center min-w-0",children:[t.jsx("div",{className:`w-full rounded-t transition-all cursor-default min-h-[2px] ${c}`,style:{height:`${d}%`},title:`${i.date}: ${Ir(i.successRate)} (${i.completedRuns}/${i.totalRuns} runs)`}),t.jsx("span",{className:"text-[10px] text-zinc-500 mt-1 truncate w-full text-center",children:i.date.slice(5)})]},i.date)})})}function Pj({agents:n}){return n.length===0?t.jsx("p",{className:"text-zinc-500 text-sm",children:"No agent data available"}):t.jsx("div",{className:"space-y-2",children:n.map((i,d)=>{const c=i.score>=70?"text-emerald-400":i.score>=50?"text-amber-400":"text-red-400",m=i.score>=70?"bg-emerald-500":i.score>=50?"bg-amber-500":"bg-red-500";return t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("span",{className:"w-6 text-xs text-zinc-500 text-right font-mono",children:["#",d+1]}),t.jsx("span",{className:"text-sm text-zinc-300 w-32 truncate",title:i.name,children:i.name}),t.jsx("div",{className:"flex-1 h-2 bg-zinc-800 rounded-full overflow-hidden",children:t.jsx("div",{className:`h-full rounded-full transition-all ${m}`,style:{width:`${Math.min(i.score,100)}%`}})}),t.jsx("span",{className:`text-xs font-medium w-12 text-right ${c}`,children:i.score.toFixed(0)}),t.jsx("span",{className:"text-xs text-zinc-500 w-16 text-right",children:Ir(i.successRate)})]},i.agentId)})})}function Wj({items:n}){return n.length===0?t.jsxs("div",{className:"flex items-center gap-2 text-sm text-zinc-500",children:[t.jsx(pt,{className:"h-4 w-4 text-emerald-500"}),"All agents performing well"]}):t.jsx("div",{className:"space-y-2",children:n.map(i=>t.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-red-500/5 border border-red-500/20",children:[t.jsx(mt,{className:"h-4 w-4 text-red-400 shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("span",{className:"text-sm text-zinc-300 truncate block",children:i.name}),t.jsx("span",{className:"text-xs text-zinc-500",children:i.issue})]}),t.jsx("span",{className:"text-xs text-red-400 font-mono",children:typeof i.metric=="number"&&i.metric<=1?Ir(i.metric):R0(i.metric)})]},i.agentId))})}function e1({tools:n}){if(n.length===0)return t.jsx("p",{className:"text-zinc-500 text-sm",children:"No tool usage data"});const i=Math.max(...n.map(d=>d.count),1);return t.jsx("div",{className:"space-y-2",children:n.slice(0,10).map(d=>{const c=d.failRate>=.3?"text-red-400":d.failRate>=.1?"text-amber-400":"text-zinc-500";return t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Wn,{className:"h-3.5 w-3.5 text-zinc-500 shrink-0"}),t.jsx("span",{className:"text-xs text-zinc-300 w-32 truncate font-mono",title:d.name,children:d.name}),t.jsx("div",{className:"flex-1 h-1.5 bg-zinc-800 rounded-full overflow-hidden",children:t.jsx("div",{className:"h-full bg-indigo-500 rounded-full",style:{width:`${d.count/i*100}%`}})}),t.jsx("span",{className:"text-xs text-zinc-500 w-10 text-right",children:d.count}),t.jsxs("span",{className:`text-xs w-12 text-right ${c}`,children:[(d.failRate*100).toFixed(0),"% fail"]})]},d.name)})})}function t1({errors:n}){return n.length===0?t.jsxs("div",{className:"flex items-center gap-2 text-sm text-zinc-500",children:[t.jsx(pt,{className:"h-4 w-4 text-emerald-500"}),"No recurring errors detected"]}):t.jsx("div",{className:"space-y-2",children:n.slice(0,8).map((i,d)=>t.jsxs("div",{className:"flex items-start gap-2 p-2 rounded-lg bg-zinc-800/50",children:[t.jsx(b0,{className:"h-3.5 w-3.5 text-red-400 shrink-0 mt-0.5"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs text-zinc-300 font-mono break-all line-clamp-2",children:i.pattern}),t.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[t.jsxs("span",{className:"text-[10px] text-zinc-500",children:[i.count," occurrences"]}),i.lastSeen&&t.jsxs("span",{className:"text-[10px] text-zinc-600",children:["Last: ",new Date(i.lastSeen).toLocaleDateString()]})]})]})]},d))})}function a1(){const[n,i]=u.useState(null),[d,c]=u.useState(!0),[m,f]=u.useState(null),[h,b]=u.useState(30);if(u.useEffect(()=>{async function w(){c(!0),f(null);const v=await Fj(h);v?i(v):f("Failed to load quality metrics"),c(!1)}w()},[h]),d)return t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})});if(m||!n)return t.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-3",children:[t.jsx(mt,{className:"h-8 w-8 text-amber-500"}),t.jsx("p",{className:"text-zinc-400",children:m??"No data available"})]});const g=n.overallFeedbackScore>=0?"text-emerald-400":"text-red-400",p=n.overallSuccessRate>=.8?"text-emerald-400":n.overallSuccessRate>=.5?"text-amber-400":"text-red-400";return t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"flex items-center gap-2",children:[7,14,30,90].map(w=>t.jsxs("button",{onClick:()=>b(w),className:`px-3 py-1 text-xs rounded-lg transition-colors ${h===w?"bg-indigo-500/20 text-indigo-400 border border-indigo-500/30":"bg-zinc-800/50 text-zinc-500 border border-zinc-700/50 hover:border-zinc-600"}`,children:[w,"d"]},w))}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[t.jsx(Mr,{label:"Total Runs",value:String(n.totalRuns),icon:Ft,color:"text-blue-400",bgColor:"bg-blue-400/10",subtitle:`Last ${h} days`}),t.jsx(Mr,{label:"Success Rate",value:Ir(n.overallSuccessRate),icon:pt,color:p,bgColor:n.overallSuccessRate>=.8?"bg-emerald-400/10":"bg-amber-400/10"}),t.jsx(Mr,{label:"Feedback Score",value:R0(n.overallFeedbackScore),icon:ni,color:g,bgColor:n.overallFeedbackScore>=0?"bg-emerald-400/10":"bg-red-400/10"}),t.jsx(Mr,{label:"Active Agents",value:`${n.activeAgents} / ${n.totalAgents}`,icon:Pn,color:"text-purple-400",bgColor:"bg-purple-400/10"})]}),t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[t.jsx(ka,{className:"h-4 w-4 text-zinc-400"}),t.jsx("h2",{className:"text-lg font-medium text-white",children:"Success Rate Trend"})]}),t.jsx(Ij,{data:n.dailySuccessRates})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[t.jsx(lu,{className:"h-4 w-4 text-zinc-400"}),t.jsx("h2",{className:"text-lg font-medium text-white",children:"Top Performers"})]}),t.jsx(Pj,{agents:n.topPerformers})]}),t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[t.jsx(mt,{className:"h-4 w-4 text-zinc-400"}),t.jsx("h2",{className:"text-lg font-medium text-white",children:"Needs Attention"})]}),t.jsx(Wj,{items:n.needsAttention})]})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[t.jsx(Wn,{className:"h-4 w-4 text-zinc-400"}),t.jsx("h2",{className:"text-lg font-medium text-white",children:"Tool Performance"})]}),t.jsx(e1,{tools:n.toolPerformance})]}),t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[t.jsx(b0,{className:"h-4 w-4 text-zinc-400"}),t.jsx("h2",{className:"text-lg font-medium text-white",children:"Error Patterns"})]}),t.jsx(t1,{errors:n.errorPatterns})]})]})]})}function Dr({label:n,value:i,icon:d,color:c,bgColor:m,subtitle:f}){return t.jsx("div",{className:"card",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-zinc-400",children:n}),t.jsx("p",{className:"mt-1 text-2xl font-semibold text-white",children:i}),f&&t.jsx("p",{className:"mt-0.5 text-xs text-zinc-500",children:f})]}),t.jsx("div",{className:`flex h-11 w-11 items-center justify-center rounded-xl ${m}`,children:t.jsx(d,{className:`h-5 w-5 ${c}`})})]})})}const Pl={"7d":{label:"7 jours",days:7,aggregate:"day"},"30d":{label:"30 jours",days:30,aggregate:"day"},"90d":{label:"3 mois",days:90,aggregate:"week"},"6m":{label:"6 mois",days:180,aggregate:"week"},"1y":{label:"1 an",days:365,aggregate:"month"}};function s1(n,i){if(i==="day"){const c=n.filter(m=>m.costUsd>0);return c.length>0?c:n.slice(-7)}const d=new Map;for(const c of n){let m;const f=new Date(c.date);if(i==="week"){const b=new Date(f);b.setDate(f.getDate()-f.getDay()+1),m=b.toISOString().slice(0,10)}else m=c.date.slice(0,7);const h=d.get(m)||{costUsd:0,runs:0};h.costUsd+=c.costUsd,h.runs+=c.runs,d.set(m,h)}return Array.from(d.entries()).map(([c,m])=>({date:c,costUsd:m.costUsd,runs:m.runs})).sort((c,m)=>c.date.localeCompare(m.date))}function n1({data:n,period:i,onPeriodChange:d}){const c=Pl[i],m=s1(n,c.aggregate);if(m.length===0)return t.jsx("div",{className:"flex h-48 items-center justify-center text-zinc-500 text-sm",children:"No cost data available"});const f=Math.max(...m.map(g=>g.costUsd),.01),h=m.reduce((g,p)=>g+p.costUsd,0),b=m.reduce((g,p)=>g+p.runs,0);return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("div",{className:"flex gap-1",children:Object.keys(Pl).map(g=>t.jsx("button",{onClick:()=>d(g),className:`px-3 py-1 rounded text-xs font-medium transition-colors ${i===g?"bg-indigo-600 text-white":"bg-zinc-800 text-zinc-400 hover:bg-zinc-700"}`,children:Pl[g].label},g))}),t.jsxs("div",{className:"text-xs text-zinc-500",children:["$",h.toFixed(2)," · ",b," runs · ",m.length," ",c.aggregate==="day"?"jours":c.aggregate==="week"?"semaines":"mois"]})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsxs("div",{className:"flex flex-col justify-between h-48 text-right pr-1 text-[10px] text-zinc-600 w-12 flex-shrink-0",children:[t.jsxs("span",{children:["$",f.toFixed(2)]}),t.jsxs("span",{children:["$",(f*.75).toFixed(2)]}),t.jsxs("span",{children:["$",(f*.5).toFixed(2)]}),t.jsxs("span",{children:["$",(f*.25).toFixed(2)]}),t.jsx("span",{children:"$0"})]}),t.jsx("div",{className:"flex items-end gap-1 h-48 flex-1",children:m.map(g=>{const p=Math.max(g.costUsd/f*100,3),w=g.costUsd===f;return t.jsxs("div",{className:"flex-1 flex flex-col items-center min-w-0 group relative",children:[t.jsxs("div",{className:"absolute bottom-full mb-1 hidden group-hover:block bg-zinc-800 text-white text-xs px-2 py-1 rounded whitespace-nowrap z-10 pointer-events-none",children:["$",g.costUsd.toFixed(4)," · ",g.runs," runs"]}),t.jsx("div",{className:`w-full rounded-t transition-all cursor-default ${w?"bg-indigo-400":"bg-indigo-500 hover:bg-indigo-400"}`,style:{height:`${p}%`}}),t.jsx("span",{className:"text-[10px] text-zinc-500 mt-1 truncate w-full text-center",children:(c.aggregate==="month",g.date.slice(5))})]},g.date)})})]})]})}function zs(n){return n<.01?`$${n.toFixed(4)}`:n<1?`$${n.toFixed(3)}`:`$${n.toFixed(2)}`}function Vh(n){return n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:String(n)}function l1(){const{t:n}=nt(),[i,d]=u.useState(null),[c,m]=u.useState([]),[f,h]=u.useState([]),[b,g]=u.useState(null),[p,w]=u.useState("30d"),[v,y]=u.useState(!0),[k,z]=u.useState(null);if(u.useEffect(()=>{async function S(){try{y(!0),z(null);const[C,O,M,E]=await Promise.all([Ar.summary(),Ar.daily(Pl[p].days),Ar.budget(),Ar.estimate()]);d(C.data),m(O.data),h(M.data),g(E.data)}catch(C){z(C instanceof Error?C.message:"Failed to load analytics")}finally{y(!1)}}S()},[p]),v)return t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsx("p",{className:"text-zinc-400",children:n("common.loading")})});if(k)return t.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-3",children:[t.jsx(mt,{className:"h-8 w-8 text-amber-500"}),t.jsx("p",{className:"text-zinc-400",children:k})]});const N=i&&i.totalRuns>0?i.totalCostUsd/i.totalRuns:0;return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[t.jsx(Dr,{label:n("analytics.totalSpend"),value:zs((i==null?void 0:i.totalCostUsd)??0),icon:Ca,color:"text-emerald-400",bgColor:"bg-emerald-400/10"}),t.jsx(Dr,{label:n("analytics.totalRuns"),value:String((i==null?void 0:i.totalRuns)??0),icon:Ft,color:"text-blue-400",bgColor:"bg-blue-400/10",subtitle:`${Vh((i==null?void 0:i.totalTokens)??0)} tokens`}),t.jsx(Dr,{label:n("analytics.avgCostPerRun"),value:zs(N),icon:nv,color:"text-amber-400",bgColor:"bg-amber-400/10"}),t.jsx(Dr,{label:n("analytics.monthlyEstimate"),value:zs((b==null?void 0:b.estimatedUsd)??0),icon:lu,color:"text-purple-400",bgColor:"bg-purple-400/10",subtitle:b?`${b.confidence} confidence`:void 0})]}),t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[t.jsx(ka,{className:"h-4 w-4 text-zinc-400"}),t.jsxs("h2",{className:"text-lg font-medium text-white",children:[n("analytics.dailyCosts")," (",Pl[p].label,")"]})]}),t.jsx(n1,{data:c,period:p,onPeriodChange:S=>{w(S)}})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"text-lg font-medium text-white mb-4",children:n("analytics.agentBreakdown")}),i&&i.byAgent.length>0?t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border text-zinc-400",children:[t.jsx("th",{className:"text-left pb-2 font-medium",children:n("common.name")}),t.jsx("th",{className:"text-right pb-2 font-medium",children:n("analytics.runs")}),t.jsx("th",{className:"text-right pb-2 font-medium",children:n("analytics.totalCost")}),t.jsx("th",{className:"text-right pb-2 font-medium",children:n("analytics.avgCost")})]})}),t.jsx("tbody",{children:i.byAgent.map(S=>t.jsxs("tr",{className:"border-b border-border/50 hover:bg-surface-hover",children:[t.jsx("td",{className:"py-2 text-white",children:S.agentName}),t.jsx("td",{className:"py-2 text-right text-zinc-300",children:S.runs}),t.jsx("td",{className:"py-2 text-right text-zinc-300",children:zs(S.costUsd)}),t.jsx("td",{className:"py-2 text-right text-zinc-300",children:zs(S.runs>0?S.costUsd/S.runs:0)})]},S.agentId))})]})}):t.jsx("p",{className:"text-zinc-500 text-sm",children:n("analytics.noAgentData")})]}),t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"text-lg font-medium text-white mb-4",children:n("analytics.modelBreakdown")}),i&&i.byModel.length>0?t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border text-zinc-400",children:[t.jsx("th",{className:"text-left pb-2 font-medium",children:n("analytics.model")}),t.jsx("th",{className:"text-right pb-2 font-medium",children:n("analytics.tokens")}),t.jsx("th",{className:"text-right pb-2 font-medium",children:n("analytics.cost")})]})}),t.jsx("tbody",{children:i.byModel.map(S=>t.jsxs("tr",{className:"border-b border-border/50 hover:bg-surface-hover",children:[t.jsx("td",{className:"py-2 text-white font-mono text-xs",children:S.model}),t.jsx("td",{className:"py-2 text-right text-zinc-300",children:Vh(S.tokens)}),t.jsx("td",{className:"py-2 text-right text-zinc-300",children:zs(S.costUsd)})]},S.model))})]})}):t.jsx("p",{className:"text-zinc-500 text-sm",children:n("analytics.noModelData")})]})]}),f.length>0&&t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"text-lg font-medium text-white mb-4",children:n("analytics.budgetUtilization")}),t.jsx("div",{className:"space-y-3",children:f.map(S=>t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("span",{className:"text-sm text-zinc-300 w-32 truncate",children:S.name}),t.jsx("div",{className:"flex-1 h-2 bg-zinc-800 rounded-full overflow-hidden",children:t.jsx("div",{className:`h-full rounded-full transition-all ${S.percent>=90?"bg-red-500":S.percent>=70?"bg-amber-500":"bg-indigo-500"}`,style:{width:`${Math.min(S.percent,100)}%`}})}),t.jsxs("span",{className:"text-xs text-zinc-400 w-24 text-right",children:[zs(S.spentUsd)," / ",zs(S.budgetUsd)]}),t.jsxs("span",{className:`text-xs font-medium w-12 text-right ${S.percent>=90?"text-red-400":S.percent>=70?"text-amber-400":"text-zinc-400"}`,children:[S.percent.toFixed(0),"%"]})]},S.agentId))})]})]})}function i1(){const{t:n}=nt(),[i,d]=u.useState("costs");return t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:n("analytics.title")}),t.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:n("analytics.description")})]})}),t.jsxs("div",{className:"flex items-center gap-1 border-b border-border",children:[t.jsx("button",{onClick:()=>d("costs"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${i==="costs"?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-400 hover:text-zinc-300 hover:border-zinc-600"}`,children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ca,{className:"h-4 w-4"}),"Costs"]})}),t.jsx("button",{onClick:()=>d("quality"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${i==="quality"?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-400 hover:text-zinc-300 hover:border-zinc-600"}`,children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(pt,{className:"h-4 w-4"}),"Quality"]})})]}),i==="costs"&&t.jsx(l1,{}),i==="quality"&&t.jsx(a1,{})]})}function M0(n){return new Date(n).toLocaleString()}function uu(n){return n===void 0?"--":n<1e3?`${n}ms`:n<6e4?`${(n/1e3).toFixed(1)}s`:`${(n/6e4).toFixed(1)}m`}function mu(n){switch(n){case"ok":return t.jsx(pt,{className:"h-4 w-4 text-emerald-400"});case"error":return t.jsx(At,{className:"h-4 w-4 text-red-400"});default:return t.jsx(mt,{className:"h-4 w-4 text-zinc-500"})}}function D0(n){const i={ok:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",error:"bg-red-500/10 text-red-400 border-red-500/20",unset:"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"};return t.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium ${i[n]??i.unset}`,children:[mu(n),n]})}function r1({span:n,traceStart:i,traceDuration:d}){if(d===0)return null;const c=(n.startTime-i)/d*100,m=Math.max((n.durationMs??0)/d*100,.5),f=n.status==="error"?"bg-red-500":n.kind==="server"?"bg-indigo-500":n.kind==="client"?"bg-cyan-500":"bg-emerald-500";return t.jsx("div",{className:"relative h-5 w-full rounded bg-zinc-800/50",children:t.jsx("div",{className:`absolute top-0.5 h-4 rounded ${f} opacity-80`,style:{left:`${Math.min(c,99)}%`,width:`${Math.min(m,100-c)}%`}})})}function c1({span:n,depth:i,traceStart:d,traceDuration:c}){const[m,f]=u.useState(!1),h=Object.keys(n.attributes).length>0||n.events.length>0;return t.jsxs(t.Fragment,{children:[t.jsxs("tr",{className:"border-b border-zinc-800/50 hover:bg-zinc-800/30 cursor-pointer transition-colors",onClick:()=>h&&f(!m),children:[t.jsx("td",{className:"py-2 px-3 text-sm font-mono text-zinc-300 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center gap-1",style:{paddingLeft:`${i*16}px`},children:[h?m?t.jsx(Fa,{className:"h-3 w-3 text-zinc-500"}):t.jsx(ca,{className:"h-3 w-3 text-zinc-500"}):t.jsx("span",{className:"w-3"}),mu(n.status),t.jsx("span",{className:"ml-1",children:n.name})]})}),t.jsx("td",{className:"py-2 px-3 text-xs text-zinc-500 whitespace-nowrap",children:n.kind}),t.jsx("td",{className:"py-2 px-3 text-xs text-zinc-400 font-mono whitespace-nowrap text-right",children:uu(n.durationMs)}),t.jsx("td",{className:"py-2 px-3 w-1/3",children:t.jsx(r1,{span:n,traceStart:d,traceDuration:c})})]}),m&&t.jsx("tr",{className:"border-b border-zinc-800/50",children:t.jsx("td",{colSpan:4,className:"px-6 py-3 bg-zinc-900/50",children:t.jsxs("div",{style:{paddingLeft:`${i*16+16}px`},children:[Object.keys(n.attributes).length>0&&t.jsxs("div",{className:"mb-2",children:[t.jsx("p",{className:"text-xs font-semibold text-zinc-500 uppercase mb-1",children:"Attributes"}),t.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5",children:Object.entries(n.attributes).map(([b,g])=>t.jsxs("div",{className:"text-xs",children:[t.jsxs("span",{className:"text-zinc-500",children:[b,":"]})," ",t.jsx("span",{className:"text-zinc-300 font-mono",children:String(g)})]},b))})]}),n.events.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold text-zinc-500 uppercase mb-1",children:"Events"}),n.events.map((b,g)=>t.jsxs("div",{className:"text-xs mb-1",children:[t.jsx("span",{className:"text-amber-400",children:b.name}),t.jsxs("span",{className:"text-zinc-600 ml-2",children:["+",b.time-n.startTime,"ms"]}),b.attributes&&Object.entries(b.attributes).map(([p,w])=>t.jsxs("span",{className:"text-zinc-500 ml-2",children:[p,"=",String(w)]},p))]},g))]})]})})})]})}function o1(n){const i=new Map,d=[];for(const c of n)i.set(c.spanId,{span:c,children:[]});for(const c of n){const m=i.get(c.spanId);c.parentSpanId&&i.has(c.parentSpanId)?i.get(c.parentSpanId).children.push(m):d.push(m)}return d}function O0(n,i=0){const d=[];for(const c of n)d.push({span:c.span,depth:i}),d.push(...O0(c.children,i+1));return d}function d1({trace:n}){const i=n.startTime,d=n.durationMs??1,c=o1(n.spans),m=O0(c);return t.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/50 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-800 px-4 py-3",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold text-white",children:n.rootSpanName}),t.jsxs("p",{className:"text-xs text-zinc-500 mt-0.5",children:[M0(n.startTime)," · ",n.spanCount," spans · ",uu(n.durationMs)]})]}),D0(n.status)]}),t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full min-w-[600px]",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-zinc-800 text-xs text-zinc-500 uppercase",children:[t.jsx("th",{className:"py-2 px-3 text-left font-medium",children:"Span"}),t.jsx("th",{className:"py-2 px-3 text-left font-medium w-16",children:"Kind"}),t.jsx("th",{className:"py-2 px-3 text-right font-medium w-20",children:"Duration"}),t.jsx("th",{className:"py-2 px-3 text-left font-medium w-1/3",children:"Timeline"})]})}),t.jsx("tbody",{children:m.map(({span:f,depth:h})=>t.jsx(c1,{span:f,depth:h,traceStart:i,traceDuration:d},f.spanId))})]})}),t.jsx("div",{className:"border-t border-zinc-800 px-4 py-2",children:t.jsxs("p",{className:"text-xs text-zinc-600 font-mono",children:["traceId: ",n.traceId]})})]})}function u1(){const[n,i]=u.useState([]),[d,c]=u.useState(null),[m,f]=u.useState(null),[h,b]=u.useState(!0),[g,p]=u.useState(!1),[w,v]=u.useState(null),y=u.useCallback(async()=>{b(!0),v(null);try{const N=await Cd.list();i(N.data),p(N.meta.tracingEnabled)}catch(N){v(N instanceof Error?N.message:"Failed to load traces")}finally{b(!1)}},[]);u.useEffect(()=>{y()},[y]);const k=u.useCallback(async N=>{if(m===N){f(null),c(null);return}f(N);try{const S=await Cd.get(N);c(S.data)}catch{c(null)}},[m]),z=async()=>{try{await Cd.clear(),i([]),c(null),f(null)}catch{}};return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-bold text-white",children:"Traces"}),t.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"Distributed tracing for agent runs, HTTP requests, and orchestrations."})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[!g&&t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-amber-500/20 bg-amber-500/10 px-3 py-1 text-xs font-medium text-amber-400",children:[t.jsx(mt,{className:"h-3 w-3"}),"Tracing disabled"]}),t.jsxs("button",{onClick:y,className:"inline-flex items-center gap-1.5 rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-1.5 text-sm text-zinc-300 hover:bg-zinc-700 transition-colors",children:[t.jsx(Mt,{className:"h-3.5 w-3.5"}),"Refresh"]}),t.jsxs("button",{onClick:z,className:"inline-flex items-center gap-1.5 rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-1.5 text-sm text-red-400 hover:bg-zinc-700 transition-colors",children:[t.jsx(qt,{className:"h-3.5 w-3.5"}),"Clear"]})]})]}),w&&t.jsx("div",{className:"rounded-lg border border-red-500/20 bg-red-500/10 p-4",children:t.jsx("p",{className:"text-sm text-red-400",children:w})}),h&&t.jsx("div",{className:"flex items-center justify-center py-12",children:t.jsx("div",{className:"animate-spin h-6 w-6 border-2 border-indigo-500 border-t-transparent rounded-full"})}),!h&&n.length===0&&t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[t.jsx("div",{className:"mb-4 rounded-2xl bg-surface p-4 text-zinc-500",children:t.jsx(Ft,{className:"h-8 w-8"})}),t.jsx("h3",{className:"text-lg font-medium text-zinc-300",children:"No traces recorded"}),t.jsx("p",{className:"mt-1.5 max-w-md text-sm text-zinc-500",children:g?"Traces will appear here as agents run and HTTP requests are processed.":"Distributed tracing records the full execution path of agent runs, tool calls, and HTTP requests."}),t.jsxs("div",{className:"mt-4 space-y-3 text-left max-w-md",children:[!g&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"rounded-lg bg-zinc-900 border border-zinc-800 p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1.5 font-medium",children:"Enable via CLI:"}),t.jsx("code",{className:"text-xs text-indigo-400 font-mono block",children:"npx nestor-sh config set observability.tracing.enabled true"})]}),t.jsxs("div",{className:"rounded-lg bg-zinc-900 border border-zinc-800 p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1.5 font-medium",children:"Or in nestor.config.json:"}),t.jsx("pre",{className:"text-xs text-zinc-400 font-mono",children:`{
581
+ "observability": {
582
+ "tracing": { "enabled": true }
583
+ }
584
+ }`})]})]}),g&&t.jsxs("div",{className:"rounded-lg bg-zinc-900 border border-zinc-800 p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1.5 font-medium",children:"Traces are recorded when:"}),t.jsxs("ul",{className:"text-xs text-zinc-400 space-y-1 list-disc list-inside",children:[t.jsx("li",{children:"An agent run executes (chat, mission, workflow)"}),t.jsx("li",{children:"Tool calls are made (shell, file, HTTP)"}),t.jsx("li",{children:"API requests are processed by the server"})]})]}),t.jsx("p",{className:"text-xs text-zinc-500",children:"Each trace shows a waterfall timeline of spans, durations, and errors."})]})]}),!h&&n.length>0&&t.jsx("div",{className:"space-y-2",children:n.map(N=>t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>k(N.traceId),className:`w-full flex items-center justify-between rounded-lg border px-4 py-3 text-left transition-colors ${m===N.traceId?"border-indigo-500/30 bg-indigo-500/5":"border-zinc-800 bg-zinc-900/50 hover:bg-zinc-800/50"}`,children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[m===N.traceId?t.jsx(Fa,{className:"h-4 w-4 text-zinc-500 flex-shrink-0"}):t.jsx(ca,{className:"h-4 w-4 text-zinc-500 flex-shrink-0"}),mu(N.status),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium text-white truncate",children:N.rootSpanName}),t.jsx("p",{className:"text-xs text-zinc-500",children:M0(N.startTime)})]})]}),t.jsxs("div",{className:"flex items-center gap-4 flex-shrink-0",children:[t.jsxs("span",{className:"text-xs text-zinc-500",children:[N.spanCount," span",N.spanCount!==1?"s":""]}),t.jsx("span",{className:"text-xs font-mono text-zinc-400 w-16 text-right",children:uu(N.durationMs)}),D0(N.status)]})]}),m===N.traceId&&d&&t.jsx("div",{className:"mt-2 ml-4",children:t.jsx(d1,{trace:d})})]},N.traceId))})]})}function L0(){const{login:n,register:i}=ci(),d=Dt(),[c,m]=u.useState("login"),[f,h]=u.useState(""),[b,g]=u.useState(""),[p,w]=u.useState(""),[v,y]=u.useState(""),[k,z]=u.useState(!1),N=async S=>{S.preventDefault(),y(""),z(!0);try{c==="register"?(await i(f,b,p),await n(f,b)):await n(f,b),d("/",{replace:!0})}catch(C){y(C.message||"An error occurred.")}finally{z(!1)}};return t.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background px-4",children:t.jsxs("div",{className:"w-full max-w-sm",children:[t.jsxs("div",{className:"mb-8 flex flex-col items-center gap-3",children:[t.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl bg-indigo-600 text-white",children:t.jsx(Qa,{className:"h-6 w-6"})}),t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Nestor Studio"}),t.jsx("p",{className:"text-sm text-zinc-400",children:c==="login"?"Sign in to your account":"Create a new account"})]}),t.jsxs("form",{onSubmit:N,className:"space-y-4",children:[v&&t.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-400",children:[t.jsx(ei,{className:"h-4 w-4 flex-shrink-0"}),v]}),c==="register"&&t.jsxs("div",{children:[t.jsx("label",{className:"mb-1.5 block text-sm font-medium text-zinc-300",children:"Name"}),t.jsx("input",{type:"text",value:p,onChange:S=>w(S.target.value),required:!0,className:"w-full rounded-lg border border-border bg-surface px-3 py-2 text-sm text-white placeholder:text-zinc-500 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500",placeholder:"Your name"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"mb-1.5 block text-sm font-medium text-zinc-300",children:"Email"}),t.jsx("input",{type:"email",value:f,onChange:S=>h(S.target.value),required:!0,className:"w-full rounded-lg border border-border bg-surface px-3 py-2 text-sm text-white placeholder:text-zinc-500 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500",placeholder:"you@example.com"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"mb-1.5 block text-sm font-medium text-zinc-300",children:"Password"}),t.jsx("input",{type:"password",value:b,onChange:S=>g(S.target.value),required:!0,minLength:c==="register"?6:1,className:"w-full rounded-lg border border-border bg-surface px-3 py-2 text-sm text-white placeholder:text-zinc-500 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500",placeholder:c==="register"?"At least 6 characters":"Your password"})]}),t.jsx("button",{type:"submit",disabled:k,className:"flex w-full items-center justify-center gap-2 rounded-lg bg-indigo-600 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-indigo-700 disabled:opacity-50",children:k?"Please wait...":c==="login"?t.jsxs(t.Fragment,{children:[t.jsx(fv,{className:"h-4 w-4"})," Sign In"]}):t.jsxs(t.Fragment,{children:[t.jsx(Tv,{className:"h-4 w-4"})," Create Account"]})})]}),t.jsx("div",{className:"mt-6 text-center",children:t.jsx("button",{type:"button",onClick:()=>{m(c==="login"?"register":"login"),y("")},className:"text-sm text-zinc-400 transition-colors hover:text-indigo-400",children:c==="login"?"Don't have an account? Register":"Already have an account? Sign in"})})]})})}function m1(){const{isAdmin:n}=ci(),[i,d]=u.useState([]),[c,m]=u.useState([]),[f,h]=u.useState("users"),[b,g]=u.useState(!0),[p,w]=u.useState(""),v=u.useCallback(async()=>{try{const N=await fetch("/api/users",{credentials:"include"}),S=await N.json();N.ok&&d(S.data||[])}catch{}},[]),y=u.useCallback(async()=>{try{const N=await fetch("/api/users/audit?limit=50",{credentials:"include"}),S=await N.json();N.ok&&m(S.data||[])}catch{}},[]);u.useEffect(()=>{g(!0),Promise.all([v(),y()]).finally(()=>g(!1))},[v,y]);const k=async(N,S)=>{var C;w("");try{const O=await fetch(`/api/users/${N}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({role:S})});if(!O.ok){const M=await O.json();throw new Error(((C=M.error)==null?void 0:C.message)||"Failed to update role.")}await v()}catch(O){w(O.message)}},z=async N=>{var S;if(confirm("Are you sure you want to delete this user?")){w("");try{const C=await fetch(`/api/users/${N}`,{method:"DELETE",credentials:"include"});if(!C.ok){const O=await C.json();throw new Error(((S=O.error)==null?void 0:S.message)||"Failed to delete user.")}await v()}catch(C){w(C.message)}}};return n?t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"User Management"}),t.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"Manage users, roles, and view audit log."})]})}),p&&t.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-sm text-red-400",children:p}),t.jsxs("div",{className:"flex gap-1 border-b border-border",children:[t.jsxs("button",{onClick:()=>h("users"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium transition-colors ${f==="users"?"border-b-2 border-indigo-500 text-indigo-400":"text-zinc-400 hover:text-zinc-200"}`,children:[t.jsx(Pn,{className:"h-4 w-4"})," Users (",i.length,")"]}),t.jsxs("button",{onClick:()=>h("audit"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium transition-colors ${f==="audit"?"border-b-2 border-indigo-500 text-indigo-400":"text-zinc-400 hover:text-zinc-200"}`,children:[t.jsx(an,{className:"h-4 w-4"})," Audit Log"]})]}),b?t.jsx("div",{className:"text-center text-zinc-400 py-8",children:"Loading..."}):f==="users"?t.jsx("div",{className:"overflow-x-auto rounded-lg border border-border",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border bg-surface",children:[t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Name"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Email"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Role"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Provider"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Last Login"}),t.jsx("th",{className:"px-4 py-3 text-right text-xs font-medium uppercase text-zinc-400",children:"Actions"})]})}),t.jsxs("tbody",{children:[i.map(N=>t.jsxs("tr",{className:"border-b border-border/50 hover:bg-surface-hover",children:[t.jsx("td",{className:"px-4 py-3 font-medium text-white",children:N.name}),t.jsx("td",{className:"px-4 py-3 text-zinc-300",children:N.email}),t.jsx("td",{className:"px-4 py-3",children:t.jsxs("select",{value:N.role,onChange:S=>k(N.id,S.target.value),className:"rounded border border-border bg-background px-2 py-1 text-xs text-white focus:outline-none",children:[t.jsx("option",{value:"admin",children:"Admin"}),t.jsx("option",{value:"member",children:"Member"}),t.jsx("option",{value:"viewer",children:"Viewer"})]})}),t.jsx("td",{className:"px-4 py-3 text-zinc-400",children:N.authProvider}),t.jsx("td",{className:"px-4 py-3 text-zinc-400",children:N.lastLoginAt?new Date(N.lastLoginAt*1e3).toLocaleString():"Never"}),t.jsx("td",{className:"px-4 py-3 text-right",children:t.jsx("button",{onClick:()=>z(N.id),className:"rounded p-1.5 text-zinc-400 transition-colors hover:bg-red-500/10 hover:text-red-400",title:"Delete user",children:t.jsx(qt,{className:"h-4 w-4"})})})]},N.id)),i.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-zinc-500",children:"No users found."})})]})]})}):t.jsx("div",{className:"overflow-x-auto rounded-lg border border-border",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border bg-surface",children:[t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Time"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Action"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Resource"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"User"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Details"})]})}),t.jsxs("tbody",{children:[c.map(N=>{var S;return t.jsxs("tr",{className:"border-b border-border/50 hover:bg-surface-hover",children:[t.jsx("td",{className:"px-4 py-3 text-zinc-400 whitespace-nowrap",children:new Date(N.createdAt*1e3).toLocaleString()}),t.jsx("td",{className:"px-4 py-3 font-mono text-xs text-indigo-400",children:N.action}),t.jsx("td",{className:"px-4 py-3 text-zinc-300",children:N.resourceType&&t.jsxs("span",{children:[N.resourceType,N.resourceId?`/${N.resourceId.slice(0,8)}`:""]})}),t.jsx("td",{className:"px-4 py-3 text-zinc-400",children:((S=N.userId)==null?void 0:S.slice(0,8))||"-"}),t.jsx("td",{className:"px-4 py-3 text-xs text-zinc-500 max-w-xs truncate",children:N.details?JSON.stringify(N.details):"-"})]},N.id)}),c.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-zinc-500",children:"No audit entries."})})]})]})})]}):t.jsxs("div",{className:"flex h-64 items-center justify-center text-zinc-400",children:[t.jsx(Ms,{className:"mr-2 h-5 w-5"})," Admin access required."]})}function Ed({label:n,valueA:i,valueB:d,format:c}){const m=Math.max(i,d,.001);return t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-zinc-400",children:n}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"w-12 text-right text-xs text-indigo-400",children:c(i)}),t.jsxs("div",{className:"flex-1 flex gap-0.5",children:[t.jsx("div",{className:"h-4 rounded-l bg-indigo-500/40",style:{width:`${i/m*50}%`}}),t.jsx("div",{className:"h-4 rounded-r bg-emerald-500/40",style:{width:`${d/m*50}%`}})]}),t.jsx("span",{className:"w-12 text-left text-xs text-emerald-400",children:c(d)})]})]})}function x1(){const{id:n}=Fn(),[i,d]=u.useState([]),[c,m]=u.useState([]),[f,h]=u.useState(!0),[b,g]=u.useState(""),[p,w]=u.useState(!1),[v,y]=u.useState(""),[k,z]=u.useState(""),[N,S]=u.useState(""),[C,O]=u.useState(""),[M,E]=u.useState(null),[ae,ce]=u.useState(!1),[B,q]=u.useState(""),[I,W]=u.useState(""),[X,le]=u.useState(""),[J,re]=u.useState(50),[ge,G]=u.useState([]),[ee,xe]=u.useState({}),[oe,we]=u.useState(!1),[T,Y]=u.useState(""),[ie,$]=u.useState(""),[de,me]=u.useState(""),[be,Ce]=u.useState(.5),je=u.useCallback(async()=>{if(n){try{const[D,P,ve]=await Promise.all([fetch(`/api/agents/${n}/prompts`,{credentials:"include"}),fetch(`/api/agents/${n}/prompts/ab-tests`,{credentials:"include"}),fetch(`/api/agents/${n}/experiments`,{credentials:"include"})]),Je=await D.json(),Q=await P.json(),se=await ve.json();if(D.ok&&d(Je.data||[]),P.ok&&m(Q.data||[]),ve.ok){const pe=se.data||[];G(pe);for(const ze of pe)try{const Ve=await fetch(`/api/experiments/${ze.id}`,{credentials:"include"});if(Ve.ok){const St=await Ve.json();xe(Wa=>({...Wa,[ze.id]:St.data}))}}catch{}}}catch{}h(!1)}},[n]);u.useEffect(()=>{je()},[je]);const Ze=async()=>{var D;if(!(!n||!v.trim())){g("");try{const P=await fetch(`/api/agents/${n}/prompts`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({systemPrompt:v,name:k||void 0})});if(!P.ok){const ve=await P.json();throw new Error(((D=ve.error)==null?void 0:D.message)||"Failed")}w(!1),y(""),z(""),await je()}catch(P){g(P.message)}}},Pe=async D=>{var P;if(n){g("");try{const ve=await fetch(`/api/agents/${n}/prompts/${D}/activate`,{method:"PATCH",credentials:"include"});if(!ve.ok){const Je=await ve.json();throw new Error(((P=Je.error)==null?void 0:P.message)||"Failed")}await je()}catch(ve){g(ve.message)}}},Gt=async()=>{if(!(!n||!N||!C))try{const D=await fetch(`/api/agents/${n}/prompts/compare?a=${N}&b=${C}`,{credentials:"include"}),P=await D.json();D.ok&&E(P.data)}catch{}},Pa=async()=>{var D;if(!(!n||!B||!I)){g("");try{const P=await fetch(`/api/agents/${n}/prompts/ab-tests`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({variantAId:B,variantBId:I,name:X||void 0,splitPercent:J})});if(!P.ok){const ve=await P.json();throw new Error(((D=ve.error)==null?void 0:D.message)||"Failed")}ce(!1),await je()}catch(P){g(P.message)}}},Et=async(D,P)=>{if(n)try{(await fetch(`/api/agents/${n}/prompts/ab-tests/${D}/complete`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({winnerId:P})})).ok&&await je()}catch{}},ga=async()=>{if(n){g("");try{const D=i.find(Je=>Je.isActive);if(!D){g("No active version to rollback from.");return}const P=i.indexOf(D),ve=i[P+1];if(!ve){g("No previous version to rollback to.");return}await Pe(ve.id)}catch(D){g(D.message)}}},Ge=async()=>{var D;if(!(!n||!T||!ie)){g("");try{const P=await fetch(`/api/agents/${n}/experiments`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:de||`Experiment ${new Date().toISOString().slice(0,10)}`,variantAId:T,variantBId:ie,trafficSplit:be})});if(!P.ok){const ve=await P.json();throw new Error(((D=ve.error)==null?void 0:D.message)||"Failed")}we(!1),me(""),Y(""),$(""),await je()}catch(P){g(P.message)}}},xt=async(D,P)=>{try{(await fetch(`/api/experiments/${D}/complete`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({winnerId:P})})).ok&&await je()}catch{}};return f?t.jsx("div",{className:"flex h-64 items-center justify-center text-zinc-400",children:"Loading..."}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Prompt Versions"}),t.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"Manage, compare, and A/B test prompt versions for this agent."})]}),t.jsxs("div",{className:"flex gap-2",children:[i.length>=2&&t.jsxs("button",{onClick:ga,className:"flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-2 text-sm text-zinc-300 hover:bg-surface-hover",children:[t.jsx(w0,{className:"h-4 w-4"})," Rollback"]}),t.jsxs("button",{onClick:()=>we(!0),className:"flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-2 text-sm text-zinc-300 hover:bg-surface-hover",children:[t.jsx(Ft,{className:"h-4 w-4"})," New Experiment"]}),t.jsxs("button",{onClick:()=>ce(!0),className:"flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-2 text-sm text-zinc-300 hover:bg-surface-hover",children:[t.jsx(zd,{className:"h-4 w-4"})," New A/B Test"]}),t.jsxs("button",{onClick:()=>w(!0),className:"flex items-center gap-2 rounded-lg bg-indigo-600 px-3 py-2 text-sm font-medium text-white hover:bg-indigo-700",children:[t.jsx(gt,{className:"h-4 w-4"})," New Version"]})]})]}),b&&t.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-sm text-red-400",children:b}),p&&t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"text-sm font-medium text-white",children:"Create New Version"}),t.jsx("button",{onClick:()=>w(!1),className:"text-zinc-400 hover:text-white",children:t.jsx(tt,{className:"h-4 w-4"})})]}),t.jsx("input",{type:"text",value:k,onChange:D=>z(D.target.value),placeholder:"Version name (optional)",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white"}),t.jsx("textarea",{value:v,onChange:D=>y(D.target.value),placeholder:"System prompt...",rows:8,className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white font-mono"}),t.jsx("button",{onClick:Ze,disabled:!v.trim(),className:"rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 disabled:opacity-50",children:"Create Version"})]}),t.jsxs("div",{className:"space-y-2",children:[i.map(D=>t.jsxs("div",{className:`rounded-lg border p-4 ${D.isActive?"border-indigo-500/50 bg-indigo-500/5":"border-border bg-surface"}`,children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-surface text-sm font-bold text-zinc-300",children:["v",D.version]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"font-medium text-white",children:D.name||`Version ${D.version}`}),D.isActive&&t.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-green-500/20 px-2 py-0.5 text-xs text-green-400",children:[t.jsx(pt,{className:"h-3 w-3"})," Active"]})]}),t.jsxs("div",{className:"mt-1 flex items-center gap-4 text-xs text-zinc-400",children:[t.jsxs("span",{children:[D.totalRuns," runs"]}),t.jsxs("span",{children:["Score: ",D.performanceScore!=null?`${(D.performanceScore*100).toFixed(0)}%`:"N/A"]}),t.jsxs("span",{children:["Avg cost: $",D.avgCostUsd.toFixed(4)]}),t.jsxs("span",{children:["Avg duration: ",D.avgDurationMs.toFixed(0),"ms"]})]})]})]}),t.jsx("div",{className:"flex items-center gap-2",children:!D.isActive&&t.jsx("button",{onClick:()=>Pe(D.id),className:"rounded-lg border border-border px-3 py-1.5 text-xs text-zinc-300 hover:bg-surface-hover",children:"Activate"})})]}),t.jsx("div",{className:"mt-3 rounded-lg bg-background p-3",children:t.jsxs("pre",{className:"max-h-24 overflow-y-auto text-xs text-zinc-400 font-mono whitespace-pre-wrap",children:[D.systemPrompt.slice(0,500),D.systemPrompt.length>500?"...":""]})})]},D.id)),i.length===0&&t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-8 text-center text-zinc-400",children:[t.jsx(an,{className:"mx-auto mb-2 h-8 w-8"}),"No prompt versions yet. Create your first version."]})]}),i.length>=2&&t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4 space-y-3",children:[t.jsxs("h3",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[t.jsx(ka,{className:"h-4 w-4"})," Compare Versions"]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("select",{value:N,onChange:D=>S(D.target.value),className:"flex-1 rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"",children:"Select version A"}),i.map(D=>t.jsxs("option",{value:D.id,children:["v",D.version," - ",D.name||`Version ${D.version}`]},D.id))]}),t.jsx(g0,{className:"h-4 w-4 text-zinc-400 flex-shrink-0"}),t.jsxs("select",{value:C,onChange:D=>O(D.target.value),className:"flex-1 rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"",children:"Select version B"}),i.map(D=>t.jsxs("option",{value:D.id,children:["v",D.version," - ",D.name||`Version ${D.version}`]},D.id))]}),t.jsx("button",{onClick:Gt,disabled:!N||!C||N===C,className:"rounded-lg bg-indigo-600 px-4 py-2 text-sm text-white hover:bg-indigo-700 disabled:opacity-50",children:"Compare"})]}),M&&t.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-4",children:[t.jsxs("div",{className:"rounded-lg border border-border bg-background p-3",children:[t.jsxs("h4",{className:"text-sm font-medium text-indigo-400 mb-2",children:["Variant A (v",M.variantA.version,")"]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Success Rate"}),t.jsxs("span",{className:"text-white",children:[(M.aSuccessRate*100).toFixed(1),"%"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Cost"}),t.jsxs("span",{className:"text-white",children:["$",M.aCostAvg.toFixed(4)]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Duration"}),t.jsxs("span",{className:"text-white",children:[M.aDurationAvg.toFixed(0),"ms"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Total Runs"}),t.jsx("span",{className:"text-white",children:M.variantA.totalRuns})]})]})]}),t.jsxs("div",{className:"rounded-lg border border-border bg-background p-3",children:[t.jsxs("h4",{className:"text-sm font-medium text-emerald-400 mb-2",children:["Variant B (v",M.variantB.version,")"]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Success Rate"}),t.jsxs("span",{className:"text-white",children:[(M.bSuccessRate*100).toFixed(1),"%"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Cost"}),t.jsxs("span",{className:"text-white",children:["$",M.bCostAvg.toFixed(4)]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Duration"}),t.jsxs("span",{className:"text-white",children:[M.bDurationAvg.toFixed(0),"ms"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Total Runs"}),t.jsx("span",{className:"text-white",children:M.variantB.totalRuns})]})]})]})]})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("h3",{className:"flex items-center gap-2 text-lg font-medium text-white",children:[t.jsx(zd,{className:"h-5 w-5"})," A/B Tests"]}),ae&&t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h4",{className:"text-sm font-medium text-white",children:"New A/B Test"}),t.jsx("button",{onClick:()=>ce(!1),className:"text-zinc-400 hover:text-white",children:t.jsx(tt,{className:"h-4 w-4"})})]}),t.jsx("input",{type:"text",value:X,onChange:D=>le(D.target.value),placeholder:"Test name (optional)",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white"}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("select",{value:B,onChange:D=>q(D.target.value),className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"",children:"Variant A"}),i.map(D=>t.jsxs("option",{value:D.id,children:["v",D.version," - ",D.name||`Version ${D.version}`]},D.id))]}),t.jsxs("select",{value:I,onChange:D=>W(D.target.value),className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"",children:"Variant B"}),i.map(D=>t.jsxs("option",{value:D.id,children:["v",D.version," - ",D.name||`Version ${D.version}`]},D.id))]})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"text-xs text-zinc-400",children:["Traffic split: ",J,"% A / ",100-J,"% B"]}),t.jsx("input",{type:"range",min:10,max:90,value:J,onChange:D=>re(Number(D.target.value)),className:"w-full"})]}),t.jsx("button",{onClick:Pa,disabled:!B||!I||B===I,className:"rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 disabled:opacity-50",children:"Start Test"})]}),c.map(D=>{const P=i.find(Je=>Je.id===D.variantAId),ve=i.find(Je=>Je.id===D.variantBId);return t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(zd,{className:"h-4 w-4 text-indigo-400"}),t.jsx("span",{className:"font-medium text-white",children:D.name}),t.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs ${D.status==="running"?"bg-green-500/20 text-green-400":D.status==="completed"?"bg-blue-500/20 text-blue-400":"bg-zinc-500/20 text-zinc-400"}`,children:D.status})]}),t.jsxs("span",{className:"text-xs text-zinc-400",children:[D.totalRuns," runs"]})]}),t.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-3 text-xs",children:[t.jsxs("div",{className:"rounded bg-background p-2",children:[t.jsxs("div",{className:"text-zinc-400",children:["Variant A (",D.splitPercent,"%)"]}),t.jsxs("div",{className:"text-white mt-1",children:["v",(P==null?void 0:P.version)??"?"," - ",(P==null?void 0:P.name)||"unnamed"]}),P&&t.jsxs("div",{className:"text-zinc-400 mt-1",children:["Score: ",P.performanceScore!=null?`${(P.performanceScore*100).toFixed(0)}%`:"N/A"]})]}),t.jsxs("div",{className:"rounded bg-background p-2",children:[t.jsxs("div",{className:"text-zinc-400",children:["Variant B (",100-D.splitPercent,"%)"]}),t.jsxs("div",{className:"text-white mt-1",children:["v",(ve==null?void 0:ve.version)??"?"," - ",(ve==null?void 0:ve.name)||"unnamed"]}),ve&&t.jsxs("div",{className:"text-zinc-400 mt-1",children:["Score: ",ve.performanceScore!=null?`${(ve.performanceScore*100).toFixed(0)}%`:"N/A"]})]})]}),D.status==="running"&&P&&ve&&t.jsxs("div",{className:"mt-3 flex gap-2",children:[t.jsxs("button",{onClick:()=>Et(D.id,D.variantAId),className:"flex items-center gap-1 rounded-lg border border-border px-3 py-1.5 text-xs text-indigo-400 hover:bg-surface-hover",children:[t.jsx(Kn,{className:"h-3 w-3"})," A wins"]}),t.jsxs("button",{onClick:()=>Et(D.id,D.variantBId),className:"flex items-center gap-1 rounded-lg border border-border px-3 py-1.5 text-xs text-emerald-400 hover:bg-surface-hover",children:[t.jsx(Kn,{className:"h-3 w-3"})," B wins"]})]}),D.winnerId&&t.jsxs("div",{className:"mt-2 flex items-center gap-1 text-xs text-yellow-400",children:[t.jsx(Kn,{className:"h-3 w-3"}),"Winner: v",D.winnerId===D.variantAId?P==null?void 0:P.version:ve==null?void 0:ve.version]})]},D.id)}),c.length===0&&!ae&&t.jsx("div",{className:"rounded-lg border border-border bg-surface p-6 text-center text-zinc-400 text-sm",children:"No A/B tests yet. Create one to compare prompt performance."})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("h3",{className:"flex items-center gap-2 text-lg font-medium text-white",children:[t.jsx(Ft,{className:"h-5 w-5"})," Experiments"]}),oe&&t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h4",{className:"text-sm font-medium text-white",children:"New Experiment"}),t.jsx("button",{onClick:()=>we(!1),className:"text-zinc-400 hover:text-white",children:t.jsx(tt,{className:"h-4 w-4"})})]}),t.jsx("input",{type:"text",value:de,onChange:D=>me(D.target.value),placeholder:"Experiment name",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white"}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("select",{value:T,onChange:D=>Y(D.target.value),className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"",children:"Variant A"}),i.map(D=>t.jsxs("option",{value:D.id,children:["v",D.version," - ",D.name||`Version ${D.version}`]},D.id))]}),t.jsxs("select",{value:ie,onChange:D=>$(D.target.value),className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"",children:"Variant B"}),i.map(D=>t.jsxs("option",{value:D.id,children:["v",D.version," - ",D.name||`Version ${D.version}`]},D.id))]})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"text-xs text-zinc-400",children:["Traffic split: ",Math.round(be*100),"% A / ",Math.round((1-be)*100),"% B"]}),t.jsx("input",{type:"range",min:10,max:90,value:be*100,onChange:D=>Ce(Number(D.target.value)/100),className:"w-full"})]}),t.jsx("button",{onClick:Ge,disabled:!T||!ie||T===ie,className:"rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 disabled:opacity-50",children:"Start Experiment"})]}),ge.map(D=>{const P=ee[D.id];return t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Ft,{className:"h-4 w-4 text-indigo-400"}),t.jsx("span",{className:"font-medium text-white",children:D.name}),t.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs ${D.status==="running"?"bg-green-500/20 text-green-400":D.status==="completed"?"bg-blue-500/20 text-blue-400":D.status==="paused"?"bg-yellow-500/20 text-yellow-400":"bg-zinc-500/20 text-zinc-400"}`,children:D.status})]}),t.jsxs("span",{className:"text-xs text-zinc-400",children:["Split: ",Math.round(D.trafficSplit*100),"% / ",Math.round((1-D.trafficSplit)*100),"%"]})]}),P&&t.jsxs("div",{className:"mt-4 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"rounded-lg border border-indigo-500/20 bg-background p-3",children:[t.jsxs("h5",{className:"text-xs font-medium text-indigo-400 mb-2",children:["Variant A (v",P.variantA.version.version,")"]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Runs"}),t.jsx("span",{className:"text-white",children:P.variantA.runs})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Success Rate"}),t.jsxs("span",{className:"text-white",children:[(P.variantA.successRate*100).toFixed(1),"%"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Cost"}),t.jsxs("span",{className:"text-white",children:["$",P.variantA.avgCostUsd.toFixed(4)]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Duration"}),t.jsxs("span",{className:"text-white",children:[P.variantA.avgDurationMs.toFixed(0),"ms"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Feedback"}),t.jsx("span",{className:"text-white",children:P.variantA.avgFeedbackScore.toFixed(2)})]})]})]}),t.jsxs("div",{className:"rounded-lg border border-emerald-500/20 bg-background p-3",children:[t.jsxs("h5",{className:"text-xs font-medium text-emerald-400 mb-2",children:["Variant B (v",P.variantB.version.version,")"]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Runs"}),t.jsx("span",{className:"text-white",children:P.variantB.runs})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Success Rate"}),t.jsxs("span",{className:"text-white",children:[(P.variantB.successRate*100).toFixed(1),"%"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Cost"}),t.jsxs("span",{className:"text-white",children:["$",P.variantB.avgCostUsd.toFixed(4)]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Duration"}),t.jsxs("span",{className:"text-white",children:[P.variantB.avgDurationMs.toFixed(0),"ms"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Feedback"}),t.jsx("span",{className:"text-white",children:P.variantB.avgFeedbackScore.toFixed(2)})]})]})]})]}),t.jsxs("div",{className:"space-y-2 rounded-lg bg-background p-3",children:[t.jsxs("div",{className:"flex items-center justify-between text-xs mb-2",children:[t.jsx("span",{className:"text-indigo-400",children:"Variant A"}),t.jsx("span",{className:"text-emerald-400",children:"Variant B"})]}),t.jsx(Ed,{label:"Success Rate",valueA:P.variantA.successRate,valueB:P.variantB.successRate,format:ve=>`${(ve*100).toFixed(0)}%`}),t.jsx(Ed,{label:"Avg Cost",valueA:P.variantA.avgCostUsd,valueB:P.variantB.avgCostUsd,format:ve=>`$${ve.toFixed(3)}`}),t.jsx(Ed,{label:"Duration",valueA:P.variantA.avgDurationMs,valueB:P.variantB.avgDurationMs,format:ve=>`${ve.toFixed(0)}ms`})]}),t.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-background p-3 text-xs",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ka,{className:"h-3.5 w-3.5 text-zinc-400"}),t.jsxs("span",{className:"text-zinc-400",children:["p-value: ",P.statisticalSignificance.toFixed(4)]}),P.statisticalSignificance<.05&&t.jsx("span",{className:"rounded-full bg-green-500/20 px-2 py-0.5 text-green-400",children:"Significant"})]}),t.jsx("span",{className:`font-medium ${P.recommendation==="A"?"text-indigo-400":P.recommendation==="B"?"text-emerald-400":"text-zinc-400"}`,children:P.recommendation==="insufficient_data"?"Need more data":`Recommendation: Variant ${P.recommendation}`})]}),D.status==="running"&&P.variantA.runs>0&&P.variantB.runs>0&&t.jsxs("div",{className:"flex gap-2",children:[t.jsxs("button",{onClick:()=>xt(D.id,D.variantAId),className:"flex items-center gap-1 rounded-lg border border-border px-3 py-1.5 text-xs text-indigo-400 hover:bg-surface-hover",children:[t.jsx(Kn,{className:"h-3 w-3"})," A wins"]}),t.jsxs("button",{onClick:()=>xt(D.id,D.variantBId),className:"flex items-center gap-1 rounded-lg border border-border px-3 py-1.5 text-xs text-emerald-400 hover:bg-surface-hover",children:[t.jsx(Kn,{className:"h-3 w-3"})," B wins"]})]}),D.winnerId&&t.jsxs("div",{className:"flex items-center gap-1 text-xs text-yellow-400",children:[t.jsx(Kn,{className:"h-3 w-3"}),"Winner: ",D.winnerId===D.variantAId?"Variant A":"Variant B"]})]}),!P&&t.jsx("div",{className:"mt-3 text-xs text-zinc-500",children:"No runs yet. Run the agent to start collecting data."})]},D.id)}),ge.length===0&&!oe&&t.jsx("div",{className:"rounded-lg border border-border bg-surface p-6 text-center text-zinc-400 text-sm",children:"No experiments yet. Create one to A/B test prompts with per-run metrics and statistical analysis."})]})]})}const _0="/api";async function Or(n){const i=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};i&&(d.Authorization=`Bearer ${i}`);const c=await fetch(`${_0}${n}`,{headers:d});if(!c.ok)throw new Error(`API error: ${c.status}`);return c.json()}async function f1(n){const i=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};i&&(d.Authorization=`Bearer ${i}`);const c=await fetch(`${_0}${n}`,{method:"DELETE",headers:d});if(!c.ok)throw new Error(`API error: ${c.status}`)}const h1={observation:"bg-blue-500/20 text-blue-400",fact:"bg-green-500/20 text-green-400",instruction:"bg-purple-500/20 text-purple-400",reflection:"bg-amber-500/20 text-amber-400"};function Yh({type:n}){return t.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${h1[n]??"bg-zinc-500/20 text-zinc-400"}`,children:n})}function p1({value:n}){const i=Math.round(n*100),d=i>=80?"bg-red-500":i>=50?"bg-amber-500":"bg-green-500";return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"h-1.5 w-16 rounded-full bg-zinc-700",children:t.jsx("div",{className:`h-full rounded-full ${d}`,style:{width:`${i}%`}})}),t.jsxs("span",{className:"text-xs text-zinc-500",children:[i,"%"]})]})}function Lr({label:n,value:i,icon:d}){return t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 text-zinc-400",children:[t.jsx(d,{className:"h-4 w-4"}),t.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",children:n})]}),t.jsx("p",{className:"mt-2 text-2xl font-semibold text-white",children:i})]})}function g1(){const{t:n}=nt(),[i,d]=u.useState([]),[c,m]=u.useState([]),[f,h]=u.useState(null),[b,g]=u.useState(!0),[p,w]=u.useState(""),[v,y]=u.useState(""),[k,z]=u.useState(""),[N,S]=u.useState(null);u.useEffect(()=>{Or("/agents").then(E=>m(E.data)).catch(console.error)},[]);const C=u.useCallback(async()=>{g(!0);try{const E=new URLSearchParams;p&&E.set("q",p),v&&E.set("agentId",v),k&&E.set("type",k),E.set("limit","100");const ae=E.toString(),ce=await Or(`/memory?${ae}`);if(d(ce.data),v){const B=await Or(`/memory/stats/${v}`);h(B.data)}else if(c.length>0){let B=0,q=0;const I={};let W=!1;for(const X of c)try{const le=await Or(`/memory/stats/${X.id}`);B+=le.data.total,q+=le.data.avgImportance*le.data.total;for(const[J,re]of Object.entries(le.data.byType))I[J]=(I[J]??0)+re;le.data.fts5Available&&(W=!0)}catch{}h({total:B,byType:I,avgImportance:B>0?q/B:0,fts5Available:W})}}catch(E){console.error("Failed to load memories:",E)}finally{g(!1)}},[p,v,k,c]);u.useEffect(()=>{(c.length>0||v)&&C()},[C,c.length,v]);const O=async E=>{S(E);try{await f1(`/memory/${E}`),d(ae=>ae.filter(ce=>ce.id!==E))}catch(ae){console.error("Failed to delete memory:",ae)}finally{S(null)}},M=E=>{E.preventDefault(),C()};return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Es,{className:"h-6 w-6 text-indigo-400"}),t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Memory"})]}),(f==null?void 0:f.fts5Available)&&t.jsx("span",{className:"rounded-full bg-green-500/10 px-3 py-1 text-xs font-medium text-green-400",children:"FTS5 Active"})]}),f&&t.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[t.jsx(Lr,{label:"Total Memories",value:f.total,icon:Es}),t.jsx(Lr,{label:"Avg Importance",value:`${Math.round(f.avgImportance*100)}%`,icon:ka}),t.jsx(Lr,{label:"Types",value:Object.keys(f.byType).length,icon:kv}),t.jsx(Lr,{label:"Observations",value:f.byType.observation??0,icon:Xn})]}),f&&Object.keys(f.byType).length>0&&t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4",children:[t.jsx("h3",{className:"mb-3 text-sm font-medium text-zinc-400",children:"Distribution by Type"}),t.jsx("div",{className:"flex gap-4",children:Object.entries(f.byType).map(([E,ae])=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Yh,{type:E}),t.jsx("span",{className:"text-sm text-white",children:ae})]},E))})]}),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[t.jsxs("form",{onSubmit:M,className:"flex flex-1 gap-2",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(Rs,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),t.jsx("input",{type:"text",value:p,onChange:E=>w(E.target.value),placeholder:"Search memories...",className:"w-full rounded-lg border border-border bg-surface py-2 pl-10 pr-4 text-sm text-white placeholder:text-zinc-500 focus:border-indigo-500 focus:outline-none"})]}),t.jsx("button",{type:"submit",className:"rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-500",children:"Search"})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsxs("select",{value:v,onChange:E=>y(E.target.value),className:"rounded-lg border border-border bg-surface px-3 py-2 text-sm text-white focus:border-indigo-500 focus:outline-none",children:[t.jsx("option",{value:"",children:"All Agents"}),c.map(E=>t.jsx("option",{value:E.id,children:E.name},E.id))]}),t.jsxs("select",{value:k,onChange:E=>z(E.target.value),className:"rounded-lg border border-border bg-surface px-3 py-2 text-sm text-white focus:border-indigo-500 focus:outline-none",children:[t.jsx("option",{value:"",children:"All Types"}),t.jsx("option",{value:"observation",children:"Observation"}),t.jsx("option",{value:"fact",children:"Fact"}),t.jsx("option",{value:"instruction",children:"Instruction"}),t.jsx("option",{value:"reflection",children:"Reflection"})]})]})]}),b?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):i.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-border bg-surface py-16",children:[t.jsx(Es,{className:"h-12 w-12 text-zinc-600"}),t.jsx("p",{className:"mt-4 text-sm text-zinc-400",children:"No memories found"}),t.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Memories are created when agents store observations, facts, and reflections."})]}):t.jsx("div",{className:"space-y-2",children:i.map(E=>t.jsx("div",{className:"group rounded-lg border border-border bg-surface p-4 transition-colors hover:border-border/80",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx(Yh,{type:E.memoryType}),t.jsx(p1,{value:E.importance}),t.jsxs("span",{className:"text-xs text-zinc-500",children:[new Date(E.createdAt*1e3).toLocaleDateString()," ",new Date(E.createdAt*1e3).toLocaleTimeString()]}),E.accessCount>0&&t.jsxs("span",{className:"text-xs text-zinc-600",children:["accessed ",E.accessCount,"x"]})]}),t.jsx("p",{className:"mt-2 text-sm text-zinc-200 leading-relaxed",children:E.content}),E.tags.length>0&&t.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:E.tags.map(ae=>t.jsxs("span",{className:"inline-flex items-center rounded bg-zinc-800 px-1.5 py-0.5 text-[10px] text-zinc-400",children:["#",ae]},ae))})]}),t.jsx("button",{onClick:()=>O(E.id),disabled:N===E.id,className:"rounded p-1.5 text-zinc-500 opacity-0 transition-all hover:bg-red-500/10 hover:text-red-400 group-hover:opacity-100 disabled:opacity-50",title:"Delete memory",children:N===E.id?t.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border border-red-400 border-t-transparent"}):t.jsx(qt,{className:"h-4 w-4"})})]})},E.id))})]})}const b1="/api/budget";function y1(){const n={"Content-Type":"application/json"},i=localStorage.getItem("nestor_token");return i&&(n.Authorization=`Bearer ${i}`),n}async function Cs(n,i){const d=await fetch(`${b1}${n}`,{...i,headers:y1()});if(!d.ok)throw new Error(`API error: ${d.status}`);if(d.status!==204)return d.json()}const Ps={listPolicies:()=>Cs("/policies"),createPolicy:n=>Cs("/policies",{method:"POST",body:JSON.stringify(n)}),updatePolicy:(n,i)=>Cs(`/policies/${n}`,{method:"PUT",body:JSON.stringify(i)}),deletePolicy:n=>Cs(`/policies/${n}`,{method:"DELETE"}),utilization:()=>Cs("/utilization"),incidents:(n=50)=>Cs(`/incidents?limit=${n}`),pauseAgent:n=>Cs(`/agents/${n}/pause`,{method:"POST",body:"{}"}),resumeAgent:n=>Cs(`/agents/${n}/resume`,{method:"POST",body:"{}"})};function qd(n){return n<.01?`$${n.toFixed(4)}`:n<1?`$${n.toFixed(3)}`:`$${n.toFixed(2)}`}function U0(n){return new Date(n*1e3).toLocaleString()}function B0(n){switch(n){case"warning":return"text-amber-400";case"breach":return"text-red-400";case"pause":return"text-orange-400";case"resume":return"text-emerald-400";default:return"text-zinc-400"}}function v1(n){return n>=90?"bg-red-500":n>=70?"bg-amber-500":"bg-emerald-500"}function Xh({initial:n,onSave:i,onCancel:d}){const[c,m]=u.useState((n==null?void 0:n.name)??""),[f,h]=u.useState((n==null?void 0:n.scope)??"global"),[b,g]=u.useState((n==null?void 0:n.scopeId)??""),[p,w]=u.useState((n==null?void 0:n.window)??"monthly"),[v,y]=u.useState(String((n==null?void 0:n.limitUsd)??10)),[k,z]=u.useState(String((n==null?void 0:n.warningThresholdPercent)??80)),[N,S]=u.useState((n==null?void 0:n.action)??"stop"),[C,O]=u.useState((n==null?void 0:n.enabled)!==!1),M=E=>{E.preventDefault(),i({name:c,scope:f,scopeId:b||null,window:p,limitUsd:parseFloat(v)||10,warningThresholdPercent:parseFloat(k)||80,action:N,enabled:C})};return t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:t.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-surface p-6",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("h3",{className:"text-lg font-semibold text-white",children:n!=null&&n.id?"Edit Policy":"New Budget Policy"}),t.jsx("button",{onClick:d,className:"text-zinc-400 hover:text-white",children:t.jsx(tt,{className:"h-5 w-5"})})]}),t.jsxs("form",{onSubmit:M,className:"space-y-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:"Name"}),t.jsx("input",{value:c,onChange:E=>m(E.target.value),required:!0,className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white"})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:"Scope"}),t.jsxs("select",{value:f,onChange:E=>h(E.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"global",children:"Global"}),t.jsx("option",{value:"agent",children:"Agent"}),t.jsx("option",{value:"workflow",children:"Workflow"}),t.jsx("option",{value:"tenant",children:"Tenant"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:"Scope ID"}),t.jsx("input",{value:b,onChange:E=>g(E.target.value),placeholder:"(optional)",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white"})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:"Window"}),t.jsxs("select",{value:p,onChange:E=>w(E.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"per_run",children:"Per Run"}),t.jsx("option",{value:"hourly",children:"Hourly"}),t.jsx("option",{value:"daily",children:"Daily"}),t.jsx("option",{value:"weekly",children:"Weekly"}),t.jsx("option",{value:"monthly",children:"Monthly"}),t.jsx("option",{value:"lifetime",children:"Lifetime"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:"Limit (USD)"}),t.jsx("input",{type:"number",step:"0.01",min:"0",value:v,onChange:E=>y(E.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white"})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:"Warning at (%)"}),t.jsx("input",{type:"number",step:"1",min:"0",max:"100",value:k,onChange:E=>z(E.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:"Action"}),t.jsxs("select",{value:N,onChange:E=>S(E.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"stop",children:"Stop"}),t.jsx("option",{value:"pause",children:"Pause"}),t.jsx("option",{value:"warn",children:"Warn"}),t.jsx("option",{value:"notify",children:"Notify"})]})]})]}),t.jsxs("label",{className:"flex items-center gap-2 text-sm text-zinc-300",children:[t.jsx("input",{type:"checkbox",checked:C,onChange:E=>O(E.target.checked),className:"rounded border-border"}),"Enabled"]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[t.jsx("button",{type:"button",onClick:d,className:"px-4 py-2 text-sm text-zinc-400 hover:text-white",children:"Cancel"}),t.jsx("button",{type:"submit",className:"rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-500",children:"Save"})]})]})]})})}function j1({report:n}){const i=n.policy;return t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsxs("div",{children:[t.jsx("h4",{className:"text-sm font-medium text-white",children:i.name}),t.jsxs("p",{className:"text-xs text-zinc-500",children:[i.scope,i.scopeId?` / ${i.scopeId}`:""," · ",i.window," · ",i.action]})]}),t.jsx("span",{className:`text-xs font-medium ${i.enabled?"text-emerald-400":"text-zinc-500"}`,children:i.enabled?"Active":"Disabled"})]}),t.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs text-zinc-400",children:[t.jsxs("span",{children:[qd(n.spentUsd)," / ",qd(i.limitUsd)]}),t.jsxs("span",{children:[n.utilizationPercent.toFixed(1),"%"]})]}),t.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-zinc-800",children:t.jsx("div",{className:`h-full rounded-full transition-all ${v1(n.utilizationPercent)}`,style:{width:`${Math.min(100,n.utilizationPercent)}%`}})}),n.incidents.length>0&&t.jsxs("div",{className:"mt-2 text-xs text-zinc-500",children:["Last incident: ",t.jsx("span",{className:B0(n.incidents[0].type),children:n.incidents[0].type})," ",U0(n.incidents[0].createdAt)]})]})}function N1(){const{t:n}=nt(),[i,d]=u.useState([]),[c,m]=u.useState([]),[f,h]=u.useState([]),[b,g]=u.useState(!0),[p,w]=u.useState(null),[v,y]=u.useState(!1),[k,z]=u.useState(null),N=u.useCallback(async()=>{try{g(!0),w(null);const[E,ae,ce]=await Promise.all([Ps.listPolicies(),Ps.utilization(),Ps.incidents(50)]);d(E.data),m(ae.data),h(ce.data)}catch(E){w(E instanceof Error?E.message:"Failed to load budget data")}finally{g(!1)}},[]);u.useEffect(()=>{N()},[N]);const S=async E=>{try{await Ps.createPolicy(E),y(!1),await N()}catch(ae){w(ae instanceof Error?ae.message:"Failed to create policy")}},C=async E=>{if(k)try{await Ps.updatePolicy(k.id,E),z(null),await N()}catch(ae){w(ae instanceof Error?ae.message:"Failed to update policy")}},O=async E=>{if(confirm("Delete this budget policy?"))try{await Ps.deletePolicy(E),await N()}catch(ae){w(ae instanceof Error?ae.message:"Failed to delete policy")}},M=async E=>{try{await Ps.resumeAgent(E),await N()}catch(ae){w(ae instanceof Error?ae.message:"Failed to resume agent")}};return b?t.jsx("div",{className:"flex h-64 items-center justify-center text-zinc-400",children:"Loading budget data..."}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-bold text-white",children:"Budget Management"}),t.jsx("p",{className:"text-sm text-zinc-400",children:"Scoped budget policies, utilization tracking, and cost control."})]}),t.jsxs("button",{onClick:()=>y(!0),className:"flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-500",children:[t.jsx(gt,{className:"h-4 w-4"})," New Policy"]})]}),p&&t.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-400",children:p}),c.length>0&&t.jsxs("section",{children:[t.jsx("h2",{className:"mb-3 text-lg font-semibold text-white",children:"Utilization"}),t.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",children:c.map(E=>t.jsx(j1,{report:E},E.policy.id))})]}),t.jsxs("section",{children:[t.jsx("h2",{className:"mb-3 text-lg font-semibold text-white",children:"Policies"}),i.length===0?t.jsx("div",{className:"card text-center text-sm text-zinc-500 py-8",children:'No budget policies configured. Click "New Policy" to create one.'}):t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-left text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border text-zinc-500",children:[t.jsx("th",{className:"py-2 px-3 font-medium",children:"Name"}),t.jsx("th",{className:"py-2 px-3 font-medium",children:"Scope"}),t.jsx("th",{className:"py-2 px-3 font-medium",children:"Window"}),t.jsx("th",{className:"py-2 px-3 font-medium",children:"Limit"}),t.jsx("th",{className:"py-2 px-3 font-medium",children:"Action"}),t.jsx("th",{className:"py-2 px-3 font-medium",children:"Status"}),t.jsx("th",{className:"py-2 px-3 font-medium text-right",children:"Actions"})]})}),t.jsx("tbody",{children:i.map(E=>t.jsxs("tr",{className:"border-b border-border/50 hover:bg-surface-hover transition-colors",children:[t.jsx("td",{className:"py-2.5 px-3 text-white font-medium",children:E.name}),t.jsxs("td",{className:"py-2.5 px-3 text-zinc-300",children:[E.scope,E.scopeId?t.jsxs("span",{className:"text-zinc-500",children:[" / ",E.scopeId]}):""]}),t.jsx("td",{className:"py-2.5 px-3 text-zinc-300",children:E.window}),t.jsx("td",{className:"py-2.5 px-3 text-zinc-300",children:qd(E.limitUsd)}),t.jsx("td",{className:"py-2.5 px-3",children:t.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${E.action==="stop"?"bg-red-500/10 text-red-400":E.action==="pause"?"bg-orange-500/10 text-orange-400":E.action==="warn"?"bg-amber-500/10 text-amber-400":"bg-blue-500/10 text-blue-400"}`,children:E.action})}),t.jsx("td",{className:"py-2.5 px-3",children:t.jsx("span",{className:`text-xs ${E.enabled?"text-emerald-400":"text-zinc-500"}`,children:E.enabled?"Enabled":"Disabled"})}),t.jsx("td",{className:"py-2.5 px-3 text-right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsx("button",{onClick:()=>z(E),className:"p-1 text-zinc-400 hover:text-white",title:"Edit",children:t.jsx(jv,{className:"h-3.5 w-3.5"})}),t.jsx("button",{onClick:()=>O(E.id),className:"p-1 text-zinc-400 hover:text-red-400",title:"Delete",children:t.jsx(qt,{className:"h-3.5 w-3.5"})})]})})]},E.id))})]})})]}),t.jsxs("section",{children:[t.jsx("h2",{className:"mb-3 text-lg font-semibold text-white",children:"Recent Incidents"}),f.length===0?t.jsx("div",{className:"card text-center text-sm text-zinc-500 py-6",children:"No budget incidents recorded."}):t.jsx("div",{className:"space-y-1",children:f.map(E=>t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border/30 bg-surface px-4 py-2.5 text-sm",children:[t.jsx("span",{className:`font-medium ${B0(E.type)}`,children:E.type.toUpperCase()}),t.jsx("span",{className:"flex-1 text-zinc-300 truncate",children:E.message}),E.agentId&&t.jsxs("span",{className:"text-xs text-zinc-500",children:["Agent: ",E.agentId.slice(0,8)]}),t.jsx("span",{className:"text-xs text-zinc-500",children:U0(E.createdAt)}),E.type==="pause"&&E.agentId&&t.jsxs("button",{onClick:()=>M(E.agentId),className:"flex items-center gap-1 rounded bg-emerald-600/20 px-2 py-1 text-xs text-emerald-400 hover:bg-emerald-600/30",children:[t.jsx(iv,{className:"h-3 w-3"})," Resume"]})]},E.id))})]}),v&&t.jsx(Xh,{onSave:S,onCancel:()=>y(!1)}),k&&t.jsx(Xh,{initial:k,onSave:C,onCancel:()=>z(null)})]})}const $0={mission:"Mission",objective:"Objective",key_result:"Key Result",task:"Task"},w1={mission:"bg-purple-500/10 text-purple-400 border-purple-500/20",objective:"bg-blue-500/10 text-blue-400 border-blue-500/20",key_result:"bg-cyan-500/10 text-cyan-400 border-cyan-500/20",task:"bg-green-500/10 text-green-400 border-green-500/20"},S1={active:en,completed:ut,paused:Zr,cancelled:tt},k1={active:"text-indigo-400",completed:"text-green-400",paused:"text-amber-400",cancelled:"text-zinc-500"};function H0({goal:n,depth:i,agents:d,onEdit:c,onDelete:m,onStatusChange:f}){const[h,b]=u.useState(i<2),g=n.children&&n.children.length>0,p=S1[n.status]??en,w=d.find(v=>v.id===n.ownerAgentId);return t.jsxs("div",{className:"group",children:[t.jsxs("div",{className:`flex items-center gap-2 rounded-lg px-3 py-2.5 transition-colors hover:bg-surface-hover ${i===0?"bg-surface border border-border":""}`,style:{paddingLeft:`${i*24+12}px`},children:[t.jsx("button",{onClick:()=>b(!h),className:`flex h-5 w-5 flex-shrink-0 items-center justify-center rounded transition-colors ${g?"text-zinc-400 hover:text-zinc-200":"text-transparent"}`,disabled:!g,children:g&&(h?t.jsx(Fa,{className:"h-3.5 w-3.5"}):t.jsx(ca,{className:"h-3.5 w-3.5"}))}),t.jsx(p,{className:`h-4 w-4 flex-shrink-0 ${k1[n.status]}`}),t.jsx("span",{className:`inline-flex items-center rounded-md border px-1.5 py-0.5 text-[10px] font-medium uppercase ${w1[n.type]}`,children:$0[n.type]}),t.jsx("span",{className:"flex-1 truncate text-sm font-medium text-zinc-200",children:n.title}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"h-1.5 w-20 rounded-full bg-zinc-800",children:t.jsx("div",{className:"h-full rounded-full bg-indigo-500 transition-all",style:{width:`${n.progressPercent}%`}})}),t.jsxs("span",{className:"w-8 text-right text-xs text-zinc-500",children:[n.progressPercent,"%"]})]}),w&&t.jsxs("span",{className:"flex items-center gap-1 text-xs text-zinc-500",children:[t.jsx(Ja,{className:"h-3 w-3"}),w.name]}),n.dueDate&&t.jsxs("span",{className:"flex items-center gap-1 text-xs text-zinc-500",children:[t.jsx(lv,{className:"h-3 w-3"}),new Date(n.dueDate).toLocaleDateString()]}),t.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[n.status==="active"&&t.jsx("button",{onClick:()=>f(n.id,"completed"),className:"rounded p-1 text-zinc-500 hover:bg-green-500/10 hover:text-green-400",title:"Mark completed",children:t.jsx(ut,{className:"h-3.5 w-3.5"})}),n.status==="active"&&t.jsx("button",{onClick:()=>f(n.id,"paused"),className:"rounded p-1 text-zinc-500 hover:bg-amber-500/10 hover:text-amber-400",title:"Pause",children:t.jsx(Zr,{className:"h-3.5 w-3.5"})}),n.status==="paused"&&t.jsx("button",{onClick:()=>f(n.id,"active"),className:"rounded p-1 text-zinc-500 hover:bg-indigo-500/10 hover:text-indigo-400",title:"Resume",children:t.jsx(en,{className:"h-3.5 w-3.5"})}),t.jsx("button",{onClick:()=>c(n),className:"rounded p-1 text-zinc-500 hover:bg-surface-hover hover:text-zinc-200",title:"Edit",children:t.jsx(tu,{className:"h-3.5 w-3.5"})}),t.jsx("button",{onClick:()=>m(n.id),className:"rounded p-1 text-zinc-500 hover:bg-red-500/10 hover:text-red-400",title:"Delete",children:t.jsx(qt,{className:"h-3.5 w-3.5"})})]})]}),h&&g&&t.jsx("div",{children:n.children.map(v=>t.jsx(H0,{goal:v,depth:i+1,agents:d,onEdit:c,onDelete:m,onStatusChange:f},v.id))})]})}function z1({goal:n,parentGoals:i,agents:d,onSave:c,onClose:m}){const[f,h]=u.useState((n==null?void 0:n.title)??""),[b,g]=u.useState((n==null?void 0:n.description)??""),[p,w]=u.useState((n==null?void 0:n.type)??"task"),[v,y]=u.useState((n==null?void 0:n.parentId)??""),[k,z]=u.useState((n==null?void 0:n.ownerAgentId)??""),[N,S]=u.useState((n==null?void 0:n.priority)??5),[C,O]=u.useState((n==null?void 0:n.dueDate)??""),M=E=>{E.preventDefault(),c({title:f,description:b||void 0,type:p,parentId:v||null,ownerAgentId:k||void 0,priority:N,dueDate:C||void 0})};return t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:t.jsxs("div",{className:"w-full max-w-lg rounded-xl border border-border bg-surface p-6 shadow-xl",children:[t.jsx("h2",{className:"text-lg font-semibold text-white mb-4",children:n?"Edit Goal":"Create Goal"}),t.jsxs("form",{onSubmit:M,className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Title"}),t.jsx("input",{type:"text",value:f,onChange:E=>h(E.target.value),className:"input w-full",required:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Description"}),t.jsx("textarea",{value:b,onChange:E=>g(E.target.value),className:"input w-full h-20 resize-none"})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Type"}),t.jsxs("select",{value:p,onChange:E=>w(E.target.value),className:"input w-full",children:[t.jsx("option",{value:"mission",children:"Mission"}),t.jsx("option",{value:"objective",children:"Objective"}),t.jsx("option",{value:"key_result",children:"Key Result"}),t.jsx("option",{value:"task",children:"Task"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Parent"}),t.jsxs("select",{value:v,onChange:E=>y(E.target.value),className:"input w-full",children:[t.jsx("option",{value:"",children:"None (root)"}),i.map(E=>t.jsxs("option",{value:E.id,children:["[",$0[E.type],"] ",E.title]},E.id))]})]})]}),t.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Priority (1-10)"}),t.jsx("input",{type:"number",min:1,max:10,value:N,onChange:E=>S(Number(E.target.value)),className:"input w-full"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Assign Agent"}),t.jsxs("select",{value:k,onChange:E=>z(E.target.value),className:"input w-full",children:[t.jsx("option",{value:"",children:"Unassigned"}),d.map(E=>t.jsx("option",{value:E.id,children:E.name},E.id))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Due Date"}),t.jsx("input",{type:"date",value:C,onChange:E=>O(E.target.value),className:"input w-full"})]})]}),t.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[t.jsx("button",{type:"button",onClick:m,className:"btn-ghost",children:"Cancel"}),t.jsx("button",{type:"submit",className:"btn-primary",children:n?"Update":"Create"})]})]})]})})}function q0(n,i=[]){for(const d of n)i.push(d),d.children&&q0(d.children,i);return i}function C1(){const{t:n}=nt(),[i,d]=u.useState([]),[c,m]=u.useState([]),[f,h]=u.useState(!0),[b,g]=u.useState(null),[p,w]=u.useState(null),v=u.useCallback(async()=>{try{g(null);const[S,C]=await Promise.all([Jl.tree(),Ds.list()]);d(S.data),m(C.data)}catch(S){g(S instanceof Error?S.message:"Failed to fetch goals")}finally{h(!1)}},[]);u.useEffect(()=>{v()},[v]);const y=async S=>{try{p&&p!=="new"?await Jl.update(p.id,S):await Jl.create(S),w(null),v()}catch(C){console.error("Save failed:",C)}},k=async S=>{if(confirm("Delete this goal and all its children?"))try{await Jl.delete(S),v()}catch(C){console.error("Delete failed:",C)}},z=async(S,C)=>{try{await Jl.update(S,{status:C}),v()}catch(O){console.error("Status change failed:",O)}};if(f)return t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})});const N=q0(i);return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Goals"}),i.length>0&&t.jsxs("span",{className:"badge bg-indigo-500/10 text-indigo-400",children:[N.length," total"]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:v,className:"btn-ghost btn-sm",children:t.jsx(Mt,{className:"h-4 w-4"})}),t.jsxs("button",{onClick:()=>w("new"),className:"btn-primary btn-sm",children:[t.jsx(gt,{className:"h-4 w-4"}),"New Goal"]})]})]}),b&&t.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-4 text-sm text-red-400",children:[b,t.jsx("button",{onClick:v,className:"ml-3 underline",children:"Retry"})]}),i.length===0&&!b?t.jsx(tn,{icon:t.jsx(en,{className:"h-8 w-8"}),title:"No goals yet",description:"Goals let you define objectives and track AI agent progress with an OKR-style hierarchy.",action:t.jsxs("div",{className:"mt-2 space-y-3 text-left max-w-md",children:[t.jsxs("div",{className:"rounded-lg bg-zinc-900 border border-zinc-800 p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1.5 font-medium",children:"Goal hierarchy:"}),t.jsxs("ul",{className:"text-xs text-zinc-400 space-y-1",children:[t.jsxs("li",{children:[t.jsx("span",{className:"text-purple-400 font-medium",children:"Mission"})," → High-level strategic goal"]}),t.jsxs("li",{children:[t.jsx("span",{className:"text-blue-400 font-medium",children:"Objective"})," → Measurable outcome"]}),t.jsxs("li",{children:[t.jsx("span",{className:"text-cyan-400 font-medium",children:"Key Result"})," → Quantifiable metric"]}),t.jsxs("li",{children:[t.jsx("span",{className:"text-green-400 font-medium",children:"Task"})," → Actionable work item"]})]})]}),t.jsxs("button",{onClick:()=>w("new"),className:"btn-primary btn-sm",children:[t.jsx(gt,{className:"h-4 w-4"}),"Create your first goal"]})]})}):t.jsx("div",{className:"space-y-1",children:i.map(S=>t.jsx(H0,{goal:S,depth:0,agents:c,onEdit:C=>w(C),onDelete:k,onStatusChange:z},S.id))}),p!==null&&t.jsx(z1,{goal:p==="new"?null:p,parentGoals:N,agents:c,onSave:y,onClose:()=>w(null)})]})}function A1(){const n=Dt(),{t:i}=nt(),[d,c]=u.useState([]),[m,f]=u.useState(!0),[h,b]=u.useState("pending"),[g,p]=u.useState({}),[w,v]=u.useState(null),y=u.useCallback(async()=>{try{const S=h==="all"?void 0:{status:h},C=await Kr.list(S);c(C.data)}catch{}finally{f(!1)}},[h]);u.useEffect(()=>{f(!0),y()},[y]);const k=async S=>{var O;const C=(O=g[S.id])==null?void 0:O.trim();if(C){v(S.id);try{await Kr.resume(S.id,C),p(M=>{const E={...M};return delete E[S.id],E}),y()}catch(M){console.error("Resume failed:",M)}finally{v(null)}}},z=S=>{switch(S){case"pending":return t.jsx(Xn,{className:"h-4 w-4 text-amber-400"});case"resumed":return t.jsx(pt,{className:"h-4 w-4 text-green-400"});case"expired":return t.jsx(At,{className:"h-4 w-4 text-zinc-500"});default:return t.jsx(Xn,{className:"h-4 w-4 text-zinc-500"})}},N=S=>{const C={pending:"bg-amber-500/10 text-amber-400 border-amber-500/30",resumed:"bg-green-500/10 text-green-400 border-green-500/30",expired:"bg-zinc-500/10 text-zinc-400 border-zinc-500/30"};return t.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium ${C[S]??C.expired}`,children:[z(S),S]})};return m?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ti,{className:"h-6 w-6 text-amber-400"}),t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Handoffs"})]}),t.jsx("div",{className:"flex items-center gap-2",children:t.jsx("button",{onClick:y,className:"btn-ghost btn-sm",children:t.jsx(Mt,{className:"h-3.5 w-3.5"})})})]}),t.jsx("div",{className:"flex gap-2",children:["pending","resumed","expired","all"].map(S=>t.jsx("button",{className:`rounded-lg px-3 py-1.5 text-sm font-medium transition-colors ${h===S?"bg-indigo-500/10 text-indigo-400 border border-indigo-500/30":"text-zinc-400 hover:text-zinc-200 border border-transparent"}`,onClick:()=>b(S),children:S.charAt(0).toUpperCase()+S.slice(1)},S))}),d.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4 text-center",children:[t.jsx("div",{className:"mb-4 rounded-2xl bg-surface p-4 text-zinc-500",children:t.jsx(ti,{className:"h-8 w-8"})}),t.jsxs("h3",{className:"text-lg font-medium text-zinc-300",children:["No ",h==="all"?"":h+" ","handoffs"]}),t.jsx("p",{className:"mt-1.5 max-w-sm text-sm text-zinc-500",children:"Handoffs occur when an agent encounters a blocking issue and needs human help to continue."}),t.jsxs("div",{className:"mt-4 space-y-3 text-left max-w-md",children:[t.jsxs("div",{className:"rounded-lg bg-zinc-900 border border-zinc-800 p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1.5 font-medium",children:"Handoffs are created automatically when:"}),t.jsxs("ul",{className:"text-xs text-zinc-400 space-y-1 list-disc list-inside",children:[t.jsx("li",{children:"An agent needs credentials or access it doesn't have"}),t.jsx("li",{children:"A task requires human judgment or decision"}),t.jsx("li",{children:"An agent encounters an unrecoverable error"})]})]}),t.jsx("p",{className:"text-xs text-zinc-500",children:"Run a complex mission and the agent will hand off to you if it gets stuck."})]})]}):t.jsx("div",{className:"space-y-4",children:d.map(S=>{var C;return t.jsxs("div",{className:`card ${S.status==="pending"?"border-amber-500/20":""}`,children:[t.jsxs("div",{className:"flex items-start justify-between mb-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[N(S.status),t.jsxs("span",{className:"text-xs text-zinc-500 font-mono",children:[S.id.slice(0,12),"..."]})]}),t.jsx("button",{className:"text-xs text-indigo-400 hover:text-indigo-300",onClick:()=>n(`/runs/${S.runId}`),children:"View Run"})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1 font-medium",children:"Accomplished"}),t.jsx("p",{className:"text-sm text-zinc-300",children:S.accomplished})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1 font-medium",children:"Blocking"}),t.jsx("p",{className:"text-sm text-red-400",children:S.blocking})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1 font-medium",children:"Suggestions"}),t.jsx("p",{className:"text-sm text-zinc-300",children:S.suggestions})]})]}),t.jsxs("div",{className:"flex items-center gap-3 mt-3 text-xs text-zinc-500",children:[t.jsxs("span",{children:["Agent: ",S.agentId.slice(0,12),"..."]}),t.jsxs("span",{children:["Created: ",new Date(S.createdAt).toLocaleString()]}),S.resumedAt&&t.jsxs("span",{children:["Resumed: ",new Date(S.resumedAt).toLocaleString()]})]}),S.status==="pending"&&t.jsxs("div",{className:"mt-4 flex items-center gap-2 border-t border-zinc-800 pt-3",children:[t.jsx("input",{type:"text",className:"flex-1 rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-2 text-sm text-zinc-200 placeholder-zinc-500 focus:border-indigo-500 focus:outline-none",placeholder:"Describe how you resolved the blocking issue...",value:g[S.id]??"",onChange:O=>p(M=>({...M,[S.id]:O.target.value}))}),t.jsx("button",{className:"btn-primary btn-sm",disabled:!((C=g[S.id])!=null&&C.trim())||w===S.id,onClick:()=>k(S),children:w===S.id?"Resuming...":"Resume"})]})]},S.id)})})]})}const Qh={low:"bg-green-500/10 text-green-400 border-green-500/20",medium:"bg-yellow-500/10 text-yellow-400 border-yellow-500/20",high:"bg-orange-500/10 text-orange-400 border-orange-500/20",critical:"bg-red-500/10 text-red-400 border-red-500/20"};function E1({level:n}){return t.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium ${Qh[n]??Qh.low}`,children:[n==="critical"&&t.jsx(mt,{className:"h-3 w-3"}),n==="high"&&t.jsx(mt,{className:"h-3 w-3"}),n.toUpperCase()]})}const Pr="/api";async function Td(n){const i=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};i&&(d.Authorization=`Bearer ${i}`);const c=await fetch(`${Pr}/plans/${n}`,{headers:d});if(!c.ok)throw new Error(`Failed to fetch plan: ${c.statusText}`);return(await c.json()).data}async function T1(n){const i=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};i&&(d.Authorization=`Bearer ${i}`);const c=await fetch(`${Pr}/plans/${n}/execute`,{method:"POST",headers:d});if(!c.ok)throw new Error(`Failed to execute plan: ${c.statusText}`)}async function R1(n){const i=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};i&&(d.Authorization=`Bearer ${i}`);const c=await fetch(`${Pr}/plans/${n}/cancel`,{method:"POST",headers:d});if(!c.ok)throw new Error(`Failed to cancel plan: ${c.statusText}`)}async function M1(){const n=localStorage.getItem("nestor_token"),i={"Content-Type":"application/json"};n&&(i.Authorization=`Bearer ${n}`);const d=await fetch(`${Pr}/plans?limit=50`,{headers:i});if(!d.ok)throw new Error(`Failed to fetch plans: ${d.statusText}`);return(await d.json()).data}function D1(){const[n,i]=u.useState([]),[d,c]=u.useState(!0),m=Dt();return u.useEffect(()=>{M1().then(i).catch(console.error).finally(()=>c(!1))},[]),d?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsx("h1",{className:"text-2xl font-bold text-white",children:"Dry-Run Plans"})}),n.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-border bg-surface p-12 text-center",children:[t.jsx(Ms,{className:"mb-4 h-12 w-12 text-zinc-600"}),t.jsx("h3",{className:"text-lg font-medium text-zinc-300",children:"No dry-run plans yet"}),t.jsx("p",{className:"mt-1.5 max-w-md text-sm text-zinc-500",children:"Plans let you preview what an agent will do before it executes. The agent creates a step-by-step plan with cost estimates and risk levels."}),t.jsxs("div",{className:"mt-4 space-y-3 text-left max-w-md",children:[t.jsxs("div",{className:"rounded-lg bg-zinc-900 border border-zinc-800 p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1.5 font-medium",children:"Create a plan via CLI:"}),t.jsx("code",{className:"text-xs text-indigo-400 font-mono block",children:'npx nestor-sh plan "Audit the codebase for security issues"'})]}),t.jsxs("div",{className:"rounded-lg bg-zinc-900 border border-zinc-800 p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1.5 font-medium",children:"Or via API:"}),t.jsxs("code",{className:"text-xs text-indigo-400 font-mono block",children:["POST /api/plans ","{",' "agentId": "...", "prompt": "..." ',"}"]})]}),t.jsx("p",{className:"text-xs text-zinc-500",children:"Once created, you can review each step, approve or reject, then execute."})]})]}):t.jsx("div",{className:"space-y-3",children:n.map(f=>t.jsxs("button",{onClick:()=>m(`/plans/${f.id}`),className:"flex w-full items-center justify-between rounded-lg border border-border bg-surface p-4 text-left transition-colors hover:bg-surface-hover",children:[t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("span",{className:"text-sm font-medium text-white",children:[f.prompt.slice(0,80),f.prompt.length>80?"...":""]}),t.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${f.status==="completed"?"bg-green-500/10 text-green-400":f.status==="executing"?"bg-blue-500/10 text-blue-400":f.status==="cancelled"?"bg-zinc-500/10 text-zinc-400":"bg-yellow-500/10 text-yellow-400"}`,children:f.status})]}),t.jsxs("div",{className:"mt-1 flex items-center gap-4 text-xs text-zinc-500",children:[t.jsxs("span",{children:[f.steps.length," step(s)"]}),t.jsxs("span",{children:["$",f.estimatedCostUsd.toFixed(4)]}),t.jsx("span",{children:new Date(f.createdAt).toLocaleString()})]})]}),t.jsx(ca,{className:"h-4 w-4 text-zinc-600"})]},f.id))})]})}function O1(){const{id:n}=Fn(),i=Dt(),[d,c]=u.useState(null),[m,f]=u.useState(!0),[h,b]=u.useState(!1),[g,p]=u.useState(-1);u.useEffect(()=>{n&&Td(n).then(c).catch(console.error).finally(()=>f(!1))},[n]);const w=async()=>{if(d){b(!0);try{await T1(d.id);for(let z=0;z<d.steps.length;z++)p(z),await new Promise(N=>setTimeout(N,500));p(d.steps.length);const k=await Td(d.id);c(k)}catch(k){console.error("Execute failed:",k)}finally{b(!1)}}},v=async()=>{if(d)try{await R1(d.id);const k=await Td(d.id);c(k)}catch(k){console.error("Cancel failed:",k)}};if(m)return t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})});if(!d)return t.jsx("div",{className:"py-20 text-center text-zinc-400",children:"Plan not found."});const y=d.status==="pending"||d.status==="approved";return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("button",{onClick:()=>i("/plans"),className:"text-sm text-zinc-500 hover:text-zinc-300",children:"← Back to Plans"}),t.jsxs("h1",{className:"mt-1 text-2xl font-bold text-white",children:["Plan: ",d.id]}),t.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:d.prompt})]}),t.jsx("div",{className:"flex gap-2",children:y&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:w,disabled:h,className:"flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-500 disabled:opacity-50",children:[t.jsx(Ct,{className:"h-4 w-4"}),"Execute All"]}),t.jsxs("button",{onClick:v,className:"flex items-center gap-2 rounded-lg border border-border px-4 py-2 text-sm font-medium text-zinc-400 hover:text-white hover:border-zinc-600",children:[t.jsx(At,{className:"h-4 w-4"}),"Cancel"]})]})})]}),t.jsxs("div",{className:"flex gap-4 rounded-lg border border-border bg-surface p-4 text-sm",children:[t.jsxs("div",{children:[t.jsx("span",{className:"text-zinc-500",children:"Status:"})," ",t.jsx("span",{className:"font-medium text-white",children:d.status})]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-zinc-500",children:"Steps:"})," ",t.jsx("span",{className:"font-medium text-white",children:d.steps.length})]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-zinc-500",children:"Est. Cost:"})," ",t.jsxs("span",{className:"font-medium text-white",children:["$",d.estimatedCostUsd.toFixed(4)]})]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-zinc-500",children:"Iterations:"})," ",t.jsx("span",{className:"font-medium text-white",children:d.estimatedIterations})]})]}),t.jsx("div",{className:"space-y-2",children:d.steps.map((k,z)=>{const N=g===z,S=g>z,C=Object.entries(k.args).map(([O,M])=>`${O}: ${typeof M=="string"?M.slice(0,80):JSON.stringify(M).slice(0,80)}`).join(" | ");return t.jsxs("div",{className:`rounded-lg border p-4 transition-colors ${N?"border-indigo-500 bg-indigo-500/5":S?"border-green-500/30 bg-green-500/5":"border-border bg-surface"}`,children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:`flex h-7 w-7 items-center justify-center rounded-full text-xs font-bold ${S?"bg-green-500/20 text-green-400":N?"bg-indigo-500/20 text-indigo-400":"bg-zinc-800 text-zinc-400"}`,children:S?t.jsx(pt,{className:"h-4 w-4"}):z+1}),t.jsx("span",{className:"font-mono text-sm font-medium text-white",children:k.toolName}),t.jsx(E1,{level:k.riskLevel}),N&&t.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})]}),t.jsx("div",{className:"mt-2 pl-10 text-xs text-zinc-500 font-mono",children:C}),t.jsx("div",{className:"mt-1 pl-10 text-xs text-zinc-600 italic",children:k.mockResult})]},k.index)})})]})}const L1={file_pattern:"File Pattern",command_pattern:"Command Pattern",url_pattern:"URL Pattern",limit:"Limit"},_1={block:"bg-red-500/10 text-red-400 border-red-500/20",warn:"bg-yellow-500/10 text-yellow-400 border-yellow-500/20",approve:"bg-blue-500/10 text-blue-400 border-blue-500/20"},Wr="/api";function ec(){const n={"Content-Type":"application/json"},i=localStorage.getItem("nestor_token");i&&(n.Authorization=`Bearer ${i}`);const d=localStorage.getItem("nestor_tenant_id");return d&&(n["X-Tenant-ID"]=d),n}async function U1(){const n=await fetch(`${Wr}/guardrails`,{headers:ec()});if(!n.ok)throw new Error(`Failed to fetch guardrails: ${n.statusText}`);return(await n.json()).data}async function B1(n){const i=await fetch(`${Wr}/guardrails`,{method:"POST",headers:ec(),body:JSON.stringify(n)});if(!i.ok)throw new Error(`Failed to create guardrail: ${i.statusText}`);return(await i.json()).data}async function Zh(n,i){const d=await fetch(`${Wr}/guardrails/${n}`,{method:"PUT",headers:ec(),body:JSON.stringify(i)});if(!d.ok)throw new Error(`Failed to update guardrail: ${d.statusText}`)}async function $1(n){const i=await fetch(`${Wr}/guardrails/${n}`,{method:"DELETE",headers:ec()});if(!i.ok)throw new Error(`Failed to delete guardrail: ${i.statusText}`)}function H1(){const[n,i]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(!1),[h,b]=u.useState(null),[g,p]=u.useState({name:"",type:"command_pattern",pattern:"",action:"block",config:"{}",enabled:!0}),w=u.useCallback(()=>{c(!0),U1().then(i).catch(console.error).finally(()=>c(!1))},[]);u.useEffect(()=>{w()},[w]);const v=()=>{p({name:"",type:"command_pattern",pattern:"",action:"block",config:"{}",enabled:!0}),b(null),f(!1)},y=async()=>{if(!g.name.trim()||!g.pattern.trim())return;let S={};try{S=JSON.parse(g.config)}catch{}try{h?await Zh(h,{...g,config:S}):await B1({...g,config:S}),v(),w()}catch(C){console.error("Save failed:",C)}},k=async S=>{try{await Zh(S.id,{enabled:!S.enabled}),w()}catch(C){console.error("Toggle failed:",C)}},z=async S=>{try{await $1(S),w()}catch(C){console.error("Delete failed:",C)}},N=S=>{p({name:S.name,type:S.type,pattern:S.pattern,action:S.action,config:JSON.stringify(S.config,null,2),enabled:S.enabled}),b(S.id),f(!0)};return d?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"text-2xl font-bold text-white",children:"Guardrails"}),t.jsxs("button",{onClick:()=>{v(),f(!0)},className:"flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-500",children:[t.jsx(gt,{className:"h-4 w-4"}),"Add Rule"]})]}),m&&t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-5 space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-lg font-semibold text-white",children:h?"Edit Guardrail":"New Guardrail"}),t.jsx("button",{onClick:v,className:"text-zinc-500 hover:text-white",children:t.jsx(tt,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-zinc-400 mb-1",children:"Name"}),t.jsx("input",{value:g.name,onChange:S=>p(C=>({...C,name:S.target.value})),placeholder:"e.g., Block production DB access",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white placeholder:text-zinc-600 focus:border-indigo-500 focus:outline-none"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-zinc-400 mb-1",children:"Type"}),t.jsxs("select",{value:g.type,onChange:S=>p(C=>({...C,type:S.target.value})),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white focus:border-indigo-500 focus:outline-none",children:[t.jsx("option",{value:"command_pattern",children:"Command Pattern"}),t.jsx("option",{value:"file_pattern",children:"File Pattern"}),t.jsx("option",{value:"url_pattern",children:"URL Pattern"}),t.jsx("option",{value:"limit",children:"Limit"})]})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-zinc-400 mb-1",children:"Pattern (regex or substring)"}),t.jsx("input",{value:g.pattern,onChange:S=>p(C=>({...C,pattern:S.target.value})),placeholder:g.type==="limit"?"shell_exec":"e.g., rm\\s+-rf|DROP\\s+TABLE",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white font-mono placeholder:text-zinc-600 focus:border-indigo-500 focus:outline-none"})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-zinc-400 mb-1",children:"Action"}),t.jsxs("select",{value:g.action,onChange:S=>p(C=>({...C,action:S.target.value})),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white focus:border-indigo-500 focus:outline-none",children:[t.jsx("option",{value:"block",children:"Block"}),t.jsx("option",{value:"warn",children:"Warn"}),t.jsx("option",{value:"approve",children:"Require Approval"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-zinc-400 mb-1",children:"Config (JSON)"}),t.jsx("input",{value:g.config,onChange:S=>p(C=>({...C,config:S.target.value})),placeholder:'e.g., {"maxPerRun": 5}',className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white font-mono placeholder:text-zinc-600 focus:border-indigo-500 focus:outline-none"})]})]}),t.jsxs("div",{className:"flex items-center justify-between pt-2",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm text-zinc-400",children:[t.jsx("input",{type:"checkbox",checked:g.enabled,onChange:S=>p(C=>({...C,enabled:S.target.checked})),className:"rounded border-border"}),"Enabled"]}),t.jsx("button",{onClick:y,className:"rounded-lg bg-indigo-600 px-6 py-2 text-sm font-medium text-white hover:bg-indigo-500",children:h?"Update":"Create"})]})]}),n.length===0&&!m?t.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-border bg-surface p-12 text-center",children:[t.jsx(Ms,{className:"mb-4 h-12 w-12 text-zinc-600"}),t.jsx("p",{className:"text-zinc-400",children:"No guardrails configured."}),t.jsx("p",{className:"mt-1 text-sm text-zinc-600",children:"Add rules to control what tools can do -- block dangerous patterns, enforce limits, or require approval."})]}):t.jsx("div",{className:"space-y-2",children:n.map(S=>t.jsxs("div",{className:`flex items-center justify-between rounded-lg border p-4 transition-colors ${S.enabled?"border-border bg-surface":"border-border/50 bg-surface/50 opacity-60"}`,children:[t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-sm font-medium text-white",children:S.name}),t.jsx("span",{className:"rounded-full bg-zinc-800 px-2 py-0.5 text-[10px] font-medium text-zinc-400",children:L1[S.type]??S.type}),t.jsx("span",{className:`rounded-full border px-2 py-0.5 text-[10px] font-medium ${_1[S.action]??""}`,children:S.action})]}),t.jsx("div",{className:"mt-1 font-mono text-xs text-zinc-500",children:S.pattern})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:()=>k(S),className:"text-zinc-500 hover:text-white",title:S.enabled?"Disable":"Enable",children:S.enabled?t.jsx(Av,{className:"h-5 w-5 text-green-400"}):t.jsx(Cv,{className:"h-5 w-5"})}),t.jsx("button",{onClick:()=>N(S),className:"text-zinc-500 hover:text-white",title:"Edit",children:t.jsx(tu,{className:"h-4 w-4"})}),t.jsx("button",{onClick:()=>z(S.id),className:"text-zinc-500 hover:text-red-400",title:"Delete",children:t.jsx(qt,{className:"h-4 w-4"})})]})]},S.id))})]})}const Jh={agent:t.jsx(sv,{className:"h-3 w-3"}),project:t.jsx(v0,{className:"h-3 w-3"}),global:t.jsx(Wd,{className:"h-3 w-3"})},Fh={agent:"bg-blue-500/20 text-blue-400",project:"bg-purple-500/20 text-purple-400",global:"bg-amber-500/20 text-amber-400"};function q1(){const{id:n}=Fn(),[i,d]=u.useState([]),[c,m]=u.useState(null),[f,h]=u.useState(!0),[b,g]=u.useState(""),[p,w]=u.useState(""),[v,y]=u.useState(""),[k,z]=u.useState(!1),[N,S]=u.useState(""),[C,O]=u.useState(""),[M,E]=u.useState("agent"),[ae,ce]=u.useState(.5),B=u.useCallback(async()=>{if(n){h(!0);try{const X=new URLSearchParams;b&&X.set("q",b),p&&X.set("scope",p),X.set("limit","100");const[le,J]=await Promise.all([fetch(`/api/agents/${n}/memory?${X}`,{credentials:"include"}),fetch(`/api/agents/${n}/memory/stats`,{credentials:"include"})]);if(le.ok){const re=await le.json();d(re.data||[])}if(J.ok){const re=await J.json();m(re.data)}}catch{}h(!1)}},[n,b,p]);u.useEffect(()=>{B()},[B]);const q=X=>{X.preventDefault(),B()},I=async()=>{var X;if(!(!n||!N.trim()||!C.trim())){y("");try{const le=await fetch(`/api/agents/${n}/memory`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:N,value:C,scope:M,importance:ae})});if(!le.ok){const J=await le.json();throw new Error(((X=J.error)==null?void 0:X.message)||"Failed")}z(!1),S(""),O(""),ce(.5),await B()}catch(le){y(le.message)}}},W=async X=>{if(n)try{(await fetch(`/api/agents/${n}/memory/${encodeURIComponent(X)}`,{method:"DELETE",credentials:"include"})).ok&&d(J=>J.filter(re=>re.key!==X))}catch{}};return f?t.jsx("div",{className:"flex h-64 items-center justify-center text-zinc-400",children:"Loading..."}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Es,{className:"h-6 w-6 text-indigo-400"}),t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Agent Memory Store"}),t.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"Key-value memory entries with scope, importance, and FTS5 search."})]})]}),t.jsxs("button",{onClick:()=>z(!0),className:"flex items-center gap-2 rounded-lg bg-indigo-600 px-3 py-2 text-sm font-medium text-white hover:bg-indigo-700",children:[t.jsx(gt,{className:"h-4 w-4"})," Add Memory"]})]}),v&&t.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-sm text-red-400",children:v}),c&&t.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4",children:[t.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-zinc-400",children:"Total Entries"}),t.jsx("p",{className:"mt-2 text-2xl font-semibold text-white",children:c.total})]}),t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4",children:[t.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-zinc-400",children:"Total Size"}),t.jsx("p",{className:"mt-2 text-2xl font-semibold text-white",children:c.totalSize>1024?`${(c.totalSize/1024).toFixed(1)} KB`:`${c.totalSize} B`})]}),t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4",children:[t.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-zinc-400",children:"By Scope"}),t.jsx("div",{className:"mt-2 flex gap-2",children:Object.entries(c.byScope).map(([X,le])=>t.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium ${Fh[X]??"bg-zinc-500/20 text-zinc-400"}`,children:[Jh[X]," ",X,": ",le]},X))})]})]}),k&&t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"text-sm font-medium text-white",children:"Add Memory Entry"}),t.jsx("button",{onClick:()=>z(!1),className:"text-zinc-400 hover:text-white",children:t.jsx(tt,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsx("input",{type:"text",value:N,onChange:X=>S(X.target.value),placeholder:"Key (e.g. user_preference_language)",className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-white"}),t.jsxs("select",{value:M,onChange:X=>E(X.target.value),className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"agent",children:"agent"}),t.jsx("option",{value:"project",children:"project"}),t.jsx("option",{value:"global",children:"global"})]})]}),t.jsx("textarea",{value:C,onChange:X=>O(X.target.value),placeholder:"Value...",rows:3,className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white"}),t.jsxs("div",{children:[t.jsxs("label",{className:"text-xs text-zinc-400",children:["Importance: ",ae.toFixed(1)]}),t.jsx("input",{type:"range",min:0,max:100,value:ae*100,onChange:X=>ce(Number(X.target.value)/100),className:"w-full"})]}),t.jsx("button",{onClick:I,disabled:!N.trim()||!C.trim(),className:"rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 disabled:opacity-50",children:"Store Memory"})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs("form",{onSubmit:q,className:"flex flex-1 gap-2",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(Rs,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),t.jsx("input",{type:"text",value:b,onChange:X=>g(X.target.value),placeholder:"Search by key or value...",className:"w-full rounded-lg border border-border bg-surface py-2 pl-10 pr-4 text-sm text-white placeholder:text-zinc-500 focus:border-indigo-500 focus:outline-none"})]}),t.jsx("button",{type:"submit",className:"rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-500",children:"Search"})]}),t.jsxs("select",{value:p,onChange:X=>w(X.target.value),className:"rounded-lg border border-border bg-surface px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"",children:"All Scopes"}),t.jsx("option",{value:"agent",children:"Agent"}),t.jsx("option",{value:"project",children:"Project"}),t.jsx("option",{value:"global",children:"Global"})]})]}),i.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-border bg-surface py-16",children:[t.jsx(mv,{className:"h-12 w-12 text-zinc-600"}),t.jsx("p",{className:"mt-4 text-sm text-zinc-400",children:"No memory entries found"}),t.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Memory entries are key-value pairs that persist across agent runs."})]}):t.jsx("div",{className:"space-y-2",children:i.map(X=>t.jsx("div",{className:"group rounded-lg border border-border bg-surface p-4 hover:border-border/80",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium ${Fh[X.scope]??"bg-zinc-500/20 text-zinc-400"}`,children:[Jh[X.scope]," ",X.scope]}),t.jsx("span",{className:"font-mono text-sm font-medium text-indigo-400",children:X.key}),t.jsxs("span",{className:"text-xs text-zinc-600",children:["importance: ",(X.importance*100).toFixed(0),"%"]}),X.accessCount>0&&t.jsxs("span",{className:"text-xs text-zinc-600",children:["accessed ",X.accessCount,"x"]})]}),t.jsx("p",{className:"mt-2 text-sm text-zinc-200 leading-relaxed",children:X.value}),t.jsxs("div",{className:"mt-1 flex items-center gap-3 text-xs text-zinc-500",children:[t.jsxs("span",{children:["Created: ",new Date(X.createdAt).toLocaleString()]}),X.expiresAt&&t.jsxs("span",{className:"text-yellow-500",children:["Expires: ",new Date(X.expiresAt).toLocaleString()]})]})]}),t.jsx("button",{onClick:()=>W(X.key),className:"rounded p-1.5 text-zinc-500 opacity-0 transition-all hover:bg-red-500/10 hover:text-red-400 group-hover:opacity-100",title:"Delete memory entry",children:t.jsx(qt,{className:"h-4 w-4"})})]})},X.id))})]})}function G1(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function G0(n){const i=Math.floor(n/86400),d=Math.floor(n%86400/3600),c=Math.floor(n%3600/60);return i>0?`${i}d ${d}h ${c}m`:d>0?`${d}h ${c}m`:`${c}m`}function As({label:n,value:i,icon:d,color:c="indigo"}){const m={indigo:"bg-indigo-500/10 text-indigo-400",green:"bg-green-500/10 text-green-400",amber:"bg-amber-500/10 text-amber-400",red:"bg-red-500/10 text-red-400",blue:"bg-blue-500/10 text-blue-400",zinc:"bg-zinc-500/10 text-zinc-400"};return t.jsxs("div",{className:"card flex items-center gap-4 p-4",children:[t.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-lg ${m[c]??m.indigo}`,children:t.jsx(d,{className:"h-5 w-5"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-zinc-400",children:n}),t.jsx("p",{className:"text-xl font-semibold text-white",children:i})]})]})}function K1(){const[n,i]=u.useState(null),[d,c]=u.useState(null),[m,f]=u.useState(null),[h,b]=u.useState(!0),[g,p]=u.useState(""),w=u.useCallback(async()=>{b(!0),p("");try{const[v,y,k]=await Promise.allSettled([zt.overview(),Sa.health(),Sa.stats()]);v.status==="fulfilled"&&i(v.value.data),y.status==="fulfilled"&&c(y.value),k.status==="fulfilled"&&f(k.value.data)}catch(v){p(v.message||"Failed to load overview")}finally{b(!1)}},[]);return u.useEffect(()=>{w()},[w]),h?t.jsx(sn,{}):g?t.jsx(Ia,{message:g,onRetry:w}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[t.jsx(As,{label:"Tenants",value:(n==null?void 0:n.tenants)??0,icon:Fd,color:"indigo"}),t.jsx(As,{label:"Users",value:(n==null?void 0:n.users)??0,icon:Pn,color:"blue"}),t.jsx(As,{label:"Agents",value:(n==null?void 0:n.agents)??0,icon:Ft,color:"green"}),t.jsx(As,{label:"Total Runs",value:(n==null?void 0:n.runs)??0,icon:eu,color:"amber"})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:[t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsx("h3",{className:"text-sm font-medium text-zinc-300",children:"System Health"}),t.jsxs("div",{className:"flex items-center gap-2",children:[(d==null?void 0:d.status)==="healthy"?t.jsx(Id,{className:"h-5 w-5 text-green-400"}):t.jsx(mt,{className:"h-5 w-5 text-amber-400"}),t.jsx("span",{className:"text-sm text-zinc-200 capitalize",children:(d==null?void 0:d.status)??"Unknown"}),(d==null?void 0:d.uptime)!=null&&t.jsxs("span",{className:"ml-auto text-xs text-zinc-500",children:["Uptime: ",G0(d.uptime)]})]})]}),t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsx("h3",{className:"text-sm font-medium text-zinc-300",children:"Cost Summary"}),t.jsxs("p",{className:"text-2xl font-semibold text-white",children:["$",((n==null?void 0:n.totalCostUsd)??0).toFixed(4)]}),t.jsx("p",{className:"text-xs text-zinc-500",children:"Total cost across all tenants"})]})]}),m&&t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsx("h3",{className:"text-sm font-medium text-zinc-300",children:"Run Statistics"}),t.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-5",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Running"}),t.jsx("p",{className:"text-lg font-semibold text-indigo-400",children:m.runs.running})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Completed"}),t.jsx("p",{className:"text-lg font-semibold text-green-400",children:m.runs.completed})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Failed"}),t.jsx("p",{className:"text-lg font-semibold text-red-400",children:m.runs.failed})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Today"}),t.jsx("p",{className:"text-lg font-semibold text-amber-400",children:m.runs.today})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Pending Approvals"}),t.jsx("p",{className:"text-lg font-semibold text-zinc-300",children:m.approvals.pending})]})]})]})]})}function V1(){const[n,i]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(""),[h,b]=u.useState(!1),[g,p]=u.useState({name:"",slug:"",description:""}),[w,v]=u.useState(!1),y=u.useCallback(async()=>{c(!0),f("");try{const z=await zt.tenants.list();i(z.data)}catch(z){f(z.message||"Failed to load tenants")}finally{c(!1)}},[]);u.useEffect(()=>{y()},[y]);const k=async()=>{if(!(!g.name||!g.slug)){v(!0);try{await zt.tenants.create(g),b(!1),p({name:"",slug:"",description:""}),await y()}catch(z){f(z.message||"Failed to create tenant")}finally{v(!1)}}};return d?t.jsx(sn,{}):m&&n.length===0?t.jsx(Ia,{message:m,onRetry:y}):t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("p",{className:"text-sm text-zinc-400",children:[n.length," tenants"]}),t.jsxs("button",{onClick:()=>b(!0),className:"btn-primary btn-sm",children:[t.jsx(gt,{className:"h-4 w-4"})," Create Tenant"]})]}),m&&t.jsx(Ia,{message:m}),h&&t.jsxs("div",{className:"card p-4 space-y-3 border-indigo-500/30",children:[t.jsx("h3",{className:"text-sm font-medium text-zinc-200",children:"New Tenant"}),t.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[t.jsx("input",{className:"input",placeholder:"Tenant Name",value:g.name,onChange:z=>p({...g,name:z.target.value})}),t.jsx("input",{className:"input",placeholder:"slug (lowercase-with-dashes)",value:g.slug,onChange:z=>p({...g,slug:z.target.value})})]}),t.jsx("input",{className:"input",placeholder:"Description (optional)",value:g.description,onChange:z=>p({...g,description:z.target.value})}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("button",{onClick:k,disabled:w,className:"btn-primary btn-sm",children:w?"Creating...":"Create"}),t.jsx("button",{onClick:()=>b(!1),className:"btn-ghost btn-sm",children:"Cancel"})]})]}),t.jsx("div",{className:"overflow-x-auto rounded-lg border border-border",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border bg-surface",children:[t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Name"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Slug"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Description"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Created"})]})}),t.jsxs("tbody",{children:[n.map(z=>t.jsxs("tr",{className:"border-b border-border/50 hover:bg-surface-hover",children:[t.jsx("td",{className:"px-4 py-3 font-medium text-white",children:z.name}),t.jsx("td",{className:"px-4 py-3 font-mono text-xs text-indigo-400",children:z.slug}),t.jsx("td",{className:"px-4 py-3 text-zinc-400 max-w-xs truncate",children:z.description||"-"}),t.jsx("td",{className:"px-4 py-3 text-zinc-500 text-xs",children:new Date(z.createdAt).toLocaleDateString()})]},z.id)),n.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:4,className:"px-4 py-8 text-center text-zinc-500",children:"No tenants found."})})]})]})})]})}function Y1(){const[n,i]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(""),[h,b]=u.useState(""),[g,p]=u.useState(""),w=u.useCallback(async()=>{c(!0),f("");try{const z=await zt.users.list(h?{role:h}:void 0);i(z.data)}catch(z){f(z.message||"Failed to load users")}finally{c(!1)}},[h]);u.useEffect(()=>{w()},[w]);const v=async(z,N)=>{f("");try{await zt.users.updateRole(z,N),await w()}catch(S){f(S.message||"Failed to update role")}},y=async(z,N)=>{f("");try{N?await zt.users.lock(z):await zt.users.unlock(z),await w()}catch(S){f(S.message||"Failed to toggle lock status")}},k=n.filter(z=>{if(!g)return!0;const N=g.toLowerCase();return z.name.toLowerCase().includes(N)||z.email.toLowerCase().includes(N)});return d?t.jsx(sn,{}):t.jsxs("div",{className:"space-y-4",children:[m&&t.jsx(Ia,{message:m}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[t.jsx(Rs,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),t.jsx("input",{className:"input pl-9",placeholder:"Search by name or email...",value:g,onChange:z=>p(z.target.value)})]}),t.jsxs("select",{className:"input w-auto",value:h,onChange:z=>b(z.target.value),children:[t.jsx("option",{value:"",children:"All Roles"}),t.jsx("option",{value:"admin",children:"Admin"}),t.jsx("option",{value:"manager",children:"Manager"}),t.jsx("option",{value:"member",children:"Member"}),t.jsx("option",{value:"viewer",children:"Viewer"})]}),t.jsx("button",{onClick:w,className:"btn-ghost btn-sm",children:t.jsx(Mt,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"overflow-x-auto rounded-lg border border-border",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border bg-surface",children:[t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Name"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Email"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Role"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Status"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Last Login"}),t.jsx("th",{className:"px-4 py-3 text-right text-xs font-medium uppercase text-zinc-400",children:"Actions"})]})}),t.jsxs("tbody",{children:[k.map(z=>t.jsxs("tr",{className:"border-b border-border/50 hover:bg-surface-hover",children:[t.jsx("td",{className:"px-4 py-3 font-medium text-white",children:z.name}),t.jsx("td",{className:"px-4 py-3 text-zinc-300",children:z.email}),t.jsx("td",{className:"px-4 py-3",children:t.jsxs("select",{value:z.role,onChange:N=>v(z.id,N.target.value),className:"rounded border border-border bg-background px-2 py-1 text-xs text-white focus:outline-none",children:[t.jsx("option",{value:"admin",children:"Admin"}),t.jsx("option",{value:"manager",children:"Manager"}),t.jsx("option",{value:"member",children:"Member"}),t.jsx("option",{value:"viewer",children:"Viewer"})]})}),t.jsx("td",{className:"px-4 py-3",children:t.jsx("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium ${z.isActive?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,children:z.isActive?"Active":"Locked"})}),t.jsx("td",{className:"px-4 py-3 text-zinc-400 text-xs",children:z.lastLoginAt?new Date(z.lastLoginAt*1e3).toLocaleString():"Never"}),t.jsx("td",{className:"px-4 py-3 text-right",children:t.jsx("div",{className:"flex items-center justify-end gap-1",children:t.jsx("button",{onClick:()=>y(z.id,z.isActive),className:"rounded p-1.5 text-zinc-400 transition-colors hover:bg-zinc-700",title:z.isActive?"Lock account":"Unlock account",children:z.isActive?t.jsx(Ud,{className:"h-3.5 w-3.5"}):t.jsx(xv,{className:"h-3.5 w-3.5"})})})})]},z.id)),k.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-zinc-500",children:"No users found."})})]})]})})]})}function X1(){const[n,i]=u.useState(null),[d,c]=u.useState(null),[m,f]=u.useState(null),[h,b]=u.useState(!0),[g,p]=u.useState(""),w=u.useCallback(async()=>{b(!0),p("");try{const[v,y,k]=await Promise.allSettled([zt.system.info(),zt.system.dbStats(),zt.system.rateLimitStats()]);v.status==="fulfilled"&&i(v.value.data),y.status==="fulfilled"&&c(y.value.data),k.status==="fulfilled"&&f(k.value.data)}catch(v){p(v.message||"Failed to load system info")}finally{b(!1)}},[]);return u.useEffect(()=>{w()},[w]),h?t.jsx(sn,{}):g?t.jsx(Ia,{message:g,onRetry:w}):t.jsxs("div",{className:"space-y-6",children:[n&&t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(su,{className:"h-4 w-4 text-indigo-400"}),t.jsx("h3",{className:"text-sm font-medium text-zinc-200",children:"Server Information"}),t.jsx("button",{onClick:w,className:"ml-auto btn-ghost btn-sm",children:t.jsx(Mt,{className:"h-3.5 w-3.5"})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Version"}),t.jsx("p",{className:"text-sm font-medium text-zinc-200",children:n.version})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Node.js"}),t.jsx("p",{className:"text-sm font-medium text-zinc-200",children:n.nodeVersion})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Platform"}),t.jsxs("p",{className:"text-sm font-medium text-zinc-200",children:[n.platform," / ",n.arch]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Uptime"}),t.jsx("p",{className:"text-sm font-medium text-zinc-200",children:G0(n.uptime)})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4 pt-2",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"RSS Memory"}),t.jsxs("p",{className:"text-sm font-medium text-zinc-200",children:[n.memory.rss," MB"]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Heap Used"}),t.jsxs("p",{className:"text-sm font-medium text-zinc-200",children:[n.memory.heapUsed," MB"]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Heap Total"}),t.jsxs("p",{className:"text-sm font-medium text-zinc-200",children:[n.memory.heapTotal," MB"]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"PID"}),t.jsx("p",{className:"text-sm font-medium text-zinc-200",children:n.pid})]})]})]}),d&&t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(v0,{className:"h-4 w-4 text-green-400"}),t.jsx("h3",{className:"text-sm font-medium text-zinc-200",children:"Database Statistics"}),t.jsx("span",{className:"ml-auto text-xs text-zinc-500",children:G1(d.totalSize)})]}),t.jsx("div",{className:"overflow-x-auto rounded border border-border/50",children:t.jsxs("table",{className:"w-full text-xs",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border/50 bg-background",children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"Table"}),t.jsx("th",{className:"px-3 py-2 text-right font-medium text-zinc-400",children:"Rows"})]})}),t.jsx("tbody",{children:d.tables.map(v=>t.jsxs("tr",{className:"border-b border-border/30",children:[t.jsx("td",{className:"px-3 py-1.5 font-mono text-zinc-300",children:v.name}),t.jsx("td",{className:"px-3 py-1.5 text-right text-zinc-400",children:v.rowCount.toLocaleString()})]},v.name))})]})})]}),m&&t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ft,{className:"h-4 w-4 text-amber-400"}),t.jsx("h3",{className:"text-sm font-medium text-zinc-200",children:"Rate Limit Counters"}),t.jsxs("span",{className:"ml-auto text-xs text-zinc-500",children:[m.totalKeys," active keys"]})]}),m.entries.length>0?t.jsx("div",{className:"overflow-x-auto rounded border border-border/50 max-h-60 overflow-y-auto",children:t.jsxs("table",{className:"w-full text-xs",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border/50 bg-background sticky top-0",children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"Key"}),t.jsx("th",{className:"px-3 py-2 text-right font-medium text-zinc-400",children:"Count"}),t.jsx("th",{className:"px-3 py-2 text-right font-medium text-zinc-400",children:"Reset"})]})}),t.jsx("tbody",{children:m.entries.slice(0,50).map((v,y)=>t.jsxs("tr",{className:"border-b border-border/30",children:[t.jsx("td",{className:"px-3 py-1.5 font-mono text-zinc-300 max-w-xs truncate",children:v.key}),t.jsx("td",{className:"px-3 py-1.5 text-right text-zinc-400",children:v.count}),t.jsx("td",{className:"px-3 py-1.5 text-right text-zinc-500",children:new Date(v.resetAt).toLocaleTimeString()})]},y))})]})}):t.jsx("p",{className:"text-xs text-zinc-500",children:"No active rate limit counters."})]})]})}function Q1(){const[n,i]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(""),[h,b]=u.useState(""),[g,p]=u.useState(""),w=u.useCallback(async()=>{c(!0),f("");try{const y=await zt.audit.query({action:h||void 0,userId:g||void 0,limit:200});i(y.data)}catch(y){f(y.message||"Failed to load audit log")}finally{c(!1)}},[h,g]);u.useEffect(()=>{w()},[w]);const v=async y=>{try{const k=await zt.audit.export(y),z=y==="json"?JSON.stringify(k.data,null,2):Z1(k.data),N=new Blob([z],{type:y==="json"?"application/json":"text/csv"}),S=URL.createObjectURL(N),C=document.createElement("a");C.href=S,C.download=`audit-log.${y}`,C.click(),URL.revokeObjectURL(S)}catch(k){f(k.message||"Export failed")}};return d?t.jsx(sn,{}):t.jsxs("div",{className:"space-y-4",children:[m&&t.jsx(Ia,{message:m}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsx("input",{className:"input flex-1 min-w-[150px]",placeholder:"Filter by action...",value:h,onChange:y=>b(y.target.value)}),t.jsx("input",{className:"input flex-1 min-w-[150px]",placeholder:"Filter by actor ID...",value:g,onChange:y=>p(y.target.value)}),t.jsx("button",{onClick:w,className:"btn-ghost btn-sm",children:t.jsx(Mt,{className:"h-4 w-4"})}),t.jsxs("button",{onClick:()=>v("json"),className:"btn-ghost btn-sm",children:[t.jsx(ai,{className:"h-4 w-4"})," JSON"]}),t.jsxs("button",{onClick:()=>v("csv"),className:"btn-ghost btn-sm",children:[t.jsx(ai,{className:"h-4 w-4"})," CSV"]})]}),t.jsx("div",{className:"overflow-x-auto rounded-lg border border-border",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border bg-surface",children:[t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Time"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Actor"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Action"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Resource"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"IP"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Details"})]})}),t.jsxs("tbody",{children:[n.map(y=>{var k;return t.jsxs("tr",{className:"border-b border-border/50 hover:bg-surface-hover",children:[t.jsx("td",{className:"px-4 py-2.5 text-zinc-400 text-xs whitespace-nowrap",children:new Date(y.createdAt*1e3).toLocaleString()}),t.jsx("td",{className:"px-4 py-2.5 text-zinc-300 text-xs font-mono",children:((k=y.userId)==null?void 0:k.slice(0,8))||"-"}),t.jsx("td",{className:"px-4 py-2.5 font-mono text-xs text-indigo-400",children:y.action}),t.jsx("td",{className:"px-4 py-2.5 text-zinc-300 text-xs",children:y.resourceType?`${y.resourceType}${y.resourceId?`/${y.resourceId.slice(0,8)}`:""}`:"-"}),t.jsx("td",{className:"px-4 py-2.5 text-zinc-500 text-xs",children:y.ipAddress||"-"}),t.jsx("td",{className:"px-4 py-2.5 text-xs text-zinc-500 max-w-[200px] truncate",children:y.details?JSON.stringify(y.details):"-"})]},y.id)}),n.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-zinc-500",children:"No audit entries found."})})]})]})})]})}function Z1(n){const i="id,userId,action,resourceType,resourceId,ipAddress,createdAt,details",d=n.map(c=>[c.id,c.userId??"",c.action,c.resourceType??"",c.resourceId??"",c.ipAddress??"",new Date(c.createdAt*1e3).toISOString(),c.details?JSON.stringify(c.details).replace(/"/g,'""'):""].map(m=>`"${m}"`).join(","));return[i,...d].join(`
585
+ `)}function J1(){const[n,i]=u.useState([]),[d,c]=u.useState([]),[m,f]=u.useState([]),[h,b]=u.useState([]),[g,p]=u.useState(!0),[w,v]=u.useState(""),y=u.useCallback(async()=>{p(!0),v("");try{const[k,z,N,S]=await Promise.allSettled([zt.security.failedLogins(24),zt.security.lockedAccounts(),zt.security.activeSessions(),zt.security.rateLimitViolations(50)]);k.status==="fulfilled"&&i(k.value.data),z.status==="fulfilled"&&c(z.value.data),N.status==="fulfilled"&&f(N.value.data),S.status==="fulfilled"&&b(S.value.data)}catch(k){v(k.message||"Failed to load security data")}finally{p(!1)}},[]);return u.useEffect(()=>{y()},[y]),g?t.jsx(sn,{}):w?t.jsx(Ia,{message:w,onRetry:y}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[t.jsx(As,{label:"Failed Logins (24h)",value:n.reduce((k,z)=>k+z.count,0),icon:At,color:"red"}),t.jsx(As,{label:"Locked Accounts",value:d.length,icon:Ud,color:"amber"}),t.jsx(As,{label:"Active Sessions",value:m.length,icon:Pn,color:"green"}),t.jsx(As,{label:"Rate Violations",value:h.length,icon:za,color:"red"})]}),t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("h3",{className:"text-sm font-medium text-zinc-200 flex items-center gap-2",children:[t.jsx(At,{className:"h-4 w-4 text-red-400"})," Failed Login Attempts (Last 24h)"]}),n.length>0?t.jsx("div",{className:"overflow-x-auto rounded border border-border/50",children:t.jsxs("table",{className:"w-full text-xs",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border/50 bg-background",children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"Email"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"IP"}),t.jsx("th",{className:"px-3 py-2 text-right font-medium text-zinc-400",children:"Attempts"}),t.jsx("th",{className:"px-3 py-2 text-right font-medium text-zinc-400",children:"First Seen"})]})}),t.jsx("tbody",{children:n.map((k,z)=>t.jsxs("tr",{className:"border-b border-border/30",children:[t.jsx("td",{className:"px-3 py-1.5 text-zinc-300",children:k.email}),t.jsx("td",{className:"px-3 py-1.5 font-mono text-zinc-400",children:k.ip}),t.jsx("td",{className:"px-3 py-1.5 text-right font-semibold text-red-400",children:k.count}),t.jsx("td",{className:"px-3 py-1.5 text-right text-zinc-500",children:new Date(k.timestamp).toLocaleString()})]},z))})]})}):t.jsx("p",{className:"text-xs text-zinc-500",children:"No failed login attempts in the last 24 hours."})]}),t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("h3",{className:"text-sm font-medium text-zinc-200 flex items-center gap-2",children:[t.jsx(Ud,{className:"h-4 w-4 text-amber-400"})," Locked Accounts"]}),d.length>0?t.jsx("div",{className:"overflow-x-auto rounded border border-border/50",children:t.jsxs("table",{className:"w-full text-xs",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border/50 bg-background",children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"Email"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"Reason"}),t.jsx("th",{className:"px-3 py-2 text-right font-medium text-zinc-400",children:"Locked At"})]})}),t.jsx("tbody",{children:d.map((k,z)=>t.jsxs("tr",{className:"border-b border-border/30",children:[t.jsx("td",{className:"px-3 py-1.5 text-zinc-300",children:k.email}),t.jsx("td",{className:"px-3 py-1.5 text-zinc-400",children:k.reason}),t.jsx("td",{className:"px-3 py-1.5 text-right text-zinc-500",children:new Date(k.lockedAt).toLocaleString()})]},z))})]})}):t.jsx("p",{className:"text-xs text-zinc-500",children:"No locked accounts."})]}),t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("h3",{className:"text-sm font-medium text-zinc-200 flex items-center gap-2",children:[t.jsx(Xn,{className:"h-4 w-4 text-green-400"})," Active Sessions (",m.length,")"]}),m.length>0?t.jsx("div",{className:"overflow-x-auto rounded border border-border/50 max-h-60 overflow-y-auto",children:t.jsxs("table",{className:"w-full text-xs",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border/50 bg-background sticky top-0",children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"Email"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"IP"}),t.jsx("th",{className:"px-3 py-2 text-right font-medium text-zinc-400",children:"Created"}),t.jsx("th",{className:"px-3 py-2 text-right font-medium text-zinc-400",children:"Expires"})]})}),t.jsx("tbody",{children:m.map((k,z)=>t.jsxs("tr",{className:"border-b border-border/30",children:[t.jsx("td",{className:"px-3 py-1.5 text-zinc-300",children:k.email}),t.jsx("td",{className:"px-3 py-1.5 font-mono text-zinc-400",children:k.ip}),t.jsx("td",{className:"px-3 py-1.5 text-right text-zinc-500",children:new Date(k.createdAt).toLocaleString()}),t.jsx("td",{className:"px-3 py-1.5 text-right text-zinc-500",children:new Date(k.expiresAt).toLocaleString()})]},z))})]})}):t.jsx("p",{className:"text-xs text-zinc-500",children:"No active sessions."})]}),t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("h3",{className:"text-sm font-medium text-zinc-200 flex items-center gap-2",children:[t.jsx(za,{className:"h-4 w-4 text-red-400"})," Recent Rate Limit Violations"]}),h.length>0?t.jsx("div",{className:"overflow-x-auto rounded border border-border/50 max-h-60 overflow-y-auto",children:t.jsxs("table",{className:"w-full text-xs",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border/50 bg-background sticky top-0",children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"Time"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"Tier"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"IP"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"User"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"Endpoint"})]})}),t.jsx("tbody",{children:h.map((k,z)=>{var N;return t.jsxs("tr",{className:"border-b border-border/30",children:[t.jsx("td",{className:"px-3 py-1.5 text-zinc-400 whitespace-nowrap",children:new Date(k.timestamp).toLocaleString()}),t.jsx("td",{className:"px-3 py-1.5",children:t.jsx("span",{className:"rounded-full bg-red-500/10 px-1.5 py-0.5 text-red-400",children:k.tier})}),t.jsx("td",{className:"px-3 py-1.5 font-mono text-zinc-400",children:k.ip}),t.jsx("td",{className:"px-3 py-1.5 text-zinc-400",children:((N=k.userId)==null?void 0:N.slice(0,8))||"-"}),t.jsx("td",{className:"px-3 py-1.5 font-mono text-zinc-300 max-w-[200px] truncate",children:k.endpoint})]},z)})})]})}):t.jsx("p",{className:"text-xs text-zinc-500",children:"No rate limit violations recorded."})]})]})}function F1(){const[n,i]=u.useState(null),[d,c]=u.useState(null),[m,f]=u.useState(!0),[h,b]=u.useState(!1),[g,p]=u.useState(""),[w,v]=u.useState(""),[y,k]=u.useState(!1),z=u.useCallback(async()=>{f(!0),p(""),v("");try{const O=await Sa.getConfig();i(O.data),c(O.data),k(!1)}catch(O){p(O.message||"Failed to load configuration")}finally{f(!1)}},[]);u.useEffect(()=>{z()},[z]);const N=(O,M,E)=>{d&&(c({...d,[O]:{...d[O],[M]:E}}),k(!0),v(""))},S=async()=>{if(d){b(!0),p(""),v("");try{const O=await Sa.updateConfig(d);i(O.data),c(O.data),k(!1),v("Configuration saved successfully.")}catch(O){p(O.message||"Failed to save configuration")}finally{b(!1)}}},C=()=>{n&&(c({...n}),k(!1),v(""))};return m?t.jsx(sn,{}):g&&!d?t.jsx(Ia,{message:g,onRetry:z}):t.jsxs("div",{className:"space-y-6",children:[g&&t.jsx(Ia,{message:g}),w&&t.jsxs("div",{className:"rounded-lg border border-green-500/30 bg-green-500/10 px-4 py-3 text-sm text-green-400 flex items-center gap-2",children:[t.jsx(Id,{className:"h-4 w-4 flex-shrink-0"}),w]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("p",{className:"text-sm text-zinc-400",children:"Runtime configuration (changes apply immediately)"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("button",{onClick:z,className:"btn-ghost btn-sm",children:t.jsx(Mt,{className:"h-4 w-4"})}),t.jsx("button",{onClick:C,disabled:!y,className:"btn-secondary btn-sm",children:"Reset"}),t.jsxs("button",{onClick:S,disabled:!y||h,className:"btn-primary btn-sm",children:[t.jsx(Fr,{className:"h-4 w-4"})," ",h?"Saving...":"Save"]})]})]}),d&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("h3",{className:"text-sm font-medium text-zinc-200 flex items-center gap-2",children:[t.jsx(su,{className:"h-4 w-4 text-indigo-400"})," Server"]}),t.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Host"}),t.jsx("input",{className:"input",value:d.server.host,onChange:O=>N("server","host",O.target.value)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Port"}),t.jsx("input",{className:"input",type:"number",value:d.server.port,onChange:O=>N("server","port",parseInt(O.target.value)||0)})]})]})]}),t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("h3",{className:"text-sm font-medium text-zinc-200 flex items-center gap-2",children:[t.jsx(za,{className:"h-4 w-4 text-amber-400"})," Security"]}),t.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Default Trust Level"}),t.jsxs("select",{className:"input",value:d.security.defaultTrustLevel,onChange:O=>N("security","defaultTrustLevel",O.target.value),children:[t.jsx("option",{value:"builtin",children:"Builtin"}),t.jsx("option",{value:"official",children:"Official"}),t.jsx("option",{value:"trusted",children:"Trusted"}),t.jsx("option",{value:"community",children:"Community"}),t.jsx("option",{value:"local",children:"Local"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Approval Mode"}),t.jsxs("select",{className:"input",value:d.security.approvalMode,onChange:O=>N("security","approvalMode",O.target.value),children:[t.jsx("option",{value:"manual",children:"Manual"}),t.jsx("option",{value:"smart",children:"Smart"}),t.jsx("option",{value:"off",children:"Off"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Max Concurrent Runs"}),t.jsx("input",{className:"input",type:"number",min:1,max:100,value:d.security.maxConcurrentRuns,onChange:O=>N("security","maxConcurrentRuns",parseInt(O.target.value)||1)})]})]})]}),t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("h3",{className:"text-sm font-medium text-zinc-200 flex items-center gap-2",children:[t.jsx(Ft,{className:"h-4 w-4 text-green-400"})," Budget"]}),t.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Enabled"}),t.jsxs("select",{className:"input",value:d.budget.enabled?"true":"false",onChange:O=>N("budget","enabled",O.target.value==="true"),children:[t.jsx("option",{value:"true",children:"Yes"}),t.jsx("option",{value:"false",children:"No"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Max Cost/Run (USD)"}),t.jsx("input",{className:"input",type:"number",step:"0.01",min:0,value:d.budget.defaultMaxCostPerRunUsd,onChange:O=>N("budget","defaultMaxCostPerRunUsd",parseFloat(O.target.value)||0)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Max Tokens/Run"}),t.jsx("input",{className:"input",type:"number",min:0,value:d.budget.defaultMaxTokensPerRun,onChange:O=>N("budget","defaultMaxTokensPerRun",parseInt(O.target.value)||0)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Warning Threshold %"}),t.jsx("input",{className:"input",type:"number",min:0,max:100,value:d.budget.warningThresholdPercent,onChange:O=>N("budget","warningThresholdPercent",parseInt(O.target.value)||0)})]})]})]}),t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("h3",{className:"text-sm font-medium text-zinc-200 flex items-center gap-2",children:[t.jsx(an,{className:"h-4 w-4 text-blue-400"})," Logging"]}),t.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Level"}),t.jsxs("select",{className:"input",value:d.logging.level,onChange:O=>N("logging","level",O.target.value),children:[t.jsx("option",{value:"debug",children:"Debug"}),t.jsx("option",{value:"info",children:"Info"}),t.jsx("option",{value:"warn",children:"Warn"}),t.jsx("option",{value:"error",children:"Error"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Format"}),t.jsxs("select",{className:"input",value:d.logging.format,onChange:O=>N("logging","format",O.target.value),children:[t.jsx("option",{value:"json",children:"JSON"}),t.jsx("option",{value:"pretty",children:"Pretty"})]})]})]})]}),t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsx("h3",{className:"text-sm font-medium text-zinc-200",children:"Current Configuration (JSON)"}),t.jsx("pre",{className:"overflow-x-auto rounded border border-border/50 bg-background p-3 text-xs text-zinc-400 max-h-60 overflow-y-auto",children:JSON.stringify(d,null,2)})]})]})]})}function sn(){return t.jsx("div",{className:"flex items-center justify-center py-16",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})})}function Ia({message:n,onRetry:i}){return t.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-400",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(mt,{className:"h-4 w-4 flex-shrink-0"}),t.jsx("span",{children:n}),i&&t.jsx("button",{onClick:i,className:"ml-auto text-xs underline hover:text-red-300",children:"Retry"})]})})}const I1=[{key:"overview",label:"Overview",icon:eu},{key:"tenants",label:"Tenants",icon:Fd},{key:"users",label:"Users",icon:Pn},{key:"system",label:"System",icon:su},{key:"audit",label:"Audit Log",icon:an},{key:"security",label:"Security",icon:za},{key:"config",label:"Config",icon:In}];function P1(){const{isAdmin:n}=ci(),[i,d]=u.useState("overview");return n?t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Admin Dashboard"}),t.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"Multi-tenant administration and system monitoring."})]}),t.jsx("div",{className:"flex gap-1 border-b border-border overflow-x-auto",children:I1.map(({key:c,label:m,icon:f})=>t.jsxs("button",{onClick:()=>d(c),className:`flex items-center gap-2 whitespace-nowrap px-4 py-2.5 text-sm font-medium transition-colors border-b-2 ${i===c?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-400 hover:text-zinc-200"}`,children:[t.jsx(f,{className:"h-4 w-4"}),m]},c))}),i==="overview"&&t.jsx(K1,{}),i==="tenants"&&t.jsx(V1,{}),i==="users"&&t.jsx(Y1,{}),i==="system"&&t.jsx(X1,{}),i==="audit"&&t.jsx(Q1,{}),i==="security"&&t.jsx(J1,{}),i==="config"&&t.jsx(F1,{})]}):t.jsxs("div",{className:"flex h-64 items-center justify-center text-zinc-400",children:[t.jsx(za,{className:"mr-2 h-5 w-5"})," Admin access required."]})}function W1(n){switch(n){case"claude":return"claude-sonnet-4-20250514";case"openai":return"gpt-4o";case"gemini":return"gemini-2.5-flash";case"grok":return"grok-3";case"mistral":return"mistral-large-latest";case"ollama":return"llama3.1";default:return"claude-sonnet-4-20250514"}}function eN(n){return n.startsWith("file_")?t.jsx(an,{className:"h-3 w-3"}):n==="shell_exec"?t.jsx(S0,{className:"h-3 w-3"}):n==="web_fetch"?t.jsx(Wd,{className:"h-3 w-3"}):t.jsx(Wn,{className:"h-3 w-3"})}function K0(n,i){return n==="file_read"&&i.path?`Reading: ${i.path}`:n==="file_write"&&i.path?`Writing: ${i.path}`:n==="file_list"&&i.path?`Listing: ${i.path||"."}`:n==="shell_exec"&&i.command?`Running: ${String(i.command).substring(0,80)}`:n==="web_fetch"&&i.url?`Fetching: ${String(i.url).substring(0,80)}`:Object.entries(i).map(([c,m])=>`${c}=${JSON.stringify(m)}`).join(", ").substring(0,100)||"No arguments"}function tN(n,i=500){return n.length<=i?n:n.substring(0,i)+`
586
+ ... (${n.length} chars total)`}function aN({tc:n}){const[i,d]=u.useState(!1),c=n.pending&&!n.output;return t.jsxs("div",{className:"mb-2 rounded-lg text-xs border border-border/50 overflow-hidden",children:[t.jsxs("button",{onClick:()=>d(!i),className:"w-full flex items-center gap-2 px-3 py-2 bg-zinc-800/50 hover:bg-zinc-800/80 transition-colors text-left",children:[i?t.jsx(Fa,{className:"h-3 w-3 text-zinc-500 flex-shrink-0"}):t.jsx(ca,{className:"h-3 w-3 text-zinc-500 flex-shrink-0"}),t.jsx("span",{className:"text-amber-400 flex-shrink-0",children:eN(n.name)}),t.jsx("span",{className:"text-amber-300 font-mono font-medium",children:n.name}),t.jsx("span",{className:"text-zinc-500 truncate flex-1 ml-1",children:K0(n.name,n.args)}),c?t.jsx(ot,{className:"h-3 w-3 animate-spin text-blue-400 flex-shrink-0"}):n.success?t.jsx("span",{className:"text-green-400 flex-shrink-0 text-[10px] font-medium",children:"OK"}):t.jsx("span",{className:"text-red-400 flex-shrink-0 text-[10px] font-medium",children:"FAIL"})]}),i&&t.jsxs("div",{className:"px-3 py-2 bg-zinc-900/50 border-t border-border/30",children:[t.jsxs("div",{className:"mb-1.5",children:[t.jsx("span",{className:"text-zinc-500 text-[10px] uppercase tracking-wider",children:"Arguments"}),t.jsx("pre",{className:"mt-0.5 text-zinc-400 overflow-x-auto whitespace-pre-wrap text-[11px] font-mono",children:JSON.stringify(n.args,null,2)})]}),n.output&&t.jsxs("div",{children:[t.jsx("span",{className:"text-zinc-500 text-[10px] uppercase tracking-wider",children:"Output"}),t.jsx("pre",{className:`mt-0.5 overflow-x-auto whitespace-pre-wrap text-[11px] font-mono ${n.success?"text-zinc-400":"text-red-400"}`,children:tN(n.output)})]}),c&&t.jsxs("div",{className:"flex items-center gap-1.5 text-blue-400 mt-1",children:[t.jsx(ot,{className:"h-3 w-3 animate-spin"}),t.jsx("span",{className:"text-[11px]",children:"Executing..."})]})]})]})}function sN(n){return n==="critical"?"text-red-500 bg-red-500/10":n==="high"?"text-orange-400 bg-orange-400/10":n==="medium"?"text-yellow-400 bg-yellow-400/10":"text-green-400 bg-green-400/10"}function nN({steps:n}){const[i,d]=u.useState(!0);return t.jsxs("div",{className:"mb-3 rounded-lg border border-indigo-500/30 overflow-hidden",children:[t.jsxs("button",{onClick:()=>d(!i),className:"w-full flex items-center gap-2 px-3 py-2 bg-indigo-500/10 hover:bg-indigo-500/15 transition-colors text-left text-sm",children:[i?t.jsx(Fa,{className:"h-3 w-3 text-indigo-400"}):t.jsx(ca,{className:"h-3 w-3 text-indigo-400"}),t.jsx("span",{className:"text-indigo-300 font-medium",children:"Dry-Run Plan"}),t.jsxs("span",{className:"text-zinc-500 text-xs",children:[n.length," step",n.length!==1?"s":""]})]}),i&&t.jsx("div",{className:"px-3 py-2 space-y-1.5 bg-zinc-900/30",children:n.map(c=>t.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[t.jsxs("span",{className:"text-zinc-500 font-mono w-4 text-right flex-shrink-0",children:[c.index+1,"."]}),t.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium flex-shrink-0 ${sN(c.riskLevel)}`,children:c.riskLevel.toUpperCase()}),t.jsx("span",{className:"text-amber-300 font-mono",children:c.toolName}),t.jsx("span",{className:"text-zinc-500 truncate",children:K0(c.toolName,c.args)})]},c.index))})]})}function lN({agent:n,onClose:i,onSave:d}){const[c,m]=u.useState(n.description||""),[f,h]=u.useState(!1),[b,g]=u.useState(""),p=u.useRef(null);u.useEffect(()=>{var v;(v=p.current)==null||v.focus()},[]);const w=async()=>{h(!0),g("");try{const v=await fetch(`/api/agents/${n.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:c})});if(!v.ok){const k=await v.json().catch(()=>({error:"Failed to save"}));throw new Error(k.error||`HTTP ${v.status}`)}const y=await v.json();d(y.data)}catch(v){g(v instanceof Error?v.message:"Failed to save")}h(!1)};return u.useEffect(()=>{const v=y=>{y.key==="Escape"&&i()};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[i]),t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:i,children:t.jsxs("div",{className:"bg-surface border border-border rounded-xl shadow-2xl w-full max-w-2xl max-h-[80vh] flex flex-col",onClick:v=>v.stopPropagation(),children:[t.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold text-zinc-200",children:"System Prompt"}),t.jsxs("p",{className:"text-xs text-zinc-500 mt-0.5",children:[n.name," (",n.adapterType,")"]})]}),t.jsx("button",{onClick:i,className:"p-1.5 hover:bg-surface-hover rounded-lg transition-colors text-zinc-400 hover:text-zinc-200",children:t.jsx(tt,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"flex-1 p-5 overflow-hidden",children:t.jsx("textarea",{ref:p,value:c,onChange:v=>m(v.target.value),className:"w-full h-full min-h-[300px] bg-background border border-border rounded-lg px-4 py-3 resize-none focus:outline-none focus:border-indigo-500 text-zinc-200 text-sm font-mono placeholder-zinc-600",placeholder:"You are a helpful AI assistant...",spellCheck:!1})}),t.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-t border-border",children:[t.jsxs("div",{className:"text-xs text-zinc-500",children:[c.length.toLocaleString()," chars",b&&t.jsx("span",{className:"text-red-400 ml-3",children:b})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:i,className:"px-3 py-1.5 text-sm text-zinc-400 hover:text-zinc-200 transition-colors",children:"Cancel"}),t.jsxs("button",{onClick:w,disabled:f,className:"flex items-center gap-1.5 px-4 py-1.5 bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 rounded-lg text-sm font-medium transition-colors text-white",children:[f?t.jsx(ot,{className:"h-3 w-3 animate-spin"}):t.jsx(Fr,{className:"h-3 w-3"}),"Save"]})]})]})]})})}function iN(){var ie;const n=Dt(),[i,d]=u.useState([]),[c,m]=u.useState(null),[f,h]=u.useState([]),[b,g]=u.useState(null),[p,w]=u.useState([]),[v,y]=u.useState(""),[k,z]=u.useState(!1),[N,S]=u.useState(!0),[C,O]=u.useState(!1),[M,E]=u.useState([]),[ae,ce]=u.useState(!1),[B,q]=u.useState(null),[I,W]=u.useState(null),[X,le]=u.useState(""),J=u.useRef(null),re=u.useRef(null),ge=u.useRef(null);u.useEffect(()=>{var $;($=J.current)==null||$.scrollIntoView({behavior:"smooth"})},[p]),u.useEffect(()=>{const $=re.current;$&&($.style.height="48px",$.style.height=Math.min($.scrollHeight,200)+"px")},[v]);const G=u.useCallback($=>{const de=$?`/api/chat/conversations?agentId=${encodeURIComponent($)}`:"/api/chat/conversations";fetch(de).then(me=>me.json()).then(me=>h(me.data||[])).catch(()=>{})},[]);u.useEffect(()=>{fetch("/api/agents").then($=>$.json()).then($=>{const de=$.data||[];d(de),de.length>0&&!c?(m(de[0]),G(de[0].id)):G()}).catch(()=>{})},[]),u.useEffect(()=>{c&&G(c.id)},[c==null?void 0:c.id,G]);const ee=u.useCallback($=>{g($),fetch(`/api/chat/conversations/${$.id}`).then(de=>de.json()).then(de=>{var be;w(((be=de.data)==null?void 0:be.messages)||[]);const me=i.find(Ce=>{var je;return Ce.id===((je=de.data)==null?void 0:je.agentId)});me&&m(me)}).catch(()=>{})},[i]),xe=u.useCallback(()=>{var $;g(null),w([]),O(!1),E([]),($=re.current)==null||$.focus()},[]),oe=u.useCallback(($,de)=>{$.stopPropagation(),fetch(`/api/chat/conversations/${de}`,{method:"DELETE"}).then(()=>{h(me=>me.filter(be=>be.id!==de)),(b==null?void 0:b.id)===de&&xe()}).catch(()=>{})},[b,xe]),we=u.useCallback(async()=>{var be;if(!v.trim()||!c||k)return;const $={role:"user",content:v.trim(),timestamp:Date.now()};le(v.trim()),W(null),w(Ce=>[...Ce,$]),y(""),z(!0);const de={role:"assistant",content:"",timestamp:Date.now(),isStreaming:!0,toolCalls:[]};w(Ce=>[...Ce,de]);const me=new AbortController;ge.current=me;try{const Ce=await fetch(`/api/chat/${c.id}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:v.trim(),conversationId:b==null?void 0:b.id}),signal:me.signal});if(!Ce.body)throw new Error("No response body");const je=Ce.body.getReader(),Ze=new TextDecoder;let Pe="";for(;;){const{done:Gt,value:Pa}=await je.read();if(Gt)break;Pe+=Ze.decode(Pa,{stream:!0});const Et=Pe.split(`
587
+ `);Pe=Et.pop()||"";for(const ga of Et){if(!ga.startsWith("data: "))continue;let Ge;try{Ge=JSON.parse(ga.slice(6))}catch{continue}switch(Ge.type){case"system":O(!0),E(Ge.tools||[]);break;case"token":w(xt=>{const D=[...xt],P=D[D.length-1];return P&&P.role==="assistant"&&(D[D.length-1]={...P,content:P.content+Ge.text}),D});break;case"thinking":w(xt=>{const D=[...xt],P=D[D.length-1];return P&&P.role==="assistant"&&(D[D.length-1]={...P,thinking:(P.thinking||"")+Ge.text}),D});break;case"tool_start":w(xt=>{const D=[...xt],P=D[D.length-1];return P&&P.role==="assistant"&&(D[D.length-1]={...P,toolCalls:[...P.toolCalls||[],{name:Ge.name,args:Ge.args||{},output:"",success:!0,pending:!0}]}),D});break;case"tool_result":w(xt=>{var ve;const D=[...xt],P=D[D.length-1];if(P&&P.role==="assistant"&&((ve=P.toolCalls)!=null&&ve.length)){const Je=[...P.toolCalls];let Q=-1;for(let se=Je.length-1;se>=0;se--)if(Je[se].name===Ge.name&&Je[se].pending){Q=se;break}Q===-1&&(Q=Je.length-1),Je[Q]={...Je[Q],output:Ge.output,success:Ge.success,pending:!1},D[D.length-1]={...P,toolCalls:Je}}return D});break;case"done":w(xt=>{const D=[...xt],P=D[D.length-1];return P&&P.role==="assistant"&&(D[D.length-1]={...P,isStreaming:!1,usage:Ge.usage}),D}),Ge.conversationId&&!b&&(g({id:Ge.conversationId}),G(c==null?void 0:c.id));break;case"plan":Ge.plan&&Ge.plan.steps&&q(Ge.plan.steps);break;case"mission_suggestion":W({message:Ge.message,objective:X});break;case"error":w(xt=>{const D=[...xt],P=D[D.length-1];return P&&P.role==="assistant"&&(D[D.length-1]={...P,content:P.content?P.content+`
588
+
589
+ Error: ${Ge.message}`:`Error: ${Ge.message}`,isStreaming:!1}),D});break;case"reasoning":break}}}}catch(Ce){if(Ce instanceof DOMException&&Ce.name==="AbortError")w(je=>{const Ze=[...je],Pe=Ze[Ze.length-1];return Pe&&Pe.role==="assistant"&&(Ze[Ze.length-1]={...Pe,isStreaming:!1}),Ze});else{const je=Ce instanceof Error?Ce.message:"Connection error";w(Ze=>{const Pe=[...Ze],Gt=Pe[Pe.length-1];return Gt&&Gt.role==="assistant"&&(Pe[Pe.length-1]={...Gt,content:`Connection error: ${je}`,isStreaming:!1}),Pe})}}ge.current=null,z(!1),(be=re.current)==null||be.focus()},[v,c,k,b,G]),T=u.useCallback(()=>{var $;($=ge.current)==null||$.abort()},[]),Y=$=>{$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),we())};return t.jsxs("div",{className:"flex h-full bg-background",children:[N&&t.jsxs("div",{className:"w-64 border-r border-border flex flex-col bg-surface flex-shrink-0",children:[t.jsx("div",{className:"p-3 border-b border-border",children:t.jsxs("button",{onClick:xe,className:"w-full flex items-center justify-center gap-2 px-3 py-2 bg-indigo-600 hover:bg-indigo-700 rounded-lg text-sm font-medium transition-colors text-white",children:[t.jsx(gt,{className:"h-4 w-4"}),"New Chat"]})}),t.jsxs("div",{className:"flex-1 overflow-y-auto",children:[f.length===0&&t.jsx("p",{className:"px-3 py-4 text-xs text-zinc-500 text-center",children:"No conversations yet"}),f.map($=>t.jsxs("button",{onClick:()=>ee($),className:`group w-full text-left px-3 py-2.5 text-sm hover:bg-surface-hover transition-colors flex items-center gap-2 ${(b==null?void 0:b.id)===$.id?"bg-indigo-500/10 text-indigo-400":"text-zinc-400"}`,children:[t.jsx(Ts,{className:"h-3.5 w-3.5 flex-shrink-0"}),t.jsx("span",{className:"truncate flex-1",children:$.title||"Untitled"}),t.jsx("button",{onClick:de=>oe(de,$.id),className:"opacity-0 group-hover:opacity-100 p-0.5 hover:text-red-400 transition-opacity",title:"Delete conversation",children:t.jsx(qt,{className:"h-3 w-3"})})]},$.id))]})]}),t.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border bg-surface",children:[t.jsx("button",{onClick:()=>S(!N),className:"p-1.5 hover:bg-surface-hover rounded-lg transition-colors text-zinc-400 hover:text-zinc-200",title:N?"Hide sidebar":"Show sidebar",children:N?t.jsx(yv,{className:"h-4 w-4"}):t.jsx(vv,{className:"h-4 w-4"})}),t.jsx("select",{value:(c==null?void 0:c.id)||"",onChange:$=>{const de=i.find(me=>me.id===$.target.value);de&&m(de)},className:"bg-background border border-border rounded-lg px-3 py-1.5 text-sm text-zinc-200 focus:outline-none focus:border-indigo-500",children:i.map($=>t.jsxs("option",{value:$.id,children:[$.name," (",$.adapterType,")"]},$.id))}),c&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-xs text-zinc-500",children:((ie=c.adapterConfig)==null?void 0:ie.model)||W1(c.adapterType)}),t.jsx("button",{onClick:()=>ce(!0),className:"p-1.5 hover:bg-surface-hover rounded-lg transition-colors text-zinc-500 hover:text-zinc-200",title:"Edit system prompt",children:t.jsx(In,{className:"h-3.5 w-3.5"})})]}),C&&t.jsxs("div",{className:"ml-auto flex items-center gap-1.5 text-xs text-amber-400/80",title:`Available tools: ${M.join(", ")}`,children:[t.jsx(Wn,{className:"h-3 w-3"}),t.jsxs("span",{children:[M.length," tools"]})]})]}),C&&t.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5 bg-amber-500/10 border-b border-amber-500/20 text-amber-400 text-xs",children:[t.jsx(mt,{className:"h-3 w-3 flex-shrink-0"}),t.jsx("span",{children:"Tools are auto-approved in chat mode. Shell commands and file operations execute without confirmation."})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-4",children:[p.length===0&&t.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-zinc-500",children:[t.jsx(Ts,{className:"h-12 w-12 mb-4 text-indigo-500/40"}),t.jsx("h2",{className:"text-xl font-semibold text-zinc-200 mb-2",children:"Start a conversation"}),t.jsxs("p",{className:"text-sm mb-6",children:["Type a message to chat with ",(c==null?void 0:c.name)||"your agent"]}),t.jsx("div",{className:"grid grid-cols-2 gap-2 max-w-md",children:["Review my code for bugs","Explain this codebase","Write unit tests","Help me refactor"].map($=>t.jsx("button",{onClick:()=>y($),className:"px-3 py-2 text-sm bg-surface hover:bg-surface-hover border border-border rounded-lg text-left text-zinc-300 transition-colors",children:$},$))})]}),p.map(($,de)=>{var me,be,Ce;return t.jsx("div",{className:`flex ${$.role==="user"?"justify-end":"justify-start"}`,children:t.jsxs("div",{className:`max-w-[80%] rounded-2xl px-4 py-3 ${$.role==="user"?"bg-indigo-600 text-white":"bg-surface border border-border text-zinc-100"}`,children:[$.thinking&&t.jsxs("div",{className:"mb-2 px-2 py-1.5 bg-zinc-800/30 rounded-lg text-[11px] text-zinc-500 italic border border-zinc-700/30",children:[t.jsx("span",{className:"text-zinc-600 text-[10px] uppercase tracking-wider block mb-0.5",children:"Thinking"}),$.thinking.substring(0,300),$.thinking.length>300&&"..."]}),(me=$.toolCalls)==null?void 0:me.map((je,Ze)=>t.jsx(aN,{tc:je},Ze)),$.content&&((/(?:API[_\s]?KEY|api[_\s]?key).*(?:not set|not configured|missing|invalid|required)/i.test($.content)||/(?:ANTHROPIC|OPENAI|GEMINI|XAI|MISTRAL|GROK)_API_KEY/i.test($.content))&&$.role==="assistant"?t.jsxs("div",{className:"space-y-2",children:[t.jsx("div",{className:"whitespace-pre-wrap break-words",children:$.content}),t.jsxs(Xa,{to:"/keys",className:"inline-flex items-center gap-2 rounded-lg border border-purple-500/30 bg-purple-500/10 px-3 py-2 text-sm text-purple-400 hover:bg-purple-500/20 transition-colors",children:[t.jsx(ri,{className:"h-4 w-4"}),"Set up your API key"]})]}):t.jsx("div",{className:"whitespace-pre-wrap break-words",children:$.content})),$.isStreaming&&!$.content&&!((be=$.toolCalls)!=null&&be.length)&&t.jsxs("div",{className:"flex items-center gap-1.5 text-zinc-400",children:[t.jsx(ot,{className:"h-3 w-3 animate-spin"}),t.jsx("span",{className:"text-xs",children:"Thinking..."})]}),$.isStreaming&&!$.content&&(((Ce=$.toolCalls)==null?void 0:Ce.length)??0)>0&&t.jsxs("div",{className:"flex items-center gap-1.5 text-zinc-400 mt-1",children:[t.jsx(ot,{className:"h-3 w-3 animate-spin"}),t.jsx("span",{className:"text-xs",children:"Processing tools..."})]}),$.isStreaming&&$.content&&t.jsx("span",{className:"inline-block w-1.5 h-4 bg-indigo-400 animate-pulse ml-0.5 rounded-sm"}),$.usage&&($.usage.inputTokens>0||$.usage.outputTokens>0)&&t.jsxs("div",{className:"mt-1.5 text-[10px] text-zinc-500 flex items-center gap-2",children:[t.jsxs("span",{children:[$.usage.inputTokens+$.usage.outputTokens," tokens"]}),$.usage.costUsd>0&&t.jsxs("span",{children:["$",$.usage.costUsd.toFixed(4)]}),$.toolCalls&&$.toolCalls.length>0&&t.jsxs("span",{children:[$.toolCalls.length," tool call",$.toolCalls.length>1?"s":""]})]})]})},de)}),B&&B.length>0&&t.jsx("div",{className:"flex justify-start",children:t.jsx("div",{className:"max-w-[80%]",children:t.jsx(nN,{steps:B})})}),I&&t.jsxs("div",{className:"mx-4 my-2 p-4 bg-purple-900/30 border border-purple-500/50 rounded-lg",children:[t.jsxs("p",{className:"text-sm text-purple-300",children:[t.jsx(en,{className:"inline h-4 w-4 mr-1.5 -mt-0.5"}),I.message]}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx("button",{onClick:()=>n(`/missions?objective=${encodeURIComponent(I.objective)}`),className:"px-3 py-1.5 bg-purple-600 hover:bg-purple-500 rounded text-sm text-white transition-colors",children:"Run as Mission"}),t.jsx("button",{onClick:()=>W(null),className:"px-3 py-1.5 bg-gray-700 hover:bg-gray-600 rounded text-sm text-zinc-200 transition-colors",children:"Continue in Chat"})]})]}),t.jsx("div",{ref:J})]}),t.jsxs("div",{className:"border-t border-border px-4 py-3 bg-surface",children:[t.jsxs("div",{className:"flex gap-2 items-end max-w-4xl mx-auto",children:[t.jsx("textarea",{ref:re,value:v,onChange:$=>y($.target.value),onKeyDown:Y,placeholder:`Message ${(c==null?void 0:c.name)||"agent"}...`,rows:1,className:"flex-1 bg-background border border-border rounded-xl px-4 py-3 resize-none focus:outline-none focus:border-indigo-500 placeholder-zinc-500 text-zinc-200 text-sm",style:{minHeight:"48px",maxHeight:"200px"},disabled:k||!c}),k?t.jsx("button",{onClick:T,className:"px-4 py-3 bg-red-600 hover:bg-red-700 rounded-xl transition-colors text-white flex-shrink-0",title:"Stop generation",children:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}):t.jsx("button",{onClick:we,disabled:!v.trim()||!c,className:"px-4 py-3 bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed rounded-xl transition-colors text-white flex-shrink-0",title:"Send message",children:t.jsx(au,{className:"h-5 w-5"})})]}),!c&&i.length===0&&t.jsx("p",{className:"text-xs text-yellow-500 mt-2 text-center",children:"No agents configured. Create one first in the Agents page."})]})]}),ae&&c&&t.jsx(lN,{agent:c,onClose:()=>ce(!1),onSave:$=>{m($),d(de=>de.map(me=>me.id===$.id?$:me)),ce(!1)}})]})}let rN=0;function cN({message:n,type:i,onDismiss:d}){return u.useEffect(()=>{const c=setTimeout(d,4e3);return()=>clearTimeout(c)},[d]),t.jsxs("div",{className:`px-4 py-2.5 rounded-lg shadow-lg text-white text-sm font-medium flex items-center gap-2 animate-[fadeSlideIn_0.3s_ease-out]
590
+ ${i==="success"?"bg-green-600":i==="error"?"bg-red-600":"bg-blue-600"}`,children:[i==="success"&&t.jsx(ut,{className:"h-4 w-4"}),i==="error"&&t.jsx(At,{className:"h-4 w-4"}),i==="info"&&t.jsx(ot,{className:"h-4 w-4"}),n]})}function oN({toasts:n,removeToast:i}){return n.length===0?null:t.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2",children:n.map(d=>t.jsx(cN,{message:d.message,type:d.type,onDismiss:()=>i(d.id)},d.id))})}function _r({onClick:n,loading:i,disabled:d,className:c,icon:m,loadingText:f,children:h}){return t.jsx("button",{onClick:n,disabled:i||d,className:`${c} ${i||d?"opacity-60 cursor-not-allowed":""}`,children:i?t.jsxs(t.Fragment,{children:[t.jsx(ot,{className:"h-3.5 w-3.5 animate-spin"}),f||h]}):t.jsxs(t.Fragment,{children:[m,h]})})}function dN(n){switch(n){case"osint":return t.jsx(Qr,{className:"h-4 w-4"});case"research":return t.jsx(Rs,{className:"h-4 w-4"});case"code":return t.jsx(cv,{className:"h-4 w-4"});case"audit":return t.jsx(Ms,{className:"h-4 w-4"});case"analysis":return t.jsx(ka,{className:"h-4 w-4"});case"creation":return t.jsx(an,{className:"h-4 w-4"});default:return t.jsx(Es,{className:"h-4 w-4"})}}function uN(n){switch(n){case"completed":return t.jsx(Id,{className:"h-4 w-4 text-green-400"});case"in_progress":return t.jsx(ot,{className:"h-4 w-4 text-amber-400 animate-spin"});case"failed":return t.jsx(At,{className:"h-4 w-4 text-red-400"});case"pending":return t.jsx(kd,{className:"h-4 w-4 text-zinc-600"});case"skipped":return t.jsx(kd,{className:"h-4 w-4 text-zinc-700"});default:return t.jsx(kd,{className:"h-4 w-4 text-zinc-600"})}}function xu(n){return n>=.8?"text-green-400":n>=.6?"text-amber-400":"text-red-400"}function V0(n){return n>=.8?"bg-green-500/10 border-green-500/20":n>=.6?"bg-amber-500/10 border-amber-500/20":"bg-red-500/10 border-red-500/20"}function Gd(n){switch(n){case"search":return"bg-blue-500/10 text-blue-400 border-blue-500/20";case"scrape":return"bg-emerald-500/10 text-emerald-400 border-emerald-500/20";case"analyze":return"bg-purple-500/10 text-purple-400 border-purple-500/20";case"create":return"bg-amber-500/10 text-amber-400 border-amber-500/20";case"validate":return"bg-cyan-500/10 text-cyan-400 border-cyan-500/20";default:return"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}}const mN=[{label:"OSINT investigation",prompt:"OSINT investigation on "},{label:"Security audit",prompt:"Security audit of "},{label:"Market analysis",prompt:"Market analysis of "},{label:"Build a landing page",prompt:"Build a landing page for "},{label:"Competitive research",prompt:"Competitive research on "},{label:"Code review",prompt:"Review all PRs from this week on "}];function Ur({label:n,score:i}){const d=Math.round(i*100);return t.jsxs("div",{className:`flex flex-col items-center rounded-lg border px-4 py-3 ${V0(i)}`,children:[t.jsx("span",{className:"text-[10px] uppercase tracking-wider text-zinc-500 mb-1",children:n}),t.jsxs("span",{className:`text-2xl font-bold tabular-nums ${xu(i)}`,children:[d,"%"]})]})}function xN({finding:n}){const[i,d]=u.useState(!1),c=Math.round(n.confidence*100);return t.jsxs("div",{className:"rounded-lg border border-border/50 bg-zinc-900/50 overflow-hidden",children:[t.jsxs("button",{onClick:()=>d(!i),className:"w-full flex items-start gap-2 px-3 py-2.5 text-left hover:bg-zinc-800/30 transition-colors",children:[t.jsx("span",{className:"mt-0.5 flex-shrink-0",children:i?t.jsx(Fa,{className:"h-3.5 w-3.5 text-zinc-500"}):t.jsx(ca,{className:"h-3.5 w-3.5 text-zinc-500"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded border font-medium ${Gd(n.type)}`,children:n.type}),t.jsx("span",{className:"text-sm font-medium text-zinc-200 truncate",children:n.title})]}),t.jsxs("div",{className:"flex items-center gap-2 mt-1 text-[11px] text-zinc-500",children:[t.jsxs("span",{className:xu(n.confidence),children:[c,"% confidence"]}),n.source&&t.jsxs("span",{children:["via ",n.source]})]})]})]}),i&&t.jsxs("div",{className:"px-3 pb-3 pt-0 border-t border-border/30",children:[t.jsx("p",{className:"text-xs text-zinc-400 whitespace-pre-wrap mt-2",children:n.content}),n.sourceUrl&&t.jsx("a",{href:n.sourceUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-block mt-2 text-[11px] text-purple-400 hover:text-purple-300 underline",children:n.sourceUrl})]})]})}function fN({content:n}){const i=n.split(`
591
+ `),d=[];for(let c=0;c<i.length;c++){const m=i[c];if(c===0&&m==="---"){const f=i.indexOf("---",1);if(f>0){c=f;continue}}if(m.startsWith("# "))d.push(t.jsx("h1",{className:"text-xl font-bold text-zinc-100 mt-6 mb-2",children:m.slice(2)},c));else if(m.startsWith("## "))d.push(t.jsx("h2",{className:"text-lg font-semibold text-zinc-200 mt-5 mb-2",children:m.slice(3)},c));else if(m.startsWith("### "))d.push(t.jsx("h3",{className:"text-base font-semibold text-zinc-300 mt-4 mb-1",children:m.slice(4)},c));else if(m.startsWith("#### "))d.push(t.jsx("h4",{className:"text-sm font-semibold text-zinc-300 mt-3 mb-1",children:m.slice(5)},c));else if(m.startsWith("- ")||m.startsWith("* "))d.push(t.jsxs("div",{className:"flex gap-2 text-sm text-zinc-400 ml-2 my-0.5",children:[t.jsx("span",{className:"text-zinc-600 flex-shrink-0",children:"-"}),t.jsx("span",{children:Rd(m.slice(2))})]},c));else if(/^\d+\.\s/.test(m)){const f=m.match(/^(\d+)\.\s(.*)$/);f&&d.push(t.jsxs("div",{className:"flex gap-2 text-sm text-zinc-400 ml-2 my-0.5",children:[t.jsxs("span",{className:"text-zinc-600 flex-shrink-0 tabular-nums",children:[f[1],"."]}),t.jsx("span",{children:Rd(f[2])})]},c))}else m.startsWith("---")||m.startsWith("***")?d.push(t.jsx("hr",{className:"border-border/50 my-4"},c)):m.trim()===""?d.push(t.jsx("div",{className:"h-2"},c)):d.push(t.jsx("p",{className:"text-sm text-zinc-400 my-1",children:Rd(m)},c))}return t.jsx("div",{className:"space-y-0",children:d})}function Rd(n){return n.split(/(\*\*[^*]+\*\*)/g).map((d,c)=>{if(d.startsWith("**")&&d.endsWith("**"))return t.jsx("strong",{className:"text-zinc-200 font-semibold",children:d.slice(2,-2)},c);const m=/\[([^\]]+)\]\(([^)]+)\)/g,f=[];let h=0,b;for(;(b=m.exec(d))!==null;)b.index>h&&f.push(d.slice(h,b.index)),f.push(t.jsx("a",{href:b[2],target:"_blank",rel:"noopener noreferrer",className:"text-purple-400 hover:text-purple-300 underline",children:b[1]},`${c}-${b.index}`)),h=b.index+b[0].length;return h<d.length&&f.push(d.slice(h)),f.length>0?t.jsx("span",{children:f},c):d})}function hN({missions:n,selectedId:i,onSelect:d}){const[c,m]=u.useState(""),[f,h]=u.useState("all"),[b,g]=u.useState("all"),[p,w]=u.useState("recent"),v=u.useMemo(()=>{let y=[...n];if(c){const k=c.toLowerCase();y=y.filter(z=>{var N,S,C;return((N=z.title)==null?void 0:N.toLowerCase().includes(k))||((S=z.objective)==null?void 0:S.toLowerCase().includes(k))||((C=z.type)==null?void 0:C.toLowerCase().includes(k))})}switch(f!=="all"&&(y=y.filter(k=>k.type===f)),b!=="all"&&(y=y.filter(k=>k.status===b)),p){case"recent":y.sort((k,z)=>(z.createdAt||0)-(k.createdAt||0));break;case"cost":y.sort((k,z)=>(z.spentUsd||0)-(k.spentUsd||0));break;case"quality":y.sort((k,z)=>{var N,S;return(((N=z.evaluation)==null?void 0:N.overall)||0)-(((S=k.evaluation)==null?void 0:S.overall)||0)});break;case"findings":y.sort((k,z)=>{var N,S;return(((N=z.findings)==null?void 0:N.length)||0)-(((S=k.findings)==null?void 0:S.length)||0)});break}return y},[n,c,f,b,p]);return n.length===0?null:t.jsxs("div",{className:"border-b border-border/50 pb-4 mb-4",children:[t.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-zinc-600 px-1 mb-3",children:"Missions"}),t.jsxs("div",{className:"grid grid-cols-4 gap-2 mb-4 text-center",children:[t.jsxs("div",{className:"bg-zinc-800/70 rounded p-2",children:[t.jsx("div",{className:"text-lg font-bold text-white",children:n.length}),t.jsx("div",{className:"text-[10px] text-zinc-500",children:"Total"})]}),t.jsxs("div",{className:"bg-zinc-800/70 rounded p-2",children:[t.jsx("div",{className:"text-lg font-bold text-green-400",children:n.filter(y=>y.status==="completed").length}),t.jsx("div",{className:"text-[10px] text-zinc-500",children:"Completed"})]}),t.jsxs("div",{className:"bg-zinc-800/70 rounded p-2",children:[t.jsxs("div",{className:"text-lg font-bold text-white",children:["$",n.reduce((y,k)=>y+(k.spentUsd||0),0).toFixed(2)]}),t.jsx("div",{className:"text-[10px] text-zinc-500",children:"Total Cost"})]}),t.jsxs("div",{className:"bg-zinc-800/70 rounded p-2",children:[t.jsx("div",{className:"text-lg font-bold text-white",children:n.reduce((y,k)=>{var z;return y+(((z=k.findings)==null?void 0:z.length)||0)},0)}),t.jsx("div",{className:"text-[10px] text-zinc-500",children:"Findings"})]})]}),t.jsx("div",{className:"mb-3",children:t.jsx("input",{type:"text",placeholder:"Search missions...",value:c,onChange:y=>m(y.target.value),className:"w-full px-3 py-2 bg-zinc-800 border border-zinc-700 rounded-lg text-sm text-white placeholder-zinc-500 focus:outline-none focus:border-purple-500"})}),t.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",children:["all","osint","research","code","audit","creation","analysis"].map(y=>t.jsx("button",{onClick:()=>h(y),className:`px-2.5 py-1 rounded-full text-[10px] font-medium transition-colors ${f===y?"bg-purple-600 text-white":"bg-zinc-800 text-zinc-400 hover:bg-zinc-700"}`,children:y==="all"?"All":y.charAt(0).toUpperCase()+y.slice(1)},y))}),t.jsx("div",{className:"flex gap-1.5 mb-3",children:["all","completed","executing","failed","interrupted"].map(y=>t.jsxs("button",{onClick:()=>g(y),className:`px-2 py-1 rounded text-[10px] transition-colors ${b===y?"bg-zinc-700 text-white":"text-zinc-500 hover:text-zinc-300"}`,children:[y==="all"?"All":y,y!=="all"&&` (${n.filter(k=>k.status===y).length})`]},y))}),t.jsxs("div",{className:"flex items-center gap-2 mb-2 text-[10px] text-zinc-500",children:[t.jsx("span",{children:"Sort:"}),["recent","cost","quality","findings"].map(y=>t.jsx("button",{onClick:()=>w(y),className:`transition-colors ${p===y?"text-purple-400":"hover:text-zinc-300"}`,children:y},y))]}),t.jsxs("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:[v.map(y=>{var k,z;return t.jsx("button",{onClick:()=>d(y),className:`w-full text-left rounded-lg transition-colors ${i===y.id?"bg-purple-500/10 border border-purple-500/20":"hover:bg-zinc-800/50"}`,children:t.jsxs("div",{className:"flex items-center gap-3 p-3",children:[t.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${y.status==="completed"?"bg-green-500":y.status==="executing"?"bg-blue-500 animate-pulse":y.status==="failed"?"bg-red-500":y.status==="interrupted"?"bg-yellow-500":"bg-gray-500"}`}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-white truncate",children:y.title}),t.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[t.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-zinc-800 text-zinc-400",children:y.type}),t.jsxs("span",{className:"text-[10px] text-zinc-500",children:["$",(y.spentUsd||0).toFixed(2)]}),t.jsxs("span",{className:"text-[10px] text-zinc-500",children:[((k=y.findings)==null?void 0:k.length)||0," findings"]}),((z=y.evaluation)==null?void 0:z.overall)!=null&&t.jsxs("span",{className:`text-[10px] font-medium ${y.evaluation.overall>=.8?"text-green-400":y.evaluation.overall>=.5?"text-yellow-400":"text-red-400"}`,children:[Math.round(y.evaluation.overall*100),"%"]})]})]}),t.jsx("span",{className:"text-[10px] text-zinc-600 flex-shrink-0",children:new Date(y.createdAt).toLocaleDateString()})]})},y.id)}),v.length===0&&t.jsx("p",{className:"text-xs text-zinc-600 text-center py-4",children:"No missions match filters"})]})]})}function pN(){var ve,Je;const[n,i]=Qy(),[d,c]=u.useState("empty"),[m,f]=u.useState(""),[h,b]=u.useState(null),[g,p]=u.useState([]),[w,v]=u.useState(""),[y,k]=u.useState([]),[z,N]=u.useState(!1),[S,C]=u.useState(null),O=u.useRef(null),M=u.useRef(null),E=u.useRef(null),ae=u.useRef(!1);u.useEffect(()=>{ks.list().then(Q=>{k(Q.data||[])}).catch(()=>{})},[]),u.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[g]),u.useEffect(()=>()=>{var Q;(Q=O.current)==null||Q.close()},[]);const ce=u.useCallback(async Q=>{var pe,ze;const se=Q??m;if(se.trim()){c("planning"),v(""),p([]),b(null),N(!1);try{const Ve=await ks.plan(se.trim());b(Ve.data),c("planned")}catch(Ve){v(((ze=(pe=Ve==null?void 0:Ve.body)==null?void 0:pe.error)==null?void 0:ze.message)||Ve.message||"Planning failed"),c("error")}}},[m]);u.useEffect(()=>{if(ae.current)return;const Q=n.get("objective");Q&&!h&&(ae.current=!0,f(Q),i({},{replace:!0}),ce(Q))},[n,h,ce,i]);const B=u.useCallback(async()=>{var Ve;if(!h)return;c("executing"),p([]),N(!1),C(null);const Q=localStorage.getItem("nestor_token"),se=(Ve=document.cookie.match(/(?:^|; )nestor-csrf=([^;]*)/))==null?void 0:Ve[1],pe=localStorage.getItem("nestor_tenant_id"),ze={"Content-Type":"application/json"};Q&&(ze.Authorization=`Bearer ${Q}`),se&&(ze["X-CSRF-Token"]=decodeURIComponent(se)),pe&&(ze["X-Tenant-ID"]=pe);try{const St=await fetch(`/api/missions/${h.id}/execute`,{method:"POST",headers:ze});if(!St.ok||!St.body){v("Failed to start execution"),c("error");return}const Wa=St.body.getReader(),tc=new TextDecoder;let es="";const di=ba=>{if(ba.startsWith("data: "))try{const bt=JSON.parse(ba.slice(6));q(bt)}catch{}};await(async()=>{for(;;){const{done:ba,value:bt}=await Wa.read();if(ba)break;es+=tc.decode(bt,{stream:!0});const ua=es.split(`
592
+ `);es=ua.pop()||"";for(const Tt of ua)di(Tt.trim())}es.trim()&&di(es.trim())})()}catch(St){v(St.message||"Execution failed"),c("error")}},[h]),q=u.useCallback(Q=>{switch(Q.type){case"status":b(se=>se&&{...se,status:Q.status}),Q.status==="evaluating"&&c("evaluating");break;case"sub_objective_start":C(Q.id),b(se=>{if(!se)return se;const pe=se.subObjectives.map(ze=>ze.id===Q.id?{...ze,status:"in_progress"}:ze);return{...se,subObjectives:pe}});break;case"sub_objective_complete":b(se=>{if(!se)return se;const pe=se.subObjectives.map(ze=>ze.id===Q.id?{...ze,status:Q.status}:ze);return{...se,subObjectives:pe}});break;case"finding":p(se=>[...se,Q]);break;case"evaluation":b(se=>se&&{...se,evaluation:{completeness:Q.completeness,accuracy:Q.accuracy,depth:Q.depth,relevance:Q.relevance,overall:Q.overall,gaps:Q.gaps||[],recommendation:Q.recommendation||"deliver",suggestedActions:Q.suggestedActions||[]}});break;case"iteration":b(se=>se&&{...se,iteration:Q.iteration});break;case"budget_exhausted":break;case"complete":b(se=>se&&{...se,status:Q.status||"completed",spentUsd:Q.cost||se.spentUsd,iteration:Q.iterations||se.iteration}),Q.missionId&&ks.get(Q.missionId).then(se=>{b(se.data)}).catch(()=>{}),c("complete"),ks.list().then(se=>k(se.data||[])).catch(()=>{});break;case"error":v(Q.message),c("error");break}},[]),I=u.useCallback(async()=>{if(h)try{await ks.cancel(h.id),b(Q=>Q&&{...Q,status:"cancelled"}),c("empty")}catch{}},[h]),W=u.useCallback(()=>{var Q,se;c("empty"),f(""),b(null),p([]),v(""),N(!1),C(null),(Q=O.current)==null||Q.close(),(se=E.current)==null||se.focus()},[]),X=u.useCallback(Q=>{b(Q),f(Q.objective),p((Q.findings||[]).map(se=>({id:se.id,type:se.type,title:se.title,content:se.content,confidence:se.confidence,source:se.source,sourceUrl:se.sourceUrl}))),Q.status==="completed"||Q.status==="failed"?c("complete"):(Q.status,c("planned"))},[]),le=u.useCallback(()=>{if(!(h!=null&&h.report))return;const Q=new Blob([h.report],{type:"text/markdown"}),se=URL.createObjectURL(Q),pe=document.createElement("a");pe.href=se,pe.download=`${h.title.replace(/[^a-zA-Z0-9]/g,"_")}_report.md`,pe.click(),URL.revokeObjectURL(se)},[h]),J=u.useCallback(Q=>{var se;f(Q),(se=E.current)==null||se.focus()},[]),re=Dt(),[ge,G]=u.useState([]),ee=u.useCallback((Q,se="info")=>{const pe=++rN;G(ze=>[...ze,{id:pe,message:Q,type:se}])},[]),xe=u.useCallback(Q=>{G(se=>se.filter(pe=>pe.id!==Q))},[]),[oe,we]=u.useState(!1),[T,Y]=u.useState(!1),[ie,$]=u.useState(!1),[de,me]=u.useState(!1),[be,Ce]=u.useState(!1),je=oe||T||ie||de;u.useEffect(()=>{Ce(!1)},[h==null?void 0:h.id]);const Ze=u.useCallback(()=>{var Ve;const Q=localStorage.getItem("nestor_token"),se=(Ve=document.cookie.match(/(?:^|; )nestor-csrf=([^;]*)/))==null?void 0:Ve[1],pe=localStorage.getItem("nestor_tenant_id"),ze={"Content-Type":"application/json"};return Q&&(ze.Authorization=`Bearer ${Q}`),se&&(ze["X-CSRF-Token"]=decodeURIComponent(se)),pe&&(ze["X-Tenant-ID"]=pe),ze},[]),Pe=u.useCallback(async Q=>{var se;we(!0);try{const pe=Ze(),ze=await fetch(`/api/missions/${Q}/iterate`,{method:"POST",headers:pe});if(!ze.ok){const St=await ze.json().catch(()=>({}));ee(((se=St==null?void 0:St.error)==null?void 0:se.message)||"Iterate request failed","error");return}ee("Iterating on gaps...","info");const Ve=await ks.get(Q);b(Ve.data),c("planned"),setTimeout(()=>{B()},500)}catch(pe){ee(pe instanceof Error?pe.message:"Iterate failed","error")}finally{we(!1)}},[B,ee,Ze]),Gt=u.useCallback(async Q=>{var se;if(!(!((se=Q.evaluation)!=null&&se.gaps)||Q.evaluation.gaps.length===0)){Y(!0);try{const pe=`Deep dive follow-up for mission "${Q.title}". Focus ONLY on these gaps identified in the evaluation:
593
+ ${Q.evaluation.gaps.map(Ve=>`- ${Ve}`).join(`
594
+ `)}
595
+
596
+ Previous findings are available in the knowledge graph. Do NOT repeat what was already found. Use different approaches and sources than the original mission.`,ze=await ks.plan(pe,{maxBudget:3});ze.data&&(ee("Deep-dive mission created!","success"),b(ze.data),f(pe),p([]),c("planned"))}catch(pe){ee(pe instanceof Error?pe.message:"Deep dive planning failed","error")}finally{Y(!1)}}},[ee]),Pa=u.useCallback(async Q=>{$(!0);try{const se=Ze();(await fetch(`/api/brain/reindex/${Q}`,{method:"POST",headers:se})).ok?(ee("Archived to Knowledge Graph","success"),Ce(!0)):ee("Archive failed — brain endpoint may not be available.","error")}catch{ee("Archive failed — brain endpoint may not be available.","error")}finally{$(!1)}},[ee,Ze]),Et=u.useCallback(async Q=>{me(!0);try{ee("Re-running mission...","info");const se=await ks.plan(Q.objective,{maxBudget:Q.maxBudgetUsd});se.data&&(b(se.data),f(Q.objective),p([]),c("planned"),ee("Fresh mission planned. Executing...","success"),setTimeout(()=>{B()},500))}catch(se){ee(se instanceof Error?se.message:"Re-run planning failed","error")}finally{me(!1)}},[ee,B]),ga=u.useCallback(Q=>{const se=(Q.findings||[]).sort((Ve,St)=>(St.confidence??0)-(Ve.confidence??0)).slice(0,3).map(Ve=>Ve.title).join(", "),pe=se?`Key findings: ${se}`:"",ze=encodeURIComponent(`Mission: ${Q.title}. ${pe}`);re(`/chat?context=mission:${Q.id}&prefill=${ze}`)},[re]),Ge=u.useCallback(Q=>{const se=new Blob([JSON.stringify(Q,null,2)],{type:"application/json"}),pe=URL.createObjectURL(se),ze=document.createElement("a");ze.href=pe,ze.download=`mission-${Q.id.substring(0,8)}-${(Q.title||"export").replace(/[^a-z0-9]/gi,"-").substring(0,30)}.json`,ze.click(),URL.revokeObjectURL(pe)},[]),xt=(h==null?void 0:h.subObjectives.filter(Q=>Q.status==="completed").length)||0,D=(h==null?void 0:h.subObjectives.length)||1,P=Math.round(xt/D*100);return t.jsxs("div",{className:"flex h-full",children:[t.jsx(oN,{toasts:ge,removeToast:xe}),t.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-3 h-14 px-6 border-b border-border bg-surface flex-shrink-0",children:[t.jsx(Qa,{className:"h-5 w-5 text-purple-400"}),t.jsx("h1",{className:"text-lg font-semibold text-zinc-100",children:"Missions"}),h&&d!=="empty"&&t.jsxs("div",{className:"flex items-center gap-2 ml-auto text-xs text-zinc-500",children:[h.type&&t.jsxs("span",{className:`flex items-center gap-1 px-2 py-0.5 rounded border ${Gd(h.type)}`,children:[dN(h.type),h.type]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Ca,{className:"h-3 w-3"}),"$",h.spentUsd.toFixed(4)," / $",h.maxBudgetUsd.toFixed(2)]}),h.iteration>0&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Mt,{className:"h-3 w-3"}),"Iteration ",h.iteration,"/",h.maxIterations]}),t.jsx("button",{onClick:W,className:"ml-2 p-1 rounded text-zinc-500 hover:text-zinc-300 hover:bg-zinc-800 transition-colors",title:"New mission",children:t.jsx(tt,{className:"h-4 w-4"})})]})]}),d==="empty"&&t.jsx("div",{className:"flex-1 flex flex-col items-center justify-center px-6",children:t.jsxs("div",{className:"w-full max-w-2xl",children:[t.jsx("div",{className:"flex items-center justify-center mb-6",children:t.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-purple-600/20 border border-purple-500/20",children:t.jsx(Qa,{className:"h-8 w-8 text-purple-400"})})}),t.jsx("h2",{className:"text-2xl font-bold text-zinc-100 text-center mb-2",children:"What's your mission?"}),t.jsx("p",{className:"text-sm text-zinc-500 text-center mb-8",children:"Autonomous AI agents will plan, execute, and deliver results."}),t.jsx(hN,{missions:y,selectedId:null,onSelect:X}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{ref:E,type:"text",value:m,onChange:Q=>f(Q.target.value),onKeyDown:Q=>Q.key==="Enter"&&ce(),placeholder:"Describe your mission objective...",className:"flex-1 rounded-lg border border-border bg-zinc-900 px-4 py-3 text-sm text-zinc-200 placeholder:text-zinc-600 focus:outline-none focus:ring-2 focus:ring-purple-500/40 focus:border-purple-500/40",autoFocus:!0}),t.jsxs("button",{onClick:()=>ce(),disabled:!m.trim(),className:"flex items-center gap-2 rounded-lg bg-purple-600 px-5 py-3 text-sm font-medium text-white hover:bg-purple-500 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[t.jsx(en,{className:"h-4 w-4"}),"Plan"]})]}),t.jsx("div",{className:"flex flex-wrap gap-2 mt-4 justify-center",children:mN.map(Q=>t.jsx("button",{onClick:()=>J(Q.prompt),className:"px-3 py-1.5 rounded-full border border-border/50 text-xs text-zinc-500 hover:text-zinc-300 hover:border-purple-500/30 hover:bg-purple-500/5 transition-colors",children:Q.label},Q.label))})]})}),d==="planning"&&t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6",children:[t.jsx(ot,{className:"h-10 w-10 text-purple-400 animate-spin mb-4"}),t.jsx("h2",{className:"text-lg font-semibold text-zinc-200 mb-1",children:"Analyzing objective..."}),t.jsx("p",{className:"text-sm text-zinc-500",children:"Decomposing into sub-objectives"})]}),d==="error"&&t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6",children:[t.jsx(mt,{className:"h-10 w-10 text-red-400 mb-4"}),t.jsx("h2",{className:"text-lg font-semibold text-zinc-200 mb-1",children:"Something went wrong"}),t.jsx("p",{className:"text-sm text-red-400/80 mb-4 max-w-md text-center",children:w}),t.jsx("button",{onClick:W,className:"px-4 py-2 rounded-lg border border-border text-sm text-zinc-300 hover:bg-zinc-800 transition-colors",children:"Try again"})]}),h&&(d==="planned"||d==="executing"||d==="evaluating"||d==="complete")&&t.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[t.jsxs("div",{className:"w-[420px] flex-shrink-0 border-r border-border overflow-y-auto p-4",children:[t.jsxs("div",{className:"mb-4",children:[t.jsx("h2",{className:"text-base font-semibold text-zinc-100 mb-1",children:h.title}),t.jsx("p",{className:"text-xs text-zinc-500 leading-relaxed",children:h.objective})]}),(d==="executing"||d==="evaluating")&&t.jsxs("div",{className:"mb-4",children:[t.jsxs("div",{className:"flex justify-between text-[10px] text-zinc-500 mb-1",children:[t.jsx("span",{children:"Progress"}),t.jsxs("span",{children:[P,"%"]})]}),t.jsx("div",{className:"h-1.5 bg-zinc-800 rounded-full overflow-hidden",children:t.jsx("div",{className:"h-full bg-purple-500 rounded-full transition-all duration-500",style:{width:`${P}%`}})})]}),t.jsx("div",{className:"space-y-1",children:h.subObjectives.map((Q,se)=>t.jsxs("div",{className:`flex items-start gap-3 px-3 py-2.5 rounded-lg transition-colors ${S===Q.id?"bg-purple-500/10 border border-purple-500/20":"hover:bg-zinc-800/30"}`,children:[t.jsxs("div",{className:"flex flex-col items-center flex-shrink-0",children:[uN(Q.status),se<h.subObjectives.length-1&&t.jsx("div",{className:"w-px h-6 bg-border/50 mt-1"})]}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-medium text-zinc-200 truncate",children:Q.name}),t.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded border ${Gd(Q.type)}`,children:Q.type})]}),t.jsx("p",{className:"text-[11px] text-zinc-500 mt-0.5 line-clamp-2",children:Q.description}),Q.findings.length>0&&t.jsxs("span",{className:"text-[10px] text-zinc-600 mt-1 inline-block",children:[Q.findings.length," finding",Q.findings.length!==1?"s":""]})]})]},Q.id))}),t.jsxs("div",{className:"mt-6 space-y-2",children:[d==="planned"&&t.jsxs("div",{className:"flex gap-2",children:[t.jsxs("button",{onClick:B,className:"flex-1 flex items-center justify-center gap-2 rounded-lg bg-purple-600 px-4 py-2.5 text-sm font-medium text-white hover:bg-purple-500 transition-colors",children:[t.jsx(Qa,{className:"h-4 w-4"}),"Execute Mission"]}),t.jsx("button",{onClick:I,className:"rounded-lg border border-border px-4 py-2.5 text-sm text-zinc-400 hover:text-zinc-200 hover:bg-zinc-800 transition-colors",children:"Cancel"})]}),d==="executing"&&t.jsxs("button",{onClick:I,className:"w-full flex items-center justify-center gap-2 rounded-lg border border-red-500/30 px-4 py-2.5 text-sm text-red-400 hover:bg-red-500/10 transition-colors",children:[t.jsx(At,{className:"h-4 w-4"}),"Cancel Execution"]}),d==="evaluating"&&t.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-amber-400 py-2",children:[t.jsx(ot,{className:"h-4 w-4 animate-spin"}),"Evaluating results..."]})]}),h.evaluation&&(d==="complete"||d==="evaluating")&&t.jsxs("div",{className:"mt-6",children:[t.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-zinc-500 mb-3",children:"Quality Evaluation"}),t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsx(Ur,{label:"Completeness",score:h.evaluation.completeness}),t.jsx(Ur,{label:"Accuracy",score:h.evaluation.accuracy}),t.jsx(Ur,{label:"Depth",score:h.evaluation.depth}),t.jsx(Ur,{label:"Relevance",score:h.evaluation.relevance})]}),t.jsxs("div",{className:`mt-2 rounded-lg border p-3 text-center ${V0(h.evaluation.overall)}`,children:[t.jsx("span",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:"Overall"}),t.jsxs("div",{className:`text-3xl font-bold tabular-nums ${xu(h.evaluation.overall)}`,children:[Math.round(h.evaluation.overall*100),"%"]}),t.jsxs("div",{className:"text-xs text-zinc-500 mt-1 capitalize",children:["Recommendation: ",t.jsx("span",{className:h.evaluation.recommendation==="deliver"?"text-green-400":h.evaluation.recommendation==="iterate"?"text-amber-400":"text-red-400",children:h.evaluation.recommendation})]})]}),h.evaluation.gaps.length>0&&t.jsxs("div",{className:"mt-3",children:[t.jsx("h4",{className:"text-[10px] uppercase tracking-wider text-zinc-600 mb-1",children:"Gaps"}),h.evaluation.gaps.map((Q,se)=>t.jsxs("p",{className:"text-[11px] text-zinc-500 flex items-start gap-1 mt-0.5",children:[t.jsx(mt,{className:"h-3 w-3 text-amber-500/60 flex-shrink-0 mt-0.5"}),Q]},se))]})]}),d==="complete"&&h.report&&t.jsxs("div",{className:"mt-4 flex gap-2",children:[t.jsxs("button",{onClick:()=>N(!z),className:"flex-1 flex items-center justify-center gap-2 rounded-lg border border-border px-3 py-2 text-sm text-zinc-300 hover:bg-zinc-800 transition-colors",children:[t.jsx(an,{className:"h-4 w-4"}),z?"Hide Report":"View Report"]}),t.jsx("button",{onClick:le,className:"flex items-center justify-center gap-2 rounded-lg border border-border px-3 py-2 text-sm text-zinc-300 hover:bg-zinc-800 transition-colors",title:"Download as Markdown",children:t.jsx(ai,{className:"h-4 w-4"})})]}),d==="complete"&&t.jsxs("button",{onClick:W,className:"mt-3 w-full flex items-center justify-center gap-2 rounded-lg bg-purple-600/20 border border-purple-500/20 px-4 py-2.5 text-sm text-purple-400 hover:bg-purple-600/30 transition-colors",children:[t.jsx(g0,{className:"h-4 w-4"}),"New Mission"]}),(d==="complete"||(h==null?void 0:h.status)==="completed"||(h==null?void 0:h.status)==="failed")&&h&&t.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-4",children:[((ve=h.evaluation)==null?void 0:ve.recommendation)==="iterate"&&t.jsx(_r,{onClick:()=>Pe(h.id),loading:oe,disabled:je&&!oe,className:"flex items-center justify-center gap-2 px-3 py-2.5 bg-yellow-600 hover:bg-yellow-500 text-white rounded-lg text-xs font-medium transition-colors",icon:t.jsx(Mt,{className:"h-3.5 w-3.5"}),loadingText:"Iterating...",children:"Iterate on Gaps"}),((Je=h.evaluation)==null?void 0:Je.gaps)&&h.evaluation.gaps.length>0&&t.jsx(_r,{onClick:()=>Gt(h),loading:T,disabled:je&&!T,className:"flex items-center justify-center gap-2 px-3 py-2.5 bg-blue-600 hover:bg-blue-500 text-white rounded-lg text-xs font-medium transition-colors",icon:t.jsx(Rs,{className:"h-3.5 w-3.5"}),loadingText:"Planning...",children:"Deep Dive Gaps"}),t.jsx(_r,{onClick:()=>Pa(h.id),loading:ie,disabled:be||je&&!ie,className:`flex items-center justify-center gap-2 px-3 py-2.5 text-white rounded-lg text-xs font-medium transition-colors ${be?"bg-green-800 cursor-default":"bg-green-600 hover:bg-green-500"}`,icon:be?t.jsx(ut,{className:"h-3.5 w-3.5"}):t.jsx(Es,{className:"h-3.5 w-3.5"}),loadingText:"Archiving...",children:be?"Archived":"Archive to Brain"}),t.jsxs("button",{onClick:()=>ga(h),className:"flex items-center justify-center gap-2 px-3 py-2.5 bg-purple-600 hover:bg-purple-500 text-white rounded-lg text-xs font-medium transition-colors",children:[t.jsx(au,{className:"h-3.5 w-3.5"}),"Chat About This"]}),t.jsx(_r,{onClick:()=>Et(h),loading:de,disabled:je&&!de,className:"flex items-center justify-center gap-2 px-3 py-2.5 bg-zinc-700 hover:bg-zinc-600 text-white rounded-lg text-xs font-medium transition-colors",icon:t.jsx(Mt,{className:"h-3.5 w-3.5"}),loadingText:"Re-running...",children:"Re-run Fresh"}),t.jsxs("button",{onClick:()=>Ge(h),className:"flex items-center justify-center gap-2 px-3 py-2.5 bg-zinc-700 hover:bg-zinc-600 text-white rounded-lg text-xs font-medium transition-colors",children:[t.jsx(ai,{className:"h-3.5 w-3.5"}),"Export Full Data"]})]})]}),t.jsx("div",{className:"flex-1 overflow-y-auto p-4",ref:M,children:z&&h.report?t.jsxs("div",{className:"max-w-3xl mx-auto",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("h3",{className:"text-sm font-semibold text-zinc-300",children:"Mission Report"}),t.jsx("button",{onClick:()=>N(!1),className:"text-zinc-500 hover:text-zinc-300",children:t.jsx(tt,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"rounded-lg border border-border bg-zinc-900/50 p-6",children:t.jsx(fN,{content:h.report})})]}):t.jsxs(t.Fragment,{children:[t.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider text-zinc-500 mb-3",children:["Findings",g.length>0&&t.jsxs("span",{className:"ml-2 text-zinc-600",children:["(",g.length,")"]})]}),g.length===0&&d==="planned"&&t.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-zinc-600",children:[t.jsx(Rs,{className:"h-8 w-8 mb-2 opacity-40"}),t.jsx("p",{className:"text-sm",children:"Findings will appear here during execution"})]}),g.length===0&&d==="executing"&&t.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-zinc-600",children:[t.jsx(ot,{className:"h-8 w-8 mb-2 animate-spin opacity-40"}),t.jsx("p",{className:"text-sm",children:"Agents are working..."})]}),t.jsx("div",{className:"space-y-2",children:g.map(Q=>t.jsx(xN,{finding:Q},Q.id))})]})})]})]})]})}const Ih=[{id:"claude",name:"Claude",provider:"Anthropic",emoji:"🟣",color:"text-purple-400",bgColor:"bg-purple-500/10",borderColor:"border-purple-500/30",keyUrl:"https://console.anthropic.com/settings/keys",keyUrlLabel:"console.anthropic.com",envVar:"ANTHROPIC_API_KEY",needsKey:!0},{id:"openai",name:"OpenAI",provider:"OpenAI",emoji:"🟢",color:"text-green-400",bgColor:"bg-green-500/10",borderColor:"border-green-500/30",keyUrl:"https://platform.openai.com/api-keys",keyUrlLabel:"platform.openai.com",envVar:"OPENAI_API_KEY",needsKey:!0},{id:"gemini",name:"Google Gemini",provider:"Google",emoji:"🔵",color:"text-blue-400",bgColor:"bg-blue-500/10",borderColor:"border-blue-500/30",keyUrl:"https://aistudio.google.com/apikey",keyUrlLabel:"aistudio.google.com",envVar:"GEMINI_API_KEY",needsKey:!0},{id:"grok",name:"Grok",provider:"xAI",emoji:"⚪",color:"text-zinc-300",bgColor:"bg-zinc-500/10",borderColor:"border-zinc-500/30",keyUrl:"https://console.x.ai/team/default/api-keys",keyUrlLabel:"console.x.ai",envVar:"XAI_API_KEY",needsKey:!0},{id:"mistral",name:"Mistral AI",provider:"Mistral",emoji:"🟠",color:"text-orange-400",bgColor:"bg-orange-500/10",borderColor:"border-orange-500/30",keyUrl:"https://console.mistral.ai/api-keys",keyUrlLabel:"console.mistral.ai",envVar:"MISTRAL_API_KEY",needsKey:!0},{id:"ollama",name:"Ollama",provider:"Local",emoji:"🟤",color:"text-amber-400",bgColor:"bg-amber-500/10",borderColor:"border-amber-500/30",keyUrl:"https://ollama.ai/download",keyUrlLabel:"ollama.ai",envVar:"",needsKey:!1}];function gN(n){if(!n)return"";const i=Date.now()-new Date(n+"Z").getTime(),d=Math.floor(i/6e4);if(d<1)return"Just now";if(d<60)return`${d}m ago`;const c=Math.floor(d/60);if(c<24)return`${c}h ago`;const m=Math.floor(c/24);return m<30?`${m}d ago`:new Date(n).toLocaleDateString()}function bN({entry:n}){return n.configured&&n.source==="db"?t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-green-500/10 px-2.5 py-0.5 text-xs font-medium text-green-400",children:[t.jsx(ut,{className:"h-3 w-3"}),"Configured"]}):n.configured&&n.source==="env"?t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-yellow-500/10 px-2.5 py-0.5 text-xs font-medium text-yellow-400",children:[t.jsx(mt,{className:"h-3 w-3"}),"From env"]}):n.provider==="ollama"&&n.configured?t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-blue-500/10 px-2.5 py-0.5 text-xs font-medium text-blue-400",children:[t.jsx(ut,{className:"h-3 w-3"}),"Local"]}):t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-red-500/10 px-2.5 py-0.5 text-xs font-medium text-red-400",children:[t.jsx(tt,{className:"h-3 w-3"}),"Not configured"]})}function yN({provider:n,onClose:i,onSaved:d}){const[c,m]=u.useState(""),[f,h]=u.useState(""),[b,g]=u.useState(!1),[p,w]=u.useState(!1),[v,y]=u.useState(!1),[k,z]=u.useState(null),[N,S]=u.useState(null),C=async()=>{if(c.trim()){y(!0),z(null),S(null);try{await ha.set(n.id,c.trim(),f||void 0);const M=await ha.test(n.id);z(M.data)}catch(M){S(M instanceof Error?M.message:"Test failed")}finally{y(!1)}}},O=async()=>{if(c.trim()){w(!0),S(null);try{await ha.set(n.id,c.trim(),f||void 0),d()}catch(M){S(M instanceof Error?M.message:"Failed to save")}finally{w(!1)}}};return t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:t.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border bg-surface p-6 shadow-2xl",children:[t.jsxs("div",{className:"flex items-center justify-between mb-6",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-2xl",children:n.emoji}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-semibold text-white",children:n.name}),t.jsx("p",{className:"text-xs text-zinc-500",children:n.provider})]})]}),t.jsx("button",{onClick:i,className:"rounded-lg p-2 text-zinc-400 hover:bg-surface-hover hover:text-zinc-200",children:t.jsx(tt,{className:"h-5 w-5"})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"API Key"}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{type:b?"text":"password",value:c,onChange:M=>m(M.target.value),placeholder:`Enter your ${n.provider} API key`,className:"w-full rounded-lg border border-border bg-background px-4 py-2.5 pr-10 text-sm text-zinc-200 focus:border-purple-500 focus:outline-none placeholder:text-zinc-600",autoFocus:!0}),t.jsx("button",{type:"button",onClick:()=>g(!b),className:"absolute right-3 top-1/2 -translate-y-1/2 text-zinc-500 hover:text-zinc-300",children:b?t.jsx(Pd,{className:"h-4 w-4"}):t.jsx(Qr,{className:"h-4 w-4"})})]}),n.envVar&&t.jsxs("p",{className:"mt-1 text-xs text-zinc-600",children:["Env var: ",t.jsx("code",{className:"text-zinc-500",children:n.envVar})]})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:["Label ",t.jsx("span",{className:"text-zinc-600",children:"(optional)"})]}),t.jsx("input",{type:"text",value:f,onChange:M=>h(M.target.value),placeholder:"e.g. Production key, Personal key",className:"w-full rounded-lg border border-border bg-background px-4 py-2.5 text-sm text-zinc-200 focus:border-purple-500 focus:outline-none placeholder:text-zinc-600"})]}),k&&t.jsxs("div",{className:`rounded-lg border p-3 ${k.valid?"border-green-500/30 bg-green-500/5 text-green-400":"border-red-500/30 bg-red-500/5 text-red-400"}`,children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[k.valid?t.jsx(ut,{className:"h-4 w-4"}):t.jsx(tt,{className:"h-4 w-4"}),k.valid?"Key is valid":"Key validation failed"]}),t.jsx("p",{className:"mt-1 text-xs opacity-80",children:k.message}),k.models&&k.models.length>0&&t.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[k.models.slice(0,6).map(M=>t.jsx("span",{className:"rounded-md bg-white/5 px-2 py-0.5 text-[10px] font-mono",children:M},M)),k.models.length>6&&t.jsxs("span",{className:"rounded-md bg-white/5 px-2 py-0.5 text-[10px]",children:["+",k.models.length-6," more"]})]})]}),N&&t.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-3 text-sm text-red-400",children:N}),t.jsxs("a",{href:n.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:[t.jsx(Vn,{className:"h-3 w-3"}),"Get API key at ",n.keyUrlLabel]})]}),t.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[t.jsxs("button",{onClick:C,disabled:!c.trim()||v,className:"inline-flex items-center gap-2 rounded-lg border border-border px-4 py-2 text-sm font-medium text-zinc-300 transition-colors hover:bg-surface-hover disabled:opacity-50 disabled:cursor-not-allowed",children:[v?t.jsx(ot,{className:"h-4 w-4 animate-spin"}):t.jsx(si,{className:"h-4 w-4"}),"Test Key"]}),t.jsxs("button",{onClick:O,disabled:!c.trim()||p,className:"inline-flex items-center gap-2 rounded-lg bg-purple-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-purple-700 disabled:opacity-50 disabled:cursor-not-allowed",children:[p?t.jsx(ot,{className:"h-4 w-4 animate-spin"}):t.jsx(ut,{className:"h-4 w-4"}),"Save"]})]})]})})}function vN({meta:n,entry:i,onAdd:d,onTest:c,onRemove:m,testingProvider:f,testResult:h}){const b=(i==null?void 0:i.configured)??!1,g=f===n.id,p=(h==null?void 0:h.provider)===n.id?h.result:null;return t.jsxs("div",{className:`rounded-xl border ${b?n.borderColor:"border-border"} bg-surface p-5 transition-all hover:shadow-lg hover:shadow-black/20`,children:[t.jsxs("div",{className:"flex items-start justify-between mb-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-2xl",children:n.emoji}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold text-white",children:n.name}),t.jsx("p",{className:"text-xs text-zinc-500",children:n.provider})]})]}),i&&t.jsx(bN,{entry:i})]}),b&&(i==null?void 0:i.maskedKey)&&t.jsxs("div",{className:"mb-3 rounded-lg bg-background/50 px-3 py-2",children:[t.jsx("p",{className:"font-mono text-xs text-zinc-400",children:i.maskedKey}),i.label&&i.source==="db"&&t.jsx("p",{className:"text-[10px] text-zinc-600 mt-0.5",children:i.label}),i.updatedAt&&i.source==="db"&&t.jsxs("p",{className:"text-[10px] text-zinc-600 mt-0.5",children:["Updated ",gN(i.updatedAt)]}),i.source==="env"&&t.jsxs("p",{className:"text-[10px] text-yellow-500/80 mt-0.5",children:["Set via ",t.jsx("code",{className:"font-mono",children:n.envVar})," environment variable"]})]}),p&&t.jsxs("div",{className:`mb-3 rounded-lg border p-2.5 text-xs ${p.valid?"border-green-500/20 bg-green-500/5 text-green-400":"border-red-500/20 bg-red-500/5 text-red-400"}`,children:[t.jsxs("div",{className:"flex items-center gap-1.5 font-medium",children:[p.valid?t.jsx(ut,{className:"h-3 w-3"}):t.jsx(tt,{className:"h-3 w-3"}),p.valid?"Working":"Failed"]}),t.jsx("p",{className:"mt-0.5 text-[10px] opacity-80",children:p.message}),p.models&&p.models.length>0&&t.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1",children:[p.models.slice(0,4).map(w=>t.jsx("span",{className:"rounded bg-white/5 px-1.5 py-0.5 text-[9px] font-mono",children:w},w)),p.models.length>4&&t.jsxs("span",{className:"rounded bg-white/5 px-1.5 py-0.5 text-[9px]",children:["+",p.models.length-4]})]})]}),t.jsx("div",{className:"flex items-center gap-2",children:b?t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:c,disabled:g,className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-zinc-400 transition-colors hover:bg-surface-hover hover:text-zinc-200 disabled:opacity-50",children:[g?t.jsx(ot,{className:"h-3 w-3 animate-spin"}):t.jsx(si,{className:"h-3 w-3"}),"Test"]}),n.needsKey&&t.jsxs("button",{onClick:d,className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-zinc-400 transition-colors hover:bg-surface-hover hover:text-zinc-200",children:[t.jsx(ri,{className:"h-3 w-3"}),"Edit"]}),(i==null?void 0:i.source)==="db"&&t.jsxs("button",{onClick:m,className:"inline-flex items-center gap-1.5 rounded-lg border border-red-500/20 px-3 py-1.5 text-xs font-medium text-red-400 transition-colors hover:bg-red-500/10",children:[t.jsx(qt,{className:"h-3 w-3"}),"Remove"]})]}):t.jsxs("button",{onClick:d,className:"inline-flex items-center gap-1.5 rounded-lg bg-purple-600 px-4 py-1.5 text-xs font-medium text-white transition-colors hover:bg-purple-700",children:[t.jsx(gt,{className:"h-3 w-3"}),"Add Key"]})}),t.jsx("div",{className:"mt-3 border-t border-border/50 pt-2.5",children:t.jsxs("a",{href:n.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[10px] text-zinc-600 hover:text-zinc-400 transition-colors",children:[t.jsx(Vn,{className:"h-2.5 w-2.5"}),n.keyUrlLabel]})})]})}function jN(){const[n,i]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(null),[h,b]=u.useState(null),[g,p]=u.useState(null),w=u.useCallback(async()=>{try{const N=await ha.list();i(N.data)}catch{}finally{c(!1)}},[]);u.useEffect(()=>{w()},[w]);const v=async N=>{b(N),p(null);try{const S=await ha.test(N);p({provider:N,result:S.data})}catch(S){p({provider:N,result:{valid:!1,message:S instanceof Error?S.message:"Test failed"}})}finally{b(null)}},y=async N=>{try{await ha.remove(N),await w(),(g==null?void 0:g.provider)===N&&p(null)}catch{}},k=N=>n.find(S=>S.provider===N)||null,z=n.filter(N=>N.configured).length;return d?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-purple-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-purple-500/10",children:t.jsx(ri,{className:"h-5 w-5 text-purple-400"})}),t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"API Keys"}),t.jsx("p",{className:"text-sm text-zinc-500",children:"Manage your LLM provider credentials securely."})]})]})}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-surface px-3 py-1.5 border border-border",children:[t.jsx(Ms,{className:"h-3.5 w-3.5 text-green-400"}),t.jsxs("span",{className:"text-xs text-zinc-400",children:[z,"/",Ih.length," configured"]})]}),t.jsxs("button",{onClick:()=>{c(!0),w()},className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs text-zinc-400 hover:bg-surface-hover hover:text-zinc-200 transition-colors",children:[t.jsx(Mt,{className:"h-3 w-3"}),"Refresh"]})]})]}),t.jsx("div",{className:"rounded-xl border border-border bg-surface/50 p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(Ms,{className:"h-5 w-5 text-purple-400 mt-0.5 flex-shrink-0"}),t.jsxs("div",{className:"text-xs text-zinc-400 space-y-1",children:[t.jsxs("p",{children:["API keys are encrypted with AES-256-GCM and stored locally in the Nestor database. The encryption key is derived from a master secret in ",t.jsx("code",{className:"text-zinc-300",children:"~/.nestor/.vault-key"}),"."]}),t.jsx("p",{children:"Keys set via environment variables take precedence over database-stored keys."})]})]})}),t.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Ih.map(N=>t.jsx(vN,{meta:N,entry:k(N.id),onAdd:()=>f(N),onTest:()=>v(N.id),onRemove:()=>y(N.id),testingProvider:h,testResult:g},N.id))}),m&&t.jsx(yN,{provider:m,onClose:()=>f(null),onSaved:()=>{f(null),w()}})]})}const Md=[{id:"gemini",name:"Gemini",provider:"Google",description:"Multimodal AI with large context window",defaultModel:"gemini-2.5-flash",keyUrl:"https://aistudio.google.com/apikey",keyUrlLabel:"aistudio.google.com",emoji:"🔵",needsApiKey:!0},{id:"claude",name:"Claude",provider:"Anthropic",description:"Best for reasoning, analysis, and code generation",defaultModel:"claude-sonnet-4-6",keyUrl:"https://console.anthropic.com/settings/keys",keyUrlLabel:"console.anthropic.com",emoji:"🟣",needsApiKey:!0},{id:"openai",name:"GPT-4o",provider:"OpenAI",description:"Versatile model with strong general capabilities",defaultModel:"gpt-4o",keyUrl:"https://platform.openai.com/api-keys",keyUrlLabel:"platform.openai.com",emoji:"🟢",needsApiKey:!0},{id:"grok",name:"Grok",provider:"xAI",description:"Real-time knowledge with web access",defaultModel:"grok-3",keyUrl:"https://console.x.ai/",keyUrlLabel:"console.x.ai",emoji:"⚪",needsApiKey:!0},{id:"mistral",name:"Mistral",provider:"Mistral AI",description:"Efficient European AI with strong multilingual support",defaultModel:"mistral-large-latest",keyUrl:"https://console.mistral.ai/api-keys",keyUrlLabel:"console.mistral.ai",emoji:"🟠",needsApiKey:!0},{id:"ollama",name:"Ollama",provider:"Local",description:"Run open-source models locally, no API key needed",defaultModel:"llama3.1",keyUrl:"https://ollama.ai/download",keyUrlLabel:"ollama.ai",emoji:"🦙",needsApiKey:!1,note:"Free, runs on your machine"}];function NN(){var xe;const n=Dt(),[i,d]=u.useState(0),[c,m]=u.useState("gemini"),[f,h]=u.useState("gemini-2.5-flash"),[b,g]=u.useState(""),[p,w]=u.useState(!1),[v,y]=u.useState({}),[k,z]=u.useState(!0),[N,S]=u.useState(!1),[C,O]=u.useState(null),[M,E]=u.useState("my-agent"),[ae,ce]=u.useState("My first Nestor agent"),[B,q]=u.useState(!1),[I,W]=u.useState("");u.useEffect(()=>{Lh.status().then(oe=>{y(oe.data)}).catch(()=>{}).finally(()=>z(!1))},[]);const X=u.useCallback(oe=>{m(oe);const we=Md.find(T=>T.id===oe);we&&h(we.defaultModel),g(""),w(!1),O(null)},[]),le=u.useCallback(()=>{d(oe=>Math.min(oe+1,2))},[]),J=u.useCallback(()=>{d(oe=>Math.max(oe-1,0))},[]),re=Md.find(oe=>oe.id===c),ge=((xe=v[c])==null?void 0:xe.configured)??!1,G=u.useCallback(async()=>{S(!0),O(null);try{const oe=await Lh.test({provider:c,apiKey:b.trim()||void 0,model:f});O(oe)}catch(oe){O({success:!1,message:oe instanceof Error?oe.message:"Connection test failed"})}finally{S(!1)}},[c,b,f]),ee=u.useCallback(async()=>{if(!M.trim()){W("Please enter an agent name.");return}q(!0),W("");try{b.trim()&&(re!=null&&re.needsApiKey)&&await ha.set(c,b.trim(),"Onboarding key"),await Ds.create({name:M.trim(),description:ae.trim()||void 0,adapterType:c,adapterConfig:{model:f},trustLevel:"trusted"}),localStorage.setItem("nestor_onboarding_complete","true"),n("/chat")}catch(oe){W(oe instanceof Error?oe.message:"Failed to create agent")}finally{q(!1)}},[M,ae,c,f,b,re,n]);return t.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:t.jsxs("div",{className:"w-full max-w-2xl",children:[t.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",children:[0,1,2].map(oe=>t.jsx("div",{className:`h-1.5 rounded-full transition-all duration-500 ${oe===i?"w-10 bg-purple-500":oe<i?"w-10 bg-purple-500/40":"w-10 bg-zinc-700"}`},oe))}),t.jsx("div",{className:"relative overflow-hidden",children:t.jsxs("div",{className:"transition-all duration-500 ease-out",style:{transform:`translateX(${-i*100}%)`,width:"300%",display:"flex"},children:[t.jsx("div",{className:"w-1/3 flex-shrink-0 px-4",children:t.jsxs("div",{className:`text-center transition-opacity duration-300 ${i===0?"opacity-100":"opacity-0 pointer-events-none"}`,children:[t.jsx("div",{className:"flex justify-center mb-6",children:t.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-2xl bg-purple-600 text-white shadow-lg shadow-purple-500/30",children:t.jsx(Qa,{className:"h-10 w-10"})})}),t.jsx("h1",{className:"text-4xl font-bold text-white mb-3",children:"Welcome to Nestor"}),t.jsx("p",{className:"text-zinc-400 text-lg mb-2",children:"Your AI agent platform is ready."}),t.jsx("p",{className:"text-zinc-500 mb-12",children:"Let's create your first agent in 30 seconds."}),t.jsxs("button",{onClick:le,className:"inline-flex items-center gap-2 px-8 py-3.5 bg-purple-600 hover:bg-purple-700 text-white rounded-xl font-medium transition-all text-lg shadow-lg shadow-purple-500/25 hover:shadow-purple-500/40 hover:scale-[1.02] active:scale-[0.98]",children:["Get Started",t.jsx(ca,{className:"h-5 w-5"})]})]})}),t.jsx("div",{className:"w-1/3 flex-shrink-0 px-4",children:t.jsxs("div",{className:`transition-opacity duration-300 ${i===1?"opacity-100":"opacity-0 pointer-events-none"}`,children:[t.jsx("h2",{className:"text-2xl font-bold text-white mb-1 text-center",children:"Choose your AI provider"}),t.jsx("p",{className:"text-zinc-500 mb-6 text-center text-sm",children:"Select which LLM to power your agent"}),t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3 mb-6",children:Md.map(oe=>{var Y;const we=c===oe.id,T=((Y=v[oe.id])==null?void 0:Y.configured)??!1;return t.jsxs("button",{onClick:()=>X(oe.id),className:`relative text-left p-4 rounded-xl border-2 transition-all duration-200 hover:scale-[1.02] ${we?"border-purple-500 bg-purple-500/10 shadow-lg shadow-purple-500/10":"border-border bg-surface hover:border-zinc-600 hover:bg-surface-hover"}`,children:[T&&t.jsx("span",{className:"absolute top-2 right-2 text-green-400",title:"API key configured",children:t.jsx(ut,{className:"h-3.5 w-3.5"})}),t.jsx("div",{className:"text-lg mb-1",children:oe.emoji}),t.jsx("div",{className:"font-semibold text-sm text-zinc-100",children:oe.name}),t.jsx("div",{className:"text-[11px] text-zinc-500",children:oe.provider}),oe.note&&t.jsx("div",{className:"text-[10px] text-green-400/80 mt-1",children:oe.note}),oe.needsApiKey&&t.jsxs("a",{href:oe.keyUrl,target:"_blank",rel:"noopener noreferrer",onClick:ie=>ie.stopPropagation(),className:"inline-flex items-center gap-1 text-[10px] text-purple-400 hover:text-purple-300 mt-1.5 transition-colors",children:["Get API Key ",t.jsx(Vn,{className:"h-2.5 w-2.5"})]})]},oe.id)})}),t.jsxs("div",{className:"space-y-3",children:[(re==null?void 0:re.needsApiKey)&&t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:["API Key",ge&&t.jsxs("span",{className:"ml-2 text-xs text-green-400 font-normal",children:[t.jsx(ut,{className:"inline h-3 w-3 mr-0.5"}),"Already configured"]})]}),ge?t.jsx("p",{className:"text-xs text-zinc-500 mb-2",children:"Your API key is already set. You can skip this field or enter a new key to update it."}):null,t.jsxs("div",{className:"relative",children:[t.jsx("input",{type:p?"text":"password",value:b,onChange:oe=>{g(oe.target.value),O(null)},className:"w-full bg-background border border-border rounded-lg px-3 py-2.5 pr-10 text-sm text-zinc-200 focus:outline-none focus:border-purple-500 placeholder-zinc-600 transition-colors",placeholder:`Enter your ${re.provider} API key`}),t.jsx("button",{type:"button",onClick:()=>w(!p),className:"absolute right-3 top-1/2 -translate-y-1/2 text-zinc-500 hover:text-zinc-300 transition-colors",children:p?t.jsx(Pd,{className:"h-4 w-4"}):t.jsx(Qr,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"flex items-center justify-between mt-1.5",children:t.jsxs("a",{href:re.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:["Get your API key ",t.jsx(Vn,{className:"h-3 w-3"})]})})]}),c==="ollama"&&t.jsxs("div",{className:"bg-surface border border-border rounded-lg p-4",children:[t.jsx("p",{className:"text-sm text-zinc-300 font-medium mb-1",children:"No API key needed"}),t.jsxs("p",{className:"text-xs text-zinc-400",children:["Make sure Ollama is running on ",t.jsx("code",{className:"text-zinc-300",children:"localhost:11434"})]}),t.jsxs("a",{href:"https://ollama.ai/download",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 mt-2 transition-colors",children:["Download Ollama ",t.jsx(Vn,{className:"h-3 w-3"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Model"}),t.jsx("input",{type:"text",value:f,onChange:oe=>h(oe.target.value),className:"w-full bg-background border border-border rounded-lg px-3 py-2 text-sm text-zinc-200 focus:outline-none focus:border-purple-500 placeholder-zinc-600 transition-colors",placeholder:"e.g. gemini-2.5-flash"})]}),t.jsx("button",{onClick:G,disabled:N||!b.trim()&&(re==null?void 0:re.needsApiKey)&&!ge,className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 rounded-lg border border-border text-sm font-medium text-zinc-300 transition-all hover:bg-surface-hover hover:text-white disabled:opacity-40 disabled:cursor-not-allowed",children:N?t.jsxs(t.Fragment,{children:[t.jsx(ot,{className:"h-4 w-4 animate-spin"}),"Testing connection..."]}):t.jsxs(t.Fragment,{children:[t.jsx(si,{className:"h-4 w-4"}),"Test Connection"]})}),C&&t.jsx("div",{className:`rounded-lg border p-3 text-sm transition-all ${C.success?"border-green-500/30 bg-green-500/5 text-green-400":"border-red-500/30 bg-red-500/5 text-red-400"}`,children:t.jsxs("div",{className:"flex items-center gap-2 font-medium",children:[C.success?t.jsx(ut,{className:"h-4 w-4"}):t.jsx(ei,{className:"h-4 w-4"}),C.message]})})]}),t.jsxs("div",{className:"flex justify-between mt-8",children:[t.jsxs("button",{onClick:J,className:"flex items-center gap-1 px-4 py-2 text-sm text-zinc-400 hover:text-zinc-200 transition-colors",children:[t.jsx(Th,{className:"h-4 w-4"}),"Back"]}),t.jsxs("button",{onClick:le,className:"flex items-center gap-2 px-6 py-2.5 bg-purple-600 hover:bg-purple-700 text-white rounded-xl font-medium transition-all text-sm hover:shadow-lg hover:shadow-purple-500/20",children:["Continue",t.jsx(ca,{className:"h-4 w-4"})]})]})]})}),t.jsx("div",{className:"w-1/3 flex-shrink-0 px-4",children:t.jsxs("div",{className:`transition-opacity duration-300 ${i===2?"opacity-100":"opacity-0 pointer-events-none"}`,children:[t.jsx("h2",{className:"text-2xl font-bold text-white mb-1 text-center",children:"Name your agent"}),t.jsx("p",{className:"text-zinc-500 mb-6 text-center text-sm",children:"Almost there! Give your agent a name."}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Agent name"}),t.jsx("input",{type:"text",value:M,onChange:oe=>E(oe.target.value),className:"w-full bg-background border border-border rounded-lg px-3 py-2.5 text-sm text-zinc-200 focus:outline-none focus:border-purple-500 placeholder-zinc-600 transition-colors",placeholder:"e.g. my-agent"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Description"}),t.jsx("textarea",{value:ae,onChange:oe=>ce(oe.target.value),rows:2,className:"w-full bg-background border border-border rounded-lg px-3 py-2.5 text-sm text-zinc-200 focus:outline-none focus:border-purple-500 placeholder-zinc-600 resize-none transition-colors",placeholder:"What does this agent do?"})]}),t.jsxs("div",{className:"bg-surface border border-border rounded-xl p-4",children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-2 font-medium uppercase tracking-wider",children:"Summary"}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("p",{className:"text-sm text-zinc-300",children:[t.jsx("span",{className:"text-zinc-500",children:"Agent:"})," ",t.jsx("span",{className:"font-medium text-zinc-100",children:M||"—"})]}),t.jsxs("p",{className:"text-sm text-zinc-300",children:[t.jsx("span",{className:"text-zinc-500",children:"Provider:"})," ",t.jsx("span",{className:"text-purple-400",children:re==null?void 0:re.name})," ",t.jsxs("span",{className:"text-zinc-500",children:["(",f,")"]})]}),b.trim()&&(re==null?void 0:re.needsApiKey)&&t.jsxs("p",{className:"text-sm text-zinc-300",children:[t.jsx("span",{className:"text-zinc-500",children:"API Key:"})," ",t.jsx("span",{className:"text-green-400",children:"Will be saved securely"})]})]})]}),I&&t.jsxs("div",{className:"flex items-center gap-2 text-sm text-red-400",children:[t.jsx(ei,{className:"h-4 w-4 flex-shrink-0"}),I]})]}),t.jsxs("div",{className:"flex justify-between mt-8",children:[t.jsxs("button",{onClick:J,className:"flex items-center gap-1 px-4 py-2 text-sm text-zinc-400 hover:text-zinc-200 transition-colors",children:[t.jsx(Th,{className:"h-4 w-4"}),"Back"]}),t.jsx("button",{onClick:ee,disabled:B||!M.trim(),className:"flex items-center gap-2 px-6 py-2.5 bg-purple-600 hover:bg-purple-700 disabled:opacity-50 disabled:cursor-not-allowed text-white rounded-xl font-medium transition-all text-sm shadow-lg shadow-purple-500/20 hover:shadow-purple-500/40 hover:scale-[1.02] active:scale-[0.98]",children:B?t.jsxs(t.Fragment,{children:[t.jsx(ot,{className:"h-4 w-4 animate-spin"}),"Creating..."]}):t.jsxs(t.Fragment,{children:["Create & Start Chatting",t.jsx(ca,{className:"h-4 w-4"})]})})]})]})})]})}),t.jsx("div",{className:"text-center mt-12",children:t.jsx("p",{className:"text-xs text-zinc-600",children:"You can always add more agents and change settings later."})})]})})}function wN({children:n}){const[i,d]=u.useState(!1),c=Dt(),m=pa();return u.useEffect(()=>{if(m.pathname==="/onboarding"){d(!0);return}if(localStorage.getItem("nestor_onboarding_complete")==="true"||localStorage.getItem("nestor_onboarded")==="true"){d(!0);return}Ds.list().then(f=>{!f.data||f.data.length===0?c("/onboarding"):localStorage.setItem("nestor_onboarding_complete","true"),d(!0)}).catch(()=>d(!0))},[m.pathname,c]),i?t.jsx(t.Fragment,{children:n}):t.jsx("div",{className:"flex items-center justify-center h-screen bg-background",children:t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-purple-500 border-t-transparent"})})}function Ye(n){return t.jsx(rj,{fallback:t.jsx(cj,{}),children:n})}function SN(){const{user:n,loading:i}=ci();return i?t.jsx("div",{className:"flex h-screen items-center justify-center bg-background text-zinc-400",children:"Loading..."}):n?t.jsx(wN,{children:t.jsxs(u0,{children:[t.jsx(De,{path:"/onboarding",element:t.jsx(NN,{})}),t.jsxs(De,{element:t.jsx(ij,{}),children:[t.jsx(De,{path:"/",element:t.jsx(Ah,{to:"/missions",replace:!0})}),t.jsx(De,{path:"/missions",element:Ye(t.jsx(pN,{}))}),t.jsx(De,{path:"/chat",element:Ye(t.jsx(iN,{}))}),t.jsx(De,{path:"/dashboard",element:Ye(t.jsx(mj,{}))}),t.jsx(De,{path:"/agents",element:Ye(t.jsx(bj,{}))}),t.jsx(De,{path:"/agents/:id",element:Ye(t.jsx(Sj,{}))}),t.jsx(De,{path:"/agents/:id/prompts",element:Ye(t.jsx(x1,{}))}),t.jsx(De,{path:"/agents/:id/memory-store",element:Ye(t.jsx(q1,{}))}),t.jsx(De,{path:"/workflows",element:Ye(t.jsx(Cj,{}))}),t.jsx(De,{path:"/workflows/:id/edit",element:Ye(t.jsx(Ej,{}))}),t.jsx(De,{path:"/skills",element:Ye(t.jsx(Mj,{}))}),t.jsx(De,{path:"/runs",element:Ye(t.jsx(Dj,{}))}),t.jsx(De,{path:"/runs/:id",element:Ye(t.jsx(Kj,{}))}),t.jsx(De,{path:"/goals",element:Ye(t.jsx(C1,{}))}),t.jsx(De,{path:"/approvals",element:Ye(t.jsx(Zj,{}))}),t.jsx(De,{path:"/handoffs",element:Ye(t.jsx(A1,{}))}),t.jsx(De,{path:"/analytics",element:Ye(t.jsx(i1,{}))}),t.jsx(De,{path:"/budget",element:Ye(t.jsx(N1,{}))}),t.jsx(De,{path:"/traces",element:Ye(t.jsx(u1,{}))}),t.jsx(De,{path:"/memory",element:Ye(t.jsx(g1,{}))}),t.jsx(De,{path:"/users",element:Ye(t.jsx(m1,{}))}),t.jsx(De,{path:"/plans",element:Ye(t.jsx(D1,{}))}),t.jsx(De,{path:"/plans/:id",element:Ye(t.jsx(O1,{}))}),t.jsx(De,{path:"/guardrails",element:Ye(t.jsx(H1,{}))}),t.jsx(De,{path:"/admin",element:Ye(t.jsx(P1,{}))}),t.jsx(De,{path:"/settings",element:Ye(t.jsx(Vj,{}))}),t.jsx(De,{path:"/keys",element:Ye(t.jsx(jN,{}))}),t.jsx(De,{path:"*",element:t.jsx(Ah,{to:"/missions",replace:!0})})]})]})}):t.jsx(L0,{})}function kN(){return t.jsx(_v,{children:t.jsx(Hv,{children:t.jsxs(u0,{children:[t.jsx(De,{path:"/login",element:t.jsx(L0,{})}),t.jsx(De,{path:"/*",element:t.jsx(SN,{})})]})})})}const Y0=document.getElementById("root");if(!Y0)throw new Error("Root element not found");yb.createRoot(Y0).render(t.jsx(u.StrictMode,{children:t.jsx(Ky,{children:t.jsx(kN,{})})}));
597
+ //# sourceMappingURL=index-0-6dEh2X.js.map