nestor-sh 3.0.0 → 3.2.0

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 yd=(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 vd={exports:{}},Wl={};/**
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 xh;function db(){if(xh)return Wl;xh=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 Wl.Fragment=i,Wl.jsx=d,Wl.jsxs=d,Wl}var fh;function ub(){return fh||(fh=1,vd.exports=db()),vd.exports}var t=ub(),jd={exports:{}},je={};/**
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 hh;function mb(){if(hh)return je;hh=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"),S=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),j=Symbol.iterator;function k(T){return T===null||typeof T!="object"?null:(T=j&&T[j]||T["@@iterator"],typeof T=="function"?T:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,v={};function z(T,Q,ce){this.props=T,this.context=Q,this.refs=v,this.updater=ce||C}z.prototype.isReactComponent={},z.prototype.setState=function(T,Q){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,Q,"setState")},z.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function M(){}M.prototype=z.prototype;function O(T,Q,ce){this.props=T,this.context=Q,this.refs=v,this.updater=ce||C}var E=O.prototype=new M;E.constructor=O,w(E,z.prototype),E.isPureReactComponent=!0;var te=Array.isArray;function oe(){}var H={H:null,A:null,T:null,S:null},$=Object.prototype.hasOwnProperty;function I(T,Q,ce){var B=ce.ref;return{$$typeof:n,type:T,key:Q,ref:B!==void 0?B:null,props:ce}}function W(T,Q){return I(T.type,Q,T.props)}function X(T){return typeof T=="object"&&T!==null&&T.$$typeof===n}function ne(T){var Q={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(ce){return Q[ce]})}var J=/\/+/g;function le(T,Q){return typeof T=="object"&&T!==null&&T.key!=null?ne(""+T.key):Q.toString(36)}function fe(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(oe,oe):(T.status="pending",T.then(function(Q){T.status==="pending"&&(T.status="fulfilled",T.value=Q)},function(Q){T.status==="pending"&&(T.status="rejected",T.reason=Q)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function K(T,Q,ce,B,re){var xe=typeof T;(xe==="undefined"||xe==="boolean")&&(T=null);var be=!1;if(T===null)be=!0;else switch(xe){case"bigint":case"string":case"number":be=!0;break;case"object":switch(T.$$typeof){case n:case i:be=!0;break;case S:return be=T._init,K(be(T._payload),Q,ce,B,re)}}if(be)return re=re(T),be=B===""?"."+le(T,0):B,te(re)?(ce="",be!=null&&(ce=be.replace(J,"$&/")+"/"),K(re,Q,ce,"",function(Pe){return Pe})):re!=null&&(X(re)&&(re=W(re,ce+(re.key==null||T&&T.key===re.key?"":(""+re.key).replace(J,"$&/")+"/")+be)),Q.push(re)),1;be=0;var Ce=B===""?".":B+":";if(te(T))for(var ve=0;ve<T.length;ve++)B=T[ve],xe=Ce+le(B,ve),be+=K(B,Q,ce,xe,re);else if(ve=k(T),typeof ve=="function")for(T=ve.call(T),ve=0;!(B=T.next()).done;)B=B.value,xe=Ce+le(B,ve++),be+=K(B,Q,ce,xe,re);else if(xe==="object"){if(typeof T.then=="function")return K(fe(T),Q,ce,B,re);throw Q=String(T),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return be}function ie(T,Q,ce){if(T==null)return T;var B=[],re=0;return K(T,B,"","",function(xe){return Q.call(ce,xe,re++)}),B}function me(T){if(T._status===-1){var Q=T._result;Q=Q(),Q.then(function(ce){(T._status===0||T._status===-1)&&(T._status=1,T._result=ce)},function(ce){(T._status===0||T._status===-1)&&(T._status=2,T._result=ce)}),T._status===-1&&(T._status=0,T._result=Q)}if(T._status===1)return T._result.default;throw T._result}var de=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=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(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},ke={map:ie,forEach:function(T,Q,ce){ie(T,function(){Q.apply(this,arguments)},ce)},count:function(T){var Q=0;return ie(T,function(){Q++}),Q},toArray:function(T){return ie(T,function(Q){return Q})||[]},only:function(T){if(!X(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return je.Activity=y,je.Children=ke,je.Component=z,je.Fragment=d,je.Profiler=m,je.PureComponent=O,je.StrictMode=c,je.Suspense=g,je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,je.__COMPILER_RUNTIME={__proto__:null,c:function(T){return H.H.useMemoCache(T)}},je.cache=function(T){return function(){return T.apply(null,arguments)}},je.cacheSignal=function(){return null},je.cloneElement=function(T,Q,ce){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var B=w({},T.props),re=T.key;if(Q!=null)for(xe in Q.key!==void 0&&(re=""+Q.key),Q)!$.call(Q,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&Q.ref===void 0||(B[xe]=Q[xe]);var xe=arguments.length-2;if(xe===1)B.children=ce;else if(1<xe){for(var be=Array(xe),Ce=0;Ce<xe;Ce++)be[Ce]=arguments[Ce+2];B.children=be}return I(T.type,re,B)},je.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},je.createElement=function(T,Q,ce){var B,re={},xe=null;if(Q!=null)for(B in Q.key!==void 0&&(xe=""+Q.key),Q)$.call(Q,B)&&B!=="key"&&B!=="__self"&&B!=="__source"&&(re[B]=Q[B]);var be=arguments.length-2;if(be===1)re.children=ce;else if(1<be){for(var Ce=Array(be),ve=0;ve<be;ve++)Ce[ve]=arguments[ve+2];re.children=Ce}if(T&&T.defaultProps)for(B in be=T.defaultProps,be)re[B]===void 0&&(re[B]=be[B]);return I(T,xe,re)},je.createRef=function(){return{current:null}},je.forwardRef=function(T){return{$$typeof:b,render:T}},je.isValidElement=X,je.lazy=function(T){return{$$typeof:S,_payload:{_status:-1,_result:T},_init:me}},je.memo=function(T,Q){return{$$typeof:p,type:T,compare:Q===void 0?null:Q}},je.startTransition=function(T){var Q=H.T,ce={};H.T=ce;try{var B=T(),re=H.S;re!==null&&re(ce,B),typeof B=="object"&&B!==null&&typeof B.then=="function"&&B.then(oe,de)}catch(xe){de(xe)}finally{Q!==null&&ce.types!==null&&(Q.types=ce.types),H.T=Q}},je.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},je.use=function(T){return H.H.use(T)},je.useActionState=function(T,Q,ce){return H.H.useActionState(T,Q,ce)},je.useCallback=function(T,Q){return H.H.useCallback(T,Q)},je.useContext=function(T){return H.H.useContext(T)},je.useDebugValue=function(){},je.useDeferredValue=function(T,Q){return H.H.useDeferredValue(T,Q)},je.useEffect=function(T,Q){return H.H.useEffect(T,Q)},je.useEffectEvent=function(T){return H.H.useEffectEvent(T)},je.useId=function(){return H.H.useId()},je.useImperativeHandle=function(T,Q,ce){return H.H.useImperativeHandle(T,Q,ce)},je.useInsertionEffect=function(T,Q){return H.H.useInsertionEffect(T,Q)},je.useLayoutEffect=function(T,Q){return H.H.useLayoutEffect(T,Q)},je.useMemo=function(T,Q){return H.H.useMemo(T,Q)},je.useOptimistic=function(T,Q){return H.H.useOptimistic(T,Q)},je.useReducer=function(T,Q,ce){return H.H.useReducer(T,Q,ce)},je.useRef=function(T){return H.H.useRef(T)},je.useState=function(T){return H.H.useState(T)},je.useSyncExternalStore=function(T,Q,ce){return H.H.useSyncExternalStore(T,Q,ce)},je.useTransition=function(){return H.H.useTransition()},je.version="19.2.4",je}var ph;function Xd(){return ph||(ph=1,jd.exports=mb()),jd.exports}var u=Xd(),Nd={exports:{}},ei={},wd={exports:{}},Sd={};/**
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 gh;function xb(){return gh||(gh=1,(function(n){function i(K,ie){var me=K.length;K.push(ie);e:for(;0<me;){var de=me-1>>>1,ke=K[de];if(0<m(ke,ie))K[de]=ie,K[me]=ke,me=de;else break e}}function d(K){return K.length===0?null:K[0]}function c(K){if(K.length===0)return null;var ie=K[0],me=K.pop();if(me!==ie){K[0]=me;e:for(var de=0,ke=K.length,T=ke>>>1;de<T;){var Q=2*(de+1)-1,ce=K[Q],B=Q+1,re=K[B];if(0>m(ce,me))B<ke&&0>m(re,ce)?(K[de]=re,K[B]=me,de=B):(K[de]=ce,K[Q]=me,de=Q);else if(B<ke&&0>m(re,me))K[de]=re,K[B]=me,de=B;else break e}}return ie}function m(K,ie){var me=K.sortIndex-ie.sortIndex;return me!==0?me:K.id-ie.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=[],S=1,y=null,j=3,k=!1,C=!1,w=!1,v=!1,z=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function E(K){for(var ie=d(p);ie!==null;){if(ie.callback===null)c(p);else if(ie.startTime<=K)c(p),ie.sortIndex=ie.expirationTime,i(g,ie);else break;ie=d(p)}}function te(K){if(w=!1,E(K),!C)if(d(g)!==null)C=!0,oe||(oe=!0,ne());else{var ie=d(p);ie!==null&&fe(te,ie.startTime-K)}}var oe=!1,H=-1,$=5,I=-1;function W(){return v?!0:!(n.unstable_now()-I<$)}function X(){if(v=!1,oe){var K=n.unstable_now();I=K;var ie=!0;try{e:{C=!1,w&&(w=!1,M(H),H=-1),k=!0;var me=j;try{t:{for(E(K),y=d(g);y!==null&&!(y.expirationTime>K&&W());){var de=y.callback;if(typeof de=="function"){y.callback=null,j=y.priorityLevel;var ke=de(y.expirationTime<=K);if(K=n.unstable_now(),typeof ke=="function"){y.callback=ke,E(K),ie=!0;break t}y===d(g)&&c(g),E(K)}else c(g);y=d(g)}if(y!==null)ie=!0;else{var T=d(p);T!==null&&fe(te,T.startTime-K),ie=!1}}break e}finally{y=null,j=me,k=!1}ie=void 0}}finally{ie?ne():oe=!1}}}var ne;if(typeof O=="function")ne=function(){O(X)};else if(typeof MessageChannel<"u"){var J=new MessageChannel,le=J.port2;J.port1.onmessage=X,ne=function(){le.postMessage(null)}}else ne=function(){z(X,0)};function fe(K,ie){H=z(function(){K(n.unstable_now())},ie)}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(K){K.callback=null},n.unstable_forceFrameRate=function(K){0>K||125<K?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<K?Math.floor(1e3/K):5},n.unstable_getCurrentPriorityLevel=function(){return j},n.unstable_next=function(K){switch(j){case 1:case 2:case 3:var ie=3;break;default:ie=j}var me=j;j=ie;try{return K()}finally{j=me}},n.unstable_requestPaint=function(){v=!0},n.unstable_runWithPriority=function(K,ie){switch(K){case 1:case 2:case 3:case 4:case 5:break;default:K=3}var me=j;j=K;try{return ie()}finally{j=me}},n.unstable_scheduleCallback=function(K,ie,me){var de=n.unstable_now();switch(typeof me=="object"&&me!==null?(me=me.delay,me=typeof me=="number"&&0<me?de+me:de):me=de,K){case 1:var ke=-1;break;case 2:ke=250;break;case 5:ke=1073741823;break;case 4:ke=1e4;break;default:ke=5e3}return ke=me+ke,K={id:S++,callback:ie,priorityLevel:K,startTime:me,expirationTime:ke,sortIndex:-1},me>de?(K.sortIndex=me,i(p,K),d(g)===null&&K===d(p)&&(w?(M(H),H=-1):w=!0,fe(te,me-de))):(K.sortIndex=ke,i(g,K),C||k||(C=!0,oe||(oe=!0,ne()))),K},n.unstable_shouldYield=W,n.unstable_wrapCallback=function(K){var ie=j;return function(){var me=j;j=ie;try{return K.apply(this,arguments)}finally{j=me}}}})(Sd)),Sd}var bh;function fb(){return bh||(bh=1,wd.exports=xb()),wd.exports}var kd={exports:{}},Ct={};/**
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 yh;function hb(){if(yh)return Ct;yh=1;var n=Xd();function i(g){var p="https://react.dev/errors/"+g;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)p+="&args[]="+encodeURIComponent(arguments[S])}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,S){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:m,key:y==null?null:""+y,children:g,containerInfo:p,implementation:S}}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 Ct.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c,Ct.createPortal=function(g,p){var S=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,S)},Ct.flushSync=function(g){var p=h.T,S=c.p;try{if(h.T=null,c.p=2,g)return g()}finally{h.T=p,c.p=S,c.d.f()}},Ct.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))},Ct.prefetchDNS=function(g){typeof g=="string"&&c.d.D(g)},Ct.preinit=function(g,p){if(typeof g=="string"&&p&&typeof p.as=="string"){var S=p.as,y=b(S,p.crossOrigin),j=typeof p.integrity=="string"?p.integrity:void 0,k=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;S==="style"?c.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:y,integrity:j,fetchPriority:k}):S==="script"&&c.d.X(g,{crossOrigin:y,integrity:j,fetchPriority:k,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Ct.preinitModule=function(g,p){if(typeof g=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var S=b(p.as,p.crossOrigin);c.d.M(g,{crossOrigin:S,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)},Ct.preload=function(g,p){if(typeof g=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var S=p.as,y=b(S,p.crossOrigin);c.d.L(g,S,{crossOrigin:y,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})}},Ct.preloadModule=function(g,p){if(typeof g=="string")if(p){var S=b(p.as,p.crossOrigin);c.d.m(g,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:S,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else c.d.m(g)},Ct.requestFormReset=function(g){c.d.r(g)},Ct.unstable_batchedUpdates=function(g,p){return g(p)},Ct.useFormState=function(g,p,S){return h.H.useFormState(g,p,S)},Ct.useFormStatus=function(){return h.H.useHostTransitionStatus()},Ct.version="19.2.4",Ct}var vh;function pb(){if(vh)return kd.exports;vh=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(),kd.exports=hb(),kd.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 jh;function gb(){if(jh)return ei;jh=1;var n=fb(),i=Xd(),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,N=r.child;N;){if(N===s){x=!0,s=r,l=o;break}if(N===l){x=!0,l=r,s=o;break}N=N.sibling}if(!x){for(N=o.child;N;){if(N===s){x=!0,s=o,l=r;break}if(N===l){x=!0,l=o,s=r;break}N=N.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 S(e){var a=e.tag;if(a===5||a===26||a===27||a===6)return e;for(e=e.child;e!==null;){if(a=S(e),a!==null)return a;e=e.sibling}return null}var y=Object.assign,j=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),O=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),te=Symbol.for("react.suspense"),oe=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),W=Symbol.for("react.memo_cache_sentinel"),X=Symbol.iterator;function ne(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 le(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 w:return"Fragment";case z:return"Profiler";case v:return"StrictMode";case te:return"Suspense";case oe:return"SuspenseList";case I:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case C:return"Portal";case O:return e.displayName||"Context";case M: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 H:return a=e.displayName||null,a!==null?a:le(e.type)||"Memo";case $:a=e._payload,e=e._init;try{return le(e(a))}catch{}}return null}var fe=Array.isArray,K=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie=d.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me={pending:!1,data:null,method:null,action:null},de=[],ke=-1;function T(e){return{current:e}}function Q(e){0>ke||(e.current=de[ke],de[ke]=null,ke--)}function ce(e,a){ke++,de[ke]=e.current,e.current=a}var B=T(null),re=T(null),xe=T(null),be=T(null);function Ce(e,a){switch(ce(xe,a),ce(re,e),ce(B,null),a.nodeType){case 9:case 11:e=(e=a.documentElement)&&(e=e.namespaceURI)?_f(e):0;break;default:if(e=a.tagName,a=a.namespaceURI)a=_f(a),e=Uf(a,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Q(B),ce(B,e)}function ve(){Q(B),Q(re),Q(xe)}function Pe(e){e.memoizedState!==null&&ce(be,e);var a=B.current,s=Uf(a,e.type);a!==s&&(ce(re,e),ce(B,s))}function Xe(e){re.current===e&&(Q(B),Q(re)),be.current===e&&(Q(be),Jl._currentValue=me)}var Ot,va;function zt(e){if(Ot===void 0)try{throw Error()}catch(s){var a=s.stack.trim().match(/\n( *(at )?)/);Ot=a&&a[1]||"",va=-1<s.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+Ot+e+va}var Kt=!1;function He(e,a){if(!e||Kt)return"";Kt=!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(V){var G=V}Reflect.construct(e,[],F)}else{try{F.call()}catch(V){G=V}e.call(F.prototype)}}else{try{throw Error()}catch(V){G=V}(F=e())&&typeof F.catch=="function"&&F.catch(function(){})}}catch(V){if(V&&G&&typeof V.stack=="string")return[V.stack,G.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],N=o[1];if(x&&N){var A=x.split(`
44
+ `),U=N.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 Y=`
46
+ `+A[l].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=l&&0<=r);break}}}finally{Kt=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?zt(s):""}function at(e,a){switch(e.tag){case 26:case 27:case 5:return zt(e.type);case 16:return zt("Lazy");case 13:return e.child!==a&&a!==null?zt("Suspense Fallback"):zt("Suspense");case 19:return zt("SuspenseList");case 0:case 15:return He(e.type,!1);case 11:return He(e.type.render,!1);case 1:return He(e.type,!0);case 31:return zt("Activity");default:return""}}function D(e){try{var a="",s=null;do a+=at(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,ye=n.unstable_scheduleCallback,Ie=n.unstable_cancelCallback,xa=n.unstable_shouldYield,fa=n.unstable_requestPaint,ht=n.unstable_now,on=n.unstable_getCurrentPriorityLevel,Us=n.unstable_ImmediatePriority,Bs=n.unstable_UserBlockingPriority,Ta=n.unstable_NormalPriority,bi=n.unstable_LowPriority,q=n.unstable_IdlePriority,ae=n.log,Ne=n.unstable_setDisableYieldValue,we=null,De=null;function it(e){if(typeof ae=="function"&&Ne(e),De&&typeof De.setStrictMode=="function")try{De.setStrictMode(we,e)}catch{}}var Tt=Math.clz32?Math.clz32:yi,lc=Math.log,$s=Math.LN2;function yi(e){return e>>>=0,e===0?32:31-(lc(e)/$s|0)|0}var rl=256,Ra=262144,ss=4194304;function ja(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 dn(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 N=l&134217727;return N!==0?(l=N&~o,l!==0?r=ja(l):(x&=N,x!==0?r=ja(x):s||(s=N&~e,s!==0&&(r=ja(s))))):(N=l&~o,N!==0?r=ja(N):x!==0?r=ja(x):s||(s=l&~e,s!==0&&(r=ja(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 cl(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 pu(){var e=ss;return ss<<=1,(ss&62914560)===0&&(ss=4194304),e}function ic(e){for(var a=[],s=0;31>s;s++)a.push(e);return a}function ol(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 N=e.entanglements,A=e.expirationTimes,U=e.hiddenUpdates;for(s=x&~s;0<s;){var Y=31-Tt(s),F=1<<Y;N[Y]=0,A[Y]=-1;var G=U[Y];if(G!==null)for(U[Y]=null,Y=0;Y<G.length;Y++){var V=G[Y];V!==null&&(V.lane&=-536870913)}s&=~F}l!==0&&gu(e,l,0),o!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=o&~(x&~a))}function gu(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 bu(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 yu(e,a){var s=a&-a;return s=(s&42)!==0?1:rc(s),(s&(e.suspendedLanes|a))!==0?0:s}function rc(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 cc(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function vu(){var e=ie.p;return e!==0?e:(e=window.event,e===void 0?32:ih(e.type))}function ju(e,a){var s=ie.p;try{return ie.p=e,a()}finally{ie.p=s}}var ns=Math.random().toString(36).slice(2),vt="__reactFiber$"+ns,Lt="__reactProps$"+ns,un="__reactContainer$"+ns,oc="__reactEvents$"+ns,I0="__reactListeners$"+ns,P0="__reactHandles$"+ns,Nu="__reactResources$"+ns,dl="__reactMarker$"+ns;function dc(e){delete e[vt],delete e[Lt],delete e[oc],delete e[I0],delete e[P0]}function mn(e){var a=e[vt];if(a)return a;for(var s=e.parentNode;s;){if(a=s[un]||s[vt]){if(s=a.alternate,a.child!==null||s!==null&&s.child!==null)for(e=Vf(e);e!==null;){if(s=e[vt])return s;e=Vf(e)}return a}e=s,s=e.parentNode}return null}function xn(e){if(e=e[vt]||e[un]){var a=e.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return e}return null}function ul(e){var a=e.tag;if(a===5||a===26||a===27||a===6)return e.stateNode;throw Error(c(33))}function fn(e){var a=e[Nu];return a||(a=e[Nu]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function pt(e){e[dl]=!0}var wu=new Set,Su={};function Hs(e,a){hn(e,a),hn(e+"Capture",a)}function hn(e,a){for(Su[e]=a,e=0;e<a.length;e++)wu.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]*$"),ku={},zu={};function ep(e){return P.call(zu,e)?!0:P.call(ku,e)?!1:W0.test(e)?zu[e]=!0:(ku[e]=!0,!1)}function vi(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 ji(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 Ma(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 Wt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Cu(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 uc(e){if(!e._valueTracker){var a=Cu(e)?"checked":"value";e._valueTracker=tp(e,a,""+e[a])}}function Au(e){if(!e)return!1;var a=e._valueTracker;if(!a)return!0;var s=a.getValue(),l="";return e&&(l=Cu(e)?e.checked?"true":"false":e.value),e=l,e!==s?(a.setValue(e),!0):!1}function Ni(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 ea(e){return e.replace(ap,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function mc(e,a,s,l,r,o,x,N){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=""+Wt(a)):e.value!==""+Wt(a)&&(e.value=""+Wt(a)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),a!=null?xc(e,x,Wt(a)):s!=null?xc(e,x,Wt(s)):l!=null&&e.removeAttribute("value"),r==null&&o!=null&&(e.defaultChecked=!!o),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+Wt(N):e.removeAttribute("name")}function Eu(e,a,s,l,r,o,x,N){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)){uc(e);return}s=s!=null?""+Wt(s):"",a=a!=null?""+Wt(a):s,N||a===e.value||(e.value=a),e.defaultValue=a}l=l??r,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=N?e.checked:!!l,e.defaultChecked=!!l,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),uc(e)}function xc(e,a,s){a==="number"&&Ni(e.ownerDocument)===e||e.defaultValue===""+s||(e.defaultValue=""+s)}function pn(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=""+Wt(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 Tu(e,a,s){if(a!=null&&(a=""+Wt(a),a!==e.value&&(e.value=a),s==null)){e.defaultValue!==a&&(e.defaultValue=a);return}e.defaultValue=s!=null?""+Wt(s):""}function Ru(e,a,s,l){if(a==null){if(l!=null){if(s!=null)throw Error(c(92));if(fe(l)){if(1<l.length)throw Error(c(93));l=l[0]}s=l}s==null&&(s=""),a=s}s=Wt(a),e.defaultValue=s,l=e.textContent,l===s&&l!==""&&l!==null&&(e.value=l),uc(e)}function gn(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 Mu(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 Du(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&&Mu(e,r,l)}else for(var o in a)a.hasOwnProperty(o)&&Mu(e,o,a[o])}function fc(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 wi(e){return lp.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Da(){}var hc=null;function pc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var bn=null,yn=null;function Ou(e){var a=xn(e);if(a&&(e=a.stateNode)){var s=e[Lt]||null;e:switch(e=a.stateNode,a.type){case"input":if(mc(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="'+ea(""+a)+'"][type="radio"]'),a=0;a<s.length;a++){var l=s[a];if(l!==e&&l.form===e.form){var r=l[Lt]||null;if(!r)throw Error(c(90));mc(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&&Au(l)}break e;case"textarea":Tu(e,s.value,s.defaultValue);break e;case"select":a=s.value,a!=null&&pn(e,!!s.multiple,a,!1)}}}var gc=!1;function Lu(e,a,s){if(gc)return e(a,s);gc=!0;try{var l=e(a);return l}finally{if(gc=!1,(bn!==null||yn!==null)&&(dr(),bn&&(a=bn,e=yn,yn=bn=null,Ou(a),e)))for(a=0;a<e.length;a++)Ou(e[a])}}function ml(e,a){var s=e.stateNode;if(s===null)return null;var l=s[Lt]||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 Oa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bc=!1;if(Oa)try{var xl={};Object.defineProperty(xl,"passive",{get:function(){bc=!0}}),window.addEventListener("test",xl,xl),window.removeEventListener("test",xl,xl)}catch{bc=!1}var ls=null,yc=null,Si=null;function _u(){if(Si)return Si;var e,a=yc,s=a.length,l,r="value"in ls?ls.value:ls.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 Si=r.slice(e,1<l?1-l:void 0)}function ki(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 zi(){return!0}function Uu(){return!1}function _t(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 N in e)e.hasOwnProperty(N)&&(s=e[N],this[N]=s?s(o):o[N]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?zi:Uu,this.isPropagationStopped=Uu,this}return y(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=zi)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=zi)},persist:function(){},isPersistent:zi}),a}var qs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ci=_t(qs),fl=y({},qs,{view:0,detail:0}),ip=_t(fl),vc,jc,hl,Ai=y({},fl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wc,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!==hl&&(hl&&e.type==="mousemove"?(vc=e.screenX-hl.screenX,jc=e.screenY-hl.screenY):jc=vc=0,hl=e),vc)},movementY:function(e){return"movementY"in e?e.movementY:jc}}),Bu=_t(Ai),rp=y({},Ai,{dataTransfer:0}),cp=_t(rp),op=y({},fl,{relatedTarget:0}),Nc=_t(op),dp=y({},qs,{animationName:0,elapsedTime:0,pseudoElement:0}),up=_t(dp),mp=y({},qs,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),xp=_t(mp),fp=y({},qs,{data:0}),$u=_t(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 wc(){return bp}var yp=y({},fl,{key:function(e){if(e.key){var a=hp[e.key]||e.key;if(a!=="Unidentified")return a}return e.type==="keypress"?(e=ki(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:wc,charCode:function(e){return e.type==="keypress"?ki(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ki(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),vp=_t(yp),jp=y({},Ai,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Hu=_t(jp),Np=y({},fl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wc}),wp=_t(Np),Sp=y({},qs,{propertyName:0,elapsedTime:0,pseudoElement:0}),kp=_t(Sp),zp=y({},Ai,{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=_t(zp),Ap=y({},qs,{newState:0,oldState:0}),Ep=_t(Ap),Tp=[9,13,27,32],Sc=Oa&&"CompositionEvent"in window,pl=null;Oa&&"documentMode"in document&&(pl=document.documentMode);var Rp=Oa&&"TextEvent"in window&&!pl,qu=Oa&&(!Sc||pl&&8<pl&&11>=pl),Gu=" ",Ku=!1;function Vu(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 Yu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var vn=!1;function Mp(e,a){switch(e){case"compositionend":return Yu(a);case"keypress":return a.which!==32?null:(Ku=!0,Gu);case"textInput":return e=a.data,e===Gu&&Ku?null:e;default:return null}}function Dp(e,a){if(vn)return e==="compositionend"||!Sc&&Vu(e,a)?(e=_u(),Si=yc=ls=null,vn=!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 qu&&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 Xu(e){var a=e&&e.nodeName&&e.nodeName.toLowerCase();return a==="input"?!!Op[e.type]:a==="textarea"}function Qu(e,a,s,l){bn?yn?yn.push(l):yn=[l]:bn=l,a=gr(a,"onChange"),0<a.length&&(s=new Ci("onChange","change",null,s,l),e.push({event:s,listeners:a}))}var gl=null,bl=null;function Lp(e){Tf(e,0)}function Ei(e){var a=ul(e);if(Au(a))return e}function Zu(e,a){if(e==="change")return a}var Ju=!1;if(Oa){var kc;if(Oa){var zc="oninput"in document;if(!zc){var Fu=document.createElement("div");Fu.setAttribute("oninput","return;"),zc=typeof Fu.oninput=="function"}kc=zc}else kc=!1;Ju=kc&&(!document.documentMode||9<document.documentMode)}function Iu(){gl&&(gl.detachEvent("onpropertychange",Pu),bl=gl=null)}function Pu(e){if(e.propertyName==="value"&&Ei(bl)){var a=[];Qu(a,bl,e,pc(e)),Lu(Lp,a)}}function _p(e,a,s){e==="focusin"?(Iu(),gl=a,bl=s,gl.attachEvent("onpropertychange",Pu)):e==="focusout"&&Iu()}function Up(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ei(bl)}function Bp(e,a){if(e==="click")return Ei(a)}function $p(e,a){if(e==="input"||e==="change")return Ei(a)}function Hp(e,a){return e===a&&(e!==0||1/e===1/a)||e!==e&&a!==a}var Vt=typeof Object.is=="function"?Object.is:Hp;function yl(e,a){if(Vt(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)||!Vt(e[r],a[r]))return!1}return!0}function Wu(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function em(e,a){var s=Wu(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=Wu(s)}}function tm(e,a){return e&&a?e===a?!0:e&&e.nodeType===3?!1:a&&a.nodeType===3?tm(e,a.parentNode):"contains"in e?e.contains(a):e.compareDocumentPosition?!!(e.compareDocumentPosition(a)&16):!1:!1}function am(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var a=Ni(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=Ni(e.document)}return a}function Cc(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=Oa&&"documentMode"in document&&11>=document.documentMode,jn=null,Ac=null,vl=null,Ec=!1;function sm(e,a,s){var l=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Ec||jn==null||jn!==Ni(l)||(l=jn,"selectionStart"in l&&Cc(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}),vl&&yl(vl,l)||(vl=l,l=gr(Ac,"onSelect"),0<l.length&&(a=new Ci("onSelect","select",null,a,s),e.push({event:a,listeners:l}),a.target=jn)))}function Gs(e,a){var s={};return s[e.toLowerCase()]=a.toLowerCase(),s["Webkit"+e]="webkit"+a,s["Moz"+e]="moz"+a,s}var Nn={animationend:Gs("Animation","AnimationEnd"),animationiteration:Gs("Animation","AnimationIteration"),animationstart:Gs("Animation","AnimationStart"),transitionrun:Gs("Transition","TransitionRun"),transitionstart:Gs("Transition","TransitionStart"),transitioncancel:Gs("Transition","TransitionCancel"),transitionend:Gs("Transition","TransitionEnd")},Tc={},nm={};Oa&&(nm=document.createElement("div").style,"AnimationEvent"in window||(delete Nn.animationend.animation,delete Nn.animationiteration.animation,delete Nn.animationstart.animation),"TransitionEvent"in window||delete Nn.transitionend.transition);function Ks(e){if(Tc[e])return Tc[e];if(!Nn[e])return e;var a=Nn[e],s;for(s in a)if(a.hasOwnProperty(s)&&s in nm)return Tc[e]=a[s];return e}var lm=Ks("animationend"),im=Ks("animationiteration"),rm=Ks("animationstart"),Gp=Ks("transitionrun"),Kp=Ks("transitionstart"),Vp=Ks("transitioncancel"),cm=Ks("transitionend"),om=new Map,Rc="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(" ");Rc.push("scrollEnd");function ha(e,a){om.set(e,a),Hs(a,[e])}var Ti=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)},ta=[],wn=0,Mc=0;function Ri(){for(var e=wn,a=Mc=wn=0;a<e;){var s=ta[a];ta[a++]=null;var l=ta[a];ta[a++]=null;var r=ta[a];ta[a++]=null;var o=ta[a];if(ta[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&&dm(s,r,o)}}function Mi(e,a,s,l){ta[wn++]=e,ta[wn++]=a,ta[wn++]=s,ta[wn++]=l,Mc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Dc(e,a,s,l){return Mi(e,a,s,l),Di(e)}function Vs(e,a){return Mi(e,null,null,a),Di(e)}function dm(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 Di(e){if(50<Gl)throw Gl=0,Ko=null,Error(c(185));for(var a=e.return;a!==null;)e=a,a=e.return;return e.tag===3?e.stateNode:null}var Sn={};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 Yt(e,a,s,l){return new Yp(e,a,s,l)}function Oc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function La(e,a){var s=e.alternate;return s===null?(s=Yt(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 um(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 Oi(e,a,s,l,r,o){var x=0;if(l=e,typeof e=="function")Oc(e)&&(x=1);else if(typeof e=="string")x=Fg(e,s,B.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case I:return e=Yt(31,s,a,r),e.elementType=I,e.lanes=o,e;case w:return Ys(s.children,r,o,a);case v:x=8,r|=24;break;case z:return e=Yt(12,s,a,r|2),e.elementType=z,e.lanes=o,e;case te:return e=Yt(13,s,a,r),e.elementType=te,e.lanes=o,e;case oe:return e=Yt(19,s,a,r),e.elementType=oe,e.lanes=o,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case O:x=10;break e;case M:x=9;break e;case E:x=11;break e;case H:x=14;break e;case $:x=16,l=null;break e}x=29,s=Error(c(130,e===null?"null":typeof e,"")),l=null}return a=Yt(x,s,a,r),a.elementType=e,a.type=l,a.lanes=o,a}function Ys(e,a,s,l){return e=Yt(7,e,l,a),e.lanes=s,e}function Lc(e,a,s){return e=Yt(6,e,null,a),e.lanes=s,e}function mm(e){var a=Yt(18,null,null,0);return a.stateNode=e,a}function _c(e,a,s){return a=Yt(4,e.children!==null?e.children:[],e.key,a),a.lanes=s,a.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},a}var xm=new WeakMap;function aa(e,a){if(typeof e=="object"&&e!==null){var s=xm.get(e);return s!==void 0?s:(a={value:e,source:a,stack:D(a)},xm.set(e,a),a)}return{value:e,source:a,stack:D(a)}}var kn=[],zn=0,Li=null,jl=0,sa=[],na=0,is=null,Na=1,wa="";function _a(e,a){kn[zn++]=jl,kn[zn++]=Li,Li=e,jl=a}function fm(e,a,s){sa[na++]=Na,sa[na++]=wa,sa[na++]=is,is=e;var l=Na;e=wa;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,Na=1<<32-Tt(a)+r|s<<r|l,wa=o+e}else Na=1<<o|s<<r|l,wa=e}function Uc(e){e.return!==null&&(_a(e,1),fm(e,1,0))}function Bc(e){for(;e===Li;)Li=kn[--zn],kn[zn]=null,jl=kn[--zn],kn[zn]=null;for(;e===is;)is=sa[--na],sa[na]=null,wa=sa[--na],sa[na]=null,Na=sa[--na],sa[na]=null}function hm(e,a){sa[na++]=Na,sa[na++]=wa,sa[na++]=is,Na=a.id,wa=a.overflow,is=e}var jt=null,Qe=null,Me=!1,rs=null,la=!1,$c=Error(c(519));function cs(e){var a=Error(c(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Nl(aa(a,e)),$c}function pm(e){var a=e.stateNode,s=e.type,l=e.memoizedProps;switch(a[vt]=e,a[Lt]=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<Vl.length;s++)Ee(Vl[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),Eu(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),Ru(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||Of(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=Da),a=!0):a=!1,a||cs(e,!0)}function gm(e){for(jt=e.return;jt;)switch(jt.tag){case 5:case 31:case 13:la=!1;return;case 27:case 3:la=!0;return;default:jt=jt.return}}function Cn(e){if(e!==jt)return!1;if(!Me)return gm(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")||nd(e.type,e.memoizedProps)),s=!s),s&&Qe&&cs(e),gm(e),a===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));Qe=Kf(e)}else if(a===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));Qe=Kf(e)}else a===27?(a=Qe,Ns(e.type)?(e=od,od=null,Qe=e):Qe=a):Qe=jt?ra(e.stateNode.nextSibling):null;return!0}function Xs(){Qe=jt=null,Me=!1}function Hc(){var e=rs;return e!==null&&(Ht===null?Ht=e:Ht.push.apply(Ht,e),rs=null),e}function Nl(e){rs===null?rs=[e]:rs.push(e)}var qc=T(null),Qs=null,Ua=null;function os(e,a,s){ce(qc,a._currentValue),a._currentValue=s}function Ba(e){e._currentValue=qc.current,Q(qc)}function Gc(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 Kc(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 N=o;o=r;for(var A=0;A<a.length;A++)if(N.context===a[A]){o.lanes|=s,N=o.alternate,N!==null&&(N.lanes|=s),Gc(o.return,s,e),l||(x=null);break e}o=N.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),Gc(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 An(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 N=r.type;Vt(r.pendingProps.value,x.value)||(e!==null?e.push(N):e=[N])}}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(Jl):e=[Jl])}r=r.return}e!==null&&Kc(a,e,s,l),a.flags|=262144}function _i(e){for(e=e.firstContext;e!==null;){if(!Vt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Zs(e){Qs=e,Ua=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Nt(e){return bm(Qs,e)}function Ui(e,a){return Qs===null&&Zs(e),bm(e,a)}function bm(e,a){var s=a._currentValue;if(a={context:a,memoizedValue:s,next:null},Ua===null){if(e===null)throw Error(c(308));Ua=a,e.dependencies={lanes:0,firstContext:a},e.flags|=524288}else Ua=Ua.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,rt={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Vc(){return{controller:new Xp,data:new Map,refCount:0}}function wl(e){e.refCount--,e.refCount===0&&Qp(Zp,function(){e.controller.abort()})}var Sl=null,Yc=0,En=0,Tn=null;function Jp(e,a){if(Sl===null){var s=Sl=[];Yc=0,En=Jo(),Tn={status:"pending",value:void 0,then:function(l){s.push(l)}}}return Yc++,a.then(ym,ym),a}function ym(){if(--Yc===0&&Sl!==null){Tn!==null&&(Tn.status="fulfilled");var e=Sl;Sl=null,En=0,Tn=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 vm=K.S;K.S=function(e,a){sf=ht(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&Jp(e,a),vm!==null&&vm(e,a)};var Js=T(null);function Xc(){var e=Js.current;return e!==null?e:Ve.pooledCache}function Bi(e,a){a===null?ce(Js,Js.current):ce(Js,a.pool)}function jm(){var e=Xc();return e===null?null:{parent:rt._currentValue,pool:e}}var Rn=Error(c(460)),Qc=Error(c(474)),$i=Error(c(542)),Hi={then:function(){}};function Nm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function wm(e,a,s){switch(s=e[s],s===void 0?e.push(a):s!==a&&(a.then(Da,Da),a=s),a.status){case"fulfilled":return a.value;case"rejected":throw e=a.reason,km(e),e;default:if(typeof a.status=="string")a.then(Da,Da);else{if(e=Ve,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,km(e),e}throw Is=a,Rn}}function Fs(e){try{var a=e._init;return a(e._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(Is=s,Rn):s}}var Is=null;function Sm(){if(Is===null)throw Error(c(459));var e=Is;return Is=null,e}function km(e){if(e===Rn||e===$i)throw Error(c(483))}var Mn=null,kl=0;function qi(e){var a=kl;return kl+=1,Mn===null&&(Mn=[]),wm(Mn,e,a)}function zl(e,a){a=a.props.ref,e.ref=a!==void 0?a:null}function Gi(e,a){throw a.$$typeof===j?Error(c(525)):(e=Object.prototype.toString.call(a),Error(c(31,e==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":e)))}function zm(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=La(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 N(L,R,_,Z){return R===null||R.tag!==6?(R=Lc(_,L.mode,Z),R.return=L,R):(R=r(R,_),R.return=L,R)}function A(L,R,_,Z){var pe=_.type;return pe===w?Y(L,R,_.props.children,Z,_.key):R!==null&&(R.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===$&&Fs(pe)===R.type)?(R=r(R,_.props),zl(R,_),R.return=L,R):(R=Oi(_.type,_.key,_.props,null,L.mode,Z),zl(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=_c(_,L.mode,Z),R.return=L,R):(R=r(R,_.children||[]),R.return=L,R)}function Y(L,R,_,Z,pe){return R===null||R.tag!==7?(R=Ys(_,L.mode,Z,pe),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=Lc(""+R,L.mode,_),R.return=L,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case k:return _=Oi(R.type,R.key,R.props,null,L.mode,_),zl(_,R),_.return=L,_;case C:return R=_c(R,L.mode,_),R.return=L,R;case $:return R=Fs(R),F(L,R,_)}if(fe(R)||ne(R))return R=Ys(R,L.mode,_,null),R.return=L,R;if(typeof R.then=="function")return F(L,qi(R),_);if(R.$$typeof===O)return F(L,Ui(L,R),_);Gi(L,R)}return null}function G(L,R,_,Z){var pe=R!==null?R.key:null;if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return pe!==null?null:N(L,R,""+_,Z);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case k:return _.key===pe?A(L,R,_,Z):null;case C:return _.key===pe?U(L,R,_,Z):null;case $:return _=Fs(_),G(L,R,_,Z)}if(fe(_)||ne(_))return pe!==null?null:Y(L,R,_,Z,null);if(typeof _.then=="function")return G(L,R,qi(_),Z);if(_.$$typeof===O)return G(L,R,Ui(L,_),Z);Gi(L,_)}return null}function V(L,R,_,Z,pe){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return L=L.get(_)||null,N(R,L,""+Z,pe);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,pe);case C:return L=L.get(Z.key===null?_:Z.key)||null,U(R,L,Z,pe);case $:return Z=Fs(Z),V(L,R,_,Z,pe)}if(fe(Z)||ne(Z))return L=L.get(_)||null,Y(R,L,Z,pe,null);if(typeof Z.then=="function")return V(L,R,_,qi(Z),pe);if(Z.$$typeof===O)return V(L,R,_,Ui(R,Z),pe);Gi(R,Z)}return null}function ue(L,R,_,Z){for(var pe=null,Le=null,he=R,ze=R=0,Re=null;he!==null&&ze<_.length;ze++){he.index>ze?(Re=he,he=null):Re=he.sibling;var _e=G(L,he,_[ze],Z);if(_e===null){he===null&&(he=Re);break}e&&he&&_e.alternate===null&&a(L,he),R=o(_e,R,ze),Le===null?pe=_e:Le.sibling=_e,Le=_e,he=Re}if(ze===_.length)return s(L,he),Me&&_a(L,ze),pe;if(he===null){for(;ze<_.length;ze++)he=F(L,_[ze],Z),he!==null&&(R=o(he,R,ze),Le===null?pe=he:Le.sibling=he,Le=he);return Me&&_a(L,ze),pe}for(he=l(he);ze<_.length;ze++)Re=V(he,L,ze,_[ze],Z),Re!==null&&(e&&Re.alternate!==null&&he.delete(Re.key===null?ze:Re.key),R=o(Re,R,ze),Le===null?pe=Re:Le.sibling=Re,Le=Re);return e&&he.forEach(function(Cs){return a(L,Cs)}),Me&&_a(L,ze),pe}function ge(L,R,_,Z){if(_==null)throw Error(c(151));for(var pe=null,Le=null,he=R,ze=R=0,Re=null,_e=_.next();he!==null&&!_e.done;ze++,_e=_.next()){he.index>ze?(Re=he,he=null):Re=he.sibling;var Cs=G(L,he,_e.value,Z);if(Cs===null){he===null&&(he=Re);break}e&&he&&Cs.alternate===null&&a(L,he),R=o(Cs,R,ze),Le===null?pe=Cs:Le.sibling=Cs,Le=Cs,he=Re}if(_e.done)return s(L,he),Me&&_a(L,ze),pe;if(he===null){for(;!_e.done;ze++,_e=_.next())_e=F(L,_e.value,Z),_e!==null&&(R=o(_e,R,ze),Le===null?pe=_e:Le.sibling=_e,Le=_e);return Me&&_a(L,ze),pe}for(he=l(he);!_e.done;ze++,_e=_.next())_e=V(he,L,ze,_e.value,Z),_e!==null&&(e&&_e.alternate!==null&&he.delete(_e.key===null?ze:_e.key),R=o(_e,R,ze),Le===null?pe=_e:Le.sibling=_e,Le=_e);return e&&he.forEach(function(rb){return a(L,rb)}),Me&&_a(L,ze),pe}function Ke(L,R,_,Z){if(typeof _=="object"&&_!==null&&_.type===w&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case k:e:{for(var pe=_.key;R!==null;){if(R.key===pe){if(pe=_.type,pe===w){if(R.tag===7){s(L,R.sibling),Z=r(R,_.props.children),Z.return=L,L=Z;break e}}else if(R.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===$&&Fs(pe)===R.type){s(L,R.sibling),Z=r(R,_.props),zl(Z,_),Z.return=L,L=Z;break e}s(L,R);break}else a(L,R);R=R.sibling}_.type===w?(Z=Ys(_.props.children,L.mode,Z,_.key),Z.return=L,L=Z):(Z=Oi(_.type,_.key,_.props,null,L.mode,Z),zl(Z,_),Z.return=L,L=Z)}return x(L);case C:e:{for(pe=_.key;R!==null;){if(R.key===pe)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=_c(_,L.mode,Z),Z.return=L,L=Z}return x(L);case $:return _=Fs(_),Ke(L,R,_,Z)}if(fe(_))return ue(L,R,_,Z);if(ne(_)){if(pe=ne(_),typeof pe!="function")throw Error(c(150));return _=pe.call(_),ge(L,R,_,Z)}if(typeof _.then=="function")return Ke(L,R,qi(_),Z);if(_.$$typeof===O)return Ke(L,R,Ui(L,_),Z);Gi(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=Lc(_,L.mode,Z),Z.return=L,L=Z),x(L)):s(L,R)}return function(L,R,_,Z){try{kl=0;var pe=Ke(L,R,_,Z);return Mn=null,pe}catch(he){if(he===Rn||he===$i)throw he;var Le=Yt(29,he,null,L.mode);return Le.lanes=Z,Le.return=L,Le}finally{}}}var Ps=zm(!0),Cm=zm(!1),ds=!1;function Zc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Jc(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 us(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ms(e,a,s){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Ue&2)!==0){var r=l.pending;return r===null?a.next=a:(a.next=r.next,r.next=a),l.pending=a,a=Di(e),dm(e,null,s),a}return Mi(e,l,a,s),Di(e)}function Cl(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,bu(e,s)}}function Fc(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 Ic=!1;function Al(){if(Ic){var e=Tn;if(e!==null)throw e}}function El(e,a,s,l){Ic=!1;var r=e.updateQueue;ds=!1;var o=r.firstBaseUpdate,x=r.lastBaseUpdate,N=r.shared.pending;if(N!==null){r.shared.pending=null;var A=N,U=A.next;A.next=null,x===null?o=U:x.next=U,x=A;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,N=Y.lastBaseUpdate,N!==x&&(N===null?Y.firstBaseUpdate=U:N.next=U,Y.lastBaseUpdate=A))}if(o!==null){var F=r.baseState;x=0,Y=U=A=null,N=o;do{var G=N.lane&-536870913,V=G!==N.lane;if(V?(Te&G)===G:(l&G)===G){G!==0&&G===En&&(Ic=!0),Y!==null&&(Y=Y.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var ue=e,ge=N;G=a;var Ke=s;switch(ge.tag){case 1:if(ue=ge.payload,typeof ue=="function"){F=ue.call(Ke,F,G);break e}F=ue;break e;case 3:ue.flags=ue.flags&-65537|128;case 0:if(ue=ge.payload,G=typeof ue=="function"?ue.call(Ke,F,G):ue,G==null)break e;F=y({},F,G);break e;case 2:ds=!0}}G=N.callback,G!==null&&(e.flags|=64,V&&(e.flags|=8192),V=r.callbacks,V===null?r.callbacks=[G]:V.push(G))}else V={lane:G,tag:N.tag,payload:N.payload,callback:N.callback,next:null},Y===null?(U=Y=V,A=F):Y=Y.next=V,x|=G;if(N=N.next,N===null){if(N=r.shared.pending,N===null)break;V=N,N=V.next,V.next=null,r.lastBaseUpdate=V,r.shared.pending=null}}while(!0);Y===null&&(A=F),r.baseState=A,r.firstBaseUpdate=U,r.lastBaseUpdate=Y,o===null&&(r.shared.lanes=0),gs|=x,e.lanes=x,e.memoizedState=F}}function Am(e,a){if(typeof e!="function")throw Error(c(191,e));e.call(a)}function Em(e,a){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)Am(s[e],a)}var Dn=T(null),Ki=T(0);function Tm(e,a){e=Qa,ce(Ki,e),ce(Dn,a),Qa=e|a.baseLanes}function Pc(){ce(Ki,Qa),ce(Dn,Dn.current)}function Wc(){Qa=Ki.current,Q(Dn),Q(Ki)}var Xt=T(null),ia=null;function xs(e){var a=e.alternate;ce(st,st.current&1),ce(Xt,e),ia===null&&(a===null||Dn.current!==null||a.memoizedState!==null)&&(ia=e)}function eo(e){ce(st,st.current),ce(Xt,e),ia===null&&(ia=e)}function Rm(e){e.tag===22?(ce(st,st.current),ce(Xt,e),ia===null&&(ia=e)):fs()}function fs(){ce(st,st.current),ce(Xt,Xt.current)}function Qt(e){Q(Xt),ia===e&&(ia=null),Q(st)}var st=T(0);function Vi(e){for(var a=e;a!==null;){if(a.tag===13){var s=a.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||rd(s)||cd(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 $a=0,Se=null,qe=null,ct=null,Yi=!1,On=!1,Ws=!1,Xi=0,Tl=0,Ln=null,Ip=0;function We(){throw Error(c(321))}function to(e,a){if(a===null)return!1;for(var s=0;s<a.length&&s<e.length;s++)if(!Vt(e[s],a[s]))return!1;return!0}function ao(e,a,s,l,r,o){return $a=o,Se=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,K.H=e===null||e.memoizedState===null?fx:bo,Ws=!1,o=s(l,r),Ws=!1,On&&(o=Dm(a,s,l,r)),Mm(e),o}function Mm(e){K.H=Dl;var a=qe!==null&&qe.next!==null;if($a=0,ct=qe=Se=null,Yi=!1,Tl=0,Ln=null,a)throw Error(c(300));e===null||ot||(e=e.dependencies,e!==null&&_i(e)&&(ot=!0))}function Dm(e,a,s,l){Se=e;var r=0;do{if(On&&(Ln=null),Tl=0,On=!1,25<=r)throw Error(c(301));if(r+=1,ct=qe=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}K.H=hx,o=a(s,l)}while(On);return o}function Pp(){var e=K.H,a=e.useState()[0];return a=typeof a.then=="function"?Rl(a):a,e=e.useState()[0],(qe!==null?qe.memoizedState:null)!==e&&(Se.flags|=1024),a}function so(){var e=Xi!==0;return Xi=0,e}function no(e,a,s){a.updateQueue=e.updateQueue,a.flags&=-2053,e.lanes&=~s}function lo(e){if(Yi){for(e=e.memoizedState;e!==null;){var a=e.queue;a!==null&&(a.pending=null),e=e.next}Yi=!1}$a=0,ct=qe=Se=null,On=!1,Tl=Xi=0,Ln=null}function Rt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ct===null?Se.memoizedState=ct=e:ct=ct.next=e,ct}function nt(){if(qe===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=qe.next;var a=ct===null?Se.memoizedState:ct.next;if(a!==null)ct=a,qe=e;else{if(e===null)throw Se.alternate===null?Error(c(467)):Error(c(310));qe=e,e={memoizedState:qe.memoizedState,baseState:qe.baseState,baseQueue:qe.baseQueue,queue:qe.queue,next:null},ct===null?Se.memoizedState=ct=e:ct=ct.next=e}return ct}function Qi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Rl(e){var a=Tl;return Tl+=1,Ln===null&&(Ln=[]),e=wm(Ln,e,a),a=Se,(ct===null?a.memoizedState:ct.next)===null&&(a=a.alternate,K.H=a===null||a.memoizedState===null?fx:bo),e}function Zi(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Rl(e);if(e.$$typeof===O)return Nt(e)}throw Error(c(438,String(e)))}function io(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=Qi(),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 Ha(e,a){return typeof a=="function"?a(e):a}function Ji(e){var a=nt();return ro(a,qe,e)}function ro(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 N=x=null,A=null,U=a,Y=!1;do{var F=U.lane&-536870913;if(F!==U.lane?(Te&F)===F:($a&F)===F){var G=U.revertLane;if(G===0)A!==null&&(A=A.next={lane:0,revertLane:0,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),F===En&&(Y=!0);else if(($a&G)===G){U=U.next,G===En&&(Y=!0);continue}else F={lane:0,revertLane:U.revertLane,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},A===null?(N=A=F,x=o):A=A.next=F,Se.lanes|=G,gs|=G;F=U.action,Ws&&s(o,F),o=U.hasEagerState?U.eagerState:s(o,F)}else G={lane:F,revertLane:U.revertLane,gesture:U.gesture,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},A===null?(N=A=G,x=o):A=A.next=G,Se.lanes|=F,gs|=F;U=U.next}while(U!==null&&U!==a);if(A===null?x=o:A.next=N,!Vt(o,e.memoizedState)&&(ot=!0,Y&&(s=Tn,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 co(e){var a=nt(),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);Vt(o,a.memoizedState)||(ot=!0),a.memoizedState=o,a.baseQueue===null&&(a.baseState=o),s.lastRenderedState=o}return[o,l]}function Om(e,a,s){var l=Se,r=nt(),o=Me;if(o){if(s===void 0)throw Error(c(407));s=s()}else s=a();var x=!Vt((qe||r).memoizedState,s);if(x&&(r.memoizedState=s,ot=!0),r=r.queue,mo(Um.bind(null,l,r,e),[e]),r.getSnapshot!==a||x||ct!==null&&ct.memoizedState.tag&1){if(l.flags|=2048,_n(9,{destroy:void 0},_m.bind(null,l,r,s,a),null),Ve===null)throw Error(c(349));o||($a&127)!==0||Lm(l,a,s)}return s}function Lm(e,a,s){e.flags|=16384,e={getSnapshot:a,value:s},a=Se.updateQueue,a===null?(a=Qi(),Se.updateQueue=a,a.stores=[e]):(s=a.stores,s===null?a.stores=[e]:s.push(e))}function _m(e,a,s,l){a.value=s,a.getSnapshot=l,Bm(a)&&$m(e)}function Um(e,a,s){return s(function(){Bm(a)&&$m(e)})}function Bm(e){var a=e.getSnapshot;e=e.value;try{var s=a();return!Vt(e,s)}catch{return!0}}function $m(e){var a=Vs(e,2);a!==null&&qt(a,e,2)}function oo(e){var a=Rt();if(typeof e=="function"){var s=e;if(e=s(),Ws){it(!0);try{s()}finally{it(!1)}}}return a.memoizedState=a.baseState=e,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ha,lastRenderedState:e},a}function Hm(e,a,s,l){return e.baseState=s,ro(e,qe,typeof l=="function"?l:Ha)}function Wp(e,a,s,l,r){if(Pi(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)}};K.T!==null?s(!0):o.isTransition=!1,l(o),s=a.pending,s===null?(o.next=a.pending=o,qm(a,o)):(o.next=s.next,a.pending=s.next=o)}}function qm(e,a){var s=a.action,l=a.payload,r=e.state;if(a.isTransition){var o=K.T,x={};K.T=x;try{var N=s(r,l),A=K.S;A!==null&&A(x,N),Gm(e,a,N)}catch(U){uo(e,a,U)}finally{o!==null&&x.types!==null&&(o.types=x.types),K.T=o}}else try{o=s(r,l),Gm(e,a,o)}catch(U){uo(e,a,U)}}function Gm(e,a,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(l){Km(e,a,l)},function(l){return uo(e,a,l)}):Km(e,a,s)}function Km(e,a,s){a.status="fulfilled",a.value=s,Vm(a),e.state=s,a=e.pending,a!==null&&(s=a.next,s===a?e.pending=null:(s=s.next,a.next=s,qm(e,s)))}function uo(e,a,s){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do a.status="rejected",a.reason=s,Vm(a),a=a.next;while(a!==l)}e.action=null}function Vm(e){e=e.listeners;for(var a=0;a<e.length;a++)(0,e[a])()}function Ym(e,a){return a}function Xm(e,a){if(Me){var s=Ve.formState;if(s!==null){e:{var l=Se;if(Me){if(Qe){t:{for(var r=Qe,o=la;r.nodeType!==8;){if(!o){r=null;break t}if(r=ra(r.nextSibling),r===null){r=null;break t}}o=r.data,r=o==="F!"||o==="F"?r:null}if(r){Qe=ra(r.nextSibling),l=r.data==="F!";break e}}cs(l)}l=!1}l&&(a=s[0])}}return s=Rt(),s.memoizedState=s.baseState=a,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ym,lastRenderedState:a},s.queue=l,s=ux.bind(null,Se,l),l.dispatch=s,l=oo(!1),o=go.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 Qm(e){var a=nt();return Zm(a,qe,e)}function Zm(e,a,s){if(a=ro(e,a,Ym)[0],e=Ji(Ha)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var l=Rl(a)}catch(x){throw x===Rn?$i:x}else l=a;a=nt();var r=a.queue,o=r.dispatch;return s!==a.memoizedState&&(Se.flags|=2048,_n(9,{destroy:void 0},eg.bind(null,r,s),null)),[l,o,e]}function eg(e,a){e.action=a}function Jm(e){var a=nt(),s=qe;if(s!==null)return Zm(a,s,e);nt(),a=a.memoizedState,s=nt();var l=s.queue.dispatch;return s.memoizedState=e,[a,l,!1]}function _n(e,a,s,l){return e={tag:e,create:s,deps:l,inst:a,next:null},a=Se.updateQueue,a===null&&(a=Qi(),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 Fm(){return nt().memoizedState}function Fi(e,a,s,l){var r=Rt();Se.flags|=e,r.memoizedState=_n(1|a,{destroy:void 0},s,l===void 0?null:l)}function Ii(e,a,s,l){var r=nt();l=l===void 0?null:l;var o=r.memoizedState.inst;qe!==null&&l!==null&&to(l,qe.memoizedState.deps)?r.memoizedState=_n(a,o,s,l):(Se.flags|=e,r.memoizedState=_n(1|a,o,s,l))}function Im(e,a){Fi(8390656,8,e,a)}function mo(e,a){Ii(2048,8,e,a)}function tg(e){Se.flags|=4;var a=Se.updateQueue;if(a===null)a=Qi(),Se.updateQueue=a,a.events=[e];else{var s=a.events;s===null?a.events=[e]:s.push(e)}}function Pm(e){var a=nt().memoizedState;return tg({ref:a,nextImpl:e}),function(){if((Ue&2)!==0)throw Error(c(440));return a.impl.apply(void 0,arguments)}}function Wm(e,a){return Ii(4,2,e,a)}function ex(e,a){return Ii(4,4,e,a)}function tx(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 ax(e,a,s){s=s!=null?s.concat([e]):null,Ii(4,4,tx.bind(null,a,e),s)}function xo(){}function sx(e,a){var s=nt();a=a===void 0?null:a;var l=s.memoizedState;return a!==null&&to(a,l[1])?l[0]:(s.memoizedState=[e,a],e)}function nx(e,a){var s=nt();a=a===void 0?null:a;var l=s.memoizedState;if(a!==null&&to(a,l[1]))return l[0];if(l=e(),Ws){it(!0);try{e()}finally{it(!1)}}return s.memoizedState=[l,a],l}function fo(e,a,s){return s===void 0||($a&1073741824)!==0&&(Te&261930)===0?e.memoizedState=a:(e.memoizedState=s,e=lf(),Se.lanes|=e,gs|=e,s)}function lx(e,a,s,l){return Vt(s,a)?s:Dn.current!==null?(e=fo(e,s,l),Vt(e,a)||(ot=!0),e):($a&42)===0||($a&1073741824)!==0&&(Te&261930)===0?(ot=!0,e.memoizedState=s):(e=lf(),Se.lanes|=e,gs|=e,a)}function ix(e,a,s,l,r){var o=ie.p;ie.p=o!==0&&8>o?o:8;var x=K.T,N={};K.T=N,go(e,!1,a,s);try{var A=r(),U=K.S;if(U!==null&&U(N,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var Y=Fp(A,l);Ml(e,a,Y,Ft(e))}else Ml(e,a,l,Ft(e))}catch(F){Ml(e,a,{then:function(){},status:"rejected",reason:F},Ft())}finally{ie.p=o,x!==null&&N.types!==null&&(x.types=N.types),K.T=x}}function ag(){}function ho(e,a,s,l){if(e.tag!==5)throw Error(c(476));var r=rx(e).queue;ix(e,r,a,me,s===null?ag:function(){return cx(e),s(l)})}function rx(e){var a=e.memoizedState;if(a!==null)return a;a={memoizedState:me,baseState:me,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ha,lastRenderedState:me},next:null};var s={};return a.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ha,lastRenderedState:s},next:null},e.memoizedState=a,e=e.alternate,e!==null&&(e.memoizedState=a),a}function cx(e){var a=rx(e);a.next===null&&(a=e.alternate.memoizedState),Ml(e,a.next.queue,{},Ft())}function po(){return Nt(Jl)}function ox(){return nt().memoizedState}function dx(){return nt().memoizedState}function sg(e){for(var a=e.return;a!==null;){switch(a.tag){case 24:case 3:var s=Ft();e=us(s);var l=ms(a,e,s);l!==null&&(qt(l,a,s),Cl(l,a,s)),a={cache:Vc()},e.payload=a;return}a=a.return}}function ng(e,a,s){var l=Ft();s={lane:l,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Pi(e)?mx(a,s):(s=Dc(e,a,s,l),s!==null&&(qt(s,e,l),xx(s,a,l)))}function ux(e,a,s){var l=Ft();Ml(e,a,s,l)}function Ml(e,a,s,l){var r={lane:l,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Pi(e))mx(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,N=o(x,s);if(r.hasEagerState=!0,r.eagerState=N,Vt(N,x))return Mi(e,a,r,0),Ve===null&&Ri(),!1}catch{}finally{}if(s=Dc(e,a,r,l),s!==null)return qt(s,e,l),xx(s,a,l),!0}return!1}function go(e,a,s,l){if(l={lane:2,revertLane:Jo(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Pi(e)){if(a)throw Error(c(479))}else a=Dc(e,s,l,2),a!==null&&qt(a,e,2)}function Pi(e){var a=e.alternate;return e===Se||a!==null&&a===Se}function mx(e,a){On=Yi=!0;var s=e.pending;s===null?a.next=a:(a.next=s.next,s.next=a),e.pending=a}function xx(e,a,s){if((s&4194048)!==0){var l=a.lanes;l&=e.pendingLanes,s|=l,a.lanes=s,bu(e,s)}}var Dl={readContext:Nt,use:Zi,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};Dl.useEffectEvent=We;var fx={readContext:Nt,use:Zi,useCallback:function(e,a){return Rt().memoizedState=[e,a===void 0?null:a],e},useContext:Nt,useEffect:Im,useImperativeHandle:function(e,a,s){s=s!=null?s.concat([e]):null,Fi(4194308,4,tx.bind(null,a,e),s)},useLayoutEffect:function(e,a){return Fi(4194308,4,e,a)},useInsertionEffect:function(e,a){Fi(4,2,e,a)},useMemo:function(e,a){var s=Rt();a=a===void 0?null:a;var l=e();if(Ws){it(!0);try{e()}finally{it(!1)}}return s.memoizedState=[l,a],l},useReducer:function(e,a,s){var l=Rt();if(s!==void 0){var r=s(a);if(Ws){it(!0);try{s(a)}finally{it(!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=oo(e);var a=e.queue,s=ux.bind(null,Se,a);return a.dispatch=s,[e.memoizedState,s]},useDebugValue:xo,useDeferredValue:function(e,a){var s=Rt();return fo(s,e,a)},useTransition:function(){var e=oo(!1);return e=ix.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(),Ve===null)throw Error(c(349));(Te&127)!==0||Lm(l,a,s)}r.memoizedState=s;var o={value:s,getSnapshot:a};return r.queue=o,Im(Um.bind(null,l,o,e),[e]),l.flags|=2048,_n(9,{destroy:void 0},_m.bind(null,l,o,s,a),null),s},useId:function(){var e=Rt(),a=Ve.identifierPrefix;if(Me){var s=wa,l=Na;s=(l&~(1<<32-Tt(l)-1)).toString(32)+s,a="_"+a+"R_"+s,s=Xi++,0<s&&(a+="H"+s.toString(32)),a+="_"}else s=Ip++,a="_"+a+"r_"+s.toString(32)+"_";return e.memoizedState=a},useHostTransitionStatus:po,useFormState:Xm,useActionState:Xm,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=go.bind(null,Se,!0,s),s.dispatch=a,[e,a]},useMemoCache:io,useCacheRefresh:function(){return Rt().memoizedState=sg.bind(null,Se)},useEffectEvent:function(e){var a=Rt(),s={impl:e};return a.memoizedState=s,function(){if((Ue&2)!==0)throw Error(c(440));return s.impl.apply(void 0,arguments)}}},bo={readContext:Nt,use:Zi,useCallback:sx,useContext:Nt,useEffect:mo,useImperativeHandle:ax,useInsertionEffect:Wm,useLayoutEffect:ex,useMemo:nx,useReducer:Ji,useRef:Fm,useState:function(){return Ji(Ha)},useDebugValue:xo,useDeferredValue:function(e,a){var s=nt();return lx(s,qe.memoizedState,e,a)},useTransition:function(){var e=Ji(Ha)[0],a=nt().memoizedState;return[typeof e=="boolean"?e:Rl(e),a]},useSyncExternalStore:Om,useId:ox,useHostTransitionStatus:po,useFormState:Qm,useActionState:Qm,useOptimistic:function(e,a){var s=nt();return Hm(s,qe,e,a)},useMemoCache:io,useCacheRefresh:dx};bo.useEffectEvent=Pm;var hx={readContext:Nt,use:Zi,useCallback:sx,useContext:Nt,useEffect:mo,useImperativeHandle:ax,useInsertionEffect:Wm,useLayoutEffect:ex,useMemo:nx,useReducer:co,useRef:Fm,useState:function(){return co(Ha)},useDebugValue:xo,useDeferredValue:function(e,a){var s=nt();return qe===null?fo(s,e,a):lx(s,qe.memoizedState,e,a)},useTransition:function(){var e=co(Ha)[0],a=nt().memoizedState;return[typeof e=="boolean"?e:Rl(e),a]},useSyncExternalStore:Om,useId:ox,useHostTransitionStatus:po,useFormState:Jm,useActionState:Jm,useOptimistic:function(e,a){var s=nt();return qe!==null?Hm(s,qe,e,a):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:io,useCacheRefresh:dx};hx.useEffectEvent=Pm;function yo(e,a,s,l){a=e.memoizedState,s=s(l,a),s=s==null?a:y({},a,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var vo={enqueueSetState:function(e,a,s){e=e._reactInternals;var l=Ft(),r=us(l);r.payload=a,s!=null&&(r.callback=s),a=ms(e,r,l),a!==null&&(qt(a,e,l),Cl(a,e,l))},enqueueReplaceState:function(e,a,s){e=e._reactInternals;var l=Ft(),r=us(l);r.tag=1,r.payload=a,s!=null&&(r.callback=s),a=ms(e,r,l),a!==null&&(qt(a,e,l),Cl(a,e,l))},enqueueForceUpdate:function(e,a){e=e._reactInternals;var s=Ft(),l=us(s);l.tag=2,a!=null&&(l.callback=a),a=ms(e,l,s),a!==null&&(qt(a,e,s),Cl(a,e,s))}};function px(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?!yl(s,l)||!yl(r,o):!0}function gx(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&&vo.enqueueReplaceState(a,a.state,null)}function en(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=y({},s));for(var r in e)s[r]===void 0&&(s[r]=e[r])}return s}function bx(e){Ti(e)}function yx(e){console.error(e)}function vx(e){Ti(e)}function Wi(e,a){try{var s=e.onUncaughtError;s(a.value,{componentStack:a.stack})}catch(l){setTimeout(function(){throw l})}}function jx(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 jo(e,a,s){return s=us(s),s.tag=3,s.payload={element:null},s.callback=function(){Wi(e,a)},s}function Nx(e){return e=us(e),e.tag=3,e}function wx(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(){jx(a,s,l)}}var x=s.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){jx(a,s,l),typeof r!="function"&&(bs===null?bs=new Set([this]):bs.add(this));var N=l.stack;this.componentDidCatch(l.value,{componentStack:N!==null?N:""})})}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&&An(a,s,r,!0),s=Xt.current,s!==null){switch(s.tag){case 31:case 13:return ia===null?ur():s.alternate===null&&et===0&&(et=3),s.flags&=-257,s.flags|=65536,s.lanes=r,l===Hi?s.flags|=16384:(a=s.updateQueue,a===null?s.updateQueue=new Set([l]):a.add(l),Xo(e,l,r)),!1;case 22:return s.flags|=65536,l===Hi?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)),Xo(e,l,r)),!1}throw Error(c(435,s.tag))}return Xo(e,l,r),ur(),!1}if(Me)return a=Xt.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=r,l!==$c&&(e=Error(c(422),{cause:l}),Nl(aa(e,s)))):(l!==$c&&(a=Error(c(423),{cause:l}),Nl(aa(a,s))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,l=aa(l,s),r=jo(e.stateNode,l,r),Fc(e,r),et!==4&&(et=2)),!1;var o=Error(c(520),{cause:l});if(o=aa(o,s),ql===null?ql=[o]:ql.push(o),et!==4&&(et=2),a===null)return!0;l=aa(l,s),s=a;do{switch(s.tag){case 3:return s.flags|=65536,e=r&-r,s.lanes|=e,e=jo(s.stateNode,l,e),Fc(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"&&(bs===null||!bs.has(o))))return s.flags|=65536,r&=-r,s.lanes|=r,r=Nx(r),wx(r,e,s,l),Fc(s,r),!1}s=s.return}while(s!==null);return!1}var No=Error(c(461)),ot=!1;function wt(e,a,s,l){a.child=e===null?Cm(a,null,s,l):Ps(a,e.child,s,l)}function Sx(e,a,s,l,r){s=s.render;var o=a.ref;if("ref"in l){var x={};for(var N in l)N!=="ref"&&(x[N]=l[N])}else x=l;return Zs(a),l=ao(e,a,s,x,o,r),N=so(),e!==null&&!ot?(no(e,a,r),qa(e,a,r)):(Me&&N&&Uc(a),a.flags|=1,wt(e,a,l,r),a.child)}function kx(e,a,s,l,r){if(e===null){var o=s.type;return typeof o=="function"&&!Oc(o)&&o.defaultProps===void 0&&s.compare===null?(a.tag=15,a.type=o,zx(e,a,o,l,r)):(e=Oi(s.type,null,l,a,a.mode,r),e.ref=a.ref,e.return=a,a.child=e)}if(o=e.child,!To(e,r)){var x=o.memoizedProps;if(s=s.compare,s=s!==null?s:yl,s(x,l)&&e.ref===a.ref)return qa(e,a,r)}return a.flags|=1,e=La(o,l),e.ref=a.ref,e.return=a,a.child=e}function zx(e,a,s,l,r){if(e!==null){var o=e.memoizedProps;if(yl(o,l)&&e.ref===a.ref)if(ot=!1,a.pendingProps=l=o,To(e,r))(e.flags&131072)!==0&&(ot=!0);else return a.lanes=e.lanes,qa(e,a,r)}return wo(e,a,s,l,r)}function Cx(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 Ax(e,a,o,s,l)}if((s&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},e!==null&&Bi(a,o!==null?o.cachePool:null),o!==null?Tm(a,o):Pc(),Rm(a);else return l=a.lanes=536870912,Ax(e,a,o!==null?o.baseLanes|s:s,s,l)}else o!==null?(Bi(a,o.cachePool),Tm(a,o),fs(),a.memoizedState=null):(e!==null&&Bi(a,null),Pc(),fs());return wt(e,a,r,s),a.child}function Ol(e,a){return e!==null&&e.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Ax(e,a,s,l,r){var o=Xc();return o=o===null?null:{parent:rt._currentValue,pool:o},a.memoizedState={baseLanes:s,cachePool:o},e!==null&&Bi(a,null),Pc(),Rm(a),e!==null&&An(e,a,l,!0),a.childLanes=r,null}function er(e,a){return a=ar({mode:a.mode,children:a.children},e.mode),a.ref=e.ref,e.child=a,a.return=e,a}function Ex(e,a,s){return Ps(a,e.child,null,s),e=er(a,a.pendingProps),e.flags|=2,Qt(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=er(a,l),a.lanes=536870912,Ol(null,e);if(eo(a),(e=Qe)?(e=Gf(e,la),e=e!==null&&e.data==="&"?e:null,e!==null&&(a.memoizedState={dehydrated:e,treeContext:is!==null?{id:Na,overflow:wa}:null,retryLane:536870912,hydrationErrors:null},s=mm(e),s.return=a,a.child=s,jt=a,Qe=null)):e=null,e===null)throw cs(a);return a.lanes=536870912,null}return er(a,l)}var o=e.memoizedState;if(o!==null){var x=o.dehydrated;if(eo(a),r)if(a.flags&256)a.flags&=-257,a=Ex(e,a,s);else if(a.memoizedState!==null)a.child=e.child,a.flags|=128,a=null;else throw Error(c(558));else if(ot||An(e,a,s,!1),r=(s&e.childLanes)!==0,ot||r){if(l=Ve,l!==null&&(x=yu(l,s),x!==0&&x!==o.retryLane))throw o.retryLane=x,Vs(e,x),qt(l,e,x),No;ur(),a=Ex(e,a,s)}else e=o.treeContext,Qe=ra(x.nextSibling),jt=a,Me=!0,rs=null,la=!1,e!==null&&hm(a,e),a=er(a,l),a.flags|=4096;return a}return e=La(e.child,{mode:l.mode,children:l.children}),e.ref=a.ref,a.child=e,e.return=a,e}function tr(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 wo(e,a,s,l,r){return Zs(a),s=ao(e,a,s,l,void 0,r),l=so(),e!==null&&!ot?(no(e,a,r),qa(e,a,r)):(Me&&l&&Uc(a),a.flags|=1,wt(e,a,s,r),a.child)}function Tx(e,a,s,l,r,o){return Zs(a),a.updateQueue=null,s=Dm(a,l,s,r),Mm(e),l=so(),e!==null&&!ot?(no(e,a,o),qa(e,a,o)):(Me&&l&&Uc(a),a.flags|=1,wt(e,a,s,o),a.child)}function Rx(e,a,s,l,r){if(Zs(a),a.stateNode===null){var o=Sn,x=s.contextType;typeof x=="object"&&x!==null&&(o=Nt(x)),o=new s(l,o),a.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=vo,a.stateNode=o,o._reactInternals=a,o=a.stateNode,o.props=l,o.state=a.memoizedState,o.refs={},Zc(a),x=s.contextType,o.context=typeof x=="object"&&x!==null?Nt(x):Sn,o.state=a.memoizedState,x=s.getDerivedStateFromProps,typeof x=="function"&&(yo(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&&vo.enqueueReplaceState(o,o.state,null),El(a,l,o,r),Al(),o.state=a.memoizedState),typeof o.componentDidMount=="function"&&(a.flags|=4194308),l=!0}else if(e===null){o=a.stateNode;var N=a.memoizedProps,A=en(s,N);o.props=A;var U=o.context,Y=s.contextType;x=Sn,typeof Y=="object"&&Y!==null&&(x=Nt(Y));var F=s.getDerivedStateFromProps;Y=typeof F=="function"||typeof o.getSnapshotBeforeUpdate=="function",N=a.pendingProps!==N,Y||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(N||U!==x)&&gx(a,o,l,x),ds=!1;var G=a.memoizedState;o.state=G,El(a,l,o,r),Al(),U=a.memoizedState,N||G!==U||ds?(typeof F=="function"&&(yo(a,s,F,l),U=a.memoizedState),(A=ds||px(a,s,A,l,G,U,x))?(Y||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,Jc(e,a),x=a.memoizedProps,Y=en(s,x),o.props=Y,F=a.pendingProps,G=o.context,U=s.contextType,A=Sn,typeof U=="object"&&U!==null&&(A=Nt(U)),N=s.getDerivedStateFromProps,(U=typeof N=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(x!==F||G!==A)&&gx(a,o,l,A),ds=!1,G=a.memoizedState,o.state=G,El(a,l,o,r),Al();var V=a.memoizedState;x!==F||G!==V||ds||e!==null&&e.dependencies!==null&&_i(e.dependencies)?(typeof N=="function"&&(yo(a,s,N,l),V=a.memoizedState),(Y=ds||px(a,s,Y,l,G,V,A)||e!==null&&e.dependencies!==null&&_i(e.dependencies))?(U||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(l,V,A),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(l,V,A)),typeof o.componentDidUpdate=="function"&&(a.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof o.componentDidUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(a.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(a.flags|=1024),a.memoizedProps=l,a.memoizedState=V),o.props=l,o.state=V,o.context=A,l=Y):(typeof o.componentDidUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(a.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(a.flags|=1024),l=!1)}return o=l,tr(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=Ps(a,e.child,null,r),a.child=Ps(a,null,s,r)):wt(e,a,s,r),a.memoizedState=o.state,e=a.child):e=qa(e,a,r),e}function Mx(e,a,s,l){return Xs(),a.flags|=256,wt(e,a,s,l),a.child}var So={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ko(e){return{baseLanes:e,cachePool:jm()}}function zo(e,a,s){return e=e!==null?e.childLanes&~s:0,a&&(e|=Jt),e}function Dx(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:(st.current&2)!==0),x&&(r=!0,a.flags&=-129),x=(a.flags&32)!==0,a.flags&=-33,e===null){if(Me){if(r?xs(a):fs(),(e=Qe)?(e=Gf(e,la),e=e!==null&&e.data!=="&"?e:null,e!==null&&(a.memoizedState={dehydrated:e,treeContext:is!==null?{id:Na,overflow:wa}:null,retryLane:536870912,hydrationErrors:null},s=mm(e),s.return=a,a.child=s,jt=a,Qe=null)):e=null,e===null)throw cs(a);return cd(e)?a.lanes=32:a.lanes=536870912,null}var N=l.children;return l=l.fallback,r?(fs(),r=a.mode,N=ar({mode:"hidden",children:N},r),l=Ys(l,r,s,null),N.return=a,l.return=a,N.sibling=l,a.child=N,l=a.child,l.memoizedState=ko(s),l.childLanes=zo(e,x,s),a.memoizedState=So,Ol(null,l)):(xs(a),Co(a,N))}var A=e.memoizedState;if(A!==null&&(N=A.dehydrated,N!==null)){if(o)a.flags&256?(xs(a),a.flags&=-257,a=Ao(e,a,s)):a.memoizedState!==null?(fs(),a.child=e.child,a.flags|=128,a=null):(fs(),N=l.fallback,r=a.mode,l=ar({mode:"visible",children:l.children},r),N=Ys(N,r,s,null),N.flags|=2,l.return=a,N.return=a,l.sibling=N,a.child=l,Ps(a,e.child,null,s),l=a.child,l.memoizedState=ko(s),l.childLanes=zo(e,x,s),a.memoizedState=So,a=Ol(null,l));else if(xs(a),cd(N)){if(x=N.nextSibling&&N.nextSibling.dataset,x)var U=x.dgst;x=U,l=Error(c(419)),l.stack="",l.digest=x,Nl({value:l,source:null,stack:null}),a=Ao(e,a,s)}else if(ot||An(e,a,s,!1),x=(s&e.childLanes)!==0,ot||x){if(x=Ve,x!==null&&(l=yu(x,s),l!==0&&l!==A.retryLane))throw A.retryLane=l,Vs(e,l),qt(x,e,l),No;rd(N)||ur(),a=Ao(e,a,s)}else rd(N)?(a.flags|=192,a.child=e.child,a=null):(e=A.treeContext,Qe=ra(N.nextSibling),jt=a,Me=!0,rs=null,la=!1,e!==null&&hm(a,e),a=Co(a,l.children),a.flags|=4096);return a}return r?(fs(),N=l.fallback,r=a.mode,A=e.child,U=A.sibling,l=La(A,{mode:"hidden",children:l.children}),l.subtreeFlags=A.subtreeFlags&65011712,U!==null?N=La(U,N):(N=Ys(N,r,s,null),N.flags|=2),N.return=a,l.return=a,l.sibling=N,a.child=l,Ol(null,l),l=a.child,N=e.child.memoizedState,N===null?N=ko(s):(r=N.cachePool,r!==null?(A=rt._currentValue,r=r.parent!==A?{parent:A,pool:A}:r):r=jm(),N={baseLanes:N.baseLanes|s,cachePool:r}),l.memoizedState=N,l.childLanes=zo(e,x,s),a.memoizedState=So,Ol(e.child,l)):(xs(a),s=e.child,e=s.sibling,s=La(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 Co(e,a){return a=ar({mode:"visible",children:a},e.mode),a.return=e,e.child=a}function ar(e,a){return e=Yt(22,e,null,a),e.lanes=0,e}function Ao(e,a,s){return Ps(a,e.child,null,s),e=Co(a,a.pendingProps.children),e.flags|=2,a.memoizedState=null,e}function Ox(e,a,s){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a),Gc(e.return,a,s)}function Eo(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 Lx(e,a,s){var l=a.pendingProps,r=l.revealOrder,o=l.tail;l=l.children;var x=st.current,N=(x&2)!==0;if(N?(x=x&1|2,a.flags|=128):x&=1,ce(st,x),wt(e,a,l,s),l=Me?jl:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=a.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ox(e,s,a);else if(e.tag===19)Ox(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&&Vi(e)===null&&(r=s),s=s.sibling;s=r,s===null?(r=a.child,a.child=null):(r=s.sibling,s.sibling=null),Eo(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&&Vi(e)===null){a.child=r;break}e=r.sibling,r.sibling=s,s=r,r=e}Eo(a,!0,s,null,o,l);break;case"together":Eo(a,!1,null,null,void 0,l);break;default:a.memoizedState=null}return a.child}function qa(e,a,s){if(e!==null&&(a.dependencies=e.dependencies),gs|=a.lanes,(s&a.childLanes)===0)if(e!==null){if(An(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=La(e,e.pendingProps),a.child=s,s.return=a;e.sibling!==null;)e=e.sibling,s=s.sibling=La(e,e.pendingProps),s.return=a;s.sibling=null}return a.child}function To(e,a){return(e.lanes&a)!==0?!0:(e=e.dependencies,!!(e!==null&&_i(e)))}function rg(e,a,s){switch(a.tag){case 3:Ce(a,a.stateNode.containerInfo),os(a,rt,e.memoizedState.cache),Xs();break;case 27:case 5:Pe(a);break;case 4:Ce(a,a.stateNode.containerInfo);break;case 10:os(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,eo(a),null;break;case 13:var l=a.memoizedState;if(l!==null)return l.dehydrated!==null?(xs(a),a.flags|=128,null):(s&a.child.childLanes)!==0?Dx(e,a,s):(xs(a),e=qa(e,a,s),e!==null?e.sibling:null);xs(a);break;case 19:var r=(e.flags&128)!==0;if(l=(s&a.childLanes)!==0,l||(An(e,a,s,!1),l=(s&a.childLanes)!==0),r){if(l)return Lx(e,a,s);a.flags|=128}if(r=a.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),ce(st,st.current),l)break;return null;case 22:return a.lanes=0,Cx(e,a,s,a.pendingProps);case 24:os(a,rt,e.memoizedState.cache)}return qa(e,a,s)}function _x(e,a,s){if(e!==null)if(e.memoizedProps!==a.pendingProps)ot=!0;else{if(!To(e,s)&&(a.flags&128)===0)return ot=!1,rg(e,a,s);ot=(e.flags&131072)!==0}else ot=!1,Me&&(a.flags&1048576)!==0&&fm(a,jl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var l=a.pendingProps;if(e=Fs(a.elementType),a.type=e,typeof e=="function")Oc(e)?(l=en(e,l),a.tag=1,a=Rx(null,a,e,l,s)):(a.tag=0,a=wo(null,a,e,l,s));else{if(e!=null){var r=e.$$typeof;if(r===E){a.tag=11,a=Sx(null,a,e,l,s);break e}else if(r===H){a.tag=14,a=kx(null,a,e,l,s);break e}}throw a=le(e)||e,Error(c(306,a,""))}}return a;case 0:return wo(e,a,a.type,a.pendingProps,s);case 1:return l=a.type,r=en(l,a.pendingProps),Rx(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,Jc(e,a),El(a,l,null,s);var x=a.memoizedState;if(l=x.cache,os(a,rt,l),l!==o.cache&&Kc(a,[rt],s,!0),Al(),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=Mx(e,a,l,s);break e}else if(l!==r){r=aa(Error(c(424)),a),Nl(r),a=Mx(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(Qe=ra(e.firstChild),jt=a,Me=!0,rs=null,la=!0,s=Cm(a,null,l,s),a.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if(Xs(),l===r){a=qa(e,a,s);break e}wt(e,a,l,s)}a=a.child}return a;case 26:return tr(e,a),e===null?(s=Zf(a.type,null,a.pendingProps,null))?a.memoizedState=s:Me||(s=a.type,e=a.pendingProps,l=br(xe.current).createElement(s),l[vt]=a,l[Lt]=e,St(l,s,e),pt(l),a.stateNode=l):a.memoizedState=Zf(a.type,e.memoizedProps,a.pendingProps,e.memoizedState),null;case 27:return Pe(a),e===null&&Me&&(l=a.stateNode=Yf(a.type,a.pendingProps,xe.current),jt=a,la=!0,r=Qe,Ns(a.type)?(od=r,Qe=ra(l.firstChild)):Qe=r),wt(e,a,a.pendingProps.children,s),tr(e,a),e===null&&(a.flags|=4194304),a.child;case 5:return e===null&&Me&&((r=l=Qe)&&(l=Ug(l,a.type,a.pendingProps,la),l!==null?(a.stateNode=l,jt=a,Qe=ra(l.firstChild),la=!1,r=!0):r=!1),r||cs(a)),Pe(a),r=a.type,o=a.pendingProps,x=e!==null?e.memoizedProps:null,l=o.children,nd(r,o)?l=null:x!==null&&nd(r,x)&&(a.flags|=32),a.memoizedState!==null&&(r=ao(e,a,Pp,null,null,s),Jl._currentValue=r),tr(e,a),wt(e,a,l,s),a.child;case 6:return e===null&&Me&&((e=s=Qe)&&(s=Bg(s,a.pendingProps,la),s!==null?(a.stateNode=s,jt=a,Qe=null,e=!0):e=!1),e||cs(a)),null;case 13:return Dx(e,a,s);case 4:return Ce(a,a.stateNode.containerInfo),l=a.pendingProps,e===null?a.child=Ps(a,null,l,s):wt(e,a,l,s),a.child;case 11:return Sx(e,a,a.type,a.pendingProps,s);case 7:return wt(e,a,a.pendingProps,s),a.child;case 8:return wt(e,a,a.pendingProps.children,s),a.child;case 12:return wt(e,a,a.pendingProps.children,s),a.child;case 10:return l=a.pendingProps,os(a,a.type,l.value),wt(e,a,l.children,s),a.child;case 9:return r=a.type._context,l=a.pendingProps.children,Zs(a),r=Nt(r),l=l(r),a.flags|=1,wt(e,a,l,s),a.child;case 14:return kx(e,a,a.type,a.pendingProps,s);case 15:return zx(e,a,a.type,a.pendingProps,s);case 19:return Lx(e,a,s);case 31:return ig(e,a,s);case 22:return Cx(e,a,s,a.pendingProps);case 24:return Zs(a),l=Nt(rt),e===null?(r=Xc(),r===null&&(r=Ve,o=Vc(),r.pooledCache=o,o.refCount++,o!==null&&(r.pooledCacheLanes|=s),r=o),a.memoizedState={parent:l,cache:r},Zc(a),os(a,rt,r)):((e.lanes&s)!==0&&(Jc(e,a),El(a,null,null,s),Al()),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),os(a,rt,l)):(l=o.cache,os(a,rt,l),l!==r.cache&&Kc(a,[rt],s,!0))),wt(e,a,a.pendingProps.children,s),a.child;case 29:throw a.pendingProps}throw Error(c(156,a.tag))}function Ga(e){e.flags|=4}function Ro(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(df())e.flags|=8192;else throw Is=Hi,Qc}else e.flags&=-16777217}function Ux(e,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(a))if(df())e.flags|=8192;else throw Is=Hi,Qc}function sr(e,a){a!==null&&(e.flags|=4),e.flags&16384&&(a=e.tag!==22?pu():536870912,e.lanes|=a,Hn|=a)}function Ll(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 Ze(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(Bc(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ze(a),null;case 1:return Ze(a),null;case 3:return s=a.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),a.memoizedState.cache!==l&&(a.flags|=2048),Ba(rt),ve(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(Cn(a)?Ga(a):e===null||e.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Hc())),Ze(a),null;case 26:var r=a.type,o=a.memoizedState;return e===null?(Ga(a),o!==null?(Ze(a),Ux(a,o)):(Ze(a),Ro(a,r,null,l,s))):o?o!==e.memoizedState?(Ga(a),Ze(a),Ux(a,o)):(Ze(a),a.flags&=-16777217):(e=e.memoizedProps,e!==l&&Ga(a),Ze(a),Ro(a,r,e,l,s)),null;case 27:if(Xe(a),s=xe.current,r=a.type,e!==null&&a.stateNode!=null)e.memoizedProps!==l&&Ga(a);else{if(!l){if(a.stateNode===null)throw Error(c(166));return Ze(a),null}e=B.current,Cn(a)?pm(a):(e=Yf(r,l,s),a.stateNode=e,Ga(a))}return Ze(a),null;case 5:if(Xe(a),r=a.type,e!==null&&a.stateNode!=null)e.memoizedProps!==l&&Ga(a);else{if(!l){if(a.stateNode===null)throw Error(c(166));return Ze(a),null}if(o=B.current,Cn(a))pm(a);else{var x=br(xe.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[vt]=a,o[Lt]=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(St(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&&Ga(a)}}return Ze(a),Ro(a,a.type,e===null?null:e.memoizedProps,a.pendingProps,s),null;case 6:if(e&&a.stateNode!=null)e.memoizedProps!==l&&Ga(a);else{if(typeof l!="string"&&a.stateNode===null)throw Error(c(166));if(e=xe.current,Cn(a)){if(e=a.stateNode,s=a.memoizedProps,l=null,r=jt,r!==null)switch(r.tag){case 27:case 5:l=r.memoizedProps}e[vt]=a,e=!!(e.nodeValue===s||l!==null&&l.suppressHydrationWarning===!0||Of(e.nodeValue,s)),e||cs(a,!0)}else e=br(e).createTextNode(l),e[vt]=a,a.stateNode=e}return Ze(a),null;case 31:if(s=a.memoizedState,e===null||e.memoizedState!==null){if(l=Cn(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[vt]=a}else Xs(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ze(a),e=!1}else s=Hc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return a.flags&256?(Qt(a),a):(Qt(a),null);if((a.flags&128)!==0)throw Error(c(558))}return Ze(a),null;case 13:if(l=a.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Cn(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[vt]=a}else Xs(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ze(a),r=!1}else r=Hc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return a.flags&256?(Qt(a),a):(Qt(a),null)}return Qt(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),sr(a,a.updateQueue),Ze(a),null);case 4:return ve(),e===null&&Wo(a.stateNode.containerInfo),Ze(a),null;case 10:return Ba(a.type),Ze(a),null;case 19:if(Q(st),l=a.memoizedState,l===null)return Ze(a),null;if(r=(a.flags&128)!==0,o=l.rendering,o===null)if(r)Ll(l,!1);else{if(et!==0||e!==null&&(e.flags&128)!==0)for(e=a.child;e!==null;){if(o=Vi(e),o!==null){for(a.flags|=128,Ll(l,!1),e=o.updateQueue,a.updateQueue=e,sr(a,e),a.subtreeFlags=0,e=s,s=a.child;s!==null;)um(s,e),s=s.sibling;return ce(st,st.current&1|2),Me&&_a(a,l.treeForkCount),a.child}e=e.sibling}l.tail!==null&&ht()>cr&&(a.flags|=128,r=!0,Ll(l,!1),a.lanes=4194304)}else{if(!r)if(e=Vi(o),e!==null){if(a.flags|=128,r=!0,e=e.updateQueue,a.updateQueue=e,sr(a,e),Ll(l,!0),l.tail===null&&l.tailMode==="hidden"&&!o.alternate&&!Me)return Ze(a),null}else 2*ht()-l.renderingStartTime>cr&&s!==536870912&&(a.flags|=128,r=!0,Ll(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=ht(),e.sibling=null,s=st.current,ce(st,r?s&1|2:s&1),Me&&_a(a,l.treeForkCount),e):(Ze(a),null);case 22:case 23:return Qt(a),Wc(),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&&(Ze(a),a.subtreeFlags&6&&(a.flags|=8192)):Ze(a),s=a.updateQueue,s!==null&&sr(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&&Q(Js),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),a.memoizedState.cache!==s&&(a.flags|=2048),Ba(rt),Ze(a),null;case 25:return null;case 30:return null}throw Error(c(156,a.tag))}function og(e,a){switch(Bc(a),a.tag){case 1:return e=a.flags,e&65536?(a.flags=e&-65537|128,a):null;case 3:return Ba(rt),ve(),e=a.flags,(e&65536)!==0&&(e&128)===0?(a.flags=e&-65537|128,a):null;case 26:case 27:case 5:return Xe(a),null;case 31:if(a.memoizedState!==null){if(Qt(a),a.alternate===null)throw Error(c(340));Xs()}return e=a.flags,e&65536?(a.flags=e&-65537|128,a):null;case 13:if(Qt(a),e=a.memoizedState,e!==null&&e.dehydrated!==null){if(a.alternate===null)throw Error(c(340));Xs()}return e=a.flags,e&65536?(a.flags=e&-65537|128,a):null;case 19:return Q(st),null;case 4:return ve(),null;case 10:return Ba(a.type),null;case 22:case 23:return Qt(a),Wc(),e!==null&&Q(Js),e=a.flags,e&65536?(a.flags=e&-65537|128,a):null;case 24:return Ba(rt),null;case 25:return null;default:return null}}function Bx(e,a){switch(Bc(a),a.tag){case 3:Ba(rt),ve();break;case 26:case 27:case 5:Xe(a);break;case 4:ve();break;case 31:a.memoizedState!==null&&Qt(a);break;case 13:Qt(a);break;case 19:Q(st);break;case 10:Ba(a.type);break;case 22:case 23:Qt(a),Wc(),e!==null&&Q(Js);break;case 24:Ba(rt)}}function _l(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(N){$e(a,a.return,N)}}function hs(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,N=x.destroy;if(N!==void 0){x.destroy=void 0,r=a;var A=s,U=N;try{U()}catch(Y){$e(r,A,Y)}}}l=l.next}while(l!==o)}}catch(Y){$e(a,a.return,Y)}}function $x(e){var a=e.updateQueue;if(a!==null){var s=e.stateNode;try{Em(a,s)}catch(l){$e(e,e.return,l)}}}function Hx(e,a,s){s.props=en(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(l){$e(e,a,l)}}function Ul(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){$e(e,a,r)}}function Sa(e,a){var s=e.ref,l=e.refCleanup;if(s!==null)if(typeof l=="function")try{l()}catch(r){$e(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){$e(e,a,r)}else s.current=null}function qx(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){$e(e,e.return,r)}}function Mo(e,a,s){try{var l=e.stateNode;Rg(l,e.type,s,a),l[Lt]=a}catch(r){$e(e,e.return,r)}}function Gx(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ns(e.type)||e.tag===4}function Do(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Gx(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&&Ns(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 Oo(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=Da));else if(l!==4&&(l===27&&Ns(e.type)&&(s=e.stateNode,a=null),e=e.child,e!==null))for(Oo(e,a,s),e=e.sibling;e!==null;)Oo(e,a,s),e=e.sibling}function nr(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&&Ns(e.type)&&(s=e.stateNode),e=e.child,e!==null))for(nr(e,a,s),e=e.sibling;e!==null;)nr(e,a,s),e=e.sibling}function Kx(e){var a=e.stateNode,s=e.memoizedProps;try{for(var l=e.type,r=a.attributes;r.length;)a.removeAttributeNode(r[0]);St(a,l,s),a[vt]=e,a[Lt]=s}catch(o){$e(e,e.return,o)}}var Ka=!1,dt=!1,Lo=!1,Vx=typeof WeakSet=="function"?WeakSet:Set,gt=null;function dg(e,a){if(e=e.containerInfo,ad=kr,e=am(e),Cc(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,N=-1,A=-1,U=0,Y=0,F=e,G=null;t:for(;;){for(var V;F!==s||r!==0&&F.nodeType!==3||(N=x+r),F!==o||l!==0&&F.nodeType!==3||(A=x+l),F.nodeType===3&&(x+=F.nodeValue.length),(V=F.firstChild)!==null;)G=F,F=V;for(;;){if(F===e)break t;if(G===s&&++U===r&&(N=x),G===o&&++Y===l&&(A=x),(V=F.nextSibling)!==null)break;F=G,G=F.parentNode}F=V}s=N===-1||A===-1?null:{start:N,end:A}}else s=null}s=s||{start:0,end:0}}else s=null;for(sd={focusedElem:e,selectionRange:s},kr=!1,gt=a;gt!==null;)if(a=gt,e=a.child,(a.subtreeFlags&1028)!==0&&e!==null)e.return=a,gt=e;else for(;gt!==null;){switch(a=gt,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=en(s.type,r);e=l.getSnapshotBeforeUpdate(ue,o),l.__reactInternalSnapshotBeforeUpdate=e}catch(ge){$e(s,s.return,ge)}}break;case 3:if((e&1024)!==0){if(e=a.stateNode.containerInfo,s=e.nodeType,s===9)id(e);else if(s===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":id(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,gt=e;break}gt=a.return}}function Yx(e,a,s){var l=s.flags;switch(s.tag){case 0:case 11:case 15:Ya(e,s),l&4&&_l(5,s);break;case 1:if(Ya(e,s),l&4)if(e=s.stateNode,a===null)try{e.componentDidMount()}catch(x){$e(s,s.return,x)}else{var r=en(s.type,a.memoizedProps);a=a.memoizedState;try{e.componentDidUpdate(r,a,e.__reactInternalSnapshotBeforeUpdate)}catch(x){$e(s,s.return,x)}}l&64&&$x(s),l&512&&Ul(s,s.return);break;case 3:if(Ya(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{Em(e,a)}catch(x){$e(s,s.return,x)}}break;case 27:a===null&&l&4&&Kx(s);case 26:case 5:Ya(e,s),a===null&&l&4&&qx(s),l&512&&Ul(s,s.return);break;case 12:Ya(e,s);break;case 31:Ya(e,s),l&4&&Zx(e,s);break;case 13:Ya(e,s),l&4&&Jx(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||Ka,!l){a=a!==null&&a.memoizedState!==null||dt,r=Ka;var o=dt;Ka=l,(dt=a)&&!o?Xa(e,s,(s.subtreeFlags&8772)!==0):Ya(e,s),Ka=r,dt=o}break;case 30:break;default:Ya(e,s)}}function Xx(e){var a=e.alternate;a!==null&&(e.alternate=null,Xx(a)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(a=e.stateNode,a!==null&&dc(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 Je=null,Ut=!1;function Va(e,a,s){for(s=s.child;s!==null;)Qx(e,a,s),s=s.sibling}function Qx(e,a,s){if(De&&typeof De.onCommitFiberUnmount=="function")try{De.onCommitFiberUnmount(we,s)}catch{}switch(s.tag){case 26:dt||Sa(s,a),Va(e,a,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:dt||Sa(s,a);var l=Je,r=Ut;Ns(s.type)&&(Je=s.stateNode,Ut=!1),Va(e,a,s),Xl(s.stateNode),Je=l,Ut=r;break;case 5:dt||Sa(s,a);case 6:if(l=Je,r=Ut,Je=null,Va(e,a,s),Je=l,Ut=r,Je!==null)if(Ut)try{(Je.nodeType===9?Je.body:Je.nodeName==="HTML"?Je.ownerDocument.body:Je).removeChild(s.stateNode)}catch(o){$e(s,a,o)}else try{Je.removeChild(s.stateNode)}catch(o){$e(s,a,o)}break;case 18:Je!==null&&(Ut?(e=Je,Hf(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),Zn(e)):Hf(Je,s.stateNode));break;case 4:l=Je,r=Ut,Je=s.stateNode.containerInfo,Ut=!0,Va(e,a,s),Je=l,Ut=r;break;case 0:case 11:case 14:case 15:hs(2,s,a),dt||hs(4,s,a),Va(e,a,s);break;case 1:dt||(Sa(s,a),l=s.stateNode,typeof l.componentWillUnmount=="function"&&Hx(s,a,l)),Va(e,a,s);break;case 21:Va(e,a,s);break;case 22:dt=(l=dt)||s.memoizedState!==null,Va(e,a,s),dt=l;break;default:Va(e,a,s)}}function Zx(e,a){if(a.memoizedState===null&&(e=a.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Zn(e)}catch(s){$e(a,a.return,s)}}}function Jx(e,a){if(a.memoizedState===null&&(e=a.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Zn(e)}catch(s){$e(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 Vx),a;case 22:return e=e.stateNode,a=e._retryCache,a===null&&(a=e._retryCache=new Vx),a;default:throw Error(c(435,e.tag))}}function lr(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 Bt(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,N=x;e:for(;N!==null;){switch(N.tag){case 27:if(Ns(N.type)){Je=N.stateNode,Ut=!1;break e}break;case 5:Je=N.stateNode,Ut=!1;break e;case 3:case 4:Je=N.stateNode.containerInfo,Ut=!0;break e}N=N.return}if(Je===null)throw Error(c(160));Qx(o,x,r),Je=null,Ut=!1,o=r.alternate,o!==null&&(o.return=null),r.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Fx(a,e),a=a.sibling}var pa=null;function Fx(e,a){var s=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Bt(a,e),$t(e),l&4&&(hs(3,e,e.return),_l(3,e),hs(5,e,e.return));break;case 1:Bt(a,e),$t(e),l&512&&(dt||s===null||Sa(s,s.return)),l&64&&Ka&&(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=pa;if(Bt(a,e),$t(e),l&512&&(dt||s===null||Sa(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[dl]||o[vt]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=r.createElement(l),r.head.insertBefore(o,r.querySelector("head > title"))),St(o,l,s),o[vt]=e,pt(o),l=o;break e;case"link":var x=If("link","href",r).get(l+(s.href||""));if(x){for(var N=0;N<x.length;N++)if(o=x[N],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(N,1);break t}}o=r.createElement(l),St(o,l,s),r.head.appendChild(o);break;case"meta":if(x=If("meta","content",r).get(l+(s.content||""))){for(N=0;N<x.length;N++)if(o=x[N],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(N,1);break t}}o=r.createElement(l),St(o,l,s),r.head.appendChild(o);break;default:throw Error(c(468,l))}o[vt]=e,pt(o),l=o}e.stateNode=l}else Pf(r,e.type,e.stateNode);else e.stateNode=Ff(r,l,e.memoizedProps);else o!==l?(o===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):o.count--,l===null?Pf(r,e.type,e.stateNode):Ff(r,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Mo(e,e.memoizedProps,s.memoizedProps)}break;case 27:Bt(a,e),$t(e),l&512&&(dt||s===null||Sa(s,s.return)),s!==null&&l&4&&Mo(e,e.memoizedProps,s.memoizedProps);break;case 5:if(Bt(a,e),$t(e),l&512&&(dt||s===null||Sa(s,s.return)),e.flags&32){r=e.stateNode;try{gn(r,"")}catch(ue){$e(e,e.return,ue)}}l&4&&e.stateNode!=null&&(r=e.memoizedProps,Mo(e,r,s!==null?s.memoizedProps:r)),l&1024&&(Lo=!0);break;case 6:if(Bt(a,e),$t(e),l&4){if(e.stateNode===null)throw Error(c(162));l=e.memoizedProps,s=e.stateNode;try{s.nodeValue=l}catch(ue){$e(e,e.return,ue)}}break;case 3:if(jr=null,r=pa,pa=yr(a.containerInfo),Bt(a,e),pa=r,$t(e),l&4&&s!==null&&s.memoizedState.isDehydrated)try{Zn(a.containerInfo)}catch(ue){$e(e,e.return,ue)}Lo&&(Lo=!1,Ix(e));break;case 4:l=pa,pa=yr(e.stateNode.containerInfo),Bt(a,e),$t(e),pa=l;break;case 12:Bt(a,e),$t(e);break;case 31:Bt(a,e),$t(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,lr(e,l)));break;case 13:Bt(a,e),$t(e),e.child.flags&8192&&e.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(rr=ht()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,lr(e,l)));break;case 22:r=e.memoizedState!==null;var A=s!==null&&s.memoizedState!==null,U=Ka,Y=dt;if(Ka=U||r,dt=Y||A,Bt(a,e),dt=Y,Ka=U,$t(e),l&8192)e:for(a=e.stateNode,a._visibility=r?a._visibility&-2:a._visibility|1,r&&(s===null||A||Ka||dt||tn(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{N=A.stateNode;var F=A.memoizedProps.style,G=F!=null&&F.hasOwnProperty("display")?F.display:null;N.style.display=G==null||typeof G=="boolean"?"":(""+G).trim()}}catch(ue){$e(A,A.return,ue)}}}else if(a.tag===6){if(s===null){A=a;try{A.stateNode.nodeValue=r?"":A.memoizedProps}catch(ue){$e(A,A.return,ue)}}}else if(a.tag===18){if(s===null){A=a;try{var V=A.stateNode;r?qf(V,!0):qf(A.stateNode,!1)}catch(ue){$e(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,lr(e,s))));break;case 19:Bt(a,e),$t(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,lr(e,l)));break;case 30:break;case 21:break;default:Bt(a,e),$t(e)}}function $t(e){var a=e.flags;if(a&2){try{for(var s,l=e.return;l!==null;){if(Gx(l)){s=l;break}l=l.return}if(s==null)throw Error(c(160));switch(s.tag){case 27:var r=s.stateNode,o=Do(e);nr(e,o,r);break;case 5:var x=s.stateNode;s.flags&32&&(gn(x,""),s.flags&=-33);var N=Do(e);nr(e,N,x);break;case 3:case 4:var A=s.stateNode.containerInfo,U=Do(e);Oo(e,U,A);break;default:throw Error(c(161))}}catch(Y){$e(e,e.return,Y)}e.flags&=-3}a&4096&&(e.flags&=-4097)}function Ix(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var a=e;Ix(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),e=e.sibling}}function Ya(e,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Yx(e,a.alternate,a),a=a.sibling}function tn(e){for(e=e.child;e!==null;){var a=e;switch(a.tag){case 0:case 11:case 14:case 15:hs(4,a,a.return),tn(a);break;case 1:Sa(a,a.return);var s=a.stateNode;typeof s.componentWillUnmount=="function"&&Hx(a,a.return,s),tn(a);break;case 27:Xl(a.stateNode);case 26:case 5:Sa(a,a.return),tn(a);break;case 22:a.memoizedState===null&&tn(a);break;case 30:tn(a);break;default:tn(a)}e=e.sibling}}function Xa(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:Xa(r,o,s),_l(4,o);break;case 1:if(Xa(r,o,s),l=o,r=l.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(U){$e(l,l.return,U)}if(l=o,r=l.updateQueue,r!==null){var N=l.stateNode;try{var A=r.shared.hiddenCallbacks;if(A!==null)for(r.shared.hiddenCallbacks=null,r=0;r<A.length;r++)Am(A[r],N)}catch(U){$e(l,l.return,U)}}s&&x&64&&$x(o),Ul(o,o.return);break;case 27:Kx(o);case 26:case 5:Xa(r,o,s),s&&l===null&&x&4&&qx(o),Ul(o,o.return);break;case 12:Xa(r,o,s);break;case 31:Xa(r,o,s),s&&x&4&&Zx(r,o);break;case 13:Xa(r,o,s),s&&x&4&&Jx(r,o);break;case 22:o.memoizedState===null&&Xa(r,o,s),Ul(o,o.return);break;case 30:break;default:Xa(r,o,s)}a=a.sibling}}function _o(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&&wl(s))}function Uo(e,a){e=null,a.alternate!==null&&(e=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==e&&(a.refCount++,e!=null&&wl(e))}function ga(e,a,s,l){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Px(e,a,s,l),a=a.sibling}function Px(e,a,s,l){var r=a.flags;switch(a.tag){case 0:case 11:case 15:ga(e,a,s,l),r&2048&&_l(9,a);break;case 1:ga(e,a,s,l);break;case 3:ga(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&&wl(e)));break;case 12:if(r&2048){ga(e,a,s,l),e=a.stateNode;try{var o=a.memoizedProps,x=o.id,N=o.onPostCommit;typeof N=="function"&&N(x,a.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(A){$e(a,a.return,A)}}else ga(e,a,s,l);break;case 31:ga(e,a,s,l);break;case 13:ga(e,a,s,l);break;case 23:break;case 22:o=a.stateNode,x=a.alternate,a.memoizedState!==null?o._visibility&2?ga(e,a,s,l):Bl(e,a):o._visibility&2?ga(e,a,s,l):(o._visibility|=2,Un(e,a,s,l,(a.subtreeFlags&10256)!==0||!1)),r&2048&&_o(x,a);break;case 24:ga(e,a,s,l),r&2048&&Uo(a.alternate,a);break;default:ga(e,a,s,l)}}function Un(e,a,s,l,r){for(r=r&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var o=e,x=a,N=s,A=l,U=x.flags;switch(x.tag){case 0:case 11:case 15:Un(o,x,N,A,r),_l(8,x);break;case 23:break;case 22:var Y=x.stateNode;x.memoizedState!==null?Y._visibility&2?Un(o,x,N,A,r):Bl(o,x):(Y._visibility|=2,Un(o,x,N,A,r)),r&&U&2048&&_o(x.alternate,x);break;case 24:Un(o,x,N,A,r),r&&U&2048&&Uo(x.alternate,x);break;default:Un(o,x,N,A,r)}a=a.sibling}}function Bl(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:Bl(s,l),r&2048&&_o(l.alternate,l);break;case 24:Bl(s,l),r&2048&&Uo(l.alternate,l);break;default:Bl(s,l)}a=a.sibling}}var $l=8192;function Bn(e,a,s){if(e.subtreeFlags&$l)for(e=e.child;e!==null;)Wx(e,a,s),e=e.sibling}function Wx(e,a,s){switch(e.tag){case 26:Bn(e,a,s),e.flags&$l&&e.memoizedState!==null&&Ig(s,pa,e.memoizedState,e.memoizedProps);break;case 5:Bn(e,a,s);break;case 3:case 4:var l=pa;pa=yr(e.stateNode.containerInfo),Bn(e,a,s),pa=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=$l,$l=16777216,Bn(e,a,s),$l=l):Bn(e,a,s));break;default:Bn(e,a,s)}}function ef(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 Hl(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];gt=l,af(l,e)}ef(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)tf(e),e=e.sibling}function tf(e){switch(e.tag){case 0:case 11:case 15:Hl(e),e.flags&2048&&hs(9,e,e.return);break;case 3:Hl(e);break;case 12:Hl(e);break;case 22:var a=e.stateNode;e.memoizedState!==null&&a._visibility&2&&(e.return===null||e.return.tag!==13)?(a._visibility&=-3,ir(e)):Hl(e);break;default:Hl(e)}}function ir(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];gt=l,af(l,e)}ef(e)}for(e=e.child;e!==null;){switch(a=e,a.tag){case 0:case 11:case 15:hs(8,a,a.return),ir(a);break;case 22:s=a.stateNode,s._visibility&2&&(s._visibility&=-3,ir(a));break;default:ir(a)}e=e.sibling}}function af(e,a){for(;gt!==null;){var s=gt;switch(s.tag){case 0:case 11:case 15:hs(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:wl(s.memoizedState.cache)}if(l=s.child,l!==null)l.return=s,gt=l;else e:for(s=e;gt!==null;){l=gt;var r=l.sibling,o=l.return;if(Xx(l),l===s){gt=null;break e}if(r!==null){r.return=o,gt=r;break e}gt=o}}}var mg={getCacheForType:function(e){var a=Nt(rt),s=a.data.get(e);return s===void 0&&(s=e(),a.data.set(e,s)),s},cacheSignal:function(){return Nt(rt).controller.signal}},xg=typeof WeakMap=="function"?WeakMap:Map,Ue=0,Ve=null,Ae=null,Te=0,Be=0,Zt=null,ps=!1,$n=!1,Bo=!1,Qa=0,et=0,gs=0,an=0,$o=0,Jt=0,Hn=0,ql=null,Ht=null,Ho=!1,rr=0,sf=0,cr=1/0,or=null,bs=null,ut=0,ys=null,qn=null,Za=0,qo=0,Go=null,nf=null,Gl=0,Ko=null;function Ft(){return(Ue&2)!==0&&Te!==0?Te&-Te:K.T!==null?Jo():vu()}function lf(){if(Jt===0)if((Te&536870912)===0||Me){var e=Ra;Ra<<=1,(Ra&3932160)===0&&(Ra=262144),Jt=e}else Jt=536870912;return e=Xt.current,e!==null&&(e.flags|=32),Jt}function qt(e,a,s){(e===Ve&&(Be===2||Be===9)||e.cancelPendingCommit!==null)&&(Gn(e,0),vs(e,Te,Jt,!1)),ol(e,s),((Ue&2)===0||e!==Ve)&&(e===Ve&&((Ue&2)===0&&(an|=s),et===4&&vs(e,Te,Jt,!1)),ka(e))}function rf(e,a,s){if((Ue&6)!==0)throw Error(c(327));var l=!s&&(a&127)===0&&(a&e.expiredLanes)===0||cl(e,a),r=l?pg(e,a):Yo(e,a,!0),o=l;do{if(r===0){$n&&!l&&vs(e,a,0,!1);break}else{if(s=e.current.alternate,o&&!fg(s)){r=Yo(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 N=e;r=ql;var A=N.current.memoizedState.isDehydrated;if(A&&(Gn(N,x).flags|=256),x=Yo(N,x,!1),x!==2){if(Bo&&!A){N.errorRecoveryDisabledLanes|=o,an|=o,r=4;break e}o=Ht,Ht=r,o!==null&&(Ht===null?Ht=o:Ht.push.apply(Ht,o))}r=x}if(o=!1,r!==2)continue}}if(r===1){Gn(e,0),vs(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:vs(l,a,Jt,!ps);break e;case 2:Ht=null;break;case 3:case 5:break;default:throw Error(c(329))}if((a&62914560)===a&&(r=rr+300-ht(),10<r)){if(vs(l,a,Jt,!ps),dn(l,0,!0)!==0)break e;Za=a,l.timeoutHandle=Bf(cf.bind(null,l,s,Ht,or,Ho,a,Jt,an,Hn,ps,o,"Throttled",-0,0),r);break e}cf(l,s,Ht,or,Ho,a,Jt,an,Hn,ps,o,null,-0,0)}}break}while(!0);ka(e)}function cf(e,a,s,l,r,o,x,N,A,U,Y,F,G,V){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:Da},Wx(a,o,F);var ue=(o&62914560)===o?rr-ht():(o&4194048)===o?sf-ht():0;if(ue=Pg(F,ue),ue!==null){Za=o,e.cancelPendingCommit=ue(pf.bind(null,e,a,o,s,l,r,x,N,A,Y,F,null,G,V)),vs(e,o,x,!U);return}}pf(e,a,o,s,l,r,x,N,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(!Vt(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 vs(e,a,s,l){a&=~$o,a&=~an,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&&gu(e,s,a)}function dr(){return(Ue&6)===0?(Kl(0),!1):!0}function Vo(){if(Ae!==null){if(Be===0)var e=Ae.return;else e=Ae,Ua=Qs=null,lo(e),Mn=null,kl=0,e=Ae;for(;e!==null;)Bx(e.alternate,e),e=e.return;Ae=null}}function Gn(e,a){var s=e.timeoutHandle;s!==-1&&(e.timeoutHandle=-1,Og(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),Za=0,Vo(),Ve=e,Ae=s=La(e.current,null),Te=a,Be=0,Zt=null,ps=!1,$n=cl(e,a),Bo=!1,Hn=Jt=$o=an=gs=et=0,Ht=ql=null,Ho=!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 Qa=a,Ri(),s}function of(e,a){Se=null,K.H=Dl,a===Rn||a===$i?(a=Sm(),Be=3):a===Qc?(a=Sm(),Be=4):Be=a===No?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Zt=a,Ae===null&&(et=1,Wi(e,aa(a,e.current)))}function df(){var e=Xt.current;return e===null?!0:(Te&4194048)===Te?ia===null:(Te&62914560)===Te||(Te&536870912)!==0?e===ia:!1}function uf(){var e=K.H;return K.H=Dl,e===null?Dl:e}function mf(){var e=K.A;return K.A=mg,e}function ur(){et=4,ps||(Te&4194048)!==Te&&Xt.current!==null||($n=!0),(gs&134217727)===0&&(an&134217727)===0||Ve===null||vs(Ve,Te,Jt,!1)}function Yo(e,a,s){var l=Ue;Ue|=2;var r=uf(),o=mf();(Ve!==e||Te!==a)&&(or=null,Gn(e,a)),a=!1;var x=et;e:do try{if(Be!==0&&Ae!==null){var N=Ae,A=Zt;switch(Be){case 8:Vo(),x=6;break e;case 3:case 2:case 9:case 6:Xt.current===null&&(a=!0);var U=Be;if(Be=0,Zt=null,Kn(e,N,A,U),s&&$n){x=0;break e}break;default:U=Be,Be=0,Zt=null,Kn(e,N,A,U)}}hg(),x=et;break}catch(Y){of(e,Y)}while(!0);return a&&e.shellSuspendCounter++,Ua=Qs=null,Ue=l,K.H=r,K.A=o,Ae===null&&(Ve=null,Te=0,Ri()),x}function hg(){for(;Ae!==null;)xf(Ae)}function pg(e,a){var s=Ue;Ue|=2;var l=uf(),r=mf();Ve!==e||Te!==a?(or=null,cr=ht()+500,Gn(e,a)):$n=cl(e,a);e:do try{if(Be!==0&&Ae!==null){a=Ae;var o=Zt;t:switch(Be){case 1:Be=0,Zt=null,Kn(e,a,o,1);break;case 2:case 9:if(Nm(o)){Be=0,Zt=null,ff(a);break}a=function(){Be!==2&&Be!==9||Ve!==e||(Be=7),ka(e)},o.then(a,a);break e;case 3:Be=7;break e;case 4:Be=5;break e;case 7:Nm(o)?(Be=0,Zt=null,ff(a)):(Be=0,Zt=null,Kn(e,a,o,7));break;case 5:var x=null;switch(Ae.tag){case 26:x=Ae.memoizedState;case 5:case 27:var N=Ae;if(x?Wf(x):N.stateNode.complete){Be=0,Zt=null;var A=N.sibling;if(A!==null)Ae=A;else{var U=N.return;U!==null?(Ae=U,mr(U)):Ae=null}break t}}Be=0,Zt=null,Kn(e,a,o,5);break;case 6:Be=0,Zt=null,Kn(e,a,o,6);break;case 8:Vo(),et=6;break e;default:throw Error(c(462))}}gg();break}catch(Y){of(e,Y)}while(!0);return Ua=Qs=null,K.H=l,K.A=r,Ue=s,Ae!==null?0:(Ve=null,Te=0,Ri(),et)}function gg(){for(;Ae!==null&&!xa();)xf(Ae)}function xf(e){var a=_x(e.alternate,e,Qa);e.memoizedProps=e.pendingProps,a===null?mr(e):Ae=a}function ff(e){var a=e,s=a.alternate;switch(a.tag){case 15:case 0:a=Tx(s,a,a.pendingProps,a.type,void 0,Te);break;case 11:a=Tx(s,a,a.pendingProps,a.type.render,a.ref,Te);break;case 5:lo(a);default:Bx(s,a),a=Ae=um(a,Qa),a=_x(s,a,Qa)}e.memoizedProps=e.pendingProps,a===null?mr(e):Ae=a}function Kn(e,a,s,l){Ua=Qs=null,lo(a),Mn=null,kl=0;var r=a.return;try{if(lg(e,r,a,s,Te)){et=1,Wi(e,aa(s,e.current)),Ae=null;return}}catch(o){if(r!==null)throw Ae=r,o;et=1,Wi(e,aa(s,e.current)),Ae=null;return}a.flags&32768?(Me||l===1?e=!0:$n||(Te&536870912)!==0?e=!1:(ps=e=!0,(l===2||l===9||l===3||l===6)&&(l=Xt.current,l!==null&&l.tag===13&&(l.flags|=16384))),hf(a,e)):mr(a)}function mr(e){var a=e;do{if((a.flags&32768)!==0){hf(a,ps);return}e=a.return;var s=cg(a.alternate,a,Qa);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 hf(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 pf(e,a,s,l,r,o,x,N,A){e.cancelPendingCommit=null;do xr();while(ut!==0);if((Ue&6)!==0)throw Error(c(327));if(a!==null){if(a===e.current)throw Error(c(177));if(o=a.lanes|a.childLanes,o|=Mc,F0(e,s,o,x,N,A),e===Ve&&(Ae=Ve=null,Te=0),qn=a,ys=e,Za=s,qo=o,Go=r,nf=l,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,jg(Ta,function(){return jf(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||l){l=K.T,K.T=null,r=ie.p,ie.p=2,x=Ue,Ue|=4;try{dg(e,a,s)}finally{Ue=x,ie.p=r,K.T=l}}ut=1,gf(),bf(),yf()}}function gf(){if(ut===1){ut=0;var e=ys,a=qn,s=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||s){s=K.T,K.T=null;var l=ie.p;ie.p=2;var r=Ue;Ue|=4;try{Fx(a,e);var o=sd,x=am(e.containerInfo),N=o.focusedElem,A=o.selectionRange;if(x!==N&&N&&N.ownerDocument&&tm(N.ownerDocument.documentElement,N)){if(A!==null&&Cc(N)){var U=A.start,Y=A.end;if(Y===void 0&&(Y=U),"selectionStart"in N)N.selectionStart=U,N.selectionEnd=Math.min(Y,N.value.length);else{var F=N.ownerDocument||document,G=F&&F.defaultView||window;if(G.getSelection){var V=G.getSelection(),ue=N.textContent.length,ge=Math.min(A.start,ue),Ke=A.end===void 0?ge:Math.min(A.end,ue);!V.extend&&ge>Ke&&(x=Ke,Ke=ge,ge=x);var L=em(N,ge),R=em(N,Ke);if(L&&R&&(V.rangeCount!==1||V.anchorNode!==L.node||V.anchorOffset!==L.offset||V.focusNode!==R.node||V.focusOffset!==R.offset)){var _=F.createRange();_.setStart(L.node,L.offset),V.removeAllRanges(),ge>Ke?(V.addRange(_),V.extend(R.node,R.offset)):(_.setEnd(R.node,R.offset),V.addRange(_))}}}}for(F=[],V=N;V=V.parentNode;)V.nodeType===1&&F.push({element:V,left:V.scrollLeft,top:V.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<F.length;N++){var Z=F[N];Z.element.scrollLeft=Z.left,Z.element.scrollTop=Z.top}}kr=!!ad,sd=ad=null}finally{Ue=r,ie.p=l,K.T=s}}e.current=a,ut=2}}function bf(){if(ut===2){ut=0;var e=ys,a=qn,s=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||s){s=K.T,K.T=null;var l=ie.p;ie.p=2;var r=Ue;Ue|=4;try{Yx(e,a.alternate,a)}finally{Ue=r,ie.p=l,K.T=s}}ut=3}}function yf(){if(ut===4||ut===3){ut=0,fa();var e=ys,a=qn,s=Za,l=nf;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?ut=5:(ut=0,qn=ys=null,vf(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(bs=null),cc(s),a=a.stateNode,De&&typeof De.onCommitFiberRoot=="function")try{De.onCommitFiberRoot(we,a,void 0,(a.current.flags&128)===128)}catch{}if(l!==null){a=K.T,r=ie.p,ie.p=2,K.T=null;try{for(var o=e.onRecoverableError,x=0;x<l.length;x++){var N=l[x];o(N.value,{componentStack:N.stack})}}finally{K.T=a,ie.p=r}}(Za&3)!==0&&xr(),ka(e),r=e.pendingLanes,(s&261930)!==0&&(r&42)!==0?e===Ko?Gl++:(Gl=0,Ko=e):Gl=0,Kl(0)}}function vf(e,a){(e.pooledCacheLanes&=a)===0&&(a=e.pooledCache,a!=null&&(e.pooledCache=null,wl(a)))}function xr(){return gf(),bf(),yf(),jf()}function jf(){if(ut!==5)return!1;var e=ys,a=qo;qo=0;var s=cc(Za),l=K.T,r=ie.p;try{ie.p=32>s?32:s,K.T=null,s=Go,Go=null;var o=ys,x=Za;if(ut=0,qn=ys=null,Za=0,(Ue&6)!==0)throw Error(c(331));var N=Ue;if(Ue|=4,tf(o.current),Px(o,o.current,x,s),Ue=N,Kl(0,!1),De&&typeof De.onPostCommitFiberRoot=="function")try{De.onPostCommitFiberRoot(we,o)}catch{}return!0}finally{ie.p=r,K.T=l,vf(e,a)}}function Nf(e,a,s){a=aa(s,a),a=jo(e.stateNode,a,2),e=ms(e,a,2),e!==null&&(ol(e,2),ka(e))}function $e(e,a,s){if(e.tag===3)Nf(e,e,s);else for(;a!==null;){if(a.tag===3){Nf(a,e,s);break}else if(a.tag===1){var l=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(bs===null||!bs.has(l))){e=aa(s,e),s=Nx(2),l=ms(a,s,2),l!==null&&(wx(s,l,a,e),ol(l,2),ka(l));break}}a=a.return}}function Xo(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)||(Bo=!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,Ve===e&&(Te&s)===s&&(et===4||et===3&&(Te&62914560)===Te&&300>ht()-rr?(Ue&2)===0&&Gn(e,0):$o|=s,Hn===Te&&(Hn=0)),ka(e)}function wf(e,a){a===0&&(a=pu()),e=Vs(e,a),e!==null&&(ol(e,a),ka(e))}function yg(e){var a=e.memoizedState,s=0;a!==null&&(s=a.retryLane),wf(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),wf(e,s)}function jg(e,a){return ye(e,a)}var fr=null,Vn=null,Qo=!1,hr=!1,Zo=!1,js=0;function ka(e){e!==Vn&&e.next===null&&(Vn===null?fr=Vn=e:Vn=Vn.next=e),hr=!0,Qo||(Qo=!0,wg())}function Kl(e,a){if(!Zo&&hr){Zo=!0;do for(var s=!1,l=fr;l!==null;){if(e!==0){var r=l.pendingLanes;if(r===0)var o=0;else{var x=l.suspendedLanes,N=l.pingedLanes;o=(1<<31-Tt(42|e)+1)-1,o&=r&~(x&~N),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(s=!0,Cf(l,o))}else o=Te,o=dn(l,l===Ve?o:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(o&3)===0||cl(l,o)||(s=!0,Cf(l,o));l=l.next}while(s);Zo=!1}}function Ng(){Sf()}function Sf(){hr=Qo=!1;var e=0;js!==0&&Dg()&&(e=js);for(var a=ht(),s=null,l=fr;l!==null;){var r=l.next,o=kf(l,a);o===0?(l.next=null,s===null?fr=r:s.next=r,r===null&&(Vn=s)):(s=l,(e!==0||(o&3)!==0)&&(hr=!0)),l=r}ut!==0&&ut!==5||Kl(e),js!==0&&(js=0)}function kf(e,a){for(var s=e.suspendedLanes,l=e.pingedLanes,r=e.expirationTimes,o=e.pendingLanes&-62914561;0<o;){var x=31-Tt(o),N=1<<x,A=r[x];A===-1?((N&s)===0||(N&l)!==0)&&(r[x]=J0(N,a)):A<=a&&(e.expiredLanes|=N),o&=~N}if(a=Ve,s=Te,s=dn(e,e===a?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,s===0||e===a&&(Be===2||Be===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Ie(l),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||cl(e,s)){if(a=s&-s,a===e.callbackPriority)return a;switch(l!==null&&Ie(l),cc(s)){case 2:case 8:s=Bs;break;case 32:s=Ta;break;case 268435456:s=q;break;default:s=Ta}return l=zf.bind(null,e),s=ye(s,l),e.callbackPriority=a,e.callbackNode=s,a}return l!==null&&l!==null&&Ie(l),e.callbackPriority=2,e.callbackNode=null,2}function zf(e,a){if(ut!==0&&ut!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(xr()&&e.callbackNode!==s)return null;var l=Te;return l=dn(e,e===Ve?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(rf(e,l,a),kf(e,ht()),e.callbackNode!=null&&e.callbackNode===s?zf.bind(null,e):null)}function Cf(e,a){if(xr())return null;rf(e,a,!0)}function wg(){Lg(function(){(Ue&6)!==0?ye(Us,Ng):Sf()})}function Jo(){if(js===0){var e=En;e===0&&(e=rl,rl<<=1,(rl&261888)===0&&(rl=256)),js=e}return js}function Af(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:wi(""+e)}function Ef(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=Af((r[Lt]||null).action),x=l.submitter;x&&(a=(a=x[Lt]||null)?Af(a.formAction):x.getAttribute("formAction"),a!==null&&(o=a,x=null));var N=new Ci("action","action",null,l,r);e.push({event:N,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(js!==0){var A=x?Ef(r,x):new FormData(r);ho(s,{pending:!0,data:A,method:r.method,action:o},null,A)}}else typeof o=="function"&&(N.preventDefault(),A=x?Ef(r,x):new FormData(r),ho(s,{pending:!0,data:A,method:r.method,action:o},o,A))},currentTarget:r}]})}}for(var Fo=0;Fo<Rc.length;Fo++){var Io=Rc[Fo],kg=Io.toLowerCase(),zg=Io[0].toUpperCase()+Io.slice(1);ha(kg,"on"+zg)}ha(lm,"onAnimationEnd"),ha(im,"onAnimationIteration"),ha(rm,"onAnimationStart"),ha("dblclick","onDoubleClick"),ha("focusin","onFocus"),ha("focusout","onBlur"),ha(Gp,"onTransitionRun"),ha(Kp,"onTransitionStart"),ha(Vp,"onTransitionCancel"),ha(cm,"onTransitionEnd"),hn("onMouseEnter",["mouseout","mouseover"]),hn("onMouseLeave",["mouseout","mouseover"]),hn("onPointerEnter",["pointerout","pointerover"]),hn("onPointerLeave",["pointerout","pointerover"]),Hs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Hs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Hs("onBeforeInput",["compositionend","keypress","textInput","paste"]),Hs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Hs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Hs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Vl="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(Vl));function Tf(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 N=l[x],A=N.instance,U=N.currentTarget;if(N=N.listener,A!==o&&r.isPropagationStopped())break e;o=N,r.currentTarget=U;try{o(r)}catch(Y){Ti(Y)}r.currentTarget=null,o=A}else for(x=0;x<l.length;x++){if(N=l[x],A=N.instance,U=N.currentTarget,N=N.listener,A!==o&&r.isPropagationStopped())break e;o=N,r.currentTarget=U;try{o(r)}catch(Y){Ti(Y)}r.currentTarget=null,o=A}}}}function Ee(e,a){var s=a[oc];s===void 0&&(s=a[oc]=new Set);var l=e+"__bubble";s.has(l)||(Rf(a,e,2,!1),s.add(l))}function Po(e,a,s){var l=0;a&&(l|=4),Rf(s,e,l,a)}var pr="_reactListening"+Math.random().toString(36).slice(2);function Wo(e){if(!e[pr]){e[pr]=!0,wu.forEach(function(s){s!=="selectionchange"&&(Cg.has(s)||Po(s,!1,e),Po(s,!0,e))});var a=e.nodeType===9?e:e.ownerDocument;a===null||a[pr]||(a[pr]=!0,Po("selectionchange",!1,a))}}function Rf(e,a,s,l){switch(ih(a)){case 2:var r=tb;break;case 8:r=ab;break;default:r=fd}s=r.bind(null,a,s,e),r=void 0,!bc||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 ed(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 N=l.stateNode.containerInfo;if(N===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(;N!==null;){if(x=mn(N),x===null)return;if(A=x.tag,A===5||A===6||A===26||A===27){l=o=x;continue e}N=N.parentNode}}l=l.return}Lu(function(){var U=o,Y=pc(s),F=[];e:{var G=om.get(e);if(G!==void 0){var V=Ci,ue=e;switch(e){case"keypress":if(ki(s)===0)break e;case"keydown":case"keyup":V=vp;break;case"focusin":ue="focus",V=Nc;break;case"focusout":ue="blur",V=Nc;break;case"beforeblur":case"afterblur":V=Nc;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":V=Bu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":V=cp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":V=wp;break;case lm:case im:case rm:V=up;break;case cm:V=kp;break;case"scroll":case"scrollend":V=ip;break;case"wheel":V=Cp;break;case"copy":case"cut":case"paste":V=xp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":V=Hu;break;case"toggle":case"beforetoggle":V=Ep}var ge=(a&4)!==0,Ke=!ge&&(e==="scroll"||e==="scrollend"),L=ge?G!==null?G+"Capture":null:G;ge=[];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=ml(R,L),Z!=null&&ge.push(Yl(R,Z,_))),Ke)break;R=R.return}0<ge.length&&(G=new V(G,ue,null,s,Y),F.push({event:G,listeners:ge}))}}if((a&7)===0){e:{if(G=e==="mouseover"||e==="pointerover",V=e==="mouseout"||e==="pointerout",G&&s!==hc&&(ue=s.relatedTarget||s.fromElement)&&(mn(ue)||ue[un]))break e;if((V||G)&&(G=Y.window===Y?Y:(G=Y.ownerDocument)?G.defaultView||G.parentWindow:window,V?(ue=s.relatedTarget||s.toElement,V=U,ue=ue?mn(ue):null,ue!==null&&(Ke=f(ue),ge=ue.tag,ue!==Ke||ge!==5&&ge!==27&&ge!==6)&&(ue=null)):(V=null,ue=U),V!==ue)){if(ge=Bu,Z="onMouseLeave",L="onMouseEnter",R="mouse",(e==="pointerout"||e==="pointerover")&&(ge=Hu,Z="onPointerLeave",L="onPointerEnter",R="pointer"),Ke=V==null?G:ul(V),_=ue==null?G:ul(ue),G=new ge(Z,R+"leave",V,s,Y),G.target=Ke,G.relatedTarget=_,Z=null,mn(Y)===U&&(ge=new ge(L,R+"enter",ue,s,Y),ge.target=_,ge.relatedTarget=Ke,Z=ge),Ke=Z,V&&ue)t:{for(ge=Ag,L=V,R=ue,_=0,Z=L;Z;Z=ge(Z))_++;Z=0;for(var pe=R;pe;pe=ge(pe))Z++;for(;0<_-Z;)L=ge(L),_--;for(;0<Z-_;)R=ge(R),Z--;for(;_--;){if(L===R||R!==null&&L===R.alternate){ge=L;break t}L=ge(L),R=ge(R)}ge=null}else ge=null;V!==null&&Mf(F,G,V,ge,!1),ue!==null&&Ke!==null&&Mf(F,Ke,ue,ge,!0)}}e:{if(G=U?ul(U):window,V=G.nodeName&&G.nodeName.toLowerCase(),V==="select"||V==="input"&&G.type==="file")var Le=Zu;else if(Xu(G))if(Ju)Le=$p;else{Le=Up;var he=_p}else V=G.nodeName,!V||V.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?U&&fc(U.elementType)&&(Le=Zu):Le=Bp;if(Le&&(Le=Le(e,U))){Qu(F,Le,s,Y);break e}he&&he(e,G,U),e==="focusout"&&U&&G.type==="number"&&U.memoizedProps.value!=null&&xc(G,"number",G.value)}switch(he=U?ul(U):window,e){case"focusin":(Xu(he)||he.contentEditable==="true")&&(jn=he,Ac=U,vl=null);break;case"focusout":vl=Ac=jn=null;break;case"mousedown":Ec=!0;break;case"contextmenu":case"mouseup":case"dragend":Ec=!1,sm(F,s,Y);break;case"selectionchange":if(qp)break;case"keydown":case"keyup":sm(F,s,Y)}var ze;if(Sc)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 vn?Vu(e,s)&&(Re="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(Re="onCompositionStart");Re&&(qu&&s.locale!=="ko"&&(vn||Re!=="onCompositionStart"?Re==="onCompositionEnd"&&vn&&(ze=_u()):(ls=Y,yc="value"in ls?ls.value:ls.textContent,vn=!0)),he=gr(U,Re),0<he.length&&(Re=new $u(Re,e,null,s,Y),F.push({event:Re,listeners:he}),ze?Re.data=ze:(ze=Yu(s),ze!==null&&(Re.data=ze)))),(ze=Rp?Mp(e,s):Dp(e,s))&&(Re=gr(U,"onBeforeInput"),0<Re.length&&(he=new $u("onBeforeInput","beforeinput",null,s,Y),F.push({event:he,listeners:Re}),he.data=ze)),Sg(F,e,U,s,Y)}Tf(F,a)})}function Yl(e,a,s){return{instance:e,listener:a,currentTarget:s}}function gr(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=ml(e,s),r!=null&&l.unshift(Yl(e,r,o)),r=ml(e,a),r!=null&&l.push(Yl(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 Mf(e,a,s,l,r){for(var o=a._reactName,x=[];s!==null&&s!==l;){var N=s,A=N.alternate,U=N.stateNode;if(N=N.tag,A!==null&&A===l)break;N!==5&&N!==26&&N!==27||U===null||(A=U,r?(U=ml(s,o),U!=null&&x.unshift(Yl(s,U,A))):r||(U=ml(s,o),U!=null&&x.push(Yl(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 Df(e){return(typeof e=="string"?e:""+e).replace(Eg,`
49
+ `).replace(Tg,"")}function Of(e,a){return a=Df(a),Df(e)===a}function Ge(e,a,s,l,r,o){switch(s){case"children":typeof l=="string"?a==="body"||a==="textarea"&&l===""||gn(e,l):(typeof l=="number"||typeof l=="bigint")&&a!=="body"&&gn(e,""+l);break;case"className":ji(e,"class",l);break;case"tabIndex":ji(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":ji(e,s,l);break;case"style":Du(e,l,o);break;case"data":if(a!=="object"){ji(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=wi(""+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"&&Ge(e,a,"name",r.name,r,null),Ge(e,a,"formEncType",r.formEncType,r,null),Ge(e,a,"formMethod",r.formMethod,r,null),Ge(e,a,"formTarget",r.formTarget,r,null)):(Ge(e,a,"encType",r.encType,r,null),Ge(e,a,"method",r.method,r,null),Ge(e,a,"target",r.target,r,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(s);break}l=wi(""+l),e.setAttribute(s,l);break;case"onClick":l!=null&&(e.onclick=Da);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=wi(""+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),vi(e,"popover",l);break;case"xlinkActuate":Ma(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Ma(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Ma(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Ma(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Ma(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Ma(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Ma(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Ma(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Ma(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":vi(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,vi(e,s,l))}}function td(e,a,s,l,r,o){switch(s){case"style":Du(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"?gn(e,l):(typeof l=="number"||typeof l=="bigint")&&gn(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=Da);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Su.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[Lt]||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,""):vi(e,s,l)}}}function St(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:Ge(e,a,o,x,s,null)}}r&&Ge(e,a,"srcSet",s.srcSet,s,null),l&&Ge(e,a,"src",s.src,s,null);return;case"input":Ee("invalid",e);var N=o=x=r=null,A=null,U=null;for(l in s)if(s.hasOwnProperty(l)){var Y=s[l];if(Y!=null)switch(l){case"name":r=Y;break;case"type":x=Y;break;case"checked":A=Y;break;case"defaultChecked":U=Y;break;case"value":o=Y;break;case"defaultValue":N=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(c(137,a));break;default:Ge(e,a,l,Y,s,null)}}Eu(e,o,N,A,U,x,r,!1);return;case"select":Ee("invalid",e),l=x=o=null;for(r in s)if(s.hasOwnProperty(r)&&(N=s[r],N!=null))switch(r){case"value":o=N;break;case"defaultValue":x=N;break;case"multiple":l=N;default:Ge(e,a,r,N,s,null)}a=o,s=x,e.multiple=!!l,a!=null?pn(e,!!l,a,!1):s!=null&&pn(e,!!l,s,!0);return;case"textarea":Ee("invalid",e),o=r=l=null;for(x in s)if(s.hasOwnProperty(x)&&(N=s[x],N!=null))switch(x){case"value":l=N;break;case"defaultValue":r=N;break;case"children":o=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(c(91));break;default:Ge(e,a,x,N,s,null)}Ru(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:Ge(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<Vl.length;l++)Ee(Vl[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:Ge(e,a,U,l,s,null)}return;default:if(fc(a)){for(Y in s)s.hasOwnProperty(Y)&&(l=s[Y],l!==void 0&&td(e,a,Y,l,s,void 0));return}}for(N in s)s.hasOwnProperty(N)&&(l=s[N],l!=null&&Ge(e,a,N,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,N=null,A=null,U=null,Y=null;for(V in s){var F=s[V];if(s.hasOwnProperty(V)&&F!=null)switch(V){case"checked":break;case"value":break;case"defaultValue":A=F;default:l.hasOwnProperty(V)||Ge(e,a,V,null,l,F)}}for(var G in l){var V=l[G];if(F=s[G],l.hasOwnProperty(G)&&(V!=null||F!=null))switch(G){case"type":o=V;break;case"name":r=V;break;case"checked":U=V;break;case"defaultChecked":Y=V;break;case"value":x=V;break;case"defaultValue":N=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(c(137,a));break;default:V!==F&&Ge(e,a,G,V,l,F)}}mc(e,x,N,A,U,Y,o,r);return;case"select":V=x=N=G=null;for(o in s)if(A=s[o],s.hasOwnProperty(o)&&A!=null)switch(o){case"value":break;case"multiple":V=A;default:l.hasOwnProperty(o)||Ge(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":G=o;break;case"defaultValue":N=o;break;case"multiple":x=o;default:o!==A&&Ge(e,a,r,o,l,A)}a=N,s=x,l=V,G!=null?pn(e,!!s,G,!1):!!l!=!!s&&(a!=null?pn(e,!!s,a,!0):pn(e,!!s,s?[]:"",!1));return;case"textarea":V=G=null;for(N in s)if(r=s[N],s.hasOwnProperty(N)&&r!=null&&!l.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:Ge(e,a,N,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":G=r;break;case"defaultValue":V=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(c(91));break;default:r!==o&&Ge(e,a,x,r,l,o)}Tu(e,G,V);return;case"option":for(var ue in s)if(G=s[ue],s.hasOwnProperty(ue)&&G!=null&&!l.hasOwnProperty(ue))switch(ue){case"selected":e.selected=!1;break;default:Ge(e,a,ue,null,l,G)}for(A in l)if(G=l[A],V=s[A],l.hasOwnProperty(A)&&G!==V&&(G!=null||V!=null))switch(A){case"selected":e.selected=G&&typeof G!="function"&&typeof G!="symbol";break;default:Ge(e,a,A,G,l,V)}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 ge in s)G=s[ge],s.hasOwnProperty(ge)&&G!=null&&!l.hasOwnProperty(ge)&&Ge(e,a,ge,null,l,G);for(U in l)if(G=l[U],V=s[U],l.hasOwnProperty(U)&&G!==V&&(G!=null||V!=null))switch(U){case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(c(137,a));break;default:Ge(e,a,U,G,l,V)}return;default:if(fc(a)){for(var Ke in s)G=s[Ke],s.hasOwnProperty(Ke)&&G!==void 0&&!l.hasOwnProperty(Ke)&&td(e,a,Ke,void 0,l,G);for(Y in l)G=l[Y],V=s[Y],!l.hasOwnProperty(Y)||G===V||G===void 0&&V===void 0||td(e,a,Y,G,l,V);return}}for(var L in s)G=s[L],s.hasOwnProperty(L)&&G!=null&&!l.hasOwnProperty(L)&&Ge(e,a,L,null,l,G);for(F in l)G=l[F],V=s[F],!l.hasOwnProperty(F)||G===V||G==null&&V==null||Ge(e,a,F,G,l,V)}function Lf(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,N=r.duration;if(o&&N&&Lf(x)){for(x=0,N=r.responseEnd,l+=1;l<s.length;l++){var A=s[l],U=A.startTime;if(U>N)break;var Y=A.transferSize,F=A.initiatorType;Y&&Lf(F)&&(A=A.responseEnd,x+=Y*(A<N?1:(N-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 ad=null,sd=null;function br(e){return e.nodeType===9?e:e.ownerDocument}function _f(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 Uf(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 nd(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 ld=null;function Dg(){var e=window.event;return e&&e.type==="popstate"?e===ld?!1:(ld=e,!0):(ld=null,!1)}var Bf=typeof setTimeout=="function"?setTimeout:void 0,Og=typeof clearTimeout=="function"?clearTimeout:void 0,$f=typeof Promise=="function"?Promise:void 0,Lg=typeof queueMicrotask=="function"?queueMicrotask:typeof $f<"u"?function(e){return $f.resolve(null).then(e).catch(_g)}:Bf;function _g(e){setTimeout(function(){throw e})}function Ns(e){return e==="head"}function Hf(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),Zn(a);return}l--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")l++;else if(s==="html")Xl(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,Xl(s);for(var o=s.firstChild;o;){var x=o.nextSibling,N=o.nodeName;o[dl]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&o.rel.toLowerCase()==="stylesheet"||s.removeChild(o),o=x}}else s==="body"&&Xl(e.ownerDocument.body);s=r}while(s);Zn(a)}function qf(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 id(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":id(s),dc(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[dl])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=ra(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=ra(e.nextSibling),e===null))return null;return e}function Gf(e,a){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=ra(e.nextSibling),e===null))return null;return e}function rd(e){return e.data==="$?"||e.data==="$~"}function cd(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 ra(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 od=null;function Kf(e){e=e.nextSibling;for(var a=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(a===0)return ra(e.nextSibling);a--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||a++}e=e.nextSibling}return null}function Vf(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 Yf(e,a,s){switch(a=br(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 Xl(e){for(var a=e.attributes;a.length;)e.removeAttributeNode(a[0]);dc(e)}var ca=new Map,Xf=new Set;function yr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ja=ie.d;ie.d={f:Hg,r:qg,D:Gg,C:Kg,L:Vg,m:Yg,X:Qg,S:Xg,M:Zg};function Hg(){var e=Ja.f(),a=dr();return e||a}function qg(e){var a=xn(e);a!==null&&a.tag===5&&a.type==="form"?cx(a):Ja.r(e)}var Yn=typeof document>"u"?null:document;function Qf(e,a,s){var l=Yn;if(l&&typeof a=="string"&&a){var r=ea(a);r='link[rel="'+e+'"][href="'+r+'"]',typeof s=="string"&&(r+='[crossorigin="'+s+'"]'),Xf.has(r)||(Xf.add(r),e={rel:e,crossOrigin:s,href:a},l.querySelector(r)===null&&(a=l.createElement("link"),St(a,"link",e),pt(a),l.head.appendChild(a)))}}function Gg(e){Ja.D(e),Qf("dns-prefetch",e,null)}function Kg(e,a){Ja.C(e,a),Qf("preconnect",e,a)}function Vg(e,a,s){Ja.L(e,a,s);var l=Yn;if(l&&e&&a){var r='link[rel="preload"][as="'+ea(a)+'"]';a==="image"&&s&&s.imageSrcSet?(r+='[imagesrcset="'+ea(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(r+='[imagesizes="'+ea(s.imageSizes)+'"]')):r+='[href="'+ea(e)+'"]';var o=r;switch(a){case"style":o=Xn(e);break;case"script":o=Qn(e)}ca.has(o)||(e=y({rel:"preload",href:a==="image"&&s&&s.imageSrcSet?void 0:e,as:a},s),ca.set(o,e),l.querySelector(r)!==null||a==="style"&&l.querySelector(Ql(o))||a==="script"&&l.querySelector(Zl(o))||(a=l.createElement("link"),St(a,"link",e),pt(a),l.head.appendChild(a)))}}function Yg(e,a){Ja.m(e,a);var s=Yn;if(s&&e){var l=a&&typeof a.as=="string"?a.as:"script",r='link[rel="modulepreload"][as="'+ea(l)+'"][href="'+ea(e)+'"]',o=r;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=Qn(e)}if(!ca.has(o)&&(e=y({rel:"modulepreload",href:e},a),ca.set(o,e),s.querySelector(r)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(Zl(o)))return}l=s.createElement("link"),St(l,"link",e),pt(l),s.head.appendChild(l)}}}function Xg(e,a,s){Ja.S(e,a,s);var l=Yn;if(l&&e){var r=fn(l).hoistableStyles,o=Xn(e);a=a||"default";var x=r.get(o);if(!x){var N={loading:0,preload:null};if(x=l.querySelector(Ql(o)))N.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":a},s),(s=ca.get(o))&&dd(e,s);var A=x=l.createElement("link");pt(A),St(A,"link",e),A._p=new Promise(function(U,Y){A.onload=U,A.onerror=Y}),A.addEventListener("load",function(){N.loading|=1}),A.addEventListener("error",function(){N.loading|=2}),N.loading|=4,vr(x,a,l)}x={type:"stylesheet",instance:x,count:1,state:N},r.set(o,x)}}}function Qg(e,a){Ja.X(e,a);var s=Yn;if(s&&e){var l=fn(s).hoistableScripts,r=Qn(e),o=l.get(r);o||(o=s.querySelector(Zl(r)),o||(e=y({src:e,async:!0},a),(a=ca.get(r))&&ud(e,a),o=s.createElement("script"),pt(o),St(o,"link",e),s.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},l.set(r,o))}}function Zg(e,a){Ja.M(e,a);var s=Yn;if(s&&e){var l=fn(s).hoistableScripts,r=Qn(e),o=l.get(r);o||(o=s.querySelector(Zl(r)),o||(e=y({src:e,async:!0,type:"module"},a),(a=ca.get(r))&&ud(e,a),o=s.createElement("script"),pt(o),St(o,"link",e),s.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},l.set(r,o))}}function Zf(e,a,s,l){var r=(r=xe.current)?yr(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=Xn(s.href),s=fn(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=Xn(s.href);var o=fn(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(Ql(e)))&&!o._p&&(x.instance=o,x.state.loading=5),ca.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},ca.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=fn(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 Xn(e){return'href="'+ea(e)+'"'}function Ql(e){return'link[rel="stylesheet"]['+e+"]"}function Jf(e){return y({},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}),St(a,"link",s),pt(a),e.head.appendChild(a))}function Qn(e){return'[src="'+ea(e)+'"]'}function Zl(e){return"script[async]"+e}function Ff(e,a,s){if(a.count++,a.instance===null)switch(a.type){case"style":var l=e.querySelector('style[data-href~="'+ea(s.href)+'"]');if(l)return a.instance=l,pt(l),l;var r=y({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),pt(l),St(l,"style",r),vr(l,s.precedence,e),a.instance=l;case"stylesheet":r=Xn(s.href);var o=e.querySelector(Ql(r));if(o)return a.state.loading|=4,a.instance=o,pt(o),o;l=Jf(s),(r=ca.get(r))&&dd(l,r),o=(e.ownerDocument||e).createElement("link"),pt(o);var x=o;return x._p=new Promise(function(N,A){x.onload=N,x.onerror=A}),St(o,"link",l),a.state.loading|=4,vr(o,s.precedence,e),a.instance=o;case"script":return o=Qn(s.src),(r=e.querySelector(Zl(o)))?(a.instance=r,pt(r),r):(l=s,(r=ca.get(o))&&(l=y({},s),ud(l,r)),e=e.ownerDocument||e,r=e.createElement("script"),pt(r),St(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,vr(l,s.precedence,e));return a.instance}function vr(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 N=l[x];if(N.dataset.precedence===a)o=N;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 dd(e,a){e.crossOrigin==null&&(e.crossOrigin=a.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=a.referrerPolicy),e.title==null&&(e.title=a.title)}function ud(e,a){e.crossOrigin==null&&(e.crossOrigin=a.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=a.referrerPolicy),e.integrity==null&&(e.integrity=a.integrity)}var jr=null;function If(e,a,s){if(jr===null){var l=new Map,r=jr=new Map;r.set(s,l)}else r=jr,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[dl]||o[vt]||e==="link"&&o.getAttribute("rel")==="stylesheet")&&o.namespaceURI!=="http://www.w3.org/2000/svg"){var x=o.getAttribute(a)||"";x=e+x;var N=l.get(x);N?N.push(o):l.set(x,[o])}}return l}function Pf(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 Wf(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=Xn(l.href),o=a.querySelector(Ql(r));if(o){a=o._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(e.count++,e=Nr.bind(e),a.then(e,e)),s.state.loading|=4,s.instance=o,pt(o);return}o=a.ownerDocument||a,l=Jf(l),(r=ca.get(r))&&dd(l,r),o=o.createElement("link"),pt(o);var x=o;x._p=new Promise(function(N,A){x.onload=N,x.onerror=A}),St(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=Nr.bind(e),a.addEventListener("load",s),a.addEventListener("error",s))}}var md=0;function Pg(e,a){return e.stylesheets&&e.count===0&&Sr(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var l=setTimeout(function(){if(e.stylesheets&&Sr(e,e.stylesheets),e.unsuspend){var o=e.unsuspend;e.unsuspend=null,o()}},6e4+a);0<e.imgBytes&&md===0&&(md=62500*Mg());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Sr(e,e.stylesheets),e.unsuspend)){var o=e.unsuspend;e.unsuspend=null,o()}},(e.imgBytes>md?50:800)+a);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(r)}}:null}function Nr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Sr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var wr=null;function Sr(e,a){e.stylesheets=null,e.unsuspend!==null&&(e.count++,wr=new Map,a.forEach(Wg,e),wr=null,Nr.call(e))}function Wg(e,a){if(!(a.state.loading&4)){var s=wr.get(e);if(s)var l=s.get(null);else{s=new Map,wr.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=Nr.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 Jl={$$typeof:O,Provider:null,Consumer:null,_currentValue:me,_currentValue2:me,_threadCount:0};function eb(e,a,s,l,r,o,x,N,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=ic(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ic(0),this.hiddenUpdates=ic(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 eh(e,a,s,l,r,o,x,N,A,U,Y,F){return e=new eb(e,a,s,x,A,U,Y,F,N),a=1,o===!0&&(a|=24),o=Yt(3,null,null,a),e.current=o,o.stateNode=e,a=Vc(),a.refCount++,e.pooledCache=a,a.refCount++,o.memoizedState={element:l,isDehydrated:s,cache:a},Zc(o),e}function th(e){return e?(e=Sn,e):Sn}function ah(e,a,s,l,r,o){r=th(r),l.context===null?l.context=r:l.pendingContext=r,l=us(a),l.payload={element:s},o=o===void 0?null:o,o!==null&&(l.callback=o),s=ms(e,l,a),s!==null&&(qt(s,e,a),Cl(s,e,a))}function sh(e,a){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<a?s:a}}function xd(e,a){sh(e,a),(e=e.alternate)&&sh(e,a)}function nh(e){if(e.tag===13||e.tag===31){var a=Vs(e,67108864);a!==null&&qt(a,e,67108864),xd(e,67108864)}}function lh(e){if(e.tag===13||e.tag===31){var a=Ft();a=rc(a);var s=Vs(e,a);s!==null&&qt(s,e,a),xd(e,a)}}var kr=!0;function tb(e,a,s,l){var r=K.T;K.T=null;var o=ie.p;try{ie.p=2,fd(e,a,s,l)}finally{ie.p=o,K.T=r}}function ab(e,a,s,l){var r=K.T;K.T=null;var o=ie.p;try{ie.p=8,fd(e,a,s,l)}finally{ie.p=o,K.T=r}}function fd(e,a,s,l){if(kr){var r=hd(l);if(r===null)ed(e,a,l,zr,s),rh(e,l);else if(nb(r,e,a,s,l))l.stopPropagation();else if(rh(e,l),a&4&&-1<sb.indexOf(e)){for(;r!==null;){var o=xn(r);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var x=ja(o.pendingLanes);if(x!==0){var N=o;for(N.pendingLanes|=2,N.entangledLanes|=2;x;){var A=1<<31-Tt(x);N.entanglements[1]|=A,x&=~A}ka(o),(Ue&6)===0&&(cr=ht()+500,Kl(0))}}break;case 31:case 13:N=Vs(o,2),N!==null&&qt(N,o,2),dr(),xd(o,2)}if(o=hd(l),o===null&&ed(e,a,l,zr,s),o===r)break;r=o}r!==null&&l.stopPropagation()}else ed(e,a,l,null,s)}}function hd(e){return e=pc(e),pd(e)}var zr=null;function pd(e){if(zr=null,e=mn(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 zr=e,null}function ih(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(on()){case Us:return 2;case Bs:return 8;case Ta:case bi:return 32;case q:return 268435456;default:return 32}default:return 32}}var gd=!1,ws=null,Ss=null,ks=null,Fl=new Map,Il=new Map,zs=[],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 rh(e,a){switch(e){case"focusin":case"focusout":ws=null;break;case"dragenter":case"dragleave":Ss=null;break;case"mouseover":case"mouseout":ks=null;break;case"pointerover":case"pointerout":Fl.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Il.delete(a.pointerId)}}function Pl(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=xn(a),a!==null&&nh(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 ws=Pl(ws,e,a,s,l,r),!0;case"dragenter":return Ss=Pl(Ss,e,a,s,l,r),!0;case"mouseover":return ks=Pl(ks,e,a,s,l,r),!0;case"pointerover":var o=r.pointerId;return Fl.set(o,Pl(Fl.get(o)||null,e,a,s,l,r)),!0;case"gotpointercapture":return o=r.pointerId,Il.set(o,Pl(Il.get(o)||null,e,a,s,l,r)),!0}return!1}function ch(e){var a=mn(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,ju(e.priority,function(){lh(s)});return}}else if(a===31){if(a=b(s),a!==null){e.blockedOn=a,ju(e.priority,function(){lh(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 Cr(e){if(e.blockedOn!==null)return!1;for(var a=e.targetContainers;0<a.length;){var s=hd(e.nativeEvent);if(s===null){s=e.nativeEvent;var l=new s.constructor(s.type,s);hc=l,s.target.dispatchEvent(l),hc=null}else return a=xn(s),a!==null&&nh(a),e.blockedOn=s,!1;a.shift()}return!0}function oh(e,a,s){Cr(e)&&s.delete(a)}function lb(){gd=!1,ws!==null&&Cr(ws)&&(ws=null),Ss!==null&&Cr(Ss)&&(Ss=null),ks!==null&&Cr(ks)&&(ks=null),Fl.forEach(oh),Il.forEach(oh)}function Ar(e,a){e.blockedOn===a&&(e.blockedOn=null,gd||(gd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,lb)))}var Er=null;function dh(e){Er!==e&&(Er=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Er===e&&(Er=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(pd(l||s)===null)continue;break}var o=xn(s);o!==null&&(e.splice(a,3),a-=3,ho(o,{pending:!0,data:r,method:s.method,action:l},l,r))}}))}function Zn(e){function a(A){return Ar(A,e)}ws!==null&&Ar(ws,e),Ss!==null&&Ar(Ss,e),ks!==null&&Ar(ks,e),Fl.forEach(a),Il.forEach(a);for(var s=0;s<zs.length;s++){var l=zs[s];l.blockedOn===e&&(l.blockedOn=null)}for(;0<zs.length&&(s=zs[0],s.blockedOn===null);)ch(s),s.blockedOn===null&&zs.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[Lt]||null;if(typeof o=="function")x||dh(s);else if(x){var N=null;if(o&&o.hasAttribute("formAction")){if(r=o,x=o[Lt]||null)N=x.formAction;else if(pd(r)!==null)continue}else N=x.action;typeof N=="function"?s[l+1]=N:(s.splice(l,3),l-=3),dh(s)}}}function uh(){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 bd(e){this._internalRoot=e}Tr.prototype.render=bd.prototype.render=function(e){var a=this._internalRoot;if(a===null)throw Error(c(409));var s=a.current,l=Ft();ah(s,l,e,a,null,null)},Tr.prototype.unmount=bd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var a=e.containerInfo;ah(e.current,2,null,e,null,null),dr(),a[un]=null}};function Tr(e){this._internalRoot=e}Tr.prototype.unstable_scheduleHydration=function(e){if(e){var a=vu();e={blockedOn:null,target:e,priority:a};for(var s=0;s<zs.length&&a!==0&&a<zs[s].priority;s++);zs.splice(s,0,e),s===0&&ch(e)}};var mh=i.version;if(mh!=="19.2.4")throw Error(c(527,mh,"19.2.4"));ie.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?S(e):null,e=e===null?null:e.stateNode,e};var ib={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:K,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Rr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Rr.isDisabled&&Rr.supportsFiber)try{we=Rr.inject(ib),De=Rr}catch{}}return ei.createRoot=function(e,a){if(!m(e))throw Error(c(299));var s=!1,l="",r=bx,o=yx,x=vx;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=eh(e,1,!1,null,null,s,l,null,r,o,x,uh),e[un]=a.current,Wo(e),new bd(a)},ei.hydrateRoot=function(e,a,s){if(!m(e))throw Error(c(299));var l=!1,r="",o=bx,x=yx,N=vx,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&&(N=s.onRecoverableError),s.formState!==void 0&&(A=s.formState)),a=eh(e,1,!0,a,s??null,l,r,A,o,x,N,uh),a.context=th(null),s=a.current,l=Ft(),l=rc(l),r=us(l),r.callback=null,ms(s,r,l),s=l,a.current.lanes=s,ol(a,s),ka(a),e[un]=a.current,Wo(e),new Tr(a)},ei.version="19.2.4",ei}var Nh;function bb(){if(Nh)return Nd.exports;Nh=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(),Nd.exports=gb(),Nd.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 wh="popstate";function Sh(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 _d("",{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:ri(m)}return Nb(i,d,null,n)}function Fe(n,i){if(n===!1||n===null||typeof n>"u")throw new Error(i)}function ua(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 kh(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 _d(n,i,d=null,c,m){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof i=="string"?el(i):i,state:d,key:i&&i.key||c||jb(),unstable_mask:m}}function ri({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 el(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=S();p==null&&(p=0,h.replaceState({...h.state,idx:p},""));function S(){return(h.state||{idx:null}).idx}function y(){b="POP";let v=S(),z=v==null?null:v-p;p=v,g&&g({action:b,location:w.location,delta:z})}function j(v,z){b="PUSH";let M=Sh(v)?v:_d(w.location,v,z);p=S()+1;let O=kh(M,p),E=w.createHref(M.unstable_mask||M);try{h.pushState(O,"",E)}catch(te){if(te instanceof DOMException&&te.name==="DataCloneError")throw te;m.location.assign(E)}f&&g&&g({action:b,location:w.location,delta:1})}function k(v,z){b="REPLACE";let M=Sh(v)?v:_d(w.location,v,z);p=S();let O=kh(M,p),E=w.createHref(M.unstable_mask||M);h.replaceState(O,"",E),f&&g&&g({action:b,location:w.location,delta:0})}function C(v){return wb(v)}let w={get action(){return b},get location(){return n(m,h)},listen(v){if(g)throw new Error("A history only accepts one active listener");return m.addEventListener(wh,y),g=v,()=>{m.removeEventListener(wh,y),g=null}},createHref(v){return i(m,v)},createURL:C,encodeLocation(v){let z=C(v);return{pathname:z.pathname,search:z.search,hash:z.hash}},push:j,replace:k,go(v){return h.go(v)}};return w}function wb(n,i=!1){let d="http://localhost";typeof window<"u"&&(d=window.location.origin!=="null"?window.location.origin:window.location.href),Fe(d,"No window.location.(origin|href) available to create URL");let c=typeof n=="string"?n:ri(n);return c=c.replace(/ $/,"%20"),!i&&c.startsWith("//")&&(c=d+c),new URL(c,d)}function e0(n,i,d="/"){return Sb(n,i,d,!1)}function Sb(n,i,d,c){let m=typeof i=="string"?el(i):i,f=Wa(m.pathname||"/",d);if(f==null)return null;let h=t0(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 t0(n,i=[],d=[],c="",m=!1){let f=(h,b,g=m,p)=>{let S={relativePath:p===void 0?h.path||"":p,caseSensitive:h.caseSensitive===!0,childrenIndex:b,route:h};if(S.relativePath.startsWith("/")){if(!S.relativePath.startsWith(c)&&g)return;Fe(S.relativePath.startsWith(c),`Absolute route path "${S.relativePath}" nested under path "${c}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),S.relativePath=S.relativePath.slice(c.length)}let y=za([c,S.relativePath]),j=d.concat(S);h.children&&h.children.length>0&&(Fe(h.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),t0(h.children,i,j,y,g)),!(h.path==null&&!h.index)&&i.push({path:y,score:Mb(y,h.index),routesMeta:j})};return n.forEach((h,b)=>{var g;if(h.path===""||!((g=h.path)!=null&&g.includes("?")))f(h,b);else for(let p of a0(h.path))f(h,b,!0,p)}),i}function a0(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=a0(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,zh=n=>n==="*";function Mb(n,i){let d=n.split("/"),c=d.length;return d.some(zh)&&(c+=Rb),i&&(c+=Ab),d.filter(m=>!zh(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,S=f==="/"?i:i.slice(f.length)||"/",y=Yr({path:g.relativePath,caseSensitive:g.caseSensitive,end:p},S),j=g.route;if(!y&&p&&d&&!c[c.length-1].route.index&&(y=Yr({path:g.relativePath,caseSensitive:g.caseSensitive,end:!1},S)),!y)return null;Object.assign(m,y.params),h.push({params:m,pathname:za([f,y.pathname]),pathnameBase:Hb(za([f,y.pathnameBase])),route:j}),y.pathnameBase!=="/"&&(f=za([f,y.pathnameBase]))}return h}function Yr(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:S,isOptional:y},j)=>{if(S==="*"){let C=b[j]||"";h=f.slice(0,f.length-C.length).replace(/(.)\/+$/,"$1")}const k=b[j];return y&&!k?p[S]=void 0:p[S]=(k||"").replace(/%2F/g,"/"),p},{}),pathname:f,pathnameBase:h,pattern:n}}function Lb(n,i=!1,d=!0){ua(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,S)=>{if(c.push({paramName:b,isOptional:g!=null}),g){let y=S.charAt(p+h.length);return y&&y!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}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 ua(!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 Wa(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"?el(n):n,f;return d?(d=d.replace(/\/\/+/g,"/"),d.startsWith("/")?f=Ch(d.substring(1),"/"):f=Ch(d,i)):f=i,{pathname:f,search:qb(c),hash:Gb(m)}}function Ch(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 zd(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 Qd(n){let i=$b(n);return i.map((d,c)=>c===i.length-1?d.pathname:d.pathnameBase)}function Zr(n,i,d,c=!1){let m;typeof n=="string"?m=el(n):(m={...n},Fe(!m.pathname||!m.pathname.includes("?"),zd("?","pathname","search",m)),Fe(!m.pathname||!m.pathname.includes("#"),zd("#","pathname","hash",m)),Fe(!m.search||!m.search.includes("#"),zd("#","search","hash",m)));let f=n===""||m.pathname==="",h=f?"/":m.pathname,b;if(h==null)b=d;else{let y=i.length-1;if(!c&&h.startsWith("..")){let j=h.split("/");for(;j[0]==="..";)j.shift(),y-=1;m.pathname=j.join("/")}b=y>=0?i[y]:"/"}let g=Bb(m,b),p=h&&h!=="/"&&h.endsWith("/"),S=(f||h===".")&&d.endsWith("/");return!g.pathname.endsWith("/")&&(p||S)&&(g.pathname+="/"),g}var za=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 s0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function n0(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(s0)try{let f=new URL(window.location.href),h=d.startsWith("//")?new URL(f.protocol+d):new URL(d),b=Wa(h.pathname,i);h.origin===f.origin&&b!=null?d=b+h.search+h.hash:m=!0}catch{ua(!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 l0=["POST","PUT","PATCH","DELETE"];new Set(l0);var Xb=["GET",...l0];new Set(Xb);var tl=u.createContext(null);tl.displayName="DataRouter";var Jr=u.createContext(null);Jr.displayName="DataRouterState";var Qb=u.createContext(!1),i0=u.createContext({isTransitioning:!1});i0.displayName="ViewTransition";var Zb=u.createContext(new Map);Zb.displayName="Fetchers";var Jb=u.createContext(null);Jb.displayName="Await";var Pt=u.createContext(null);Pt.displayName="Navigation";var xi=u.createContext(null);xi.displayName="Location";var ma=u.createContext({outlet:null,matches:[],isDataRoute:!1});ma.displayName="Route";var Zd=u.createContext(null);Zd.displayName="RouteError";var r0="REACT_ROUTER_ERROR",Fb="REDIRECT",Ib="ROUTE_ERROR_RESPONSE";function Pb(n){if(n.startsWith(`${r0}:${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(`${r0}:${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}={}){Fe(al(),"useHref() may be used only in the context of a <Router> component.");let{basename:d,navigator:c}=u.useContext(Pt),{hash:m,pathname:f,search:h}=fi(n,{relative:i}),b=f;return d!=="/"&&(b=f==="/"?d:za([d,f])),c.createHref({pathname:b,search:h,hash:m})}function al(){return u.useContext(xi)!=null}function ya(){return Fe(al(),"useLocation() may be used only in the context of a <Router> component."),u.useContext(xi).location}var c0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function o0(n){u.useContext(Pt).static||u.useLayoutEffect(n)}function Dt(){let{isDataRoute:n}=u.useContext(ma);return n?hy():ty()}function ty(){Fe(al(),"useNavigate() may be used only in the context of a <Router> component.");let n=u.useContext(tl),{basename:i,navigator:d}=u.useContext(Pt),{matches:c}=u.useContext(ma),{pathname:m}=ya(),f=JSON.stringify(Qd(c)),h=u.useRef(!1);return o0(()=>{h.current=!0}),u.useCallback((g,p={})=>{if(ua(h.current,c0),!h.current)return;if(typeof g=="number"){d.go(g);return}let S=Zr(g,JSON.parse(f),m,p.relative==="path");n==null&&i!=="/"&&(S.pathname=S.pathname==="/"?i:za([i,S.pathname])),(p.replace?d.replace:d.push)(S,p.state,p)},[i,d,f,m,n])}var ay=u.createContext(null);function sy(n){let i=u.useContext(ma).outlet;return u.useMemo(()=>i&&u.createElement(ay.Provider,{value:n},i),[i,n])}function sl(){let{matches:n}=u.useContext(ma),i=n[n.length-1];return i?i.params:{}}function fi(n,{relative:i}={}){let{matches:d}=u.useContext(ma),{pathname:c}=ya(),m=JSON.stringify(Qd(d));return u.useMemo(()=>Zr(n,JSON.parse(m),c,i==="path"),[n,m,c,i])}function ny(n,i){return d0(n,i)}function d0(n,i,d){var v;Fe(al(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:c}=u.useContext(Pt),{matches:m}=u.useContext(ma),f=m[m.length-1],h=f?f.params:{},b=f?f.pathname:"/",g=f?f.pathnameBase:"/",p=f&&f.route;{let z=p&&p.path||"";m0(b,!p||z.endsWith("*")||z.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${b}" (under <Route path="${z}">) 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="${z}"> to <Route path="${z==="/"?"*":`${z}/*`}">.`)}let S=ya(),y;if(i){let z=typeof i=="string"?el(i):i;Fe(g==="/"||((v=z.pathname)==null?void 0:v.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 "${z.pathname}" was given in the \`location\` prop.`),y=z}else y=S;let j=y.pathname||"/",k=j;if(g!=="/"){let z=g.replace(/^\//,"").split("/");k="/"+j.replace(/^\//,"").split("/").slice(z.length).join("/")}let C=e0(n,{pathname:k});ua(p||C!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),ua(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.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 w=oy(C&&C.map(z=>Object.assign({},z,{params:Object.assign({},h,z.params),pathname:za([g,c.encodeLocation?c.encodeLocation(z.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:z.pathname]),pathnameBase:z.pathnameBase==="/"?g:za([g,c.encodeLocation?c.encodeLocation(z.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:z.pathnameBase])})),m,d);return i&&w?u.createElement(xi.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...y},navigationType:"POP"}},w):w}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),u0=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(ma.Provider,{value:this.props.routeContext},u.createElement(Zd.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?u.createElement(ry,{error:n},i):i}};u0.contextType=Qb;var Cd=new WeakMap;function ry({children:n,error:i}){let{basename:d}=u.useContext(Pt);if(typeof i=="object"&&i&&"digest"in i&&typeof i.digest=="string"){let c=Pb(i.digest);if(c){let m=Cd.get(i);if(m)throw m;let f=n0(c.location,d);if(s0&&!Cd.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 Cd.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(tl);return c&&c.static&&c.staticContext&&(i.route.errorElement||i.route.ErrorBoundary)&&(c.staticContext._deepestRenderedBoundaryId=i.route.id),u.createElement(ma.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 S=m.findIndex(y=>y.route.id&&(f==null?void 0:f[y.route.id])!==void 0);Fe(S>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),m=m.slice(0,Math.min(m.length,S+1))}let h=!1,b=-1;if(d&&c){h=c.renderFallback;for(let S=0;S<m.length;S++){let y=m[S];if((y.route.HydrateFallback||y.route.hydrateFallbackElement)&&(b=S),y.route.id){let{loaderData:j,errors:k}=c,C=y.route.loader&&!j.hasOwnProperty(y.route.id)&&(!k||k[y.route.id]===void 0);if(y.route.lazy||C){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?(S,y)=>{var j,k;g(S,{location:c.location,params:((k=(j=c.matches)==null?void 0:j[0])==null?void 0:k.params)??{},unstable_pattern:Yb(c.matches),errorInfo:y})}:void 0;return m.reduceRight((S,y,j)=>{let k,C=!1,w=null,v=null;c&&(k=f&&y.route.id?f[y.route.id]:void 0,w=y.route.errorElement||iy,h&&(b<0&&j===0?(m0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,v=null):b===j&&(C=!0,v=y.route.hydrateFallbackElement||null)));let z=i.concat(m.slice(0,j+1)),M=()=>{let O;return k?O=w:C?O=v:y.route.Component?O=u.createElement(y.route.Component,null):y.route.element?O=y.route.element:O=S,u.createElement(cy,{match:y,routeContext:{outlet:S,matches:z,isDataRoute:c!=null},children:O})};return c&&(y.route.ErrorBoundary||y.route.errorElement||j===0)?u.createElement(u0,{location:c.location,revalidation:c.revalidation,component:w,error:k,children:M(),routeContext:{outlet:null,matches:z,isDataRoute:!0},onError:p}):M()},null)}function Jd(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(tl);return Fe(i,Jd(n)),i}function uy(n){let i=u.useContext(Jr);return Fe(i,Jd(n)),i}function my(n){let i=u.useContext(ma);return Fe(i,Jd(n)),i}function Fd(n){let i=my(n),d=i.matches[i.matches.length-1];return Fe(d.route.id,`${n} can only be used on routes that contain a unique "id"`),d.route.id}function xy(){return Fd("useRouteId")}function fy(){var c;let n=u.useContext(Zd),i=uy("useRouteError"),d=Fd("useRouteError");return n!==void 0?n:(c=i.errors)==null?void 0:c[d]}function hy(){let{router:n}=dy("useNavigate"),i=Fd("useNavigate"),d=u.useRef(!1);return o0(()=>{d.current=!0}),u.useCallback(async(m,f={})=>{ua(d.current,c0),d.current&&(typeof m=="number"?await n.navigate(m):await n.navigate(m,{fromRouteId:i,...f}))},[n,i])}var Ah={};function m0(n,i,d){!i&&!Ah[n]&&(Ah[n]=!0,ua(!1,d))}u.memo(py);function py({routes:n,future:i,state:d,isStatic:c,onError:m}){return d0(n,void 0,{state:d,isStatic:c,onError:m})}function Eh({to:n,replace:i,state:d,relative:c}){Fe(al(),"<Navigate> may be used only in the context of a <Router> component.");let{static:m}=u.useContext(Pt);ua(!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(ma),{pathname:h}=ya(),b=Dt(),g=Zr(n,Qd(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 Oe(n){Fe(!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}){Fe(!al(),"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=el(d));let{pathname:p="/",search:S="",hash:y="",state:j=null,key:k="default",unstable_mask:C}=d,w=u.useMemo(()=>{let v=Wa(p,b);return v==null?null:{location:{pathname:v,search:S,hash:y,state:j,key:k,unstable_mask:C},navigationType:c}},[b,p,S,y,j,k,c,C]);return ua(w!=null,`<Router basename="${b}"> is not able to match the URL "${p}${S}${y}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:u.createElement(Pt.Provider,{value:g},u.createElement(xi.Provider,{children:i,value:w}))}function x0({children:n,location:i}){return ny(Ud(n),i)}function Ud(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,Ud(c.props.children,f));return}Fe(c.type===Oe,`[${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>`),Fe(!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=Ud(c.props.children,f)),d.push(h)}),d}var Gr="get",Kr="application/x-www-form-urlencoded";function Fr(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function yy(n){return Fr(n)&&n.tagName.toLowerCase()==="button"}function vy(n){return Fr(n)&&n.tagName.toLowerCase()==="form"}function jy(n){return Fr(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 Bd(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=Bd(n);return i&&i.forEach((c,m)=>{d.has(m)||i.getAll(m).forEach(f=>{d.append(m,f)})}),d}var Mr=null;function ky(){if(Mr===null)try{new FormData(document.createElement("form"),0),Mr=!1}catch{Mr=!0}return Mr}var zy=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ad(n){return n!=null&&!zy.has(n)?(ua(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Kr}"`),null):n}function Cy(n,i){let d,c,m,f,h;if(vy(n)){let b=n.getAttribute("action");c=b?Wa(b,i):null,d=n.getAttribute("method")||Gr,m=Ad(n.getAttribute("enctype"))||Kr,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?Wa(g,i):null,d=n.getAttribute("formmethod")||b.getAttribute("method")||Gr,m=Ad(n.getAttribute("formenctype"))||Ad(b.getAttribute("enctype"))||Kr,f=new FormData(b,n),!ky()){let{name:p,type:S,value:y}=n;if(S==="image"){let j=p?`${p}.`:"";f.append(`${j}x`,"0"),f.append(`${j}y`,"0")}else p&&f.append(p,y)}}else{if(Fr(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');d=Gr,c=null,m=Kr,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 Id(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&&Wa(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 Th(n,i,d,c,m,f){let h=(g,p)=>d[p]?g.route.id!==d[p].route.id:!0,b=(g,p)=>{var S;return d[p].pathname!==g.pathname||((S=d[p].route.path)==null?void 0:S.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 y;let S=c.routes[g.route.id];if(!S||!S.hasLoader)return!1;if(h(g,p)||b(g,p))return!0;if(g.route.shouldRevalidate){let j=g.route.shouldRevalidate({currentUrl:new URL(m.pathname+m.search+m.hash,window.origin),currentParams:((y=d[0])==null?void 0:y.params)||{},nextUrl:new URL(n,window.origin),nextParams:g.params,defaultShouldRevalidate:!0});if(typeof j=="boolean")return j}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 f0(){let n=u.useContext(tl);return Id(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function _y(){let n=u.useContext(Jr);return Id(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var Pd=u.createContext(void 0);Pd.displayName="FrameworkContext";function h0(){let n=u.useContext(Pd);return Id(n,"You must render this element inside a <HydratedRouter> element"),n}function Uy(n,i){let d=u.useContext(Pd),[c,m]=u.useState(!1),[f,h]=u.useState(!1),{onFocus:b,onBlur:g,onMouseEnter:p,onMouseLeave:S,onTouchStart:y}=i,j=u.useRef(null);u.useEffect(()=>{if(n==="render"&&h(!0),n==="viewport"){let w=z=>{z.forEach(M=>{h(M.isIntersecting)})},v=new IntersectionObserver(w,{threshold:.5});return j.current&&v.observe(j.current),()=>{v.disconnect()}}},[n]),u.useEffect(()=>{if(c){let w=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(w)}}},[c]);let k=()=>{m(!0)},C=()=>{m(!1),h(!1)};return d?n!=="intent"?[f,j,{}]:[f,j,{onFocus:ti(b,k),onBlur:ti(g,C),onMouseEnter:ti(p,k),onMouseLeave:ti(S,C),onTouchStart:ti(y,k)}]:[!1,j,{}]}function ti(n,i){return d=>{n&&n(d),d.defaultPrevented||i(d)}}function By({page:n,...i}){let{router:d}=f0(),c=u.useMemo(()=>e0(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}=h0(),[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=ya(),{future:m,manifest:f,routeModules:h}=h0(),{basename:b}=f0(),{loaderData:g,matches:p}=_y(),S=u.useMemo(()=>Th(n,i,p,f,c,"data"),[n,i,p,f,c]),y=u.useMemo(()=>Th(n,i,p,f,c,"assets"),[n,i,p,f,c]),j=u.useMemo(()=>{if(n===c.pathname+c.search+c.hash)return[];let w=new Set,v=!1;if(i.forEach(M=>{var E;let O=f.routes[M.route.id];!O||!O.hasLoader||(!S.some(te=>te.route.id===M.route.id)&&M.route.id in g&&((E=h[M.route.id])!=null&&E.shouldRevalidate)||O.hasClientLoader?v=!0:w.add(M.route.id))}),w.size===0)return[];let z=Ay(n,b,m.unstable_trailingSlashAwareDataRequests,"data");return v&&w.size>0&&z.searchParams.set("_routes",i.filter(M=>w.has(M.route.id)).map(M=>M.route.id).join(",")),[z.pathname+z.search]},[b,m.unstable_trailingSlashAwareDataRequests,g,c,f,S,i,n,h]),k=u.useMemo(()=>My(y,f),[y,f]),C=$y(y);return u.createElement(u.Fragment,null,j.map(w=>u.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...d})),k.map(w=>u.createElement("link",{key:w,rel:"modulepreload",href:w,...d})),C.map(({key:w,link:v})=>u.createElement("link",{key:w,nonce:d.nonce,...v,crossOrigin:v.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 p0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ia=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:S,preventScrollReset:y,viewTransition:j,unstable_defaultShouldRevalidate:k,...C},w){let{basename:v,navigator:z,unstable_useTransitions:M}=u.useContext(Pt),O=typeof S=="string"&&p0.test(S),E=n0(S,v);S=E.to;let te=ey(S,{relative:m}),oe=ya(),H=null;if(b){let fe=Zr(b,[],oe.unstable_mask?oe.unstable_mask.pathname:"/",!0);v!=="/"&&(fe.pathname=fe.pathname==="/"?v:za([v,fe.pathname])),H=z.createHref(fe)}let[$,I,W]=Uy(c,C),X=Xy(S,{replace:h,unstable_mask:b,state:g,target:p,preventScrollReset:y,relative:m,viewTransition:j,unstable_defaultShouldRevalidate:k,unstable_useTransitions:M});function ne(fe){i&&i(fe),fe.defaultPrevented||X(fe)}let J=!(E.isExternal||f),le=u.createElement("a",{...C,...W,href:(J?H:void 0)||E.absoluteURL||te,onClick:J?ne:i,ref:qy(w,I),target:p,"data-discover":!O&&d==="render"?"true":void 0});return $&&!O?u.createElement(u.Fragment,null,le,u.createElement(By,{page:te})):le});Ia.displayName="Link";var li=u.forwardRef(function({"aria-current":i="page",caseSensitive:d=!1,className:c="",end:m=!1,style:f,to:h,viewTransition:b,children:g,...p},S){let y=fi(h,{relative:p.relative}),j=ya(),k=u.useContext(Jr),{navigator:C,basename:w}=u.useContext(Pt),v=k!=null&&Py(y)&&b===!0,z=C.encodeLocation?C.encodeLocation(y).pathname:y.pathname,M=j.pathname,O=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;d||(M=M.toLowerCase(),O=O?O.toLowerCase():null,z=z.toLowerCase()),O&&w&&(O=Wa(O,w)||O);const E=z!=="/"&&z.endsWith("/")?z.length-1:z.length;let te=M===z||!m&&M.startsWith(z)&&M.charAt(E)==="/",oe=O!=null&&(O===z||!m&&O.startsWith(z)&&O.charAt(z.length)==="/"),H={isActive:te,isPending:oe,isTransitioning:v},$=te?i:void 0,I;typeof c=="function"?I=c(H):I=[c,te?"active":null,oe?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let W=typeof f=="function"?f(H):f;return u.createElement(Ia,{...p,"aria-current":$,className:I,ref:S,style:W,to:h,viewTransition:b},typeof g=="function"?g(H):g)});li.displayName="NavLink";var Vy=u.forwardRef(({discover:n="render",fetcherKey:i,navigate:d,reloadDocument:c,replace:m,state:f,method:h=Gr,action:b,onSubmit:g,relative:p,preventScrollReset:S,viewTransition:y,unstable_defaultShouldRevalidate:j,...k},C)=>{let{unstable_useTransitions:w}=u.useContext(Pt),v=Fy(),z=Iy(b,{relative:p}),M=h.toLowerCase()==="get"?"get":"post",O=typeof b=="string"&&p0.test(b),E=te=>{if(g&&g(te),te.defaultPrevented)return;te.preventDefault();let oe=te.nativeEvent.submitter,H=(oe==null?void 0:oe.getAttribute("formmethod"))||h,$=()=>v(oe||te.currentTarget,{fetcherKey:i,method:H,navigate:d,replace:m,state:f,relative:p,preventScrollReset:S,viewTransition:y,unstable_defaultShouldRevalidate:j});w&&d!==!1?u.startTransition(()=>$()):$()};return u.createElement("form",{ref:C,method:M,action:z,onSubmit:c?g:E,...k,"data-discover":!O&&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 g0(n){let i=u.useContext(tl);return Fe(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 S=Dt(),y=ya(),j=fi(n,{relative:h});return u.useCallback(k=>{if(wy(k,i)){k.preventDefault();let C=d!==void 0?d:ri(y)===ri(j),w=()=>S(n,{replace:C,unstable_mask:c,state:m,preventScrollReset:f,relative:h,viewTransition:b,unstable_defaultShouldRevalidate:g});p?u.startTransition(()=>w()):w()}},[y,S,j,d,c,m,i,n,f,h,b,g,p])}function Qy(n){ua(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(Bd(n)),d=u.useRef(!1),c=ya(),m=u.useMemo(()=>Sy(c.search,d.current?null:i.current),[c.search]),f=Dt(),h=u.useCallback((b,g)=>{const p=Bd(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}=g0("useSubmit"),{basename:i}=u.useContext(Pt),d=xy(),c=n.fetch,m=n.navigate;return u.useCallback(async(f,h={})=>{let{action:b,method:g,encType:p,formData:S,body:y}=Cy(f,i);if(h.navigate===!1){let j=h.fetcherKey||Jy();await c(j,d,h.action||b,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:S,body:y,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:S,body:y,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(Pt),c=u.useContext(ma);Fe(c,"useFormAction must be used inside a RouteContext");let[m]=c.matches.slice(-1),f={...fi(n||".",{relative:i})},h=ya();if(n==null){f.search=h.search;let b=new URLSearchParams(f.search),g=b.getAll("index");if(g.some(S=>S==="")){b.delete("index"),g.filter(y=>y).forEach(y=>b.append("index",y));let S=b.toString();f.search=S?`?${S}`:""}}return(!n||n===".")&&m.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),d!=="/"&&(f.pathname=f.pathname==="/"?d:za([d,f.pathname])),ri(f)}function Py(n,{relative:i}={}){let d=u.useContext(i0);Fe(d!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:c}=g0("useViewTransitionState"),m=fi(n,{relative:i});if(!d.isTransitioning)return!1;let f=Wa(d.currentLocation.pathname,c)||d.currentLocation.pathname,h=Wa(d.nextLocation.pathname,c)||d.nextLocation.pathname;return Yr(m.pathname,h)!=null||Yr(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(),b0=(...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:b0("lucide",m),...b},[...h.map(([p,S])=>u.createElement(p,S)),...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 ee=(n,i)=>{const d=u.forwardRef(({className:c,...m},f)=>u.createElement(tv,{ref:f,iconNode:i,className:b0(`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 It=ee("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 Pn=ee("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 y0=ee("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=ee("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 es=ee("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 Rs=ee("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=ee("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 v0=ee("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 Wd=ee("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=ee("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=ee("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 Aa=ee("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 mt=ee("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 ts=ee("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 Rh=ee("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 oa=ee("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 ci=ee("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 oi=ee("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 bt=ee("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 j0=ee("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=ee("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 N0=ee("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 Mt=ee("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 rv=ee("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"}]]);/**
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 Wn=ee("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
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 cv=ee("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
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 ov=ee("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"}]]);/**
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 w0=ee("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"}]]);/**
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 da=ee("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"}]]);/**
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 di=ee("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"}]]);/**
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 In=ee("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"}]]);/**
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 eu=ee("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"}]]);/**
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 Ir=ee("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"}]]);/**
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 _s=ee("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"}]]);/**
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 S0=ee("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
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 Mh=ee("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"}]]);/**
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 Ed=ee("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"}]]);/**
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 dv=ee("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"}]]);/**
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 Xr=ee("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"}]]);/**
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 tu=ee("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"}]]);/**
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 Dh=ee("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"}]]);/**
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 uv=ee("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"}]]);/**
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 hi=ee("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"}]]);/**
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 mv=ee("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"}]]);/**
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 xv=ee("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
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 au=ee("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=ee("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 xt=ee("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 fv=ee("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 Hd=ee("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 hv=ee("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 pv=ee("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 gv=ee("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 Ms=ee("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 bv=ee("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 yv=ee("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 vv=ee("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 jv=ee("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 Pr=ee("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 Nv=ee("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 su=ee("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 Et=ee("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 yt=ee("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 Wr=ee("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 k0=ee("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 kt=ee("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 z0=ee("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 ec=ee("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 Ds=ee("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 nu=ee("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 lu=ee("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 nl=ee("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 Ea=ee("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 iu=ee("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 Os=ee("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 wv=ee("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 Sv=ee("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 kv=ee("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 zv=ee("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 ln=ee("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 C0=ee("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 ui=ee("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 qd=ee("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 mi=ee("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 Cv=ee("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 Av=ee("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 Ev=ee("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 Gt=ee("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 Tv=ee("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 ru=ee("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 ft=ee("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 Jn=ee("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 Rv=ee("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 ll=ee("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 Mv=ee("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 Dv=ee("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 il=ee("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=ee("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 Pa=ee("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"}]]),Gd={en:"English",fr:"Français",es:"Español",de:"Deutsch",pt:"Português",ja:"日本語",zh:"中文",ko:"한국어",ar:"العربية",ru:"Русский",it:"Italiano",nl:"Nederlands"},Ov=["ar"],Lv=Object.keys(Gd);function Kd(n){return Lv.includes(n)}function _v(n){if(!n)return"en";const i=n.toLowerCase();if(Kd(i))return i;const d=i.split("-")[0];return Kd(d)?d:"en"}const Oh={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"}},A0=u.createContext({lang:"en",setLang:()=>{},t:n=>n,isRTL:!1});function Uv({children:n}){const[i,d]=u.useState(()=>{const h=localStorage.getItem("nestor_lang");return h&&Kd(h)?h:_v(navigator.language)}),c=Ov.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=Oh[i])==null?void 0:p[h])??Oh.en[h]??h;if(b)for(const[S,y]of Object.entries(b))g=g.replace(`{${S}}`,String(y));return g},[i]);return t.jsx(A0.Provider,{value:{lang:i,setLang:m,t:f,isRTL:c},children:n})}function lt(){return u.useContext(A0)}const Bv={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"]}},E0=u.createContext({user:null,loading:!0,login:async()=>{},logout:async()=>{},register:async()=>{},isAdmin:!1,hasPermission:()=>!1}),$v="/api";function Hv(){const n=document.cookie.match(/(?:^|; )nestor-csrf=([^;]*)/);return n?decodeURIComponent(n[1]):null}async function ai(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=Hv();b&&(d["X-CSRF-Token"]=b)}const m=await fetch(`${$v}${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 qv({children:n}){const[i,d]=u.useState(null),[c,m]=u.useState(!0);u.useEffect(()=>{ai("/auth/me").then(S=>{var y;(y=S.data)!=null&&y.user&&typeof S.data.user=="object"&&d(S.data.user)}).catch(async()=>{try{(await ai("/health")).status==="ok"&&d({id:"local",email:"admin@localhost",name:"Admin",role:"admin"})}catch{}}).finally(()=>m(!1))},[]);const f=u.useCallback(async(S,y)=>{const j=await ai("/auth/login",{method:"POST",body:JSON.stringify({email:S,password:y})});d(j.data.user)},[]),h=u.useCallback(async()=>{await ai("/auth/logout",{method:"POST"}).catch(()=>{}),d(null)},[]),b=u.useCallback(async(S,y,j)=>{await ai("/auth/register",{method:"POST",body:JSON.stringify({email:S,password:y,name:j})})},[]),g=(i==null?void 0:i.role)==="admin",p=u.useCallback((S,y)=>{if(!i)return!1;const j=Bv[i.role];if(!j)return!1;const k=j[S];return k?k.includes(y)||k.includes("admin"):!1},[i]);return t.jsx(E0.Provider,{value:{user:i,loading:c,login:f,logout:h,register:b,isAdmin:g,hasPermission:p},children:n})}function pi(){return u.useContext(E0)}const Gv=[{to:"/missions",icon:Pa,labelKey:"nav.missions"},{to:"/chat",icon:Ms,labelKey:"nav.chat"},{to:"/agents",icon:es,labelKey:"nav.agents"},{to:"/workflows",icon:Xr,labelKey:"nav.workflows"},{to:"/runs",icon:Et,labelKey:"nav.history"}],T0=[{key:"tools",label:"Tools",defaultOpen:!1,items:[{to:"/skills",icon:Wr,labelKey:"nav.skills"},{to:"/memory",icon:Rs,labelKey:"nav.memory"},{to:"/plans",icon:rv,labelKey:"nav.plans"},{to:"/guardrails",icon:Os,labelKey:"nav.guardrails"}]},{key:"monitoring",label:"Monitoring",defaultOpen:!1,items:[{to:"/analytics",icon:Aa,labelKey:"nav.analytics"},{to:"/budget",icon:da,labelKey:"nav.budget"},{to:"/traces",icon:It,labelKey:"nav.traces"},{to:"/approvals",icon:iu,labelKey:"nav.approvals"}]},{key:"advanced",label:"Advanced",defaultOpen:!1,items:[{to:"/goals",icon:ln,labelKey:"nav.goals"},{to:"/handoffs",icon:oi,labelKey:"nav.handoffs"},{to:"/keys",icon:hi,labelKey:"nav.apiKeys"},{to:"/settings",icon:nl,labelKey:"nav.settings"}]}],Kv=[{to:"/users",icon:ll,labelKey:"nav.users"},{to:"/admin",icon:nl,labelKey:"nav.admin"}],R0="nestor_sidebar_sections";function Vv(){try{const i=localStorage.getItem(R0);if(i)return JSON.parse(i)}catch{}const n={};for(const i of T0)n[i.key]=i.defaultOpen;return n}function Yv(n){try{localStorage.setItem(R0,JSON.stringify(n))}catch{}}function Xv({onNavigate:n}){const{t:i}=lt(),{user:d,isAdmin:c,logout:m}=pi(),[f,h]=u.useState(Vv);u.useEffect(()=>{Yv(f)},[f]);const b=u.useCallback(p=>{h(S=>({...S,[p]:!S[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(Pa,{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:[Gv.map(p=>{const S=p.icon;return t.jsxs(li,{to:p.to,end:p.to==="/chat",onClick:n,className:g,children:[t.jsx(S,{className:"h-4 w-4 flex-shrink-0"}),i(p.labelKey)]},p.to)}),T0.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(ts,{className:"h-3 w-3"}):t.jsx(oa,{className:"h-3 w-3"}),p.label]}),f[p.key]&&t.jsx("div",{className:"space-y-0.5",children:p.items.map(S=>{const y=S.icon;return t.jsxs(li,{to:S.to,onClick:n,className:g,children:[t.jsx(y,{className:"h-4 w-4 flex-shrink-0"}),i(S.labelKey)]},S.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"}),Kv.map(p=>{const S=p.icon;return t.jsxs(li,{to:p.to,onClick:n,className:g,children:[t.jsx(S,{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(pv,{className:"h-4 w-4"})})]}),t.jsx("p",{className:"mt-2 text-xs text-zinc-600",children:"Nestor v3.2.0"})]})]})}const Qv=["system","agents","runs","approvals"],Zv=10,Jv=1e3,Fv=3e4,Iv=3e4,Pv=200;function Wv(n,i,d){const c=Math.min(i*2**n,d),m=c*Math.random()*.25;return c+m}function ej(){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 cu(n=Qv,i){const{reconnect:d=!0,maxRetries:c=Zv,baseDelay:m=Jv,maxDelay:f=Fv}={},[h,b]=u.useState([]),[g,p]=u.useState("disconnected"),[S,y]=u.useState(0),j=u.useRef(null),k=u.useRef(),C=u.useRef(),w=u.useRef(n),v=u.useRef(!1),z=u.useRef(0);w.current=n;const M=u.useCallback(()=>{k.current&&(clearTimeout(k.current),k.current=void 0)},[]),O=u.useCallback(()=>{C.current&&(clearInterval(C.current),C.current=void 0)},[]),E=u.useCallback(ne=>{O(),C.current=setInterval(()=>{ne.readyState===WebSocket.OPEN&&ne.send(JSON.stringify({type:"ping"}))},Iv)},[O]),te=u.useCallback((ne,J)=>{for(const le of J)ne.readyState===WebSocket.OPEN&&ne.send(JSON.stringify({type:"subscribe",channel:le}))},[]),oe=u.useCallback(ne=>{if(!d||v.current)return;if(z.current>=c){console.warn(`[Nestor WS] Max retries (${c}) reached. Giving up.`),p("disconnected");return}const J=Wv(z.current,m,f);console.info(`[Nestor WS] Reconnecting in ${Math.round(J)}ms (attempt ${z.current+1}/${c})`),p("reconnecting"),M(),k.current=setTimeout(()=>{z.current+=1,y(z.current),ne()},J)},[d,c,m,f,M]),H=u.useCallback(()=>{if(!(j.current&&(j.current.readyState===WebSocket.OPEN||j.current.readyState===WebSocket.CONNECTING)))try{const ne=ej(),J=new WebSocket(ne);j.current=J,p("connecting"),J.onopen=()=>{console.info("[Nestor WS] Connected"),p("connected"),z.current=0,y(0),v.current=!1,te(J,w.current),E(J)},J.onmessage=le=>{try{const fe=JSON.parse(le.data);if(fe.type==="ping"){J.send(JSON.stringify({type:"pong"}));return}if(fe.type==="pong")return;if(fe.type==="event"){const K=fe;b(ie=>[...ie.slice(-(Pv-1)),K])}}catch{}},J.onclose=le=>{if(console.info(`[Nestor WS] Closed (code=${le.code}, reason=${le.reason||"none"})`),j.current=null,O(),v.current){p("disconnected");return}oe(H)},J.onerror=le=>{console.error("[Nestor WS] Error:",le),J.close()}}catch{oe(H)}},[te,E,O,oe]);u.useEffect(()=>(v.current=!1,H(),()=>{v.current=!0,M(),O(),j.current&&(j.current.close(1e3,"Component unmount"),j.current=null)}),[H,M,O]),u.useEffect(()=>{const ne=j.current;!ne||ne.readyState!==WebSocket.OPEN||te(ne,n)},[n,te]);const $=u.useCallback(ne=>{const J=j.current;J&&J.readyState===WebSocket.OPEN&&J.send(JSON.stringify({type:"subscribe",channel:ne}))},[]),I=u.useCallback(ne=>{const J=j.current;J&&J.readyState===WebSocket.OPEN&&J.send(JSON.stringify({type:"unsubscribe",channel:ne}))},[]),W=u.useCallback(()=>{b([])},[]),X=u.useCallback(()=>{v.current=!0,M(),O(),j.current&&(j.current.close(1e3,"Manual close"),j.current=null),p("disconnected")},[M,O]);return{events:h,connected:g==="connected",status:g,retryCount:S,subscribe:$,unsubscribe:I,clearEvents:W,close:X}}const tj="/api";class aj extends Error{constructor(i,d,c){super(`API Error ${i}: ${d}`),this.status=i,this.statusText=d,this.body=c,this.name="ApiError"}}function sj(n){const i=document.cookie.match(new RegExp(`(?:^|; )${n}=([^;]*)`));return i?decodeURIComponent(i[1]):null}async function se(n,i={}){const d=`${tj}${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=sj("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 aj(b.status,b.statusText,g)}if(b.status!==204)return b.json()}const Ls={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 se(`/agents${d?`?${d}`:""}`)},get:n=>se(`/agents/${n}`),create:n=>se("/agents",{method:"POST",body:JSON.stringify(n)}),update:(n,i)=>se(`/agents/${n}`,{method:"PATCH",body:JSON.stringify(i)}),delete:n=>se(`/agents/${n}`,{method:"DELETE"}),run:(n,i)=>se(`/agents/${n}/run`,{method:"POST",body:JSON.stringify({prompt:i})}),getStatus:n=>se(`/agents/${n}/status`),start:(n,i="daemon")=>se(`/agents/${n}/start`,{method:"POST",body:JSON.stringify({mode:i})}),stop:n=>se(`/agents/${n}/stop`,{method:"POST"})},ou={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 se(`/workflows${d?`?${d}`:""}`)},get:n=>se(`/workflows/${n}`),create:n=>se("/workflows",{method:"POST",body:JSON.stringify(n)}),run:(n,i={})=>se(`/workflows/${n}/run`,{method:"POST",body:JSON.stringify({input:i})})},nn={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 se(`/runs${d?`?${d}`:""}`)},get:n=>se(`/runs/${n}`),getEvents:n=>se(`/runs/${n}/events`),abort:n=>se(`/runs/${n}/abort`,{method:"POST"}),delete:n=>se(`/runs/${n}`,{method:"DELETE"})},Vr={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 se(`/skills${d?`?${d}`:""}`)},install:n=>se("/skills/install",{method:"POST",body:JSON.stringify(n)}),scan:n=>se("/skills/scan",{method:"POST",body:JSON.stringify({path:n})}),delete:n=>se(`/skills/${n}`,{method:"DELETE"})},Ca={stats:()=>se("/system/stats"),health:()=>se("/health"),getConfig:()=>se("/system/config"),updateConfig:n=>se("/system/config",{method:"PUT",body:JSON.stringify(n)})},Fn={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 se(`/analytics/summary${d?`?${d}`:""}`)},daily:(n=30)=>se(`/analytics/daily?days=${n}`),budget:()=>se("/analytics/budget"),estimate:()=>se("/analytics/estimate"),agentBreakdown:n=>se(`/analytics/agents/${n}`),qualityOverview:(n=30)=>se(`/analytics/quality?days=${n}`),qualityAgent:(n,i=30)=>se(`/analytics/quality/${n}?days=${i}`)},Td={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 se(`/traces${d?`?${d}`:""}`)},get:n=>se(`/traces/${n}`),clear:()=>se("/traces",{method:"DELETE"})},Lh={list:()=>se("/tenants"),get:n=>se(`/tenants/${n}`),create:n=>se("/tenants",{method:"POST",body:JSON.stringify(n)}),update:(n,i)=>se(`/tenants/${n}`,{method:"PUT",body:JSON.stringify(i)}),delete:n=>se(`/tenants/${n}`,{method:"DELETE"}),switch:n=>se(`/tenants/${n}/switch`,{method:"POST"})},si={tree:()=>se("/goals"),get:n=>se(`/goals/${n}`),create:n=>se("/goals",{method:"POST",body:JSON.stringify(n)}),update:(n,i)=>se(`/goals/${n}`,{method:"PUT",body:JSON.stringify(i)}),delete:n=>se(`/goals/${n}`,{method:"DELETE"}),ancestry:n=>se(`/goals/${n}/ancestry`),assign:(n,i)=>se(`/goals/${n}/assign/${i}`,{method:"POST"}),agentGoals:n=>se(`/agents/${n}/goals`)},ni={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 se(`/approvals${d?`?${d}`:""}`)},create:n=>se("/approvals",{method:"POST",body:JSON.stringify(n)}),get:n=>se(`/approvals/${n}`),approve:(n,i)=>se(`/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)=>se(`/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 se(`/approvals/history${d?`?${d}`:""}`)},stats:()=>se("/approvals/stats")},Rd={forRun:n=>se(`/runs/${n}/annotations`),create:(n,i)=>se(`/runs/${n}/annotate`,{method:"POST",body:JSON.stringify(i)}),delete:n=>se(`/annotations/${n}`,{method:"DELETE"})},Qr={list:n=>{const i=new URLSearchParams;n!=null&&n.status&&i.set("status",n.status);const d=i.toString();return se(`/handoffs${d?`?${d}`:""}`)},get:n=>se(`/handoffs/${n}`),create:(n,i)=>se(`/runs/${n}/handoff`,{method:"POST",body:JSON.stringify(i)}),resume:(n,i)=>se(`/handoffs/${n}/resume`,{method:"POST",body:JSON.stringify({humanResolution:i})})},At={overview:()=>se("/admin/overview"),tenants:{list:()=>se("/tenants"),create:n=>se("/tenants",{method:"POST",body:JSON.stringify(n)}),get:n=>se(`/tenants/${n}`),update:(n,i)=>se(`/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 se(`/users${d?`?${d}`:""}`)},updateRole:(n,i)=>se(`/users/${n}`,{method:"PATCH",body:JSON.stringify({role:i})}),lock:n=>se(`/users/${n}`,{method:"PATCH",body:JSON.stringify({isActive:!1})}),unlock:n=>se(`/users/${n}`,{method:"PATCH",body:JSON.stringify({isActive:!0})})},system:{info:()=>se("/admin/system-info"),dbStats:()=>se("/admin/db-stats"),rateLimitStats:()=>se("/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 se(`/users/audit${d?`?${d}`:""}`)},export:n=>se(`/users/audit?limit=10000&format=${n}`)},security:{failedLogins:(n=24)=>se(`/admin/security/failed-logins?hours=${n}`),lockedAccounts:()=>se("/admin/security/locked-accounts"),activeSessions:()=>se("/admin/security/active-sessions"),rateLimitViolations:(n=100)=>se(`/admin/security/rate-violations?limit=${n}`)}},_h={status:()=>se("/providers/status"),test:n=>se("/providers/test",{method:"POST",body:JSON.stringify(n)})},ba={list:()=>se("/keys"),set:(n,i,d)=>se("/keys",{method:"POST",body:JSON.stringify({provider:n,key:i,label:d})}),remove:n=>se(`/keys/${n}`,{method:"DELETE"}),test:n=>se(`/keys/test/${n}`)},Fa={plan:(n,i)=>se("/missions/plan",{method:"POST",body:JSON.stringify({objective:n,...i})}),list:()=>se("/missions"),get:n=>se(`/missions/${n}`),getReport:(n,i)=>se(`/missions/${n}/report${i==="md"?"?format=md":""}`),cancel:n=>se(`/missions/${n}/cancel`,{method:"POST"}),templates:()=>se("/missions/templates")};function nj({onMenuClick:n,showMenu:i}){const{lang:d,setLang:c,t:m}=lt(),{connected:f}=cu(),[h,b]=u.useState([]),[g,p]=u.useState(()=>localStorage.getItem("nestor_tenant_id")??"default"),[S,y]=u.useState(!1),[j,k]=u.useState(!1),C=u.useRef(null),w=u.useRef(null),v=h.find(E=>E.id===g)??null,z=u.useCallback(async()=>{try{const E=await Lh.list();b(E.data)}catch{}},[]);u.useEffect(()=>{z()},[z]),u.useEffect(()=>{const E=te=>{C.current&&!C.current.contains(te.target)&&y(!1),w.current&&!w.current.contains(te.target)&&k(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]);const M=async E=>{try{await Lh.switch(E.id),localStorage.setItem("nestor_tenant_id",E.id),p(E.id),y(!1),window.location.reload()}catch(te){console.error("Failed to switch tenant:",te)}},O=Object.keys(Gd);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(gv,{className:"h-5 w-5 text-zinc-400"})}),t.jsxs("div",{className:"relative max-w-md flex-1",children:[t.jsx(Ds,{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:C,children:[t.jsxs("button",{onClick:()=>y(!S),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(Wd,{className:"h-3.5 w-3.5 text-indigo-400"}),t.jsx("span",{className:"text-zinc-200 max-w-[120px] truncate",children:(v==null?void 0:v.name)??"Default"}),t.jsx(ts,{className:`h-3.5 w-3.5 text-zinc-500 transition-transform ${S?"rotate-180":""}`})]}),S&&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:()=>M(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(mt,{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(Dv,{className:"h-4 w-4 text-green-400"}):t.jsx(Mv,{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:w,children:[t.jsxs("button",{onClick:()=>k(!j),className:"btn-ghost btn-sm flex items-center gap-1.5",title:"Switch language",children:[t.jsx(tu,{className:"h-4 w-4"}),t.jsx("span",{className:"text-xs uppercase",children:d}),t.jsx(ts,{className:`h-3 w-3 text-zinc-500 transition-transform ${j?"rotate-180":""}`})]}),j&&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:O.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(mt,{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:Gd[E]}),t.jsx("span",{className:"text-xs text-zinc-500 uppercase",children:E})]},E))})]})]})]})}const lj=[{to:"/",icon:Ms,labelKey:"nav.chat"},{to:"/agents",icon:es,labelKey:"nav.agents"},{to:"/dashboard",icon:au,labelKey:"nav.dashboard"},{to:"/runs",icon:Et,labelKey:"nav.history"},{to:"/settings",icon:nl,labelKey:"nav.settings"}];function ij(){const{t:n}=lt();return t.jsx("nav",{className:"mobile-bottom-nav",children:lj.map(i=>{const d=i.icon;return t.jsxs(li,{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 rj(){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(Xv,{onNavigate:m})}),t.jsxs("div",{className:`flex flex-1 flex-col ${d?"":"pl-60"}`,children:[t.jsx(nj,{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(ij,{})]})]})}class cj extends u.Component{constructor(){super(...arguments);yd(this,"state",{hasError:!1,error:null});yd(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 oj(){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 dj={node_started:{icon:Et,color:"text-blue-400"},node_completed:{icon:bt,color:"text-green-400"},node_failed:{icon:Mt,color:"text-red-400"},tool_call_requested:{icon:Pa,color:"text-amber-400"},tool_call_approved:{icon:bt,color:"text-green-400"},tool_call_denied:{icon:Ea,color:"text-red-400"},tool_call_completed:{icon:bt,color:"text-emerald-400"},approval_requested:{icon:Ea,color:"text-amber-400"},approval_resolved:{icon:bt,color:"text-green-400"},budget_warning:{icon:ft,color:"text-amber-400"},budget_exceeded:{icon:da,color:"text-red-400"},run_paused:{icon:Pr,color:"text-blue-400"},run_resumed:{icon:z0,color:"text-blue-400"}};function uj(n){try{return new Date(n).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return n}}function mj(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 du({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(Wn,{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=dj[d.type]??{icon:Pa,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:mj(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:uj(d.timestamp)})]},d.id)})})})}function Dr({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 xj(){const{t:n}=lt(),{events:i}=cu(),[d,c]=u.useState(null),[m,f]=u.useState("healthy"),[h,b]=u.useState(!0),[g,p]=u.useState(null),[S,y]=u.useState(0);u.useEffect(()=>{Ca.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)}),Ca.health().then(z=>{f(z.status==="healthy"?"healthy":"degraded")}).catch(()=>{f("down")});const v=new Date;v.setHours(0,0,0,0),Fn.summary({from:v.getTime()}).then(z=>{var M;y(((M=z.data)==null?void 0:M.totalCostUsd)??0)}).catch(()=>{})},[]),u.useEffect(()=>{if(i.length===0)return;Ca.stats().then(z=>c(z.data)).catch(()=>{});const v=new Date;v.setHours(0,0,0,0),Fn.summary({from:v.getTime()}).then(z=>{var M;y(((M=z.data)==null?void 0:M.totalCostUsd)??0)}).catch(()=>{})},[i.length]);const k={healthy:{icon:bt,color:"text-green-400",bg:"bg-green-500/10",label:"All systems operational"},degraded:{icon:ft,color:"text-amber-400",bg:"bg-amber-500/10",label:"Some services degraded"},down:{icon:Mt,color:"text-red-400",bg:"bg-red-500/10",label:"Services unavailable"}}[m],C=k.icon,w=i.map((v,z)=>{var M;return{id:String(z),type:typeof v.data=="object"&&v.data!==null&&"kind"in v.data?v.data.kind:v.channel,data:v.data??{},timestamp:((M=v.data)==null?void 0:M.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(Dr,{label:n("dashboard.activeAgents"),value:(d==null?void 0:d.agents.total)??0,icon:es,color:"text-indigo-400",bgColor:"bg-indigo-500/10"}),t.jsx(Dr,{label:n("dashboard.runningTasks"),value:(d==null?void 0:d.runs.running)??0,icon:Et,color:"text-emerald-400",bgColor:"bg-emerald-500/10"}),t.jsx(Dr,{label:n("dashboard.costToday"),value:`$${S.toFixed(2)}`,icon:da,color:"text-amber-400",bgColor:"bg-amber-500/10"}),t.jsx(Dr,{label:n("dashboard.skillsInstalled"),value:(d==null?void 0:d.skills.total)??0,icon:Wr,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(It,{className:"h-4 w-4 text-zinc-500"})]}),t.jsx(du,{events:w,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(Ia,{to:"/agents",className:"btn-secondary w-full justify-start",children:[t.jsx(yt,{className:"h-4 w-4"}),n("dashboard.createAgent")]}),t.jsxs(Ia,{to:"/workflows",className:"btn-secondary w-full justify-start",children:[t.jsx(Xr,{className:"h-4 w-4"}),n("dashboard.runWorkflow")]}),t.jsxs(Ia,{to:"/skills",className:"btn-secondary w-full justify-start",children:[t.jsx(di,{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 ${k.bg}`,children:[t.jsx(C,{className:`h-5 w-5 ${k.color}`}),t.jsxs("div",{children:[t.jsx("p",{className:`text-sm font-medium ${k.color}`,children:k.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 fj(){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 Ls.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 hj(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 Ls.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 Uh={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 gi({status:n,pulse:i}){const{t:d}=lt(),c=Uh[n]??Uh.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 pj={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 uu({level:n}){const{t:i}=lt(),d=pj[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 M0({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 gj={anthropic:es,openai:es,local:ov};function bj({agent:n,status:i="idle",budgetSpent:d=0,budgetLimit:c=10}){const m=gj[n.adapterType]??es;return t.jsxs(Ia,{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(gi,{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(uu,{level:n.trustLevel})}),t.jsx("div",{className:"mt-3",children:t.jsx(M0,{spent:d,limit:c})})]})}function rn({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 yj(){const{t:n}=lt(),{agents:i,loading:d,error:c,refetch:m}=fj(),[f,h]=u.useState(!1),[b,g]=u.useState(!1),[p,S]=u.useState({name:"",description:"",adapterType:"anthropic",model:"",trustLevel:"community"}),y=async()=>{if(p.name.trim()){g(!0);try{await Ls.create({name:p.name,description:p.description||void 0,adapterType:p.adapterType,adapterConfig:p.model?{model:p.model}:{},trustLevel:p.trustLevel}),h(!1),S({name:"",description:"",adapterType:"anthropic",model:"",trustLevel:"community"}),m()}catch(j){console.error("Failed to create agent:",j)}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(yt,{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(rn,{icon:t.jsx(es,{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(yt,{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(j=>t.jsx(bj,{agent:j},j.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:j=>S({...p,name:j.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:j=>S({...p,description:j.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:j=>S({...p,adapterType:j.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:j=>S({...p,model:j.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:j=>S({...p,trustLevel:j.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:y,disabled:!p.name.trim()||b,className:"btn-primary",children:n(b?"common.loading":"agents.create")})]})]})})]})}const vj="/api";async function jj(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(`${vj}/agents/${n}/quality`,{headers:d});return m.ok?(await m.json()).data??null:null}catch{return null}}function Bh(n){return`${(n*100).toFixed(0)}%`}function Or({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 Nj({agentId:n}){const[i,d]=u.useState(null),[c,m]=u.useState(!0),f=u.useCallback(async()=>{m(!0);const w=await jj(n);d(w),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(w=>w.rating===1).length,p=i.recentFeedback.length,S=p>0?g/p:0,y=i.satisfactionRate,j=p<3?"stable":S>y+.1?"improving":S<y-.1?"declining":"stable",k=j==="improving"?ru:j==="declining"?Tv:bv,C=j==="improving"?"text-green-400":j==="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 ${C}`,children:[t.jsx(k,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"capitalize",children:j})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[t.jsx(Or,{icon:mi,label:"Satisfaction",value:Bh(i.satisfactionRate),subtext:`${i.positiveFeedback}/${i.totalFeedback} positive`,color:h}),t.jsx(Or,{icon:bt,label:"Success Rate",value:Bh(i.successRate),subtext:`${i.completedRuns} completed, ${i.failedRuns} failed`,color:b}),t.jsx(Or,{icon:da,label:"Avg Cost / Run",value:`$${i.avgCostPerRun.toFixed(4)}`,subtext:`${i.totalRuns} total runs`,color:"text-blue-400"}),t.jsx(Or,{icon:Aa,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((w,v)=>t.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[t.jsx("span",{className:w.rating===1?"text-green-400":"text-red-400",children:w.rating===1?"+":"-"}),t.jsx("span",{className:"text-zinc-400 flex-1",children:w.comment??(w.rating===1?"Positive":"Negative")}),t.jsx("span",{className:"text-zinc-600 shrink-0",children:new Date(w.createdAt).toLocaleDateString()})]},v))})]})]})}function wj({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(il,{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(xt,{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(bt,{className:"h-3.5 w-3.5 text-emerald-400"}):t.jsx(Mt,{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(Mt,{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 Sj({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:S,unsubscribe:y,events:j,connected:k}=cu([`run:${n}`]);return u.useEffect(()=>(k&&S(`run:${n}`),()=>{y(`run:${n}`)}),[k,n,S,y]),u.useEffect(()=>{for(const C of j){if(C.channel!==`run:${n}`)continue;const w=C.data;if(!w||w.runId!==n)continue;const v=w.type,z=++p.current;switch(v){case"token":c(M=>M+(w.text??""));break;case"tool_start":f(M=>[...M,{id:z,type:"tool_start",name:w.name,args:w.args,timestamp:Date.now()}]);break;case"tool_result":f(M=>[...M,{id:z,type:"tool_result",name:w.name,result:w.result,success:w.success,timestamp:Date.now()}]);break;case"reasoning":{const M=w.entry;f(O=>[...O,{id:z,type:"reasoning",reasoning:(M==null?void 0:M.reasoning)??w.reasoning??"",phase:(M==null?void 0:M.phase)??void 0,confidence:(M==null?void 0:M.confidence)??void 0,timestamp:Date.now()}]);break}case"error":f(M=>[...M,{id:z,type:"error",text:w.message,timestamp:Date.now()}]);break;case"done":b(!1),i==null||i();break}}},[j,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(k0,{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(C=>t.jsx(wj,{event:C},C.id))})]})}function kj(){const{id:n}=sl(),i=Dt(),{t:d}=lt(),{agent:c,loading:m,error:f}=hj(n),[h,b]=u.useState("overview"),[g,p]=u.useState(""),[S,y]=u.useState(!1),[j,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(Pn,{className:"h-4 w-4"})," Back to Agents"]})]});const C=async()=>{var z;if(!(!g.trim()||!n)){y(!0);try{const M=await Ls.run(n,g),O=((z=M==null?void 0:M.data)==null?void 0:z.id)??null;k(O),p("")}catch(M){console.error("Run failed:",M)}finally{y(!1)}}},w=async()=>{if(n&&window.confirm(`Delete agent "${c.name}"?`))try{await Ls.delete(n),i("/agents")}catch(z){console.error("Delete failed:",z)}},v=[{key:"overview",label:d("agent.overview"),icon:Aa},{key:"quality",label:"Quality",icon:It},{key:"runs",label:d("agent.runs"),icon:Et},{key:"events",label:d("agent.events"),icon:It},{key:"configuration",label:d("agent.configuration"),icon:nl}];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(Pn,{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(es,{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(gi,{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(uu,{level:c.trustLevel})]})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{className:"btn-secondary btn-sm",children:[t.jsx(Et,{className:"h-3.5 w-3.5"})," ",d("agent.start")]}),t.jsxs("button",{className:"btn-secondary btn-sm",children:[t.jsx(kv,{className:"h-3.5 w-3.5"})," ",d("agent.stop")]}),t.jsxs("button",{onClick:w,className:"btn-danger btn-sm",children:[t.jsx(Gt,{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(C0,{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:z=>p(z.target.value),onKeyDown:z=>z.key==="Enter"&&C()})]}),t.jsxs("button",{onClick:C,disabled:!g.trim()||S,className:"btn-primary",children:[t.jsx(Et,{className:"h-4 w-4"}),d(S?"common.loading":"agent.run")]})]})}),j&&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(k0,{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:[j.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(Sj,{runId:j,onComplete:()=>{}})]}),t.jsx("div",{className:"flex gap-1 border-b border-border",children:v.map(({key:z,label:M,icon:O})=>t.jsxs("button",{onClick:()=>b(z),className:`flex items-center gap-2 px-4 py-2.5 text-sm font-medium transition-colors border-b-2 ${h===z?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-400 hover:text-zinc-200"}`,children:[t.jsx(O,{className:"h-4 w-4"}),M]},z))}),h==="quality"&&n&&t.jsx(Nj,{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(M0,{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(du,{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 zj(){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 ou.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 Cj(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 ou.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}}const Aj=[{id:"tdd-loop",name:"TDD Loop",description:"spec → code → test → fix → repeat",icon:t.jsx(kt,{className:"h-5 w-5"}),color:"text-green-400 bg-green-500/10",entryNodeId:"spec",nodes:[{id:"spec",type:"agent",label:"Write Spec",config:{role:"spec-writer",prompt:"Write a detailed specification for the feature"},next:["code"]},{id:"code",type:"agent",label:"Implement Code",config:{role:"developer",prompt:"Implement the code based on the specification"},next:["test"]},{id:"test",type:"agent",label:"Run Tests",config:{role:"tester",prompt:"Write and run tests against the implementation"},next:["check"]},{id:"check",type:"condition",label:"Tests Pass?",config:{},condition:"result.allPassed === true",next:["done","fix"]},{id:"fix",type:"agent",label:"Fix Issues",config:{role:"developer",prompt:"Fix the failing tests based on error output"},next:["test"]},{id:"done",type:"agent",label:"Complete",config:{role:"reporter",prompt:"Generate a summary of the implementation and test results"},next:[]}]},{id:"content-pipeline",name:"Content Pipeline",description:"research → draft → review → publish",icon:t.jsx(_s,{className:"h-5 w-5"}),color:"text-amber-400 bg-amber-500/10",entryNodeId:"research",nodes:[{id:"research",type:"agent",label:"Research",config:{role:"researcher",prompt:"Research the topic and gather relevant sources and data"},next:["draft"]},{id:"draft",type:"agent",label:"Draft",config:{role:"writer",prompt:"Write a draft based on the research findings"},next:["review"]},{id:"review",type:"agent",label:"Review",config:{role:"editor",prompt:"Review the draft for accuracy, style, and completeness"},next:["publish"]},{id:"publish",type:"agent",label:"Publish",config:{role:"publisher",prompt:"Format and prepare the final content for publication"},next:[]}]},{id:"ralph-3phase",name:"Ralph 3-Phase",description:"spec-writer → planner → builder (with backpressure)",icon:t.jsx(xv,{className:"h-5 w-5"}),color:"text-purple-400 bg-purple-500/10",entryNodeId:"spec-writer",nodes:[{id:"spec-writer",type:"agent",label:"Spec Writer",config:{role:"spec-writer",prompt:"Analyze requirements and produce a detailed technical specification",backpressure:{validator:"spec",strictness:"strict"}},next:["planner"]},{id:"planner",type:"agent",label:"Planner",config:{role:"planner",prompt:"Break the specification into an ordered plan of implementation tasks",backpressure:{validator:"plan",strictness:"strict"}},next:["builder"]},{id:"builder",type:"agent",label:"Builder",config:{role:"builder",prompt:"Execute each task from the plan, implementing the specification",backpressure:{validator:"code",strictness:"normal"}},next:[]}]}];function Ej(){const{t:n}=lt(),{workflows:i,loading:d,error:c,refetch:m}=zj(),[f,h]=u.useState(!1),[b,g]=u.useState(!1),[p,S]=u.useState({name:"",description:""}),[y,j]=u.useState(null),k=v=>{j(v),S({name:v.name,description:v.description})},C=()=>{j(null),S({name:"",description:""})},w=async()=>{if(p.name.trim()){g(!0);try{const v=y?y.nodes:[{id:"start",type:"agent",label:"Start",config:{},next:[]}],z=y?y.entryNodeId:"start";await ou.create({name:p.name,description:p.description||void 0,nodes:v,entryNodeId:z}),h(!1),S({name:"",description:""}),j(null),m()}catch(v){console.error("Failed to create workflow:",v)}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(yt,{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(rn,{icon:t.jsx(Xr,{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(yt,{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(v=>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(Xr,{className:"h-5 w-5"})}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-zinc-200",children:v.name}),t.jsxs("p",{className:"text-xs text-zinc-500",children:["v",v.currentVersion]})]})]}),t.jsx(gi,{status:"idle"})]}),v.description&&t.jsx("p",{className:"mt-3 text-sm text-zinc-400 line-clamp-2",children:v.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(v.updatedAt).toLocaleDateString()]}),t.jsxs("div",{className:"flex gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.jsx(Ia,{to:`/workflows/${v.id}/edit`,className:"btn-ghost btn-sm",children:t.jsx(su,{className:"h-3.5 w-3.5"})}),t.jsx("button",{className:"btn-ghost btn-sm text-green-400",children:t.jsx(Et,{className:"h-3.5 w-3.5"})})]})]})]},v.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-2xl rounded-2xl border border-border bg-surface p-6 shadow-2xl max-h-[90vh] overflow-y-auto",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),C()},className:"btn-ghost btn-sm",children:t.jsx(tt,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"mb-5",children:[t.jsx("p",{className:"text-xs font-medium text-zinc-500 uppercase tracking-wider mb-3",children:"Start from a template"}),t.jsx("div",{className:"grid grid-cols-3 gap-3",children:Aj.map(v=>t.jsxs("button",{onClick:()=>k(v),className:`group text-left rounded-xl border p-3 transition-all ${(y==null?void 0:y.id)===v.id?"border-indigo-500/50 bg-indigo-500/10 ring-1 ring-indigo-500/30":"border-border/50 bg-zinc-900/60 hover:border-indigo-500/30 hover:bg-indigo-500/5"}`,children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[t.jsx("span",{className:`flex h-7 w-7 items-center justify-center rounded-lg ${v.color}`,children:v.icon}),t.jsx("span",{className:"text-sm font-medium text-zinc-200",children:v.name})]}),t.jsx("p",{className:"text-[11px] text-zinc-500 leading-relaxed",children:v.description}),t.jsxs("p",{className:"text-[10px] text-zinc-600 mt-1.5",children:[v.nodes.length," nodes"]})]},v.id))}),y&&t.jsx("button",{onClick:C,className:"mt-2 text-xs text-zinc-500 hover:text-zinc-300 underline",children:"Clear template selection"})]}),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:v=>S({...p,name:v.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:v=>S({...p,description:v.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),C()},className:"btn-secondary",children:n("common.cancel")}),t.jsx("button",{onClick:w,disabled:!p.name.trim()||b,className:"btn-primary",children:n(b?"common.loading":"workflows.create")})]})]})})]})}const $h={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"},Lr={agent:"Agent",tool:"Tool",condition:"Condition",parallel:"Parallel",loop:"Loop",human:"Human"};function Tj(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:S}=m.shift();if(c.has(p))continue;c.add(p);const y=f.get(S)??0;f.set(S,y+1),d.set(p,{x:80+y*220,y:60+S*120});const j=n.find(k=>k.id===p);if(j)for(const k of j.next)c.has(k)||m.push({id:k,depth:S+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 Rj(){const{id:n}=sl(),i=Dt(),{t:d}=lt(),{workflow:c,loading:m,error:f}=Cj(n),[h,b]=u.useState([]),[g,p]=u.useState(),[S,y]=u.useState(null),[j,k]=u.useState(!1),[C,w]=u.useState({label:"",type:"agent"});u.useEffect(()=>{c!=null&&c.nodes&&(b(c.nodes),p(c.entryNodeId))},[c]);const v=u.useMemo(()=>Tj(h,g),[h,g]),z=Math.max(800,...Array.from(v.values()).map(H=>H.x+200)),M=Math.max(400,...Array.from(v.values()).map(H=>H.y+100)),O=u.useMemo(()=>{const H=[];for(const $ of h){const I=v.get($.id);if(I)for(const W of $.next){const X=v.get(W);X&&H.push({from:I,to:X,fromId:$.id,toId:W})}}return H},[h,v]),E=u.useCallback(()=>{if(!C.label.trim())return;const H=`node_${Date.now()}`;b($=>[...$,{id:H,type:C.type,label:C.label,config:{},next:[]}]),h.length===0&&p(H),w({label:"",type:"agent"}),k(!1)},[C,h.length]),te=u.useCallback(H=>{var $;b(I=>I.filter(X=>X.id!==H).map(X=>({...X,next:X.next.filter(ne=>ne!==H)}))),S===H&&y(null),g===H&&p(($=h.find(I=>I.id!==H))==null?void 0:$.id)},[S,g,h]),oe=h.find(H=>H.id===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"})}):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(Pn,{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(Pn,{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(yt,{className:"h-3.5 w-3.5"})," ",d("workflow.addNode")]}),t.jsxs("button",{className:"btn-secondary btn-sm",children:[t.jsx(ec,{className:"h-3.5 w-3.5"})," ",d("workflow.save")]}),t.jsxs("button",{className:"btn-primary btn-sm",children:[t.jsx(Et,{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:z,height:M,className:"w-full",children:[O.map((H,$)=>{const I=H.from.x+80,W=H.from.y+40,X=H.to.x+80,ne=H.to.y,J=(W+ne)/2;return t.jsx("path",{d:`M ${I} ${W} C ${I} ${J}, ${X} ${J}, ${X} ${ne}`,fill:"none",stroke:"#2a2a35",strokeWidth:"2",markerEnd:"url(#arrowhead)"},$)}),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:z,height:M},children:h.map(H=>{const $=v.get(H.id);if(!$)return null;const I=H.id===g,W=H.id===S;return t.jsxs("div",{className:`absolute cursor-pointer rounded-lg border-2 px-4 py-2.5 text-sm transition-all ${$h[H.type]} ${W?"ring-2 ring-indigo-500 ring-offset-2 ring-offset-[#0a0a0f]":""} ${I?"shadow-lg":""}`,style:{left:$.x,top:$.y,width:160},onClick:()=>y(H.id),children:[t.jsx("div",{className:"font-medium text-zinc-200 truncate",children:H.label}),t.jsx("div",{className:"text-xs text-zinc-500 mt-0.5",children:Lr[H.type]}),I&&t.jsx("div",{className:"absolute -top-2 -right-2 h-4 w-4 rounded-full bg-indigo-500 border-2 border-[#0a0a0f]"})]},H.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"})]}),oe&&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:()=>y(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:oe.label,onChange:H=>b($=>$.map(I=>I.id===oe.id?{...I,label:H.target.value}:I))})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:d("common.type")}),t.jsx("select",{className:"input",value:oe.type,onChange:H=>b($=>$.map(I=>I.id===oe.id?{...I,type:H.target.value}:I)),children:Object.entries(Lr).map(([H,$])=>t.jsx("option",{value:H,children:$},H))})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Agent ID"}),t.jsx("input",{className:"input",value:oe.agentId??"",onChange:H=>b($=>$.map(I=>I.id===oe.id?{...I,agentId:H.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:H=>{H.target.value&&b($=>$.map(I=>I.id===oe.id&&!I.next.includes(H.target.value)?{...I,next:[...I.next,H.target.value]}:I))},children:[t.jsx("option",{value:"",children:"Select a node..."}),h.filter(H=>H.id!==oe.id&&!oe.next.includes(H.id)).map(H=>t.jsx("option",{value:H.id,children:H.label},H.id))]}),oe.next.length>0&&t.jsx("div",{className:"mt-2 space-y-1",children:oe.next.map(H=>{const $=h.find(I=>I.id===H);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:($==null?void 0:$.label)??H}),t.jsx("button",{onClick:()=>b(I=>I.map(W=>W.id===oe.id?{...W,next:W.next.filter(X=>X!==H)}:W)),className:"text-zinc-500 hover:text-red-400",children:t.jsx(tt,{className:"h-3 w-3"})})]},H)})})]}),t.jsxs("button",{onClick:()=>te(oe.id),className:"btn-danger w-full",children:[t.jsx(Gt,{className:"h-3.5 w-3.5"}),"Delete Node"]})]})]}),j&&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:C.label,onChange:H=>w({...C,label:H.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(Lr).map(H=>t.jsx("button",{onClick:()=>w({...C,type:H}),className:`rounded-lg border-2 p-2.5 text-center text-xs font-medium transition-colors ${C.type===H?$h[H]:"border-border text-zinc-400 hover:border-zinc-600"}`,children:Lr[H]},H))})]})]}),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:!C.label.trim(),className:"btn-primary",children:d("workflow.addNode")})]})]})})]})}function Mj(){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 Vr.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 Dj({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(Wr,{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(uu,{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(Gt,{className:"h-3.5 w-3.5"})})]})]})}function Oj(){const{t:n}=lt(),{skills:i,loading:d,error:c,refetch:m}=Mj(),[f,h]=u.useState(!1),[b,g]=u.useState(!1),[p,S]=u.useState(""),[y,j]=u.useState({source:"",type:"local",name:"",trustLevel:"community"}),[k,C]=u.useState(null),w=async()=>{if(y.source.trim()){g(!0);try{await Vr.install({source:y.source,type:y.type,name:y.name||void 0,trustLevel:y.trustLevel}),h(!1),j({source:"",type:"local",name:"",trustLevel:"community"}),m()}catch(O){console.error("Failed to install skill:",O)}finally{g(!1)}}},v=async O=>{if(window.confirm("Remove this skill?"))try{await Vr.delete(O),m()}catch(E){console.error("Failed to delete skill:",E)}},z=async()=>{if(y.source.trim())try{const O=await Vr.scan(y.source);C(O)}catch(O){console.error("Scan failed:",O)}},M=i.filter(O=>!p||O.name.toLowerCase().includes(p.toLowerCase())||O.description.toLowerCase().includes(p.toLowerCase())||O.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(yt,{className:"h-4 w-4"}),n("skills.install")]})]}),i.length>0&&t.jsxs("div",{className:"relative max-w-md",children:[t.jsx(Ds,{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:O=>S(O.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(rn,{icon:t.jsx(Wr,{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(yt,{className:"h-4 w-4"}),n("skills.install")]})}):M.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:M.map(O=>t.jsx(Dj,{skill:O,onDelete:v},O.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),C(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:y.source,onChange:O=>j({...y,source:O.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:y.type,onChange:O=>j({...y,type:O.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:y.name,onChange:O=>j({...y,name:O.target.value}),placeholder:"my-skill"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Trust Level"}),t.jsxs("select",{className:"input",value:y.trustLevel,onChange:O=>j({...y,trustLevel:O.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:z,disabled:!y.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),C(null)},className:"btn-secondary",children:n("common.cancel")}),t.jsx("button",{onClick:w,disabled:!y.source.trim()||b,className:"btn-primary",children:n(b?"common.loading":"skills.install")})]})]})]})})]})}function Lj(){const{t:n}=lt(),[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 j={limit:100};b!=="all"&&(j.status=b);const k=await nn.list(j);d(k.data)}catch(j){h(j instanceof Error?j.message:"Failed to fetch runs"),d([])}finally{m(!1)}},[b]);u.useEffect(()=>{p()},[p]);const S=async j=>{try{await nn.abort(j),p()}catch(k){console.error("Abort failed:",k)}},y=async j=>{if(window.confirm("Delete this run record?"))try{await nn.delete(j),d(k=>k.filter(C=>C.id!==j))}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(kt,{className:"h-4 w-4"})}),t.jsx(S0,{className:"h-4 w-4 text-zinc-500"}),t.jsxs("select",{className:"input w-auto",value:b,onChange:j=>g(j.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(rn,{icon:t.jsx(Et,{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(j=>{var C;const k=j.completedAt&&j.startedAt?Math.round((new Date(j.completedAt).getTime()-new Date(j.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(Ia,{to:`/runs/${j.id}`,className:"text-indigo-400 hover:text-indigo-300 font-mono text-xs",children:[j.id.slice(0,8),"..."]})}),t.jsxs("td",{className:"px-5 py-3 text-zinc-300 font-mono text-xs",children:[((C=j.workflowId)==null?void 0:C.slice(0,8))??"—","..."]}),t.jsx("td",{className:"px-5 py-3",children:t.jsx(gi,{status:j.status,pulse:!0})}),t.jsx("td",{className:"px-5 py-3 text-zinc-400 text-xs",children:new Date(j.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:[(j.status==="running"||j.status==="pending")&&t.jsx("button",{onClick:()=>S(j.id),className:"btn-ghost btn-sm text-amber-400",title:"Abort run",children:t.jsx(N0,{className:"h-3.5 w-3.5"})}),(j.status==="completed"||j.status==="failed"||j.status==="cancelled")&&t.jsx("button",{onClick:()=>y(j.id),className:"btn-ghost btn-sm text-zinc-400 hover:text-red-400",title:"Delete run",children:t.jsx(Gt,{className:"h-3.5 w-3.5"})})]})})]},j.id)})})]})})}):null]})}const D0="/api";async function _j(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(`${D0}/runs/${n}/feedback`,{headers:d});return m.ok?(await m.json()).data??[]:[]}async function Hh(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(`${D0}/runs/${n}/feedback`,{method:"POST",headers:f,body:JSON.stringify({rating:i,comment:d||void 0,agentId:c})})}function Uj({runId:n,agentId:i}){const[d,c]=u.useState([]),[m,f]=u.useState(!1),[h,b]=u.useState(null),[g,p]=u.useState(""),[S,y]=u.useState(!1),j=u.useCallback(async()=>{const w=await _j(n);c(w),w.length>0&&(f(!0),b(w[0].rating))},[n]);u.useEffect(()=>{j()},[j]);const k=async w=>{m||(b(w),w===1?(await Hh(n,w,void 0,i),f(!0),j()):y(!0))},C=async()=>{h!==null&&(await Hh(n,h,g||void 0,i),f(!0),y(!1),j())};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(mi,{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(qd,{className:"h-5 w-5"})})]})]}),S&&!m&&t.jsxs("div",{className:"mt-3 flex gap-2",children:[t.jsx("input",{type:"text",value:g,onChange:w=>p(w.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:w=>{w.key==="Enter"&&C()}}),t.jsx("button",{onClick:C,className:"rounded-lg bg-indigo-600 px-3 py-2 text-sm text-white hover:bg-indigo-500 transition-colors",children:t.jsx(nu,{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 Bj={llm_request:{icon:Rs,color:"text-purple-400",bgColor:"bg-purple-500/10",label:"LLM Request"},llm_response:{icon:Ms,color:"text-blue-400",bgColor:"bg-blue-500/10",label:"LLM Response"},tool_call_requested:{icon:il,color:"text-amber-400",bgColor:"bg-amber-500/10",label:"Tool Call"},tool_call_completed:{icon:bt,color:"text-emerald-400",bgColor:"bg-emerald-500/10",label:"Tool Result"},tool_call_denied:{icon:Mt,color:"text-red-400",bgColor:"bg-red-500/10",label:"Tool Denied"},node_started:{icon:Et,color:"text-blue-400",bgColor:"bg-blue-500/10",label:"Step Started"},node_completed:{icon:bt,color:"text-green-400",bgColor:"bg-green-500/10",label:"Step Completed"},node_failed:{icon:Mt,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:Ea,color:"text-amber-400",bgColor:"bg-amber-500/10",label:"Approval Requested"},budget_warning:{icon:ft,color:"text-amber-400",bgColor:"bg-amber-500/10",label:"Budget Warning"},budget_exceeded:{icon:da,color:"text-red-400",bgColor:"bg-red-500/10",label:"Budget Exceeded"},error:{icon:ft,color:"text-red-400",bgColor:"bg-red-500/10",label:"Error"}},$j={icon:Et,color:"text-zinc-400",bgColor:"bg-zinc-500/10",label:"Event"};function Hj(n){try{return new Date(n).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3})}catch{return n}}function qh(n,i){try{return new Date(i).getTime()-new Date(n).getTime()}catch{return 0}}function qj(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 Gj(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 Kj(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 Vj({runId:n}){const[i,d]=u.useState([]),[c,m]=u.useState(!0),[f,h]=u.useState(null),[b,g]=u.useState(-1),[p,S]=u.useState(!1),[y,j]=u.useState(1),k=u.useRef(null),C=u.useRef(null),w=u.useRef(new Map);u.useEffect(()=>{let W=!1;return m(!0),h(null),nn.getEvents(n).then(X=>{W||d(X.data.sort((ne,J)=>new Date(ne.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 v=u.useCallback(()=>{S(!1),k.current&&(clearTimeout(k.current),k.current=null)},[]),z=u.useCallback(()=>{g(W=>{const X=W+1;if(X>=i.length)return v(),W;const ne=i[W]??i[0],J=i[X];if(ne&&J){const le=qh(ne.timestamp,J.timestamp),fe=Math.max(50,Math.min(le/y,2e3/y));k.current=setTimeout(z,fe)}return X})},[i,y,v]),M=u.useCallback(()=>{i.length!==0&&(S(!0),g(W=>{const X=W>=i.length-1?0:W,ne=300/y;return k.current=setTimeout(z,ne),X}))},[i,y,z]),O=u.useCallback(()=>{p?v():M()},[p,v,M]),E=u.useCallback(()=>{v(),g(W=>Math.min(W+1,i.length-1))},[i.length,v]),te=u.useCallback(()=>{v(),g(W=>Math.max(W-1,0))},[v]),oe=u.useCallback(W=>{v(),g(W)},[v]),H=u.useCallback(()=>{j(W=>{const X=[1,2,4,8],ne=X.indexOf(W);return X[(ne+1)%X.length]})},[]);if(u.useEffect(()=>{if(b>=0){const W=w.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 $=i.length>0?(b+1)/i.length*100:0,I=b>=0?Kj(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:te,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(wv,{className:"h-4 w-4"})}),t.jsx("button",{onClick:O,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(Pr,{className:"h-4 w-4"}):t.jsx(Et,{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(Sv,{className:"h-4 w-4"})}),t.jsxs("button",{onClick:H,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:[y,"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(),ne=(W.clientX-X.left)/X.width,J=Math.round(ne*(i.length-1));oe(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:`${$}%`}}),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(${$}% - 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(da,{className:"h-3 w-3"}),I.toFixed(4)]})]}),t.jsx("div",{ref:C,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 ne=Bj[W.type]??$j,J=ne.icon,le=X===b,fe=b<0||X<=b,K=Gj(W),ie=X>0?qh(i[X-1].timestamp,W.timestamp):0;return t.jsxs("div",{ref:me=>{me&&w.current.set(X,me)},className:`
576
+ flex items-start gap-3 px-4 py-3 cursor-pointer transition-all duration-200
577
+ ${le?"bg-indigo-500/10 border-l-2 border-l-indigo-500":"border-l-2 border-l-transparent"}
578
+ ${fe?"opacity-100":"opacity-30"}
579
+ hover:bg-zinc-800/50
580
+ `,onClick:()=>oe(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 ${ne.bgColor}`,children:t.jsx(J,{className:`h-3.5 w-3.5 ${ne.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 ${ne.color}`,children:ne.label}),t.jsx("span",{className:"text-[10px] font-mono text-zinc-600",children:Hj(W.timestamp)}),ie>0&&t.jsxs("span",{className:"text-[10px] text-zinc-600",children:["+",qj(ie)]})]}),K&&fe&&t.jsx("pre",{className:`mt-1 text-xs whitespace-pre-wrap break-words ${le?"text-zinc-200":"text-zinc-500"} max-h-40 overflow-hidden`,children:K.length>500?K.slice(0,500)+"...":K})]}),le&&t.jsx(oa,{className:"mt-1.5 h-3.5 w-3.5 shrink-0 text-indigo-400"})]},W.id)})})})]})}function Yj(){const{id:n}=sl(),i=Dt(),{t:d}=lt(),[c,m]=u.useState(null),[f,h]=u.useState([]),[b,g]=u.useState([]),[p,S]=u.useState([]),[y,j]=u.useState(!0),[k,C]=u.useState(null),[w,v]=u.useState(null),[z,M]=u.useState(""),[O,E]=u.useState("details"),te=u.useCallback(async()=>{if(n)try{const J=await nn.get(n);m(J.data)}catch(J){C(J instanceof Error?J.message:"Failed to load run")}},[n]),oe=u.useCallback(async()=>{if(n)try{const J=await nn.getEvents(n);h(J.data)}catch{}},[n]),H=u.useCallback(async()=>{if(n)try{const J=await Rd.forRun(n);g(J.data)}catch{}},[n]),$=u.useCallback(async()=>{if(n)try{const J=await Qr.list();S(J.data.filter(le=>le.runId===n))}catch{}},[n]);u.useEffect(()=>{n&&(j(!0),C(null),Promise.all([te(),oe(),H(),$()]).finally(()=>{j(!1)}))},[n,te,oe,H,$]),u.useEffect(()=>{if(!c||c.status==="completed"||c.status==="failed"||c.status==="cancelled")return;const J=setInterval(()=>{te(),oe()},3e3);return()=>clearInterval(J)},[c==null?void 0:c.status,te,oe]);const I=async()=>{if(n)try{await nn.abort(n),te()}catch(J){console.error("Abort failed:",J)}};if(y)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(Pn,{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(bt,{className:"h-5 w-5 text-green-400"}):c.status==="failed"?t.jsx(Mt,{className:"h-5 w-5 text-red-400"}):t.jsx(Et,{className:"h-5 w-5 text-blue-400"}),ne=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(Pn,{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(gi,{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:()=>{te(),oe()},className:"btn-ghost btn-sm",children:t.jsx(kt,{className:"h-3.5 w-3.5"})}),ne&&t.jsxs("button",{onClick:I,className:"btn-danger btn-sm",children:[t.jsx(N0,{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(Cv,{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(da,{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(Wn,{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 ${O==="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 ${O==="replay"?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-500 hover:text-zinc-300"}`,children:[t.jsx(Et,{className:"h-3.5 w-3.5"}),"Replay"]})]}),O==="replay"&&t.jsx(Vj,{runId:n}),O==="details"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[t.jsx(Uj,{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(du,{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(oi,{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:z,onChange:le=>M(le.target.value)}),t.jsx("button",{className:"btn-primary btn-sm",disabled:!z.trim(),onClick:async()=>{try{await Qr.resume(J.id,z),M(""),$()}catch(le){console.error("Resume failed:",le)}},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:()=>v(w?null:{type:"note",content:""}),children:w?"Cancel":"+ Add"})]}),w&&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 le={good:t.jsx(mi,{className:"h-3.5 w-3.5"}),bad:t.jsx(qd,{className:"h-3.5 w-3.5"}),wrong_approach:t.jsx(Mh,{className:"h-3.5 w-3.5"}),note:t.jsx(Ms,{className:"h-3.5 w-3.5"})},fe={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 ${w.type===J?fe[J]+" bg-zinc-800":"border-zinc-700 text-zinc-500 hover:text-zinc-300"}`,onClick:()=>v({...w,type:J}),children:[le[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:w.content,onChange:J=>v({...w,content:J.target.value})}),t.jsx("button",{className:"btn-primary btn-sm",disabled:!w.content.trim(),onClick:async()=>{if(!(!n||!w.content.trim()))try{await Rd.create(n,{type:w.type,content:w.content}),v(null),H()}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 le={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"},fe={good:t.jsx(mi,{className:"h-3.5 w-3.5 text-green-400"}),bad:t.jsx(qd,{className:"h-3.5 w-3.5 text-red-400"}),wrong_approach:t.jsx(Mh,{className:"h-3.5 w-3.5 text-amber-400"}),note:t.jsx(Ms,{className:"h-3.5 w-3.5 text-blue-400"}),handoff:t.jsx(oi,{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 ${le[J.type]??"border-zinc-700"}`,children:[t.jsx("span",{className:"mt-0.5",children:fe[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 Rd.delete(J.id),H()}catch(K){console.error("Delete failed:",K)}},children:t.jsx(Mt,{className:"h-3.5 w-3.5"})})]},J.id)})})]})]})]})}function Xj(){const{t:n}=lt(),[i,d]=u.useState("general"),[c,m]=u.useState(null),[f,h]=u.useState(!0),[b,g]=u.useState(!1),[p,S]=u.useState(!1),[y,j]=u.useState(null);u.useEffect(()=>{Ca.getConfig().then(z=>m(z.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),S(!1),j(null);try{const z=await Ca.updateConfig(c);m(z.data),S(!0),setTimeout(()=>S(!1),3e3)}catch(z){j(z instanceof Error?z.message:"Failed to save")}finally{g(!1)}}},C=async()=>{h(!0);try{const z=await Ca.getConfig();m(z.data),j(null)}catch{j("Failed to refresh config")}finally{h(!1)}},w=(z,M,O)=>{c&&m({...c,[z]:{...c[z],[M]:O}})},v=[{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(mt,{className:"h-4 w-4"}),n("settings.saved")]}),y&&t.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-red-400",children:[t.jsx(ci,{className:"h-4 w-4"}),y]}),t.jsx("button",{onClick:C,className:"btn-ghost btn-sm",children:t.jsx(kt,{className:"h-4 w-4"})}),t.jsxs("button",{onClick:k,disabled:b,className:"btn-primary",children:[t.jsx(ec,{className:"h-4 w-4"}),n(b?"common.loading":"settings.save")]})]})]}),t.jsx("div",{className:"flex gap-1 border-b border-border",children:v.map(({key:z,label:M})=>t.jsx("button",{onClick:()=>d(z),className:`px-4 py-2.5 text-sm font-medium transition-colors border-b-2 ${i===z?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-400 hover:text-zinc-200"}`,children:M},z))}),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:z=>w("server","host",z.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:z=>w("server","port",parseInt(z.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:z=>w("logging","level",z.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:z=>w("logging","format",z.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:z=>w("security","defaultTrustLevel",z.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:z=>w("security","approvalMode",z.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:z=>w("security","maxConcurrentRuns",parseInt(z.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:z=>w("budget","enabled",z.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:z=>w("budget","defaultMaxCostPerRunUsd",parseFloat(z.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:z=>w("budget","defaultMaxTokensPerRun",parseInt(z.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:z=>w("budget","warningThresholdPercent",parseInt(z.target.value)||80)})]})]})]}),i==="apikeys"&&t.jsx(Qj,{}),i==="studio"&&t.jsxs("div",{className:"card space-y-6",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(yv,{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 Gh=[{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 Qj(){const[n,i]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(null),[h,b]=u.useState(""),[g,p]=u.useState(!1),[S,y]=u.useState(null),[j,k]=u.useState(null),[C,w]=u.useState({}),v=u.useCallback(async()=>{try{const $=await ba.list();i($.data)}catch{}finally{c(!1)}},[]);u.useEffect(()=>{v()},[v]);const z=$=>n.find(I=>I.provider===$),M=$=>{f($),b(""),p(!1)},O=()=>{f(null),b(""),p(!1)},E=async $=>{if(h.trim()){y($);try{await ba.set($,h.trim()),f(null),b(""),await v()}catch{}finally{y(null)}}},te=async $=>{k($);try{const I=await ba.test($);w(W=>({...W,[$]:I.data}))}catch(I){w(W=>({...W,[$]:{valid:!1,message:I instanceof Error?I.message:"Test failed"}}))}finally{k(null)}},oe=async $=>{try{await ba.remove($),w(I=>{const W={...I};return delete W[$],W}),await v()}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 H=n.filter($=>$.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(Os,{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:[H,"/",Gh.length," providers configured."]})]})]})}),t.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Gh.map($=>{const I=z($.id),W=(I==null?void 0:I.configured)??!1,X=m===$.id,ne=j===$.id,J=S===$.id,le=C[$.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:$.emoji}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold text-white",children:$.name}),t.jsx("p",{className:"text-xs text-zinc-500",children:$.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(mt,{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:$.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:fe=>b(fe.target.value),placeholder:`Enter ${$.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(eu,{className:"h-3.5 w-3.5"}):t.jsx(Ir,{className:"h-3.5 w-3.5"})})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{onClick:()=>E($.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(xt,{className:"h-3 w-3 animate-spin"}):t.jsx(mt,{className:"h-3 w-3"}),"Save"]}),t.jsx("button",{onClick:O,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"})]})]}),le&&t.jsxs("div",{className:`mb-3 rounded-lg border p-2.5 text-xs ${le.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:[le.valid?t.jsx(mt,{className:"h-3 w-3"}):t.jsx(ci,{className:"h-3 w-3"}),le.valid?"Working":"Failed"]}),t.jsx("p",{className:"mt-0.5 text-[10px] opacity-80",children:le.message}),le.models&&le.models.length>0&&t.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1",children:[le.models.slice(0,4).map(fe=>t.jsx("span",{className:"rounded bg-white/5 px-1.5 py-0.5 text-[9px] font-mono",children:fe},fe)),le.models.length>4&&t.jsxs("span",{className:"rounded bg-white/5 px-1.5 py-0.5 text-[9px]",children:["+",le.models.length-4]})]})]}),t.jsx("div",{className:"flex items-center gap-2",children:W&&!X?t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:()=>te($.id),disabled:ne,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:[ne?t.jsx(xt,{className:"h-3 w-3 animate-spin"}):t.jsx(ui,{className:"h-3 w-3"}),"Test"]}),$.needsKey&&t.jsxs("button",{onClick:()=>M($.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(hi,{className:"h-3 w-3"}),"Edit"]}),(I==null?void 0:I.source)==="db"&&t.jsxs("button",{onClick:()=>oe($.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(Gt,{className:"h-3 w-3"}),"Remove"]})]}):X?null:$.needsKey?t.jsxs("button",{onClick:()=>M($.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(yt,{className:"h-3 w-3"}),"Add Key"]}):t.jsxs("button",{onClick:()=>te($.id),disabled:ne,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:[ne?t.jsx(xt,{className:"h-3 w-3 animate-spin"}):t.jsx(ui,{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:$.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(In,{className:"h-2.5 w-2.5"}),"Get API Key at ",$.keyUrlLabel]})})]},$.id)})})]})}const Kh={low:{bg:"bg-green-500/10",text:"text-green-400",icon:iu},medium:{bg:"bg-amber-500/10",text:"text-amber-400",icon:ft},high:{bg:"bg-orange-500/10",text:"text-orange-400",icon:Ea},critical:{bg:"bg-red-500/10",text:"text-red-400",icon:av}},mu={command:"Command",budget:"Budget",config:"Config",hire:"Hire",strategy:"Strategy",deploy:"Deploy",custom:"Custom"},Zj={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 Vh({approval:n,onApprove:i,onReject:d,actionLoading:c,showActions:m}){const[f,h]=u.useState(""),b=Kh[n.riskLevel]??Kh.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:mu[n.type]??n.type}),n.status!=="pending"&&t.jsx("span",{className:`badge ${Zj[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(Ms,{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:S=>h(S.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(mt,{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 Jj({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:mu[c]??c}),t.jsx("span",{className:"font-medium text-zinc-200",children:m})]},c))})]})]})}function Fj(){const{t:n}=lt(),[i,d]=u.useState("pending"),[c,m]=u.useState([]),[f,h]=u.useState([]),[b,g]=u.useState(null),[p,S]=u.useState(!0),[y,j]=u.useState(null),[k,C]=u.useState(null),[w,v]=u.useState(""),[z,M]=u.useState(""),O=u.useCallback(async()=>{try{j(null);const $={status:"pending"};w&&($.type=w);let W=(await ni.list($)).data;z&&(W=W.filter(X=>X.riskLevel===z)),m(W)}catch($){j($ instanceof Error?$.message:"Failed to fetch approvals"),m([])}finally{S(!1)}},[w,z]),E=u.useCallback(async()=>{try{const $=await ni.history({limit:100});h($.data)}catch{h([])}},[]),te=u.useCallback(async()=>{try{const $=await ni.stats();g($.data)}catch{g(null)}},[]);u.useEffect(()=>{i==="pending"?O():i==="history"?E():i==="stats"&&te()},[i,O,E,te]),u.useEffect(()=>{if(i==="pending"){const $=setInterval(O,5e3);return()=>clearInterval($)}},[i,O]);const oe=async($,I)=>{C($);try{await ni.approve($,{comment:I||void 0}),m(W=>W.filter(X=>X.id!==$))}catch(W){console.error("Approve failed:",W)}finally{C(null)}},H=async($,I)=>{C($);try{await ni.reject($,{reason:I||void 0}),m(W=>W.filter(X=>X.id!==$))}catch(W){console.error("Reject failed:",W)}finally{C(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"?O():i==="history"?E():te()},className:"btn-ghost btn-sm",children:t.jsx(kt,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:[{key:"pending",label:"Pending",icon:Ea},{key:"history",label:"History",icon:Dh},{key:"stats",label:"Stats",icon:Aa}].map(({key:$,label:I,icon:W})=>t.jsxs("button",{onClick:()=>d($),className:`flex items-center gap-2 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors ${i===$?"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]},$))}),i==="pending"&&t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(S0,{className:"h-4 w-4 text-zinc-500"}),t.jsxs("select",{value:w,onChange:$=>v($.target.value),className:"input text-sm w-40",children:[t.jsx("option",{value:"",children:"All Types"}),Object.entries(mu).map(([$,I])=>t.jsx("option",{value:$,children:I},$))]}),t.jsxs("select",{value:z,onChange:$=>M($.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"})]})]}),y&&t.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-4 text-sm text-red-400",children:[y,t.jsx("button",{onClick:O,className:"ml-3 underline",children:"Retry"})]}),i==="pending"&&(c.length===0&&!y?t.jsx(rn,{icon:t.jsx(iu,{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($=>t.jsx(Vh,{approval:$,onApprove:oe,onReject:H,actionLoading:k,showActions:!0},$.id))})),i==="history"&&(f.length===0?t.jsx(rn,{icon:t.jsx(Dh,{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($=>t.jsx(Vh,{approval:$,actionLoading:null,showActions:!1},$.id))})),i==="stats"&&b&&t.jsx(Jj,{stats:b})]})}const Ij="/api";async function Pj(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(`${Ij}/analytics/quality?days=${n}`,{headers:d});return m.ok?(await m.json()).data??null:null}catch{return null}}function tc(n){return`${(n*100).toFixed(0)}%`}function O0(n){return n>0?`+${(n*100).toFixed(0)}%`:`${(n*100).toFixed(0)}%`}function _r({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 Wj({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}: ${tc(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 e1({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:tc(i.successRate)})]},i.agentId)})})}function t1({items:n}){return n.length===0?t.jsxs("div",{className:"flex items-center gap-2 text-sm text-zinc-500",children:[t.jsx(bt,{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(ft,{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?tc(i.metric):O0(i.metric)})]},i.agentId))})}function a1({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(il,{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 s1({errors:n}){return n.length===0?t.jsxs("div",{className:"flex items-center gap-2 text-sm text-zinc-500",children:[t.jsx(bt,{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(v0,{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 n1(){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 S(){c(!0),f(null);const y=await Pj(h);y?i(y):f("Failed to load quality metrics"),c(!1)}S()},[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(ft,{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(S=>t.jsxs("button",{onClick:()=>b(S),className:`px-3 py-1 text-xs rounded-lg transition-colors ${h===S?"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:[S,"d"]},S))}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[t.jsx(_r,{label:"Total Runs",value:String(n.totalRuns),icon:It,color:"text-blue-400",bgColor:"bg-blue-400/10",subtitle:`Last ${h} days`}),t.jsx(_r,{label:"Success Rate",value:tc(n.overallSuccessRate),icon:bt,color:p,bgColor:n.overallSuccessRate>=.8?"bg-emerald-400/10":"bg-amber-400/10"}),t.jsx(_r,{label:"Feedback Score",value:O0(n.overallFeedbackScore),icon:mi,color:g,bgColor:n.overallFeedbackScore>=0?"bg-emerald-400/10":"bg-red-400/10"}),t.jsx(_r,{label:"Active Agents",value:`${n.activeAgents} / ${n.totalAgents}`,icon:ll,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(Aa,{className:"h-4 w-4 text-zinc-400"}),t.jsx("h2",{className:"text-lg font-medium text-white",children:"Success Rate Trend"})]}),t.jsx(Wj,{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(ru,{className:"h-4 w-4 text-zinc-400"}),t.jsx("h2",{className:"text-lg font-medium text-white",children:"Top Performers"})]}),t.jsx(e1,{agents:n.topPerformers})]}),t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[t.jsx(ft,{className:"h-4 w-4 text-zinc-400"}),t.jsx("h2",{className:"text-lg font-medium text-white",children:"Needs Attention"})]}),t.jsx(t1,{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(il,{className:"h-4 w-4 text-zinc-400"}),t.jsx("h2",{className:"text-lg font-medium text-white",children:"Tool Performance"})]}),t.jsx(a1,{tools:n.toolPerformance})]}),t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[t.jsx(v0,{className:"h-4 w-4 text-zinc-400"}),t.jsx("h2",{className:"text-lg font-medium text-white",children:"Error Patterns"})]}),t.jsx(s1,{errors:n.errorPatterns})]})]})]})}function Ur({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 ii={"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 l1(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 i1({data:n,period:i,onPeriodChange:d}){const c=ii[i],m=l1(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(ii).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:ii[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),S=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 ${S?"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 As(n){return n<.01?`$${n.toFixed(4)}`:n<1?`$${n.toFixed(3)}`:`$${n.toFixed(2)}`}function Yh(n){return n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:String(n)}function r1(){const{t:n}=lt(),[i,d]=u.useState(null),[c,m]=u.useState([]),[f,h]=u.useState([]),[b,g]=u.useState(null),[p,S]=u.useState("30d"),[y,j]=u.useState(!0),[k,C]=u.useState(null);if(u.useEffect(()=>{async function v(){try{j(!0),C(null);const[z,M,O,E]=await Promise.all([Fn.summary(),Fn.daily(ii[p].days),Fn.budget(),Fn.estimate()]);d(z.data),m(M.data),h(O.data),g(E.data)}catch(z){C(z instanceof Error?z.message:"Failed to load analytics")}finally{j(!1)}}v()},[p]),y)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(ft,{className:"h-8 w-8 text-amber-500"}),t.jsx("p",{className:"text-zinc-400",children:k})]});const w=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(Ur,{label:n("analytics.totalSpend"),value:As((i==null?void 0:i.totalCostUsd)??0),icon:da,color:"text-emerald-400",bgColor:"bg-emerald-400/10"}),t.jsx(Ur,{label:n("analytics.totalRuns"),value:String((i==null?void 0:i.totalRuns)??0),icon:It,color:"text-blue-400",bgColor:"bg-blue-400/10",subtitle:`${Yh((i==null?void 0:i.totalTokens)??0)} tokens`}),t.jsx(Ur,{label:n("analytics.avgCostPerRun"),value:As(w),icon:nv,color:"text-amber-400",bgColor:"bg-amber-400/10"}),t.jsx(Ur,{label:n("analytics.monthlyEstimate"),value:As((b==null?void 0:b.estimatedUsd)??0),icon:ru,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(Aa,{className:"h-4 w-4 text-zinc-400"}),t.jsxs("h2",{className:"text-lg font-medium text-white",children:[n("analytics.dailyCosts")," (",ii[p].label,")"]})]}),t.jsx(i1,{data:c,period:p,onPeriodChange:v=>{S(v)}})]}),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(v=>t.jsxs("tr",{className:"border-b border-border/50 hover:bg-surface-hover",children:[t.jsx("td",{className:"py-2 text-white",children:v.agentName}),t.jsx("td",{className:"py-2 text-right text-zinc-300",children:v.runs}),t.jsx("td",{className:"py-2 text-right text-zinc-300",children:As(v.costUsd)}),t.jsx("td",{className:"py-2 text-right text-zinc-300",children:As(v.runs>0?v.costUsd/v.runs:0)})]},v.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(v=>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:v.model}),t.jsx("td",{className:"py-2 text-right text-zinc-300",children:Yh(v.tokens)}),t.jsx("td",{className:"py-2 text-right text-zinc-300",children:As(v.costUsd)})]},v.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(v=>t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("span",{className:"text-sm text-zinc-300 w-32 truncate",children:v.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 ${v.percent>=90?"bg-red-500":v.percent>=70?"bg-amber-500":"bg-indigo-500"}`,style:{width:`${Math.min(v.percent,100)}%`}})}),t.jsxs("span",{className:"text-xs text-zinc-400 w-24 text-right",children:[As(v.spentUsd)," / ",As(v.budgetUsd)]}),t.jsxs("span",{className:`text-xs font-medium w-12 text-right ${v.percent>=90?"text-red-400":v.percent>=70?"text-amber-400":"text-zinc-400"}`,children:[v.percent.toFixed(0),"%"]})]},v.agentId))})]})]})}function c1(){const{t:n}=lt(),[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(da,{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(bt,{className:"h-4 w-4"}),"Quality"]})})]}),i==="costs"&&t.jsx(r1,{}),i==="quality"&&t.jsx(n1,{})]})}function L0(n){return new Date(n).toLocaleString()}function xu(n){return n===void 0?"--":n<1e3?`${n}ms`:n<6e4?`${(n/1e3).toFixed(1)}s`:`${(n/6e4).toFixed(1)}m`}function fu(n){switch(n){case"ok":return t.jsx(bt,{className:"h-4 w-4 text-emerald-400"});case"error":return t.jsx(Mt,{className:"h-4 w-4 text-red-400"});default:return t.jsx(ft,{className:"h-4 w-4 text-zinc-500"})}}function _0(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:[fu(n),n]})}function o1({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 d1({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(ts,{className:"h-3 w-3 text-zinc-500"}):t.jsx(oa,{className:"h-3 w-3 text-zinc-500"}):t.jsx("span",{className:"w-3"}),fu(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:xu(n.durationMs)}),t.jsx("td",{className:"py-2 px-3 w-1/3",children:t.jsx(o1,{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,S])=>t.jsxs("span",{className:"text-zinc-500 ml-2",children:[p,"=",String(S)]},p))]},g))]})]})})})]})}function u1(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 U0(n,i=0){const d=[];for(const c of n)d.push({span:c.span,depth:i}),d.push(...U0(c.children,i+1));return d}function m1({trace:n}){const i=n.startTime,d=n.durationMs??1,c=u1(n.spans),m=U0(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:[L0(n.startTime)," · ",n.spanCount," spans · ",xu(n.durationMs)]})]}),_0(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(d1,{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 x1(){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),[S,y]=u.useState(null),j=u.useCallback(async()=>{b(!0),y(null);try{const w=await Td.list();i(w.data),p(w.meta.tracingEnabled)}catch(w){y(w instanceof Error?w.message:"Failed to load traces")}finally{b(!1)}},[]);u.useEffect(()=>{j()},[j]);const k=u.useCallback(async w=>{if(m===w){f(null),c(null);return}f(w);try{const v=await Td.get(w);c(v.data)}catch{c(null)}},[m]),C=async()=>{try{await Td.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(ft,{className:"h-3 w-3"}),"Tracing disabled"]}),t.jsxs("button",{onClick:j,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(kt,{className:"h-3.5 w-3.5"}),"Refresh"]}),t.jsxs("button",{onClick:C,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(Gt,{className:"h-3.5 w-3.5"}),"Clear"]})]})]}),S&&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:S})}),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(It,{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(w=>t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>k(w.traceId),className:`w-full flex items-center justify-between rounded-lg border px-4 py-3 text-left transition-colors ${m===w.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===w.traceId?t.jsx(ts,{className:"h-4 w-4 text-zinc-500 flex-shrink-0"}):t.jsx(oa,{className:"h-4 w-4 text-zinc-500 flex-shrink-0"}),fu(w.status),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium text-white truncate",children:w.rootSpanName}),t.jsx("p",{className:"text-xs text-zinc-500",children:L0(w.startTime)})]})]}),t.jsxs("div",{className:"flex items-center gap-4 flex-shrink-0",children:[t.jsxs("span",{className:"text-xs text-zinc-500",children:[w.spanCount," span",w.spanCount!==1?"s":""]}),t.jsx("span",{className:"text-xs font-mono text-zinc-400 w-16 text-right",children:xu(w.durationMs)}),_0(w.status)]})]}),m===w.traceId&&d&&t.jsx("div",{className:"mt-2 ml-4",children:t.jsx(m1,{trace:d})})]},w.traceId))})]})}function B0(){const{login:n,register:i}=pi(),d=Dt(),[c,m]=u.useState("login"),[f,h]=u.useState(""),[b,g]=u.useState(""),[p,S]=u.useState(""),[y,j]=u.useState(""),[k,C]=u.useState(!1),w=async v=>{v.preventDefault(),j(""),C(!0);try{c==="register"?(await i(f,b,p),await n(f,b)):await n(f,b),d("/",{replace:!0})}catch(z){j(z.message||"An error occurred.")}finally{C(!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(Pa,{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:w,className:"space-y-4",children:[y&&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(ci,{className:"h-4 w-4 flex-shrink-0"}),y]}),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:v=>S(v.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:v=>h(v.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:v=>g(v.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(hv,{className:"h-4 w-4"})," Sign In"]}):t.jsxs(t.Fragment,{children:[t.jsx(Rv,{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"),j("")},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 f1(){const{isAdmin:n}=pi(),[i,d]=u.useState([]),[c,m]=u.useState([]),[f,h]=u.useState("users"),[b,g]=u.useState(!0),[p,S]=u.useState(""),y=u.useCallback(async()=>{try{const w=await fetch("/api/users",{credentials:"include"}),v=await w.json();w.ok&&d(v.data||[])}catch{}},[]),j=u.useCallback(async()=>{try{const w=await fetch("/api/users/audit?limit=50",{credentials:"include"}),v=await w.json();w.ok&&m(v.data||[])}catch{}},[]);u.useEffect(()=>{g(!0),Promise.all([y(),j()]).finally(()=>g(!1))},[y,j]);const k=async(w,v)=>{var z;S("");try{const M=await fetch(`/api/users/${w}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({role:v})});if(!M.ok){const O=await M.json();throw new Error(((z=O.error)==null?void 0:z.message)||"Failed to update role.")}await y()}catch(M){S(M.message)}},C=async w=>{var v;if(confirm("Are you sure you want to delete this user?")){S("");try{const z=await fetch(`/api/users/${w}`,{method:"DELETE",credentials:"include"});if(!z.ok){const M=await z.json();throw new Error(((v=M.error)==null?void 0:v.message)||"Failed to delete user.")}await y()}catch(z){S(z.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(ll,{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(_s,{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(w=>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:w.name}),t.jsx("td",{className:"px-4 py-3 text-zinc-300",children:w.email}),t.jsx("td",{className:"px-4 py-3",children:t.jsxs("select",{value:w.role,onChange:v=>k(w.id,v.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:w.authProvider}),t.jsx("td",{className:"px-4 py-3 text-zinc-400",children:w.lastLoginAt?new Date(w.lastLoginAt*1e3).toLocaleString():"Never"}),t.jsx("td",{className:"px-4 py-3 text-right",children:t.jsx("button",{onClick:()=>C(w.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(Gt,{className:"h-4 w-4"})})})]},w.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(w=>{var v;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(w.createdAt*1e3).toLocaleString()}),t.jsx("td",{className:"px-4 py-3 font-mono text-xs text-indigo-400",children:w.action}),t.jsx("td",{className:"px-4 py-3 text-zinc-300",children:w.resourceType&&t.jsxs("span",{children:[w.resourceType,w.resourceId?`/${w.resourceId.slice(0,8)}`:""]})}),t.jsx("td",{className:"px-4 py-3 text-zinc-400",children:((v=w.userId)==null?void 0:v.slice(0,8))||"-"}),t.jsx("td",{className:"px-4 py-3 text-xs text-zinc-500 max-w-xs truncate",children:w.details?JSON.stringify(w.details):"-"})]},w.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(Os,{className:"mr-2 h-5 w-5"})," Admin access required."]})}function Md({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 h1(){const{id:n}=sl(),[i,d]=u.useState([]),[c,m]=u.useState([]),[f,h]=u.useState(!0),[b,g]=u.useState(""),[p,S]=u.useState(!1),[y,j]=u.useState(""),[k,C]=u.useState(""),[w,v]=u.useState(""),[z,M]=u.useState(""),[O,E]=u.useState(null),[te,oe]=u.useState(!1),[H,$]=u.useState(""),[I,W]=u.useState(""),[X,ne]=u.useState(""),[J,le]=u.useState(50),[fe,K]=u.useState([]),[ie,me]=u.useState({}),[de,ke]=u.useState(!1),[T,Q]=u.useState(""),[ce,B]=u.useState(""),[re,xe]=u.useState(""),[be,Ce]=u.useState(.5),ve=u.useCallback(async()=>{if(n){try{const[D,P,ye]=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"})]),Ie=await D.json(),xa=await P.json(),fa=await ye.json();if(D.ok&&d(Ie.data||[]),P.ok&&m(xa.data||[]),ye.ok){const ht=fa.data||[];K(ht);for(const on of ht)try{const Us=await fetch(`/api/experiments/${on.id}`,{credentials:"include"});if(Us.ok){const Bs=await Us.json();me(Ta=>({...Ta,[on.id]:Bs.data}))}}catch{}}}catch{}h(!1)}},[n]);u.useEffect(()=>{ve()},[ve]);const Pe=async()=>{var D;if(!(!n||!y.trim())){g("");try{const P=await fetch(`/api/agents/${n}/prompts`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({systemPrompt:y,name:k||void 0})});if(!P.ok){const ye=await P.json();throw new Error(((D=ye.error)==null?void 0:D.message)||"Failed")}S(!1),j(""),C(""),await ve()}catch(P){g(P.message)}}},Xe=async D=>{var P;if(n){g("");try{const ye=await fetch(`/api/agents/${n}/prompts/${D}/activate`,{method:"PATCH",credentials:"include"});if(!ye.ok){const Ie=await ye.json();throw new Error(((P=Ie.error)==null?void 0:P.message)||"Failed")}await ve()}catch(ye){g(ye.message)}}},Ot=async()=>{if(!(!n||!w||!z))try{const D=await fetch(`/api/agents/${n}/prompts/compare?a=${w}&b=${z}`,{credentials:"include"}),P=await D.json();D.ok&&E(P.data)}catch{}},va=async()=>{var D;if(!(!n||!H||!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:H,variantBId:I,name:X||void 0,splitPercent:J})});if(!P.ok){const ye=await P.json();throw new Error(((D=ye.error)==null?void 0:D.message)||"Failed")}oe(!1),await ve()}catch(P){g(P.message)}}},zt=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 ve()}catch{}},Kt=async()=>{if(n){g("");try{const D=i.find(Ie=>Ie.isActive);if(!D){g("No active version to rollback from.");return}const P=i.indexOf(D),ye=i[P+1];if(!ye){g("No previous version to rollback to.");return}await Xe(ye.id)}catch(D){g(D.message)}}},He=async()=>{var D;if(!(!n||!T||!ce)){g("");try{const P=await fetch(`/api/agents/${n}/experiments`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:re||`Experiment ${new Date().toISOString().slice(0,10)}`,variantAId:T,variantBId:ce,trafficSplit:be})});if(!P.ok){const ye=await P.json();throw new Error(((D=ye.error)==null?void 0:D.message)||"Failed")}ke(!1),xe(""),Q(""),B(""),await ve()}catch(P){g(P.message)}}},at=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 ve()}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:Kt,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(z0,{className:"h-4 w-4"})," Rollback"]}),t.jsxs("button",{onClick:()=>ke(!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(It,{className:"h-4 w-4"})," New Experiment"]}),t.jsxs("button",{onClick:()=>oe(!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(Ed,{className:"h-4 w-4"})," New A/B Test"]}),t.jsxs("button",{onClick:()=>S(!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(yt,{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:()=>S(!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=>C(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:y,onChange:D=>j(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:Pe,disabled:!y.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(bt,{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:()=>Xe(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(_s,{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(Aa,{className:"h-4 w-4"})," Compare Versions"]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("select",{value:w,onChange:D=>v(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(y0,{className:"h-4 w-4 text-zinc-400 flex-shrink-0"}),t.jsxs("select",{value:z,onChange:D=>M(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:Ot,disabled:!w||!z||w===z,className:"rounded-lg bg-indigo-600 px-4 py-2 text-sm text-white hover:bg-indigo-700 disabled:opacity-50",children:"Compare"})]}),O&&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",O.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:[(O.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:["$",O.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:[O.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:O.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",O.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:[(O.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:["$",O.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:[O.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:O.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(Ed,{className:"h-5 w-5"})," A/B Tests"]}),te&&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:()=>oe(!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=>ne(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:H,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 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=>le(Number(D.target.value)),className:"w-full"})]}),t.jsx("button",{onClick:va,disabled:!H||!I||H===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(Ie=>Ie.id===D.variantAId),ye=i.find(Ie=>Ie.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(Ed,{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",(ye==null?void 0:ye.version)??"?"," - ",(ye==null?void 0:ye.name)||"unnamed"]}),ye&&t.jsxs("div",{className:"text-zinc-400 mt-1",children:["Score: ",ye.performanceScore!=null?`${(ye.performanceScore*100).toFixed(0)}%`:"N/A"]})]})]}),D.status==="running"&&P&&ye&&t.jsxs("div",{className:"mt-3 flex gap-2",children:[t.jsxs("button",{onClick:()=>zt(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(Jn,{className:"h-3 w-3"})," A wins"]}),t.jsxs("button",{onClick:()=>zt(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(Jn,{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(Jn,{className:"h-3 w-3"}),"Winner: v",D.winnerId===D.variantAId?P==null?void 0:P.version:ye==null?void 0:ye.version]})]},D.id)}),c.length===0&&!te&&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(It,{className:"h-5 w-5"})," Experiments"]}),de&&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:()=>ke(!1),className:"text-zinc-400 hover:text-white",children:t.jsx(tt,{className:"h-4 w-4"})})]}),t.jsx("input",{type:"text",value:re,onChange:D=>xe(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=>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:ce,onChange:D=>B(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:He,disabled:!T||!ce||T===ce,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"})]}),fe.map(D=>{const P=ie[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(It,{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(Md,{label:"Success Rate",valueA:P.variantA.successRate,valueB:P.variantB.successRate,format:ye=>`${(ye*100).toFixed(0)}%`}),t.jsx(Md,{label:"Avg Cost",valueA:P.variantA.avgCostUsd,valueB:P.variantB.avgCostUsd,format:ye=>`$${ye.toFixed(3)}`}),t.jsx(Md,{label:"Duration",valueA:P.variantA.avgDurationMs,valueB:P.variantB.avgDurationMs,format:ye=>`${ye.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(Aa,{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:()=>at(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(Jn,{className:"h-3 w-3"})," A wins"]}),t.jsxs("button",{onClick:()=>at(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(Jn,{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(Jn,{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)}),fe.length===0&&!de&&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 Br(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 p1(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 g1={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 Xh({type:n}){return t.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${g1[n]??"bg-zinc-500/20 text-zinc-400"}`,children:n})}function b1({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 $r({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 y1(){const{t:n}=lt(),[i,d]=u.useState([]),[c,m]=u.useState([]),[f,h]=u.useState(null),[b,g]=u.useState(!0),[p,S]=u.useState(""),[y,j]=u.useState(""),[k,C]=u.useState(""),[w,v]=u.useState(null);u.useEffect(()=>{Br("/agents").then(E=>m(E.data)).catch(console.error)},[]);const z=u.useCallback(async()=>{g(!0);try{const E=new URLSearchParams;p&&E.set("q",p),y&&E.set("agentId",y),k&&E.set("type",k),E.set("limit","100");const te=E.toString(),oe=await Br(`/memory?${te}`);if(d(oe.data),y){const H=await Br(`/memory/stats/${y}`);h(H.data)}else if(c.length>0){let H=0,$=0;const I={};let W=!1;for(const X of c)try{const ne=await Br(`/memory/stats/${X.id}`);H+=ne.data.total,$+=ne.data.avgImportance*ne.data.total;for(const[J,le]of Object.entries(ne.data.byType))I[J]=(I[J]??0)+le;ne.data.fts5Available&&(W=!0)}catch{}h({total:H,byType:I,avgImportance:H>0?$/H:0,fts5Available:W})}}catch(E){console.error("Failed to load memories:",E)}finally{g(!1)}},[p,y,k,c]);u.useEffect(()=>{(c.length>0||y)&&z()},[z,c.length,y]);const M=async E=>{v(E);try{await p1(`/memory/${E}`),d(te=>te.filter(oe=>oe.id!==E))}catch(te){console.error("Failed to delete memory:",te)}finally{v(null)}},O=E=>{E.preventDefault(),z()};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(Rs,{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($r,{label:"Total Memories",value:f.total,icon:Rs}),t.jsx($r,{label:"Avg Importance",value:`${Math.round(f.avgImportance*100)}%`,icon:Aa}),t.jsx($r,{label:"Types",value:Object.keys(f.byType).length,icon:zv}),t.jsx($r,{label:"Observations",value:f.byType.observation??0,icon:Wn})]}),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,te])=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Xh,{type:E}),t.jsx("span",{className:"text-sm text-white",children:te})]},E))})]}),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[t.jsxs("form",{onSubmit:O,className:"flex flex-1 gap-2",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(Ds,{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=>S(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:y,onChange:E=>j(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=>C(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(Rs,{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(Xh,{type:E.memoryType}),t.jsx(b1,{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(te=>t.jsxs("span",{className:"inline-flex items-center rounded bg-zinc-800 px-1.5 py-0.5 text-[10px] text-zinc-400",children:["#",te]},te))})]}),t.jsx("button",{onClick:()=>M(E.id),disabled:w===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:w===E.id?t.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border border-red-400 border-t-transparent"}):t.jsx(Gt,{className:"h-4 w-4"})})]})},E.id))})]})}const v1="/api/budget";function j1(){const n={"Content-Type":"application/json"},i=localStorage.getItem("nestor_token");return i&&(n.Authorization=`Bearer ${i}`),n}async function Es(n,i){const d=await fetch(`${v1}${n}`,{...i,headers:j1()});if(!d.ok)throw new Error(`API error: ${d.status}`);if(d.status!==204)return d.json()}const sn={listPolicies:()=>Es("/policies"),createPolicy:n=>Es("/policies",{method:"POST",body:JSON.stringify(n)}),updatePolicy:(n,i)=>Es(`/policies/${n}`,{method:"PUT",body:JSON.stringify(i)}),deletePolicy:n=>Es(`/policies/${n}`,{method:"DELETE"}),utilization:()=>Es("/utilization"),incidents:(n=50)=>Es(`/incidents?limit=${n}`),pauseAgent:n=>Es(`/agents/${n}/pause`,{method:"POST",body:"{}"}),resumeAgent:n=>Es(`/agents/${n}/resume`,{method:"POST",body:"{}"})};function Vd(n){return n<.01?`$${n.toFixed(4)}`:n<1?`$${n.toFixed(3)}`:`$${n.toFixed(2)}`}function H0(n){return new Date(n*1e3).toLocaleString()}function q0(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 N1(n){return n>=90?"bg-red-500":n>=70?"bg-amber-500":"bg-emerald-500"}function Qh({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,S]=u.useState((n==null?void 0:n.window)??"monthly"),[y,j]=u.useState(String((n==null?void 0:n.limitUsd)??10)),[k,C]=u.useState(String((n==null?void 0:n.warningThresholdPercent)??80)),[w,v]=u.useState((n==null?void 0:n.action)??"stop"),[z,M]=u.useState((n==null?void 0:n.enabled)!==!1),O=E=>{E.preventDefault(),i({name:c,scope:f,scopeId:b||null,window:p,limitUsd:parseFloat(y)||10,warningThresholdPercent:parseFloat(k)||80,action:w,enabled:z})};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:O,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=>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:"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:y,onChange:E=>j(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=>C(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:w,onChange:E=>v(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:z,onChange:E=>M(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 w1({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:[Vd(n.spentUsd)," / ",Vd(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 ${N1(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:q0(n.incidents[0].type),children:n.incidents[0].type})," ",H0(n.incidents[0].createdAt)]})]})}function S1(){const{t:n}=lt(),[i,d]=u.useState([]),[c,m]=u.useState([]),[f,h]=u.useState([]),[b,g]=u.useState(!0),[p,S]=u.useState(null),[y,j]=u.useState(!1),[k,C]=u.useState(null),w=u.useCallback(async()=>{try{g(!0),S(null);const[E,te,oe]=await Promise.all([sn.listPolicies(),sn.utilization(),sn.incidents(50)]);d(E.data),m(te.data),h(oe.data)}catch(E){S(E instanceof Error?E.message:"Failed to load budget data")}finally{g(!1)}},[]);u.useEffect(()=>{w()},[w]);const v=async E=>{try{await sn.createPolicy(E),j(!1),await w()}catch(te){S(te instanceof Error?te.message:"Failed to create policy")}},z=async E=>{if(k)try{await sn.updatePolicy(k.id,E),C(null),await w()}catch(te){S(te instanceof Error?te.message:"Failed to update policy")}},M=async E=>{if(confirm("Delete this budget policy?"))try{await sn.deletePolicy(E),await w()}catch(te){S(te instanceof Error?te.message:"Failed to delete policy")}},O=async E=>{try{await sn.resumeAgent(E),await w()}catch(te){S(te instanceof Error?te.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:()=>j(!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(yt,{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(w1,{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:Vd(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:()=>C(E),className:"p-1 text-zinc-400 hover:text-white",title:"Edit",children:t.jsx(Nv,{className:"h-3.5 w-3.5"})}),t.jsx("button",{onClick:()=>M(E.id),className:"p-1 text-zinc-400 hover:text-red-400",title:"Delete",children:t.jsx(Gt,{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 ${q0(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:H0(E.createdAt)}),E.type==="pause"&&E.agentId&&t.jsxs("button",{onClick:()=>O(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))})]}),y&&t.jsx(Qh,{onSave:v,onCancel:()=>j(!1)}),k&&t.jsx(Qh,{initial:k,onSave:z,onCancel:()=>C(null)})]})}const G0={mission:"Mission",objective:"Objective",key_result:"Key Result",task:"Task"},k1={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"},z1={active:ln,completed:mt,paused:Pr,cancelled:tt},C1={active:"text-indigo-400",completed:"text-green-400",paused:"text-amber-400",cancelled:"text-zinc-500"};function K0({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=z1[n.status]??ln,S=d.find(y=>y.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(ts,{className:"h-3.5 w-3.5"}):t.jsx(oa,{className:"h-3.5 w-3.5"}))}),t.jsx(p,{className:`h-4 w-4 flex-shrink-0 ${C1[n.status]}`}),t.jsx("span",{className:`inline-flex items-center rounded-md border px-1.5 py-0.5 text-[10px] font-medium uppercase ${k1[n.type]}`,children:G0[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,"%"]})]}),S&&t.jsxs("span",{className:"flex items-center gap-1 text-xs text-zinc-500",children:[t.jsx(es,{className:"h-3 w-3"}),S.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(mt,{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(Pr,{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(ln,{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(su,{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(Gt,{className:"h-3.5 w-3.5"})})]})]}),h&&g&&t.jsx("div",{children:n.children.map(y=>t.jsx(K0,{goal:y,depth:i+1,agents:d,onEdit:c,onDelete:m,onStatusChange:f},y.id))})]})}function A1({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,S]=u.useState((n==null?void 0:n.type)??"task"),[y,j]=u.useState((n==null?void 0:n.parentId)??""),[k,C]=u.useState((n==null?void 0:n.ownerAgentId)??""),[w,v]=u.useState((n==null?void 0:n.priority)??5),[z,M]=u.useState((n==null?void 0:n.dueDate)??""),O=E=>{E.preventDefault(),c({title:f,description:b||void 0,type:p,parentId:y||null,ownerAgentId:k||void 0,priority:w,dueDate:z||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:O,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=>S(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:y,onChange:E=>j(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:["[",G0[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:w,onChange:E=>v(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=>C(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:z,onChange:E=>M(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 V0(n,i=[]){for(const d of n)i.push(d),d.children&&V0(d.children,i);return i}function E1(){const{t:n}=lt(),[i,d]=u.useState([]),[c,m]=u.useState([]),[f,h]=u.useState(!0),[b,g]=u.useState(null),[p,S]=u.useState(null),y=u.useCallback(async()=>{try{g(null);const[v,z]=await Promise.all([si.tree(),Ls.list()]);d(v.data),m(z.data)}catch(v){g(v instanceof Error?v.message:"Failed to fetch goals")}finally{h(!1)}},[]);u.useEffect(()=>{y()},[y]);const j=async v=>{try{p&&p!=="new"?await si.update(p.id,v):await si.create(v),S(null),y()}catch(z){console.error("Save failed:",z)}},k=async v=>{if(confirm("Delete this goal and all its children?"))try{await si.delete(v),y()}catch(z){console.error("Delete failed:",z)}},C=async(v,z)=>{try{await si.update(v,{status:z}),y()}catch(M){console.error("Status change failed:",M)}};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 w=V0(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:[w.length," total"]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:y,className:"btn-ghost btn-sm",children:t.jsx(kt,{className:"h-4 w-4"})}),t.jsxs("button",{onClick:()=>S("new"),className:"btn-primary btn-sm",children:[t.jsx(yt,{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:y,className:"ml-3 underline",children:"Retry"})]}),i.length===0&&!b?t.jsx(rn,{icon:t.jsx(ln,{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:()=>S("new"),className:"btn-primary btn-sm",children:[t.jsx(yt,{className:"h-4 w-4"}),"Create your first goal"]})]})}):t.jsx("div",{className:"space-y-1",children:i.map(v=>t.jsx(K0,{goal:v,depth:0,agents:c,onEdit:z=>S(z),onDelete:k,onStatusChange:C},v.id))}),p!==null&&t.jsx(A1,{goal:p==="new"?null:p,parentGoals:w,agents:c,onSave:j,onClose:()=>S(null)})]})}function T1(){const n=Dt(),{t:i}=lt(),[d,c]=u.useState([]),[m,f]=u.useState(!0),[h,b]=u.useState("pending"),[g,p]=u.useState({}),[S,y]=u.useState(null),j=u.useCallback(async()=>{try{const v=h==="all"?void 0:{status:h},z=await Qr.list(v);c(z.data)}catch{}finally{f(!1)}},[h]);u.useEffect(()=>{f(!0),j()},[j]);const k=async v=>{var M;const z=(M=g[v.id])==null?void 0:M.trim();if(z){y(v.id);try{await Qr.resume(v.id,z),p(O=>{const E={...O};return delete E[v.id],E}),j()}catch(O){console.error("Resume failed:",O)}finally{y(null)}}},C=v=>{switch(v){case"pending":return t.jsx(Wn,{className:"h-4 w-4 text-amber-400"});case"resumed":return t.jsx(bt,{className:"h-4 w-4 text-green-400"});case"expired":return t.jsx(Mt,{className:"h-4 w-4 text-zinc-500"});default:return t.jsx(Wn,{className:"h-4 w-4 text-zinc-500"})}},w=v=>{const z={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 ${z[v]??z.expired}`,children:[C(v),v]})};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(oi,{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:j,className:"btn-ghost btn-sm",children:t.jsx(kt,{className:"h-3.5 w-3.5"})})})]}),t.jsx("div",{className:"flex gap-2",children:["pending","resumed","expired","all"].map(v=>t.jsx("button",{className:`rounded-lg px-3 py-1.5 text-sm font-medium transition-colors ${h===v?"bg-indigo-500/10 text-indigo-400 border border-indigo-500/30":"text-zinc-400 hover:text-zinc-200 border border-transparent"}`,onClick:()=>b(v),children:v.charAt(0).toUpperCase()+v.slice(1)},v))}),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(oi,{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(v=>{var z;return t.jsxs("div",{className:`card ${v.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:[w(v.status),t.jsxs("span",{className:"text-xs text-zinc-500 font-mono",children:[v.id.slice(0,12),"..."]})]}),t.jsx("button",{className:"text-xs text-indigo-400 hover:text-indigo-300",onClick:()=>n(`/runs/${v.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:v.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:v.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:v.suggestions})]})]}),t.jsxs("div",{className:"flex items-center gap-3 mt-3 text-xs text-zinc-500",children:[t.jsxs("span",{children:["Agent: ",v.agentId.slice(0,12),"..."]}),t.jsxs("span",{children:["Created: ",new Date(v.createdAt).toLocaleString()]}),v.resumedAt&&t.jsxs("span",{children:["Resumed: ",new Date(v.resumedAt).toLocaleString()]})]}),v.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[v.id]??"",onChange:M=>p(O=>({...O,[v.id]:M.target.value}))}),t.jsx("button",{className:"btn-primary btn-sm",disabled:!((z=g[v.id])!=null&&z.trim())||S===v.id,onClick:()=>k(v),children:S===v.id?"Resuming...":"Resume"})]})]},v.id)})})]})}const Zh={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 R1({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 ${Zh[n]??Zh.low}`,children:[n==="critical"&&t.jsx(ft,{className:"h-3 w-3"}),n==="high"&&t.jsx(ft,{className:"h-3 w-3"}),n.toUpperCase()]})}const ac="/api";async function Dd(n){const i=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};i&&(d.Authorization=`Bearer ${i}`);const c=await fetch(`${ac}/plans/${n}`,{headers:d});if(!c.ok)throw new Error(`Failed to fetch plan: ${c.statusText}`);return(await c.json()).data}async function M1(n){const i=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};i&&(d.Authorization=`Bearer ${i}`);const c=await fetch(`${ac}/plans/${n}/execute`,{method:"POST",headers:d});if(!c.ok)throw new Error(`Failed to execute plan: ${c.statusText}`)}async function D1(n){const i=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};i&&(d.Authorization=`Bearer ${i}`);const c=await fetch(`${ac}/plans/${n}/cancel`,{method:"POST",headers:d});if(!c.ok)throw new Error(`Failed to cancel plan: ${c.statusText}`)}async function O1(){const n=localStorage.getItem("nestor_token"),i={"Content-Type":"application/json"};n&&(i.Authorization=`Bearer ${n}`);const d=await fetch(`${ac}/plans?limit=50`,{headers:i});if(!d.ok)throw new Error(`Failed to fetch plans: ${d.statusText}`);return(await d.json()).data}function L1(){const[n,i]=u.useState([]),[d,c]=u.useState(!0),m=Dt();return u.useEffect(()=>{O1().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(Os,{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(oa,{className:"h-4 w-4 text-zinc-600"})]},f.id))})]})}function _1(){const{id:n}=sl(),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&&Dd(n).then(c).catch(console.error).finally(()=>f(!1))},[n]);const S=async()=>{if(d){b(!0);try{await M1(d.id);for(let C=0;C<d.steps.length;C++)p(C),await new Promise(w=>setTimeout(w,500));p(d.steps.length);const k=await Dd(d.id);c(k)}catch(k){console.error("Execute failed:",k)}finally{b(!1)}}},y=async()=>{if(d)try{await D1(d.id);const k=await Dd(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 j=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:j&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:S,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(Et,{className:"h-4 w-4"}),"Execute All"]}),t.jsxs("button",{onClick:y,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(Mt,{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,C)=>{const w=g===C,v=g>C,z=Object.entries(k.args).map(([M,O])=>`${M}: ${typeof O=="string"?O.slice(0,80):JSON.stringify(O).slice(0,80)}`).join(" | ");return t.jsxs("div",{className:`rounded-lg border p-4 transition-colors ${w?"border-indigo-500 bg-indigo-500/5":v?"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 ${v?"bg-green-500/20 text-green-400":w?"bg-indigo-500/20 text-indigo-400":"bg-zinc-800 text-zinc-400"}`,children:v?t.jsx(bt,{className:"h-4 w-4"}):C+1}),t.jsx("span",{className:"font-mono text-sm font-medium text-white",children:k.toolName}),t.jsx(R1,{level:k.riskLevel}),w&&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:z}),t.jsx("div",{className:"mt-1 pl-10 text-xs text-zinc-600 italic",children:k.mockResult})]},k.index)})})]})}const U1={file_pattern:"File Pattern",command_pattern:"Command Pattern",url_pattern:"URL Pattern",limit:"Limit"},B1={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"},sc="/api";function nc(){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 $1(){const n=await fetch(`${sc}/guardrails`,{headers:nc()});if(!n.ok)throw new Error(`Failed to fetch guardrails: ${n.statusText}`);return(await n.json()).data}async function H1(n){const i=await fetch(`${sc}/guardrails`,{method:"POST",headers:nc(),body:JSON.stringify(n)});if(!i.ok)throw new Error(`Failed to create guardrail: ${i.statusText}`);return(await i.json()).data}async function Jh(n,i){const d=await fetch(`${sc}/guardrails/${n}`,{method:"PUT",headers:nc(),body:JSON.stringify(i)});if(!d.ok)throw new Error(`Failed to update guardrail: ${d.statusText}`)}async function q1(n){const i=await fetch(`${sc}/guardrails/${n}`,{method:"DELETE",headers:nc()});if(!i.ok)throw new Error(`Failed to delete guardrail: ${i.statusText}`)}function G1(){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}),S=u.useCallback(()=>{c(!0),$1().then(i).catch(console.error).finally(()=>c(!1))},[]);u.useEffect(()=>{S()},[S]);const y=()=>{p({name:"",type:"command_pattern",pattern:"",action:"block",config:"{}",enabled:!0}),b(null),f(!1)},j=async()=>{if(!g.name.trim()||!g.pattern.trim())return;let v={};try{v=JSON.parse(g.config)}catch{}try{h?await Jh(h,{...g,config:v}):await H1({...g,config:v}),y(),S()}catch(z){console.error("Save failed:",z)}},k=async v=>{try{await Jh(v.id,{enabled:!v.enabled}),S()}catch(z){console.error("Toggle failed:",z)}},C=async v=>{try{await q1(v),S()}catch(z){console.error("Delete failed:",z)}},w=v=>{p({name:v.name,type:v.type,pattern:v.pattern,action:v.action,config:JSON.stringify(v.config,null,2),enabled:v.enabled}),b(v.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:()=>{y(),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(yt,{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:y,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:v=>p(z=>({...z,name:v.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:v=>p(z=>({...z,type:v.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:v=>p(z=>({...z,pattern:v.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:v=>p(z=>({...z,action:v.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:v=>p(z=>({...z,config:v.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:v=>p(z=>({...z,enabled:v.target.checked})),className:"rounded border-border"}),"Enabled"]}),t.jsx("button",{onClick:j,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(Os,{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(v=>t.jsxs("div",{className:`flex items-center justify-between rounded-lg border p-4 transition-colors ${v.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:v.name}),t.jsx("span",{className:"rounded-full bg-zinc-800 px-2 py-0.5 text-[10px] font-medium text-zinc-400",children:U1[v.type]??v.type}),t.jsx("span",{className:`rounded-full border px-2 py-0.5 text-[10px] font-medium ${B1[v.action]??""}`,children:v.action})]}),t.jsx("div",{className:"mt-1 font-mono text-xs text-zinc-500",children:v.pattern})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:()=>k(v),className:"text-zinc-500 hover:text-white",title:v.enabled?"Disable":"Enable",children:v.enabled?t.jsx(Ev,{className:"h-5 w-5 text-green-400"}):t.jsx(Av,{className:"h-5 w-5"})}),t.jsx("button",{onClick:()=>w(v),className:"text-zinc-500 hover:text-white",title:"Edit",children:t.jsx(su,{className:"h-4 w-4"})}),t.jsx("button",{onClick:()=>C(v.id),className:"text-zinc-500 hover:text-red-400",title:"Delete",children:t.jsx(Gt,{className:"h-4 w-4"})})]})]},v.id))})]})}const Fh={agent:t.jsx(sv,{className:"h-3 w-3"}),project:t.jsx(w0,{className:"h-3 w-3"}),global:t.jsx(tu,{className:"h-3 w-3"})},Ih={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 K1(){const{id:n}=sl(),[i,d]=u.useState([]),[c,m]=u.useState(null),[f,h]=u.useState(!0),[b,g]=u.useState(""),[p,S]=u.useState(""),[y,j]=u.useState(""),[k,C]=u.useState(!1),[w,v]=u.useState(""),[z,M]=u.useState(""),[O,E]=u.useState("agent"),[te,oe]=u.useState(.5),H=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[ne,J]=await Promise.all([fetch(`/api/agents/${n}/memory?${X}`,{credentials:"include"}),fetch(`/api/agents/${n}/memory/stats`,{credentials:"include"})]);if(ne.ok){const le=await ne.json();d(le.data||[])}if(J.ok){const le=await J.json();m(le.data)}}catch{}h(!1)}},[n,b,p]);u.useEffect(()=>{H()},[H]);const $=X=>{X.preventDefault(),H()},I=async()=>{var X;if(!(!n||!w.trim()||!z.trim())){j("");try{const ne=await fetch(`/api/agents/${n}/memory`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:w,value:z,scope:O,importance:te})});if(!ne.ok){const J=await ne.json();throw new Error(((X=J.error)==null?void 0:X.message)||"Failed")}C(!1),v(""),M(""),oe(.5),await H()}catch(ne){j(ne.message)}}},W=async X=>{if(n)try{(await fetch(`/api/agents/${n}/memory/${encodeURIComponent(X)}`,{method:"DELETE",credentials:"include"})).ok&&d(J=>J.filter(le=>le.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(Rs,{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:()=>C(!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(yt,{className:"h-4 w-4"})," Add Memory"]})]}),y&&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:y}),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,ne])=>t.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium ${Ih[X]??"bg-zinc-500/20 text-zinc-400"}`,children:[Fh[X]," ",X,": ",ne]},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:()=>C(!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:w,onChange:X=>v(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:O,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:z,onChange:X=>M(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: ",te.toFixed(1)]}),t.jsx("input",{type:"range",min:0,max:100,value:te*100,onChange:X=>oe(Number(X.target.value)/100),className:"w-full"})]}),t.jsx("button",{onClick:I,disabled:!w.trim()||!z.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:$,className:"flex flex-1 gap-2",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(Ds,{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=>S(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 ${Ih[X.scope]??"bg-zinc-500/20 text-zinc-400"}`,children:[Fh[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(Gt,{className:"h-4 w-4"})})]})},X.id))})]})}function V1(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function Y0(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 Ts({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 Y1(){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(""),S=u.useCallback(async()=>{b(!0),p("");try{const[y,j,k]=await Promise.allSettled([At.overview(),Ca.health(),Ca.stats()]);y.status==="fulfilled"&&i(y.value.data),j.status==="fulfilled"&&c(j.value),k.status==="fulfilled"&&f(k.value.data)}catch(y){p(y.message||"Failed to load overview")}finally{b(!1)}},[]);return u.useEffect(()=>{S()},[S]),h?t.jsx(cn,{}):g?t.jsx(as,{message:g,onRetry:S}):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(Ts,{label:"Tenants",value:(n==null?void 0:n.tenants)??0,icon:Wd,color:"indigo"}),t.jsx(Ts,{label:"Users",value:(n==null?void 0:n.users)??0,icon:ll,color:"blue"}),t.jsx(Ts,{label:"Agents",value:(n==null?void 0:n.agents)??0,icon:It,color:"green"}),t.jsx(Ts,{label:"Total Runs",value:(n==null?void 0:n.runs)??0,icon:au,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(j0,{className:"h-5 w-5 text-green-400"}):t.jsx(ft,{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: ",Y0(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 X1(){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:""}),[S,y]=u.useState(!1),j=u.useCallback(async()=>{c(!0),f("");try{const C=await At.tenants.list();i(C.data)}catch(C){f(C.message||"Failed to load tenants")}finally{c(!1)}},[]);u.useEffect(()=>{j()},[j]);const k=async()=>{if(!(!g.name||!g.slug)){y(!0);try{await At.tenants.create(g),b(!1),p({name:"",slug:"",description:""}),await j()}catch(C){f(C.message||"Failed to create tenant")}finally{y(!1)}}};return d?t.jsx(cn,{}):m&&n.length===0?t.jsx(as,{message:m,onRetry:j}):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(yt,{className:"h-4 w-4"})," Create Tenant"]})]}),m&&t.jsx(as,{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:C=>p({...g,name:C.target.value})}),t.jsx("input",{className:"input",placeholder:"slug (lowercase-with-dashes)",value:g.slug,onChange:C=>p({...g,slug:C.target.value})})]}),t.jsx("input",{className:"input",placeholder:"Description (optional)",value:g.description,onChange:C=>p({...g,description:C.target.value})}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("button",{onClick:k,disabled:S,className:"btn-primary btn-sm",children:S?"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(C=>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:C.name}),t.jsx("td",{className:"px-4 py-3 font-mono text-xs text-indigo-400",children:C.slug}),t.jsx("td",{className:"px-4 py-3 text-zinc-400 max-w-xs truncate",children:C.description||"-"}),t.jsx("td",{className:"px-4 py-3 text-zinc-500 text-xs",children:new Date(C.createdAt).toLocaleDateString()})]},C.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 Q1(){const[n,i]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(""),[h,b]=u.useState(""),[g,p]=u.useState(""),S=u.useCallback(async()=>{c(!0),f("");try{const C=await At.users.list(h?{role:h}:void 0);i(C.data)}catch(C){f(C.message||"Failed to load users")}finally{c(!1)}},[h]);u.useEffect(()=>{S()},[S]);const y=async(C,w)=>{f("");try{await At.users.updateRole(C,w),await S()}catch(v){f(v.message||"Failed to update role")}},j=async(C,w)=>{f("");try{w?await At.users.lock(C):await At.users.unlock(C),await S()}catch(v){f(v.message||"Failed to toggle lock status")}},k=n.filter(C=>{if(!g)return!0;const w=g.toLowerCase();return C.name.toLowerCase().includes(w)||C.email.toLowerCase().includes(w)});return d?t.jsx(cn,{}):t.jsxs("div",{className:"space-y-4",children:[m&&t.jsx(as,{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(Ds,{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:C=>p(C.target.value)})]}),t.jsxs("select",{className:"input w-auto",value:h,onChange:C=>b(C.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:S,className:"btn-ghost btn-sm",children:t.jsx(kt,{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(C=>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:C.name}),t.jsx("td",{className:"px-4 py-3 text-zinc-300",children:C.email}),t.jsx("td",{className:"px-4 py-3",children:t.jsxs("select",{value:C.role,onChange:w=>y(C.id,w.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 ${C.isActive?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,children:C.isActive?"Active":"Locked"})}),t.jsx("td",{className:"px-4 py-3 text-zinc-400 text-xs",children:C.lastLoginAt?new Date(C.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:()=>j(C.id,C.isActive),className:"rounded p-1.5 text-zinc-400 transition-colors hover:bg-zinc-700",title:C.isActive?"Lock account":"Unlock account",children:C.isActive?t.jsx(Hd,{className:"h-3.5 w-3.5"}):t.jsx(fv,{className:"h-3.5 w-3.5"})})})})]},C.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 Z1(){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(""),S=u.useCallback(async()=>{b(!0),p("");try{const[y,j,k]=await Promise.allSettled([At.system.info(),At.system.dbStats(),At.system.rateLimitStats()]);y.status==="fulfilled"&&i(y.value.data),j.status==="fulfilled"&&c(j.value.data),k.status==="fulfilled"&&f(k.value.data)}catch(y){p(y.message||"Failed to load system info")}finally{b(!1)}},[]);return u.useEffect(()=>{S()},[S]),h?t.jsx(cn,{}):g?t.jsx(as,{message:g,onRetry:S}):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(lu,{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:S,className:"ml-auto btn-ghost btn-sm",children:t.jsx(kt,{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:Y0(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(w0,{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:V1(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(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",children:y.name}),t.jsx("td",{className:"px-3 py-1.5 text-right text-zinc-400",children:y.rowCount.toLocaleString()})]},y.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(It,{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((y,j)=>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:y.key}),t.jsx("td",{className:"px-3 py-1.5 text-right text-zinc-400",children:y.count}),t.jsx("td",{className:"px-3 py-1.5 text-right text-zinc-500",children:new Date(y.resetAt).toLocaleTimeString()})]},j))})]})}):t.jsx("p",{className:"text-xs text-zinc-500",children:"No active rate limit counters."})]})]})}function J1(){const[n,i]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(""),[h,b]=u.useState(""),[g,p]=u.useState(""),S=u.useCallback(async()=>{c(!0),f("");try{const j=await At.audit.query({action:h||void 0,userId:g||void 0,limit:200});i(j.data)}catch(j){f(j.message||"Failed to load audit log")}finally{c(!1)}},[h,g]);u.useEffect(()=>{S()},[S]);const y=async j=>{try{const k=await At.audit.export(j),C=j==="json"?JSON.stringify(k.data,null,2):F1(k.data),w=new Blob([C],{type:j==="json"?"application/json":"text/csv"}),v=URL.createObjectURL(w),z=document.createElement("a");z.href=v,z.download=`audit-log.${j}`,z.click(),URL.revokeObjectURL(v)}catch(k){f(k.message||"Export failed")}};return d?t.jsx(cn,{}):t.jsxs("div",{className:"space-y-4",children:[m&&t.jsx(as,{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:j=>b(j.target.value)}),t.jsx("input",{className:"input flex-1 min-w-[150px]",placeholder:"Filter by actor ID...",value:g,onChange:j=>p(j.target.value)}),t.jsx("button",{onClick:S,className:"btn-ghost btn-sm",children:t.jsx(kt,{className:"h-4 w-4"})}),t.jsxs("button",{onClick:()=>y("json"),className:"btn-ghost btn-sm",children:[t.jsx(di,{className:"h-4 w-4"})," JSON"]}),t.jsxs("button",{onClick:()=>y("csv"),className:"btn-ghost btn-sm",children:[t.jsx(di,{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(j=>{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(j.createdAt*1e3).toLocaleString()}),t.jsx("td",{className:"px-4 py-2.5 text-zinc-300 text-xs font-mono",children:((k=j.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:j.action}),t.jsx("td",{className:"px-4 py-2.5 text-zinc-300 text-xs",children:j.resourceType?`${j.resourceType}${j.resourceId?`/${j.resourceId.slice(0,8)}`:""}`:"-"}),t.jsx("td",{className:"px-4 py-2.5 text-zinc-500 text-xs",children:j.ipAddress||"-"}),t.jsx("td",{className:"px-4 py-2.5 text-xs text-zinc-500 max-w-[200px] truncate",children:j.details?JSON.stringify(j.details):"-"})]},j.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 F1(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 I1(){const[n,i]=u.useState([]),[d,c]=u.useState([]),[m,f]=u.useState([]),[h,b]=u.useState([]),[g,p]=u.useState(!0),[S,y]=u.useState(""),j=u.useCallback(async()=>{p(!0),y("");try{const[k,C,w,v]=await Promise.allSettled([At.security.failedLogins(24),At.security.lockedAccounts(),At.security.activeSessions(),At.security.rateLimitViolations(50)]);k.status==="fulfilled"&&i(k.value.data),C.status==="fulfilled"&&c(C.value.data),w.status==="fulfilled"&&f(w.value.data),v.status==="fulfilled"&&b(v.value.data)}catch(k){y(k.message||"Failed to load security data")}finally{p(!1)}},[]);return u.useEffect(()=>{j()},[j]),g?t.jsx(cn,{}):S?t.jsx(as,{message:S,onRetry:j}):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(Ts,{label:"Failed Logins (24h)",value:n.reduce((k,C)=>k+C.count,0),icon:Mt,color:"red"}),t.jsx(Ts,{label:"Locked Accounts",value:d.length,icon:Hd,color:"amber"}),t.jsx(Ts,{label:"Active Sessions",value:m.length,icon:ll,color:"green"}),t.jsx(Ts,{label:"Rate Violations",value:h.length,icon:Ea,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(Mt,{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,C)=>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()})]},C))})]})}):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(Hd,{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,C)=>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()})]},C))})]})}):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(Wn,{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,C)=>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()})]},C))})]})}):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(Ea,{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,C)=>{var w;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:((w=k.userId)==null?void 0:w.slice(0,8))||"-"}),t.jsx("td",{className:"px-3 py-1.5 font-mono text-zinc-300 max-w-[200px] truncate",children:k.endpoint})]},C)})})]})}):t.jsx("p",{className:"text-xs text-zinc-500",children:"No rate limit violations recorded."})]})]})}function P1(){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(""),[S,y]=u.useState(""),[j,k]=u.useState(!1),C=u.useCallback(async()=>{f(!0),p(""),y("");try{const M=await Ca.getConfig();i(M.data),c(M.data),k(!1)}catch(M){p(M.message||"Failed to load configuration")}finally{f(!1)}},[]);u.useEffect(()=>{C()},[C]);const w=(M,O,E)=>{d&&(c({...d,[M]:{...d[M],[O]:E}}),k(!0),y(""))},v=async()=>{if(d){b(!0),p(""),y("");try{const M=await Ca.updateConfig(d);i(M.data),c(M.data),k(!1),y("Configuration saved successfully.")}catch(M){p(M.message||"Failed to save configuration")}finally{b(!1)}}},z=()=>{n&&(c({...n}),k(!1),y(""))};return m?t.jsx(cn,{}):g&&!d?t.jsx(as,{message:g,onRetry:C}):t.jsxs("div",{className:"space-y-6",children:[g&&t.jsx(as,{message:g}),S&&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(j0,{className:"h-4 w-4 flex-shrink-0"}),S]}),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:C,className:"btn-ghost btn-sm",children:t.jsx(kt,{className:"h-4 w-4"})}),t.jsx("button",{onClick:z,disabled:!j,className:"btn-secondary btn-sm",children:"Reset"}),t.jsxs("button",{onClick:v,disabled:!j||h,className:"btn-primary btn-sm",children:[t.jsx(ec,{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(lu,{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:M=>w("server","host",M.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:M=>w("server","port",parseInt(M.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(Ea,{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:M=>w("security","defaultTrustLevel",M.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:M=>w("security","approvalMode",M.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:M=>w("security","maxConcurrentRuns",parseInt(M.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(It,{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:M=>w("budget","enabled",M.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:M=>w("budget","defaultMaxCostPerRunUsd",parseFloat(M.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:M=>w("budget","defaultMaxTokensPerRun",parseInt(M.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:M=>w("budget","warningThresholdPercent",parseInt(M.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(_s,{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:M=>w("logging","level",M.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:M=>w("logging","format",M.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 cn(){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 as({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(ft,{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 W1=[{key:"overview",label:"Overview",icon:au},{key:"tenants",label:"Tenants",icon:Wd},{key:"users",label:"Users",icon:ll},{key:"system",label:"System",icon:lu},{key:"audit",label:"Audit Log",icon:_s},{key:"security",label:"Security",icon:Ea},{key:"config",label:"Config",icon:nl}];function eN(){const{isAdmin:n}=pi(),[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:W1.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(Y1,{}),i==="tenants"&&t.jsx(X1,{}),i==="users"&&t.jsx(Q1,{}),i==="system"&&t.jsx(Z1,{}),i==="audit"&&t.jsx(J1,{}),i==="security"&&t.jsx(I1,{}),i==="config"&&t.jsx(P1,{})]}):t.jsxs("div",{className:"flex h-64 items-center justify-center text-zinc-400",children:[t.jsx(Ea,{className:"mr-2 h-5 w-5"})," Admin access required."]})}function tN(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 aN(n){return n.startsWith("file_")?t.jsx(_s,{className:"h-3 w-3"}):n==="shell_exec"?t.jsx(C0,{className:"h-3 w-3"}):n==="web_fetch"?t.jsx(tu,{className:"h-3 w-3"}):t.jsx(il,{className:"h-3 w-3"})}function X0(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 sN(n,i=500){return n.length<=i?n:n.substring(0,i)+`
586
+ ... (${n.length} chars total)`}function nN({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(ts,{className:"h-3 w-3 text-zinc-500 flex-shrink-0"}):t.jsx(oa,{className:"h-3 w-3 text-zinc-500 flex-shrink-0"}),t.jsx("span",{className:"text-amber-400 flex-shrink-0",children:aN(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:X0(n.name,n.args)}),c?t.jsx(xt,{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:sN(n.output)})]}),c&&t.jsxs("div",{className:"flex items-center gap-1.5 text-blue-400 mt-1",children:[t.jsx(xt,{className:"h-3 w-3 animate-spin"}),t.jsx("span",{className:"text-[11px]",children:"Executing..."})]})]})]})}function lN(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 iN({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(ts,{className:"h-3 w-3 text-indigo-400"}):t.jsx(oa,{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 ${lN(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:X0(c.toolName,c.args)})]},c.index))})]})}function rN({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 y;(y=p.current)==null||y.focus()},[]);const S=async()=>{h(!0),g("");try{const y=await fetch(`/api/agents/${n.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:c})});if(!y.ok){const k=await y.json().catch(()=>({error:"Failed to save"}));throw new Error(k.error||`HTTP ${y.status}`)}const j=await y.json();d(j.data)}catch(y){g(y instanceof Error?y.message:"Failed to save")}h(!1)};return u.useEffect(()=>{const y=j=>{j.key==="Escape"&&i()};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[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:y=>y.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:y=>m(y.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:S,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(xt,{className:"h-3 w-3 animate-spin"}):t.jsx(ec,{className:"h-3 w-3"}),"Save"]})]})]})]})})}function cN(){var ce;const n=Dt(),[i,d]=u.useState([]),[c,m]=u.useState(null),[f,h]=u.useState([]),[b,g]=u.useState(null),[p,S]=u.useState([]),[y,j]=u.useState(""),[k,C]=u.useState(!1),[w,v]=u.useState(!0),[z,M]=u.useState(!1),[O,E]=u.useState([]),[te,oe]=u.useState(!1),[H,$]=u.useState(null),[I,W]=u.useState(null),[X,ne]=u.useState(""),J=u.useRef(null),le=u.useRef(null),fe=u.useRef(null);u.useEffect(()=>{var B;(B=J.current)==null||B.scrollIntoView({behavior:"smooth"})},[p]),u.useEffect(()=>{const B=le.current;B&&(B.style.height="48px",B.style.height=Math.min(B.scrollHeight,200)+"px")},[y]);const K=u.useCallback(B=>{const re=B?`/api/chat/conversations?agentId=${encodeURIComponent(B)}`:"/api/chat/conversations";fetch(re).then(xe=>xe.json()).then(xe=>h(xe.data||[])).catch(()=>{})},[]);u.useEffect(()=>{fetch("/api/agents").then(B=>B.json()).then(B=>{const re=B.data||[];d(re),re.length>0&&!c?(m(re[0]),K(re[0].id)):K()}).catch(()=>{})},[]),u.useEffect(()=>{c&&K(c.id)},[c==null?void 0:c.id,K]);const ie=u.useCallback(B=>{g(B),fetch(`/api/chat/conversations/${B.id}`).then(re=>re.json()).then(re=>{var be;S(((be=re.data)==null?void 0:be.messages)||[]);const xe=i.find(Ce=>{var ve;return Ce.id===((ve=re.data)==null?void 0:ve.agentId)});xe&&m(xe)}).catch(()=>{})},[i]),me=u.useCallback(()=>{var B;g(null),S([]),M(!1),E([]),(B=le.current)==null||B.focus()},[]),de=u.useCallback((B,re)=>{B.stopPropagation(),fetch(`/api/chat/conversations/${re}`,{method:"DELETE"}).then(()=>{h(xe=>xe.filter(be=>be.id!==re)),(b==null?void 0:b.id)===re&&me()}).catch(()=>{})},[b,me]),ke=u.useCallback(async()=>{var be;if(!y.trim()||!c||k)return;const B={role:"user",content:y.trim(),timestamp:Date.now()};ne(y.trim()),W(null),S(Ce=>[...Ce,B]),j(""),C(!0);const re={role:"assistant",content:"",timestamp:Date.now(),isStreaming:!0,toolCalls:[]};S(Ce=>[...Ce,re]);const xe=new AbortController;fe.current=xe;try{const Ce=await fetch(`/api/chat/${c.id}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:y.trim(),conversationId:b==null?void 0:b.id}),signal:xe.signal});if(!Ce.body)throw new Error("No response body");const ve=Ce.body.getReader(),Pe=new TextDecoder;let Xe="";for(;;){const{done:Ot,value:va}=await ve.read();if(Ot)break;Xe+=Pe.decode(va,{stream:!0});const zt=Xe.split(`
587
+ `);Xe=zt.pop()||"";for(const Kt of zt){if(!Kt.startsWith("data: "))continue;let He;try{He=JSON.parse(Kt.slice(6))}catch{continue}switch(He.type){case"system":M(!0),E(He.tools||[]);break;case"token":S(at=>{const D=[...at],P=D[D.length-1];return P&&P.role==="assistant"&&(D[D.length-1]={...P,content:P.content+He.text}),D});break;case"thinking":S(at=>{const D=[...at],P=D[D.length-1];return P&&P.role==="assistant"&&(D[D.length-1]={...P,thinking:(P.thinking||"")+He.text}),D});break;case"tool_start":S(at=>{const D=[...at],P=D[D.length-1];return P&&P.role==="assistant"&&(D[D.length-1]={...P,toolCalls:[...P.toolCalls||[],{name:He.name,args:He.args||{},output:"",success:!0,pending:!0}]}),D});break;case"tool_result":S(at=>{var ye;const D=[...at],P=D[D.length-1];if(P&&P.role==="assistant"&&((ye=P.toolCalls)!=null&&ye.length)){const Ie=[...P.toolCalls];let xa=-1;for(let fa=Ie.length-1;fa>=0;fa--)if(Ie[fa].name===He.name&&Ie[fa].pending){xa=fa;break}xa===-1&&(xa=Ie.length-1),Ie[xa]={...Ie[xa],output:He.output,success:He.success,pending:!1},D[D.length-1]={...P,toolCalls:Ie}}return D});break;case"done":S(at=>{const D=[...at],P=D[D.length-1];return P&&P.role==="assistant"&&(D[D.length-1]={...P,isStreaming:!1,usage:He.usage}),D}),He.conversationId&&!b&&(g({id:He.conversationId}),K(c==null?void 0:c.id));break;case"plan":He.plan&&He.plan.steps&&$(He.plan.steps);break;case"mission_suggestion":W({message:He.message,objective:X});break;case"error":S(at=>{const D=[...at],P=D[D.length-1];return P&&P.role==="assistant"&&(D[D.length-1]={...P,content:P.content?P.content+`
588
+
589
+ Error: ${He.message}`:`Error: ${He.message}`,isStreaming:!1}),D});break;case"reasoning":break}}}}catch(Ce){if(Ce instanceof DOMException&&Ce.name==="AbortError")S(ve=>{const Pe=[...ve],Xe=Pe[Pe.length-1];return Xe&&Xe.role==="assistant"&&(Pe[Pe.length-1]={...Xe,isStreaming:!1}),Pe});else{const ve=Ce instanceof Error?Ce.message:"Connection error";S(Pe=>{const Xe=[...Pe],Ot=Xe[Xe.length-1];return Ot&&Ot.role==="assistant"&&(Xe[Xe.length-1]={...Ot,content:`Connection error: ${ve}`,isStreaming:!1}),Xe})}}fe.current=null,C(!1),(be=le.current)==null||be.focus()},[y,c,k,b,K]),T=u.useCallback(()=>{var B;(B=fe.current)==null||B.abort()},[]),Q=B=>{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),ke())};return t.jsxs("div",{className:"flex h-full bg-background",children:[w&&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:me,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(yt,{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(B=>t.jsxs("button",{onClick:()=>ie(B),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)===B.id?"bg-indigo-500/10 text-indigo-400":"text-zinc-400"}`,children:[t.jsx(Ms,{className:"h-3.5 w-3.5 flex-shrink-0"}),t.jsx("span",{className:"truncate flex-1",children:B.title||"Untitled"}),t.jsx("button",{onClick:re=>de(re,B.id),className:"opacity-0 group-hover:opacity-100 p-0.5 hover:text-red-400 transition-opacity",title:"Delete conversation",children:t.jsx(Gt,{className:"h-3 w-3"})})]},B.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:()=>v(!w),className:"p-1.5 hover:bg-surface-hover rounded-lg transition-colors text-zinc-400 hover:text-zinc-200",title:w?"Hide sidebar":"Show sidebar",children:w?t.jsx(vv,{className:"h-4 w-4"}):t.jsx(jv,{className:"h-4 w-4"})}),t.jsx("select",{value:(c==null?void 0:c.id)||"",onChange:B=>{const re=i.find(xe=>xe.id===B.target.value);re&&m(re)},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(B=>t.jsxs("option",{value:B.id,children:[B.name," (",B.adapterType,")"]},B.id))}),c&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-xs text-zinc-500",children:((ce=c.adapterConfig)==null?void 0:ce.model)||tN(c.adapterType)}),t.jsx("button",{onClick:()=>oe(!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(nl,{className:"h-3.5 w-3.5"})})]}),z&&t.jsxs("div",{className:"ml-auto flex items-center gap-1.5 text-xs text-amber-400/80",title:`Available tools: ${O.join(", ")}`,children:[t.jsx(il,{className:"h-3 w-3"}),t.jsxs("span",{children:[O.length," tools"]})]})]}),z&&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(ft,{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(Ms,{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(B=>t.jsx("button",{onClick:()=>j(B),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:B},B))})]}),p.map((B,re)=>{var xe,be,Ce;return t.jsx("div",{className:`flex ${B.role==="user"?"justify-end":"justify-start"}`,children:t.jsxs("div",{className:`max-w-[80%] rounded-2xl px-4 py-3 ${B.role==="user"?"bg-indigo-600 text-white":"bg-surface border border-border text-zinc-100"}`,children:[B.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"}),B.thinking.substring(0,300),B.thinking.length>300&&"..."]}),(xe=B.toolCalls)==null?void 0:xe.map((ve,Pe)=>t.jsx(nN,{tc:ve},Pe)),B.content&&((/(?:API[_\s]?KEY|api[_\s]?key).*(?:not set|not configured|missing|invalid|required)/i.test(B.content)||/(?:ANTHROPIC|OPENAI|GEMINI|XAI|MISTRAL|GROK)_API_KEY/i.test(B.content))&&B.role==="assistant"?t.jsxs("div",{className:"space-y-2",children:[t.jsx("div",{className:"whitespace-pre-wrap break-words",children:B.content}),t.jsxs(Ia,{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(hi,{className:"h-4 w-4"}),"Set up your API key"]})]}):t.jsx("div",{className:"whitespace-pre-wrap break-words",children:B.content})),B.isStreaming&&!B.content&&!((be=B.toolCalls)!=null&&be.length)&&t.jsxs("div",{className:"flex items-center gap-1.5 text-zinc-400",children:[t.jsx(xt,{className:"h-3 w-3 animate-spin"}),t.jsx("span",{className:"text-xs",children:"Thinking..."})]}),B.isStreaming&&!B.content&&(((Ce=B.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(xt,{className:"h-3 w-3 animate-spin"}),t.jsx("span",{className:"text-xs",children:"Processing tools..."})]}),B.isStreaming&&B.content&&t.jsx("span",{className:"inline-block w-1.5 h-4 bg-indigo-400 animate-pulse ml-0.5 rounded-sm"}),B.usage&&(B.usage.inputTokens>0||B.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:[B.usage.inputTokens+B.usage.outputTokens," tokens"]}),B.usage.costUsd>0&&t.jsxs("span",{children:["$",B.usage.costUsd.toFixed(4)]}),B.toolCalls&&B.toolCalls.length>0&&t.jsxs("span",{children:[B.toolCalls.length," tool call",B.toolCalls.length>1?"s":""]})]})]})},re)}),H&&H.length>0&&t.jsx("div",{className:"flex justify-start",children:t.jsx("div",{className:"max-w-[80%]",children:t.jsx(iN,{steps:H})})}),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(ln,{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:le,value:y,onChange:B=>j(B.target.value),onKeyDown:Q,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:ke,disabled:!y.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(nu,{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."})]})]}),te&&c&&t.jsx(rN,{agent:c,onClose:()=>oe(!1),onSave:B=>{m(B),d(re=>re.map(xe=>xe.id===B.id?B:xe)),oe(!1)}})]})}let oN=0;function dN({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(mt,{className:"h-4 w-4"}),i==="error"&&t.jsx(Mt,{className:"h-4 w-4"}),i==="info"&&t.jsx(xt,{className:"h-4 w-4"}),n]})}function uN({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(dN,{message:d.message,type:d.type,onDismiss:()=>i(d.id)},d.id))})}function Hr({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(xt,{className:"h-3.5 w-3.5 animate-spin"}),f||h]}):t.jsxs(t.Fragment,{children:[m,h]})})}function Ph(n){switch(n){case"osint":return t.jsx(Ir,{className:"h-4 w-4"});case"research":return t.jsx(Ds,{className:"h-4 w-4"});case"code":return t.jsx(cv,{className:"h-4 w-4"});case"audit":return t.jsx(Os,{className:"h-4 w-4"});case"analysis":return t.jsx(Aa,{className:"h-4 w-4"});case"creation":return t.jsx(_s,{className:"h-4 w-4"});default:return t.jsx(Rs,{className:"h-4 w-4"})}}function hu(n){return n>=.8?"text-green-400":n>=.6?"text-amber-400":"text-red-400"}function Q0(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 Yd(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 qr({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 ${Q0(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 ${hu(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(ts,{className:"h-3.5 w-3.5 text-zinc-500"}):t.jsx(oa,{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 ${Yd(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:hu(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:Od(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:Od(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:Od(m)},c))}return t.jsx("div",{className:"space-y-0",children:d})}function Od(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,S]=u.useState("recent"),y=u.useMemo(()=>{let j=[...n];if(c){const k=c.toLowerCase();j=j.filter(C=>{var w,v,z;return((w=C.title)==null?void 0:w.toLowerCase().includes(k))||((v=C.objective)==null?void 0:v.toLowerCase().includes(k))||((z=C.type)==null?void 0:z.toLowerCase().includes(k))})}switch(f!=="all"&&(j=j.filter(k=>k.type===f)),b!=="all"&&(j=j.filter(k=>k.status===b)),p){case"recent":j.sort((k,C)=>(C.createdAt||0)-(k.createdAt||0));break;case"cost":j.sort((k,C)=>(C.spentUsd||0)-(k.spentUsd||0));break;case"quality":j.sort((k,C)=>{var w,v;return(((w=C.evaluation)==null?void 0:w.overall)||0)-(((v=k.evaluation)==null?void 0:v.overall)||0)});break;case"findings":j.sort((k,C)=>{var w,v;return(((w=C.findings)==null?void 0:w.length)||0)-(((v=k.findings)==null?void 0:v.length)||0)});break}return j},[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(j=>j.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((j,k)=>j+(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((j,k)=>{var C;return j+(((C=k.findings)==null?void 0:C.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:j=>m(j.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(j=>t.jsx("button",{onClick:()=>h(j),className:`px-2.5 py-1 rounded-full text-[10px] font-medium transition-colors ${f===j?"bg-purple-600 text-white":"bg-zinc-800 text-zinc-400 hover:bg-zinc-700"}`,children:j==="all"?"All":j.charAt(0).toUpperCase()+j.slice(1)},j))}),t.jsx("div",{className:"flex gap-1.5 mb-3",children:["all","completed","executing","failed","interrupted"].map(j=>t.jsxs("button",{onClick:()=>g(j),className:`px-2 py-1 rounded text-[10px] transition-colors ${b===j?"bg-zinc-700 text-white":"text-zinc-500 hover:text-zinc-300"}`,children:[j==="all"?"All":j,j!=="all"&&` (${n.filter(k=>k.status===j).length})`]},j))}),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(j=>t.jsx("button",{onClick:()=>S(j),className:`transition-colors ${p===j?"text-purple-400":"hover:text-zinc-300"}`,children:j},j))]}),t.jsxs("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:[y.map(j=>{var k,C;return t.jsx("button",{onClick:()=>d(j),className:`w-full text-left rounded-lg transition-colors ${i===j.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 ${j.status==="completed"?"bg-green-500":j.status==="executing"?"bg-blue-500 animate-pulse":j.status==="failed"?"bg-red-500":j.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:j.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:j.type}),t.jsxs("span",{className:"text-[10px] text-zinc-500",children:["$",(j.spentUsd||0).toFixed(2)]}),t.jsxs("span",{className:"text-[10px] text-zinc-500",children:[((k=j.findings)==null?void 0:k.length)||0," findings"]}),((C=j.evaluation)==null?void 0:C.overall)!=null&&t.jsxs("span",{className:`text-[10px] font-medium ${j.evaluation.overall>=.8?"text-green-400":j.evaluation.overall>=.5?"text-yellow-400":"text-red-400"}`,children:[Math.round(j.evaluation.overall*100),"%"]})]})]}),t.jsx("span",{className:"text-[10px] text-zinc-600 flex-shrink-0",children:new Date(j.createdAt).toLocaleDateString()})]})},j.id)}),y.length===0&&t.jsx("p",{className:"text-xs text-zinc-600 text-center py-4",children:"No missions match filters"})]})]})}function pN(){var Ta,bi;const[n,i]=Qy(),[d,c]=u.useState("empty"),[m,f]=u.useState(""),[h,b]=u.useState(null),[g,p]=u.useState([]),[S,y]=u.useState(""),[j,k]=u.useState([]),[C,w]=u.useState(!1),[v,z]=u.useState(null),M=u.useRef(null),O=u.useRef(null),E=u.useRef(null),te=u.useRef(!1),[oe,H]=u.useState([]),[$,I]=u.useState([]),[W,X]=u.useState(0),ne=u.useRef(null);u.useEffect(()=>{Fa.templates().then(q=>{H(q.data||[])}).catch(()=>{})},[]),u.useEffect(()=>{Fa.list().then(q=>{k(q.data||[])}).catch(()=>{})},[]),u.useEffect(()=>{O.current&&(O.current.scrollTop=O.current.scrollHeight)},[g]),u.useEffect(()=>{ne.current&&(ne.current.scrollTop=ne.current.scrollHeight)},[$]),u.useEffect(()=>()=>{var q;(q=M.current)==null||q.close()},[]);const J=u.useCallback(async q=>{var Ne,we;const ae=q??m;if(ae.trim()){c("planning"),y(""),p([]),b(null),w(!1);try{const De=await Fa.plan(ae.trim());b(De.data),c("planned")}catch(De){y(((we=(Ne=De==null?void 0:De.body)==null?void 0:Ne.error)==null?void 0:we.message)||De.message||"Planning failed"),c("error")}}},[m]);u.useEffect(()=>{if(te.current)return;const q=n.get("objective");q&&!h&&(te.current=!0,f(q),i({},{replace:!0}),J(q))},[n,h,J,i]);const le=u.useCallback(async()=>{var De;if(!h)return;c("executing"),p([]),w(!1),z(null),I([]),X(0);const q=localStorage.getItem("nestor_token"),ae=(De=document.cookie.match(/(?:^|; )nestor-csrf=([^;]*)/))==null?void 0:De[1],Ne=localStorage.getItem("nestor_tenant_id"),we={"Content-Type":"application/json"};q&&(we.Authorization=`Bearer ${q}`),ae&&(we["X-CSRF-Token"]=decodeURIComponent(ae)),Ne&&(we["X-Tenant-ID"]=Ne);try{const it=await fetch(`/api/missions/${h.id}/execute`,{method:"POST",headers:we});if(!it.ok||!it.body){y("Failed to start execution"),c("error");return}const Tt=it.body.getReader(),lc=new TextDecoder;let $s="";const yi=Ra=>{if(Ra.startsWith("data: "))try{const ss=JSON.parse(Ra.slice(6));K(ss)}catch{}};await(async()=>{for(;;){const{done:Ra,value:ss}=await Tt.read();if(Ra)break;$s+=lc.decode(ss,{stream:!0});const ja=$s.split(`
592
+ `);$s=ja.pop()||"";for(const dn of ja)yi(dn.trim())}$s.trim()&&yi($s.trim())})()}catch(it){y(it.message||"Execution failed"),c("error")}},[h]),fe=u.useCallback((q,ae)=>{I(Ne=>[...Ne,{id:`${Date.now()}-${Math.random().toString(36).slice(2,6)}`,timestamp:Date.now(),type:q,label:ae}])},[]),K=u.useCallback(q=>{switch(q.type){case"status":b(ae=>ae&&{...ae,status:q.status}),q.status==="evaluating"&&(c("evaluating"),fe("status","Evaluation phase started"));break;case"sub_objective_start":z(q.id),b(ae=>{if(!ae)return ae;const Ne=ae.subObjectives.map(we=>we.id===q.id?{...we,status:"in_progress"}:we);return{...ae,subObjectives:Ne}}),fe("sub_objective_start",`Sub-objective "${q.name||q.id}" started`);break;case"sub_objective_complete":b(ae=>{if(!ae)return ae;const Ne=ae.subObjectives.map(we=>we.id===q.id?{...we,status:q.status}:we);return{...ae,subObjectives:Ne}}),fe("sub_objective_complete",`Sub-objective "${q.name||q.id}" ${q.status}`);break;case"finding":p(ae=>[...ae,q]),fe("finding",`Finding: ${q.title||"New finding"}`);break;case"evaluation":b(ae=>ae&&{...ae,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||[]}}),fe("evaluation",`Evaluation complete: ${Math.round(q.overall*100)}% overall`);break;case"iteration":b(ae=>ae&&{...ae,iteration:q.iteration}),fe("iteration",`Iteration ${q.iteration} started`);break;case"cost_update":typeof q.costUsd=="number"&&X(q.costUsd);break;case"budget_exhausted":fe("budget","Budget exhausted");break;case"complete":b(ae=>ae&&{...ae,status:q.status||"completed",spentUsd:q.cost||ae.spentUsd,iteration:q.iterations||ae.iteration}),typeof q.cost=="number"&&X(q.cost),fe("complete",`Mission ${q.status||"completed"}`),q.missionId&&Fa.get(q.missionId).then(ae=>{b(ae.data)}).catch(()=>{}),c("complete"),Fa.list().then(ae=>k(ae.data||[])).catch(()=>{});break;case"error":y(q.message),c("error"),fe("error",`Error: ${q.message||"Unknown error"}`);break}},[fe]),ie=u.useCallback(async()=>{if(h)try{await Fa.cancel(h.id),b(q=>q&&{...q,status:"cancelled"}),c("empty")}catch{}},[h]),me=u.useCallback(()=>{var q,ae;c("empty"),f(""),b(null),p([]),y(""),w(!1),z(null),I([]),X(0),(q=M.current)==null||q.close(),(ae=E.current)==null||ae.focus()},[]),de=u.useCallback(q=>{b(q),f(q.objective),p((q.findings||[]).map(ae=>({id:ae.id,type:ae.type,title:ae.title,content:ae.content,confidence:ae.confidence,source:ae.source,sourceUrl:ae.sourceUrl}))),q.status==="completed"||q.status==="failed"?c("complete"):(q.status,c("planned"))},[]),ke=u.useCallback(()=>{if(!(h!=null&&h.report))return;const q=new Blob([h.report],{type:"text/markdown"}),ae=URL.createObjectURL(q),Ne=document.createElement("a");Ne.href=ae,Ne.download=`${h.title.replace(/[^a-zA-Z0-9]/g,"_")}_report.md`,Ne.click(),URL.revokeObjectURL(ae)},[h]),T=u.useCallback(q=>{var ae;f(q),(ae=E.current)==null||ae.focus()},[]),Q=Dt(),[ce,B]=u.useState([]),re=u.useCallback((q,ae="info")=>{const Ne=++oN;B(we=>[...we,{id:Ne,message:q,type:ae}])},[]),xe=u.useCallback(q=>{B(ae=>ae.filter(Ne=>Ne.id!==q))},[]),[be,Ce]=u.useState(!1),[ve,Pe]=u.useState(!1),[Xe,Ot]=u.useState(!1),[va,zt]=u.useState(!1),[Kt,He]=u.useState(!1),at=be||ve||Xe||va;u.useEffect(()=>{He(!1)},[h==null?void 0:h.id]);const D=u.useCallback(()=>{var De;const q=localStorage.getItem("nestor_token"),ae=(De=document.cookie.match(/(?:^|; )nestor-csrf=([^;]*)/))==null?void 0:De[1],Ne=localStorage.getItem("nestor_tenant_id"),we={"Content-Type":"application/json"};return q&&(we.Authorization=`Bearer ${q}`),ae&&(we["X-CSRF-Token"]=decodeURIComponent(ae)),Ne&&(we["X-Tenant-ID"]=Ne),we},[]),P=u.useCallback(async q=>{var ae;Ce(!0);try{const Ne=D(),we=await fetch(`/api/missions/${q}/iterate`,{method:"POST",headers:Ne});if(!we.ok){const it=await we.json().catch(()=>({}));re(((ae=it==null?void 0:it.error)==null?void 0:ae.message)||"Iterate request failed","error");return}re("Iterating on gaps...","info");const De=await Fa.get(q);b(De.data),c("planned"),setTimeout(()=>{le()},500)}catch(Ne){re(Ne instanceof Error?Ne.message:"Iterate failed","error")}finally{Ce(!1)}},[le,re,D]),ye=u.useCallback(async q=>{var ae;if(!(!((ae=q.evaluation)!=null&&ae.gaps)||q.evaluation.gaps.length===0)){Pe(!0);try{const Ne=`Deep dive follow-up for mission "${q.title}". Focus ONLY on these gaps identified in the evaluation:
593
+ ${q.evaluation.gaps.map(De=>`- ${De}`).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.`,we=await Fa.plan(Ne,{maxBudget:3});we.data&&(re("Deep-dive mission created!","success"),b(we.data),f(Ne),p([]),c("planned"))}catch(Ne){re(Ne instanceof Error?Ne.message:"Deep dive planning failed","error")}finally{Pe(!1)}}},[re]),Ie=u.useCallback(async q=>{Ot(!0);try{const ae=D();(await fetch(`/api/brain/reindex/${q}`,{method:"POST",headers:ae})).ok?(re("Archived to Knowledge Graph","success"),He(!0)):re("Archive failed — brain endpoint may not be available.","error")}catch{re("Archive failed — brain endpoint may not be available.","error")}finally{Ot(!1)}},[re,D]),xa=u.useCallback(async q=>{zt(!0);try{re("Re-running mission...","info");const ae=await Fa.plan(q.objective,{maxBudget:q.maxBudgetUsd});ae.data&&(b(ae.data),f(q.objective),p([]),c("planned"),re("Fresh mission planned. Executing...","success"),setTimeout(()=>{le()},500))}catch(ae){re(ae instanceof Error?ae.message:"Re-run planning failed","error")}finally{zt(!1)}},[re,le]),fa=u.useCallback(q=>{const ae=(q.findings||[]).sort((De,it)=>(it.confidence??0)-(De.confidence??0)).slice(0,3).map(De=>De.title).join(", "),Ne=ae?`Key findings: ${ae}`:"",we=encodeURIComponent(`Mission: ${q.title}. ${Ne}`);Q(`/chat?context=mission:${q.id}&prefill=${we}`)},[Q]),ht=u.useCallback(q=>{const ae=new Blob([JSON.stringify(q,null,2)],{type:"application/json"}),Ne=URL.createObjectURL(ae),we=document.createElement("a");we.href=Ne,we.download=`mission-${q.id.substring(0,8)}-${(q.title||"export").replace(/[^a-z0-9]/gi,"-").substring(0,30)}.json`,we.click(),URL.revokeObjectURL(Ne)},[]),on=(h==null?void 0:h.subObjectives.filter(q=>q.status==="completed").length)||0,Us=(h==null?void 0:h.subObjectives.length)||1,Bs=Math.round(on/Us*100);return t.jsxs("div",{className:"flex h-full",children:[t.jsx(uN,{toasts:ce,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(Pa,{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 ${Yd(h.type)}`,children:[Ph(h.type),h.type]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(da,{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(kt,{className:"h-3 w-3"}),"Iteration ",h.iteration,"/",h.maxIterations]}),t.jsx("button",{onClick:me,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(Pa,{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:j,selectedId:null,onSelect:de}),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"&&J(),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:()=>J(),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(ln,{className:"h-4 w-4"}),"Plan"]})]}),oe.length>0?t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 mt-6 w-full max-w-4xl mx-auto",children:oe.map(q=>t.jsxs("button",{onClick:()=>{var ae;f(q.objective),(ae=E.current)==null||ae.focus()},className:"group text-left rounded-xl border border-border/50 bg-zinc-900/60 hover:border-purple-500/40 hover:bg-purple-500/5 p-4 transition-all",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx("span",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-purple-500/10 text-purple-400 group-hover:bg-purple-500/20 transition-colors",children:Ph(q.type)}),t.jsx("span",{className:"text-sm font-medium text-zinc-200 group-hover:text-white transition-colors",children:q.name})]}),t.jsx("p",{className:"text-xs text-zinc-500 line-clamp-2 mb-2",children:q.description}),t.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-zinc-600",children:[t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(da,{className:"h-3 w-3"}),"$",q.suggestedBudget.toFixed(2)]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(kt,{className:"h-3 w-3"}),q.suggestedIterations," iter"]})]})]},q.id))}):t.jsx("div",{className:"flex flex-wrap gap-2 mt-4 justify-center",children:mN.map(q=>t.jsx("button",{onClick:()=>T(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(xt,{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(ft,{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:S}),t.jsx("button",{onClick:me,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"||d==="complete")&&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:[Bs,"%"]})]}),t.jsx("div",{className:"h-2 bg-zinc-800 rounded-full overflow-hidden",children:t.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${d==="complete"?"bg-green-500":"bg-purple-500"}`,style:{width:`${Bs}%`}})})]}),(d==="executing"||d==="evaluating")&&W>0&&t.jsxs("div",{className:"mb-4 flex items-center gap-2 px-3 py-2 rounded-lg bg-amber-500/5 border border-amber-500/10",children:[t.jsx(da,{className:"h-3.5 w-3.5 text-amber-400"}),t.jsxs("span",{className:"text-xs text-amber-400 font-mono tabular-nums",children:["$",W.toFixed(4)]}),t.jsx("span",{className:"text-[10px] text-zinc-500",children:"spent so far"})]}),t.jsx("div",{className:"space-y-1",children:h.subObjectives.map((q,ae)=>t.jsxs("div",{className:`flex items-start gap-3 px-3 py-2.5 rounded-lg transition-colors ${v===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:[t.jsx("div",{className:"flex items-center justify-center h-5 w-5",children:t.jsx("div",{className:`h-2.5 w-2.5 rounded-full ${q.status==="completed"?"bg-green-500":q.status==="in_progress"?"bg-blue-500 animate-pulse":q.status==="failed"?"bg-red-500":"bg-zinc-600"}`})}),ae<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 ${Yd(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))}),$.length>0&&t.jsxs("div",{className:"mt-5",children:[t.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-zinc-600 mb-2",children:"Event Timeline"}),t.jsx("div",{ref:ne,className:"max-h-48 overflow-y-auto space-y-0.5",children:$.map(q=>{const ae=new Date(q.timestamp),Ne=`${String(ae.getHours()).padStart(2,"0")}:${String(ae.getMinutes()).padStart(2,"0")}:${String(ae.getSeconds()).padStart(2,"0")}`,we=q.type==="error"?"bg-red-500":q.type==="complete"?"bg-green-500":q.type==="finding"?"bg-emerald-400":q.type==="evaluation"?"bg-amber-400":q.type==="sub_objective_start"?"bg-blue-400":q.type==="sub_objective_complete"?"bg-green-400":q.type==="iteration"?"bg-purple-400":"bg-zinc-500";return t.jsxs("div",{className:"flex items-start gap-2 px-2 py-1 text-[11px] rounded hover:bg-zinc-800/30",children:[t.jsxs("span",{className:"text-zinc-600 font-mono flex-shrink-0",children:["[",Ne,"]"]}),t.jsx("div",{className:`h-1.5 w-1.5 rounded-full mt-1.5 flex-shrink-0 ${we}`}),t.jsx("span",{className:"text-zinc-400 break-words",children:q.label})]},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:le,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(Pa,{className:"h-4 w-4"}),"Execute Mission"]}),t.jsx("button",{onClick:ie,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:ie,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(Mt,{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(xt,{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(qr,{label:"Completeness",score:h.evaluation.completeness}),t.jsx(qr,{label:"Accuracy",score:h.evaluation.accuracy}),t.jsx(qr,{label:"Depth",score:h.evaluation.depth}),t.jsx(qr,{label:"Relevance",score:h.evaluation.relevance})]}),t.jsxs("div",{className:`mt-2 rounded-lg border p-3 text-center ${Q0(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 ${hu(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,ae)=>t.jsxs("p",{className:"text-[11px] text-zinc-500 flex items-start gap-1 mt-0.5",children:[t.jsx(ft,{className:"h-3 w-3 text-amber-500/60 flex-shrink-0 mt-0.5"}),q]},ae))]})]}),d==="complete"&&h.report&&t.jsxs("div",{className:"mt-4 flex gap-2",children:[t.jsxs("button",{onClick:()=>w(!C),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(_s,{className:"h-4 w-4"}),C?"Hide Report":"View Report"]}),t.jsx("button",{onClick:ke,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(di,{className:"h-4 w-4"})})]}),d==="complete"&&t.jsxs("button",{onClick:me,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(y0,{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:[((Ta=h.evaluation)==null?void 0:Ta.recommendation)==="iterate"&&t.jsx(Hr,{onClick:()=>P(h.id),loading:be,disabled:at&&!be,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(kt,{className:"h-3.5 w-3.5"}),loadingText:"Iterating...",children:"Iterate on Gaps"}),((bi=h.evaluation)==null?void 0:bi.gaps)&&h.evaluation.gaps.length>0&&t.jsx(Hr,{onClick:()=>ye(h),loading:ve,disabled:at&&!ve,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(Ds,{className:"h-3.5 w-3.5"}),loadingText:"Planning...",children:"Deep Dive Gaps"}),t.jsx(Hr,{onClick:()=>Ie(h.id),loading:Xe,disabled:Kt||at&&!Xe,className:`flex items-center justify-center gap-2 px-3 py-2.5 text-white rounded-lg text-xs font-medium transition-colors ${Kt?"bg-green-800 cursor-default":"bg-green-600 hover:bg-green-500"}`,icon:Kt?t.jsx(mt,{className:"h-3.5 w-3.5"}):t.jsx(Rs,{className:"h-3.5 w-3.5"}),loadingText:"Archiving...",children:Kt?"Archived":"Archive to Brain"}),t.jsxs("button",{onClick:()=>fa(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(nu,{className:"h-3.5 w-3.5"}),"Chat About This"]}),t.jsx(Hr,{onClick:()=>xa(h),loading:va,disabled:at&&!va,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(kt,{className:"h-3.5 w-3.5"}),loadingText:"Re-running...",children:"Re-run Fresh"}),t.jsxs("button",{onClick:()=>ht(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(di,{className:"h-3.5 w-3.5"}),"Export Full Data"]})]})]}),t.jsx("div",{className:"flex-1 overflow-y-auto p-4",ref:O,children:C&&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:()=>w(!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(Ds,{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(xt,{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 Wh=[{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(mt,{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(ft,{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(mt,{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,S]=u.useState(!1),[y,j]=u.useState(!1),[k,C]=u.useState(null),[w,v]=u.useState(null),z=async()=>{if(c.trim()){j(!0),C(null),v(null);try{await ba.set(n.id,c.trim(),f||void 0);const O=await ba.test(n.id);C(O.data)}catch(O){v(O instanceof Error?O.message:"Test failed")}finally{j(!1)}}},M=async()=>{if(c.trim()){S(!0),v(null);try{await ba.set(n.id,c.trim(),f||void 0),d()}catch(O){v(O instanceof Error?O.message:"Failed to save")}finally{S(!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:O=>m(O.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(eu,{className:"h-4 w-4"}):t.jsx(Ir,{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:O=>h(O.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(mt,{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(O=>t.jsx("span",{className:"rounded-md bg-white/5 px-2 py-0.5 text-[10px] font-mono",children:O},O)),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"]})]})]}),w&&t.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-3 text-sm text-red-400",children:w}),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(In,{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:z,disabled:!c.trim()||y,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:[y?t.jsx(xt,{className:"h-4 w-4 animate-spin"}):t.jsx(ui,{className:"h-4 w-4"}),"Test Key"]}),t.jsxs("button",{onClick:M,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(xt,{className:"h-4 w-4 animate-spin"}):t.jsx(mt,{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(mt,{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(S=>t.jsx("span",{className:"rounded bg-white/5 px-1.5 py-0.5 text-[9px] font-mono",children:S},S)),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(xt,{className:"h-3 w-3 animate-spin"}):t.jsx(ui,{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(hi,{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(Gt,{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(yt,{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(In,{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),S=u.useCallback(async()=>{try{const w=await ba.list();i(w.data)}catch{}finally{c(!1)}},[]);u.useEffect(()=>{S()},[S]);const y=async w=>{b(w),p(null);try{const v=await ba.test(w);p({provider:w,result:v.data})}catch(v){p({provider:w,result:{valid:!1,message:v instanceof Error?v.message:"Test failed"}})}finally{b(null)}},j=async w=>{try{await ba.remove(w),await S(),(g==null?void 0:g.provider)===w&&p(null)}catch{}},k=w=>n.find(v=>v.provider===w)||null,C=n.filter(w=>w.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(hi,{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(Os,{className:"h-3.5 w-3.5 text-green-400"}),t.jsxs("span",{className:"text-xs text-zinc-400",children:[C,"/",Wh.length," configured"]})]}),t.jsxs("button",{onClick:()=>{c(!0),S()},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(kt,{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(Os,{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:Wh.map(w=>t.jsx(vN,{meta:w,entry:k(w.id),onAdd:()=>f(w),onTest:()=>y(w.id),onRemove:()=>j(w.id),testingProvider:h,testResult:g},w.id))}),m&&t.jsx(yN,{provider:m,onClose:()=>f(null),onSaved:()=>{f(null),S()}})]})}const Ld=[{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:"openrouter",name:"OpenRouter",provider:"OpenRouter",description:"Access 200+ models through a single API",defaultModel:"google/gemini-2.5-flash-preview",keyUrl:"https://openrouter.ai/keys",keyUrlLabel:"openrouter.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 me;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,S]=u.useState(!1),[y,j]=u.useState({}),[k,C]=u.useState(!0),[w,v]=u.useState(!1),[z,M]=u.useState(null),[O,E]=u.useState("my-agent"),[te,oe]=u.useState("My first Nestor agent"),[H,$]=u.useState(!1),[I,W]=u.useState("");u.useEffect(()=>{_h.status().then(de=>{j(de.data)}).catch(()=>{}).finally(()=>C(!1))},[]);const X=u.useCallback(de=>{m(de);const ke=Ld.find(T=>T.id===de);ke&&h(ke.defaultModel),g(""),S(!1),M(null)},[]),ne=u.useCallback(()=>{d(de=>Math.min(de+1,2))},[]),J=u.useCallback(()=>{d(de=>Math.max(de-1,0))},[]),le=Ld.find(de=>de.id===c),fe=((me=y[c])==null?void 0:me.configured)??!1,K=u.useCallback(async()=>{v(!0),M(null);try{const de=await _h.test({provider:c,apiKey:b.trim()||void 0,model:f});M(de)}catch(de){M({success:!1,message:de instanceof Error?de.message:"Connection test failed"})}finally{v(!1)}},[c,b,f]),ie=u.useCallback(async()=>{if(!O.trim()){W("Please enter an agent name.");return}$(!0),W("");try{b.trim()&&(le!=null&&le.needsApiKey)&&await ba.set(c,b.trim(),"Onboarding key"),await Ls.create({name:O.trim(),description:te.trim()||void 0,adapterType:c,adapterConfig:{model:f},trustLevel:"trusted"}),localStorage.setItem("nestor_onboarding_complete","true"),n("/chat")}catch(de){W(de instanceof Error?de.message:"Failed to create agent")}finally{$(!1)}},[O,te,c,f,b,le,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(de=>t.jsx("div",{className:`h-1.5 rounded-full transition-all duration-500 ${de===i?"w-10 bg-purple-500":de<i?"w-10 bg-purple-500/40":"w-10 bg-zinc-700"}`},de))}),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(Pa,{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:ne,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(oa,{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:Ld.map(de=>{var Q;const ke=c===de.id,T=((Q=y[de.id])==null?void 0:Q.configured)??!1;return t.jsxs("button",{onClick:()=>X(de.id),className:`relative text-left p-4 rounded-xl border-2 transition-all duration-200 hover:scale-[1.02] ${ke?"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(mt,{className:"h-3.5 w-3.5"})}),t.jsx("div",{className:"text-lg mb-1",children:de.emoji}),t.jsx("div",{className:"font-semibold text-sm text-zinc-100",children:de.name}),t.jsx("div",{className:"text-[11px] text-zinc-500",children:de.provider}),de.note&&t.jsx("div",{className:"text-[10px] text-green-400/80 mt-1",children:de.note}),de.needsApiKey&&t.jsxs("a",{href:de.keyUrl,target:"_blank",rel:"noopener noreferrer",onClick:ce=>ce.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(In,{className:"h-2.5 w-2.5"})]})]},de.id)})}),t.jsxs("div",{className:"space-y-3",children:[(le==null?void 0:le.needsApiKey)&&t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:["API Key",fe&&t.jsxs("span",{className:"ml-2 text-xs text-green-400 font-normal",children:[t.jsx(mt,{className:"inline h-3 w-3 mr-0.5"}),"Already configured"]})]}),fe?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:de=>{g(de.target.value),M(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 ${le.provider} API key`}),t.jsx("button",{type:"button",onClick:()=>S(!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(eu,{className:"h-4 w-4"}):t.jsx(Ir,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"flex items-center justify-between mt-1.5",children:t.jsxs("a",{href:le.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(In,{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(In,{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:de=>h(de.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:K,disabled:w||!b.trim()&&(le==null?void 0:le.needsApiKey)&&!fe,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:w?t.jsxs(t.Fragment,{children:[t.jsx(xt,{className:"h-4 w-4 animate-spin"}),"Testing connection..."]}):t.jsxs(t.Fragment,{children:[t.jsx(ui,{className:"h-4 w-4"}),"Test Connection"]})}),z&&t.jsx("div",{className:`rounded-lg border p-3 text-sm transition-all ${z.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:[z.success?t.jsx(mt,{className:"h-4 w-4"}):t.jsx(ci,{className:"h-4 w-4"}),z.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(Rh,{className:"h-4 w-4"}),"Back"]}),t.jsxs("button",{onClick:ne,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(oa,{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:O,onChange:de=>E(de.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:te,onChange:de=>oe(de.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:O||"—"})]}),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:le==null?void 0:le.name})," ",t.jsxs("span",{className:"text-zinc-500",children:["(",f,")"]})]}),b.trim()&&(le==null?void 0:le.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(ci,{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(Rh,{className:"h-4 w-4"}),"Back"]}),t.jsx("button",{onClick:ie,disabled:H||!O.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:H?t.jsxs(t.Fragment,{children:[t.jsx(xt,{className:"h-4 w-4 animate-spin"}),"Creating..."]}):t.jsxs(t.Fragment,{children:["Create & Start Chatting",t.jsx(oa,{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=ya();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}Ls.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(cj,{fallback:t.jsx(oj,{}),children:n})}function SN(){const{user:n,loading:i}=pi();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(x0,{children:[t.jsx(Oe,{path:"/onboarding",element:t.jsx(NN,{})}),t.jsxs(Oe,{element:t.jsx(rj,{}),children:[t.jsx(Oe,{path:"/",element:t.jsx(Eh,{to:"/missions",replace:!0})}),t.jsx(Oe,{path:"/missions",element:Ye(t.jsx(pN,{}))}),t.jsx(Oe,{path:"/chat",element:Ye(t.jsx(cN,{}))}),t.jsx(Oe,{path:"/dashboard",element:Ye(t.jsx(xj,{}))}),t.jsx(Oe,{path:"/agents",element:Ye(t.jsx(yj,{}))}),t.jsx(Oe,{path:"/agents/:id",element:Ye(t.jsx(kj,{}))}),t.jsx(Oe,{path:"/agents/:id/prompts",element:Ye(t.jsx(h1,{}))}),t.jsx(Oe,{path:"/agents/:id/memory-store",element:Ye(t.jsx(K1,{}))}),t.jsx(Oe,{path:"/workflows",element:Ye(t.jsx(Ej,{}))}),t.jsx(Oe,{path:"/workflows/:id/edit",element:Ye(t.jsx(Rj,{}))}),t.jsx(Oe,{path:"/skills",element:Ye(t.jsx(Oj,{}))}),t.jsx(Oe,{path:"/runs",element:Ye(t.jsx(Lj,{}))}),t.jsx(Oe,{path:"/runs/:id",element:Ye(t.jsx(Yj,{}))}),t.jsx(Oe,{path:"/goals",element:Ye(t.jsx(E1,{}))}),t.jsx(Oe,{path:"/approvals",element:Ye(t.jsx(Fj,{}))}),t.jsx(Oe,{path:"/handoffs",element:Ye(t.jsx(T1,{}))}),t.jsx(Oe,{path:"/analytics",element:Ye(t.jsx(c1,{}))}),t.jsx(Oe,{path:"/budget",element:Ye(t.jsx(S1,{}))}),t.jsx(Oe,{path:"/traces",element:Ye(t.jsx(x1,{}))}),t.jsx(Oe,{path:"/memory",element:Ye(t.jsx(y1,{}))}),t.jsx(Oe,{path:"/users",element:Ye(t.jsx(f1,{}))}),t.jsx(Oe,{path:"/plans",element:Ye(t.jsx(L1,{}))}),t.jsx(Oe,{path:"/plans/:id",element:Ye(t.jsx(_1,{}))}),t.jsx(Oe,{path:"/guardrails",element:Ye(t.jsx(G1,{}))}),t.jsx(Oe,{path:"/admin",element:Ye(t.jsx(eN,{}))}),t.jsx(Oe,{path:"/settings",element:Ye(t.jsx(Xj,{}))}),t.jsx(Oe,{path:"/keys",element:Ye(t.jsx(jN,{}))}),t.jsx(Oe,{path:"*",element:t.jsx(Eh,{to:"/missions",replace:!0})})]})]})}):t.jsx(B0,{})}function kN(){return t.jsx(Uv,{children:t.jsx(qv,{children:t.jsxs(x0,{children:[t.jsx(Oe,{path:"/login",element:t.jsx(B0,{})}),t.jsx(Oe,{path:"/*",element:t.jsx(SN,{})})]})})})}const Z0=document.getElementById("root");if(!Z0)throw new Error("Root element not found");yb.createRoot(Z0).render(t.jsx(u.StrictMode,{children:t.jsx(Ky,{children:t.jsx(kN,{})})}));
597
+ //# sourceMappingURL=index-CTXjJlEy.js.map