@agentprojectcontext/apx 1.35.0 → 1.36.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,628 @@
1
+ function PN(e,n){for(var s=0;s<n.length;s++){const o=n[s];if(typeof o!="string"&&!Array.isArray(o)){for(const l in o)if(l!=="default"&&!(l in e)){const c=Object.getOwnPropertyDescriptor(o,l);c&&Object.defineProperty(e,l,c.get?c:{enumerable:!0,get:()=>o[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))o(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function s(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(l){if(l.ep)return;l.ep=!0;const c=s(l);fetch(l.href,c)}})();function ex(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fm={exports:{}},Ai={};/**
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 T1;function IN(){if(T1)return Ai;T1=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function s(o,l,c){var d=null;if(c!==void 0&&(d=""+c),l.key!==void 0&&(d=""+l.key),"key"in l){c={};for(var f in l)f!=="key"&&(c[f]=l[f])}else c=l;return l=c.ref,{$$typeof:e,type:o,key:d,ref:l!==void 0?l:null,props:c}}return Ai.Fragment=n,Ai.jsx=s,Ai.jsxs=s,Ai}var A1;function BN(){return A1||(A1=1,Fm.exports=IN()),Fm.exports}var r=BN(),Ym={exports:{}},rt={};/**
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 M1;function UN(){if(M1)return rt;M1=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),v=Symbol.iterator;function S(U){return U===null||typeof U!="object"?null:(U=v&&U[v]||U["@@iterator"],typeof U=="function"?U:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,w={};function k(U,K,F){this.props=U,this.context=K,this.refs=w,this.updater=F||C}k.prototype.isReactComponent={},k.prototype.setState=function(U,K){if(typeof U!="object"&&typeof U!="function"&&U!=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,U,K,"setState")},k.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function E(){}E.prototype=k.prototype;function N(U,K,F){this.props=U,this.context=K,this.refs=w,this.updater=F||C}var R=N.prototype=new E;R.constructor=N,_(R,k.prototype),R.isPureReactComponent=!0;var T=Array.isArray;function O(){}var A={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function B(U,K,F){var J=F.ref;return{$$typeof:e,type:U,key:K,ref:J!==void 0?J:null,props:F}}function L(U,K){return B(U.type,K,U.props)}function D(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function P(U){var K={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(F){return K[F]})}var H=/\/+/g;function q(U,K){return typeof U=="object"&&U!==null&&U.key!=null?P(""+U.key):K.toString(36)}function Y(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(O,O):(U.status="pending",U.then(function(K){U.status==="pending"&&(U.status="fulfilled",U.value=K)},function(K){U.status==="pending"&&(U.status="rejected",U.reason=K)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function V(U,K,F,J,ie){var re=typeof U;(re==="undefined"||re==="boolean")&&(U=null);var oe=!1;if(U===null)oe=!0;else switch(re){case"bigint":case"string":case"number":oe=!0;break;case"object":switch(U.$$typeof){case e:case n:oe=!0;break;case g:return oe=U._init,V(oe(U._payload),K,F,J,ie)}}if(oe)return ie=ie(U),oe=J===""?"."+q(U,0):J,T(ie)?(F="",oe!=null&&(F=oe.replace(H,"$&/")+"/"),V(ie,K,F,"",function(Te){return Te})):ie!=null&&(D(ie)&&(ie=L(ie,F+(ie.key==null||U&&U.key===ie.key?"":(""+ie.key).replace(H,"$&/")+"/")+oe)),K.push(ie)),1;oe=0;var ce=J===""?".":J+":";if(T(U))for(var ee=0;ee<U.length;ee++)J=U[ee],re=ce+q(J,ee),oe+=V(J,K,F,re,ie);else if(ee=S(U),typeof ee=="function")for(U=ee.call(U),ee=0;!(J=U.next()).done;)J=J.value,re=ce+q(J,ee++),oe+=V(J,K,F,re,ie);else if(re==="object"){if(typeof U.then=="function")return V(Y(U),K,F,J,ie);throw K=String(U),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return oe}function $(U,K,F){if(U==null)return U;var J=[],ie=0;return V(U,J,"","",function(re){return K.call(F,re,ie++)}),J}function Z(U){if(U._status===-1){var K=U._result;K=K(),K.then(function(F){(U._status===0||U._status===-1)&&(U._status=1,U._result=F)},function(F){(U._status===0||U._status===-1)&&(U._status=2,U._result=F)}),U._status===-1&&(U._status=0,U._result=K)}if(U._status===1)return U._result.default;throw U._result}var G=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},X={map:$,forEach:function(U,K,F){$(U,function(){K.apply(this,arguments)},F)},count:function(U){var K=0;return $(U,function(){K++}),K},toArray:function(U){return $(U,function(K){return K})||[]},only:function(U){if(!D(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return rt.Activity=b,rt.Children=X,rt.Component=k,rt.Fragment=s,rt.Profiler=l,rt.PureComponent=N,rt.StrictMode=o,rt.Suspense=p,rt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,rt.__COMPILER_RUNTIME={__proto__:null,c:function(U){return A.H.useMemoCache(U)}},rt.cache=function(U){return function(){return U.apply(null,arguments)}},rt.cacheSignal=function(){return null},rt.cloneElement=function(U,K,F){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var J=_({},U.props),ie=U.key;if(K!=null)for(re in K.key!==void 0&&(ie=""+K.key),K)!z.call(K,re)||re==="key"||re==="__self"||re==="__source"||re==="ref"&&K.ref===void 0||(J[re]=K[re]);var re=arguments.length-2;if(re===1)J.children=F;else if(1<re){for(var oe=Array(re),ce=0;ce<re;ce++)oe[ce]=arguments[ce+2];J.children=oe}return B(U.type,ie,J)},rt.createContext=function(U){return U={$$typeof:d,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:c,_context:U},U},rt.createElement=function(U,K,F){var J,ie={},re=null;if(K!=null)for(J in K.key!==void 0&&(re=""+K.key),K)z.call(K,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(ie[J]=K[J]);var oe=arguments.length-2;if(oe===1)ie.children=F;else if(1<oe){for(var ce=Array(oe),ee=0;ee<oe;ee++)ce[ee]=arguments[ee+2];ie.children=ce}if(U&&U.defaultProps)for(J in oe=U.defaultProps,oe)ie[J]===void 0&&(ie[J]=oe[J]);return B(U,re,ie)},rt.createRef=function(){return{current:null}},rt.forwardRef=function(U){return{$$typeof:f,render:U}},rt.isValidElement=D,rt.lazy=function(U){return{$$typeof:g,_payload:{_status:-1,_result:U},_init:Z}},rt.memo=function(U,K){return{$$typeof:m,type:U,compare:K===void 0?null:K}},rt.startTransition=function(U){var K=A.T,F={};A.T=F;try{var J=U(),ie=A.S;ie!==null&&ie(F,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(O,G)}catch(re){G(re)}finally{K!==null&&F.types!==null&&(K.types=F.types),A.T=K}},rt.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},rt.use=function(U){return A.H.use(U)},rt.useActionState=function(U,K,F){return A.H.useActionState(U,K,F)},rt.useCallback=function(U,K){return A.H.useCallback(U,K)},rt.useContext=function(U){return A.H.useContext(U)},rt.useDebugValue=function(){},rt.useDeferredValue=function(U,K){return A.H.useDeferredValue(U,K)},rt.useEffect=function(U,K){return A.H.useEffect(U,K)},rt.useEffectEvent=function(U){return A.H.useEffectEvent(U)},rt.useId=function(){return A.H.useId()},rt.useImperativeHandle=function(U,K,F){return A.H.useImperativeHandle(U,K,F)},rt.useInsertionEffect=function(U,K){return A.H.useInsertionEffect(U,K)},rt.useLayoutEffect=function(U,K){return A.H.useLayoutEffect(U,K)},rt.useMemo=function(U,K){return A.H.useMemo(U,K)},rt.useOptimistic=function(U,K){return A.H.useOptimistic(U,K)},rt.useReducer=function(U,K,F){return A.H.useReducer(U,K,F)},rt.useRef=function(U){return A.H.useRef(U)},rt.useState=function(U){return A.H.useState(U)},rt.useSyncExternalStore=function(U,K,F){return A.H.useSyncExternalStore(U,K,F)},rt.useTransition=function(){return A.H.useTransition()},rt.version="19.2.7",rt}var O1;function Sc(){return O1||(O1=1,Ym.exports=UN()),Ym.exports}var h=Sc();const Cc=ex(h),HN=PN({__proto__:null,default:Cc},[h]);var Xm={exports:{}},Mi={},Km={exports:{}},Qm={};/**
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 z1;function VN(){return z1||(z1=1,(function(e){function n(V,$){var Z=V.length;V.push($);e:for(;0<Z;){var G=Z-1>>>1,X=V[G];if(0<l(X,$))V[G]=$,V[Z]=X,Z=G;else break e}}function s(V){return V.length===0?null:V[0]}function o(V){if(V.length===0)return null;var $=V[0],Z=V.pop();if(Z!==$){V[0]=Z;e:for(var G=0,X=V.length,U=X>>>1;G<U;){var K=2*(G+1)-1,F=V[K],J=K+1,ie=V[J];if(0>l(F,Z))J<X&&0>l(ie,F)?(V[G]=ie,V[J]=Z,G=J):(V[G]=F,V[K]=Z,G=K);else if(J<X&&0>l(ie,Z))V[G]=ie,V[J]=Z,G=J;else break e}}return $}function l(V,$){var Z=V.sortIndex-$.sortIndex;return Z!==0?Z:V.id-$.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var p=[],m=[],g=1,b=null,v=3,S=!1,C=!1,_=!1,w=!1,k=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function R(V){for(var $=s(m);$!==null;){if($.callback===null)o(m);else if($.startTime<=V)o(m),$.sortIndex=$.expirationTime,n(p,$);else break;$=s(m)}}function T(V){if(_=!1,R(V),!C)if(s(p)!==null)C=!0,O||(O=!0,P());else{var $=s(m);$!==null&&Y(T,$.startTime-V)}}var O=!1,A=-1,z=5,B=-1;function L(){return w?!0:!(e.unstable_now()-B<z)}function D(){if(w=!1,O){var V=e.unstable_now();B=V;var $=!0;try{e:{C=!1,_&&(_=!1,E(A),A=-1),S=!0;var Z=v;try{t:{for(R(V),b=s(p);b!==null&&!(b.expirationTime>V&&L());){var G=b.callback;if(typeof G=="function"){b.callback=null,v=b.priorityLevel;var X=G(b.expirationTime<=V);if(V=e.unstable_now(),typeof X=="function"){b.callback=X,R(V),$=!0;break t}b===s(p)&&o(p),R(V)}else o(p);b=s(p)}if(b!==null)$=!0;else{var U=s(m);U!==null&&Y(T,U.startTime-V),$=!1}}break e}finally{b=null,v=Z,S=!1}$=void 0}}finally{$?P():O=!1}}}var P;if(typeof N=="function")P=function(){N(D)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,q=H.port2;H.port1.onmessage=D,P=function(){q.postMessage(null)}}else P=function(){k(D,0)};function Y(V,$){A=k(function(){V(e.unstable_now())},$)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(V){switch(v){case 1:case 2:case 3:var $=3;break;default:$=v}var Z=v;v=$;try{return V()}finally{v=Z}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(V,$){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var Z=v;v=V;try{return $()}finally{v=Z}},e.unstable_scheduleCallback=function(V,$,Z){var G=e.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?G+Z:G):Z=G,V){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=Z+X,V={id:g++,callback:$,priorityLevel:V,startTime:Z,expirationTime:X,sortIndex:-1},Z>G?(V.sortIndex=Z,n(m,V),s(p)===null&&V===s(m)&&(_?(E(A),A=-1):_=!0,Y(T,Z-G))):(V.sortIndex=X,n(p,V),C||S||(C=!0,O||(O=!0,P()))),V},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(V){var $=v;return function(){var Z=v;v=$;try{return V.apply(this,arguments)}finally{v=Z}}}})(Qm)),Qm}var D1;function qN(){return D1||(D1=1,Km.exports=VN()),Km.exports}var Zm={exports:{}},Dn={};/**
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 L1;function $N(){if(L1)return Dn;L1=1;var e=Sc();function n(p){var m="https://react.dev/errors/"+p;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)m+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var o={d:{f:s,r:function(){throw Error(n(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},l=Symbol.for("react.portal");function c(p,m,g){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:b==null?null:""+b,children:p,containerInfo:m,implementation:g}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(p,m){if(p==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Dn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Dn.createPortal=function(p,m){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(n(299));return c(p,m,null,g)},Dn.flushSync=function(p){var m=d.T,g=o.p;try{if(d.T=null,o.p=2,p)return p()}finally{d.T=m,o.p=g,o.d.f()}},Dn.preconnect=function(p,m){typeof p=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,o.d.C(p,m))},Dn.prefetchDNS=function(p){typeof p=="string"&&o.d.D(p)},Dn.preinit=function(p,m){if(typeof p=="string"&&m&&typeof m.as=="string"){var g=m.as,b=f(g,m.crossOrigin),v=typeof m.integrity=="string"?m.integrity:void 0,S=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;g==="style"?o.d.S(p,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:b,integrity:v,fetchPriority:S}):g==="script"&&o.d.X(p,{crossOrigin:b,integrity:v,fetchPriority:S,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Dn.preinitModule=function(p,m){if(typeof p=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var g=f(m.as,m.crossOrigin);o.d.M(p,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&o.d.M(p)},Dn.preload=function(p,m){if(typeof p=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var g=m.as,b=f(g,m.crossOrigin);o.d.L(p,g,{crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Dn.preloadModule=function(p,m){if(typeof p=="string")if(m){var g=f(m.as,m.crossOrigin);o.d.m(p,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else o.d.m(p)},Dn.requestFormReset=function(p){o.d.r(p)},Dn.unstable_batchedUpdates=function(p,m){return p(m)},Dn.useFormState=function(p,m,g){return d.H.useFormState(p,m,g)},Dn.useFormStatus=function(){return d.H.useHostTransitionStatus()},Dn.version="19.2.7",Dn}var P1;function bw(){if(P1)return Zm.exports;P1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Zm.exports=$N(),Zm.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 I1;function GN(){if(I1)return Mi;I1=1;var e=qN(),n=Sc(),s=bw();function o(t){var a="https://react.dev/errors/"+t;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)a+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+t+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var a=t,i=t;if(t.alternate)for(;a.return;)a=a.return;else{t=a;do a=t,(a.flags&4098)!==0&&(i=a.return),t=a.return;while(t)}return a.tag===3?i:null}function d(t){if(t.tag===13){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function f(t){if(t.tag===31){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function p(t){if(c(t)!==t)throw Error(o(188))}function m(t){var a=t.alternate;if(!a){if(a=c(t),a===null)throw Error(o(188));return a!==t?null:t}for(var i=t,u=a;;){var x=i.return;if(x===null)break;var y=x.alternate;if(y===null){if(u=x.return,u!==null){i=u;continue}break}if(x.child===y.child){for(y=x.child;y;){if(y===i)return p(x),t;if(y===u)return p(x),a;y=y.sibling}throw Error(o(188))}if(i.return!==u.return)i=x,u=y;else{for(var M=!1,I=x.child;I;){if(I===i){M=!0,i=x,u=y;break}if(I===u){M=!0,u=x,i=y;break}I=I.sibling}if(!M){for(I=y.child;I;){if(I===i){M=!0,i=y,u=x;break}if(I===u){M=!0,u=y,i=x;break}I=I.sibling}if(!M)throw Error(o(189))}}if(i.alternate!==u)throw Error(o(190))}if(i.tag!==3)throw Error(o(188));return i.stateNode.current===i?t:a}function g(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t;for(t=t.child;t!==null;){if(a=g(t),a!==null)return a;t=t.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),N=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),D=Symbol.iterator;function P(t){return t===null||typeof t!="object"?null:(t=D&&t[D]||t["@@iterator"],typeof t=="function"?t:null)}var H=Symbol.for("react.client.reference");function q(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===H?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case _:return"Fragment";case k:return"Profiler";case w:return"StrictMode";case T:return"Suspense";case O:return"SuspenseList";case B:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case C:return"Portal";case N:return t.displayName||"Context";case E:return(t._context.displayName||"Context")+".Consumer";case R:var a=t.render;return t=t.displayName,t||(t=a.displayName||a.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case A:return a=t.displayName||null,a!==null?a:q(t.type)||"Memo";case z:a=t._payload,t=t._init;try{return q(t(a))}catch{}}return null}var Y=Array.isArray,V=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},G=[],X=-1;function U(t){return{current:t}}function K(t){0>X||(t.current=G[X],G[X]=null,X--)}function F(t,a){X++,G[X]=t.current,t.current=a}var J=U(null),ie=U(null),re=U(null),oe=U(null);function ce(t,a){switch(F(re,a),F(ie,t),F(J,null),a.nodeType){case 9:case 11:t=(t=a.documentElement)&&(t=t.namespaceURI)?J0(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=J0(a),t=e1(a,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}K(J),F(J,t)}function ee(){K(J),K(ie),K(re)}function Te(t){t.memoizedState!==null&&F(oe,t);var a=J.current,i=e1(a,t.type);a!==i&&(F(ie,t),F(J,i))}function Fe(t){ie.current===t&&(K(J),K(ie)),oe.current===t&&(K(oe),Ei._currentValue=Z)}var ve,Ce;function Ne(t){if(ve===void 0)try{throw Error()}catch(i){var a=i.stack.trim().match(/\n( *(at )?)/);ve=a&&a[1]||"",Ce=-1<i.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+ve+t+Ce}var Pe=!1;function Ie(t,a){if(!t||Pe)return"";Pe=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(a){var xe=function(){throw Error()};if(Object.defineProperty(xe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(xe,[])}catch(ue){var se=ue}Reflect.construct(t,[],xe)}else{try{xe.call()}catch(ue){se=ue}t.call(xe.prototype)}}else{try{throw Error()}catch(ue){se=ue}(xe=t())&&typeof xe.catch=="function"&&xe.catch(function(){})}}catch(ue){if(ue&&se&&typeof ue.stack=="string")return[ue.stack,se.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=u.DetermineComponentFrameRoot(),M=y[0],I=y[1];if(M&&I){var Q=M.split(`
44
+ `),ae=I.split(`
45
+ `);for(x=u=0;u<Q.length&&!Q[u].includes("DetermineComponentFrameRoot");)u++;for(;x<ae.length&&!ae[x].includes("DetermineComponentFrameRoot");)x++;if(u===Q.length||x===ae.length)for(u=Q.length-1,x=ae.length-1;1<=u&&0<=x&&Q[u]!==ae[x];)x--;for(;1<=u&&0<=x;u--,x--)if(Q[u]!==ae[x]){if(u!==1||x!==1)do if(u--,x--,0>x||Q[u]!==ae[x]){var fe=`
46
+ `+Q[u].replace(" at new "," at ");return t.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",t.displayName)),fe}while(1<=u&&0<=x);break}}}finally{Pe=!1,Error.prepareStackTrace=i}return(i=t?t.displayName||t.name:"")?Ne(i):""}function be(t,a){switch(t.tag){case 26:case 27:case 5:return Ne(t.type);case 16:return Ne("Lazy");case 13:return t.child!==a&&a!==null?Ne("Suspense Fallback"):Ne("Suspense");case 19:return Ne("SuspenseList");case 0:case 15:return Ie(t.type,!1);case 11:return Ie(t.type.render,!1);case 1:return Ie(t.type,!0);case 31:return Ne("Activity");default:return""}}function Ae(t){try{var a="",i=null;do a+=be(t,i),i=t,t=t.return;while(t);return a}catch(u){return`
47
+ Error generating stack: `+u.message+`
48
+ `+u.stack}}var we=Object.prototype.hasOwnProperty,Be=e.unstable_scheduleCallback,Xe=e.unstable_cancelCallback,Ye=e.unstable_shouldYield,De=e.unstable_requestPaint,ye=e.unstable_now,le=e.unstable_getCurrentPriorityLevel,je=e.unstable_ImmediatePriority,Se=e.unstable_UserBlockingPriority,Ue=e.unstable_NormalPriority,Je=e.unstable_LowPriority,_t=e.unstable_IdlePriority,zt=e.log,pe=e.unstable_setDisableYieldValue,Ee=null,Re=null;function qe(t){if(typeof zt=="function"&&pe(t),Re&&typeof Re.setStrictMode=="function")try{Re.setStrictMode(Ee,t)}catch{}}var st=Math.clz32?Math.clz32:mt,an=Math.log,Vt=Math.LN2;function mt(t){return t>>>=0,t===0?32:31-(an(t)/Vt|0)|0}var Nt=256,Wt=262144,St=4194304;function sn(t){var a=t&42;if(a!==0)return a;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Ft(t,a,i){var u=t.pendingLanes;if(u===0)return 0;var x=0,y=t.suspendedLanes,M=t.pingedLanes;t=t.warmLanes;var I=u&134217727;return I!==0?(u=I&~y,u!==0?x=sn(u):(M&=I,M!==0?x=sn(M):i||(i=I&~t,i!==0&&(x=sn(i))))):(I=u&~y,I!==0?x=sn(I):M!==0?x=sn(M):i||(i=u&~t,i!==0&&(x=sn(i)))),x===0?0:a!==0&&a!==x&&(a&y)===0&&(y=x&-x,i=a&-a,y>=i||y===32&&(i&4194048)!==0)?a:x}function dn(t,a){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&a)===0}function On(t,a){switch(t){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 Kn(){var t=St;return St<<=1,(St&62914560)===0&&(St=4194304),t}function ia(t){for(var a=[],i=0;31>i;i++)a.push(t);return a}function Qn(t,a){t.pendingLanes|=a,a!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function us(t,a,i,u,x,y){var M=t.pendingLanes;t.pendingLanes=i,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=i,t.entangledLanes&=i,t.errorRecoveryDisabledLanes&=i,t.shellSuspendCounter=0;var I=t.entanglements,Q=t.expirationTimes,ae=t.hiddenUpdates;for(i=M&~i;0<i;){var fe=31-st(i),xe=1<<fe;I[fe]=0,Q[fe]=-1;var se=ae[fe];if(se!==null)for(ae[fe]=null,fe=0;fe<se.length;fe++){var ue=se[fe];ue!==null&&(ue.lane&=-536870913)}i&=~xe}u!==0&&zn(t,u,0),y!==0&&x===0&&t.tag!==0&&(t.suspendedLanes|=y&~(M&~a))}function zn(t,a,i){t.pendingLanes|=a,t.suspendedLanes&=~a;var u=31-st(a);t.entangledLanes|=a,t.entanglements[u]=t.entanglements[u]|1073741824|i&261930}function ca(t,a){var i=t.entangledLanes|=a;for(t=t.entanglements;i;){var u=31-st(i),x=1<<u;x&a|t[u]&a&&(t[u]|=a),i&=~x}}function Ia(t,a){var i=a&-a;return i=(i&42)!==0?1:ds(i),(i&(t.suspendedLanes|a))!==0?0:i}function ds(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function it(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Dt(){var t=$.p;return t!==0?t:(t=window.event,t===void 0?32:w1(t.type))}function Sn(t,a){var i=$.p;try{return $.p=t,a()}finally{$.p=i}}var rn=Math.random().toString(36).slice(2),Rt="__reactFiber$"+rn,hn="__reactProps$"+rn,Lr="__reactContainer$"+rn,Lc="__reactEvents$"+rn,kk="__reactListeners$"+rn,Ek="__reactHandles$"+rn,Ub="__reactResources$"+rn,Vl="__reactMarker$"+rn;function If(t){delete t[Rt],delete t[hn],delete t[Lc],delete t[kk],delete t[Ek]}function Co(t){var a=t[Rt];if(a)return a;for(var i=t.parentNode;i;){if(a=i[Lr]||i[Rt]){if(i=a.alternate,a.child!==null||i!==null&&i.child!==null)for(t=l1(t);t!==null;){if(i=t[Rt])return i;t=l1(t)}return a}t=i,i=t.parentNode}return null}function ko(t){if(t=t[Rt]||t[Lr]){var a=t.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return t}return null}function ql(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t.stateNode;throw Error(o(33))}function Eo(t){var a=t[Ub];return a||(a=t[Ub]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function jn(t){t[Vl]=!0}var Hb=new Set,Vb={};function Pr(t,a){No(t,a),No(t+"Capture",a)}function No(t,a){for(Vb[t]=a,t=0;t<a.length;t++)Hb.add(a[t])}var Nk=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]*$"),qb={},$b={};function Rk(t){return we.call($b,t)?!0:we.call(qb,t)?!1:Nk.test(t)?$b[t]=!0:(qb[t]=!0,!1)}function Pc(t,a,i){if(Rk(a))if(i===null)t.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":t.removeAttribute(a);return;case"boolean":var u=a.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){t.removeAttribute(a);return}}t.setAttribute(a,""+i)}}function Ic(t,a,i){if(i===null)t.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttribute(a,""+i)}}function fs(t,a,i,u){if(u===null)t.removeAttribute(i);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(i);return}t.setAttributeNS(a,i,""+u)}}function ja(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Gb(t){var a=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Tk(t,a,i){var u=Object.getOwnPropertyDescriptor(t.constructor.prototype,a);if(!t.hasOwnProperty(a)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var x=u.get,y=u.set;return Object.defineProperty(t,a,{configurable:!0,get:function(){return x.call(this)},set:function(M){i=""+M,y.call(this,M)}}),Object.defineProperty(t,a,{enumerable:u.enumerable}),{getValue:function(){return i},setValue:function(M){i=""+M},stopTracking:function(){t._valueTracker=null,delete t[a]}}}}function Bf(t){if(!t._valueTracker){var a=Gb(t)?"checked":"value";t._valueTracker=Tk(t,a,""+t[a])}}function Fb(t){if(!t)return!1;var a=t._valueTracker;if(!a)return!0;var i=a.getValue(),u="";return t&&(u=Gb(t)?t.checked?"true":"false":t.value),t=u,t!==i?(a.setValue(t),!0):!1}function Bc(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Ak=/[\n"\\]/g;function wa(t){return t.replace(Ak,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Uf(t,a,i,u,x,y,M,I){t.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?t.type=M:t.removeAttribute("type"),a!=null?M==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+ja(a)):t.value!==""+ja(a)&&(t.value=""+ja(a)):M!=="submit"&&M!=="reset"||t.removeAttribute("value"),a!=null?Hf(t,M,ja(a)):i!=null?Hf(t,M,ja(i)):u!=null&&t.removeAttribute("value"),x==null&&y!=null&&(t.defaultChecked=!!y),x!=null&&(t.checked=x&&typeof x!="function"&&typeof x!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?t.name=""+ja(I):t.removeAttribute("name")}function Yb(t,a,i,u,x,y,M,I){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(t.type=y),a!=null||i!=null){if(!(y!=="submit"&&y!=="reset"||a!=null)){Bf(t);return}i=i!=null?""+ja(i):"",a=a!=null?""+ja(a):i,I||a===t.value||(t.value=a),t.defaultValue=a}u=u??x,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=I?t.checked:!!u,t.defaultChecked=!!u,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(t.name=M),Bf(t)}function Hf(t,a,i){a==="number"&&Bc(t.ownerDocument)===t||t.defaultValue===""+i||(t.defaultValue=""+i)}function Ro(t,a,i,u){if(t=t.options,a){a={};for(var x=0;x<i.length;x++)a["$"+i[x]]=!0;for(i=0;i<t.length;i++)x=a.hasOwnProperty("$"+t[i].value),t[i].selected!==x&&(t[i].selected=x),x&&u&&(t[i].defaultSelected=!0)}else{for(i=""+ja(i),a=null,x=0;x<t.length;x++){if(t[x].value===i){t[x].selected=!0,u&&(t[x].defaultSelected=!0);return}a!==null||t[x].disabled||(a=t[x])}a!==null&&(a.selected=!0)}}function Xb(t,a,i){if(a!=null&&(a=""+ja(a),a!==t.value&&(t.value=a),i==null)){t.defaultValue!==a&&(t.defaultValue=a);return}t.defaultValue=i!=null?""+ja(i):""}function Kb(t,a,i,u){if(a==null){if(u!=null){if(i!=null)throw Error(o(92));if(Y(u)){if(1<u.length)throw Error(o(93));u=u[0]}i=u}i==null&&(i=""),a=i}i=ja(a),t.defaultValue=i,u=t.textContent,u===i&&u!==""&&u!==null&&(t.value=u),Bf(t)}function To(t,a){if(a){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=a;return}}t.textContent=a}var Mk=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 Qb(t,a,i){var u=a.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?u?t.setProperty(a,""):a==="float"?t.cssFloat="":t[a]="":u?t.setProperty(a,i):typeof i!="number"||i===0||Mk.has(a)?a==="float"?t.cssFloat=i:t[a]=(""+i).trim():t[a]=i+"px"}function Zb(t,a,i){if(a!=null&&typeof a!="object")throw Error(o(62));if(t=t.style,i!=null){for(var u in i)!i.hasOwnProperty(u)||a!=null&&a.hasOwnProperty(u)||(u.indexOf("--")===0?t.setProperty(u,""):u==="float"?t.cssFloat="":t[u]="");for(var x in a)u=a[x],a.hasOwnProperty(x)&&i[x]!==u&&Qb(t,x,u)}else for(var y in a)a.hasOwnProperty(y)&&Qb(t,y,a[y])}function Vf(t){if(t.indexOf("-")===-1)return!1;switch(t){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 Ok=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"]]),zk=/^[\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 Uc(t){return zk.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function ps(){}var qf=null;function $f(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Ao=null,Mo=null;function Wb(t){var a=ko(t);if(a&&(t=a.stateNode)){var i=t[hn]||null;e:switch(t=a.stateNode,a.type){case"input":if(Uf(t,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),a=i.name,i.type==="radio"&&a!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+wa(""+a)+'"][type="radio"]'),a=0;a<i.length;a++){var u=i[a];if(u!==t&&u.form===t.form){var x=u[hn]||null;if(!x)throw Error(o(90));Uf(u,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(a=0;a<i.length;a++)u=i[a],u.form===t.form&&Fb(u)}break e;case"textarea":Xb(t,i.value,i.defaultValue);break e;case"select":a=i.value,a!=null&&Ro(t,!!i.multiple,a,!1)}}}var Gf=!1;function Jb(t,a,i){if(Gf)return t(a,i);Gf=!0;try{var u=t(a);return u}finally{if(Gf=!1,(Ao!==null||Mo!==null)&&(Eu(),Ao&&(a=Ao,t=Mo,Mo=Ao=null,Wb(a),t)))for(a=0;a<t.length;a++)Wb(t[a])}}function $l(t,a){var i=t.stateNode;if(i===null)return null;var u=i[hn]||null;if(u===null)return null;i=u[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":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(o(231,a,typeof i));return i}var ms=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ff=!1;if(ms)try{var Gl={};Object.defineProperty(Gl,"passive",{get:function(){Ff=!0}}),window.addEventListener("test",Gl,Gl),window.removeEventListener("test",Gl,Gl)}catch{Ff=!1}var Gs=null,Yf=null,Hc=null;function ev(){if(Hc)return Hc;var t,a=Yf,i=a.length,u,x="value"in Gs?Gs.value:Gs.textContent,y=x.length;for(t=0;t<i&&a[t]===x[t];t++);var M=i-t;for(u=1;u<=M&&a[i-u]===x[y-u];u++);return Hc=x.slice(t,1<u?1-u:void 0)}function Vc(t){var a=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&a===13&&(t=13)):t=a,t===10&&(t=13),32<=t||t===13?t:0}function qc(){return!0}function tv(){return!1}function Zn(t){function a(i,u,x,y,M){this._reactName=i,this._targetInst=x,this.type=u,this.nativeEvent=y,this.target=M,this.currentTarget=null;for(var I in t)t.hasOwnProperty(I)&&(i=t[I],this[I]=i?i(y):y[I]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?qc:tv,this.isPropagationStopped=tv,this}return b(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=qc)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=qc)},persist:function(){},isPersistent:qc}),a}var Ir={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$c=Zn(Ir),Fl=b({},Ir,{view:0,detail:0}),Dk=Zn(Fl),Xf,Kf,Yl,Gc=b({},Fl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zf,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Yl&&(Yl&&t.type==="mousemove"?(Xf=t.screenX-Yl.screenX,Kf=t.screenY-Yl.screenY):Kf=Xf=0,Yl=t),Xf)},movementY:function(t){return"movementY"in t?t.movementY:Kf}}),nv=Zn(Gc),Lk=b({},Gc,{dataTransfer:0}),Pk=Zn(Lk),Ik=b({},Fl,{relatedTarget:0}),Qf=Zn(Ik),Bk=b({},Ir,{animationName:0,elapsedTime:0,pseudoElement:0}),Uk=Zn(Bk),Hk=b({},Ir,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Vk=Zn(Hk),qk=b({},Ir,{data:0}),av=Zn(qk),$k={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Gk={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"},Fk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Yk(t){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(t):(t=Fk[t])?!!a[t]:!1}function Zf(){return Yk}var Xk=b({},Fl,{key:function(t){if(t.key){var a=$k[t.key]||t.key;if(a!=="Unidentified")return a}return t.type==="keypress"?(t=Vc(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Gk[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zf,charCode:function(t){return t.type==="keypress"?Vc(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Vc(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Kk=Zn(Xk),Qk=b({},Gc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),sv=Zn(Qk),Zk=b({},Fl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zf}),Wk=Zn(Zk),Jk=b({},Ir,{propertyName:0,elapsedTime:0,pseudoElement:0}),eE=Zn(Jk),tE=b({},Gc,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),nE=Zn(tE),aE=b({},Ir,{newState:0,oldState:0}),sE=Zn(aE),rE=[9,13,27,32],Wf=ms&&"CompositionEvent"in window,Xl=null;ms&&"documentMode"in document&&(Xl=document.documentMode);var oE=ms&&"TextEvent"in window&&!Xl,rv=ms&&(!Wf||Xl&&8<Xl&&11>=Xl),ov=" ",lv=!1;function iv(t,a){switch(t){case"keyup":return rE.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cv(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Oo=!1;function lE(t,a){switch(t){case"compositionend":return cv(a);case"keypress":return a.which!==32?null:(lv=!0,ov);case"textInput":return t=a.data,t===ov&&lv?null:t;default:return null}}function iE(t,a){if(Oo)return t==="compositionend"||!Wf&&iv(t,a)?(t=ev(),Hc=Yf=Gs=null,Oo=!1,t):null;switch(t){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 rv&&a.locale!=="ko"?null:a.data;default:return null}}var cE={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 uv(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a==="input"?!!cE[t.type]:a==="textarea"}function dv(t,a,i,u){Ao?Mo?Mo.push(u):Mo=[u]:Ao=u,a=zu(a,"onChange"),0<a.length&&(i=new $c("onChange","change",null,i,u),t.push({event:i,listeners:a}))}var Kl=null,Ql=null;function uE(t){Y0(t,0)}function Fc(t){var a=ql(t);if(Fb(a))return t}function fv(t,a){if(t==="change")return a}var pv=!1;if(ms){var Jf;if(ms){var ep="oninput"in document;if(!ep){var mv=document.createElement("div");mv.setAttribute("oninput","return;"),ep=typeof mv.oninput=="function"}Jf=ep}else Jf=!1;pv=Jf&&(!document.documentMode||9<document.documentMode)}function gv(){Kl&&(Kl.detachEvent("onpropertychange",hv),Ql=Kl=null)}function hv(t){if(t.propertyName==="value"&&Fc(Ql)){var a=[];dv(a,Ql,t,$f(t)),Jb(uE,a)}}function dE(t,a,i){t==="focusin"?(gv(),Kl=a,Ql=i,Kl.attachEvent("onpropertychange",hv)):t==="focusout"&&gv()}function fE(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Fc(Ql)}function pE(t,a){if(t==="click")return Fc(a)}function mE(t,a){if(t==="input"||t==="change")return Fc(a)}function gE(t,a){return t===a&&(t!==0||1/t===1/a)||t!==t&&a!==a}var ua=typeof Object.is=="function"?Object.is:gE;function Zl(t,a){if(ua(t,a))return!0;if(typeof t!="object"||t===null||typeof a!="object"||a===null)return!1;var i=Object.keys(t),u=Object.keys(a);if(i.length!==u.length)return!1;for(u=0;u<i.length;u++){var x=i[u];if(!we.call(a,x)||!ua(t[x],a[x]))return!1}return!0}function xv(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function bv(t,a){var i=xv(t);t=0;for(var u;i;){if(i.nodeType===3){if(u=t+i.textContent.length,t<=a&&u>=a)return{node:i,offset:a-t};t=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=xv(i)}}function vv(t,a){return t&&a?t===a?!0:t&&t.nodeType===3?!1:a&&a.nodeType===3?vv(t,a.parentNode):"contains"in t?t.contains(a):t.compareDocumentPosition?!!(t.compareDocumentPosition(a)&16):!1:!1}function yv(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var a=Bc(t.document);a instanceof t.HTMLIFrameElement;){try{var i=typeof a.contentWindow.location.href=="string"}catch{i=!1}if(i)t=a.contentWindow;else break;a=Bc(t.document)}return a}function tp(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a&&(a==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||a==="textarea"||t.contentEditable==="true")}var hE=ms&&"documentMode"in document&&11>=document.documentMode,zo=null,np=null,Wl=null,ap=!1;function _v(t,a,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;ap||zo==null||zo!==Bc(u)||(u=zo,"selectionStart"in u&&tp(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Wl&&Zl(Wl,u)||(Wl=u,u=zu(np,"onSelect"),0<u.length&&(a=new $c("onSelect","select",null,a,i),t.push({event:a,listeners:u}),a.target=zo)))}function Br(t,a){var i={};return i[t.toLowerCase()]=a.toLowerCase(),i["Webkit"+t]="webkit"+a,i["Moz"+t]="moz"+a,i}var Do={animationend:Br("Animation","AnimationEnd"),animationiteration:Br("Animation","AnimationIteration"),animationstart:Br("Animation","AnimationStart"),transitionrun:Br("Transition","TransitionRun"),transitionstart:Br("Transition","TransitionStart"),transitioncancel:Br("Transition","TransitionCancel"),transitionend:Br("Transition","TransitionEnd")},sp={},jv={};ms&&(jv=document.createElement("div").style,"AnimationEvent"in window||(delete Do.animationend.animation,delete Do.animationiteration.animation,delete Do.animationstart.animation),"TransitionEvent"in window||delete Do.transitionend.transition);function Ur(t){if(sp[t])return sp[t];if(!Do[t])return t;var a=Do[t],i;for(i in a)if(a.hasOwnProperty(i)&&i in jv)return sp[t]=a[i];return t}var wv=Ur("animationend"),Sv=Ur("animationiteration"),Cv=Ur("animationstart"),xE=Ur("transitionrun"),bE=Ur("transitionstart"),vE=Ur("transitioncancel"),kv=Ur("transitionend"),Ev=new Map,rp="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(" ");rp.push("scrollEnd");function Ba(t,a){Ev.set(t,a),Pr(a,[t])}var Yc=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=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(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Sa=[],Lo=0,op=0;function Xc(){for(var t=Lo,a=op=Lo=0;a<t;){var i=Sa[a];Sa[a++]=null;var u=Sa[a];Sa[a++]=null;var x=Sa[a];Sa[a++]=null;var y=Sa[a];if(Sa[a++]=null,u!==null&&x!==null){var M=u.pending;M===null?x.next=x:(x.next=M.next,M.next=x),u.pending=x}y!==0&&Nv(i,x,y)}}function Kc(t,a,i,u){Sa[Lo++]=t,Sa[Lo++]=a,Sa[Lo++]=i,Sa[Lo++]=u,op|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function lp(t,a,i,u){return Kc(t,a,i,u),Qc(t)}function Hr(t,a){return Kc(t,null,null,a),Qc(t)}function Nv(t,a,i){t.lanes|=i;var u=t.alternate;u!==null&&(u.lanes|=i);for(var x=!1,y=t.return;y!==null;)y.childLanes|=i,u=y.alternate,u!==null&&(u.childLanes|=i),y.tag===22&&(t=y.stateNode,t===null||t._visibility&1||(x=!0)),t=y,y=y.return;return t.tag===3?(y=t.stateNode,x&&a!==null&&(x=31-st(i),t=y.hiddenUpdates,u=t[x],u===null?t[x]=[a]:u.push(a),a.lane=i|536870912),y):null}function Qc(t){if(50<yi)throw yi=0,hm=null,Error(o(185));for(var a=t.return;a!==null;)t=a,a=t.return;return t.tag===3?t.stateNode:null}var Po={};function yE(t,a,i,u){this.tag=t,this.key=i,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=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function da(t,a,i,u){return new yE(t,a,i,u)}function ip(t){return t=t.prototype,!(!t||!t.isReactComponent)}function gs(t,a){var i=t.alternate;return i===null?(i=da(t.tag,a,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=a,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&65011712,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,a=t.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i.refCleanup=t.refCleanup,i}function Rv(t,a){t.flags&=65011714;var i=t.alternate;return i===null?(t.childLanes=0,t.lanes=a,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=i.childLanes,t.lanes=i.lanes,t.child=i.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=i.memoizedProps,t.memoizedState=i.memoizedState,t.updateQueue=i.updateQueue,t.type=i.type,a=i.dependencies,t.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),t}function Zc(t,a,i,u,x,y){var M=0;if(u=t,typeof t=="function")ip(t)&&(M=1);else if(typeof t=="string")M=CN(t,i,J.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case B:return t=da(31,i,a,x),t.elementType=B,t.lanes=y,t;case _:return Vr(i.children,x,y,a);case w:M=8,x|=24;break;case k:return t=da(12,i,a,x|2),t.elementType=k,t.lanes=y,t;case T:return t=da(13,i,a,x),t.elementType=T,t.lanes=y,t;case O:return t=da(19,i,a,x),t.elementType=O,t.lanes=y,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case N:M=10;break e;case E:M=9;break e;case R:M=11;break e;case A:M=14;break e;case z:M=16,u=null;break e}M=29,i=Error(o(130,t===null?"null":typeof t,"")),u=null}return a=da(M,i,a,x),a.elementType=t,a.type=u,a.lanes=y,a}function Vr(t,a,i,u){return t=da(7,t,u,a),t.lanes=i,t}function cp(t,a,i){return t=da(6,t,null,a),t.lanes=i,t}function Tv(t){var a=da(18,null,null,0);return a.stateNode=t,a}function up(t,a,i){return a=da(4,t.children!==null?t.children:[],t.key,a),a.lanes=i,a.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},a}var Av=new WeakMap;function Ca(t,a){if(typeof t=="object"&&t!==null){var i=Av.get(t);return i!==void 0?i:(a={value:t,source:a,stack:Ae(a)},Av.set(t,a),a)}return{value:t,source:a,stack:Ae(a)}}var Io=[],Bo=0,Wc=null,Jl=0,ka=[],Ea=0,Fs=null,Xa=1,Ka="";function hs(t,a){Io[Bo++]=Jl,Io[Bo++]=Wc,Wc=t,Jl=a}function Mv(t,a,i){ka[Ea++]=Xa,ka[Ea++]=Ka,ka[Ea++]=Fs,Fs=t;var u=Xa;t=Ka;var x=32-st(u)-1;u&=~(1<<x),i+=1;var y=32-st(a)+x;if(30<y){var M=x-x%5;y=(u&(1<<M)-1).toString(32),u>>=M,x-=M,Xa=1<<32-st(a)+x|i<<x|u,Ka=y+t}else Xa=1<<y|i<<x|u,Ka=t}function dp(t){t.return!==null&&(hs(t,1),Mv(t,1,0))}function fp(t){for(;t===Wc;)Wc=Io[--Bo],Io[Bo]=null,Jl=Io[--Bo],Io[Bo]=null;for(;t===Fs;)Fs=ka[--Ea],ka[Ea]=null,Ka=ka[--Ea],ka[Ea]=null,Xa=ka[--Ea],ka[Ea]=null}function Ov(t,a){ka[Ea++]=Xa,ka[Ea++]=Ka,ka[Ea++]=Fs,Xa=a.id,Ka=a.overflow,Fs=t}var Cn=null,Yt=null,jt=!1,Ys=null,Na=!1,pp=Error(o(519));function Xs(t){var a=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ei(Ca(a,t)),pp}function zv(t){var a=t.stateNode,i=t.type,u=t.memoizedProps;switch(a[Rt]=t,a[hn]=u,i){case"dialog":ht("cancel",a),ht("close",a);break;case"iframe":case"object":case"embed":ht("load",a);break;case"video":case"audio":for(i=0;i<ji.length;i++)ht(ji[i],a);break;case"source":ht("error",a);break;case"img":case"image":case"link":ht("error",a),ht("load",a);break;case"details":ht("toggle",a);break;case"input":ht("invalid",a),Yb(a,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":ht("invalid",a);break;case"textarea":ht("invalid",a),Kb(a,u.value,u.defaultValue,u.children)}i=u.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||a.textContent===""+i||u.suppressHydrationWarning===!0||Z0(a.textContent,i)?(u.popover!=null&&(ht("beforetoggle",a),ht("toggle",a)),u.onScroll!=null&&ht("scroll",a),u.onScrollEnd!=null&&ht("scrollend",a),u.onClick!=null&&(a.onclick=ps),a=!0):a=!1,a||Xs(t,!0)}function Dv(t){for(Cn=t.return;Cn;)switch(Cn.tag){case 5:case 31:case 13:Na=!1;return;case 27:case 3:Na=!0;return;default:Cn=Cn.return}}function Uo(t){if(t!==Cn)return!1;if(!jt)return Dv(t),jt=!0,!1;var a=t.tag,i;if((i=a!==3&&a!==27)&&((i=a===5)&&(i=t.type,i=!(i!=="form"&&i!=="button")||Am(t.type,t.memoizedProps)),i=!i),i&&Yt&&Xs(t),Dv(t),a===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(o(317));Yt=o1(t)}else if(a===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(o(317));Yt=o1(t)}else a===27?(a=Yt,ir(t.type)?(t=Lm,Lm=null,Yt=t):Yt=a):Yt=Cn?Ta(t.stateNode.nextSibling):null;return!0}function qr(){Yt=Cn=null,jt=!1}function mp(){var t=Ys;return t!==null&&(ta===null?ta=t:ta.push.apply(ta,t),Ys=null),t}function ei(t){Ys===null?Ys=[t]:Ys.push(t)}var gp=U(null),$r=null,xs=null;function Ks(t,a,i){F(gp,a._currentValue),a._currentValue=i}function bs(t){t._currentValue=gp.current,K(gp)}function hp(t,a,i){for(;t!==null;){var u=t.alternate;if((t.childLanes&a)!==a?(t.childLanes|=a,u!==null&&(u.childLanes|=a)):u!==null&&(u.childLanes&a)!==a&&(u.childLanes|=a),t===i)break;t=t.return}}function xp(t,a,i,u){var x=t.child;for(x!==null&&(x.return=t);x!==null;){var y=x.dependencies;if(y!==null){var M=x.child;y=y.firstContext;e:for(;y!==null;){var I=y;y=x;for(var Q=0;Q<a.length;Q++)if(I.context===a[Q]){y.lanes|=i,I=y.alternate,I!==null&&(I.lanes|=i),hp(y.return,i,t),u||(M=null);break e}y=I.next}}else if(x.tag===18){if(M=x.return,M===null)throw Error(o(341));M.lanes|=i,y=M.alternate,y!==null&&(y.lanes|=i),hp(M,i,t),M=null}else M=x.child;if(M!==null)M.return=x;else for(M=x;M!==null;){if(M===t){M=null;break}if(x=M.sibling,x!==null){x.return=M.return,M=x;break}M=M.return}x=M}}function Ho(t,a,i,u){t=null;for(var x=a,y=!1;x!==null;){if(!y){if((x.flags&524288)!==0)y=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var M=x.alternate;if(M===null)throw Error(o(387));if(M=M.memoizedProps,M!==null){var I=x.type;ua(x.pendingProps.value,M.value)||(t!==null?t.push(I):t=[I])}}else if(x===oe.current){if(M=x.alternate,M===null)throw Error(o(387));M.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(t!==null?t.push(Ei):t=[Ei])}x=x.return}t!==null&&xp(a,t,i,u),a.flags|=262144}function Jc(t){for(t=t.firstContext;t!==null;){if(!ua(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Gr(t){$r=t,xs=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function kn(t){return Lv($r,t)}function eu(t,a){return $r===null&&Gr(t),Lv(t,a)}function Lv(t,a){var i=a._currentValue;if(a={context:a,memoizedValue:i,next:null},xs===null){if(t===null)throw Error(o(308));xs=a,t.dependencies={lanes:0,firstContext:a},t.flags|=524288}else xs=xs.next=a;return i}var _E=typeof AbortController<"u"?AbortController:function(){var t=[],a=this.signal={aborted:!1,addEventListener:function(i,u){t.push(u)}};this.abort=function(){a.aborted=!0,t.forEach(function(i){return i()})}},jE=e.unstable_scheduleCallback,wE=e.unstable_NormalPriority,xn={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bp(){return{controller:new _E,data:new Map,refCount:0}}function ti(t){t.refCount--,t.refCount===0&&jE(wE,function(){t.controller.abort()})}var ni=null,vp=0,Vo=0,qo=null;function SE(t,a){if(ni===null){var i=ni=[];vp=0,Vo=jm(),qo={status:"pending",value:void 0,then:function(u){i.push(u)}}}return vp++,a.then(Pv,Pv),a}function Pv(){if(--vp===0&&ni!==null){qo!==null&&(qo.status="fulfilled");var t=ni;ni=null,Vo=0,qo=null;for(var a=0;a<t.length;a++)(0,t[a])()}}function CE(t,a){var i=[],u={status:"pending",value:null,reason:null,then:function(x){i.push(x)}};return t.then(function(){u.status="fulfilled",u.value=a;for(var x=0;x<i.length;x++)(0,i[x])(a)},function(x){for(u.status="rejected",u.reason=x,x=0;x<i.length;x++)(0,i[x])(void 0)}),u}var Iv=V.S;V.S=function(t,a){_0=ye(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&SE(t,a),Iv!==null&&Iv(t,a)};var Fr=U(null);function yp(){var t=Fr.current;return t!==null?t:qt.pooledCache}function tu(t,a){a===null?F(Fr,Fr.current):F(Fr,a.pool)}function Bv(){var t=yp();return t===null?null:{parent:xn._currentValue,pool:t}}var $o=Error(o(460)),_p=Error(o(474)),nu=Error(o(542)),au={then:function(){}};function Uv(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Hv(t,a,i){switch(i=t[i],i===void 0?t.push(a):i!==a&&(a.then(ps,ps),a=i),a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,qv(t),t;default:if(typeof a.status=="string")a.then(ps,ps);else{if(t=qt,t!==null&&100<t.shellSuspendCounter)throw Error(o(482));t=a,t.status="pending",t.then(function(u){if(a.status==="pending"){var x=a;x.status="fulfilled",x.value=u}},function(u){if(a.status==="pending"){var x=a;x.status="rejected",x.reason=u}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,qv(t),t}throw Xr=a,$o}}function Yr(t){try{var a=t._init;return a(t._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(Xr=i,$o):i}}var Xr=null;function Vv(){if(Xr===null)throw Error(o(459));var t=Xr;return Xr=null,t}function qv(t){if(t===$o||t===nu)throw Error(o(483))}var Go=null,ai=0;function su(t){var a=ai;return ai+=1,Go===null&&(Go=[]),Hv(Go,t,a)}function si(t,a){a=a.props.ref,t.ref=a!==void 0?a:null}function ru(t,a){throw a.$$typeof===v?Error(o(525)):(t=Object.prototype.toString.call(a),Error(o(31,t==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":t)))}function $v(t){function a(te,W){if(t){var ne=te.deletions;ne===null?(te.deletions=[W],te.flags|=16):ne.push(W)}}function i(te,W){if(!t)return null;for(;W!==null;)a(te,W),W=W.sibling;return null}function u(te){for(var W=new Map;te!==null;)te.key!==null?W.set(te.key,te):W.set(te.index,te),te=te.sibling;return W}function x(te,W){return te=gs(te,W),te.index=0,te.sibling=null,te}function y(te,W,ne){return te.index=ne,t?(ne=te.alternate,ne!==null?(ne=ne.index,ne<W?(te.flags|=67108866,W):ne):(te.flags|=67108866,W)):(te.flags|=1048576,W)}function M(te){return t&&te.alternate===null&&(te.flags|=67108866),te}function I(te,W,ne,he){return W===null||W.tag!==6?(W=cp(ne,te.mode,he),W.return=te,W):(W=x(W,ne),W.return=te,W)}function Q(te,W,ne,he){var Ke=ne.type;return Ke===_?fe(te,W,ne.props.children,he,ne.key):W!==null&&(W.elementType===Ke||typeof Ke=="object"&&Ke!==null&&Ke.$$typeof===z&&Yr(Ke)===W.type)?(W=x(W,ne.props),si(W,ne),W.return=te,W):(W=Zc(ne.type,ne.key,ne.props,null,te.mode,he),si(W,ne),W.return=te,W)}function ae(te,W,ne,he){return W===null||W.tag!==4||W.stateNode.containerInfo!==ne.containerInfo||W.stateNode.implementation!==ne.implementation?(W=up(ne,te.mode,he),W.return=te,W):(W=x(W,ne.children||[]),W.return=te,W)}function fe(te,W,ne,he,Ke){return W===null||W.tag!==7?(W=Vr(ne,te.mode,he,Ke),W.return=te,W):(W=x(W,ne),W.return=te,W)}function xe(te,W,ne){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return W=cp(""+W,te.mode,ne),W.return=te,W;if(typeof W=="object"&&W!==null){switch(W.$$typeof){case S:return ne=Zc(W.type,W.key,W.props,null,te.mode,ne),si(ne,W),ne.return=te,ne;case C:return W=up(W,te.mode,ne),W.return=te,W;case z:return W=Yr(W),xe(te,W,ne)}if(Y(W)||P(W))return W=Vr(W,te.mode,ne,null),W.return=te,W;if(typeof W.then=="function")return xe(te,su(W),ne);if(W.$$typeof===N)return xe(te,eu(te,W),ne);ru(te,W)}return null}function se(te,W,ne,he){var Ke=W!==null?W.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return Ke!==null?null:I(te,W,""+ne,he);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case S:return ne.key===Ke?Q(te,W,ne,he):null;case C:return ne.key===Ke?ae(te,W,ne,he):null;case z:return ne=Yr(ne),se(te,W,ne,he)}if(Y(ne)||P(ne))return Ke!==null?null:fe(te,W,ne,he,null);if(typeof ne.then=="function")return se(te,W,su(ne),he);if(ne.$$typeof===N)return se(te,W,eu(te,ne),he);ru(te,ne)}return null}function ue(te,W,ne,he,Ke){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return te=te.get(ne)||null,I(W,te,""+he,Ke);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case S:return te=te.get(he.key===null?ne:he.key)||null,Q(W,te,he,Ke);case C:return te=te.get(he.key===null?ne:he.key)||null,ae(W,te,he,Ke);case z:return he=Yr(he),ue(te,W,ne,he,Ke)}if(Y(he)||P(he))return te=te.get(ne)||null,fe(W,te,he,Ke,null);if(typeof he.then=="function")return ue(te,W,ne,su(he),Ke);if(he.$$typeof===N)return ue(te,W,ne,eu(W,he),Ke);ru(W,he)}return null}function He(te,W,ne,he){for(var Ke=null,Ct=null,$e=W,ct=W=0,bt=null;$e!==null&&ct<ne.length;ct++){$e.index>ct?(bt=$e,$e=null):bt=$e.sibling;var kt=se(te,$e,ne[ct],he);if(kt===null){$e===null&&($e=bt);break}t&&$e&&kt.alternate===null&&a(te,$e),W=y(kt,W,ct),Ct===null?Ke=kt:Ct.sibling=kt,Ct=kt,$e=bt}if(ct===ne.length)return i(te,$e),jt&&hs(te,ct),Ke;if($e===null){for(;ct<ne.length;ct++)$e=xe(te,ne[ct],he),$e!==null&&(W=y($e,W,ct),Ct===null?Ke=$e:Ct.sibling=$e,Ct=$e);return jt&&hs(te,ct),Ke}for($e=u($e);ct<ne.length;ct++)bt=ue($e,te,ct,ne[ct],he),bt!==null&&(t&&bt.alternate!==null&&$e.delete(bt.key===null?ct:bt.key),W=y(bt,W,ct),Ct===null?Ke=bt:Ct.sibling=bt,Ct=bt);return t&&$e.forEach(function(pr){return a(te,pr)}),jt&&hs(te,ct),Ke}function et(te,W,ne,he){if(ne==null)throw Error(o(151));for(var Ke=null,Ct=null,$e=W,ct=W=0,bt=null,kt=ne.next();$e!==null&&!kt.done;ct++,kt=ne.next()){$e.index>ct?(bt=$e,$e=null):bt=$e.sibling;var pr=se(te,$e,kt.value,he);if(pr===null){$e===null&&($e=bt);break}t&&$e&&pr.alternate===null&&a(te,$e),W=y(pr,W,ct),Ct===null?Ke=pr:Ct.sibling=pr,Ct=pr,$e=bt}if(kt.done)return i(te,$e),jt&&hs(te,ct),Ke;if($e===null){for(;!kt.done;ct++,kt=ne.next())kt=xe(te,kt.value,he),kt!==null&&(W=y(kt,W,ct),Ct===null?Ke=kt:Ct.sibling=kt,Ct=kt);return jt&&hs(te,ct),Ke}for($e=u($e);!kt.done;ct++,kt=ne.next())kt=ue($e,te,ct,kt.value,he),kt!==null&&(t&&kt.alternate!==null&&$e.delete(kt.key===null?ct:kt.key),W=y(kt,W,ct),Ct===null?Ke=kt:Ct.sibling=kt,Ct=kt);return t&&$e.forEach(function(LN){return a(te,LN)}),jt&&hs(te,ct),Ke}function It(te,W,ne,he){if(typeof ne=="object"&&ne!==null&&ne.type===_&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case S:e:{for(var Ke=ne.key;W!==null;){if(W.key===Ke){if(Ke=ne.type,Ke===_){if(W.tag===7){i(te,W.sibling),he=x(W,ne.props.children),he.return=te,te=he;break e}}else if(W.elementType===Ke||typeof Ke=="object"&&Ke!==null&&Ke.$$typeof===z&&Yr(Ke)===W.type){i(te,W.sibling),he=x(W,ne.props),si(he,ne),he.return=te,te=he;break e}i(te,W);break}else a(te,W);W=W.sibling}ne.type===_?(he=Vr(ne.props.children,te.mode,he,ne.key),he.return=te,te=he):(he=Zc(ne.type,ne.key,ne.props,null,te.mode,he),si(he,ne),he.return=te,te=he)}return M(te);case C:e:{for(Ke=ne.key;W!==null;){if(W.key===Ke)if(W.tag===4&&W.stateNode.containerInfo===ne.containerInfo&&W.stateNode.implementation===ne.implementation){i(te,W.sibling),he=x(W,ne.children||[]),he.return=te,te=he;break e}else{i(te,W);break}else a(te,W);W=W.sibling}he=up(ne,te.mode,he),he.return=te,te=he}return M(te);case z:return ne=Yr(ne),It(te,W,ne,he)}if(Y(ne))return He(te,W,ne,he);if(P(ne)){if(Ke=P(ne),typeof Ke!="function")throw Error(o(150));return ne=Ke.call(ne),et(te,W,ne,he)}if(typeof ne.then=="function")return It(te,W,su(ne),he);if(ne.$$typeof===N)return It(te,W,eu(te,ne),he);ru(te,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,W!==null&&W.tag===6?(i(te,W.sibling),he=x(W,ne),he.return=te,te=he):(i(te,W),he=cp(ne,te.mode,he),he.return=te,te=he),M(te)):i(te,W)}return function(te,W,ne,he){try{ai=0;var Ke=It(te,W,ne,he);return Go=null,Ke}catch($e){if($e===$o||$e===nu)throw $e;var Ct=da(29,$e,null,te.mode);return Ct.lanes=he,Ct.return=te,Ct}finally{}}}var Kr=$v(!0),Gv=$v(!1),Qs=!1;function jp(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wp(t,a){t=t.updateQueue,a.updateQueue===t&&(a.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Zs(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Ws(t,a,i){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(Et&2)!==0){var x=u.pending;return x===null?a.next=a:(a.next=x.next,x.next=a),u.pending=a,a=Qc(t),Nv(t,null,i),a}return Kc(t,u,a,i),Qc(t)}function ri(t,a,i){if(a=a.updateQueue,a!==null&&(a=a.shared,(i&4194048)!==0)){var u=a.lanes;u&=t.pendingLanes,i|=u,a.lanes=i,ca(t,i)}}function Sp(t,a){var i=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var x=null,y=null;if(i=i.firstBaseUpdate,i!==null){do{var M={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};y===null?x=y=M:y=y.next=M,i=i.next}while(i!==null);y===null?x=y=a:y=y.next=a}else x=y=a;i={baseState:u.baseState,firstBaseUpdate:x,lastBaseUpdate:y,shared:u.shared,callbacks:u.callbacks},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=a:t.next=a,i.lastBaseUpdate=a}var Cp=!1;function oi(){if(Cp){var t=qo;if(t!==null)throw t}}function li(t,a,i,u){Cp=!1;var x=t.updateQueue;Qs=!1;var y=x.firstBaseUpdate,M=x.lastBaseUpdate,I=x.shared.pending;if(I!==null){x.shared.pending=null;var Q=I,ae=Q.next;Q.next=null,M===null?y=ae:M.next=ae,M=Q;var fe=t.alternate;fe!==null&&(fe=fe.updateQueue,I=fe.lastBaseUpdate,I!==M&&(I===null?fe.firstBaseUpdate=ae:I.next=ae,fe.lastBaseUpdate=Q))}if(y!==null){var xe=x.baseState;M=0,fe=ae=Q=null,I=y;do{var se=I.lane&-536870913,ue=se!==I.lane;if(ue?(xt&se)===se:(u&se)===se){se!==0&&se===Vo&&(Cp=!0),fe!==null&&(fe=fe.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var He=t,et=I;se=a;var It=i;switch(et.tag){case 1:if(He=et.payload,typeof He=="function"){xe=He.call(It,xe,se);break e}xe=He;break e;case 3:He.flags=He.flags&-65537|128;case 0:if(He=et.payload,se=typeof He=="function"?He.call(It,xe,se):He,se==null)break e;xe=b({},xe,se);break e;case 2:Qs=!0}}se=I.callback,se!==null&&(t.flags|=64,ue&&(t.flags|=8192),ue=x.callbacks,ue===null?x.callbacks=[se]:ue.push(se))}else ue={lane:se,tag:I.tag,payload:I.payload,callback:I.callback,next:null},fe===null?(ae=fe=ue,Q=xe):fe=fe.next=ue,M|=se;if(I=I.next,I===null){if(I=x.shared.pending,I===null)break;ue=I,I=ue.next,ue.next=null,x.lastBaseUpdate=ue,x.shared.pending=null}}while(!0);fe===null&&(Q=xe),x.baseState=Q,x.firstBaseUpdate=ae,x.lastBaseUpdate=fe,y===null&&(x.shared.lanes=0),ar|=M,t.lanes=M,t.memoizedState=xe}}function Fv(t,a){if(typeof t!="function")throw Error(o(191,t));t.call(a)}function Yv(t,a){var i=t.callbacks;if(i!==null)for(t.callbacks=null,t=0;t<i.length;t++)Fv(i[t],a)}var Fo=U(null),ou=U(0);function Xv(t,a){t=Es,F(ou,t),F(Fo,a),Es=t|a.baseLanes}function kp(){F(ou,Es),F(Fo,Fo.current)}function Ep(){Es=ou.current,K(Fo),K(ou)}var fa=U(null),Ra=null;function Js(t){var a=t.alternate;F(fn,fn.current&1),F(fa,t),Ra===null&&(a===null||Fo.current!==null||a.memoizedState!==null)&&(Ra=t)}function Np(t){F(fn,fn.current),F(fa,t),Ra===null&&(Ra=t)}function Kv(t){t.tag===22?(F(fn,fn.current),F(fa,t),Ra===null&&(Ra=t)):er()}function er(){F(fn,fn.current),F(fa,fa.current)}function pa(t){K(fa),Ra===t&&(Ra=null),K(fn)}var fn=U(0);function lu(t){for(var a=t;a!==null;){if(a.tag===13){var i=a.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||zm(i)||Dm(i)))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===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var vs=0,ot=null,Lt=null,bn=null,iu=!1,Yo=!1,Qr=!1,cu=0,ii=0,Xo=null,kE=0;function on(){throw Error(o(321))}function Rp(t,a){if(a===null)return!1;for(var i=0;i<a.length&&i<t.length;i++)if(!ua(t[i],a[i]))return!1;return!0}function Tp(t,a,i,u,x,y){return vs=y,ot=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,V.H=t===null||t.memoizedState===null?My:Gp,Qr=!1,y=i(u,x),Qr=!1,Yo&&(y=Zv(a,i,u,x)),Qv(t),y}function Qv(t){V.H=di;var a=Lt!==null&&Lt.next!==null;if(vs=0,bn=Lt=ot=null,iu=!1,ii=0,Xo=null,a)throw Error(o(300));t===null||vn||(t=t.dependencies,t!==null&&Jc(t)&&(vn=!0))}function Zv(t,a,i,u){ot=t;var x=0;do{if(Yo&&(Xo=null),ii=0,Yo=!1,25<=x)throw Error(o(301));if(x+=1,bn=Lt=null,t.updateQueue!=null){var y=t.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}V.H=Oy,y=a(i,u)}while(Yo);return y}function EE(){var t=V.H,a=t.useState()[0];return a=typeof a.then=="function"?ci(a):a,t=t.useState()[0],(Lt!==null?Lt.memoizedState:null)!==t&&(ot.flags|=1024),a}function Ap(){var t=cu!==0;return cu=0,t}function Mp(t,a,i){a.updateQueue=t.updateQueue,a.flags&=-2053,t.lanes&=~i}function Op(t){if(iu){for(t=t.memoizedState;t!==null;){var a=t.queue;a!==null&&(a.pending=null),t=t.next}iu=!1}vs=0,bn=Lt=ot=null,Yo=!1,ii=cu=0,Xo=null}function qn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bn===null?ot.memoizedState=bn=t:bn=bn.next=t,bn}function pn(){if(Lt===null){var t=ot.alternate;t=t!==null?t.memoizedState:null}else t=Lt.next;var a=bn===null?ot.memoizedState:bn.next;if(a!==null)bn=a,Lt=t;else{if(t===null)throw ot.alternate===null?Error(o(467)):Error(o(310));Lt=t,t={memoizedState:Lt.memoizedState,baseState:Lt.baseState,baseQueue:Lt.baseQueue,queue:Lt.queue,next:null},bn===null?ot.memoizedState=bn=t:bn=bn.next=t}return bn}function uu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ci(t){var a=ii;return ii+=1,Xo===null&&(Xo=[]),t=Hv(Xo,t,a),a=ot,(bn===null?a.memoizedState:bn.next)===null&&(a=a.alternate,V.H=a===null||a.memoizedState===null?My:Gp),t}function du(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return ci(t);if(t.$$typeof===N)return kn(t)}throw Error(o(438,String(t)))}function zp(t){var a=null,i=ot.updateQueue;if(i!==null&&(a=i.memoCache),a==null){var u=ot.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(a={data:u.data.map(function(x){return x.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),i===null&&(i=uu(),ot.updateQueue=i),i.memoCache=a,i=a.data[a.index],i===void 0)for(i=a.data[a.index]=Array(t),u=0;u<t;u++)i[u]=L;return a.index++,i}function ys(t,a){return typeof a=="function"?a(t):a}function fu(t){var a=pn();return Dp(a,Lt,t)}function Dp(t,a,i){var u=t.queue;if(u===null)throw Error(o(311));u.lastRenderedReducer=i;var x=t.baseQueue,y=u.pending;if(y!==null){if(x!==null){var M=x.next;x.next=y.next,y.next=M}a.baseQueue=x=y,u.pending=null}if(y=t.baseState,x===null)t.memoizedState=y;else{a=x.next;var I=M=null,Q=null,ae=a,fe=!1;do{var xe=ae.lane&-536870913;if(xe!==ae.lane?(xt&xe)===xe:(vs&xe)===xe){var se=ae.revertLane;if(se===0)Q!==null&&(Q=Q.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),xe===Vo&&(fe=!0);else if((vs&se)===se){ae=ae.next,se===Vo&&(fe=!0);continue}else xe={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},Q===null?(I=Q=xe,M=y):Q=Q.next=xe,ot.lanes|=se,ar|=se;xe=ae.action,Qr&&i(y,xe),y=ae.hasEagerState?ae.eagerState:i(y,xe)}else se={lane:xe,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},Q===null?(I=Q=se,M=y):Q=Q.next=se,ot.lanes|=xe,ar|=xe;ae=ae.next}while(ae!==null&&ae!==a);if(Q===null?M=y:Q.next=I,!ua(y,t.memoizedState)&&(vn=!0,fe&&(i=qo,i!==null)))throw i;t.memoizedState=y,t.baseState=M,t.baseQueue=Q,u.lastRenderedState=y}return x===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function Lp(t){var a=pn(),i=a.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=t;var u=i.dispatch,x=i.pending,y=a.memoizedState;if(x!==null){i.pending=null;var M=x=x.next;do y=t(y,M.action),M=M.next;while(M!==x);ua(y,a.memoizedState)||(vn=!0),a.memoizedState=y,a.baseQueue===null&&(a.baseState=y),i.lastRenderedState=y}return[y,u]}function Wv(t,a,i){var u=ot,x=pn(),y=jt;if(y){if(i===void 0)throw Error(o(407));i=i()}else i=a();var M=!ua((Lt||x).memoizedState,i);if(M&&(x.memoizedState=i,vn=!0),x=x.queue,Bp(ty.bind(null,u,x,t),[t]),x.getSnapshot!==a||M||bn!==null&&bn.memoizedState.tag&1){if(u.flags|=2048,Ko(9,{destroy:void 0},ey.bind(null,u,x,i,a),null),qt===null)throw Error(o(349));y||(vs&127)!==0||Jv(u,a,i)}return i}function Jv(t,a,i){t.flags|=16384,t={getSnapshot:a,value:i},a=ot.updateQueue,a===null?(a=uu(),ot.updateQueue=a,a.stores=[t]):(i=a.stores,i===null?a.stores=[t]:i.push(t))}function ey(t,a,i,u){a.value=i,a.getSnapshot=u,ny(a)&&ay(t)}function ty(t,a,i){return i(function(){ny(a)&&ay(t)})}function ny(t){var a=t.getSnapshot;t=t.value;try{var i=a();return!ua(t,i)}catch{return!0}}function ay(t){var a=Hr(t,2);a!==null&&na(a,t,2)}function Pp(t){var a=qn();if(typeof t=="function"){var i=t;if(t=i(),Qr){qe(!0);try{i()}finally{qe(!1)}}}return a.memoizedState=a.baseState=t,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ys,lastRenderedState:t},a}function sy(t,a,i,u){return t.baseState=i,Dp(t,Lt,typeof u=="function"?u:ys)}function NE(t,a,i,u,x){if(gu(t))throw Error(o(485));if(t=a.action,t!==null){var y={payload:x,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(M){y.listeners.push(M)}};V.T!==null?i(!0):y.isTransition=!1,u(y),i=a.pending,i===null?(y.next=a.pending=y,ry(a,y)):(y.next=i.next,a.pending=i.next=y)}}function ry(t,a){var i=a.action,u=a.payload,x=t.state;if(a.isTransition){var y=V.T,M={};V.T=M;try{var I=i(x,u),Q=V.S;Q!==null&&Q(M,I),oy(t,a,I)}catch(ae){Ip(t,a,ae)}finally{y!==null&&M.types!==null&&(y.types=M.types),V.T=y}}else try{y=i(x,u),oy(t,a,y)}catch(ae){Ip(t,a,ae)}}function oy(t,a,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(u){ly(t,a,u)},function(u){return Ip(t,a,u)}):ly(t,a,i)}function ly(t,a,i){a.status="fulfilled",a.value=i,iy(a),t.state=i,a=t.pending,a!==null&&(i=a.next,i===a?t.pending=null:(i=i.next,a.next=i,ry(t,i)))}function Ip(t,a,i){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do a.status="rejected",a.reason=i,iy(a),a=a.next;while(a!==u)}t.action=null}function iy(t){t=t.listeners;for(var a=0;a<t.length;a++)(0,t[a])()}function cy(t,a){return a}function uy(t,a){if(jt){var i=qt.formState;if(i!==null){e:{var u=ot;if(jt){if(Yt){t:{for(var x=Yt,y=Na;x.nodeType!==8;){if(!y){x=null;break t}if(x=Ta(x.nextSibling),x===null){x=null;break t}}y=x.data,x=y==="F!"||y==="F"?x:null}if(x){Yt=Ta(x.nextSibling),u=x.data==="F!";break e}}Xs(u)}u=!1}u&&(a=i[0])}}return i=qn(),i.memoizedState=i.baseState=a,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:cy,lastRenderedState:a},i.queue=u,i=Ry.bind(null,ot,u),u.dispatch=i,u=Pp(!1),y=$p.bind(null,ot,!1,u.queue),u=qn(),x={state:a,dispatch:null,action:t,pending:null},u.queue=x,i=NE.bind(null,ot,x,y,i),x.dispatch=i,u.memoizedState=t,[a,i,!1]}function dy(t){var a=pn();return fy(a,Lt,t)}function fy(t,a,i){if(a=Dp(t,a,cy)[0],t=fu(ys)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var u=ci(a)}catch(M){throw M===$o?nu:M}else u=a;a=pn();var x=a.queue,y=x.dispatch;return i!==a.memoizedState&&(ot.flags|=2048,Ko(9,{destroy:void 0},RE.bind(null,x,i),null)),[u,y,t]}function RE(t,a){t.action=a}function py(t){var a=pn(),i=Lt;if(i!==null)return fy(a,i,t);pn(),a=a.memoizedState,i=pn();var u=i.queue.dispatch;return i.memoizedState=t,[a,u,!1]}function Ko(t,a,i,u){return t={tag:t,create:i,deps:u,inst:a,next:null},a=ot.updateQueue,a===null&&(a=uu(),ot.updateQueue=a),i=a.lastEffect,i===null?a.lastEffect=t.next=t:(u=i.next,i.next=t,t.next=u,a.lastEffect=t),t}function my(){return pn().memoizedState}function pu(t,a,i,u){var x=qn();ot.flags|=t,x.memoizedState=Ko(1|a,{destroy:void 0},i,u===void 0?null:u)}function mu(t,a,i,u){var x=pn();u=u===void 0?null:u;var y=x.memoizedState.inst;Lt!==null&&u!==null&&Rp(u,Lt.memoizedState.deps)?x.memoizedState=Ko(a,y,i,u):(ot.flags|=t,x.memoizedState=Ko(1|a,y,i,u))}function gy(t,a){pu(8390656,8,t,a)}function Bp(t,a){mu(2048,8,t,a)}function TE(t){ot.flags|=4;var a=ot.updateQueue;if(a===null)a=uu(),ot.updateQueue=a,a.events=[t];else{var i=a.events;i===null?a.events=[t]:i.push(t)}}function hy(t){var a=pn().memoizedState;return TE({ref:a,nextImpl:t}),function(){if((Et&2)!==0)throw Error(o(440));return a.impl.apply(void 0,arguments)}}function xy(t,a){return mu(4,2,t,a)}function by(t,a){return mu(4,4,t,a)}function vy(t,a){if(typeof a=="function"){t=t();var i=a(t);return function(){typeof i=="function"?i():a(null)}}if(a!=null)return t=t(),a.current=t,function(){a.current=null}}function yy(t,a,i){i=i!=null?i.concat([t]):null,mu(4,4,vy.bind(null,a,t),i)}function Up(){}function _y(t,a){var i=pn();a=a===void 0?null:a;var u=i.memoizedState;return a!==null&&Rp(a,u[1])?u[0]:(i.memoizedState=[t,a],t)}function jy(t,a){var i=pn();a=a===void 0?null:a;var u=i.memoizedState;if(a!==null&&Rp(a,u[1]))return u[0];if(u=t(),Qr){qe(!0);try{t()}finally{qe(!1)}}return i.memoizedState=[u,a],u}function Hp(t,a,i){return i===void 0||(vs&1073741824)!==0&&(xt&261930)===0?t.memoizedState=a:(t.memoizedState=i,t=w0(),ot.lanes|=t,ar|=t,i)}function wy(t,a,i,u){return ua(i,a)?i:Fo.current!==null?(t=Hp(t,i,u),ua(t,a)||(vn=!0),t):(vs&42)===0||(vs&1073741824)!==0&&(xt&261930)===0?(vn=!0,t.memoizedState=i):(t=w0(),ot.lanes|=t,ar|=t,a)}function Sy(t,a,i,u,x){var y=$.p;$.p=y!==0&&8>y?y:8;var M=V.T,I={};V.T=I,$p(t,!1,a,i);try{var Q=x(),ae=V.S;if(ae!==null&&ae(I,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var fe=CE(Q,u);ui(t,a,fe,ha(t))}else ui(t,a,u,ha(t))}catch(xe){ui(t,a,{then:function(){},status:"rejected",reason:xe},ha())}finally{$.p=y,M!==null&&I.types!==null&&(M.types=I.types),V.T=M}}function AE(){}function Vp(t,a,i,u){if(t.tag!==5)throw Error(o(476));var x=Cy(t).queue;Sy(t,x,a,Z,i===null?AE:function(){return ky(t),i(u)})}function Cy(t){var a=t.memoizedState;if(a!==null)return a;a={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ys,lastRenderedState:Z},next:null};var i={};return a.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ys,lastRenderedState:i},next:null},t.memoizedState=a,t=t.alternate,t!==null&&(t.memoizedState=a),a}function ky(t){var a=Cy(t);a.next===null&&(a=t.alternate.memoizedState),ui(t,a.next.queue,{},ha())}function qp(){return kn(Ei)}function Ey(){return pn().memoizedState}function Ny(){return pn().memoizedState}function ME(t){for(var a=t.return;a!==null;){switch(a.tag){case 24:case 3:var i=ha();t=Zs(i);var u=Ws(a,t,i);u!==null&&(na(u,a,i),ri(u,a,i)),a={cache:bp()},t.payload=a;return}a=a.return}}function OE(t,a,i){var u=ha();i={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},gu(t)?Ty(a,i):(i=lp(t,a,i,u),i!==null&&(na(i,t,u),Ay(i,a,u)))}function Ry(t,a,i){var u=ha();ui(t,a,i,u)}function ui(t,a,i,u){var x={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(gu(t))Ty(a,x);else{var y=t.alternate;if(t.lanes===0&&(y===null||y.lanes===0)&&(y=a.lastRenderedReducer,y!==null))try{var M=a.lastRenderedState,I=y(M,i);if(x.hasEagerState=!0,x.eagerState=I,ua(I,M))return Kc(t,a,x,0),qt===null&&Xc(),!1}catch{}finally{}if(i=lp(t,a,x,u),i!==null)return na(i,t,u),Ay(i,a,u),!0}return!1}function $p(t,a,i,u){if(u={lane:2,revertLane:jm(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},gu(t)){if(a)throw Error(o(479))}else a=lp(t,i,u,2),a!==null&&na(a,t,2)}function gu(t){var a=t.alternate;return t===ot||a!==null&&a===ot}function Ty(t,a){Yo=iu=!0;var i=t.pending;i===null?a.next=a:(a.next=i.next,i.next=a),t.pending=a}function Ay(t,a,i){if((i&4194048)!==0){var u=a.lanes;u&=t.pendingLanes,i|=u,a.lanes=i,ca(t,i)}}var di={readContext:kn,use:du,useCallback:on,useContext:on,useEffect:on,useImperativeHandle:on,useLayoutEffect:on,useInsertionEffect:on,useMemo:on,useReducer:on,useRef:on,useState:on,useDebugValue:on,useDeferredValue:on,useTransition:on,useSyncExternalStore:on,useId:on,useHostTransitionStatus:on,useFormState:on,useActionState:on,useOptimistic:on,useMemoCache:on,useCacheRefresh:on};di.useEffectEvent=on;var My={readContext:kn,use:du,useCallback:function(t,a){return qn().memoizedState=[t,a===void 0?null:a],t},useContext:kn,useEffect:gy,useImperativeHandle:function(t,a,i){i=i!=null?i.concat([t]):null,pu(4194308,4,vy.bind(null,a,t),i)},useLayoutEffect:function(t,a){return pu(4194308,4,t,a)},useInsertionEffect:function(t,a){pu(4,2,t,a)},useMemo:function(t,a){var i=qn();a=a===void 0?null:a;var u=t();if(Qr){qe(!0);try{t()}finally{qe(!1)}}return i.memoizedState=[u,a],u},useReducer:function(t,a,i){var u=qn();if(i!==void 0){var x=i(a);if(Qr){qe(!0);try{i(a)}finally{qe(!1)}}}else x=a;return u.memoizedState=u.baseState=x,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:x},u.queue=t,t=t.dispatch=OE.bind(null,ot,t),[u.memoizedState,t]},useRef:function(t){var a=qn();return t={current:t},a.memoizedState=t},useState:function(t){t=Pp(t);var a=t.queue,i=Ry.bind(null,ot,a);return a.dispatch=i,[t.memoizedState,i]},useDebugValue:Up,useDeferredValue:function(t,a){var i=qn();return Hp(i,t,a)},useTransition:function(){var t=Pp(!1);return t=Sy.bind(null,ot,t.queue,!0,!1),qn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,a,i){var u=ot,x=qn();if(jt){if(i===void 0)throw Error(o(407));i=i()}else{if(i=a(),qt===null)throw Error(o(349));(xt&127)!==0||Jv(u,a,i)}x.memoizedState=i;var y={value:i,getSnapshot:a};return x.queue=y,gy(ty.bind(null,u,y,t),[t]),u.flags|=2048,Ko(9,{destroy:void 0},ey.bind(null,u,y,i,a),null),i},useId:function(){var t=qn(),a=qt.identifierPrefix;if(jt){var i=Ka,u=Xa;i=(u&~(1<<32-st(u)-1)).toString(32)+i,a="_"+a+"R_"+i,i=cu++,0<i&&(a+="H"+i.toString(32)),a+="_"}else i=kE++,a="_"+a+"r_"+i.toString(32)+"_";return t.memoizedState=a},useHostTransitionStatus:qp,useFormState:uy,useActionState:uy,useOptimistic:function(t){var a=qn();a.memoizedState=a.baseState=t;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=i,a=$p.bind(null,ot,!0,i),i.dispatch=a,[t,a]},useMemoCache:zp,useCacheRefresh:function(){return qn().memoizedState=ME.bind(null,ot)},useEffectEvent:function(t){var a=qn(),i={impl:t};return a.memoizedState=i,function(){if((Et&2)!==0)throw Error(o(440));return i.impl.apply(void 0,arguments)}}},Gp={readContext:kn,use:du,useCallback:_y,useContext:kn,useEffect:Bp,useImperativeHandle:yy,useInsertionEffect:xy,useLayoutEffect:by,useMemo:jy,useReducer:fu,useRef:my,useState:function(){return fu(ys)},useDebugValue:Up,useDeferredValue:function(t,a){var i=pn();return wy(i,Lt.memoizedState,t,a)},useTransition:function(){var t=fu(ys)[0],a=pn().memoizedState;return[typeof t=="boolean"?t:ci(t),a]},useSyncExternalStore:Wv,useId:Ey,useHostTransitionStatus:qp,useFormState:dy,useActionState:dy,useOptimistic:function(t,a){var i=pn();return sy(i,Lt,t,a)},useMemoCache:zp,useCacheRefresh:Ny};Gp.useEffectEvent=hy;var Oy={readContext:kn,use:du,useCallback:_y,useContext:kn,useEffect:Bp,useImperativeHandle:yy,useInsertionEffect:xy,useLayoutEffect:by,useMemo:jy,useReducer:Lp,useRef:my,useState:function(){return Lp(ys)},useDebugValue:Up,useDeferredValue:function(t,a){var i=pn();return Lt===null?Hp(i,t,a):wy(i,Lt.memoizedState,t,a)},useTransition:function(){var t=Lp(ys)[0],a=pn().memoizedState;return[typeof t=="boolean"?t:ci(t),a]},useSyncExternalStore:Wv,useId:Ey,useHostTransitionStatus:qp,useFormState:py,useActionState:py,useOptimistic:function(t,a){var i=pn();return Lt!==null?sy(i,Lt,t,a):(i.baseState=t,[t,i.queue.dispatch])},useMemoCache:zp,useCacheRefresh:Ny};Oy.useEffectEvent=hy;function Fp(t,a,i,u){a=t.memoizedState,i=i(u,a),i=i==null?a:b({},a,i),t.memoizedState=i,t.lanes===0&&(t.updateQueue.baseState=i)}var Yp={enqueueSetState:function(t,a,i){t=t._reactInternals;var u=ha(),x=Zs(u);x.payload=a,i!=null&&(x.callback=i),a=Ws(t,x,u),a!==null&&(na(a,t,u),ri(a,t,u))},enqueueReplaceState:function(t,a,i){t=t._reactInternals;var u=ha(),x=Zs(u);x.tag=1,x.payload=a,i!=null&&(x.callback=i),a=Ws(t,x,u),a!==null&&(na(a,t,u),ri(a,t,u))},enqueueForceUpdate:function(t,a){t=t._reactInternals;var i=ha(),u=Zs(i);u.tag=2,a!=null&&(u.callback=a),a=Ws(t,u,i),a!==null&&(na(a,t,i),ri(a,t,i))}};function zy(t,a,i,u,x,y,M){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,y,M):a.prototype&&a.prototype.isPureReactComponent?!Zl(i,u)||!Zl(x,y):!0}function Dy(t,a,i,u){t=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(i,u),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(i,u),a.state!==t&&Yp.enqueueReplaceState(a,a.state,null)}function Zr(t,a){var i=a;if("ref"in a){i={};for(var u in a)u!=="ref"&&(i[u]=a[u])}if(t=t.defaultProps){i===a&&(i=b({},i));for(var x in t)i[x]===void 0&&(i[x]=t[x])}return i}function Ly(t){Yc(t)}function Py(t){console.error(t)}function Iy(t){Yc(t)}function hu(t,a){try{var i=t.onUncaughtError;i(a.value,{componentStack:a.stack})}catch(u){setTimeout(function(){throw u})}}function By(t,a,i){try{var u=t.onCaughtError;u(i.value,{componentStack:i.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Xp(t,a,i){return i=Zs(i),i.tag=3,i.payload={element:null},i.callback=function(){hu(t,a)},i}function Uy(t){return t=Zs(t),t.tag=3,t}function Hy(t,a,i,u){var x=i.type.getDerivedStateFromError;if(typeof x=="function"){var y=u.value;t.payload=function(){return x(y)},t.callback=function(){By(a,i,u)}}var M=i.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(t.callback=function(){By(a,i,u),typeof x!="function"&&(sr===null?sr=new Set([this]):sr.add(this));var I=u.stack;this.componentDidCatch(u.value,{componentStack:I!==null?I:""})})}function zE(t,a,i,u,x){if(i.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(a=i.alternate,a!==null&&Ho(a,i,x,!0),i=fa.current,i!==null){switch(i.tag){case 31:case 13:return Ra===null?Nu():i.alternate===null&&ln===0&&(ln=3),i.flags&=-257,i.flags|=65536,i.lanes=x,u===au?i.flags|=16384:(a=i.updateQueue,a===null?i.updateQueue=new Set([u]):a.add(u),vm(t,u,x)),!1;case 22:return i.flags|=65536,u===au?i.flags|=16384:(a=i.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([u])},i.updateQueue=a):(i=a.retryQueue,i===null?a.retryQueue=new Set([u]):i.add(u)),vm(t,u,x)),!1}throw Error(o(435,i.tag))}return vm(t,u,x),Nu(),!1}if(jt)return a=fa.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,u!==pp&&(t=Error(o(422),{cause:u}),ei(Ca(t,i)))):(u!==pp&&(a=Error(o(423),{cause:u}),ei(Ca(a,i))),t=t.current.alternate,t.flags|=65536,x&=-x,t.lanes|=x,u=Ca(u,i),x=Xp(t.stateNode,u,x),Sp(t,x),ln!==4&&(ln=2)),!1;var y=Error(o(520),{cause:u});if(y=Ca(y,i),vi===null?vi=[y]:vi.push(y),ln!==4&&(ln=2),a===null)return!0;u=Ca(u,i),i=a;do{switch(i.tag){case 3:return i.flags|=65536,t=x&-x,i.lanes|=t,t=Xp(i.stateNode,u,t),Sp(i,t),!1;case 1:if(a=i.type,y=i.stateNode,(i.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(sr===null||!sr.has(y))))return i.flags|=65536,x&=-x,i.lanes|=x,x=Uy(x),Hy(x,t,i,u),Sp(i,x),!1}i=i.return}while(i!==null);return!1}var Kp=Error(o(461)),vn=!1;function En(t,a,i,u){a.child=t===null?Gv(a,null,i,u):Kr(a,t.child,i,u)}function Vy(t,a,i,u,x){i=i.render;var y=a.ref;if("ref"in u){var M={};for(var I in u)I!=="ref"&&(M[I]=u[I])}else M=u;return Gr(a),u=Tp(t,a,i,M,y,x),I=Ap(),t!==null&&!vn?(Mp(t,a,x),_s(t,a,x)):(jt&&I&&dp(a),a.flags|=1,En(t,a,u,x),a.child)}function qy(t,a,i,u,x){if(t===null){var y=i.type;return typeof y=="function"&&!ip(y)&&y.defaultProps===void 0&&i.compare===null?(a.tag=15,a.type=y,$y(t,a,y,u,x)):(t=Zc(i.type,null,u,a,a.mode,x),t.ref=a.ref,t.return=a,a.child=t)}if(y=t.child,!am(t,x)){var M=y.memoizedProps;if(i=i.compare,i=i!==null?i:Zl,i(M,u)&&t.ref===a.ref)return _s(t,a,x)}return a.flags|=1,t=gs(y,u),t.ref=a.ref,t.return=a,a.child=t}function $y(t,a,i,u,x){if(t!==null){var y=t.memoizedProps;if(Zl(y,u)&&t.ref===a.ref)if(vn=!1,a.pendingProps=u=y,am(t,x))(t.flags&131072)!==0&&(vn=!0);else return a.lanes=t.lanes,_s(t,a,x)}return Qp(t,a,i,u,x)}function Gy(t,a,i,u){var x=u.children,y=t!==null?t.memoizedState:null;if(t===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((a.flags&128)!==0){if(y=y!==null?y.baseLanes|i:i,t!==null){for(u=a.child=t.child,x=0;u!==null;)x=x|u.lanes|u.childLanes,u=u.sibling;u=x&~y}else u=0,a.child=null;return Fy(t,a,y,i,u)}if((i&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},t!==null&&tu(a,y!==null?y.cachePool:null),y!==null?Xv(a,y):kp(),Kv(a);else return u=a.lanes=536870912,Fy(t,a,y!==null?y.baseLanes|i:i,i,u)}else y!==null?(tu(a,y.cachePool),Xv(a,y),er(),a.memoizedState=null):(t!==null&&tu(a,null),kp(),er());return En(t,a,x,i),a.child}function fi(t,a){return t!==null&&t.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Fy(t,a,i,u,x){var y=yp();return y=y===null?null:{parent:xn._currentValue,pool:y},a.memoizedState={baseLanes:i,cachePool:y},t!==null&&tu(a,null),kp(),Kv(a),t!==null&&Ho(t,a,u,!0),a.childLanes=x,null}function xu(t,a){return a=vu({mode:a.mode,children:a.children},t.mode),a.ref=t.ref,t.child=a,a.return=t,a}function Yy(t,a,i){return Kr(a,t.child,null,i),t=xu(a,a.pendingProps),t.flags|=2,pa(a),a.memoizedState=null,t}function DE(t,a,i){var u=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,t===null){if(jt){if(u.mode==="hidden")return t=xu(a,u),a.lanes=536870912,fi(null,t);if(Np(a),(t=Yt)?(t=r1(t,Na),t=t!==null&&t.data==="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:Fs!==null?{id:Xa,overflow:Ka}:null,retryLane:536870912,hydrationErrors:null},i=Tv(t),i.return=a,a.child=i,Cn=a,Yt=null)):t=null,t===null)throw Xs(a);return a.lanes=536870912,null}return xu(a,u)}var y=t.memoizedState;if(y!==null){var M=y.dehydrated;if(Np(a),x)if(a.flags&256)a.flags&=-257,a=Yy(t,a,i);else if(a.memoizedState!==null)a.child=t.child,a.flags|=128,a=null;else throw Error(o(558));else if(vn||Ho(t,a,i,!1),x=(i&t.childLanes)!==0,vn||x){if(u=qt,u!==null&&(M=Ia(u,i),M!==0&&M!==y.retryLane))throw y.retryLane=M,Hr(t,M),na(u,t,M),Kp;Nu(),a=Yy(t,a,i)}else t=y.treeContext,Yt=Ta(M.nextSibling),Cn=a,jt=!0,Ys=null,Na=!1,t!==null&&Ov(a,t),a=xu(a,u),a.flags|=4096;return a}return t=gs(t.child,{mode:u.mode,children:u.children}),t.ref=a.ref,a.child=t,t.return=a,t}function bu(t,a){var i=a.ref;if(i===null)t!==null&&t.ref!==null&&(a.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(o(284));(t===null||t.ref!==i)&&(a.flags|=4194816)}}function Qp(t,a,i,u,x){return Gr(a),i=Tp(t,a,i,u,void 0,x),u=Ap(),t!==null&&!vn?(Mp(t,a,x),_s(t,a,x)):(jt&&u&&dp(a),a.flags|=1,En(t,a,i,x),a.child)}function Xy(t,a,i,u,x,y){return Gr(a),a.updateQueue=null,i=Zv(a,u,i,x),Qv(t),u=Ap(),t!==null&&!vn?(Mp(t,a,y),_s(t,a,y)):(jt&&u&&dp(a),a.flags|=1,En(t,a,i,y),a.child)}function Ky(t,a,i,u,x){if(Gr(a),a.stateNode===null){var y=Po,M=i.contextType;typeof M=="object"&&M!==null&&(y=kn(M)),y=new i(u,y),a.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Yp,a.stateNode=y,y._reactInternals=a,y=a.stateNode,y.props=u,y.state=a.memoizedState,y.refs={},jp(a),M=i.contextType,y.context=typeof M=="object"&&M!==null?kn(M):Po,y.state=a.memoizedState,M=i.getDerivedStateFromProps,typeof M=="function"&&(Fp(a,i,M,u),y.state=a.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(M=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),M!==y.state&&Yp.enqueueReplaceState(y,y.state,null),li(a,u,y,x),oi(),y.state=a.memoizedState),typeof y.componentDidMount=="function"&&(a.flags|=4194308),u=!0}else if(t===null){y=a.stateNode;var I=a.memoizedProps,Q=Zr(i,I);y.props=Q;var ae=y.context,fe=i.contextType;M=Po,typeof fe=="object"&&fe!==null&&(M=kn(fe));var xe=i.getDerivedStateFromProps;fe=typeof xe=="function"||typeof y.getSnapshotBeforeUpdate=="function",I=a.pendingProps!==I,fe||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(I||ae!==M)&&Dy(a,y,u,M),Qs=!1;var se=a.memoizedState;y.state=se,li(a,u,y,x),oi(),ae=a.memoizedState,I||se!==ae||Qs?(typeof xe=="function"&&(Fp(a,i,xe,u),ae=a.memoizedState),(Q=Qs||zy(a,i,Q,u,se,ae,M))?(fe||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(a.flags|=4194308)):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=u,a.memoizedState=ae),y.props=u,y.state=ae,y.context=M,u=Q):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),u=!1)}else{y=a.stateNode,wp(t,a),M=a.memoizedProps,fe=Zr(i,M),y.props=fe,xe=a.pendingProps,se=y.context,ae=i.contextType,Q=Po,typeof ae=="object"&&ae!==null&&(Q=kn(ae)),I=i.getDerivedStateFromProps,(ae=typeof I=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(M!==xe||se!==Q)&&Dy(a,y,u,Q),Qs=!1,se=a.memoizedState,y.state=se,li(a,u,y,x),oi();var ue=a.memoizedState;M!==xe||se!==ue||Qs||t!==null&&t.dependencies!==null&&Jc(t.dependencies)?(typeof I=="function"&&(Fp(a,i,I,u),ue=a.memoizedState),(fe=Qs||zy(a,i,fe,u,se,ue,Q)||t!==null&&t.dependencies!==null&&Jc(t.dependencies))?(ae||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(u,ue,Q),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(u,ue,Q)),typeof y.componentDidUpdate=="function"&&(a.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof y.componentDidUpdate!="function"||M===t.memoizedProps&&se===t.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||M===t.memoizedProps&&se===t.memoizedState||(a.flags|=1024),a.memoizedProps=u,a.memoizedState=ue),y.props=u,y.state=ue,y.context=Q,u=fe):(typeof y.componentDidUpdate!="function"||M===t.memoizedProps&&se===t.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||M===t.memoizedProps&&se===t.memoizedState||(a.flags|=1024),u=!1)}return y=u,bu(t,a),u=(a.flags&128)!==0,y||u?(y=a.stateNode,i=u&&typeof i.getDerivedStateFromError!="function"?null:y.render(),a.flags|=1,t!==null&&u?(a.child=Kr(a,t.child,null,x),a.child=Kr(a,null,i,x)):En(t,a,i,x),a.memoizedState=y.state,t=a.child):t=_s(t,a,x),t}function Qy(t,a,i,u){return qr(),a.flags|=256,En(t,a,i,u),a.child}var Zp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wp(t){return{baseLanes:t,cachePool:Bv()}}function Jp(t,a,i){return t=t!==null?t.childLanes&~i:0,a&&(t|=ga),t}function Zy(t,a,i){var u=a.pendingProps,x=!1,y=(a.flags&128)!==0,M;if((M=y)||(M=t!==null&&t.memoizedState===null?!1:(fn.current&2)!==0),M&&(x=!0,a.flags&=-129),M=(a.flags&32)!==0,a.flags&=-33,t===null){if(jt){if(x?Js(a):er(),(t=Yt)?(t=r1(t,Na),t=t!==null&&t.data!=="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:Fs!==null?{id:Xa,overflow:Ka}:null,retryLane:536870912,hydrationErrors:null},i=Tv(t),i.return=a,a.child=i,Cn=a,Yt=null)):t=null,t===null)throw Xs(a);return Dm(t)?a.lanes=32:a.lanes=536870912,null}var I=u.children;return u=u.fallback,x?(er(),x=a.mode,I=vu({mode:"hidden",children:I},x),u=Vr(u,x,i,null),I.return=a,u.return=a,I.sibling=u,a.child=I,u=a.child,u.memoizedState=Wp(i),u.childLanes=Jp(t,M,i),a.memoizedState=Zp,fi(null,u)):(Js(a),em(a,I))}var Q=t.memoizedState;if(Q!==null&&(I=Q.dehydrated,I!==null)){if(y)a.flags&256?(Js(a),a.flags&=-257,a=tm(t,a,i)):a.memoizedState!==null?(er(),a.child=t.child,a.flags|=128,a=null):(er(),I=u.fallback,x=a.mode,u=vu({mode:"visible",children:u.children},x),I=Vr(I,x,i,null),I.flags|=2,u.return=a,I.return=a,u.sibling=I,a.child=u,Kr(a,t.child,null,i),u=a.child,u.memoizedState=Wp(i),u.childLanes=Jp(t,M,i),a.memoizedState=Zp,a=fi(null,u));else if(Js(a),Dm(I)){if(M=I.nextSibling&&I.nextSibling.dataset,M)var ae=M.dgst;M=ae,u=Error(o(419)),u.stack="",u.digest=M,ei({value:u,source:null,stack:null}),a=tm(t,a,i)}else if(vn||Ho(t,a,i,!1),M=(i&t.childLanes)!==0,vn||M){if(M=qt,M!==null&&(u=Ia(M,i),u!==0&&u!==Q.retryLane))throw Q.retryLane=u,Hr(t,u),na(M,t,u),Kp;zm(I)||Nu(),a=tm(t,a,i)}else zm(I)?(a.flags|=192,a.child=t.child,a=null):(t=Q.treeContext,Yt=Ta(I.nextSibling),Cn=a,jt=!0,Ys=null,Na=!1,t!==null&&Ov(a,t),a=em(a,u.children),a.flags|=4096);return a}return x?(er(),I=u.fallback,x=a.mode,Q=t.child,ae=Q.sibling,u=gs(Q,{mode:"hidden",children:u.children}),u.subtreeFlags=Q.subtreeFlags&65011712,ae!==null?I=gs(ae,I):(I=Vr(I,x,i,null),I.flags|=2),I.return=a,u.return=a,u.sibling=I,a.child=u,fi(null,u),u=a.child,I=t.child.memoizedState,I===null?I=Wp(i):(x=I.cachePool,x!==null?(Q=xn._currentValue,x=x.parent!==Q?{parent:Q,pool:Q}:x):x=Bv(),I={baseLanes:I.baseLanes|i,cachePool:x}),u.memoizedState=I,u.childLanes=Jp(t,M,i),a.memoizedState=Zp,fi(t.child,u)):(Js(a),i=t.child,t=i.sibling,i=gs(i,{mode:"visible",children:u.children}),i.return=a,i.sibling=null,t!==null&&(M=a.deletions,M===null?(a.deletions=[t],a.flags|=16):M.push(t)),a.child=i,a.memoizedState=null,i)}function em(t,a){return a=vu({mode:"visible",children:a},t.mode),a.return=t,t.child=a}function vu(t,a){return t=da(22,t,null,a),t.lanes=0,t}function tm(t,a,i){return Kr(a,t.child,null,i),t=em(a,a.pendingProps.children),t.flags|=2,a.memoizedState=null,t}function Wy(t,a,i){t.lanes|=a;var u=t.alternate;u!==null&&(u.lanes|=a),hp(t.return,a,i)}function nm(t,a,i,u,x,y){var M=t.memoizedState;M===null?t.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:u,tail:i,tailMode:x,treeForkCount:y}:(M.isBackwards=a,M.rendering=null,M.renderingStartTime=0,M.last=u,M.tail=i,M.tailMode=x,M.treeForkCount=y)}function Jy(t,a,i){var u=a.pendingProps,x=u.revealOrder,y=u.tail;u=u.children;var M=fn.current,I=(M&2)!==0;if(I?(M=M&1|2,a.flags|=128):M&=1,F(fn,M),En(t,a,u,i),u=jt?Jl:0,!I&&t!==null&&(t.flags&128)!==0)e:for(t=a.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Wy(t,i,a);else if(t.tag===19)Wy(t,i,a);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===a)break e;for(;t.sibling===null;){if(t.return===null||t.return===a)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(x){case"forwards":for(i=a.child,x=null;i!==null;)t=i.alternate,t!==null&&lu(t)===null&&(x=i),i=i.sibling;i=x,i===null?(x=a.child,a.child=null):(x=i.sibling,i.sibling=null),nm(a,!1,x,i,y,u);break;case"backwards":case"unstable_legacy-backwards":for(i=null,x=a.child,a.child=null;x!==null;){if(t=x.alternate,t!==null&&lu(t)===null){a.child=x;break}t=x.sibling,x.sibling=i,i=x,x=t}nm(a,!0,i,null,y,u);break;case"together":nm(a,!1,null,null,void 0,u);break;default:a.memoizedState=null}return a.child}function _s(t,a,i){if(t!==null&&(a.dependencies=t.dependencies),ar|=a.lanes,(i&a.childLanes)===0)if(t!==null){if(Ho(t,a,i,!1),(i&a.childLanes)===0)return null}else return null;if(t!==null&&a.child!==t.child)throw Error(o(153));if(a.child!==null){for(t=a.child,i=gs(t,t.pendingProps),a.child=i,i.return=a;t.sibling!==null;)t=t.sibling,i=i.sibling=gs(t,t.pendingProps),i.return=a;i.sibling=null}return a.child}function am(t,a){return(t.lanes&a)!==0?!0:(t=t.dependencies,!!(t!==null&&Jc(t)))}function LE(t,a,i){switch(a.tag){case 3:ce(a,a.stateNode.containerInfo),Ks(a,xn,t.memoizedState.cache),qr();break;case 27:case 5:Te(a);break;case 4:ce(a,a.stateNode.containerInfo);break;case 10:Ks(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Np(a),null;break;case 13:var u=a.memoizedState;if(u!==null)return u.dehydrated!==null?(Js(a),a.flags|=128,null):(i&a.child.childLanes)!==0?Zy(t,a,i):(Js(a),t=_s(t,a,i),t!==null?t.sibling:null);Js(a);break;case 19:var x=(t.flags&128)!==0;if(u=(i&a.childLanes)!==0,u||(Ho(t,a,i,!1),u=(i&a.childLanes)!==0),x){if(u)return Jy(t,a,i);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),F(fn,fn.current),u)break;return null;case 22:return a.lanes=0,Gy(t,a,i,a.pendingProps);case 24:Ks(a,xn,t.memoizedState.cache)}return _s(t,a,i)}function e0(t,a,i){if(t!==null)if(t.memoizedProps!==a.pendingProps)vn=!0;else{if(!am(t,i)&&(a.flags&128)===0)return vn=!1,LE(t,a,i);vn=(t.flags&131072)!==0}else vn=!1,jt&&(a.flags&1048576)!==0&&Mv(a,Jl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var u=a.pendingProps;if(t=Yr(a.elementType),a.type=t,typeof t=="function")ip(t)?(u=Zr(t,u),a.tag=1,a=Ky(null,a,t,u,i)):(a.tag=0,a=Qp(null,a,t,u,i));else{if(t!=null){var x=t.$$typeof;if(x===R){a.tag=11,a=Vy(null,a,t,u,i);break e}else if(x===A){a.tag=14,a=qy(null,a,t,u,i);break e}}throw a=q(t)||t,Error(o(306,a,""))}}return a;case 0:return Qp(t,a,a.type,a.pendingProps,i);case 1:return u=a.type,x=Zr(u,a.pendingProps),Ky(t,a,u,x,i);case 3:e:{if(ce(a,a.stateNode.containerInfo),t===null)throw Error(o(387));u=a.pendingProps;var y=a.memoizedState;x=y.element,wp(t,a),li(a,u,null,i);var M=a.memoizedState;if(u=M.cache,Ks(a,xn,u),u!==y.cache&&xp(a,[xn],i,!0),oi(),u=M.element,y.isDehydrated)if(y={element:u,isDehydrated:!1,cache:M.cache},a.updateQueue.baseState=y,a.memoizedState=y,a.flags&256){a=Qy(t,a,u,i);break e}else if(u!==x){x=Ca(Error(o(424)),a),ei(x),a=Qy(t,a,u,i);break e}else{switch(t=a.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Yt=Ta(t.firstChild),Cn=a,jt=!0,Ys=null,Na=!0,i=Gv(a,null,u,i),a.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(qr(),u===x){a=_s(t,a,i);break e}En(t,a,u,i)}a=a.child}return a;case 26:return bu(t,a),t===null?(i=d1(a.type,null,a.pendingProps,null))?a.memoizedState=i:jt||(i=a.type,t=a.pendingProps,u=Du(re.current).createElement(i),u[Rt]=a,u[hn]=t,Nn(u,i,t),jn(u),a.stateNode=u):a.memoizedState=d1(a.type,t.memoizedProps,a.pendingProps,t.memoizedState),null;case 27:return Te(a),t===null&&jt&&(u=a.stateNode=i1(a.type,a.pendingProps,re.current),Cn=a,Na=!0,x=Yt,ir(a.type)?(Lm=x,Yt=Ta(u.firstChild)):Yt=x),En(t,a,a.pendingProps.children,i),bu(t,a),t===null&&(a.flags|=4194304),a.child;case 5:return t===null&&jt&&((x=u=Yt)&&(u=fN(u,a.type,a.pendingProps,Na),u!==null?(a.stateNode=u,Cn=a,Yt=Ta(u.firstChild),Na=!1,x=!0):x=!1),x||Xs(a)),Te(a),x=a.type,y=a.pendingProps,M=t!==null?t.memoizedProps:null,u=y.children,Am(x,y)?u=null:M!==null&&Am(x,M)&&(a.flags|=32),a.memoizedState!==null&&(x=Tp(t,a,EE,null,null,i),Ei._currentValue=x),bu(t,a),En(t,a,u,i),a.child;case 6:return t===null&&jt&&((t=i=Yt)&&(i=pN(i,a.pendingProps,Na),i!==null?(a.stateNode=i,Cn=a,Yt=null,t=!0):t=!1),t||Xs(a)),null;case 13:return Zy(t,a,i);case 4:return ce(a,a.stateNode.containerInfo),u=a.pendingProps,t===null?a.child=Kr(a,null,u,i):En(t,a,u,i),a.child;case 11:return Vy(t,a,a.type,a.pendingProps,i);case 7:return En(t,a,a.pendingProps,i),a.child;case 8:return En(t,a,a.pendingProps.children,i),a.child;case 12:return En(t,a,a.pendingProps.children,i),a.child;case 10:return u=a.pendingProps,Ks(a,a.type,u.value),En(t,a,u.children,i),a.child;case 9:return x=a.type._context,u=a.pendingProps.children,Gr(a),x=kn(x),u=u(x),a.flags|=1,En(t,a,u,i),a.child;case 14:return qy(t,a,a.type,a.pendingProps,i);case 15:return $y(t,a,a.type,a.pendingProps,i);case 19:return Jy(t,a,i);case 31:return DE(t,a,i);case 22:return Gy(t,a,i,a.pendingProps);case 24:return Gr(a),u=kn(xn),t===null?(x=yp(),x===null&&(x=qt,y=bp(),x.pooledCache=y,y.refCount++,y!==null&&(x.pooledCacheLanes|=i),x=y),a.memoizedState={parent:u,cache:x},jp(a),Ks(a,xn,x)):((t.lanes&i)!==0&&(wp(t,a),li(a,null,null,i),oi()),x=t.memoizedState,y=a.memoizedState,x.parent!==u?(x={parent:u,cache:u},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),Ks(a,xn,u)):(u=y.cache,Ks(a,xn,u),u!==x.cache&&xp(a,[xn],i,!0))),En(t,a,a.pendingProps.children,i),a.child;case 29:throw a.pendingProps}throw Error(o(156,a.tag))}function js(t){t.flags|=4}function sm(t,a,i,u,x){if((a=(t.mode&32)!==0)&&(a=!1),a){if(t.flags|=16777216,(x&335544128)===x)if(t.stateNode.complete)t.flags|=8192;else if(E0())t.flags|=8192;else throw Xr=au,_p}else t.flags&=-16777217}function t0(t,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!h1(a))if(E0())t.flags|=8192;else throw Xr=au,_p}function yu(t,a){a!==null&&(t.flags|=4),t.flags&16384&&(a=t.tag!==22?Kn():536870912,t.lanes|=a,Jo|=a)}function pi(t,a){if(!jt)switch(t.tailMode){case"hidden":a=t.tail;for(var i=null;a!==null;)a.alternate!==null&&(i=a),a=a.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?a||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function Xt(t){var a=t.alternate!==null&&t.alternate.child===t.child,i=0,u=0;if(a)for(var x=t.child;x!==null;)i|=x.lanes|x.childLanes,u|=x.subtreeFlags&65011712,u|=x.flags&65011712,x.return=t,x=x.sibling;else for(x=t.child;x!==null;)i|=x.lanes|x.childLanes,u|=x.subtreeFlags,u|=x.flags,x.return=t,x=x.sibling;return t.subtreeFlags|=u,t.childLanes=i,a}function PE(t,a,i){var u=a.pendingProps;switch(fp(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xt(a),null;case 1:return Xt(a),null;case 3:return i=a.stateNode,u=null,t!==null&&(u=t.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),bs(xn),ee(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(t===null||t.child===null)&&(Uo(a)?js(a):t===null||t.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,mp())),Xt(a),null;case 26:var x=a.type,y=a.memoizedState;return t===null?(js(a),y!==null?(Xt(a),t0(a,y)):(Xt(a),sm(a,x,null,u,i))):y?y!==t.memoizedState?(js(a),Xt(a),t0(a,y)):(Xt(a),a.flags&=-16777217):(t=t.memoizedProps,t!==u&&js(a),Xt(a),sm(a,x,t,u,i)),null;case 27:if(Fe(a),i=re.current,x=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&js(a);else{if(!u){if(a.stateNode===null)throw Error(o(166));return Xt(a),null}t=J.current,Uo(a)?zv(a):(t=i1(x,u,i),a.stateNode=t,js(a))}return Xt(a),null;case 5:if(Fe(a),x=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&js(a);else{if(!u){if(a.stateNode===null)throw Error(o(166));return Xt(a),null}if(y=J.current,Uo(a))zv(a);else{var M=Du(re.current);switch(y){case 1:y=M.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:y=M.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":y=M.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":y=M.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":y=M.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof u.is=="string"?M.createElement("select",{is:u.is}):M.createElement("select"),u.multiple?y.multiple=!0:u.size&&(y.size=u.size);break;default:y=typeof u.is=="string"?M.createElement(x,{is:u.is}):M.createElement(x)}}y[Rt]=a,y[hn]=u;e:for(M=a.child;M!==null;){if(M.tag===5||M.tag===6)y.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===a)break e;for(;M.sibling===null;){if(M.return===null||M.return===a)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}a.stateNode=y;e:switch(Nn(y,x,u),x){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&js(a)}}return Xt(a),sm(a,a.type,t===null?null:t.memoizedProps,a.pendingProps,i),null;case 6:if(t&&a.stateNode!=null)t.memoizedProps!==u&&js(a);else{if(typeof u!="string"&&a.stateNode===null)throw Error(o(166));if(t=re.current,Uo(a)){if(t=a.stateNode,i=a.memoizedProps,u=null,x=Cn,x!==null)switch(x.tag){case 27:case 5:u=x.memoizedProps}t[Rt]=a,t=!!(t.nodeValue===i||u!==null&&u.suppressHydrationWarning===!0||Z0(t.nodeValue,i)),t||Xs(a,!0)}else t=Du(t).createTextNode(u),t[Rt]=a,a.stateNode=t}return Xt(a),null;case 31:if(i=a.memoizedState,t===null||t.memoizedState!==null){if(u=Uo(a),i!==null){if(t===null){if(!u)throw Error(o(318));if(t=a.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(o(557));t[Rt]=a}else qr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Xt(a),t=!1}else i=mp(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=i),t=!0;if(!t)return a.flags&256?(pa(a),a):(pa(a),null);if((a.flags&128)!==0)throw Error(o(558))}return Xt(a),null;case 13:if(u=a.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(x=Uo(a),u!==null&&u.dehydrated!==null){if(t===null){if(!x)throw Error(o(318));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(o(317));x[Rt]=a}else qr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Xt(a),x=!1}else x=mp(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(pa(a),a):(pa(a),null)}return pa(a),(a.flags&128)!==0?(a.lanes=i,a):(i=u!==null,t=t!==null&&t.memoizedState!==null,i&&(u=a.child,x=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(x=u.alternate.memoizedState.cachePool.pool),y=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(y=u.memoizedState.cachePool.pool),y!==x&&(u.flags|=2048)),i!==t&&i&&(a.child.flags|=8192),yu(a,a.updateQueue),Xt(a),null);case 4:return ee(),t===null&&km(a.stateNode.containerInfo),Xt(a),null;case 10:return bs(a.type),Xt(a),null;case 19:if(K(fn),u=a.memoizedState,u===null)return Xt(a),null;if(x=(a.flags&128)!==0,y=u.rendering,y===null)if(x)pi(u,!1);else{if(ln!==0||t!==null&&(t.flags&128)!==0)for(t=a.child;t!==null;){if(y=lu(t),y!==null){for(a.flags|=128,pi(u,!1),t=y.updateQueue,a.updateQueue=t,yu(a,t),a.subtreeFlags=0,t=i,i=a.child;i!==null;)Rv(i,t),i=i.sibling;return F(fn,fn.current&1|2),jt&&hs(a,u.treeForkCount),a.child}t=t.sibling}u.tail!==null&&ye()>Cu&&(a.flags|=128,x=!0,pi(u,!1),a.lanes=4194304)}else{if(!x)if(t=lu(y),t!==null){if(a.flags|=128,x=!0,t=t.updateQueue,a.updateQueue=t,yu(a,t),pi(u,!0),u.tail===null&&u.tailMode==="hidden"&&!y.alternate&&!jt)return Xt(a),null}else 2*ye()-u.renderingStartTime>Cu&&i!==536870912&&(a.flags|=128,x=!0,pi(u,!1),a.lanes=4194304);u.isBackwards?(y.sibling=a.child,a.child=y):(t=u.last,t!==null?t.sibling=y:a.child=y,u.last=y)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=ye(),t.sibling=null,i=fn.current,F(fn,x?i&1|2:i&1),jt&&hs(a,u.treeForkCount),t):(Xt(a),null);case 22:case 23:return pa(a),Ep(),u=a.memoizedState!==null,t!==null?t.memoizedState!==null!==u&&(a.flags|=8192):u&&(a.flags|=8192),u?(i&536870912)!==0&&(a.flags&128)===0&&(Xt(a),a.subtreeFlags&6&&(a.flags|=8192)):Xt(a),i=a.updateQueue,i!==null&&yu(a,i.retryQueue),i=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==i&&(a.flags|=2048),t!==null&&K(Fr),null;case 24:return i=null,t!==null&&(i=t.memoizedState.cache),a.memoizedState.cache!==i&&(a.flags|=2048),bs(xn),Xt(a),null;case 25:return null;case 30:return null}throw Error(o(156,a.tag))}function IE(t,a){switch(fp(a),a.tag){case 1:return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 3:return bs(xn),ee(),t=a.flags,(t&65536)!==0&&(t&128)===0?(a.flags=t&-65537|128,a):null;case 26:case 27:case 5:return Fe(a),null;case 31:if(a.memoizedState!==null){if(pa(a),a.alternate===null)throw Error(o(340));qr()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 13:if(pa(a),t=a.memoizedState,t!==null&&t.dehydrated!==null){if(a.alternate===null)throw Error(o(340));qr()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 19:return K(fn),null;case 4:return ee(),null;case 10:return bs(a.type),null;case 22:case 23:return pa(a),Ep(),t!==null&&K(Fr),t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 24:return bs(xn),null;case 25:return null;default:return null}}function n0(t,a){switch(fp(a),a.tag){case 3:bs(xn),ee();break;case 26:case 27:case 5:Fe(a);break;case 4:ee();break;case 31:a.memoizedState!==null&&pa(a);break;case 13:pa(a);break;case 19:K(fn);break;case 10:bs(a.type);break;case 22:case 23:pa(a),Ep(),t!==null&&K(Fr);break;case 24:bs(xn)}}function mi(t,a){try{var i=a.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var x=u.next;i=x;do{if((i.tag&t)===t){u=void 0;var y=i.create,M=i.inst;u=y(),M.destroy=u}i=i.next}while(i!==x)}}catch(I){At(a,a.return,I)}}function tr(t,a,i){try{var u=a.updateQueue,x=u!==null?u.lastEffect:null;if(x!==null){var y=x.next;u=y;do{if((u.tag&t)===t){var M=u.inst,I=M.destroy;if(I!==void 0){M.destroy=void 0,x=a;var Q=i,ae=I;try{ae()}catch(fe){At(x,Q,fe)}}}u=u.next}while(u!==y)}}catch(fe){At(a,a.return,fe)}}function a0(t){var a=t.updateQueue;if(a!==null){var i=t.stateNode;try{Yv(a,i)}catch(u){At(t,t.return,u)}}}function s0(t,a,i){i.props=Zr(t.type,t.memoizedProps),i.state=t.memoizedState;try{i.componentWillUnmount()}catch(u){At(t,a,u)}}function gi(t,a){try{var i=t.ref;if(i!==null){switch(t.tag){case 26:case 27:case 5:var u=t.stateNode;break;case 30:u=t.stateNode;break;default:u=t.stateNode}typeof i=="function"?t.refCleanup=i(u):i.current=u}}catch(x){At(t,a,x)}}function Qa(t,a){var i=t.ref,u=t.refCleanup;if(i!==null)if(typeof u=="function")try{u()}catch(x){At(t,a,x)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(x){At(t,a,x)}else i.current=null}function r0(t){var a=t.type,i=t.memoizedProps,u=t.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":i.autoFocus&&u.focus();break e;case"img":i.src?u.src=i.src:i.srcSet&&(u.srcset=i.srcSet)}}catch(x){At(t,t.return,x)}}function rm(t,a,i){try{var u=t.stateNode;oN(u,t.type,i,a),u[hn]=a}catch(x){At(t,t.return,x)}}function o0(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ir(t.type)||t.tag===4}function om(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||o0(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ir(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function lm(t,a,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,a?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(t,a):(a=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.appendChild(t),i=i._reactRootContainer,i!=null||a.onclick!==null||(a.onclick=ps));else if(u!==4&&(u===27&&ir(t.type)&&(i=t.stateNode,a=null),t=t.child,t!==null))for(lm(t,a,i),t=t.sibling;t!==null;)lm(t,a,i),t=t.sibling}function _u(t,a,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,a?i.insertBefore(t,a):i.appendChild(t);else if(u!==4&&(u===27&&ir(t.type)&&(i=t.stateNode),t=t.child,t!==null))for(_u(t,a,i),t=t.sibling;t!==null;)_u(t,a,i),t=t.sibling}function l0(t){var a=t.stateNode,i=t.memoizedProps;try{for(var u=t.type,x=a.attributes;x.length;)a.removeAttributeNode(x[0]);Nn(a,u,i),a[Rt]=t,a[hn]=i}catch(y){At(t,t.return,y)}}var ws=!1,yn=!1,im=!1,i0=typeof WeakSet=="function"?WeakSet:Set,wn=null;function BE(t,a){if(t=t.containerInfo,Rm=Vu,t=yv(t),tp(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var u=i.getSelection&&i.getSelection();if(u&&u.rangeCount!==0){i=u.anchorNode;var x=u.anchorOffset,y=u.focusNode;u=u.focusOffset;try{i.nodeType,y.nodeType}catch{i=null;break e}var M=0,I=-1,Q=-1,ae=0,fe=0,xe=t,se=null;t:for(;;){for(var ue;xe!==i||x!==0&&xe.nodeType!==3||(I=M+x),xe!==y||u!==0&&xe.nodeType!==3||(Q=M+u),xe.nodeType===3&&(M+=xe.nodeValue.length),(ue=xe.firstChild)!==null;)se=xe,xe=ue;for(;;){if(xe===t)break t;if(se===i&&++ae===x&&(I=M),se===y&&++fe===u&&(Q=M),(ue=xe.nextSibling)!==null)break;xe=se,se=xe.parentNode}xe=ue}i=I===-1||Q===-1?null:{start:I,end:Q}}else i=null}i=i||{start:0,end:0}}else i=null;for(Tm={focusedElem:t,selectionRange:i},Vu=!1,wn=a;wn!==null;)if(a=wn,t=a.child,(a.subtreeFlags&1028)!==0&&t!==null)t.return=a,wn=t;else for(;wn!==null;){switch(a=wn,y=a.alternate,t=a.flags,a.tag){case 0:if((t&4)!==0&&(t=a.updateQueue,t=t!==null?t.events:null,t!==null))for(i=0;i<t.length;i++)x=t[i],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&y!==null){t=void 0,i=a,x=y.memoizedProps,y=y.memoizedState,u=i.stateNode;try{var He=Zr(i.type,x);t=u.getSnapshotBeforeUpdate(He,y),u.__reactInternalSnapshotBeforeUpdate=t}catch(et){At(i,i.return,et)}}break;case 3:if((t&1024)!==0){if(t=a.stateNode.containerInfo,i=t.nodeType,i===9)Om(t);else if(i===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Om(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(o(163))}if(t=a.sibling,t!==null){t.return=a.return,wn=t;break}wn=a.return}}function c0(t,a,i){var u=i.flags;switch(i.tag){case 0:case 11:case 15:Cs(t,i),u&4&&mi(5,i);break;case 1:if(Cs(t,i),u&4)if(t=i.stateNode,a===null)try{t.componentDidMount()}catch(M){At(i,i.return,M)}else{var x=Zr(i.type,a.memoizedProps);a=a.memoizedState;try{t.componentDidUpdate(x,a,t.__reactInternalSnapshotBeforeUpdate)}catch(M){At(i,i.return,M)}}u&64&&a0(i),u&512&&gi(i,i.return);break;case 3:if(Cs(t,i),u&64&&(t=i.updateQueue,t!==null)){if(a=null,i.child!==null)switch(i.child.tag){case 27:case 5:a=i.child.stateNode;break;case 1:a=i.child.stateNode}try{Yv(t,a)}catch(M){At(i,i.return,M)}}break;case 27:a===null&&u&4&&l0(i);case 26:case 5:Cs(t,i),a===null&&u&4&&r0(i),u&512&&gi(i,i.return);break;case 12:Cs(t,i);break;case 31:Cs(t,i),u&4&&f0(t,i);break;case 13:Cs(t,i),u&4&&p0(t,i),u&64&&(t=i.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(i=XE.bind(null,i),mN(t,i))));break;case 22:if(u=i.memoizedState!==null||ws,!u){a=a!==null&&a.memoizedState!==null||yn,x=ws;var y=yn;ws=u,(yn=a)&&!y?ks(t,i,(i.subtreeFlags&8772)!==0):Cs(t,i),ws=x,yn=y}break;case 30:break;default:Cs(t,i)}}function u0(t){var a=t.alternate;a!==null&&(t.alternate=null,u0(a)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(a=t.stateNode,a!==null&&If(a)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Jt=null,Wn=!1;function Ss(t,a,i){for(i=i.child;i!==null;)d0(t,a,i),i=i.sibling}function d0(t,a,i){if(Re&&typeof Re.onCommitFiberUnmount=="function")try{Re.onCommitFiberUnmount(Ee,i)}catch{}switch(i.tag){case 26:yn||Qa(i,a),Ss(t,a,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:yn||Qa(i,a);var u=Jt,x=Wn;ir(i.type)&&(Jt=i.stateNode,Wn=!1),Ss(t,a,i),Si(i.stateNode),Jt=u,Wn=x;break;case 5:yn||Qa(i,a);case 6:if(u=Jt,x=Wn,Jt=null,Ss(t,a,i),Jt=u,Wn=x,Jt!==null)if(Wn)try{(Jt.nodeType===9?Jt.body:Jt.nodeName==="HTML"?Jt.ownerDocument.body:Jt).removeChild(i.stateNode)}catch(y){At(i,a,y)}else try{Jt.removeChild(i.stateNode)}catch(y){At(i,a,y)}break;case 18:Jt!==null&&(Wn?(t=Jt,a1(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,i.stateNode),ll(t)):a1(Jt,i.stateNode));break;case 4:u=Jt,x=Wn,Jt=i.stateNode.containerInfo,Wn=!0,Ss(t,a,i),Jt=u,Wn=x;break;case 0:case 11:case 14:case 15:tr(2,i,a),yn||tr(4,i,a),Ss(t,a,i);break;case 1:yn||(Qa(i,a),u=i.stateNode,typeof u.componentWillUnmount=="function"&&s0(i,a,u)),Ss(t,a,i);break;case 21:Ss(t,a,i);break;case 22:yn=(u=yn)||i.memoizedState!==null,Ss(t,a,i),yn=u;break;default:Ss(t,a,i)}}function f0(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{ll(t)}catch(i){At(a,a.return,i)}}}function p0(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{ll(t)}catch(i){At(a,a.return,i)}}function UE(t){switch(t.tag){case 31:case 13:case 19:var a=t.stateNode;return a===null&&(a=t.stateNode=new i0),a;case 22:return t=t.stateNode,a=t._retryCache,a===null&&(a=t._retryCache=new i0),a;default:throw Error(o(435,t.tag))}}function ju(t,a){var i=UE(t);a.forEach(function(u){if(!i.has(u)){i.add(u);var x=KE.bind(null,t,u);u.then(x,x)}})}function Jn(t,a){var i=a.deletions;if(i!==null)for(var u=0;u<i.length;u++){var x=i[u],y=t,M=a,I=M;e:for(;I!==null;){switch(I.tag){case 27:if(ir(I.type)){Jt=I.stateNode,Wn=!1;break e}break;case 5:Jt=I.stateNode,Wn=!1;break e;case 3:case 4:Jt=I.stateNode.containerInfo,Wn=!0;break e}I=I.return}if(Jt===null)throw Error(o(160));d0(y,M,x),Jt=null,Wn=!1,y=x.alternate,y!==null&&(y.return=null),x.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)m0(a,t),a=a.sibling}var Ua=null;function m0(t,a){var i=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Jn(a,t),ea(t),u&4&&(tr(3,t,t.return),mi(3,t),tr(5,t,t.return));break;case 1:Jn(a,t),ea(t),u&512&&(yn||i===null||Qa(i,i.return)),u&64&&ws&&(t=t.updateQueue,t!==null&&(u=t.callbacks,u!==null&&(i=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=i===null?u:i.concat(u))));break;case 26:var x=Ua;if(Jn(a,t),ea(t),u&512&&(yn||i===null||Qa(i,i.return)),u&4){var y=i!==null?i.memoizedState:null;if(u=t.memoizedState,i===null)if(u===null)if(t.stateNode===null){e:{u=t.type,i=t.memoizedProps,x=x.ownerDocument||x;t:switch(u){case"title":y=x.getElementsByTagName("title")[0],(!y||y[Vl]||y[Rt]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=x.createElement(u),x.head.insertBefore(y,x.querySelector("head > title"))),Nn(y,u,i),y[Rt]=t,jn(y),u=y;break e;case"link":var M=m1("link","href",x).get(u+(i.href||""));if(M){for(var I=0;I<M.length;I++)if(y=M[I],y.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&y.getAttribute("rel")===(i.rel==null?null:i.rel)&&y.getAttribute("title")===(i.title==null?null:i.title)&&y.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){M.splice(I,1);break t}}y=x.createElement(u),Nn(y,u,i),x.head.appendChild(y);break;case"meta":if(M=m1("meta","content",x).get(u+(i.content||""))){for(I=0;I<M.length;I++)if(y=M[I],y.getAttribute("content")===(i.content==null?null:""+i.content)&&y.getAttribute("name")===(i.name==null?null:i.name)&&y.getAttribute("property")===(i.property==null?null:i.property)&&y.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&y.getAttribute("charset")===(i.charSet==null?null:i.charSet)){M.splice(I,1);break t}}y=x.createElement(u),Nn(y,u,i),x.head.appendChild(y);break;default:throw Error(o(468,u))}y[Rt]=t,jn(y),u=y}t.stateNode=u}else g1(x,t.type,t.stateNode);else t.stateNode=p1(x,u,t.memoizedProps);else y!==u?(y===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):y.count--,u===null?g1(x,t.type,t.stateNode):p1(x,u,t.memoizedProps)):u===null&&t.stateNode!==null&&rm(t,t.memoizedProps,i.memoizedProps)}break;case 27:Jn(a,t),ea(t),u&512&&(yn||i===null||Qa(i,i.return)),i!==null&&u&4&&rm(t,t.memoizedProps,i.memoizedProps);break;case 5:if(Jn(a,t),ea(t),u&512&&(yn||i===null||Qa(i,i.return)),t.flags&32){x=t.stateNode;try{To(x,"")}catch(He){At(t,t.return,He)}}u&4&&t.stateNode!=null&&(x=t.memoizedProps,rm(t,x,i!==null?i.memoizedProps:x)),u&1024&&(im=!0);break;case 6:if(Jn(a,t),ea(t),u&4){if(t.stateNode===null)throw Error(o(162));u=t.memoizedProps,i=t.stateNode;try{i.nodeValue=u}catch(He){At(t,t.return,He)}}break;case 3:if(Iu=null,x=Ua,Ua=Lu(a.containerInfo),Jn(a,t),Ua=x,ea(t),u&4&&i!==null&&i.memoizedState.isDehydrated)try{ll(a.containerInfo)}catch(He){At(t,t.return,He)}im&&(im=!1,g0(t));break;case 4:u=Ua,Ua=Lu(t.stateNode.containerInfo),Jn(a,t),ea(t),Ua=u;break;case 12:Jn(a,t),ea(t);break;case 31:Jn(a,t),ea(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,ju(t,u)));break;case 13:Jn(a,t),ea(t),t.child.flags&8192&&t.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Su=ye()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,ju(t,u)));break;case 22:x=t.memoizedState!==null;var Q=i!==null&&i.memoizedState!==null,ae=ws,fe=yn;if(ws=ae||x,yn=fe||Q,Jn(a,t),yn=fe,ws=ae,ea(t),u&8192)e:for(a=t.stateNode,a._visibility=x?a._visibility&-2:a._visibility|1,x&&(i===null||Q||ws||yn||Wr(t)),i=null,a=t;;){if(a.tag===5||a.tag===26){if(i===null){Q=i=a;try{if(y=Q.stateNode,x)M=y.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{I=Q.stateNode;var xe=Q.memoizedProps.style,se=xe!=null&&xe.hasOwnProperty("display")?xe.display:null;I.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(He){At(Q,Q.return,He)}}}else if(a.tag===6){if(i===null){Q=a;try{Q.stateNode.nodeValue=x?"":Q.memoizedProps}catch(He){At(Q,Q.return,He)}}}else if(a.tag===18){if(i===null){Q=a;try{var ue=Q.stateNode;x?s1(ue,!0):s1(Q.stateNode,!1)}catch(He){At(Q,Q.return,He)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===t)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;i===a&&(i=null),a=a.return}i===a&&(i=null),a.sibling.return=a.return,a=a.sibling}u&4&&(u=t.updateQueue,u!==null&&(i=u.retryQueue,i!==null&&(u.retryQueue=null,ju(t,i))));break;case 19:Jn(a,t),ea(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,ju(t,u)));break;case 30:break;case 21:break;default:Jn(a,t),ea(t)}}function ea(t){var a=t.flags;if(a&2){try{for(var i,u=t.return;u!==null;){if(o0(u)){i=u;break}u=u.return}if(i==null)throw Error(o(160));switch(i.tag){case 27:var x=i.stateNode,y=om(t);_u(t,y,x);break;case 5:var M=i.stateNode;i.flags&32&&(To(M,""),i.flags&=-33);var I=om(t);_u(t,I,M);break;case 3:case 4:var Q=i.stateNode.containerInfo,ae=om(t);lm(t,ae,Q);break;default:throw Error(o(161))}}catch(fe){At(t,t.return,fe)}t.flags&=-3}a&4096&&(t.flags&=-4097)}function g0(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var a=t;g0(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),t=t.sibling}}function Cs(t,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)c0(t,a.alternate,a),a=a.sibling}function Wr(t){for(t=t.child;t!==null;){var a=t;switch(a.tag){case 0:case 11:case 14:case 15:tr(4,a,a.return),Wr(a);break;case 1:Qa(a,a.return);var i=a.stateNode;typeof i.componentWillUnmount=="function"&&s0(a,a.return,i),Wr(a);break;case 27:Si(a.stateNode);case 26:case 5:Qa(a,a.return),Wr(a);break;case 22:a.memoizedState===null&&Wr(a);break;case 30:Wr(a);break;default:Wr(a)}t=t.sibling}}function ks(t,a,i){for(i=i&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var u=a.alternate,x=t,y=a,M=y.flags;switch(y.tag){case 0:case 11:case 15:ks(x,y,i),mi(4,y);break;case 1:if(ks(x,y,i),u=y,x=u.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(ae){At(u,u.return,ae)}if(u=y,x=u.updateQueue,x!==null){var I=u.stateNode;try{var Q=x.shared.hiddenCallbacks;if(Q!==null)for(x.shared.hiddenCallbacks=null,x=0;x<Q.length;x++)Fv(Q[x],I)}catch(ae){At(u,u.return,ae)}}i&&M&64&&a0(y),gi(y,y.return);break;case 27:l0(y);case 26:case 5:ks(x,y,i),i&&u===null&&M&4&&r0(y),gi(y,y.return);break;case 12:ks(x,y,i);break;case 31:ks(x,y,i),i&&M&4&&f0(x,y);break;case 13:ks(x,y,i),i&&M&4&&p0(x,y);break;case 22:y.memoizedState===null&&ks(x,y,i),gi(y,y.return);break;case 30:break;default:ks(x,y,i)}a=a.sibling}}function cm(t,a){var i=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),t=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(t=a.memoizedState.cachePool.pool),t!==i&&(t!=null&&t.refCount++,i!=null&&ti(i))}function um(t,a){t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&ti(t))}function Ha(t,a,i,u){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)h0(t,a,i,u),a=a.sibling}function h0(t,a,i,u){var x=a.flags;switch(a.tag){case 0:case 11:case 15:Ha(t,a,i,u),x&2048&&mi(9,a);break;case 1:Ha(t,a,i,u);break;case 3:Ha(t,a,i,u),x&2048&&(t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&ti(t)));break;case 12:if(x&2048){Ha(t,a,i,u),t=a.stateNode;try{var y=a.memoizedProps,M=y.id,I=y.onPostCommit;typeof I=="function"&&I(M,a.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(Q){At(a,a.return,Q)}}else Ha(t,a,i,u);break;case 31:Ha(t,a,i,u);break;case 13:Ha(t,a,i,u);break;case 23:break;case 22:y=a.stateNode,M=a.alternate,a.memoizedState!==null?y._visibility&2?Ha(t,a,i,u):hi(t,a):y._visibility&2?Ha(t,a,i,u):(y._visibility|=2,Qo(t,a,i,u,(a.subtreeFlags&10256)!==0||!1)),x&2048&&cm(M,a);break;case 24:Ha(t,a,i,u),x&2048&&um(a.alternate,a);break;default:Ha(t,a,i,u)}}function Qo(t,a,i,u,x){for(x=x&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var y=t,M=a,I=i,Q=u,ae=M.flags;switch(M.tag){case 0:case 11:case 15:Qo(y,M,I,Q,x),mi(8,M);break;case 23:break;case 22:var fe=M.stateNode;M.memoizedState!==null?fe._visibility&2?Qo(y,M,I,Q,x):hi(y,M):(fe._visibility|=2,Qo(y,M,I,Q,x)),x&&ae&2048&&cm(M.alternate,M);break;case 24:Qo(y,M,I,Q,x),x&&ae&2048&&um(M.alternate,M);break;default:Qo(y,M,I,Q,x)}a=a.sibling}}function hi(t,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var i=t,u=a,x=u.flags;switch(u.tag){case 22:hi(i,u),x&2048&&cm(u.alternate,u);break;case 24:hi(i,u),x&2048&&um(u.alternate,u);break;default:hi(i,u)}a=a.sibling}}var xi=8192;function Zo(t,a,i){if(t.subtreeFlags&xi)for(t=t.child;t!==null;)x0(t,a,i),t=t.sibling}function x0(t,a,i){switch(t.tag){case 26:Zo(t,a,i),t.flags&xi&&t.memoizedState!==null&&kN(i,Ua,t.memoizedState,t.memoizedProps);break;case 5:Zo(t,a,i);break;case 3:case 4:var u=Ua;Ua=Lu(t.stateNode.containerInfo),Zo(t,a,i),Ua=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=xi,xi=16777216,Zo(t,a,i),xi=u):Zo(t,a,i));break;default:Zo(t,a,i)}}function b0(t){var a=t.alternate;if(a!==null&&(t=a.child,t!==null)){a.child=null;do a=t.sibling,t.sibling=null,t=a;while(t!==null)}}function bi(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var u=a[i];wn=u,y0(u,t)}b0(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)v0(t),t=t.sibling}function v0(t){switch(t.tag){case 0:case 11:case 15:bi(t),t.flags&2048&&tr(9,t,t.return);break;case 3:bi(t);break;case 12:bi(t);break;case 22:var a=t.stateNode;t.memoizedState!==null&&a._visibility&2&&(t.return===null||t.return.tag!==13)?(a._visibility&=-3,wu(t)):bi(t);break;default:bi(t)}}function wu(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var u=a[i];wn=u,y0(u,t)}b0(t)}for(t=t.child;t!==null;){switch(a=t,a.tag){case 0:case 11:case 15:tr(8,a,a.return),wu(a);break;case 22:i=a.stateNode,i._visibility&2&&(i._visibility&=-3,wu(a));break;default:wu(a)}t=t.sibling}}function y0(t,a){for(;wn!==null;){var i=wn;switch(i.tag){case 0:case 11:case 15:tr(8,i,a);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var u=i.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:ti(i.memoizedState.cache)}if(u=i.child,u!==null)u.return=i,wn=u;else e:for(i=t;wn!==null;){u=wn;var x=u.sibling,y=u.return;if(u0(u),u===i){wn=null;break e}if(x!==null){x.return=y,wn=x;break e}wn=y}}}var HE={getCacheForType:function(t){var a=kn(xn),i=a.data.get(t);return i===void 0&&(i=t(),a.data.set(t,i)),i},cacheSignal:function(){return kn(xn).controller.signal}},VE=typeof WeakMap=="function"?WeakMap:Map,Et=0,qt=null,gt=null,xt=0,Tt=0,ma=null,nr=!1,Wo=!1,dm=!1,Es=0,ln=0,ar=0,Jr=0,fm=0,ga=0,Jo=0,vi=null,ta=null,pm=!1,Su=0,_0=0,Cu=1/0,ku=null,sr=null,_n=0,rr=null,el=null,Ns=0,mm=0,gm=null,j0=null,yi=0,hm=null;function ha(){return(Et&2)!==0&&xt!==0?xt&-xt:V.T!==null?jm():Dt()}function w0(){if(ga===0)if((xt&536870912)===0||jt){var t=Wt;Wt<<=1,(Wt&3932160)===0&&(Wt=262144),ga=t}else ga=536870912;return t=fa.current,t!==null&&(t.flags|=32),ga}function na(t,a,i){(t===qt&&(Tt===2||Tt===9)||t.cancelPendingCommit!==null)&&(tl(t,0),or(t,xt,ga,!1)),Qn(t,i),((Et&2)===0||t!==qt)&&(t===qt&&((Et&2)===0&&(Jr|=i),ln===4&&or(t,xt,ga,!1)),Za(t))}function S0(t,a,i){if((Et&6)!==0)throw Error(o(327));var u=!i&&(a&127)===0&&(a&t.expiredLanes)===0||dn(t,a),x=u?GE(t,a):bm(t,a,!0),y=u;do{if(x===0){Wo&&!u&&or(t,a,0,!1);break}else{if(i=t.current.alternate,y&&!qE(i)){x=bm(t,a,!1),y=!1;continue}if(x===2){if(y=a,t.errorRecoveryDisabledLanes&y)var M=0;else M=t.pendingLanes&-536870913,M=M!==0?M:M&536870912?536870912:0;if(M!==0){a=M;e:{var I=t;x=vi;var Q=I.current.memoizedState.isDehydrated;if(Q&&(tl(I,M).flags|=256),M=bm(I,M,!1),M!==2){if(dm&&!Q){I.errorRecoveryDisabledLanes|=y,Jr|=y,x=4;break e}y=ta,ta=x,y!==null&&(ta===null?ta=y:ta.push.apply(ta,y))}x=M}if(y=!1,x!==2)continue}}if(x===1){tl(t,0),or(t,a,0,!0);break}e:{switch(u=t,y=x,y){case 0:case 1:throw Error(o(345));case 4:if((a&4194048)!==a)break;case 6:or(u,a,ga,!nr);break e;case 2:ta=null;break;case 3:case 5:break;default:throw Error(o(329))}if((a&62914560)===a&&(x=Su+300-ye(),10<x)){if(or(u,a,ga,!nr),Ft(u,0,!0)!==0)break e;Ns=a,u.timeoutHandle=t1(C0.bind(null,u,i,ta,ku,pm,a,ga,Jr,Jo,nr,y,"Throttled",-0,0),x);break e}C0(u,i,ta,ku,pm,a,ga,Jr,Jo,nr,y,null,-0,0)}}break}while(!0);Za(t)}function C0(t,a,i,u,x,y,M,I,Q,ae,fe,xe,se,ue){if(t.timeoutHandle=-1,xe=a.subtreeFlags,xe&8192||(xe&16785408)===16785408){xe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ps},x0(a,y,xe);var He=(y&62914560)===y?Su-ye():(y&4194048)===y?_0-ye():0;if(He=EN(xe,He),He!==null){Ns=y,t.cancelPendingCommit=He(O0.bind(null,t,a,y,i,u,x,M,I,Q,fe,xe,null,se,ue)),or(t,y,M,!ae);return}}O0(t,a,y,i,u,x,M,I,Q)}function qE(t){for(var a=t;;){var i=a.tag;if((i===0||i===11||i===15)&&a.flags&16384&&(i=a.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var u=0;u<i.length;u++){var x=i[u],y=x.getSnapshot;x=x.value;try{if(!ua(y(),x))return!1}catch{return!1}}if(i=a.child,a.subtreeFlags&16384&&i!==null)i.return=a,a=i;else{if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function or(t,a,i,u){a&=~fm,a&=~Jr,t.suspendedLanes|=a,t.pingedLanes&=~a,u&&(t.warmLanes|=a),u=t.expirationTimes;for(var x=a;0<x;){var y=31-st(x),M=1<<y;u[y]=-1,x&=~M}i!==0&&zn(t,i,a)}function Eu(){return(Et&6)===0?(_i(0),!1):!0}function xm(){if(gt!==null){if(Tt===0)var t=gt.return;else t=gt,xs=$r=null,Op(t),Go=null,ai=0,t=gt;for(;t!==null;)n0(t.alternate,t),t=t.return;gt=null}}function tl(t,a){var i=t.timeoutHandle;i!==-1&&(t.timeoutHandle=-1,cN(i)),i=t.cancelPendingCommit,i!==null&&(t.cancelPendingCommit=null,i()),Ns=0,xm(),qt=t,gt=i=gs(t.current,null),xt=a,Tt=0,ma=null,nr=!1,Wo=dn(t,a),dm=!1,Jo=ga=fm=Jr=ar=ln=0,ta=vi=null,pm=!1,(a&8)!==0&&(a|=a&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=a;0<u;){var x=31-st(u),y=1<<x;a|=t[x],u&=~y}return Es=a,Xc(),i}function k0(t,a){ot=null,V.H=di,a===$o||a===nu?(a=Vv(),Tt=3):a===_p?(a=Vv(),Tt=4):Tt=a===Kp?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,ma=a,gt===null&&(ln=1,hu(t,Ca(a,t.current)))}function E0(){var t=fa.current;return t===null?!0:(xt&4194048)===xt?Ra===null:(xt&62914560)===xt||(xt&536870912)!==0?t===Ra:!1}function N0(){var t=V.H;return V.H=di,t===null?di:t}function R0(){var t=V.A;return V.A=HE,t}function Nu(){ln=4,nr||(xt&4194048)!==xt&&fa.current!==null||(Wo=!0),(ar&134217727)===0&&(Jr&134217727)===0||qt===null||or(qt,xt,ga,!1)}function bm(t,a,i){var u=Et;Et|=2;var x=N0(),y=R0();(qt!==t||xt!==a)&&(ku=null,tl(t,a)),a=!1;var M=ln;e:do try{if(Tt!==0&&gt!==null){var I=gt,Q=ma;switch(Tt){case 8:xm(),M=6;break e;case 3:case 2:case 9:case 6:fa.current===null&&(a=!0);var ae=Tt;if(Tt=0,ma=null,nl(t,I,Q,ae),i&&Wo){M=0;break e}break;default:ae=Tt,Tt=0,ma=null,nl(t,I,Q,ae)}}$E(),M=ln;break}catch(fe){k0(t,fe)}while(!0);return a&&t.shellSuspendCounter++,xs=$r=null,Et=u,V.H=x,V.A=y,gt===null&&(qt=null,xt=0,Xc()),M}function $E(){for(;gt!==null;)T0(gt)}function GE(t,a){var i=Et;Et|=2;var u=N0(),x=R0();qt!==t||xt!==a?(ku=null,Cu=ye()+500,tl(t,a)):Wo=dn(t,a);e:do try{if(Tt!==0&&gt!==null){a=gt;var y=ma;t:switch(Tt){case 1:Tt=0,ma=null,nl(t,a,y,1);break;case 2:case 9:if(Uv(y)){Tt=0,ma=null,A0(a);break}a=function(){Tt!==2&&Tt!==9||qt!==t||(Tt=7),Za(t)},y.then(a,a);break e;case 3:Tt=7;break e;case 4:Tt=5;break e;case 7:Uv(y)?(Tt=0,ma=null,A0(a)):(Tt=0,ma=null,nl(t,a,y,7));break;case 5:var M=null;switch(gt.tag){case 26:M=gt.memoizedState;case 5:case 27:var I=gt;if(M?h1(M):I.stateNode.complete){Tt=0,ma=null;var Q=I.sibling;if(Q!==null)gt=Q;else{var ae=I.return;ae!==null?(gt=ae,Ru(ae)):gt=null}break t}}Tt=0,ma=null,nl(t,a,y,5);break;case 6:Tt=0,ma=null,nl(t,a,y,6);break;case 8:xm(),ln=6;break e;default:throw Error(o(462))}}FE();break}catch(fe){k0(t,fe)}while(!0);return xs=$r=null,V.H=u,V.A=x,Et=i,gt!==null?0:(qt=null,xt=0,Xc(),ln)}function FE(){for(;gt!==null&&!Ye();)T0(gt)}function T0(t){var a=e0(t.alternate,t,Es);t.memoizedProps=t.pendingProps,a===null?Ru(t):gt=a}function A0(t){var a=t,i=a.alternate;switch(a.tag){case 15:case 0:a=Xy(i,a,a.pendingProps,a.type,void 0,xt);break;case 11:a=Xy(i,a,a.pendingProps,a.type.render,a.ref,xt);break;case 5:Op(a);default:n0(i,a),a=gt=Rv(a,Es),a=e0(i,a,Es)}t.memoizedProps=t.pendingProps,a===null?Ru(t):gt=a}function nl(t,a,i,u){xs=$r=null,Op(a),Go=null,ai=0;var x=a.return;try{if(zE(t,x,a,i,xt)){ln=1,hu(t,Ca(i,t.current)),gt=null;return}}catch(y){if(x!==null)throw gt=x,y;ln=1,hu(t,Ca(i,t.current)),gt=null;return}a.flags&32768?(jt||u===1?t=!0:Wo||(xt&536870912)!==0?t=!1:(nr=t=!0,(u===2||u===9||u===3||u===6)&&(u=fa.current,u!==null&&u.tag===13&&(u.flags|=16384))),M0(a,t)):Ru(a)}function Ru(t){var a=t;do{if((a.flags&32768)!==0){M0(a,nr);return}t=a.return;var i=PE(a.alternate,a,Es);if(i!==null){gt=i;return}if(a=a.sibling,a!==null){gt=a;return}gt=a=t}while(a!==null);ln===0&&(ln=5)}function M0(t,a){do{var i=IE(t.alternate,t);if(i!==null){i.flags&=32767,gt=i;return}if(i=t.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!a&&(t=t.sibling,t!==null)){gt=t;return}gt=t=i}while(t!==null);ln=6,gt=null}function O0(t,a,i,u,x,y,M,I,Q){t.cancelPendingCommit=null;do Tu();while(_n!==0);if((Et&6)!==0)throw Error(o(327));if(a!==null){if(a===t.current)throw Error(o(177));if(y=a.lanes|a.childLanes,y|=op,us(t,i,y,M,I,Q),t===qt&&(gt=qt=null,xt=0),el=a,rr=t,Ns=i,mm=y,gm=x,j0=u,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,QE(Ue,function(){return I0(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||u){u=V.T,V.T=null,x=$.p,$.p=2,M=Et,Et|=4;try{BE(t,a,i)}finally{Et=M,$.p=x,V.T=u}}_n=1,z0(),D0(),L0()}}function z0(){if(_n===1){_n=0;var t=rr,a=el,i=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||i){i=V.T,V.T=null;var u=$.p;$.p=2;var x=Et;Et|=4;try{m0(a,t);var y=Tm,M=yv(t.containerInfo),I=y.focusedElem,Q=y.selectionRange;if(M!==I&&I&&I.ownerDocument&&vv(I.ownerDocument.documentElement,I)){if(Q!==null&&tp(I)){var ae=Q.start,fe=Q.end;if(fe===void 0&&(fe=ae),"selectionStart"in I)I.selectionStart=ae,I.selectionEnd=Math.min(fe,I.value.length);else{var xe=I.ownerDocument||document,se=xe&&xe.defaultView||window;if(se.getSelection){var ue=se.getSelection(),He=I.textContent.length,et=Math.min(Q.start,He),It=Q.end===void 0?et:Math.min(Q.end,He);!ue.extend&&et>It&&(M=It,It=et,et=M);var te=bv(I,et),W=bv(I,It);if(te&&W&&(ue.rangeCount!==1||ue.anchorNode!==te.node||ue.anchorOffset!==te.offset||ue.focusNode!==W.node||ue.focusOffset!==W.offset)){var ne=xe.createRange();ne.setStart(te.node,te.offset),ue.removeAllRanges(),et>It?(ue.addRange(ne),ue.extend(W.node,W.offset)):(ne.setEnd(W.node,W.offset),ue.addRange(ne))}}}}for(xe=[],ue=I;ue=ue.parentNode;)ue.nodeType===1&&xe.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;I<xe.length;I++){var he=xe[I];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}Vu=!!Rm,Tm=Rm=null}finally{Et=x,$.p=u,V.T=i}}t.current=a,_n=2}}function D0(){if(_n===2){_n=0;var t=rr,a=el,i=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||i){i=V.T,V.T=null;var u=$.p;$.p=2;var x=Et;Et|=4;try{c0(t,a.alternate,a)}finally{Et=x,$.p=u,V.T=i}}_n=3}}function L0(){if(_n===4||_n===3){_n=0,De();var t=rr,a=el,i=Ns,u=j0;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?_n=5:(_n=0,el=rr=null,P0(t,t.pendingLanes));var x=t.pendingLanes;if(x===0&&(sr=null),it(i),a=a.stateNode,Re&&typeof Re.onCommitFiberRoot=="function")try{Re.onCommitFiberRoot(Ee,a,void 0,(a.current.flags&128)===128)}catch{}if(u!==null){a=V.T,x=$.p,$.p=2,V.T=null;try{for(var y=t.onRecoverableError,M=0;M<u.length;M++){var I=u[M];y(I.value,{componentStack:I.stack})}}finally{V.T=a,$.p=x}}(Ns&3)!==0&&Tu(),Za(t),x=t.pendingLanes,(i&261930)!==0&&(x&42)!==0?t===hm?yi++:(yi=0,hm=t):yi=0,_i(0)}}function P0(t,a){(t.pooledCacheLanes&=a)===0&&(a=t.pooledCache,a!=null&&(t.pooledCache=null,ti(a)))}function Tu(){return z0(),D0(),L0(),I0()}function I0(){if(_n!==5)return!1;var t=rr,a=mm;mm=0;var i=it(Ns),u=V.T,x=$.p;try{$.p=32>i?32:i,V.T=null,i=gm,gm=null;var y=rr,M=Ns;if(_n=0,el=rr=null,Ns=0,(Et&6)!==0)throw Error(o(331));var I=Et;if(Et|=4,v0(y.current),h0(y,y.current,M,i),Et=I,_i(0,!1),Re&&typeof Re.onPostCommitFiberRoot=="function")try{Re.onPostCommitFiberRoot(Ee,y)}catch{}return!0}finally{$.p=x,V.T=u,P0(t,a)}}function B0(t,a,i){a=Ca(i,a),a=Xp(t.stateNode,a,2),t=Ws(t,a,2),t!==null&&(Qn(t,2),Za(t))}function At(t,a,i){if(t.tag===3)B0(t,t,i);else for(;a!==null;){if(a.tag===3){B0(a,t,i);break}else if(a.tag===1){var u=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(sr===null||!sr.has(u))){t=Ca(i,t),i=Uy(2),u=Ws(a,i,2),u!==null&&(Hy(i,u,a,t),Qn(u,2),Za(u));break}}a=a.return}}function vm(t,a,i){var u=t.pingCache;if(u===null){u=t.pingCache=new VE;var x=new Set;u.set(a,x)}else x=u.get(a),x===void 0&&(x=new Set,u.set(a,x));x.has(i)||(dm=!0,x.add(i),t=YE.bind(null,t,a,i),a.then(t,t))}function YE(t,a,i){var u=t.pingCache;u!==null&&u.delete(a),t.pingedLanes|=t.suspendedLanes&i,t.warmLanes&=~i,qt===t&&(xt&i)===i&&(ln===4||ln===3&&(xt&62914560)===xt&&300>ye()-Su?(Et&2)===0&&tl(t,0):fm|=i,Jo===xt&&(Jo=0)),Za(t)}function U0(t,a){a===0&&(a=Kn()),t=Hr(t,a),t!==null&&(Qn(t,a),Za(t))}function XE(t){var a=t.memoizedState,i=0;a!==null&&(i=a.retryLane),U0(t,i)}function KE(t,a){var i=0;switch(t.tag){case 31:case 13:var u=t.stateNode,x=t.memoizedState;x!==null&&(i=x.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(o(314))}u!==null&&u.delete(a),U0(t,i)}function QE(t,a){return Be(t,a)}var Au=null,al=null,ym=!1,Mu=!1,_m=!1,lr=0;function Za(t){t!==al&&t.next===null&&(al===null?Au=al=t:al=al.next=t),Mu=!0,ym||(ym=!0,WE())}function _i(t,a){if(!_m&&Mu){_m=!0;do for(var i=!1,u=Au;u!==null;){if(t!==0){var x=u.pendingLanes;if(x===0)var y=0;else{var M=u.suspendedLanes,I=u.pingedLanes;y=(1<<31-st(42|t)+1)-1,y&=x&~(M&~I),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(i=!0,$0(u,y))}else y=xt,y=Ft(u,u===qt?y:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(y&3)===0||dn(u,y)||(i=!0,$0(u,y));u=u.next}while(i);_m=!1}}function ZE(){H0()}function H0(){Mu=ym=!1;var t=0;lr!==0&&iN()&&(t=lr);for(var a=ye(),i=null,u=Au;u!==null;){var x=u.next,y=V0(u,a);y===0?(u.next=null,i===null?Au=x:i.next=x,x===null&&(al=i)):(i=u,(t!==0||(y&3)!==0)&&(Mu=!0)),u=x}_n!==0&&_n!==5||_i(t),lr!==0&&(lr=0)}function V0(t,a){for(var i=t.suspendedLanes,u=t.pingedLanes,x=t.expirationTimes,y=t.pendingLanes&-62914561;0<y;){var M=31-st(y),I=1<<M,Q=x[M];Q===-1?((I&i)===0||(I&u)!==0)&&(x[M]=On(I,a)):Q<=a&&(t.expiredLanes|=I),y&=~I}if(a=qt,i=xt,i=Ft(t,t===a?i:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,i===0||t===a&&(Tt===2||Tt===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&&Xe(u),t.callbackNode=null,t.callbackPriority=0;if((i&3)===0||dn(t,i)){if(a=i&-i,a===t.callbackPriority)return a;switch(u!==null&&Xe(u),it(i)){case 2:case 8:i=Se;break;case 32:i=Ue;break;case 268435456:i=_t;break;default:i=Ue}return u=q0.bind(null,t),i=Be(i,u),t.callbackPriority=a,t.callbackNode=i,a}return u!==null&&u!==null&&Xe(u),t.callbackPriority=2,t.callbackNode=null,2}function q0(t,a){if(_n!==0&&_n!==5)return t.callbackNode=null,t.callbackPriority=0,null;var i=t.callbackNode;if(Tu()&&t.callbackNode!==i)return null;var u=xt;return u=Ft(t,t===qt?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(S0(t,u,a),V0(t,ye()),t.callbackNode!=null&&t.callbackNode===i?q0.bind(null,t):null)}function $0(t,a){if(Tu())return null;S0(t,a,!0)}function WE(){uN(function(){(Et&6)!==0?Be(je,ZE):H0()})}function jm(){if(lr===0){var t=Vo;t===0&&(t=Nt,Nt<<=1,(Nt&261888)===0&&(Nt=256)),lr=t}return lr}function G0(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Uc(""+t)}function F0(t,a){var i=a.ownerDocument.createElement("input");return i.name=a.name,i.value=a.value,t.id&&i.setAttribute("form",t.id),a.parentNode.insertBefore(i,a),t=new FormData(t),i.parentNode.removeChild(i),t}function JE(t,a,i,u,x){if(a==="submit"&&i&&i.stateNode===x){var y=G0((x[hn]||null).action),M=u.submitter;M&&(a=(a=M[hn]||null)?G0(a.formAction):M.getAttribute("formAction"),a!==null&&(y=a,M=null));var I=new $c("action","action",null,u,x);t.push({event:I,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(lr!==0){var Q=M?F0(x,M):new FormData(x);Vp(i,{pending:!0,data:Q,method:x.method,action:y},null,Q)}}else typeof y=="function"&&(I.preventDefault(),Q=M?F0(x,M):new FormData(x),Vp(i,{pending:!0,data:Q,method:x.method,action:y},y,Q))},currentTarget:x}]})}}for(var wm=0;wm<rp.length;wm++){var Sm=rp[wm],eN=Sm.toLowerCase(),tN=Sm[0].toUpperCase()+Sm.slice(1);Ba(eN,"on"+tN)}Ba(wv,"onAnimationEnd"),Ba(Sv,"onAnimationIteration"),Ba(Cv,"onAnimationStart"),Ba("dblclick","onDoubleClick"),Ba("focusin","onFocus"),Ba("focusout","onBlur"),Ba(xE,"onTransitionRun"),Ba(bE,"onTransitionStart"),Ba(vE,"onTransitionCancel"),Ba(kv,"onTransitionEnd"),No("onMouseEnter",["mouseout","mouseover"]),No("onMouseLeave",["mouseout","mouseover"]),No("onPointerEnter",["pointerout","pointerover"]),No("onPointerLeave",["pointerout","pointerover"]),Pr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Pr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Pr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Pr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Pr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Pr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ji="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(" "),nN=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ji));function Y0(t,a){a=(a&4)!==0;for(var i=0;i<t.length;i++){var u=t[i],x=u.event;u=u.listeners;e:{var y=void 0;if(a)for(var M=u.length-1;0<=M;M--){var I=u[M],Q=I.instance,ae=I.currentTarget;if(I=I.listener,Q!==y&&x.isPropagationStopped())break e;y=I,x.currentTarget=ae;try{y(x)}catch(fe){Yc(fe)}x.currentTarget=null,y=Q}else for(M=0;M<u.length;M++){if(I=u[M],Q=I.instance,ae=I.currentTarget,I=I.listener,Q!==y&&x.isPropagationStopped())break e;y=I,x.currentTarget=ae;try{y(x)}catch(fe){Yc(fe)}x.currentTarget=null,y=Q}}}}function ht(t,a){var i=a[Lc];i===void 0&&(i=a[Lc]=new Set);var u=t+"__bubble";i.has(u)||(X0(a,t,2,!1),i.add(u))}function Cm(t,a,i){var u=0;a&&(u|=4),X0(i,t,u,a)}var Ou="_reactListening"+Math.random().toString(36).slice(2);function km(t){if(!t[Ou]){t[Ou]=!0,Hb.forEach(function(i){i!=="selectionchange"&&(nN.has(i)||Cm(i,!1,t),Cm(i,!0,t))});var a=t.nodeType===9?t:t.ownerDocument;a===null||a[Ou]||(a[Ou]=!0,Cm("selectionchange",!1,a))}}function X0(t,a,i,u){switch(w1(a)){case 2:var x=TN;break;case 8:x=AN;break;default:x=Hm}i=x.bind(null,a,i,t),x=void 0,!Ff||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(x=!0),u?x!==void 0?t.addEventListener(a,i,{capture:!0,passive:x}):t.addEventListener(a,i,!0):x!==void 0?t.addEventListener(a,i,{passive:x}):t.addEventListener(a,i,!1)}function Em(t,a,i,u,x){var y=u;if((a&1)===0&&(a&2)===0&&u!==null)e:for(;;){if(u===null)return;var M=u.tag;if(M===3||M===4){var I=u.stateNode.containerInfo;if(I===x)break;if(M===4)for(M=u.return;M!==null;){var Q=M.tag;if((Q===3||Q===4)&&M.stateNode.containerInfo===x)return;M=M.return}for(;I!==null;){if(M=Co(I),M===null)return;if(Q=M.tag,Q===5||Q===6||Q===26||Q===27){u=y=M;continue e}I=I.parentNode}}u=u.return}Jb(function(){var ae=y,fe=$f(i),xe=[];e:{var se=Ev.get(t);if(se!==void 0){var ue=$c,He=t;switch(t){case"keypress":if(Vc(i)===0)break e;case"keydown":case"keyup":ue=Kk;break;case"focusin":He="focus",ue=Qf;break;case"focusout":He="blur",ue=Qf;break;case"beforeblur":case"afterblur":ue=Qf;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=nv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=Pk;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=Wk;break;case wv:case Sv:case Cv:ue=Uk;break;case kv:ue=eE;break;case"scroll":case"scrollend":ue=Dk;break;case"wheel":ue=nE;break;case"copy":case"cut":case"paste":ue=Vk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=sv;break;case"toggle":case"beforetoggle":ue=sE}var et=(a&4)!==0,It=!et&&(t==="scroll"||t==="scrollend"),te=et?se!==null?se+"Capture":null:se;et=[];for(var W=ae,ne;W!==null;){var he=W;if(ne=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||ne===null||te===null||(he=$l(W,te),he!=null&&et.push(wi(W,he,ne))),It)break;W=W.return}0<et.length&&(se=new ue(se,He,null,i,fe),xe.push({event:se,listeners:et}))}}if((a&7)===0){e:{if(se=t==="mouseover"||t==="pointerover",ue=t==="mouseout"||t==="pointerout",se&&i!==qf&&(He=i.relatedTarget||i.fromElement)&&(Co(He)||He[Lr]))break e;if((ue||se)&&(se=fe.window===fe?fe:(se=fe.ownerDocument)?se.defaultView||se.parentWindow:window,ue?(He=i.relatedTarget||i.toElement,ue=ae,He=He?Co(He):null,He!==null&&(It=c(He),et=He.tag,He!==It||et!==5&&et!==27&&et!==6)&&(He=null)):(ue=null,He=ae),ue!==He)){if(et=nv,he="onMouseLeave",te="onMouseEnter",W="mouse",(t==="pointerout"||t==="pointerover")&&(et=sv,he="onPointerLeave",te="onPointerEnter",W="pointer"),It=ue==null?se:ql(ue),ne=He==null?se:ql(He),se=new et(he,W+"leave",ue,i,fe),se.target=It,se.relatedTarget=ne,he=null,Co(fe)===ae&&(et=new et(te,W+"enter",He,i,fe),et.target=ne,et.relatedTarget=It,he=et),It=he,ue&&He)t:{for(et=aN,te=ue,W=He,ne=0,he=te;he;he=et(he))ne++;he=0;for(var Ke=W;Ke;Ke=et(Ke))he++;for(;0<ne-he;)te=et(te),ne--;for(;0<he-ne;)W=et(W),he--;for(;ne--;){if(te===W||W!==null&&te===W.alternate){et=te;break t}te=et(te),W=et(W)}et=null}else et=null;ue!==null&&K0(xe,se,ue,et,!1),He!==null&&It!==null&&K0(xe,It,He,et,!0)}}e:{if(se=ae?ql(ae):window,ue=se.nodeName&&se.nodeName.toLowerCase(),ue==="select"||ue==="input"&&se.type==="file")var Ct=fv;else if(uv(se))if(pv)Ct=mE;else{Ct=fE;var $e=dE}else ue=se.nodeName,!ue||ue.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ae&&Vf(ae.elementType)&&(Ct=fv):Ct=pE;if(Ct&&(Ct=Ct(t,ae))){dv(xe,Ct,i,fe);break e}$e&&$e(t,se,ae),t==="focusout"&&ae&&se.type==="number"&&ae.memoizedProps.value!=null&&Hf(se,"number",se.value)}switch($e=ae?ql(ae):window,t){case"focusin":(uv($e)||$e.contentEditable==="true")&&(zo=$e,np=ae,Wl=null);break;case"focusout":Wl=np=zo=null;break;case"mousedown":ap=!0;break;case"contextmenu":case"mouseup":case"dragend":ap=!1,_v(xe,i,fe);break;case"selectionchange":if(hE)break;case"keydown":case"keyup":_v(xe,i,fe)}var ct;if(Wf)e:{switch(t){case"compositionstart":var bt="onCompositionStart";break e;case"compositionend":bt="onCompositionEnd";break e;case"compositionupdate":bt="onCompositionUpdate";break e}bt=void 0}else Oo?iv(t,i)&&(bt="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(bt="onCompositionStart");bt&&(rv&&i.locale!=="ko"&&(Oo||bt!=="onCompositionStart"?bt==="onCompositionEnd"&&Oo&&(ct=ev()):(Gs=fe,Yf="value"in Gs?Gs.value:Gs.textContent,Oo=!0)),$e=zu(ae,bt),0<$e.length&&(bt=new av(bt,t,null,i,fe),xe.push({event:bt,listeners:$e}),ct?bt.data=ct:(ct=cv(i),ct!==null&&(bt.data=ct)))),(ct=oE?lE(t,i):iE(t,i))&&(bt=zu(ae,"onBeforeInput"),0<bt.length&&($e=new av("onBeforeInput","beforeinput",null,i,fe),xe.push({event:$e,listeners:bt}),$e.data=ct)),JE(xe,t,ae,i,fe)}Y0(xe,a)})}function wi(t,a,i){return{instance:t,listener:a,currentTarget:i}}function zu(t,a){for(var i=a+"Capture",u=[];t!==null;){var x=t,y=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||y===null||(x=$l(t,i),x!=null&&u.unshift(wi(t,x,y)),x=$l(t,a),x!=null&&u.push(wi(t,x,y))),t.tag===3)return u;t=t.return}return[]}function aN(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function K0(t,a,i,u,x){for(var y=a._reactName,M=[];i!==null&&i!==u;){var I=i,Q=I.alternate,ae=I.stateNode;if(I=I.tag,Q!==null&&Q===u)break;I!==5&&I!==26&&I!==27||ae===null||(Q=ae,x?(ae=$l(i,y),ae!=null&&M.unshift(wi(i,ae,Q))):x||(ae=$l(i,y),ae!=null&&M.push(wi(i,ae,Q)))),i=i.return}M.length!==0&&t.push({event:a,listeners:M})}var sN=/\r\n?/g,rN=/\u0000|\uFFFD/g;function Q0(t){return(typeof t=="string"?t:""+t).replace(sN,`
49
+ `).replace(rN,"")}function Z0(t,a){return a=Q0(a),Q0(t)===a}function Pt(t,a,i,u,x,y){switch(i){case"children":typeof u=="string"?a==="body"||a==="textarea"&&u===""||To(t,u):(typeof u=="number"||typeof u=="bigint")&&a!=="body"&&To(t,""+u);break;case"className":Ic(t,"class",u);break;case"tabIndex":Ic(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Ic(t,i,u);break;case"style":Zb(t,u,y);break;case"data":if(a!=="object"){Ic(t,"data",u);break}case"src":case"href":if(u===""&&(a!=="a"||i!=="href")){t.removeAttribute(i);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(i);break}u=Uc(""+u),t.setAttribute(i,u);break;case"action":case"formAction":if(typeof u=="function"){t.setAttribute(i,"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 y=="function"&&(i==="formAction"?(a!=="input"&&Pt(t,a,"name",x.name,x,null),Pt(t,a,"formEncType",x.formEncType,x,null),Pt(t,a,"formMethod",x.formMethod,x,null),Pt(t,a,"formTarget",x.formTarget,x,null)):(Pt(t,a,"encType",x.encType,x,null),Pt(t,a,"method",x.method,x,null),Pt(t,a,"target",x.target,x,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(i);break}u=Uc(""+u),t.setAttribute(i,u);break;case"onClick":u!=null&&(t.onclick=ps);break;case"onScroll":u!=null&&ht("scroll",t);break;case"onScrollEnd":u!=null&&ht("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(o(61));if(i=u.__html,i!=null){if(x.children!=null)throw Error(o(60));t.innerHTML=i}}break;case"multiple":t.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":t.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){t.removeAttribute("xlink:href");break}i=Uc(""+u),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(i,""+u):t.removeAttribute(i);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":u&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(i,""):t.removeAttribute(i);break;case"capture":case"download":u===!0?t.setAttribute(i,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(i,u):t.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?t.setAttribute(i,u):t.removeAttribute(i);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?t.removeAttribute(i):t.setAttribute(i,u);break;case"popover":ht("beforetoggle",t),ht("toggle",t),Pc(t,"popover",u);break;case"xlinkActuate":fs(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":fs(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":fs(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":fs(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":fs(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":fs(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":fs(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":fs(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":fs(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Pc(t,"is",u);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=Ok.get(i)||i,Pc(t,i,u))}}function Nm(t,a,i,u,x,y){switch(i){case"style":Zb(t,u,y);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(o(61));if(i=u.__html,i!=null){if(x.children!=null)throw Error(o(60));t.innerHTML=i}}break;case"children":typeof u=="string"?To(t,u):(typeof u=="number"||typeof u=="bigint")&&To(t,""+u);break;case"onScroll":u!=null&&ht("scroll",t);break;case"onScrollEnd":u!=null&&ht("scrollend",t);break;case"onClick":u!=null&&(t.onclick=ps);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Vb.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(x=i.endsWith("Capture"),a=i.slice(2,x?i.length-7:void 0),y=t[hn]||null,y=y!=null?y[i]:null,typeof y=="function"&&t.removeEventListener(a,y,x),typeof u=="function")){typeof y!="function"&&y!==null&&(i in t?t[i]=null:t.hasAttribute(i)&&t.removeAttribute(i)),t.addEventListener(a,u,x);break e}i in t?t[i]=u:u===!0?t.setAttribute(i,""):Pc(t,i,u)}}}function Nn(t,a,i){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ht("error",t),ht("load",t);var u=!1,x=!1,y;for(y in i)if(i.hasOwnProperty(y)){var M=i[y];if(M!=null)switch(y){case"src":u=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,a));default:Pt(t,a,y,M,i,null)}}x&&Pt(t,a,"srcSet",i.srcSet,i,null),u&&Pt(t,a,"src",i.src,i,null);return;case"input":ht("invalid",t);var I=y=M=x=null,Q=null,ae=null;for(u in i)if(i.hasOwnProperty(u)){var fe=i[u];if(fe!=null)switch(u){case"name":x=fe;break;case"type":M=fe;break;case"checked":Q=fe;break;case"defaultChecked":ae=fe;break;case"value":y=fe;break;case"defaultValue":I=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(o(137,a));break;default:Pt(t,a,u,fe,i,null)}}Yb(t,y,I,Q,ae,M,x,!1);return;case"select":ht("invalid",t),u=M=y=null;for(x in i)if(i.hasOwnProperty(x)&&(I=i[x],I!=null))switch(x){case"value":y=I;break;case"defaultValue":M=I;break;case"multiple":u=I;default:Pt(t,a,x,I,i,null)}a=y,i=M,t.multiple=!!u,a!=null?Ro(t,!!u,a,!1):i!=null&&Ro(t,!!u,i,!0);return;case"textarea":ht("invalid",t),y=x=u=null;for(M in i)if(i.hasOwnProperty(M)&&(I=i[M],I!=null))switch(M){case"value":u=I;break;case"defaultValue":x=I;break;case"children":y=I;break;case"dangerouslySetInnerHTML":if(I!=null)throw Error(o(91));break;default:Pt(t,a,M,I,i,null)}Kb(t,u,x,y);return;case"option":for(Q in i)if(i.hasOwnProperty(Q)&&(u=i[Q],u!=null))switch(Q){case"selected":t.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:Pt(t,a,Q,u,i,null)}return;case"dialog":ht("beforetoggle",t),ht("toggle",t),ht("cancel",t),ht("close",t);break;case"iframe":case"object":ht("load",t);break;case"video":case"audio":for(u=0;u<ji.length;u++)ht(ji[u],t);break;case"image":ht("error",t),ht("load",t);break;case"details":ht("toggle",t);break;case"embed":case"source":case"link":ht("error",t),ht("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in i)if(i.hasOwnProperty(ae)&&(u=i[ae],u!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,a));default:Pt(t,a,ae,u,i,null)}return;default:if(Vf(a)){for(fe in i)i.hasOwnProperty(fe)&&(u=i[fe],u!==void 0&&Nm(t,a,fe,u,i,void 0));return}}for(I in i)i.hasOwnProperty(I)&&(u=i[I],u!=null&&Pt(t,a,I,u,i,null))}function oN(t,a,i,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,y=null,M=null,I=null,Q=null,ae=null,fe=null;for(ue in i){var xe=i[ue];if(i.hasOwnProperty(ue)&&xe!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":Q=xe;default:u.hasOwnProperty(ue)||Pt(t,a,ue,null,u,xe)}}for(var se in u){var ue=u[se];if(xe=i[se],u.hasOwnProperty(se)&&(ue!=null||xe!=null))switch(se){case"type":y=ue;break;case"name":x=ue;break;case"checked":ae=ue;break;case"defaultChecked":fe=ue;break;case"value":M=ue;break;case"defaultValue":I=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(o(137,a));break;default:ue!==xe&&Pt(t,a,se,ue,u,xe)}}Uf(t,M,I,Q,ae,fe,y,x);return;case"select":ue=M=I=se=null;for(y in i)if(Q=i[y],i.hasOwnProperty(y)&&Q!=null)switch(y){case"value":break;case"multiple":ue=Q;default:u.hasOwnProperty(y)||Pt(t,a,y,null,u,Q)}for(x in u)if(y=u[x],Q=i[x],u.hasOwnProperty(x)&&(y!=null||Q!=null))switch(x){case"value":se=y;break;case"defaultValue":I=y;break;case"multiple":M=y;default:y!==Q&&Pt(t,a,x,y,u,Q)}a=I,i=M,u=ue,se!=null?Ro(t,!!i,se,!1):!!u!=!!i&&(a!=null?Ro(t,!!i,a,!0):Ro(t,!!i,i?[]:"",!1));return;case"textarea":ue=se=null;for(I in i)if(x=i[I],i.hasOwnProperty(I)&&x!=null&&!u.hasOwnProperty(I))switch(I){case"value":break;case"children":break;default:Pt(t,a,I,null,u,x)}for(M in u)if(x=u[M],y=i[M],u.hasOwnProperty(M)&&(x!=null||y!=null))switch(M){case"value":se=x;break;case"defaultValue":ue=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(o(91));break;default:x!==y&&Pt(t,a,M,x,u,y)}Xb(t,se,ue);return;case"option":for(var He in i)if(se=i[He],i.hasOwnProperty(He)&&se!=null&&!u.hasOwnProperty(He))switch(He){case"selected":t.selected=!1;break;default:Pt(t,a,He,null,u,se)}for(Q in u)if(se=u[Q],ue=i[Q],u.hasOwnProperty(Q)&&se!==ue&&(se!=null||ue!=null))switch(Q){case"selected":t.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:Pt(t,a,Q,se,u,ue)}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 et in i)se=i[et],i.hasOwnProperty(et)&&se!=null&&!u.hasOwnProperty(et)&&Pt(t,a,et,null,u,se);for(ae in u)if(se=u[ae],ue=i[ae],u.hasOwnProperty(ae)&&se!==ue&&(se!=null||ue!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(o(137,a));break;default:Pt(t,a,ae,se,u,ue)}return;default:if(Vf(a)){for(var It in i)se=i[It],i.hasOwnProperty(It)&&se!==void 0&&!u.hasOwnProperty(It)&&Nm(t,a,It,void 0,u,se);for(fe in u)se=u[fe],ue=i[fe],!u.hasOwnProperty(fe)||se===ue||se===void 0&&ue===void 0||Nm(t,a,fe,se,u,ue);return}}for(var te in i)se=i[te],i.hasOwnProperty(te)&&se!=null&&!u.hasOwnProperty(te)&&Pt(t,a,te,null,u,se);for(xe in u)se=u[xe],ue=i[xe],!u.hasOwnProperty(xe)||se===ue||se==null&&ue==null||Pt(t,a,xe,se,u,ue)}function W0(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function lN(){if(typeof performance.getEntriesByType=="function"){for(var t=0,a=0,i=performance.getEntriesByType("resource"),u=0;u<i.length;u++){var x=i[u],y=x.transferSize,M=x.initiatorType,I=x.duration;if(y&&I&&W0(M)){for(M=0,I=x.responseEnd,u+=1;u<i.length;u++){var Q=i[u],ae=Q.startTime;if(ae>I)break;var fe=Q.transferSize,xe=Q.initiatorType;fe&&W0(xe)&&(Q=Q.responseEnd,M+=fe*(Q<I?1:(I-ae)/(Q-ae)))}if(--u,a+=8*(y+M)/(x.duration/1e3),t++,10<t)break}}if(0<t)return a/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Rm=null,Tm=null;function Du(t){return t.nodeType===9?t:t.ownerDocument}function J0(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function e1(t,a){if(t===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&a==="foreignObject"?0:t}function Am(t,a){return t==="textarea"||t==="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 Mm=null;function iN(){var t=window.event;return t&&t.type==="popstate"?t===Mm?!1:(Mm=t,!0):(Mm=null,!1)}var t1=typeof setTimeout=="function"?setTimeout:void 0,cN=typeof clearTimeout=="function"?clearTimeout:void 0,n1=typeof Promise=="function"?Promise:void 0,uN=typeof queueMicrotask=="function"?queueMicrotask:typeof n1<"u"?function(t){return n1.resolve(null).then(t).catch(dN)}:t1;function dN(t){setTimeout(function(){throw t})}function ir(t){return t==="head"}function a1(t,a){var i=a,u=0;do{var x=i.nextSibling;if(t.removeChild(i),x&&x.nodeType===8)if(i=x.data,i==="/$"||i==="/&"){if(u===0){t.removeChild(x),ll(a);return}u--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")u++;else if(i==="html")Si(t.ownerDocument.documentElement);else if(i==="head"){i=t.ownerDocument.head,Si(i);for(var y=i.firstChild;y;){var M=y.nextSibling,I=y.nodeName;y[Vl]||I==="SCRIPT"||I==="STYLE"||I==="LINK"&&y.rel.toLowerCase()==="stylesheet"||i.removeChild(y),y=M}}else i==="body"&&Si(t.ownerDocument.body);i=x}while(i);ll(a)}function s1(t,a){var i=t;t=0;do{var u=i.nextSibling;if(i.nodeType===1?a?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(a?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),u&&u.nodeType===8)if(i=u.data,i==="/$"){if(t===0)break;t--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||t++;i=u}while(i)}function Om(t){var a=t.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var i=a;switch(a=a.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Om(i),If(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}t.removeChild(i)}}function fN(t,a,i,u){for(;t.nodeType===1;){var x=i;if(t.nodeName.toLowerCase()!==a.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[Vl])switch(a){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(y=t.getAttribute("rel"),y==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(y!==x.rel||t.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||t.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||t.getAttribute("title")!==(x.title==null?null:x.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(y=t.getAttribute("src"),(y!==(x.src==null?null:x.src)||t.getAttribute("type")!==(x.type==null?null:x.type)||t.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&y&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(a==="input"&&t.type==="hidden"){var y=x.name==null?null:""+x.name;if(x.type==="hidden"&&t.getAttribute("name")===y)return t}else return t;if(t=Ta(t.nextSibling),t===null)break}return null}function pN(t,a,i){if(a==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=Ta(t.nextSibling),t===null))return null;return t}function r1(t,a){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Ta(t.nextSibling),t===null))return null;return t}function zm(t){return t.data==="$?"||t.data==="$~"}function Dm(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function mN(t,a){var i=t.ownerDocument;if(t.data==="$~")t._reactRetry=a;else if(t.data!=="$?"||i.readyState!=="loading")a();else{var u=function(){a(),i.removeEventListener("DOMContentLoaded",u)};i.addEventListener("DOMContentLoaded",u),t._reactRetry=u}}function Ta(t){for(;t!=null;t=t.nextSibling){var a=t.nodeType;if(a===1||a===3)break;if(a===8){if(a=t.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return t}var Lm=null;function o1(t){t=t.nextSibling;for(var a=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"||i==="/&"){if(a===0)return Ta(t.nextSibling);a--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||a++}t=t.nextSibling}return null}function l1(t){t=t.previousSibling;for(var a=0;t;){if(t.nodeType===8){var i=t.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(a===0)return t;a--}else i!=="/$"&&i!=="/&"||a++}t=t.previousSibling}return null}function i1(t,a,i){switch(a=Du(i),t){case"html":if(t=a.documentElement,!t)throw Error(o(452));return t;case"head":if(t=a.head,!t)throw Error(o(453));return t;case"body":if(t=a.body,!t)throw Error(o(454));return t;default:throw Error(o(451))}}function Si(t){for(var a=t.attributes;a.length;)t.removeAttributeNode(a[0]);If(t)}var Aa=new Map,c1=new Set;function Lu(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Rs=$.d;$.d={f:gN,r:hN,D:xN,C:bN,L:vN,m:yN,X:jN,S:_N,M:wN};function gN(){var t=Rs.f(),a=Eu();return t||a}function hN(t){var a=ko(t);a!==null&&a.tag===5&&a.type==="form"?ky(a):Rs.r(t)}var sl=typeof document>"u"?null:document;function u1(t,a,i){var u=sl;if(u&&typeof a=="string"&&a){var x=wa(a);x='link[rel="'+t+'"][href="'+x+'"]',typeof i=="string"&&(x+='[crossorigin="'+i+'"]'),c1.has(x)||(c1.add(x),t={rel:t,crossOrigin:i,href:a},u.querySelector(x)===null&&(a=u.createElement("link"),Nn(a,"link",t),jn(a),u.head.appendChild(a)))}}function xN(t){Rs.D(t),u1("dns-prefetch",t,null)}function bN(t,a){Rs.C(t,a),u1("preconnect",t,a)}function vN(t,a,i){Rs.L(t,a,i);var u=sl;if(u&&t&&a){var x='link[rel="preload"][as="'+wa(a)+'"]';a==="image"&&i&&i.imageSrcSet?(x+='[imagesrcset="'+wa(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(x+='[imagesizes="'+wa(i.imageSizes)+'"]')):x+='[href="'+wa(t)+'"]';var y=x;switch(a){case"style":y=rl(t);break;case"script":y=ol(t)}Aa.has(y)||(t=b({rel:"preload",href:a==="image"&&i&&i.imageSrcSet?void 0:t,as:a},i),Aa.set(y,t),u.querySelector(x)!==null||a==="style"&&u.querySelector(Ci(y))||a==="script"&&u.querySelector(ki(y))||(a=u.createElement("link"),Nn(a,"link",t),jn(a),u.head.appendChild(a)))}}function yN(t,a){Rs.m(t,a);var i=sl;if(i&&t){var u=a&&typeof a.as=="string"?a.as:"script",x='link[rel="modulepreload"][as="'+wa(u)+'"][href="'+wa(t)+'"]',y=x;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=ol(t)}if(!Aa.has(y)&&(t=b({rel:"modulepreload",href:t},a),Aa.set(y,t),i.querySelector(x)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(ki(y)))return}u=i.createElement("link"),Nn(u,"link",t),jn(u),i.head.appendChild(u)}}}function _N(t,a,i){Rs.S(t,a,i);var u=sl;if(u&&t){var x=Eo(u).hoistableStyles,y=rl(t);a=a||"default";var M=x.get(y);if(!M){var I={loading:0,preload:null};if(M=u.querySelector(Ci(y)))I.loading=5;else{t=b({rel:"stylesheet",href:t,"data-precedence":a},i),(i=Aa.get(y))&&Pm(t,i);var Q=M=u.createElement("link");jn(Q),Nn(Q,"link",t),Q._p=new Promise(function(ae,fe){Q.onload=ae,Q.onerror=fe}),Q.addEventListener("load",function(){I.loading|=1}),Q.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Pu(M,a,u)}M={type:"stylesheet",instance:M,count:1,state:I},x.set(y,M)}}}function jN(t,a){Rs.X(t,a);var i=sl;if(i&&t){var u=Eo(i).hoistableScripts,x=ol(t),y=u.get(x);y||(y=i.querySelector(ki(x)),y||(t=b({src:t,async:!0},a),(a=Aa.get(x))&&Im(t,a),y=i.createElement("script"),jn(y),Nn(y,"link",t),i.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},u.set(x,y))}}function wN(t,a){Rs.M(t,a);var i=sl;if(i&&t){var u=Eo(i).hoistableScripts,x=ol(t),y=u.get(x);y||(y=i.querySelector(ki(x)),y||(t=b({src:t,async:!0,type:"module"},a),(a=Aa.get(x))&&Im(t,a),y=i.createElement("script"),jn(y),Nn(y,"link",t),i.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},u.set(x,y))}}function d1(t,a,i,u){var x=(x=re.current)?Lu(x):null;if(!x)throw Error(o(446));switch(t){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(a=rl(i.href),i=Eo(x).hoistableStyles,u=i.get(a),u||(u={type:"style",instance:null,count:0,state:null},i.set(a,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){t=rl(i.href);var y=Eo(x).hoistableStyles,M=y.get(t);if(M||(x=x.ownerDocument||x,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(t,M),(y=x.querySelector(Ci(t)))&&!y._p&&(M.instance=y,M.state.loading=5),Aa.has(t)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Aa.set(t,i),y||SN(x,t,i,M.state))),a&&u===null)throw Error(o(528,""));return M}if(a&&u!==null)throw Error(o(529,""));return null;case"script":return a=i.async,i=i.src,typeof i=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=ol(i),i=Eo(x).hoistableScripts,u=i.get(a),u||(u={type:"script",instance:null,count:0,state:null},i.set(a,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,t))}}function rl(t){return'href="'+wa(t)+'"'}function Ci(t){return'link[rel="stylesheet"]['+t+"]"}function f1(t){return b({},t,{"data-precedence":t.precedence,precedence:null})}function SN(t,a,i,u){t.querySelector('link[rel="preload"][as="style"]['+a+"]")?u.loading=1:(a=t.createElement("link"),u.preload=a,a.addEventListener("load",function(){return u.loading|=1}),a.addEventListener("error",function(){return u.loading|=2}),Nn(a,"link",i),jn(a),t.head.appendChild(a))}function ol(t){return'[src="'+wa(t)+'"]'}function ki(t){return"script[async]"+t}function p1(t,a,i){if(a.count++,a.instance===null)switch(a.type){case"style":var u=t.querySelector('style[data-href~="'+wa(i.href)+'"]');if(u)return a.instance=u,jn(u),u;var x=b({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),jn(u),Nn(u,"style",x),Pu(u,i.precedence,t),a.instance=u;case"stylesheet":x=rl(i.href);var y=t.querySelector(Ci(x));if(y)return a.state.loading|=4,a.instance=y,jn(y),y;u=f1(i),(x=Aa.get(x))&&Pm(u,x),y=(t.ownerDocument||t).createElement("link"),jn(y);var M=y;return M._p=new Promise(function(I,Q){M.onload=I,M.onerror=Q}),Nn(y,"link",u),a.state.loading|=4,Pu(y,i.precedence,t),a.instance=y;case"script":return y=ol(i.src),(x=t.querySelector(ki(y)))?(a.instance=x,jn(x),x):(u=i,(x=Aa.get(y))&&(u=b({},i),Im(u,x)),t=t.ownerDocument||t,x=t.createElement("script"),jn(x),Nn(x,"link",u),t.head.appendChild(x),a.instance=x);case"void":return null;default:throw Error(o(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(u=a.instance,a.state.loading|=4,Pu(u,i.precedence,t));return a.instance}function Pu(t,a,i){for(var u=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=u.length?u[u.length-1]:null,y=x,M=0;M<u.length;M++){var I=u[M];if(I.dataset.precedence===a)y=I;else if(y!==x)break}y?y.parentNode.insertBefore(t,y.nextSibling):(a=i.nodeType===9?i.head:i,a.insertBefore(t,a.firstChild))}function Pm(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.title==null&&(t.title=a.title)}function Im(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.integrity==null&&(t.integrity=a.integrity)}var Iu=null;function m1(t,a,i){if(Iu===null){var u=new Map,x=Iu=new Map;x.set(i,u)}else x=Iu,u=x.get(i),u||(u=new Map,x.set(i,u));if(u.has(t))return u;for(u.set(t,null),i=i.getElementsByTagName(t),x=0;x<i.length;x++){var y=i[x];if(!(y[Vl]||y[Rt]||t==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var M=y.getAttribute(a)||"";M=t+M;var I=u.get(M);I?I.push(y):u.set(M,[y])}}return u}function g1(t,a,i){t=t.ownerDocument||t,t.head.insertBefore(i,a==="title"?t.querySelector("head > title"):null)}function CN(t,a,i){if(i===1||a.itemProp!=null)return!1;switch(t){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 t=a.disabled,typeof a.precedence=="string"&&t==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 h1(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function kN(t,a,i,u){if(i.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var x=rl(u.href),y=a.querySelector(Ci(x));if(y){a=y._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(t.count++,t=Bu.bind(t),a.then(t,t)),i.state.loading|=4,i.instance=y,jn(y);return}y=a.ownerDocument||a,u=f1(u),(x=Aa.get(x))&&Pm(u,x),y=y.createElement("link"),jn(y);var M=y;M._p=new Promise(function(I,Q){M.onload=I,M.onerror=Q}),Nn(y,"link",u),i.instance=y}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(i,a),(a=i.state.preload)&&(i.state.loading&3)===0&&(t.count++,i=Bu.bind(t),a.addEventListener("load",i),a.addEventListener("error",i))}}var Bm=0;function EN(t,a){return t.stylesheets&&t.count===0&&Hu(t,t.stylesheets),0<t.count||0<t.imgCount?function(i){var u=setTimeout(function(){if(t.stylesheets&&Hu(t,t.stylesheets),t.unsuspend){var y=t.unsuspend;t.unsuspend=null,y()}},6e4+a);0<t.imgBytes&&Bm===0&&(Bm=62500*lN());var x=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Hu(t,t.stylesheets),t.unsuspend)){var y=t.unsuspend;t.unsuspend=null,y()}},(t.imgBytes>Bm?50:800)+a);return t.unsuspend=i,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(x)}}:null}function Bu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Uu=null;function Hu(t,a){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Uu=new Map,a.forEach(NN,t),Uu=null,Bu.call(t))}function NN(t,a){if(!(a.state.loading&4)){var i=Uu.get(t);if(i)var u=i.get(null);else{i=new Map,Uu.set(t,i);for(var x=t.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<x.length;y++){var M=x[y];(M.nodeName==="LINK"||M.getAttribute("media")!=="not all")&&(i.set(M.dataset.precedence,M),u=M)}u&&i.set(null,u)}x=a.instance,M=x.getAttribute("data-precedence"),y=i.get(M)||u,y===u&&i.set(null,x),i.set(M,x),this.count++,u=Bu.bind(this),x.addEventListener("load",u),x.addEventListener("error",u),y?y.parentNode.insertBefore(x,y.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(x,t.firstChild)),a.state.loading|=4}}var Ei={$$typeof:N,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function RN(t,a,i,u,x,y,M,I,Q){this.tag=1,this.containerInfo=t,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=ia(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ia(0),this.hiddenUpdates=ia(null),this.identifierPrefix=u,this.onUncaughtError=x,this.onCaughtError=y,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.incompleteTransitions=new Map}function x1(t,a,i,u,x,y,M,I,Q,ae,fe,xe){return t=new RN(t,a,i,M,Q,ae,fe,xe,I),a=1,y===!0&&(a|=24),y=da(3,null,null,a),t.current=y,y.stateNode=t,a=bp(),a.refCount++,t.pooledCache=a,a.refCount++,y.memoizedState={element:u,isDehydrated:i,cache:a},jp(y),t}function b1(t){return t?(t=Po,t):Po}function v1(t,a,i,u,x,y){x=b1(x),u.context===null?u.context=x:u.pendingContext=x,u=Zs(a),u.payload={element:i},y=y===void 0?null:y,y!==null&&(u.callback=y),i=Ws(t,u,a),i!==null&&(na(i,t,a),ri(i,t,a))}function y1(t,a){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<a?i:a}}function Um(t,a){y1(t,a),(t=t.alternate)&&y1(t,a)}function _1(t){if(t.tag===13||t.tag===31){var a=Hr(t,67108864);a!==null&&na(a,t,67108864),Um(t,67108864)}}function j1(t){if(t.tag===13||t.tag===31){var a=ha();a=ds(a);var i=Hr(t,a);i!==null&&na(i,t,a),Um(t,a)}}var Vu=!0;function TN(t,a,i,u){var x=V.T;V.T=null;var y=$.p;try{$.p=2,Hm(t,a,i,u)}finally{$.p=y,V.T=x}}function AN(t,a,i,u){var x=V.T;V.T=null;var y=$.p;try{$.p=8,Hm(t,a,i,u)}finally{$.p=y,V.T=x}}function Hm(t,a,i,u){if(Vu){var x=Vm(u);if(x===null)Em(t,a,u,qu,i),S1(t,u);else if(ON(x,t,a,i,u))u.stopPropagation();else if(S1(t,u),a&4&&-1<MN.indexOf(t)){for(;x!==null;){var y=ko(x);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var M=sn(y.pendingLanes);if(M!==0){var I=y;for(I.pendingLanes|=2,I.entangledLanes|=2;M;){var Q=1<<31-st(M);I.entanglements[1]|=Q,M&=~Q}Za(y),(Et&6)===0&&(Cu=ye()+500,_i(0))}}break;case 31:case 13:I=Hr(y,2),I!==null&&na(I,y,2),Eu(),Um(y,2)}if(y=Vm(u),y===null&&Em(t,a,u,qu,i),y===x)break;x=y}x!==null&&u.stopPropagation()}else Em(t,a,u,null,i)}}function Vm(t){return t=$f(t),qm(t)}var qu=null;function qm(t){if(qu=null,t=Co(t),t!==null){var a=c(t);if(a===null)t=null;else{var i=a.tag;if(i===13){if(t=d(a),t!==null)return t;t=null}else if(i===31){if(t=f(a),t!==null)return t;t=null}else if(i===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;t=null}else a!==t&&(t=null)}}return qu=t,null}function w1(t){switch(t){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(le()){case je:return 2;case Se:return 8;case Ue:case Je:return 32;case _t:return 268435456;default:return 32}default:return 32}}var $m=!1,cr=null,ur=null,dr=null,Ni=new Map,Ri=new Map,fr=[],MN="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 S1(t,a){switch(t){case"focusin":case"focusout":cr=null;break;case"dragenter":case"dragleave":ur=null;break;case"mouseover":case"mouseout":dr=null;break;case"pointerover":case"pointerout":Ni.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ri.delete(a.pointerId)}}function Ti(t,a,i,u,x,y){return t===null||t.nativeEvent!==y?(t={blockedOn:a,domEventName:i,eventSystemFlags:u,nativeEvent:y,targetContainers:[x]},a!==null&&(a=ko(a),a!==null&&_1(a)),t):(t.eventSystemFlags|=u,a=t.targetContainers,x!==null&&a.indexOf(x)===-1&&a.push(x),t)}function ON(t,a,i,u,x){switch(a){case"focusin":return cr=Ti(cr,t,a,i,u,x),!0;case"dragenter":return ur=Ti(ur,t,a,i,u,x),!0;case"mouseover":return dr=Ti(dr,t,a,i,u,x),!0;case"pointerover":var y=x.pointerId;return Ni.set(y,Ti(Ni.get(y)||null,t,a,i,u,x)),!0;case"gotpointercapture":return y=x.pointerId,Ri.set(y,Ti(Ri.get(y)||null,t,a,i,u,x)),!0}return!1}function C1(t){var a=Co(t.target);if(a!==null){var i=c(a);if(i!==null){if(a=i.tag,a===13){if(a=d(i),a!==null){t.blockedOn=a,Sn(t.priority,function(){j1(i)});return}}else if(a===31){if(a=f(i),a!==null){t.blockedOn=a,Sn(t.priority,function(){j1(i)});return}}else if(a===3&&i.stateNode.current.memoizedState.isDehydrated){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function $u(t){if(t.blockedOn!==null)return!1;for(var a=t.targetContainers;0<a.length;){var i=Vm(t.nativeEvent);if(i===null){i=t.nativeEvent;var u=new i.constructor(i.type,i);qf=u,i.target.dispatchEvent(u),qf=null}else return a=ko(i),a!==null&&_1(a),t.blockedOn=i,!1;a.shift()}return!0}function k1(t,a,i){$u(t)&&i.delete(a)}function zN(){$m=!1,cr!==null&&$u(cr)&&(cr=null),ur!==null&&$u(ur)&&(ur=null),dr!==null&&$u(dr)&&(dr=null),Ni.forEach(k1),Ri.forEach(k1)}function Gu(t,a){t.blockedOn===a&&(t.blockedOn=null,$m||($m=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,zN)))}var Fu=null;function E1(t){Fu!==t&&(Fu=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Fu===t&&(Fu=null);for(var a=0;a<t.length;a+=3){var i=t[a],u=t[a+1],x=t[a+2];if(typeof u!="function"){if(qm(u||i)===null)continue;break}var y=ko(i);y!==null&&(t.splice(a,3),a-=3,Vp(y,{pending:!0,data:x,method:i.method,action:u},u,x))}}))}function ll(t){function a(Q){return Gu(Q,t)}cr!==null&&Gu(cr,t),ur!==null&&Gu(ur,t),dr!==null&&Gu(dr,t),Ni.forEach(a),Ri.forEach(a);for(var i=0;i<fr.length;i++){var u=fr[i];u.blockedOn===t&&(u.blockedOn=null)}for(;0<fr.length&&(i=fr[0],i.blockedOn===null);)C1(i),i.blockedOn===null&&fr.shift();if(i=(t.ownerDocument||t).$$reactFormReplay,i!=null)for(u=0;u<i.length;u+=3){var x=i[u],y=i[u+1],M=x[hn]||null;if(typeof y=="function")M||E1(i);else if(M){var I=null;if(y&&y.hasAttribute("formAction")){if(x=y,M=y[hn]||null)I=M.formAction;else if(qm(x)!==null)continue}else I=M.action;typeof I=="function"?i[u+1]=I:(i.splice(u,3),u-=3),E1(i)}}}function N1(){function t(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(M){return x=M})},focusReset:"manual",scroll:"manual"})}function a(){x!==null&&(x(),x=null),u||setTimeout(i,20)}function i(){if(!u&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,x=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(i,100),function(){u=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),x!==null&&(x(),x=null)}}}function Gm(t){this._internalRoot=t}Yu.prototype.render=Gm.prototype.render=function(t){var a=this._internalRoot;if(a===null)throw Error(o(409));var i=a.current,u=ha();v1(i,u,t,a,null,null)},Yu.prototype.unmount=Gm.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var a=t.containerInfo;v1(t.current,2,null,t,null,null),Eu(),a[Lr]=null}};function Yu(t){this._internalRoot=t}Yu.prototype.unstable_scheduleHydration=function(t){if(t){var a=Dt();t={blockedOn:null,target:t,priority:a};for(var i=0;i<fr.length&&a!==0&&a<fr[i].priority;i++);fr.splice(i,0,t),i===0&&C1(t)}};var R1=n.version;if(R1!=="19.2.7")throw Error(o(527,R1,"19.2.7"));$.findDOMNode=function(t){var a=t._reactInternals;if(a===void 0)throw typeof t.render=="function"?Error(o(188)):(t=Object.keys(t).join(","),Error(o(268,t)));return t=m(a),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var DN={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:V,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xu.isDisabled&&Xu.supportsFiber)try{Ee=Xu.inject(DN),Re=Xu}catch{}}return Mi.createRoot=function(t,a){if(!l(t))throw Error(o(299));var i=!1,u="",x=Ly,y=Py,M=Iy;return a!=null&&(a.unstable_strictMode===!0&&(i=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(x=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(M=a.onRecoverableError)),a=x1(t,1,!1,null,null,i,u,null,x,y,M,N1),t[Lr]=a.current,km(t),new Gm(a)},Mi.hydrateRoot=function(t,a,i){if(!l(t))throw Error(o(299));var u=!1,x="",y=Ly,M=Py,I=Iy,Q=null;return i!=null&&(i.unstable_strictMode===!0&&(u=!0),i.identifierPrefix!==void 0&&(x=i.identifierPrefix),i.onUncaughtError!==void 0&&(y=i.onUncaughtError),i.onCaughtError!==void 0&&(M=i.onCaughtError),i.onRecoverableError!==void 0&&(I=i.onRecoverableError),i.formState!==void 0&&(Q=i.formState)),a=x1(t,1,!0,a,i??null,u,x,Q,y,M,I,N1),a.context=b1(null),i=a.current,u=ha(),u=ds(u),x=Zs(u),x.callback=null,Ws(i,x,u),i=u,a.current.lanes=i,Qn(a,i),Za(a),t[Lr]=a.current,km(t),new Yu(a)},Mi.version="19.2.7",Mi}var B1;function FN(){if(B1)return Xm.exports;B1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Xm.exports=GN(),Xm.exports}var YN=FN();const XN=ex(YN);/**
50
+ * react-router v7.17.0
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 U1="popstate";function H1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function KN(e={}){function n(o,l){let c=l.state?.masked,{pathname:d,search:f,hash:p}=c||o.location;return dh("",{pathname:d,search:f,hash:p},l.state&&l.state.usr||null,l.state&&l.state.key||"default",c?{pathname:o.location.pathname,search:o.location.search,hash:o.location.hash}:void 0)}function s(o,l){return typeof l=="string"?l:uc(l)}return ZN(n,s,null,e)}function en(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function La(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function QN(){return Math.random().toString(36).substring(2,10)}function V1(e,n){return{usr:e.state,key:e.key,idx:n,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function dh(e,n,s=null,o,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?Al(n):n,state:s,key:n&&n.key||o||QN(),mask:l}}function uc({pathname:e="/",search:n="",hash:s=""}){return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(e+=s.charAt(0)==="#"?s:"#"+s),e}function Al(e){let n={};if(e){let s=e.indexOf("#");s>=0&&(n.hash=e.substring(s),e=e.substring(0,s));let o=e.indexOf("?");o>=0&&(n.search=e.substring(o),e=e.substring(0,o)),e&&(n.pathname=e)}return n}function ZN(e,n,s,o={}){let{window:l=document.defaultView,v5Compat:c=!1}=o,d=l.history,f="POP",p=null,m=g();m==null&&(m=0,d.replaceState({...d.state,idx:m},""));function g(){return(d.state||{idx:null}).idx}function b(){f="POP";let w=g(),k=w==null?null:w-m;m=w,p&&p({action:f,location:_.location,delta:k})}function v(w,k){f="PUSH";let E=H1(w)?w:dh(_.location,w,k);m=g()+1;let N=V1(E,m),R=_.createHref(E.mask||E);try{d.pushState(N,"",R)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;l.location.assign(R)}c&&p&&p({action:f,location:_.location,delta:1})}function S(w,k){f="REPLACE";let E=H1(w)?w:dh(_.location,w,k);m=g();let N=V1(E,m),R=_.createHref(E.mask||E);d.replaceState(N,"",R),c&&p&&p({action:f,location:_.location,delta:0})}function C(w){return WN(l,w)}let _={get action(){return f},get location(){return e(l,d)},listen(w){if(p)throw new Error("A history only accepts one active listener");return l.addEventListener(U1,b),p=w,()=>{l.removeEventListener(U1,b),p=null}},createHref(w){return n(l,w)},createURL:C,encodeLocation(w){let k=C(w);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:v,replace:S,go(w){return d.go(w)}};return _}function WN(e,n,s=!1){let o="http://localhost";e&&(o=e.location.origin!=="null"?e.location.origin:e.location.href),en(o,"No window.location.(origin|href) available to create URL");let l=typeof n=="string"?n:uc(n);return l=l.replace(/ $/,"%20"),!s&&l.startsWith("//")&&(l=o+l),new URL(l,o)}function vw(e,n,s="/"){return JN(e,n,s,!1)}function JN(e,n,s,o,l){let c=typeof n=="string"?Al(n):n,d=Is(c.pathname||"/",s);if(d==null)return null;let f=eR(e),p=null,m=fR(d);for(let g=0;p==null&&g<f.length;++g)p=uR(f[g],m,o);return p}function eR(e){let n=yw(e);return tR(n),n}function yw(e,n=[],s=[],o="",l=!1){let c=(d,f,p=l,m)=>{let g={relativePath:m===void 0?d.path||"":m,caseSensitive:d.caseSensitive===!0,childrenIndex:f,route:d};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(o)&&p)return;en(g.relativePath.startsWith(o),`Absolute route path "${g.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(o.length)}let b=$a([o,g.relativePath]),v=s.concat(g);d.children&&d.children.length>0&&(en(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),yw(d.children,n,v,b,p)),!(d.path==null&&!d.index)&&n.push({path:b,score:iR(b,d.index),routesMeta:v})};return e.forEach((d,f)=>{if(d.path===""||!d.path?.includes("?"))c(d,f);else for(let p of _w(d.path))c(d,f,!0,p)}),n}function _w(e){let n=e.split("/");if(n.length===0)return[];let[s,...o]=n,l=s.endsWith("?"),c=s.replace(/\?$/,"");if(o.length===0)return l?[c,""]:[c];let d=_w(o.join("/")),f=[];return f.push(...d.map(p=>p===""?c:[c,p].join("/"))),l&&f.push(...d),f.map(p=>e.startsWith("/")&&p===""?"/":p)}function tR(e){e.sort((n,s)=>n.score!==s.score?s.score-n.score:cR(n.routesMeta.map(o=>o.childrenIndex),s.routesMeta.map(o=>o.childrenIndex)))}var nR=/^:[\w-]+$/,aR=3,sR=2,rR=1,oR=10,lR=-2,q1=e=>e==="*";function iR(e,n){let s=e.split("/"),o=s.length;return s.some(q1)&&(o+=lR),n&&(o+=sR),s.filter(l=>!q1(l)).reduce((l,c)=>l+(nR.test(c)?aR:c===""?rR:oR),o)}function cR(e,n){return e.length===n.length&&e.slice(0,-1).every((o,l)=>o===n[l])?e[e.length-1]-n[n.length-1]:0}function uR(e,n,s=!1){let{routesMeta:o}=e,l={},c="/",d=[];for(let f=0;f<o.length;++f){let p=o[f],m=f===o.length-1,g=c==="/"?n:n.slice(c.length)||"/",b=Rd({path:p.relativePath,caseSensitive:p.caseSensitive,end:m},g),v=p.route;if(!b&&m&&s&&!o[o.length-1].route.index&&(b=Rd({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},g)),!b)return null;Object.assign(l,b.params),d.push({params:l,pathname:$a([c,b.pathname]),pathnameBase:hR($a([c,b.pathnameBase])),route:v}),b.pathnameBase!=="/"&&(c=$a([c,b.pathnameBase]))}return d}function Rd(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[s,o]=dR(e.path,e.caseSensitive,e.end),l=n.match(s);if(!l)return null;let c=l[0],d=c.replace(/(.)\/+$/,"$1"),f=l.slice(1);return{params:o.reduce((m,{paramName:g,isOptional:b},v)=>{if(g==="*"){let C=f[v]||"";d=c.slice(0,c.length-C.length).replace(/(.)\/+$/,"$1")}const S=f[v];return b&&!S?m[g]=void 0:m[g]=(S||"").replace(/%2F/g,"/"),m},{}),pathname:c,pathnameBase:d,pattern:e}}function dR(e,n=!1,s=!0){La(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let o=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,f,p,m,g)=>{if(o.push({paramName:f,isOptional:p!=null}),p){let b=g.charAt(m+d.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(o.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,n?void 0:"i"),o]}function fR(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return La(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),e}}function Is(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let s=n.endsWith("/")?n.length-1:n.length,o=e.charAt(s);return o&&o!=="/"?null:e.slice(s)||"/"}var pR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function mR(e,n="/"){let{pathname:s,search:o="",hash:l=""}=typeof e=="string"?Al(e):e,c;return s?(s=jw(s),s.startsWith("/")?c=$1(s.substring(1),"/"):c=$1(s,n)):c=n,{pathname:c,search:xR(o),hash:bR(l)}}function $1(e,n){let s=Td(n).split("/");return e.split("/").forEach(l=>{l===".."?s.length>1&&s.pop():l!=="."&&s.push(l)}),s.length>1?s.join("/"):"/"}function Wm(e,n,s,o){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${s}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function gR(e){return e.filter((n,s)=>s===0||n.route.path&&n.route.path.length>0)}function tx(e){let n=gR(e);return n.map((s,o)=>o===n.length-1?s.pathname:s.pathnameBase)}function sf(e,n,s,o=!1){let l;typeof e=="string"?l=Al(e):(l={...e},en(!l.pathname||!l.pathname.includes("?"),Wm("?","pathname","search",l)),en(!l.pathname||!l.pathname.includes("#"),Wm("#","pathname","hash",l)),en(!l.search||!l.search.includes("#"),Wm("#","search","hash",l)));let c=e===""||l.pathname==="",d=c?"/":l.pathname,f;if(d==null)f=s;else{let b=n.length-1;if(!o&&d.startsWith("..")){let v=d.split("/");for(;v[0]==="..";)v.shift(),b-=1;l.pathname=v.join("/")}f=b>=0?n[b]:"/"}let p=mR(l,f),m=d&&d!=="/"&&d.endsWith("/"),g=(c||d===".")&&s.endsWith("/");return!p.pathname.endsWith("/")&&(m||g)&&(p.pathname+="/"),p}var jw=e=>e.replace(/\/\/+/g,"/"),$a=e=>jw(e.join("/")),Td=e=>e.replace(/\/+$/,""),hR=e=>Td(e).replace(/^\/*/,"/"),xR=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,bR=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,vR=class{constructor(e,n,s,o=!1){this.status=e,this.statusText=n||"",this.internal=o,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}};function yR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function _R(e){let n=e.map(s=>s.route.path).filter(Boolean);return $a(n)||"/"}var ww=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Sw(e,n){let s=e;if(typeof s!="string"||!pR.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let o=s,l=!1;if(ww)try{let c=new URL(window.location.href),d=s.startsWith("//")?new URL(c.protocol+s):new URL(s),f=Is(d.pathname,n);d.origin===c.origin&&f!=null?s=f+d.search+d.hash:l=!0}catch{La(!1,`<Link to="${s}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:l,to:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Cw=["POST","PUT","PATCH","DELETE"];new Set(Cw);var jR=["GET",...Cw];new Set(jR);var Ml=h.createContext(null);Ml.displayName="DataRouter";var rf=h.createContext(null);rf.displayName="DataRouterState";var kw=h.createContext(!1);function wR(){return h.useContext(kw)}var Ew=h.createContext({isTransitioning:!1});Ew.displayName="ViewTransition";var SR=h.createContext(new Map);SR.displayName="Fetchers";var CR=h.createContext(null);CR.displayName="Await";var ya=h.createContext(null);ya.displayName="Navigation";var kc=h.createContext(null);kc.displayName="Location";var Fa=h.createContext({outlet:null,matches:[],isDataRoute:!1});Fa.displayName="Route";var nx=h.createContext(null);nx.displayName="RouteError";var Nw="REACT_ROUTER_ERROR",kR="REDIRECT",ER="ROUTE_ERROR_RESPONSE";function NR(e){if(e.startsWith(`${Nw}:${kR}:{`))try{let n=JSON.parse(e.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function RR(e){if(e.startsWith(`${Nw}:${ER}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new vR(n.status,n.statusText,n.data)}catch{}}function TR(e,{relative:n}={}){en(Ol(),"useHref() may be used only in the context of a <Router> component.");let{basename:s,navigator:o}=h.useContext(ya),{hash:l,pathname:c,search:d}=Ec(e,{relative:n}),f=c;return s!=="/"&&(f=c==="/"?s:$a([s,c])),o.createHref({pathname:f,search:d,hash:l})}function Ol(){return h.useContext(kc)!=null}function Yn(){return en(Ol(),"useLocation() may be used only in the context of a <Router> component."),h.useContext(kc).location}var Rw="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Tw(e){h.useContext(ya).static||h.useLayoutEffect(e)}function _a(){let{isDataRoute:e}=h.useContext(Fa);return e?qR():AR()}function AR(){en(Ol(),"useNavigate() may be used only in the context of a <Router> component.");let e=h.useContext(Ml),{basename:n,navigator:s}=h.useContext(ya),{matches:o}=h.useContext(Fa),{pathname:l}=Yn(),c=JSON.stringify(tx(o)),d=h.useRef(!1);return Tw(()=>{d.current=!0}),h.useCallback((p,m={})=>{if(La(d.current,Rw),!d.current)return;if(typeof p=="number"){s.go(p);return}let g=sf(p,JSON.parse(c),l,m.relative==="path");e==null&&n!=="/"&&(g.pathname=g.pathname==="/"?n:$a([n,g.pathname])),(m.replace?s.replace:s.push)(g,m.state,m)},[n,s,c,l,e])}h.createContext(null);function Aw(){let{matches:e}=h.useContext(Fa);return e[e.length-1]?.params??{}}function Ec(e,{relative:n}={}){let{matches:s}=h.useContext(Fa),{pathname:o}=Yn(),l=JSON.stringify(tx(s));return h.useMemo(()=>sf(e,JSON.parse(l),o,n==="path"),[e,l,o,n])}function MR(e,n){return Mw(e,n)}function Mw(e,n,s){en(Ol(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=h.useContext(ya),{matches:l}=h.useContext(Fa),c=l[l.length-1],d=c?c.params:{},f=c?c.pathname:"/",p=c?c.pathnameBase:"/",m=c&&c.route;{let w=m&&m.path||"";zw(f,!m||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${w}">) 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="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let g=Yn(),b;if(n){let w=typeof n=="string"?Al(n):n;en(p==="/"||w.pathname?.startsWith(p),`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 "${p}" but pathname "${w.pathname}" was given in the \`location\` prop.`),b=w}else b=g;let v=b.pathname||"/",S=v;if(p!=="/"){let w=p.replace(/^\//,"").split("/");S="/"+v.replace(/^\//,"").split("/").slice(w.length).join("/")}let C=s&&s.state.matches.length?s.state.matches.map(w=>Object.assign(w,{route:s.manifest[w.route.id]||w.route})):vw(e,{pathname:S});La(m||C!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),La(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 "${b.pathname}${b.search}${b.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 _=PR(C&&C.map(w=>Object.assign({},w,{params:Object.assign({},d,w.params),pathname:$a([p,o.encodeLocation?o.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?p:$a([p,o.encodeLocation?o.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),l,s);return n&&_?h.createElement(kc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...b},navigationType:"POP"}},_):_}function OR(){let e=VR(),n=yR(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),s=e instanceof Error?e.stack:null,o="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:o},c={padding:"2px 4px",backgroundColor:o},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=h.createElement(h.Fragment,null,h.createElement("p",null,"💿 Hey developer 👋"),h.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",h.createElement("code",{style:c},"ErrorBoundary")," or"," ",h.createElement("code",{style:c},"errorElement")," prop on your route.")),h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},n),s?h.createElement("pre",{style:l},s):null,d)}var zR=h.createElement(OR,null),Ow=class extends h.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const s=RR(e.digest);s&&(e=s)}let n=e!==void 0?h.createElement(Fa.Provider,{value:this.props.routeContext},h.createElement(nx.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?h.createElement(DR,{error:e},n):n}};Ow.contextType=kw;var Jm=new WeakMap;function DR({children:e,error:n}){let{basename:s}=h.useContext(ya);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let o=NR(n.digest);if(o){let l=Jm.get(n);if(l)throw l;let c=Sw(o.location,s);if(ww&&!Jm.get(n))if(c.isExternal||o.reloadDocument)window.location.href=c.absoluteURL||c.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:o.replace}));throw Jm.set(n,d),d}return h.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c.absoluteURL||c.to}`})}}return e}function LR({routeContext:e,match:n,children:s}){let o=h.useContext(Ml);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),h.createElement(Fa.Provider,{value:e},s)}function PR(e,n=[],s){let o=s?.state;if(e==null){if(!o)return null;if(o.errors)e=o.matches;else if(n.length===0&&!o.initialized&&o.matches.length>0)e=o.matches;else return null}let l=e,c=o?.errors;if(c!=null){let g=l.findIndex(b=>b.route.id&&c?.[b.route.id]!==void 0);en(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),l=l.slice(0,Math.min(l.length,g+1))}let d=!1,f=-1;if(s&&o){d=o.renderFallback;for(let g=0;g<l.length;g++){let b=l[g];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(f=g),b.route.id){let{loaderData:v,errors:S}=o,C=b.route.loader&&!v.hasOwnProperty(b.route.id)&&(!S||S[b.route.id]===void 0);if(b.route.lazy||C){s.isStatic&&(d=!0),f>=0?l=l.slice(0,f+1):l=[l[0]];break}}}}let p=s?.onError,m=o&&p?(g,b)=>{p(g,{location:o.location,params:o.matches?.[0]?.params??{},pattern:_R(o.matches),errorInfo:b})}:void 0;return l.reduceRight((g,b,v)=>{let S,C=!1,_=null,w=null;o&&(S=c&&b.route.id?c[b.route.id]:void 0,_=b.route.errorElement||zR,d&&(f<0&&v===0?(zw("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,w=null):f===v&&(C=!0,w=b.route.hydrateFallbackElement||null)));let k=n.concat(l.slice(0,v+1)),E=()=>{let N;return S?N=_:C?N=w:b.route.Component?N=h.createElement(b.route.Component,null):b.route.element?N=b.route.element:N=g,h.createElement(LR,{match:b,routeContext:{outlet:g,matches:k,isDataRoute:o!=null},children:N})};return o&&(b.route.ErrorBoundary||b.route.errorElement||v===0)?h.createElement(Ow,{location:o.location,revalidation:o.revalidation,component:_,error:S,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:m}):E()},null)}function ax(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function IR(e){let n=h.useContext(Ml);return en(n,ax(e)),n}function BR(e){let n=h.useContext(rf);return en(n,ax(e)),n}function UR(e){let n=h.useContext(Fa);return en(n,ax(e)),n}function sx(e){let n=UR(e),s=n.matches[n.matches.length-1];return en(s.route.id,`${e} can only be used on routes that contain a unique "id"`),s.route.id}function HR(){return sx("useRouteId")}function VR(){let e=h.useContext(nx),n=BR("useRouteError"),s=sx("useRouteError");return e!==void 0?e:n.errors?.[s]}function qR(){let{router:e}=IR("useNavigate"),n=sx("useNavigate"),s=h.useRef(!1);return Tw(()=>{s.current=!0}),h.useCallback(async(l,c={})=>{La(s.current,Rw),s.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:n,...c}))},[e,n])}var G1={};function zw(e,n,s){!n&&!G1[e]&&(G1[e]=!0,La(!1,s))}h.memo($R);function $R({routes:e,manifest:n,future:s,state:o,isStatic:l,onError:c}){return Mw(e,void 0,{manifest:n,state:o,isStatic:l,onError:c})}function GR({to:e,replace:n,state:s,relative:o}){en(Ol(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=h.useContext(ya);La(!l,"<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:c}=h.useContext(Fa),{pathname:d}=Yn(),f=_a(),p=sf(e,tx(c),d,o==="path"),m=JSON.stringify(p);return h.useEffect(()=>{f(JSON.parse(m),{replace:n,state:s,relative:o})},[f,m,o,n,s]),null}function $t(e){en(!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 FR({basename:e="/",children:n=null,location:s,navigationType:o="POP",navigator:l,static:c=!1,useTransitions:d}){en(!Ol(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),p=h.useMemo(()=>({basename:f,navigator:l,static:c,useTransitions:d,future:{}}),[f,l,c,d]);typeof s=="string"&&(s=Al(s));let{pathname:m="/",search:g="",hash:b="",state:v=null,key:S="default",mask:C}=s,_=h.useMemo(()=>{let w=Is(m,f);return w==null?null:{location:{pathname:w,search:g,hash:b,state:v,key:S,mask:C},navigationType:o}},[f,m,g,b,v,S,o,C]);return La(_!=null,`<Router basename="${f}"> is not able to match the URL "${m}${g}${b}" because it does not start with the basename, so the <Router> won't render anything.`),_==null?null:h.createElement(ya.Provider,{value:p},h.createElement(kc.Provider,{children:n,value:_}))}function Dw({children:e,location:n}){return MR(fh(e),n)}function fh(e,n=[]){let s=[];return h.Children.forEach(e,(o,l)=>{if(!h.isValidElement(o))return;let c=[...n,l];if(o.type===h.Fragment){s.push.apply(s,fh(o.props.children,c));return}en(o.type===$t,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),en(!o.props.index||!o.props.children,"An index route cannot have child routes.");let d={id:o.props.id||c.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(d.children=fh(o.props.children,c)),s.push(d)}),s}var vd="get",yd="application/x-www-form-urlencoded";function of(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function YR(e){return of(e)&&e.tagName.toLowerCase()==="button"}function XR(e){return of(e)&&e.tagName.toLowerCase()==="form"}function KR(e){return of(e)&&e.tagName.toLowerCase()==="input"}function QR(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ZR(e,n){return e.button===0&&(!n||n==="_self")&&!QR(e)}function ph(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,s)=>{let o=e[s];return n.concat(Array.isArray(o)?o.map(l=>[s,l]):[[s,o]])},[]))}function WR(e,n){let s=ph(e);return n&&n.forEach((o,l)=>{s.has(l)||n.getAll(l).forEach(c=>{s.append(l,c)})}),s}var Ku=null;function JR(){if(Ku===null)try{new FormData(document.createElement("form"),0),Ku=!1}catch{Ku=!0}return Ku}var eT=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function eg(e){return e!=null&&!eT.has(e)?(La(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${yd}"`),null):e}function tT(e,n){let s,o,l,c,d;if(XR(e)){let f=e.getAttribute("action");o=f?Is(f,n):null,s=e.getAttribute("method")||vd,l=eg(e.getAttribute("enctype"))||yd,c=new FormData(e)}else if(YR(e)||KR(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=e.getAttribute("formaction")||f.getAttribute("action");if(o=p?Is(p,n):null,s=e.getAttribute("formmethod")||f.getAttribute("method")||vd,l=eg(e.getAttribute("formenctype"))||eg(f.getAttribute("enctype"))||yd,c=new FormData(f,e),!JR()){let{name:m,type:g,value:b}=e;if(g==="image"){let v=m?`${m}.`:"";c.append(`${v}x`,"0"),c.append(`${v}y`,"0")}else m&&c.append(m,b)}}else{if(of(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=vd,o=null,l=yd,d=e}return c&&l==="text/plain"&&(d=c,c=void 0),{action:o,method:s.toLowerCase(),encType:l,formData:c,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function rx(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Lw(e,n,s,o){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return s?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${o}`:l.pathname=`${l.pathname}.${o}`:l.pathname==="/"?l.pathname=`_root.${o}`:n&&Is(l.pathname,n)==="/"?l.pathname=`${Td(n)}/_root.${o}`:l.pathname=`${Td(l.pathname)}.${o}`,l}async function nT(e,n){if(e.id in n)return n[e.id];try{let s=await import(e.module);return n[e.id]=s,s}catch(s){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(s),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function aT(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function sT(e,n,s){let o=await Promise.all(e.map(async l=>{let c=n.routes[l.route.id];if(c){let d=await nT(c,s);return d.links?d.links():[]}return[]}));return iT(o.flat(1).filter(aT).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function F1(e,n,s,o,l,c){let d=(p,m)=>s[m]?p.route.id!==s[m].route.id:!0,f=(p,m)=>s[m].pathname!==p.pathname||s[m].route.path?.endsWith("*")&&s[m].params["*"]!==p.params["*"];return c==="assets"?n.filter((p,m)=>d(p,m)||f(p,m)):c==="data"?n.filter((p,m)=>{let g=o.routes[p.route.id];if(!g||!g.hasLoader)return!1;if(d(p,m)||f(p,m))return!0;if(p.route.shouldRevalidate){let b=p.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:s[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function rT(e,n,{includeHydrateFallback:s}={}){return oT(e.map(o=>{let l=n.routes[o.route.id];if(!l)return[];let c=[l.module];return l.clientActionModule&&(c=c.concat(l.clientActionModule)),l.clientLoaderModule&&(c=c.concat(l.clientLoaderModule)),s&&l.hydrateFallbackModule&&(c=c.concat(l.hydrateFallbackModule)),l.imports&&(c=c.concat(l.imports)),c}).flat(1))}function oT(e){return[...new Set(e)]}function lT(e){let n={},s=Object.keys(e).sort();for(let o of s)n[o]=e[o];return n}function iT(e,n){let s=new Set;return new Set(n),e.reduce((o,l)=>{let c=JSON.stringify(lT(l));return s.has(c)||(s.add(c),o.push({key:c,link:l})),o},[])}function ox(){let e=h.useContext(Ml);return rx(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function cT(){let e=h.useContext(rf);return rx(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var lx=h.createContext(void 0);lx.displayName="FrameworkContext";function ix(){let e=h.useContext(lx);return rx(e,"You must render this element inside a <HydratedRouter> element"),e}function uT(e,n){let s=h.useContext(lx),[o,l]=h.useState(!1),[c,d]=h.useState(!1),{onFocus:f,onBlur:p,onMouseEnter:m,onMouseLeave:g,onTouchStart:b}=n,v=h.useRef(null);h.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let _=k=>{k.forEach(E=>{d(E.isIntersecting)})},w=new IntersectionObserver(_,{threshold:.5});return v.current&&w.observe(v.current),()=>{w.disconnect()}}},[e]),h.useEffect(()=>{if(o){let _=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(_)}}},[o]);let S=()=>{l(!0)},C=()=>{l(!1),d(!1)};return s?e!=="intent"?[c,v,{}]:[c,v,{onFocus:Oi(f,S),onBlur:Oi(p,C),onMouseEnter:Oi(m,S),onMouseLeave:Oi(g,C),onTouchStart:Oi(b,S)}]:[!1,v,{}]}function Oi(e,n){return s=>{e&&e(s),s.defaultPrevented||n(s)}}function dT({page:e,...n}){let s=wR(),{router:o}=ox(),l=h.useMemo(()=>vw(o.routes,e,o.basename),[o.routes,e,o.basename]);return l?s?h.createElement(pT,{page:e,matches:l,...n}):h.createElement(mT,{page:e,matches:l,...n}):null}function fT(e){let{manifest:n,routeModules:s}=ix(),[o,l]=h.useState([]);return h.useEffect(()=>{let c=!1;return sT(e,n,s).then(d=>{c||l(d)}),()=>{c=!0}},[e,n,s]),o}function pT({page:e,matches:n,...s}){let o=Yn(),{future:l}=ix(),{basename:c}=ox(),d=h.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let f=Lw(e,c,l.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,m=[];for(let g of n)typeof g.route.shouldRevalidate=="function"?p=!0:m.push(g.route.id);return p&&m.length>0&&f.searchParams.set("_routes",m.join(",")),[f.pathname+f.search]},[c,l.v8_trailingSlashAwareDataRequests,e,o,n]);return h.createElement(h.Fragment,null,d.map(f=>h.createElement("link",{key:f,rel:"prefetch",as:"fetch",href:f,...s})))}function mT({page:e,matches:n,...s}){let o=Yn(),{future:l,manifest:c,routeModules:d}=ix(),{basename:f}=ox(),{loaderData:p,matches:m}=cT(),g=h.useMemo(()=>F1(e,n,m,c,o,"data"),[e,n,m,c,o]),b=h.useMemo(()=>F1(e,n,m,c,o,"assets"),[e,n,m,c,o]),v=h.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let _=new Set,w=!1;if(n.forEach(E=>{let N=c.routes[E.route.id];!N||!N.hasLoader||(!g.some(R=>R.route.id===E.route.id)&&E.route.id in p&&d[E.route.id]?.shouldRevalidate||N.hasClientLoader?w=!0:_.add(E.route.id))}),_.size===0)return[];let k=Lw(e,f,l.v8_trailingSlashAwareDataRequests,"data");return w&&_.size>0&&k.searchParams.set("_routes",n.filter(E=>_.has(E.route.id)).map(E=>E.route.id).join(",")),[k.pathname+k.search]},[f,l.v8_trailingSlashAwareDataRequests,p,o,c,g,n,e,d]),S=h.useMemo(()=>rT(b,c),[b,c]),C=fT(b);return h.createElement(h.Fragment,null,v.map(_=>h.createElement("link",{key:_,rel:"prefetch",as:"fetch",href:_,...s})),S.map(_=>h.createElement("link",{key:_,rel:"modulepreload",href:_,...s})),C.map(({key:_,link:w})=>h.createElement("link",{key:_,nonce:s.nonce,...w,crossOrigin:w.crossOrigin??s.crossOrigin})))}function gT(...e){return n=>{e.forEach(s=>{typeof s=="function"?s(n):s!=null&&(s.current=n)})}}var hT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{hT&&(window.__reactRouterVersion="7.17.0")}catch{}function xT({basename:e,children:n,useTransitions:s,window:o}){let l=h.useRef();l.current==null&&(l.current=KN({window:o,v5Compat:!0}));let c=l.current,[d,f]=h.useState({action:c.action,location:c.location}),p=h.useCallback(m=>{s===!1?f(m):h.startTransition(()=>f(m))},[s]);return h.useLayoutEffect(()=>c.listen(p),[c,p]),h.createElement(FR,{basename:e,children:n,location:d.location,navigationType:d.action,navigator:c,useTransitions:s})}var Pw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,cx=h.forwardRef(function({onClick:n,discover:s="render",prefetch:o="none",relative:l,reloadDocument:c,replace:d,mask:f,state:p,target:m,to:g,preventScrollReset:b,viewTransition:v,defaultShouldRevalidate:S,...C},_){let{basename:w,navigator:k,useTransitions:E}=h.useContext(ya),N=typeof g=="string"&&Pw.test(g),R=Sw(g,w);g=R.to;let T=TR(g,{relative:l}),O=Yn(),A=null;if(f){let Y=sf(f,[],O.mask?O.mask.pathname:"/",!0);w!=="/"&&(Y.pathname=Y.pathname==="/"?w:$a([w,Y.pathname])),A=k.createHref(Y)}let[z,B,L]=uT(o,C),D=yT(g,{replace:d,mask:f,state:p,target:m,preventScrollReset:b,relative:l,viewTransition:v,defaultShouldRevalidate:S,useTransitions:E});function P(Y){n&&n(Y),Y.defaultPrevented||D(Y)}let H=!(R.isExternal||c),q=h.createElement("a",{...C,...L,href:(H?A:void 0)||R.absoluteURL||T,onClick:H?P:n,ref:gT(_,B),target:m,"data-discover":!N&&s==="render"?"true":void 0});return z&&!N?h.createElement(h.Fragment,null,q,h.createElement(dT,{page:T})):q});cx.displayName="Link";var Iw=h.forwardRef(function({"aria-current":n="page",caseSensitive:s=!1,className:o="",end:l=!1,style:c,to:d,viewTransition:f,children:p,...m},g){let b=Ec(d,{relative:m.relative}),v=Yn(),S=h.useContext(rf),{navigator:C,basename:_}=h.useContext(ya),w=S!=null&&CT(b)&&f===!0,k=C.encodeLocation?C.encodeLocation(b).pathname:b.pathname,E=v.pathname,N=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;s||(E=E.toLowerCase(),N=N?N.toLowerCase():null,k=k.toLowerCase()),N&&_&&(N=Is(N,_)||N);const R=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let T=E===k||!l&&E.startsWith(k)&&E.charAt(R)==="/",O=N!=null&&(N===k||!l&&N.startsWith(k)&&N.charAt(k.length)==="/"),A={isActive:T,isPending:O,isTransitioning:w},z=T?n:void 0,B;typeof o=="function"?B=o(A):B=[o,T?"active":null,O?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let L=typeof c=="function"?c(A):c;return h.createElement(cx,{...m,"aria-current":z,className:B,ref:g,style:L,to:d,viewTransition:f},typeof p=="function"?p(A):p)});Iw.displayName="NavLink";var bT=h.forwardRef(({discover:e="render",fetcherKey:n,navigate:s,reloadDocument:o,replace:l,state:c,method:d=vd,action:f,onSubmit:p,relative:m,preventScrollReset:g,viewTransition:b,defaultShouldRevalidate:v,...S},C)=>{let{useTransitions:_}=h.useContext(ya),w=wT(),k=ST(f,{relative:m}),E=d.toLowerCase()==="get"?"get":"post",N=typeof f=="string"&&Pw.test(f),R=T=>{if(p&&p(T),T.defaultPrevented)return;T.preventDefault();let O=T.nativeEvent.submitter,A=O?.getAttribute("formmethod")||d,z=()=>w(O||T.currentTarget,{fetcherKey:n,method:A,navigate:s,replace:l,state:c,relative:m,preventScrollReset:g,viewTransition:b,defaultShouldRevalidate:v});_&&s!==!1?h.startTransition(()=>z()):z()};return h.createElement("form",{ref:C,method:E,action:k,onSubmit:o?p:R,...S,"data-discover":!N&&e==="render"?"true":void 0})});bT.displayName="Form";function vT(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Bw(e){let n=h.useContext(Ml);return en(n,vT(e)),n}function yT(e,{target:n,replace:s,mask:o,state:l,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:p,useTransitions:m}={}){let g=_a(),b=Yn(),v=Ec(e,{relative:d});return h.useCallback(S=>{if(ZR(S,n)){S.preventDefault();let C=s!==void 0?s:uc(b)===uc(v),_=()=>g(e,{replace:C,mask:o,state:l,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:p});m?h.startTransition(()=>_()):_()}},[b,g,v,s,o,l,n,e,c,d,f,p,m])}function Uw(e){La(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 n=h.useRef(ph(e)),s=h.useRef(!1),o=Yn(),l=h.useMemo(()=>WR(o.search,s.current?null:n.current),[o.search]),c=_a(),d=h.useCallback((f,p)=>{const m=ph(typeof f=="function"?f(new URLSearchParams(l)):f);s.current=!0,c("?"+m,p)},[c,l]);return[l,d]}var _T=0,jT=()=>`__${String(++_T)}__`;function wT(){let{router:e}=Bw("useSubmit"),{basename:n}=h.useContext(ya),s=HR(),o=e.fetch,l=e.navigate;return h.useCallback(async(c,d={})=>{let{action:f,method:p,encType:m,formData:g,body:b}=tT(c,n);if(d.navigate===!1){let v=d.fetcherKey||jT();await o(v,s,d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:g,body:b,formMethod:d.method||p,formEncType:d.encType||m,flushSync:d.flushSync})}else await l(d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:g,body:b,formMethod:d.method||p,formEncType:d.encType||m,replace:d.replace,state:d.state,fromRouteId:s,flushSync:d.flushSync,viewTransition:d.viewTransition})},[o,l,n,s])}function ST(e,{relative:n}={}){let{basename:s}=h.useContext(ya),o=h.useContext(Fa);en(o,"useFormAction must be used inside a RouteContext");let[l]=o.matches.slice(-1),c={...Ec(e||".",{relative:n})},d=Yn();if(e==null){c.search=d.search;let f=new URLSearchParams(c.search),p=f.getAll("index");if(p.some(g=>g==="")){f.delete("index"),p.filter(b=>b).forEach(b=>f.append("index",b));let g=f.toString();c.search=g?`?${g}`:""}}return(!e||e===".")&&l.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),s!=="/"&&(c.pathname=c.pathname==="/"?s:$a([s,c.pathname])),uc(c)}function CT(e,{relative:n}={}){let s=h.useContext(Ew);en(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=Bw("useViewTransitionState"),l=Ec(e,{relative:n});if(!s.isTransitioning)return!1;let c=Is(s.currentLocation.pathname,o)||s.currentLocation.pathname,d=Is(s.nextLocation.pathname,o)||s.nextLocation.pathname;return Rd(l.pathname,d)!=null||Rd(l.pathname,c)!=null}var Rr=bw();/**
61
+ * @license lucide-react v0.469.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 kT=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Hw=(...e)=>e.filter((n,s,o)=>!!n&&n.trim()!==""&&o.indexOf(n)===s).join(" ").trim();/**
66
+ * @license lucide-react v0.469.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 ET={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.469.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 NT=h.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:l="",children:c,iconNode:d,...f},p)=>h.createElement("svg",{ref:p,...ET,width:n,height:n,stroke:e,strokeWidth:o?Number(s)*24/Number(n):s,className:Hw("lucide",l),...f},[...d.map(([m,g])=>h.createElement(m,g)),...Array.isArray(c)?c:[c]]));/**
76
+ * @license lucide-react v0.469.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 _e=(e,n)=>{const s=h.forwardRef(({className:o,...l},c)=>h.createElement(NT,{ref:c,iconNode:n,className:Hw(`lucide-${kT(e)}`,o),...l}));return s.displayName=`${e}`,s};/**
81
+ * @license lucide-react v0.469.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 Vw=_e("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.469.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 qw=_e("ArrowDownLeft",[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]);/**
91
+ * @license lucide-react v0.469.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 RT=_e("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
96
+ * @license lucide-react v0.469.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 $w=_e("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
101
+ * @license lucide-react v0.469.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 Gw=_e("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
106
+ * @license lucide-react v0.469.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 TT=_e("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
111
+ * @license lucide-react v0.469.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 gn=_e("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"}]]);/**
116
+ * @license lucide-react v0.469.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 AT=_e("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
121
+ * @license lucide-react v0.469.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 MT=_e("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);/**
126
+ * @license lucide-react v0.469.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 Ad=_e("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"}]]);/**
131
+ * @license lucide-react v0.469.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 dc=_e("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
136
+ * @license lucide-react v0.469.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 Tr=_e("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
141
+ * @license lucide-react v0.469.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 Nc=_e("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
146
+ * @license lucide-react v0.469.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 Fw=_e("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
151
+ * @license lucide-react v0.469.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 OT=_e("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
156
+ * @license lucide-react v0.469.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 ux=_e("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
161
+ * @license lucide-react v0.469.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 zT=_e("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"}]]);/**
166
+ * @license lucide-react v0.469.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 DT=_e("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
171
+ * @license lucide-react v0.469.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 LT=_e("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"}]]);/**
176
+ * @license lucide-react v0.469.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 PT=_e("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
181
+ * @license lucide-react v0.469.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 IT=_e("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
186
+ * @license lucide-react v0.469.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 Md=_e("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
191
+ * @license lucide-react v0.469.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 BT=_e("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
196
+ * @license lucide-react v0.469.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 UT=_e("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/**
201
+ * @license lucide-react v0.469.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 dx=_e("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"}]]);/**
206
+ * @license lucide-react v0.469.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 Bs=_e("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
211
+ * @license lucide-react v0.469.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 Yw=_e("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"}]]);/**
216
+ * @license lucide-react v0.469.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 HT=_e("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/**
221
+ * @license lucide-react v0.469.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 VT=_e("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"}]]);/**
226
+ * @license lucide-react v0.469.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 lf=_e("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"}]]);/**
231
+ * @license lucide-react v0.469.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 qT=_e("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/**
236
+ * @license lucide-react v0.469.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 Od=_e("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/**
241
+ * @license lucide-react v0.469.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 $T=_e("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);/**
246
+ * @license lucide-react v0.469.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 GT=_e("FilePlus",[["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:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/**
251
+ * @license lucide-react v0.469.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 FT=_e("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
256
+ * @license lucide-react v0.469.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 YT=_e("FileX2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 12.5-5 5",key:"b853mi"}],["path",{d:"m3 12.5 5 5",key:"1qls4r"}]]);/**
261
+ * @license lucide-react v0.469.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 XT=_e("File",[["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"}]]);/**
266
+ * @license lucide-react v0.469.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 Xw=_e("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);/**
271
+ * @license lucide-react v0.469.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 KT=_e("FolderGit2",[["path",{d:"M9 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 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/**
276
+ * @license lucide-react v0.469.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 Kw=_e("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/**
281
+ * @license lucide-react v0.469.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 fx=_e("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 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.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
286
+ * @license lucide-react v0.469.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 Qw=_e("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/**
291
+ * @license lucide-react v0.469.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 QT=_e("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
296
+ * @license lucide-react v0.469.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 cf=_e("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
301
+ * @license lucide-react v0.469.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 ZT=_e("Gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]);/**
306
+ * @license lucide-react v0.469.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 px=_e("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"}]]);/**
311
+ * @license lucide-react v0.469.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 WT=_e("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);/**
316
+ * @license lucide-react v0.469.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 JT=_e("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/**
321
+ * @license lucide-react v0.469.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 yl=_e("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/**
326
+ * @license lucide-react v0.469.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 eA=_e("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"}]]);/**
331
+ * @license lucide-react v0.469.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 tA=_e("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
336
+ * @license lucide-react v0.469.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 nA=_e("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
341
+ * @license lucide-react v0.469.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 mh=_e("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"}]]);/**
346
+ * @license lucide-react v0.469.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 aA=_e("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"}]]);/**
351
+ * @license lucide-react v0.469.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 sA=_e("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
356
+ * @license lucide-react v0.469.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 rA=_e("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
361
+ * @license lucide-react v0.469.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 oA=_e("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
366
+ * @license lucide-react v0.469.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 uf=_e("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
371
+ * @license lucide-react v0.469.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 Zw=_e("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
376
+ * @license lucide-react v0.469.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 mx=_e("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"}]]);/**
381
+ * @license lucide-react v0.469.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 zd=_e("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/**
386
+ * @license lucide-react v0.469.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 Ww=_e("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
391
+ * @license lucide-react v0.469.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 Jw=_e("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"}]]);/**
396
+ * @license lucide-react v0.469.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 lA=_e("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
401
+ * @license lucide-react v0.469.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 iA=_e("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
406
+ * @license lucide-react v0.469.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 cA=_e("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
411
+ * @license lucide-react v0.469.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 eS=_e("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
416
+ * @license lucide-react v0.469.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 uA=_e("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
421
+ * @license lucide-react v0.469.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 zl=_e("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"}]]);/**
426
+ * @license lucide-react v0.469.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 gx=_e("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
431
+ * @license lucide-react v0.469.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 dA=_e("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
436
+ * @license lucide-react v0.469.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 nn=_e("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
441
+ * @license lucide-react v0.469.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 gh=_e("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"}]]);/**
446
+ * @license lucide-react v0.469.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 fA=_e("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/**
451
+ * @license lucide-react v0.469.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=_e("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"}]]);/**
456
+ * @license lucide-react v0.469.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 hx=_e("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"}]]);/**
461
+ * @license lucide-react v0.469.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 df=_e("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"}]]);/**
466
+ * @license lucide-react v0.469.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 Dd=_e("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/**
471
+ * @license lucide-react v0.469.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 _d=_e("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
476
+ * @license lucide-react v0.469.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 Ya=_e("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"}]]);/**
481
+ * @license lucide-react v0.469.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 tS=_e("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"}]]);/**
486
+ * @license lucide-react v0.469.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 pA=_e("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
491
+ * @license lucide-react v0.469.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 Ld=_e("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"}]]);/**
496
+ * @license lucide-react v0.469.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 mA=_e("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
501
+ * @license lucide-react v0.469.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 ls=_e("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
506
+ * @license lucide-react v0.469.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 gA=_e("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
511
+ * @license lucide-react v0.469.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 nS=_e("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
516
+ * @license lucide-react v0.469.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 hA=_e("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
521
+ * @license lucide-react v0.469.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 kr=_e("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
526
+ * @license lucide-react v0.469.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 xA=_e("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"}]]);/**
531
+ * @license lucide-react v0.469.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 la=_e("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"}]]);/**
536
+ * @license lucide-react v0.469.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 aS=_e("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"}]]);/**
541
+ * @license lucide-react v0.469.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 bA=_e("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
546
+ * @license lucide-react v0.469.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 xx=_e("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
551
+ * @license lucide-react v0.469.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 vA=_e("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
556
+ * @license lucide-react v0.469.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 yA=_e("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
561
+ * @license lucide-react v0.469.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 Dl=_e("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.469.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 vo=_e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
571
+ * @license lucide-react v0.469.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 fc=_e("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"}]]),ff={health:5e3,projects:15e3,telegramStatus:8e3,pairList:12e3},Rn={theme:"apx.theme",token:"apx.token",sidebarCollapsed:"apx.sidebar.collapsed",language:"apx.lang",robyChat:"apx.roby.chat"},bx=["total","automatico","permiso"],Y1=["sky","violet","emerald","amber","rose","indigo","teal","fuchsia"],_A={icon:{light:"/logo/logo_only_white.webp",dark:"/logo/logo_only_dark.webp"},full:{light:"/logo/logo_white.webp",dark:"/logo/logo_dark.webp"},vertical:{light:"/logo/logo_vertical_white.webp",dark:"/logo/logo_vertical_dark.webp"}};function jA(){if(typeof window>"u")return"dark";const e=localStorage.getItem(Rn.theme);return e==="light"||e==="dark"?e:document.documentElement.classList.contains("dark")?"dark":"light"}const sS=h.createContext(null);function wA({children:e}){const[n,s]=h.useState(jA);h.useEffect(()=>{document.documentElement.classList.toggle("dark",n==="dark");try{localStorage.setItem(Rn.theme,n)}catch{}},[n]);const o=h.useCallback(()=>{s(c=>c==="dark"?"light":"dark")},[]),l=h.useMemo(()=>({theme:n,toggle:o,set:s}),[n,o]);return r.jsx(sS.Provider,{value:l,children:e})}function vx(){const e=h.useContext(sS);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const SA=1367/458,CA=735/1016;function kA({size:e=32,title:n="APX",variant:s="icon"}){const{theme:o}=vx(),l=_A[s][o];if(s==="full"){const c=e,d=Math.round(e*SA);return r.jsx("img",{src:l,alt:n,width:d,height:c,className:"block object-contain",draggable:!1})}if(s==="vertical"){const c=e,d=Math.round(e/CA);return r.jsx("img",{src:l,alt:n,width:c,height:d,className:"block object-contain",draggable:!1})}return r.jsx("img",{src:l,alt:n,width:e,height:e,className:"block object-contain",draggable:!1})}function rS(e){var n,s,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(n=0;n<l;n++)e[n]&&(s=rS(e[n]))&&(o&&(o+=" "),o+=s)}else for(s in e)e[s]&&(o&&(o+=" "),o+=s);return o}function pc(){for(var e,n,s=0,o="",l=arguments.length;s<l;s++)(e=arguments[s])&&(n=rS(e))&&(o&&(o+=" "),o+=n);return o}const yx="-",EA=e=>{const n=RA(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:d=>{const f=d.split(yx);return f[0]===""&&f.length!==1&&f.shift(),oS(f,n)||NA(d)},getConflictingClassGroupIds:(d,f)=>{const p=s[d]||[];return f&&o[d]?[...p,...o[d]]:p}}},oS=(e,n)=>{if(e.length===0)return n.classGroupId;const s=e[0],o=n.nextPart.get(s),l=o?oS(e.slice(1),o):void 0;if(l)return l;if(n.validators.length===0)return;const c=e.join(yx);return n.validators.find(({validator:d})=>d(c))?.classGroupId},X1=/^\[(.+)\]$/,NA=e=>{if(X1.test(e)){const n=X1.exec(e)[1],s=n?.substring(0,n.indexOf(":"));if(s)return"arbitrary.."+s}},RA=e=>{const{theme:n,prefix:s}=e,o={nextPart:new Map,validators:[]};return AA(Object.entries(e.classGroups),s).forEach(([c,d])=>{hh(d,o,c,n)}),o},hh=(e,n,s,o)=>{e.forEach(l=>{if(typeof l=="string"){const c=l===""?n:K1(n,l);c.classGroupId=s;return}if(typeof l=="function"){if(TA(l)){hh(l(o),n,s,o);return}n.validators.push({validator:l,classGroupId:s});return}Object.entries(l).forEach(([c,d])=>{hh(d,K1(n,c),s,o)})})},K1=(e,n)=>{let s=e;return n.split(yx).forEach(o=>{s.nextPart.has(o)||s.nextPart.set(o,{nextPart:new Map,validators:[]}),s=s.nextPart.get(o)}),s},TA=e=>e.isThemeGetter,AA=(e,n)=>n?e.map(([s,o])=>{const l=o.map(c=>typeof c=="string"?n+c:typeof c=="object"?Object.fromEntries(Object.entries(c).map(([d,f])=>[n+d,f])):c);return[s,l]}):e,MA=e=>{if(e<1)return{get:()=>{},set:()=>{}};let n=0,s=new Map,o=new Map;const l=(c,d)=>{s.set(c,d),n++,n>e&&(n=0,o=s,s=new Map)};return{get(c){let d=s.get(c);if(d!==void 0)return d;if((d=o.get(c))!==void 0)return l(c,d),d},set(c,d){s.has(c)?s.set(c,d):l(c,d)}}},lS="!",OA=e=>{const{separator:n,experimentalParseClassName:s}=e,o=n.length===1,l=n[0],c=n.length,d=f=>{const p=[];let m=0,g=0,b;for(let w=0;w<f.length;w++){let k=f[w];if(m===0){if(k===l&&(o||f.slice(w,w+c)===n)){p.push(f.slice(g,w)),g=w+c;continue}if(k==="/"){b=w;continue}}k==="["?m++:k==="]"&&m--}const v=p.length===0?f:f.substring(g),S=v.startsWith(lS),C=S?v.substring(1):v,_=b&&b>g?b-g:void 0;return{modifiers:p,hasImportantModifier:S,baseClassName:C,maybePostfixModifierPosition:_}};return s?f=>s({className:f,parseClassName:d}):d},zA=e=>{if(e.length<=1)return e;const n=[];let s=[];return e.forEach(o=>{o[0]==="["?(n.push(...s.sort(),o),s=[]):s.push(o)}),n.push(...s.sort()),n},DA=e=>({cache:MA(e.cacheSize),parseClassName:OA(e),...EA(e)}),LA=/\s+/,PA=(e,n)=>{const{parseClassName:s,getClassGroupId:o,getConflictingClassGroupIds:l}=n,c=[],d=e.trim().split(LA);let f="";for(let p=d.length-1;p>=0;p-=1){const m=d[p],{modifiers:g,hasImportantModifier:b,baseClassName:v,maybePostfixModifierPosition:S}=s(m);let C=!!S,_=o(C?v.substring(0,S):v);if(!_){if(!C){f=m+(f.length>0?" "+f:f);continue}if(_=o(v),!_){f=m+(f.length>0?" "+f:f);continue}C=!1}const w=zA(g).join(":"),k=b?w+lS:w,E=k+_;if(c.includes(E))continue;c.push(E);const N=l(_,C);for(let R=0;R<N.length;++R){const T=N[R];c.push(k+T)}f=m+(f.length>0?" "+f:f)}return f};function IA(){let e=0,n,s,o="";for(;e<arguments.length;)(n=arguments[e++])&&(s=iS(n))&&(o&&(o+=" "),o+=s);return o}const iS=e=>{if(typeof e=="string")return e;let n,s="";for(let o=0;o<e.length;o++)e[o]&&(n=iS(e[o]))&&(s&&(s+=" "),s+=n);return s};function BA(e,...n){let s,o,l,c=d;function d(p){const m=n.reduce((g,b)=>b(g),e());return s=DA(m),o=s.cache.get,l=s.cache.set,c=f,f(p)}function f(p){const m=o(p);if(m)return m;const g=PA(p,s);return l(p,g),g}return function(){return c(IA.apply(null,arguments))}}const Kt=e=>{const n=s=>s[e]||[];return n.isThemeGetter=!0,n},cS=/^\[(?:([a-z-]+):)?(.+)\]$/i,UA=/^\d+\/\d+$/,HA=new Set(["px","full","screen"]),VA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qA=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,$A=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,GA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,FA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ts=e=>ml(e)||HA.has(e)||UA.test(e),mr=e=>Ll(e,"length",eM),ml=e=>!!e&&!Number.isNaN(Number(e)),tg=e=>Ll(e,"number",ml),zi=e=>!!e&&Number.isInteger(Number(e)),YA=e=>e.endsWith("%")&&ml(e.slice(0,-1)),ut=e=>cS.test(e),gr=e=>VA.test(e),XA=new Set(["length","size","percentage"]),KA=e=>Ll(e,XA,uS),QA=e=>Ll(e,"position",uS),ZA=new Set(["image","url"]),WA=e=>Ll(e,ZA,nM),JA=e=>Ll(e,"",tM),Di=()=>!0,Ll=(e,n,s)=>{const o=cS.exec(e);return o?o[1]?typeof n=="string"?o[1]===n:n.has(o[1]):s(o[2]):!1},eM=e=>qA.test(e)&&!$A.test(e),uS=()=>!1,tM=e=>GA.test(e),nM=e=>FA.test(e),aM=()=>{const e=Kt("colors"),n=Kt("spacing"),s=Kt("blur"),o=Kt("brightness"),l=Kt("borderColor"),c=Kt("borderRadius"),d=Kt("borderSpacing"),f=Kt("borderWidth"),p=Kt("contrast"),m=Kt("grayscale"),g=Kt("hueRotate"),b=Kt("invert"),v=Kt("gap"),S=Kt("gradientColorStops"),C=Kt("gradientColorStopPositions"),_=Kt("inset"),w=Kt("margin"),k=Kt("opacity"),E=Kt("padding"),N=Kt("saturate"),R=Kt("scale"),T=Kt("sepia"),O=Kt("skew"),A=Kt("space"),z=Kt("translate"),B=()=>["auto","contain","none"],L=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",ut,n],P=()=>[ut,n],H=()=>["",Ts,mr],q=()=>["auto",ml,ut],Y=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],V=()=>["solid","dashed","dotted","double","none"],$=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>["start","end","center","between","around","evenly","stretch"],G=()=>["","0",ut],X=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[ml,ut];return{cacheSize:500,separator:":",theme:{colors:[Di],spacing:[Ts,mr],blur:["none","",gr,ut],brightness:U(),borderColor:[e],borderRadius:["none","","full",gr,ut],borderSpacing:P(),borderWidth:H(),contrast:U(),grayscale:G(),hueRotate:U(),invert:G(),gap:P(),gradientColorStops:[e],gradientColorStopPositions:[YA,mr],inset:D(),margin:D(),opacity:U(),padding:P(),saturate:U(),scale:U(),sepia:G(),skew:U(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",ut]}],container:["container"],columns:[{columns:[gr]}],"break-after":[{"break-after":X()}],"break-before":[{"break-before":X()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Y(),ut]}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[_]}],"inset-x":[{"inset-x":[_]}],"inset-y":[{"inset-y":[_]}],start:[{start:[_]}],end:[{end:[_]}],top:[{top:[_]}],right:[{right:[_]}],bottom:[{bottom:[_]}],left:[{left:[_]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",zi,ut]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ut]}],grow:[{grow:G()}],shrink:[{shrink:G()}],order:[{order:["first","last","none",zi,ut]}],"grid-cols":[{"grid-cols":[Di]}],"col-start-end":[{col:["auto",{span:["full",zi,ut]},ut]}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":[Di]}],"row-start-end":[{row:["auto",{span:[zi,ut]},ut]}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ut]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ut]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...Z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ut,n]}],"min-w":[{"min-w":[ut,n,"min","max","fit"]}],"max-w":[{"max-w":[ut,n,"none","full","min","max","fit","prose",{screen:[gr]},gr]}],h:[{h:[ut,n,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ut,n,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ut,n,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ut,n,"auto","min","max","fit"]}],"font-size":[{text:["base",gr,mr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",tg]}],"font-family":[{font:[Di]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ut]}],"line-clamp":[{"line-clamp":["none",ml,tg]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ts,ut]}],"list-image":[{"list-image":["none",ut]}],"list-style-type":[{list:["none","disc","decimal",ut]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ts,mr]}],"underline-offset":[{"underline-offset":["auto",Ts,ut]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ut]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ut]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Y(),QA]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",KA]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},WA]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[C]}],"gradient-via-pos":[{via:[C]}],"gradient-to-pos":[{to:[C]}],"gradient-from":[{from:[S]}],"gradient-via":[{via:[S]}],"gradient-to":[{to:[S]}],rounded:[{rounded:[c]}],"rounded-s":[{"rounded-s":[c]}],"rounded-e":[{"rounded-e":[c]}],"rounded-t":[{"rounded-t":[c]}],"rounded-r":[{"rounded-r":[c]}],"rounded-b":[{"rounded-b":[c]}],"rounded-l":[{"rounded-l":[c]}],"rounded-ss":[{"rounded-ss":[c]}],"rounded-se":[{"rounded-se":[c]}],"rounded-ee":[{"rounded-ee":[c]}],"rounded-es":[{"rounded-es":[c]}],"rounded-tl":[{"rounded-tl":[c]}],"rounded-tr":[{"rounded-tr":[c]}],"rounded-br":[{"rounded-br":[c]}],"rounded-bl":[{"rounded-bl":[c]}],"border-w":[{border:[f]}],"border-w-x":[{"border-x":[f]}],"border-w-y":[{"border-y":[f]}],"border-w-s":[{"border-s":[f]}],"border-w-e":[{"border-e":[f]}],"border-w-t":[{"border-t":[f]}],"border-w-r":[{"border-r":[f]}],"border-w-b":[{"border-b":[f]}],"border-w-l":[{"border-l":[f]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[f]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[f]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:V()}],"border-color":[{border:[l]}],"border-color-x":[{"border-x":[l]}],"border-color-y":[{"border-y":[l]}],"border-color-s":[{"border-s":[l]}],"border-color-e":[{"border-e":[l]}],"border-color-t":[{"border-t":[l]}],"border-color-r":[{"border-r":[l]}],"border-color-b":[{"border-b":[l]}],"border-color-l":[{"border-l":[l]}],"divide-color":[{divide:[l]}],"outline-style":[{outline:["",...V()]}],"outline-offset":[{"outline-offset":[Ts,ut]}],"outline-w":[{outline:[Ts,mr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Ts,mr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",gr,JA]}],"shadow-color":[{shadow:[Di]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...$(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":$()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[o]}],contrast:[{contrast:[p]}],"drop-shadow":[{"drop-shadow":["","none",gr,ut]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[g]}],invert:[{invert:[b]}],saturate:[{saturate:[N]}],sepia:[{sepia:[T]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[s]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[p]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[g]}],"backdrop-invert":[{"backdrop-invert":[b]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[T]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[d]}],"border-spacing-x":[{"border-spacing-x":[d]}],"border-spacing-y":[{"border-spacing-y":[d]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ut]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",ut]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",ut]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[zi,ut]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[O]}],"skew-y":[{"skew-y":[O]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ut]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ut]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ut]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ts,mr,tg]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},dS=BA(aM);function Oe(...e){return dS(pc(e))}const Q1={};function va(e,n){const s=h.useRef(Q1);return s.current===Q1&&(s.current=e(n)),s}const xh=[];let bh;function sM(){return bh}function rM(e){xh.push(e)}function fS(e){const n=(s,o)=>{const l=va(lM).current;let c;try{bh=l;for(const d of xh)d.before(l);c=e(s,o);for(const d of xh)d.after(l);l.didInitialize=!0}finally{bh=void 0}return c};return n.displayName=e.displayName||e.name,n}function oM(e){return h.forwardRef(fS(e))}function lM(){return{didInitialize:!1}}function _x(e){const n=h.useRef(!0);n.current&&(n.current=!1,e())}const iM=()=>{},Me=typeof document<"u"?h.useLayoutEffect:iM;function cM(e,n){return function(o,...l){const c=new URL(e);return c.searchParams.set("code",o.toString()),l.forEach(d=>c.searchParams.append("args[]",d)),`${n} error #${o}; visit ${c} for the full message.`}}const Mn=cM("https://base-ui.com/production-error","Base UI"),pS=h.createContext(void 0);function Rc(e){const n=h.useContext(pS);if(n===void 0&&!e)throw new Error(Mn(72));return n}const uM=[];function jx(e){h.useEffect(e,uM)}const Li=0;class Ga{static create(){return new Ga}currentId=Li;start(n,s){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Li,s()},n)}isStarted(){return this.currentId!==Li}clear=()=>{this.currentId!==Li&&(clearTimeout(this.currentId),this.currentId=Li)};disposeEffect=()=>this.clear}function sa(){const e=va(Ga.create).current;return jx(e.disposeEffect),e}const Pl=typeof navigator<"u",ng=fM(),mS=mM(),gS=pM(),wx=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),hS=ng.platform==="MacIntel"&&ng.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(ng.platform),xS=Pl&&/apple/i.test(navigator.vendor),vh=Pl&&/android/i.test(mS)||/android/i.test(gS),dM=Pl&&mS.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,bS=gS.includes("jsdom/");function fM(){if(!Pl)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function pM(){if(!Pl)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:n,version:s})=>`${n}/${s}`).join(" "):navigator.userAgent}function mM(){if(!Pl)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}function xa(e){e.preventDefault(),e.stopPropagation()}function gM(e){return"nativeEvent"in e}function Sx(e){return e.pointerType===""&&e.isTrusted?!0:vh&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function vS(e){return bS?!1:!vh&&e.width===0&&e.height===0||vh&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function uo(e,n){const s=["mouse","pen"];return n||s.push("",void 0),s.includes(e)}function hM(e){const n=e.type;return n==="click"||n==="mousedown"||n==="keydown"||n==="keyup"}function pf(){return typeof window<"u"}function Hn(e){return Cx(e)?(e.nodeName||"").toLowerCase():"#document"}function Qt(e){var n;return(e==null||(n=e.ownerDocument)==null?void 0:n.defaultView)||window}function is(e){var n;return(n=(Cx(e)?e.ownerDocument:e.document)||window.document)==null?void 0:n.documentElement}function Cx(e){return pf()?e instanceof Node||e instanceof Qt(e).Node:!1}function dt(e){return pf()?e instanceof Element||e instanceof Qt(e).Element:!1}function Gt(e){return pf()?e instanceof HTMLElement||e instanceof Qt(e).HTMLElement:!1}function _l(e){return!pf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qt(e).ShadowRoot}function Ar(e){const{overflow:n,overflowX:s,overflowY:o,display:l}=oa(e);return/auto|scroll|overlay|hidden|clip/.test(n+o+s)&&l!=="inline"&&l!=="contents"}function xM(e){return/^(table|td|th)$/.test(Hn(e))}function mf(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const bM=/transform|translate|scale|rotate|perspective|filter/,vM=/paint|layout|strict|content/,eo=e=>!!e&&e!=="none";let ag;function kx(e){const n=dt(e)?oa(e):e;return eo(n.transform)||eo(n.translate)||eo(n.scale)||eo(n.rotate)||eo(n.perspective)||!gf()&&(eo(n.backdropFilter)||eo(n.filter))||bM.test(n.willChange||"")||vM.test(n.contain||"")}function yM(e){let n=Us(e);for(;Gt(n)&&!Ls(n);){if(kx(n))return n;if(mf(n))return null;n=Us(n)}return null}function gf(){return ag==null&&(ag=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ag}function Ls(e){return/^(html|body|#document)$/.test(Hn(e))}function oa(e){return Qt(e).getComputedStyle(e)}function hf(e){return dt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Us(e){if(Hn(e)==="html")return e;const n=e.assignedSlot||e.parentNode||_l(e)&&e.host||is(e);return _l(n)?n.host:n}function yS(e){const n=Us(e);return Ls(n)?e.ownerDocument?e.ownerDocument.body:e.body:Gt(n)&&Ar(n)?n:yS(n)}function mc(e,n,s){var o;n===void 0&&(n=[]),s===void 0&&(s=!0);const l=yS(e),c=l===((o=e.ownerDocument)==null?void 0:o.body),d=Qt(l);if(c){const f=yh(d);return n.concat(d,d.visualViewport||[],Ar(l)?l:[],f&&s?mc(f):[])}else return n.concat(l,mc(l,[],s))}function yh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const _h="data-base-ui-focusable",_S="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",jr="ArrowLeft",wr="ArrowRight",Ex="ArrowUp",Tc="ArrowDown";function Pn(e){let n=e.activeElement;for(;n?.shadowRoot?.activeElement!=null;)n=n.shadowRoot.activeElement;return n}function Ze(e,n){if(!e||!n)return!1;const s=n.getRootNode?.();if(e.contains(n))return!0;if(s&&_l(s)){let o=n;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function Tn(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Pd(e,n){if(!dt(e))return!1;const s=e;if(n.hasElement(s))return!s.hasAttribute("data-trigger-disabled");for(const[,o]of n.entries())if(Ze(o,s))return!o.hasAttribute("data-trigger-disabled");return!1}function sg(e,n){if(n==null)return!1;if("composedPath"in e)return e.composedPath().includes(n);const s=e;return s.target!=null&&n.contains(s.target)}function _M(e){return e.matches("html,body")}function xf(e){return Gt(e)&&e.matches(_S)}function jM(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${_S}`)!=null}function jh(e){return e?e.getAttribute("role")==="combobox"&&xf(e):!1}function wM(e){if(!e||bS)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Id(e){return e?e.hasAttribute(_h)?e:e.querySelector(`[${_h}]`)||e:null}function SM(e,n){return n!=null&&!uo(n)?0:typeof e=="function"?e():e}function Bd(e,n,s){const o=SM(e,s);return typeof o=="number"?o:o?.[n]}function Z1(e){return typeof e=="function"?e():e}function jS(e,n){return n||e==="click"||e==="mousedown"}function CM(e){return e?.includes("mouse")&&e!=="mousedown"}function Bn(){}const gc=Object.freeze([]),un=Object.freeze({}),Hs="none",hc="trigger-press",$n="trigger-hover",jd="trigger-focus",Nx="outside-press",rg="item-press",kM="close-press",bf="focus-out",Rx="escape-key",W1="list-navigation",EM="cancel-open",wS="disabled",J1="missing",e_="initial",SS="imperative-action",NM="window-resize";function lt(e,n,s,o){let l=!1,c=!1;const d=o??un;return{reason:e,event:n??new Event("base-ui"),cancel(){l=!0},allowPropagation(){c=!0},get isCanceled(){return l},get isPropagationAllowed(){return c},trigger:s,...d}}const CS=h.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Ga,currentIdRef:{current:null},currentContextRef:{current:null}});function RM(e){const{children:n,delay:s,timeoutMs:o=0}=e,l=h.useRef(s),c=h.useRef(s),d=h.useRef(null),f=h.useRef(null),p=sa();return r.jsx(CS.Provider,{value:h.useMemo(()=>({hasProvider:!0,delayRef:l,initialDelayRef:c,currentIdRef:d,timeoutMs:o,currentContextRef:f,timeout:p}),[o,p]),children:n})}function TM(e,n={open:!1}){const{open:s}=n,o="rootStore"in e?e.rootStore:e,l=o.useState("floatingId"),c=h.useContext(CS),{currentIdRef:d,delayRef:f,timeoutMs:p,initialDelayRef:m,currentContextRef:g,hasProvider:b,timeout:v}=c,[S,C]=h.useState(!1);return Me(()=>{function _(){C(!1),g.current?.setIsInstantPhase(!1),d.current=null,g.current=null,f.current=m.current}if(d.current&&!s&&d.current===l){if(C(!1),p){const w=l;return v.start(p,()=>{o.select("open")||d.current&&d.current!==w||_()}),()=>{v.clear()}}_()}},[s,l,d,f,p,m,g,v,o]),Me(()=>{if(!s)return;const _=g.current,w=d.current;v.clear(),g.current={onOpenChange:o.setOpen,setIsInstantPhase:C},d.current=l,f.current={open:0,close:Bd(m.current,"close")},w!==null&&w!==l?(C(!0),_?.setIsInstantPhase(!0),_?.onOpenChange(!1,lt(Hs))):(C(!1),_?.setIsInstantPhase(!1))},[s,l,o,d,f,m,g,v]),Me(()=>()=>{g.current=null},[g]),h.useMemo(()=>({hasProvider:b,delayRef:f,isInstantPhase:S}),[b,f,S])}function ft(e,n,s,o){return e.addEventListener(n,s,o),()=>{e.removeEventListener(n,s,o)}}function ss(...e){return()=>{for(let n=0;n<e.length;n+=1){const s=e[n];s&&s()}}}function Vs(e,n,s,o){const l=va(kS).current;return MM(l,e,n,s,o)&&ES(l,[e,n,s,o]),l.callback}function AM(e){const n=va(kS).current;return OM(n,e)&&ES(n,e),n.callback}function kS(){return{callback:null,cleanup:null,refs:[]}}function MM(e,n,s,o,l){return e.refs[0]!==n||e.refs[1]!==s||e.refs[2]!==o||e.refs[3]!==l}function OM(e,n){return e.refs.length!==n.length||e.refs.some((s,o)=>s!==n[o])}function ES(e,n){if(e.refs=n,n.every(s=>s==null)){e.callback=null;return}e.callback=s=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),s!=null){const o=Array(n.length).fill(null);for(let l=0;l<n.length;l+=1){const c=n[l];if(c!=null)switch(typeof c){case"function":{const d=c(s);typeof d=="function"&&(o[l]=d);break}case"object":{c.current=s;break}}}e.cleanup=()=>{for(let l=0;l<n.length;l+=1){const c=n[l];if(c!=null)switch(typeof c){case"function":{const d=o[l];typeof d=="function"?d():c(null);break}case"object":{c.current=null;break}}}}}}}function mn(e){const n=va(zM,e).current;return n.next=e,Me(n.effect),n}function zM(e){const n={current:e,next:e,effect:()=>{n.current=n.next}};return n}const Tx={...HN},og=Tx.useInsertionEffect,DM=og&&og!==Tx.useLayoutEffect?og:e=>e();function Le(e){const n=va(LM).current;return n.next=e,DM(n.effect),n.trampoline}function LM(){const e={next:void 0,callback:PM,trampoline:(...n)=>e.callback?.(...n),effect:()=>{e.callback=e.next}};return e}function PM(){}const Qu=null;class IM{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=n=>{this.isScheduled=!1;const s=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let l=0;l<s.length;l+=1)s[l]?.(n)};request(n){const s=this.nextId;return this.nextId+=1,this.callbacks.push(n),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),s}cancel(n){const s=n-this.startId;s<0||s>=this.callbacks.length||(this.callbacks[s]=null,this.callbacksCount-=1)}}const Zu=new IM;class es{static create(){return new es}static request(n){return Zu.request(n)}static cancel(n){return Zu.cancel(n)}currentId=Qu;request(n){this.cancel(),this.currentId=Zu.request(()=>{this.currentId=Qu,n()})}cancel=()=>{this.currentId!==Qu&&(Zu.cancel(this.currentId),this.currentId=Qu)};disposeEffect=()=>this.cancel}function jl(){const e=va(es.create).current;return jx(e.disposeEffect),e}function yt(e){return e?.ownerDocument||document}const NS={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Ax={...NS,position:"fixed",top:0,left:0},RS={...NS,position:"absolute"},Ud=h.forwardRef(function(n,s){const[o,l]=h.useState();Me(()=>{xS&&l("button")},[]);const c={tabIndex:0,role:o};return r.jsx("span",{...n,ref:s,style:Ax,"aria-hidden":o?void 0:!0,...c,"data-base-ui-focus-guard":""})}),BM=["top","right","bottom","left"],wl=Math.min,ba=Math.max,Hd=Math.round,ro=Math.floor,rs=e=>({x:e,y:e}),UM={left:"right",right:"left",bottom:"top",top:"bottom"};function wh(e,n,s){return ba(e,wl(n,s))}function qs(e,n){return typeof e=="function"?e(n):e}function ra(e){return e.split("-")[0]}function Mr(e){return e.split("-")[1]}function Mx(e){return e==="x"?"y":"x"}function Ox(e){return e==="y"?"height":"width"}function Oa(e){const n=e[0];return n==="t"||n==="b"?"y":"x"}function zx(e){return Mx(Oa(e))}function HM(e,n,s){s===void 0&&(s=!1);const o=Mr(e),l=zx(e),c=Ox(l);let d=l==="x"?o===(s?"end":"start")?"right":"left":o==="start"?"bottom":"top";return n.reference[c]>n.floating[c]&&(d=Vd(d)),[d,Vd(d)]}function VM(e){const n=Vd(e);return[Sh(e),n,Sh(n)]}function Sh(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const t_=["left","right"],n_=["right","left"],qM=["top","bottom"],$M=["bottom","top"];function GM(e,n,s){switch(e){case"top":case"bottom":return s?n?n_:t_:n?t_:n_;case"left":case"right":return n?qM:$M;default:return[]}}function FM(e,n,s,o){const l=Mr(e);let c=GM(ra(e),s==="start",o);return l&&(c=c.map(d=>d+"-"+l),n&&(c=c.concat(c.map(Sh)))),c}function Vd(e){const n=ra(e);return UM[n]+e.slice(n.length)}function YM(e){return{top:0,right:0,bottom:0,left:0,...e}}function TS(e){return typeof e!="number"?YM(e):{top:e,right:e,bottom:e,left:e}}function xc(e){const{x:n,y:s,width:o,height:l}=e;return{width:o,height:l,top:s,left:n,right:n+o,bottom:s+l,x:n,y:s}}function Wu(e,n,s){return Math.floor(e/n)!==s}function bc(e,n){return n<0||n>=e.length}function wd(e,n){return Ln(e.current,{disabledIndices:n})}function Ch(e,n){return Ln(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:n})}function Ln(e,{startingIndex:n=-1,decrement:s=!1,disabledIndices:o,amount:l=1}={}){let c=n;do c+=s?-l:l;while(c>=0&&c<=e.length-1&&Ps(e,c,o));return c}function AS(e,{event:n,orientation:s,loopFocus:o,onLoop:l,rtl:c,cols:d,disabledIndices:f,minIndex:p,maxIndex:m,prevIndex:g,stopEvent:b=!1}){let v=g,S;if(n.key===Ex?S="up":n.key===Tc&&(S="down"),S){const C=[],_=[];let w=!1,k=0;{let B=null,L=-1;e.forEach((D,P)=>{if(D==null)return;k+=1;const H=D.closest('[role="row"]');H&&(w=!0),(H!==B||L===-1)&&(B=H,L+=1,C[L]=[]),C[L].push(P),_[P]=L})}let E=!1,N=0;if(w)for(const B of C){const L=B.length;L>N&&(N=L),L!==d&&(E=!0)}const R=E&&k<e.length,T=N||d,O=B=>{if(!E||g===-1)return;const L=_[g];if(L==null)return;const D=C[L].indexOf(g),P=B==="up"?-1:1;for(let H=L+P,q=0;q<C.length;q+=1,H+=P){if(H<0||H>=C.length){if(!o||R)return;if(H=H<0?C.length-1:0,l){const V=Math.min(D,C[H].length-1),$=C[H][V]??C[H][0],Z=l(n,g,$);H=_[Z]??H}}const Y=C[H];for(let V=Math.min(D,Y.length-1);V>=0;V-=1){const $=Y[V];if(!Ps(e,$,f))return $}}},A=B=>{if(!R||g===-1)return;const L=g%T,D=B==="up"?-T:T,P=m-m%T,H=ro(m/T)+1;for(let q=g-L+D,Y=0;Y<H;Y+=1,q+=D){if(q<0||q>m){if(!o)return;q=q<0?P:0}const V=Math.min(q+T-1,m);for(let $=Math.min(q+L,V);$>=q;$-=1)if(!Ps(e,$,f))return $}};b&&xa(n);const z=O(S)??A(S);if(z!==void 0)v=z;else if(g===-1)v=S==="up"?m:p;else if(v=Ln(e,{startingIndex:g,amount:T,decrement:S==="up",disabledIndices:f}),o){if(S==="up"&&(g-T<p||v<0)){const B=g%T,L=m%T,D=m-(L-B);L===B?v=m:v=L>B?D:D-T,l&&(v=l(n,g,v))}S==="down"&&g+T>m&&(v=Ln(e,{startingIndex:g%T-T,amount:T,disabledIndices:f}),l&&(v=l(n,g,v)))}bc(e,v)&&(v=g)}if(s==="both"){const C=ro(g/d);n.key===(c?jr:wr)&&(b&&xa(n),g%d!==d-1?(v=Ln(e,{startingIndex:g,disabledIndices:f}),o&&Wu(v,d,C)&&(v=Ln(e,{startingIndex:g-g%d-1,disabledIndices:f}),l&&(v=l(n,g,v)))):o&&(v=Ln(e,{startingIndex:g-g%d-1,disabledIndices:f}),l&&(v=l(n,g,v))),Wu(v,d,C)&&(v=g)),n.key===(c?wr:jr)&&(b&&xa(n),g%d!==0?(v=Ln(e,{startingIndex:g,decrement:!0,disabledIndices:f}),o&&Wu(v,d,C)&&(v=Ln(e,{startingIndex:g+(d-g%d),decrement:!0,disabledIndices:f}),l&&(v=l(n,g,v)))):o&&(v=Ln(e,{startingIndex:g+(d-g%d),decrement:!0,disabledIndices:f}),l&&(v=l(n,g,v))),Wu(v,d,C)&&(v=g));const _=ro(m/d)===C;bc(e,v)&&(o&&_?(v=n.key===(c?wr:jr)?m:Ln(e,{startingIndex:g-g%d-1,disabledIndices:f}),l&&(v=l(n,g,v))):v=g)}return v}function MS(e,n,s){const o=[];let l=0;return e.forEach(({width:c,height:d},f)=>{let p=!1;for(s&&(l=0);!p;){const m=[];for(let g=0;g<c;g+=1)for(let b=0;b<d;b+=1)m.push(l+g+b*n);l%n+c<=n&&m.every(g=>o[g]==null)?(m.forEach(g=>{o[g]=f}),p=!0):l+=1}}),[...o]}function OS(e,n,s,o,l){if(e===-1)return-1;const c=s.indexOf(e),d=n[e];switch(l){case"tl":return c;case"tr":return d?c+d.width-1:c;case"bl":return d?c+(d.height-1)*o:c;case"br":return s.lastIndexOf(e);default:return-1}}function zS(e,n){return n.flatMap((s,o)=>e.includes(s)?[o]:[])}function Ps(e,n,s){if(typeof s=="function"?s(n):s?.includes(n)??!1)return!0;const l=e[n];return l?vf(l)?!s&&(l.hasAttribute("disabled")||l.getAttribute("aria-disabled")==="true"):!0:!1}function XM(e){return e.visibility==="hidden"||e.visibility==="collapse"}function vf(e,n=e?oa(e):null){return!e||!e.isConnected||!n||XM(n)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():n.display!=="none"&&n.display!=="contents"}const KM='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function QM(e){const n=e.assignedSlot;if(n)return n;if(e.parentElement)return e.parentElement;const s=e.getRootNode();return _l(s)?s.host:null}function kh(e){for(const n of Array.from(e.children))if(Hn(n)==="summary")return n;return null}function ZM(e,n){const s=kh(n);return!!s&&(e===s||Ze(s,e))}function DS(e){const n=e?Hn(e):"";return e!=null&&e.matches(KM)&&(n!=="summary"||e.parentElement!=null&&Hn(e.parentElement)==="details"&&kh(e.parentElement)===e)&&(n!=="details"||kh(e)==null)&&(n!=="input"||e.type!=="hidden")}function LS(e){if(!DS(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let n=e;n;n=QM(n)){const s=n!==e,o=Hn(n)==="slot";if(n.hasAttribute("inert")||s&&Hn(n)==="details"&&!n.open&&!ZM(e,n)||n.hasAttribute("hidden")||!o&&!WM(n,s))return!1}return!0}function WM(e,n){const s=oa(e);return n?s.display!=="none":vf(e,s)}function PS(e){const n=e.tabIndex;if(n<0){const s=Hn(e);if(s==="details"||s==="audio"||s==="video"||Gt(e)&&e.isContentEditable)return 0}return n}function lg(e){if(Hn(e)!=="input")return null;const n=e;return n.type==="radio"&&n.name!==""?n:null}function JM(e,n){const s=lg(e);if(!s)return!0;const o=n.find(l=>{const c=lg(l);return c?.name===s.name&&c.form===s.form&&c.checked});return o?o===s:n.find(l=>{const c=lg(l);return c?.name===s.name&&c.form===s.form})===s}function IS(e){if(Gt(e)&&Hn(e)==="slot"){const n=e.assignedElements({flatten:!0});if(n.length>0)return n}return Gt(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function BS(e,n){IS(e).forEach(s=>{DS(s)&&n.push(s),BS(s,n)})}function US(e,n,s){IS(e).forEach(o=>{Gt(o)&&o.matches(n)&&s.push(o),US(o,n,s)})}function Dx(e){return LS(e)&&PS(e)>=0}function HS(e){const n=[];return BS(e,n),n.filter(LS)}function yf(e){const n=HS(e);return n.filter(s=>PS(s)>=0&&JM(s,n))}function VS(e,n){const s=yf(e),o=s.length;if(o===0)return;const l=Pn(yt(e)),c=s.indexOf(l),d=c===-1?n===1?0:o-1:c+n;return s[d]}function qS(e){return VS(yt(e).body,1)||e}function $S(e){return VS(yt(e).body,-1)||e}function ac(e,n){const s=n||e.currentTarget,o=e.relatedTarget;return!o||!Ze(s,o)}function e3(e){yf(e).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function a_(e){const n=[];US(e,"[data-tabindex]",n),n.forEach(s=>{const o=s.dataset.tabindex;delete s.dataset.tabindex,o?s.setAttribute("tabindex",o):s.removeAttribute("tabindex")})}function Er(e,n,s=!0){return e.filter(l=>l.parentId===n).flatMap(l=>[...!s||l.context?.open?[l]:[],...Er(e,l.id,s)])}function s_(e,n){let s=[],o=e.find(l=>l.id===n)?.parentId;for(;o;){const l=e.find(c=>c.id===o);o=l?.parentId,l&&(s=s.concat(l))}return s}function vc(e){return`data-base-ui-${e}`}let Ju=0;function Sd(e,n={}){const{preventScroll:s=!1,sync:o=!1,shouldFocus:l}=n;cancelAnimationFrame(Ju);function c(){l&&!l()||e?.focus({preventScroll:s})}if(o)return c(),Bn;const d=requestAnimationFrame(c);return Ju=d,()=>{Ju===d&&(cancelAnimationFrame(d),Ju=0)}}const ig={inert:new WeakMap,"aria-hidden":new WeakMap},r_="data-base-ui-inert",Eh={inert:new WeakSet,"aria-hidden":new WeakSet};let Pi=new WeakMap,cg=0;function t3(e){return Eh[e]}function GS(e){return e?_l(e)?e.host:GS(e.parentNode):null}const ug=(e,n)=>n.map(s=>{if(e.contains(s))return s;const o=GS(s);return e.contains(o)?o:null}).filter(s=>s!=null),o_=e=>{const n=new Set;return e.forEach(s=>{let o=s;for(;o&&!n.has(o);)n.add(o),o=o.parentNode}),n},l_=(e,n,s)=>{const o=[],l=c=>{!c||s.has(c)||Array.from(c.children).forEach(d=>{Hn(d)!=="script"&&(n.has(d)?l(d):o.push(d))})};return l(e),o};function n3(e,n,s,o,{mark:l=!0,markerIgnoreElements:c=[]}){const d=o?"inert":s?"aria-hidden":null;let f=null,p=null;const m=ug(n,e),g=l?ug(n,c):[],b=new Set(g),v=l?l_(n,o_(m),new Set(m)).filter(_=>!b.has(_)):[],S=[],C=[];if(d){const _=ig[d],w=t3(d);p=w,f=_;const k=ug(n,Array.from(n.querySelectorAll("[aria-live]"))),E=m.concat(k);l_(n,o_(E),new Set(E)).forEach(R=>{const T=R.getAttribute(d),O=T!==null&&T!=="false",A=(_.get(R)||0)+1;_.set(R,A),S.push(R),A===1&&O&&w.add(R),O||R.setAttribute(d,d==="inert"?"":"true")})}return l&&v.forEach(_=>{const w=(Pi.get(_)||0)+1;Pi.set(_,w),C.push(_),w===1&&_.setAttribute(r_,"")}),cg+=1,()=>{f&&S.forEach(_=>{const k=(f.get(_)||0)-1;f.set(_,k),k||(!p?.has(_)&&d&&_.removeAttribute(d),p?.delete(_))}),l&&C.forEach(_=>{const w=(Pi.get(_)||0)-1;Pi.set(_,w),w||_.removeAttribute(r_)}),cg-=1,cg||(ig.inert=new WeakMap,ig["aria-hidden"]=new WeakMap,Eh.inert=new WeakSet,Eh["aria-hidden"]=new WeakSet,Pi=new WeakMap)}}function i_(e,n={}){const{ariaHidden:s=!1,inert:o=!1,mark:l=!0,markerIgnoreElements:c=[]}=n,d=yt(e[0]).body;return n3(e,d,s,o,{mark:l,markerIgnoreElements:c})}let c_=0;function a3(e,n="mui"){const[s,o]=h.useState(e),l=e||s;return h.useEffect(()=>{s==null&&(c_+=1,o(`${n}-${c_}`))},[s,n]),l}const u_=Tx.useId;function _f(e,n){if(u_!==void 0){const s=u_();return e??(n?`${n}-${s}`:s)}return a3(e,n)}const s3=parseInt(h.version,10);function Lx(e){return s3>=e}function d_(e){if(!h.isValidElement(e))return null;const n=e,s=n.props;return(Lx(19)?s?.ref:n.ref)??null}function Nh(e,n){if(e&&!n)return e;if(!e&&n)return n;if(e||n)return{...e,...n}}function r3(e,n){const s={};for(const o in e){const l=e[o];if(n?.hasOwnProperty(o)){const c=n[o](l);c!=null&&Object.assign(s,c);continue}l===!0?s[`data-${o.toLowerCase()}`]="":l&&(s[`data-${o.toLowerCase()}`]=l.toString())}return s}function o3(e,n){return typeof e=="function"?e(n):e}function l3(e,n){return typeof e=="function"?e(n):e}const Px={};function Da(e,n,s,o,l){if(!s&&!o&&!l&&!e)return qd(n);let c=qd(e);return n&&(c=Ki(c,n)),s&&(c=Ki(c,s)),o&&(c=Ki(c,o)),l&&(c=Ki(c,l)),c}function i3(e){if(e.length===0)return Px;if(e.length===1)return qd(e[0]);let n=qd(e[0]);for(let s=1;s<e.length;s+=1)n=Ki(n,e[s]);return n}function qd(e){return Ix(e)?{...YS(e,Px)}:c3(e)}function Ki(e,n){return Ix(n)?YS(n,e):u3(e,n)}function c3(e){const n={...e};for(const s in n){const o=n[s];FS(s,o)&&(n[s]=XS(o))}return n}function u3(e,n){if(!n)return e;for(const s in n){const o=n[s];switch(s){case"style":{e[s]=Nh(e.style,o);break}case"className":{e[s]=KS(e.className,o);break}default:FS(s,o)?e[s]=d3(e[s],o):e[s]=o}}return e}function FS(e,n){const s=e.charCodeAt(0),o=e.charCodeAt(1),l=e.charCodeAt(2);return s===111&&o===110&&l>=65&&l<=90&&(typeof n=="function"||typeof n>"u")}function Ix(e){return typeof e=="function"}function YS(e,n){return Ix(e)?e(n):e??Px}function d3(e,n){return n?e?(...s)=>{const o=s[0];if(QS(o)){const c=o;$d(c);const d=n(...s);return c.baseUIHandlerPrevented||e?.(...s),d}const l=n(...s);return e?.(...s),l}:XS(n):e}function XS(e){return e&&((...n)=>{const s=n[0];return QS(s)&&$d(s),e(...n)})}function $d(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function KS(e,n){return n?e?n+" "+e:n:e}function QS(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Ht(e,n,s={}){const o=n.render,l=f3(n,s);if(s.enabled===!1)return null;const c=s.state??un;return g3(e,o,l,c)}function f3(e,n={}){const{className:s,style:o,render:l}=e,{state:c=un,ref:d,props:f,stateAttributesMapping:p,enabled:m=!0}=n,g=m?o3(s,c):void 0,b=m?l3(o,c):void 0,v=m?r3(c,p):un,S=m&&f?p3(f):void 0,C=m?Nh(v,S)??{}:un;return typeof document<"u"&&(m?Array.isArray(d)?C.ref=AM([C.ref,d_(l),...d]):C.ref=Vs(C.ref,d_(l),d):Vs(null,null)),m?(g!==void 0&&(C.className=KS(C.className,g)),b!==void 0&&(C.style=Nh(C.style,b)),C):un}function p3(e){return Array.isArray(e)?i3(e):Da(void 0,e)}const m3=Symbol.for("react.lazy");function g3(e,n,s,o){if(n){if(typeof n=="function")return n(s,o);const l=Da(s,n.props);l.ref=s.ref;let c=n;return c?.$$typeof===m3&&(c=h.Children.toArray(n)[0]),h.cloneElement(c,l)}if(e&&typeof e=="string")return h3(e,s);throw new Error(Mn(8))}function h3(e,n){return e==="button"?h.createElement("button",{type:"button",...n,key:n.key}):e==="img"?h.createElement("img",{alt:"",...n,key:n.key}):h.createElement(e,n)}const x3={style:{transition:"none"}},b3="data-base-ui-click-trigger",v3={fallbackAxisSide:"none"},y3={fallbackAxisSide:"end"},_3={clipPath:"inset(50%)",position:"fixed",top:0,left:0},ZS=h.createContext(null),WS=()=>h.useContext(ZS),j3=vc("portal");function JS(e={}){const{ref:n,container:s,componentProps:o=un,elementProps:l}=e,c=_f(),f=WS()?.portalNode,[p,m]=h.useState(null),[g,b]=h.useState(null),v=Le(w=>{w!==null&&b(w)}),S=h.useRef(null);Me(()=>{if(s===null){S.current&&(S.current=null,b(null),m(null));return}if(c==null)return;const w=(s&&(Cx(s)?s:s.current))??f??document.body;if(w==null){S.current&&(S.current=null,b(null),m(null));return}S.current!==w&&(S.current=w,b(null),m(w))},[s,f,c]);const C=Ht("div",o,{ref:[n,v],props:[{id:c,[j3]:""},l]});return{portalNode:g,portalSubtree:p&&C?Rr.createPortal(C,p):null}}const e2=h.forwardRef(function(n,s){const{render:o,className:l,style:c,children:d,container:f,renderGuards:p,...m}=n,{portalNode:g,portalSubtree:b}=JS({container:f,ref:s,componentProps:n,elementProps:m}),v=h.useRef(null),S=h.useRef(null),C=h.useRef(null),_=h.useRef(null),[w,k]=h.useState(null),E=h.useRef(!1),N=w?.modal,R=w?.open,T=typeof p=="boolean"?p:!!w&&!w.modal&&w.open&&!!g;h.useEffect(()=>{if(!g||N)return;function A(z){g&&z.relatedTarget&&ac(z)&&(z.type==="focusin"?E.current&&(a_(g),E.current=!1):(e3(g),E.current=!0))}return ss(ft(g,"focusin",A,!0),ft(g,"focusout",A,!0))},[g,N]),h.useEffect(()=>{!g||R!==!1||(a_(g),E.current=!1)},[R,g]);const O=h.useMemo(()=>({beforeOutsideRef:v,afterOutsideRef:S,beforeInsideRef:C,afterInsideRef:_,portalNode:g,setFocusManagerState:k}),[g]);return r.jsxs(h.Fragment,{children:[b,r.jsxs(ZS.Provider,{value:O,children:[T&&g&&r.jsx(Ud,{"data-type":"outside",ref:v,onFocus:A=>{if(ac(A,g))C.current?.focus();else{const z=w?w.domReference:null;$S(z)?.focus()}}}),T&&g&&r.jsx("span",{"aria-owns":g.id,style:_3}),g&&Rr.createPortal(d,g),T&&g&&r.jsx(Ud,{"data-type":"outside",ref:S,onFocus:A=>{if(ac(A,g))_.current?.focus();else{const z=w?w.domReference:null;qS(z)?.focus(),w?.closeOnFocusOut&&w?.onOpenChange(!1,lt(bf,A.nativeEvent))}}})]})]})});function w3(){const e=new Map;return{emit(n,s){e.get(n)?.forEach(o=>o(s))},on(n,s){e.has(n)||e.set(n,new Set),e.get(n).add(s)},off(n,s){e.get(n)?.delete(s)}}}const S3=h.createContext(null),C3=h.createContext(null),jf=()=>h.useContext(S3)?.id||null,Il=e=>{const n=h.useContext(C3);return e??n};function Os(e){return e==null?e:"current"in e?e.current:e}function k3(e,n){const s=Qt(Tn(e));return e instanceof s.KeyboardEvent?"keyboard":e instanceof s.FocusEvent?n||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof s.MouseEvent?n||(e.detail===0?"keyboard":"mouse"):""}const f_=20;let yr=[];function Bx(){yr=yr.filter(e=>e.deref()?.isConnected)}function E3(e){Bx(),e&&Hn(e)!=="body"&&(yr.push(new WeakRef(e)),yr.length>f_&&(yr=yr.slice(-f_)))}function dg(){return Bx(),yr[yr.length-1]?.deref()}function N3(e){return e?Dx(e)?e:yf(e)[0]||e:null}function p_(e,n){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!n.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const o=HS(e).filter(c=>{const d=c.getAttribute("data-tabindex")||"";return Dx(c)||c.hasAttribute("data-tabindex")&&!d.startsWith("-")}),l=e.getAttribute("tabindex");n.current.includes("floating")||o.length===0?l!=="0"&&e.setAttribute("tabindex","0"):(l!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function t2(e){const{context:n,children:s,disabled:o=!1,initialFocus:l=!0,returnFocus:c=!0,restoreFocus:d=!1,modal:f=!0,closeOnFocusOut:p=!0,openInteractionType:m="",nextFocusableElement:g,previousFocusableElement:b,beforeContentFocusGuardRef:v,externalTree:S,getInsideElements:C}=e,_="rootStore"in n?n.rootStore:n,w=_.useState("open"),k=_.useState("domReferenceElement"),E=_.useState("floatingElement"),{events:N,dataRef:R}=_.context,T=Le(()=>R.current.floatingContext?.nodeId),O=l===!1,A=jh(k)&&O,z=h.useRef(["content"]),B=mn(l),L=mn(c),D=mn(m),P=Il(S),H=WS(),q=h.useRef(!1),Y=h.useRef(!1),V=h.useRef(!1),$=h.useRef(null),Z=h.useRef(""),G=h.useRef(""),X=h.useRef(null),U=h.useRef(null),K=Vs(X,v,H?.beforeInsideRef),F=Vs(U,H?.afterInsideRef),J=sa(),ie=sa(),re=jl(),oe=H!=null,ce=Id(E),ee=Le((ve=ce)=>ve?yf(ve):[]),Te=Le(()=>C?.().filter(ve=>ve!=null)??[]);h.useEffect(()=>{if(o||!f)return;function ve(Ne){Ne.key==="Tab"&&Ze(ce,Pn(yt(ce)))&&ee().length===0&&!A&&xa(Ne)}const Ce=yt(ce);return ft(Ce,"keydown",ve)},[o,ce,f,A,ee]),h.useEffect(()=>{if(o||!w)return;const ve=yt(ce);function Ce(){V.current=!1}function Ne(Ie){const be=Tn(Ie),Ae=Te(),we=Ze(E,be)||Ze(k,be)||Ze(H?.portalNode,be)||Ae.some(Be=>Be===be||Ze(Be,be));V.current=!we,G.current=Ie.pointerType||"keyboard",be?.closest(`[${b3}]`)&&(Y.current=!0)}function Pe(){G.current="keyboard"}return ss(ft(ve,"pointerdown",Ne,!0),ft(ve,"pointerup",Ce,!0),ft(ve,"pointercancel",Ce,!0),ft(ve,"keydown",Pe,!0))},[o,E,k,ce,w,H,Te]),h.useEffect(()=>{if(o||!p)return;const ve=yt(ce);function Ce(){Y.current=!0,ie.start(0,()=>{Y.current=!1})}function Ne(Ae){const we=Tn(Ae);Dx(we)&&($.current=we)}function Pe(Ae){const we=Ae.relatedTarget,Be=Ae.currentTarget,Xe=Tn(Ae);queueMicrotask(()=>{const Ye=T(),De=_.context.triggerElements,ye=Te(),le=we?.hasAttribute(vc("focus-guard"))&&[X.current,U.current,H?.beforeInsideRef.current,H?.afterInsideRef.current,H?.beforeOutsideRef.current,H?.afterOutsideRef.current,Os(b),Os(g)].includes(we),je=!(Ze(k,we)||Ze(E,we)||Ze(we,E)||Ze(H?.portalNode,we)||ye.some(Se=>Se===we||Ze(Se,we))||we!=null&&De.hasElement(we)||De.hasMatchingElement(Se=>Ze(Se,we))||le||P&&(Er(P.nodesRef.current,Ye).find(Se=>Ze(Se.context?.elements.floating,we)||Ze(Se.context?.elements.domReference,we))||s_(P.nodesRef.current,Ye).find(Se=>[Se.context?.elements.floating,Id(Se.context?.elements.floating)].includes(we)||Se.context?.elements.domReference===we)));if(Be===k&&ce&&p_(ce,z),d&&Be!==k&&!vf(Xe)&&Pn(ve)===ve.body){if(Gt(ce)&&(ce.focus(),d==="popup")){re.request(()=>{ce.focus()});return}const Se=ee(),Ue=$.current,Je=(Ue&&Se.includes(Ue)?Ue:null)||Se[Se.length-1]||ce;Gt(Je)&&Je.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(A||!f)&&we&&je&&!Y.current&&(A||we!==dg())&&(q.current=!0,_.setOpen(!1,lt(bf,Ae)))})}function Ie(){V.current||(R.current.insideReactTree=!0,J.start(0,()=>{R.current.insideReactTree=!1}))}const be=Gt(k)?k:null;if(!(!E&&!be))return ss(be&&ft(be,"focusout",Pe),be&&ft(be,"pointerdown",Ce),E&&ft(E,"focusin",Ne),E&&ft(E,"focusout",Pe),E&&H&&ft(E,"focusout",Ie,!0))},[o,k,E,ce,f,P,H,_,p,d,ee,A,T,z,R,J,ie,re,g,b,Te]),h.useEffect(()=>{if(o||!E||!w)return;const ve=Array.from(H?.portalNode?.querySelectorAll(`[${vc("portal")}]`)||[]),Ne=(P?s_(P.nodesRef.current,T()):[]).find(Be=>jh(Be.context?.elements.domReference||null))?.context?.elements.domReference,Ie=[...[E,...ve,X.current,U.current,H?.beforeOutsideRef.current,H?.afterOutsideRef.current,...Te()],Ne,Os(b),Os(g),A?k:null].filter(Be=>Be!=null),be=i_(Ie,{ariaHidden:f||A,mark:!1}),Ae=[E,...ve].filter(Be=>Be!=null),we=i_(Ae);return()=>{we(),be()}},[w,o,k,E,f,H,A,P,T,g,b,Te]),Me(()=>{if(!w||o||!Gt(ce))return;const ve=yt(ce),Ce=Pn(ve);queueMicrotask(()=>{const Ne=B.current,Pe=typeof Ne=="function"?Ne(D.current||""):Ne;if(Pe===void 0||Pe===!1||Ze(ce,Ce))return;let be=null;const Ae=()=>(be==null&&(be=ee(ce)),be[0]||ce);let we;Pe===!0||Pe===null?we=Ae():we=Os(Pe),we=we||Ae();const Be=Ze(ce,Pn(ve));Sd(we,{preventScroll:we===ce,shouldFocus(){if(Be)return!0;const Xe=Pn(ve);return!(Xe!==we&&Ze(ce,Xe))}})})},[o,w,ce,ee,B,D]),Me(()=>{if(o||!ce)return;const ve=yt(ce),Ce=Pn(ve);E3(Ce);function Ne(Ie){if(Ie.open||(Z.current=k3(Ie.nativeEvent,G.current)),Ie.reason===$n&&Ie.nativeEvent.type==="mouseleave"&&(q.current=!0),Ie.reason===Nx)if(Ie.nested)q.current=!1;else if(Sx(Ie.nativeEvent)||vS(Ie.nativeEvent))q.current=!1;else{let be=!1;yt(ce).createElement("div").focus({get preventScroll(){return be=!0,!1}}),be?q.current=!1:q.current=!0}}N.on("openchange",Ne);function Pe(){const Ie=L.current;let be=typeof Ie=="function"?Ie(Z.current):Ie;if(be===void 0||be===!1)return null;if(be===null&&(be=!0),typeof be=="boolean")return k?.isConnected?k:dg()||null;const Ae=k?.isConnected?k:dg();return Os(be)||Ae||null}return()=>{N.off("openchange",Ne);const Ie=Pn(ve),be=Te(),Ae=Ze(E,Ie)||be.some(Xe=>Xe===Ie||Ze(Xe,Ie))||P&&Er(P.nodesRef.current,T(),!1).some(Xe=>Ze(Xe.context?.elements.floating,Ie)),we=L.current,Be=Pe();queueMicrotask(()=>{const Xe=N3(Be),Ye=typeof we!="boolean";we&&!q.current&&Gt(Xe)&&(!(!Ye&&Xe!==Ie&&Ie!==ve.body)||Ae)&&Xe.focus({preventScroll:!0}),q.current=!1})}},[o,E,ce,L,N,P,k,T,Te]),Me(()=>{if(!wx||w||!E)return;const ve=Pn(yt(E));!Gt(ve)||!xf(ve)||Ze(E,ve)&&ve.blur()},[w,E]),Me(()=>{if(!(o||!H))return H.setFocusManagerState({modal:f,closeOnFocusOut:p,open:w,onOpenChange:_.setOpen,domReference:k}),()=>{H.setFocusManagerState(null)}},[o,H,f,w,_,p,k]),Me(()=>{if(!(o||!ce))return p_(ce,z),()=>{queueMicrotask(Bx)}},[o,ce,z]);const Fe=!o&&(f?!A:!0)&&(oe||f);return r.jsxs(h.Fragment,{children:[Fe&&r.jsx(Ud,{"data-type":"inside",ref:K,onFocus:ve=>{if(f){const Ce=ee();Sd(Ce[Ce.length-1])}else H?.portalNode&&(q.current=!1,ac(ve,H.portalNode)?qS(k)?.focus():Os(b??H.beforeOutsideRef)?.focus())}}),s,Fe&&r.jsx(Ud,{"data-type":"inside",ref:F,onFocus:ve=>{f?Sd(ee()[0]):H?.portalNode&&(p&&(q.current=!0),ac(ve,H.portalNode)?$S(k)?.focus():Os(g??H.afterOutsideRef)?.focus())}})]})}function R3(e,n={}){const{enabled:s=!0,event:o="click",toggle:l=!0,ignoreMouse:c=!1,stickIfOpen:d=!0,touchOpenDelay:f=0,reason:p=hc}=n,m="rootStore"in e?e.rootStore:e,g=m.context.dataRef,b=h.useRef(void 0),v=jl(),S=sa(),C=h.useMemo(()=>{function _(k,E,N,R){const T=lt(p,E,N);k&&R==="touch"&&f>0?S.start(f,()=>{m.setOpen(!0,T)}):m.setOpen(k,T)}function w(k,E,N){const R=g.current.openEvent,T=m.select("domReferenceElement")!==E;return k&&T||!k||!l?!0:R&&d?!N(R.type):!1}return{onPointerDown(k){b.current=k.pointerType},onMouseDown(k){const E=b.current,N=k.nativeEvent,R=m.select("open");if(k.button!==0||o==="click"||uo(E,!0)&&c)return;const T=w(R,k.currentTarget,z=>z==="click"||z==="mousedown"),O=Tn(N);if(xf(O)){_(T,N,O,E);return}const A=k.currentTarget;v.request(()=>{_(T,N,A,E)})},onClick(k){if(o==="mousedown-only")return;const E=b.current;if(o==="mousedown"&&E){b.current=void 0;return}if(uo(E,!0)&&c)return;const N=m.select("open"),R=w(N,k.currentTarget,T=>T==="click"||T==="mousedown"||T==="keydown"||T==="keyup");_(R,k.nativeEvent,k.currentTarget,E)},onKeyDown(){b.current=void 0}}},[g,o,c,p,m,d,l,v,S,f]);return h.useMemo(()=>s?{reference:C}:un,[s,C])}function T3(e,n){let s=null,o=null,l=!1;return{contextElement:e||void 0,getBoundingClientRect(){const c=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},d=n.axis==="x"||n.axis==="both",f=n.axis==="y"||n.axis==="both",p=["mouseenter","mousemove"].includes(n.dataRef.current.openEvent?.type||"")&&n.pointerType!=="touch";let m=c.width,g=c.height,b=c.x,v=c.y;return s==null&&n.x&&d&&(s=c.x-n.x),o==null&&n.y&&f&&(o=c.y-n.y),b-=s||0,v-=o||0,m=0,g=0,!l||p?(m=n.axis==="y"?c.width:0,g=n.axis==="x"?c.height:0,b=d&&n.x!=null?n.x:b,v=f&&n.y!=null?n.y:v):l&&!p&&(g=n.axis==="x"?c.height:g,m=n.axis==="y"?c.width:m),l=!0,{width:m,height:g,x:b,y:v,top:v,right:b+m,bottom:v+g,left:b}}}}function m_(e){return e!=null&&e.clientX!=null}function A3(e,n={}){const{enabled:s=!0,axis:o="both"}=n,l="rootStore"in e?e.rootStore:e,c=l.useState("open"),d=l.useState("floatingElement"),f=l.useState("domReferenceElement"),p=l.context.dataRef,m=h.useRef(!1),g=h.useRef(null),[b,v]=h.useState(),[S,C]=h.useState([]),_=Le(R=>{l.set("positionReference",R)}),w=Le((R,T,O)=>{m.current||p.current.openEvent&&!m_(p.current.openEvent)||l.set("positionReference",T3(O??f,{x:R,y:T,axis:o,dataRef:p,pointerType:b}))}),k=Le(R=>{c?g.current||(w(R.clientX,R.clientY,R.currentTarget),C([])):w(R.clientX,R.clientY,R.currentTarget)}),E=uo(b)?d:c;h.useEffect(()=>{if(!s){_(f);return}if(!E)return;function R(){g.current?.(),g.current=null}const T=Qt(d);function O(A){const z=Tn(A);Ze(d,z)?R():w(A.clientX,A.clientY)}return!p.current.openEvent||m_(p.current.openEvent)?g.current=ft(T,"mousemove",O):_(f),R},[E,s,d,p,f,l,w,_,S]),h.useEffect(()=>()=>{l.set("positionReference",null)},[l]),h.useEffect(()=>{s&&!d&&(m.current=!1)},[s,d]),h.useEffect(()=>{!s&&c&&(m.current=!0)},[s,c]);const N=h.useMemo(()=>{function R(T){v(T.pointerType)}return{onPointerDown:R,onPointerEnter:R,onMouseMove:k,onMouseEnter:k}},[k]);return h.useMemo(()=>s?{reference:N,trigger:N}:{},[s,N])}const M3={intentional:"onClick",sloppy:"onPointerDown"};function O3(){return!1}function z3(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Ux(e,n={}){const{enabled:s=!0,escapeKey:o=!0,outsidePress:l=!0,outsidePressEvent:c="sloppy",referencePress:d=O3,referencePressEvent:f="sloppy",bubbles:p,externalTree:m}=n,g="rootStore"in e?e.rootStore:e,b=g.useState("open"),v=g.useState("floatingElement"),{dataRef:S}=g.context,C=Il(m),_=Le(typeof l=="function"?l:()=>!1),w=typeof l=="function"?_:l,k=w!==!1,E=Le(()=>c),{escapeKey:N,outsidePress:R}=z3(p),T=h.useRef(!1),O=h.useRef(!1),A=h.useRef(!1),z=h.useRef(!1),B=h.useRef(""),L=h.useRef(null),D=sa(),P=sa(),H=Le(()=>{P.clear(),S.current.insideReactTree=!1}),q=Le(F=>{const J=S.current.floatingContext?.nodeId;return(C?Er(C.nodesRef.current,J):[]).some(re=>re.context?.open&&!re.context.dataRef.current[F])}),Y=Le(F=>sg(F,g.select("floatingElement"))||sg(F,g.select("domReferenceElement"))),V=Le(F=>{d()&&g.setOpen(!1,lt(hc,F.nativeEvent))}),$=Le(F=>{if(!b||!s||!o||F.key!=="Escape"||z.current||!N&&q("__escapeKeyBubbles"))return;const J=gM(F)?F.nativeEvent:F,ie=lt(Rx,J);g.setOpen(!1,ie),ie.isCanceled||F.preventDefault(),!N&&!ie.isPropagationAllowed&&F.stopPropagation()}),Z=Le(()=>{S.current.insideReactTree=!0,P.start(0,H)}),G=Le(F=>{if(!b||!s||F.button!==0)return;const J=Tn(F.nativeEvent);Ze(g.select("floatingElement"),J)&&(T.current||(T.current=!0,O.current=!1))}),X=Le(F=>{!b||!s||(F.defaultPrevented||F.nativeEvent.defaultPrevented)&&T.current&&(O.current=!0)});h.useEffect(()=>{if(!b||!s)return;S.current.__escapeKeyBubbles=N,S.current.__outsidePressBubbles=R;const F=new Ga,J=new Ga;function ie(){F.clear(),z.current=!0}function re(){F.start(gf()?5:0,()=>{z.current=!1})}function oe(){A.current=!0,J.start(0,()=>{A.current=!1})}function ce(){T.current=!1,O.current=!1}function ee(){const le=B.current,je=le==="pen"||!le?"mouse":le,Se=E(),Ue=typeof Se=="function"?Se():Se;return typeof Ue=="string"?Ue:Ue[je]}function Te(le){const je=ee();return je==="intentional"&&le.type!=="click"||je==="sloppy"&&le.type==="click"}function Fe(le){const je=S.current.floatingContext?.nodeId,Se=C&&Er(C.nodesRef.current,je).some(Ue=>sg(le,Ue.context?.elements.floating));return Y(le)||Se}function ve(le){if(Te(le)){le.type!=="click"&&!Y(le)&&(J.clear(),A.current=!1),H();return}if(S.current.insideReactTree){H();return}const je=Tn(le),Se=`[${vc("inert")}]`,Ue=dt(je)?je.getRootNode():null,Je=Array.from((_l(Ue)?Ue:yt(g.select("floatingElement"))).querySelectorAll(Se)),_t=g.context.triggerElements;if(je&&(_t.hasElement(je)||_t.hasMatchingElement(pe=>Ze(pe,je))))return;let zt=dt(je)?je:null;for(;zt&&!Ls(zt);){const pe=Us(zt);if(Ls(pe)||!dt(pe))break;zt=pe}if(!(Je.length&&dt(je)&&!_M(je)&&!Ze(je,g.select("floatingElement"))&&Je.every(pe=>!Ze(zt,pe)))){if(Gt(je)&&!("touches"in le)){const pe=Ls(je),Ee=oa(je),Re=/auto|scroll/,qe=pe||Re.test(Ee.overflowX),st=pe||Re.test(Ee.overflowY),an=qe&&je.clientWidth>0&&je.scrollWidth>je.clientWidth,Vt=st&&je.clientHeight>0&&je.scrollHeight>je.clientHeight,mt=Ee.direction==="rtl",Nt=Vt&&(mt?le.offsetX<=je.offsetWidth-je.clientWidth:le.offsetX>je.clientWidth),Wt=an&&le.offsetY>je.clientHeight;if(Nt||Wt)return}if(!Fe(le)){if(ee()==="intentional"&&A.current){J.clear(),A.current=!1;return}typeof w=="function"&&!w(le)||q("__outsidePressBubbles")||(g.setOpen(!1,lt(Nx,le)),H())}}}function Ce(le){ee()!=="sloppy"||le.pointerType==="touch"||!g.select("open")||!s||Y(le)||ve(le)}function Ne(le){if(ee()!=="sloppy"||!g.select("open")||!s||Y(le))return;const je=le.touches[0];je&&(L.current={startTime:Date.now(),startX:je.clientX,startY:je.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},D.start(1e3,()=>{L.current&&(L.current.dismissOnTouchEnd=!1,L.current.dismissOnMouseDown=!1)}))}function Pe(le,je){const Se=Tn(le);if(!Se)return;const Ue=ft(Se,le.type,()=>{je(le),Ue()})}function Ie(le){B.current="touch",Pe(le,Ne)}function be(le){D.clear(),le.type==="pointerdown"&&(B.current=le.pointerType),!(le.type==="mousedown"&&L.current&&!L.current.dismissOnMouseDown)&&Pe(le,je=>{je.type==="pointerdown"?Ce(je):ve(je)})}function Ae(le){if(!T.current)return;const je=O.current;if(ce(),ee()==="intentional"){if(le.type==="pointercancel"){je&&oe();return}if(!Fe(le)){if(je){oe();return}typeof w=="function"&&!w(le)||(J.clear(),A.current=!0,H())}}}function we(le){if(ee()!=="sloppy"||!L.current||Y(le))return;const je=le.touches[0];if(!je)return;const Se=Math.abs(je.clientX-L.current.startX),Ue=Math.abs(je.clientY-L.current.startY),Je=Math.sqrt(Se*Se+Ue*Ue);Je>5&&(L.current.dismissOnTouchEnd=!0),Je>10&&(ve(le),D.clear(),L.current=null)}function Be(le){Pe(le,we)}function Xe(le){ee()!=="sloppy"||!L.current||Y(le)||(L.current.dismissOnTouchEnd&&ve(le),D.clear(),L.current=null)}function Ye(le){Pe(le,Xe)}const De=yt(v),ye=ss(o&&ss(ft(De,"keydown",$),ft(De,"compositionstart",ie),ft(De,"compositionend",re)),k&&ss(ft(De,"click",be,!0),ft(De,"pointerdown",be,!0),ft(De,"pointerup",Ae,!0),ft(De,"pointercancel",Ae,!0),ft(De,"mousedown",be,!0),ft(De,"mouseup",Ae,!0),ft(De,"touchstart",Ie,!0),ft(De,"touchmove",Be,!0),ft(De,"touchend",Ye,!0)));return()=>{ye(),F.clear(),J.clear(),ce(),A.current=!1}},[S,v,o,k,w,b,s,N,R,$,H,E,q,Y,C,g,D]),h.useEffect(H,[w,H]);const U=h.useMemo(()=>({onKeyDown:$,[M3[f]]:V,...f!=="intentional"&&{onClick:V}}),[$,V,f]),K=h.useMemo(()=>({onKeyDown:$,onPointerDown:X,onMouseDown:X,onClickCapture:Z,onMouseDownCapture(F){Z(),G(F)},onPointerDownCapture(F){Z(),G(F)},onMouseUpCapture:Z,onTouchEndCapture:Z,onTouchMoveCapture:Z}),[$,Z,G,X]);return h.useMemo(()=>s?{reference:U,floating:K,trigger:U}:{},[s,U,K])}function g_(e,n,s){let{reference:o,floating:l}=e;const c=Oa(n),d=zx(n),f=Ox(d),p=ra(n),m=c==="y",g=o.x+o.width/2-l.width/2,b=o.y+o.height/2-l.height/2,v=o[f]/2-l[f]/2;let S;switch(p){case"top":S={x:g,y:o.y-l.height};break;case"bottom":S={x:g,y:o.y+o.height};break;case"right":S={x:o.x+o.width,y:b};break;case"left":S={x:o.x-l.width,y:b};break;default:S={x:o.x,y:o.y}}switch(Mr(n)){case"start":S[d]-=v*(s&&m?-1:1);break;case"end":S[d]+=v*(s&&m?-1:1);break}return S}async function D3(e,n){var s;n===void 0&&(n={});const{x:o,y:l,platform:c,rects:d,elements:f,strategy:p}=e,{boundary:m="clippingAncestors",rootBoundary:g="viewport",elementContext:b="floating",altBoundary:v=!1,padding:S=0}=qs(n,e),C=TS(S),w=f[v?b==="floating"?"reference":"floating":b],k=xc(await c.getClippingRect({element:(s=await(c.isElement==null?void 0:c.isElement(w)))==null||s?w:w.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(f.floating)),boundary:m,rootBoundary:g,strategy:p})),E=b==="floating"?{x:o,y:l,width:d.floating.width,height:d.floating.height}:d.reference,N=await(c.getOffsetParent==null?void 0:c.getOffsetParent(f.floating)),R=await(c.isElement==null?void 0:c.isElement(N))?await(c.getScale==null?void 0:c.getScale(N))||{x:1,y:1}:{x:1,y:1},T=xc(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:E,offsetParent:N,strategy:p}):E);return{top:(k.top-T.top+C.top)/R.y,bottom:(T.bottom-k.bottom+C.bottom)/R.y,left:(k.left-T.left+C.left)/R.x,right:(T.right-k.right+C.right)/R.x}}const L3=50,P3=async(e,n,s)=>{const{placement:o="bottom",strategy:l="absolute",middleware:c=[],platform:d}=s,f=d.detectOverflow?d:{...d,detectOverflow:D3},p=await(d.isRTL==null?void 0:d.isRTL(n));let m=await d.getElementRects({reference:e,floating:n,strategy:l}),{x:g,y:b}=g_(m,o,p),v=o,S=0;const C={};for(let _=0;_<c.length;_++){const w=c[_];if(!w)continue;const{name:k,fn:E}=w,{x:N,y:R,data:T,reset:O}=await E({x:g,y:b,initialPlacement:o,placement:v,strategy:l,middlewareData:C,rects:m,platform:f,elements:{reference:e,floating:n}});g=N??g,b=R??b,C[k]={...C[k],...T},O&&S<L3&&(S++,typeof O=="object"&&(O.placement&&(v=O.placement),O.rects&&(m=O.rects===!0?await d.getElementRects({reference:e,floating:n,strategy:l}):O.rects),{x:g,y:b}=g_(m,v,p)),_=-1)}return{x:g,y:b,placement:v,strategy:l,middlewareData:C}},I3=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(n){var s,o;const{placement:l,middlewareData:c,rects:d,initialPlacement:f,platform:p,elements:m}=n,{mainAxis:g=!0,crossAxis:b=!0,fallbackPlacements:v,fallbackStrategy:S="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:_=!0,...w}=qs(e,n);if((s=c.arrow)!=null&&s.alignmentOffset)return{};const k=ra(l),E=Oa(f),N=ra(f)===f,R=await(p.isRTL==null?void 0:p.isRTL(m.floating)),T=v||(N||!_?[Vd(f)]:VM(f)),O=C!=="none";!v&&O&&T.push(...FM(f,_,C,R));const A=[f,...T],z=await p.detectOverflow(n,w),B=[];let L=((o=c.flip)==null?void 0:o.overflows)||[];if(g&&B.push(z[k]),b){const q=HM(l,d,R);B.push(z[q[0]],z[q[1]])}if(L=[...L,{placement:l,overflows:B}],!B.every(q=>q<=0)){var D,P;const q=(((D=c.flip)==null?void 0:D.index)||0)+1,Y=A[q];if(Y&&(!(b==="alignment"?E!==Oa(Y):!1)||L.every(Z=>Oa(Z.placement)===E?Z.overflows[0]>0:!0)))return{data:{index:q,overflows:L},reset:{placement:Y}};let V=(P=L.filter($=>$.overflows[0]<=0).sort(($,Z)=>$.overflows[1]-Z.overflows[1])[0])==null?void 0:P.placement;if(!V)switch(S){case"bestFit":{var H;const $=(H=L.filter(Z=>{if(O){const G=Oa(Z.placement);return G===E||G==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(G=>G>0).reduce((G,X)=>G+X,0)]).sort((Z,G)=>Z[1]-G[1])[0])==null?void 0:H[0];$&&(V=$);break}case"initialPlacement":V=f;break}if(l!==V)return{reset:{placement:V}}}return{}}}};function h_(e,n){return{top:e.top-n.height,right:e.right-n.width,bottom:e.bottom-n.height,left:e.left-n.width}}function x_(e){return BM.some(n=>e[n]>=0)}const B3=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(n){const{rects:s,platform:o}=n,{strategy:l="referenceHidden",...c}=qs(e,n);switch(l){case"referenceHidden":{const d=await o.detectOverflow(n,{...c,elementContext:"reference"}),f=h_(d,s.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:x_(f)}}}case"escaped":{const d=await o.detectOverflow(n,{...c,altBoundary:!0}),f=h_(d,s.floating);return{data:{escapedOffsets:f,escaped:x_(f)}}}default:return{}}}}},n2=new Set(["left","top"]);async function U3(e,n){const{placement:s,platform:o,elements:l}=e,c=await(o.isRTL==null?void 0:o.isRTL(l.floating)),d=ra(s),f=Mr(s),p=Oa(s)==="y",m=n2.has(d)?-1:1,g=c&&p?-1:1,b=qs(n,e);let{mainAxis:v,crossAxis:S,alignmentAxis:C}=typeof b=="number"?{mainAxis:b,crossAxis:0,alignmentAxis:null}:{mainAxis:b.mainAxis||0,crossAxis:b.crossAxis||0,alignmentAxis:b.alignmentAxis};return f&&typeof C=="number"&&(S=f==="end"?C*-1:C),p?{x:S*g,y:v*m}:{x:v*m,y:S*g}}const H3=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(n){var s,o;const{x:l,y:c,placement:d,middlewareData:f}=n,p=await U3(n,e);return d===((s=f.offset)==null?void 0:s.placement)&&(o=f.arrow)!=null&&o.alignmentOffset?{}:{x:l+p.x,y:c+p.y,data:{...p,placement:d}}}}},V3=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(n){const{x:s,y:o,placement:l,platform:c}=n,{mainAxis:d=!0,crossAxis:f=!1,limiter:p={fn:k=>{let{x:E,y:N}=k;return{x:E,y:N}}},...m}=qs(e,n),g={x:s,y:o},b=await c.detectOverflow(n,m),v=Oa(ra(l)),S=Mx(v);let C=g[S],_=g[v];if(d){const k=S==="y"?"top":"left",E=S==="y"?"bottom":"right",N=C+b[k],R=C-b[E];C=wh(N,C,R)}if(f){const k=v==="y"?"top":"left",E=v==="y"?"bottom":"right",N=_+b[k],R=_-b[E];_=wh(N,_,R)}const w=p.fn({...n,[S]:C,[v]:_});return{...w,data:{x:w.x-s,y:w.y-o,enabled:{[S]:d,[v]:f}}}}}},q3=function(e){return e===void 0&&(e={}),{options:e,fn(n){const{x:s,y:o,placement:l,rects:c,middlewareData:d}=n,{offset:f=0,mainAxis:p=!0,crossAxis:m=!0}=qs(e,n),g={x:s,y:o},b=Oa(l),v=Mx(b);let S=g[v],C=g[b];const _=qs(f,n),w=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(p){const N=v==="y"?"height":"width",R=c.reference[v]-c.floating[N]+w.mainAxis,T=c.reference[v]+c.reference[N]-w.mainAxis;S<R?S=R:S>T&&(S=T)}if(m){var k,E;const N=v==="y"?"width":"height",R=n2.has(ra(l)),T=c.reference[b]-c.floating[N]+(R&&((k=d.offset)==null?void 0:k[b])||0)+(R?0:w.crossAxis),O=c.reference[b]+c.reference[N]+(R?0:((E=d.offset)==null?void 0:E[b])||0)-(R?w.crossAxis:0);C<T?C=T:C>O&&(C=O)}return{[v]:S,[b]:C}}}},$3=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(n){var s,o;const{placement:l,rects:c,platform:d,elements:f}=n,{apply:p=()=>{},...m}=qs(e,n),g=await d.detectOverflow(n,m),b=ra(l),v=Mr(l),S=Oa(l)==="y",{width:C,height:_}=c.floating;let w,k;b==="top"||b==="bottom"?(w=b,k=v===(await(d.isRTL==null?void 0:d.isRTL(f.floating))?"start":"end")?"left":"right"):(k=b,w=v==="end"?"top":"bottom");const E=_-g.top-g.bottom,N=C-g.left-g.right,R=wl(_-g[w],E),T=wl(C-g[k],N),O=!n.middlewareData.shift;let A=R,z=T;if((s=n.middlewareData.shift)!=null&&s.enabled.x&&(z=N),(o=n.middlewareData.shift)!=null&&o.enabled.y&&(A=E),O&&!v){const L=ba(g.left,0),D=ba(g.right,0),P=ba(g.top,0),H=ba(g.bottom,0);S?z=C-2*(L!==0||D!==0?L+D:ba(g.left,g.right)):A=_-2*(P!==0||H!==0?P+H:ba(g.top,g.bottom))}await p({...n,availableWidth:z,availableHeight:A});const B=await d.getDimensions(f.floating);return C!==B.width||_!==B.height?{reset:{rects:!0}}:{}}}};function a2(e){const n=oa(e);let s=parseFloat(n.width)||0,o=parseFloat(n.height)||0;const l=Gt(e),c=l?e.offsetWidth:s,d=l?e.offsetHeight:o,f=Hd(s)!==c||Hd(o)!==d;return f&&(s=c,o=d),{width:s,height:o,$:f}}function Hx(e){return dt(e)?e:e.contextElement}function gl(e){const n=Hx(e);if(!Gt(n))return rs(1);const s=n.getBoundingClientRect(),{width:o,height:l,$:c}=a2(n);let d=(c?Hd(s.width):s.width)/o,f=(c?Hd(s.height):s.height)/l;return(!d||!Number.isFinite(d))&&(d=1),(!f||!Number.isFinite(f))&&(f=1),{x:d,y:f}}const G3=rs(0);function s2(e){const n=Qt(e);return!gf()||!n.visualViewport?G3:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function F3(e,n,s){return n===void 0&&(n=!1),!s||n&&s!==Qt(e)?!1:n}function fo(e,n,s,o){n===void 0&&(n=!1),s===void 0&&(s=!1);const l=e.getBoundingClientRect(),c=Hx(e);let d=rs(1);n&&(o?dt(o)&&(d=gl(o)):d=gl(e));const f=F3(c,s,o)?s2(c):rs(0);let p=(l.left+f.x)/d.x,m=(l.top+f.y)/d.y,g=l.width/d.x,b=l.height/d.y;if(c){const v=Qt(c),S=o&&dt(o)?Qt(o):o;let C=v,_=yh(C);for(;_&&o&&S!==C;){const w=gl(_),k=_.getBoundingClientRect(),E=oa(_),N=k.left+(_.clientLeft+parseFloat(E.paddingLeft))*w.x,R=k.top+(_.clientTop+parseFloat(E.paddingTop))*w.y;p*=w.x,m*=w.y,g*=w.x,b*=w.y,p+=N,m+=R,C=Qt(_),_=yh(C)}}return xc({width:g,height:b,x:p,y:m})}function wf(e,n){const s=hf(e).scrollLeft;return n?n.left+s:fo(is(e)).left+s}function r2(e,n){const s=e.getBoundingClientRect(),o=s.left+n.scrollLeft-wf(e,s),l=s.top+n.scrollTop;return{x:o,y:l}}function Y3(e){let{elements:n,rect:s,offsetParent:o,strategy:l}=e;const c=l==="fixed",d=is(o),f=n?mf(n.floating):!1;if(o===d||f&&c)return s;let p={scrollLeft:0,scrollTop:0},m=rs(1);const g=rs(0),b=Gt(o);if((b||!b&&!c)&&((Hn(o)!=="body"||Ar(d))&&(p=hf(o)),b)){const S=fo(o);m=gl(o),g.x=S.x+o.clientLeft,g.y=S.y+o.clientTop}const v=d&&!b&&!c?r2(d,p):rs(0);return{width:s.width*m.x,height:s.height*m.y,x:s.x*m.x-p.scrollLeft*m.x+g.x+v.x,y:s.y*m.y-p.scrollTop*m.y+g.y+v.y}}function X3(e){return Array.from(e.getClientRects())}function K3(e){const n=is(e),s=hf(e),o=e.ownerDocument.body,l=ba(n.scrollWidth,n.clientWidth,o.scrollWidth,o.clientWidth),c=ba(n.scrollHeight,n.clientHeight,o.scrollHeight,o.clientHeight);let d=-s.scrollLeft+wf(e);const f=-s.scrollTop;return oa(o).direction==="rtl"&&(d+=ba(n.clientWidth,o.clientWidth)-l),{width:l,height:c,x:d,y:f}}const b_=25;function Q3(e,n){const s=Qt(e),o=is(e),l=s.visualViewport;let c=o.clientWidth,d=o.clientHeight,f=0,p=0;if(l){c=l.width,d=l.height;const g=gf();(!g||g&&n==="fixed")&&(f=l.offsetLeft,p=l.offsetTop)}const m=wf(o);if(m<=0){const g=o.ownerDocument,b=g.body,v=getComputedStyle(b),S=g.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,C=Math.abs(o.clientWidth-b.clientWidth-S);C<=b_&&(c-=C)}else m<=b_&&(c+=m);return{width:c,height:d,x:f,y:p}}function Z3(e,n){const s=fo(e,!0,n==="fixed"),o=s.top+e.clientTop,l=s.left+e.clientLeft,c=Gt(e)?gl(e):rs(1),d=e.clientWidth*c.x,f=e.clientHeight*c.y,p=l*c.x,m=o*c.y;return{width:d,height:f,x:p,y:m}}function v_(e,n,s){let o;if(n==="viewport")o=Q3(e,s);else if(n==="document")o=K3(is(e));else if(dt(n))o=Z3(n,s);else{const l=s2(e);o={x:n.x-l.x,y:n.y-l.y,width:n.width,height:n.height}}return xc(o)}function o2(e,n){const s=Us(e);return s===n||!dt(s)||Ls(s)?!1:oa(s).position==="fixed"||o2(s,n)}function W3(e,n){const s=n.get(e);if(s)return s;let o=mc(e,[],!1).filter(f=>dt(f)&&Hn(f)!=="body"),l=null;const c=oa(e).position==="fixed";let d=c?Us(e):e;for(;dt(d)&&!Ls(d);){const f=oa(d),p=kx(d);!p&&f.position==="fixed"&&(l=null),(c?!p&&!l:!p&&f.position==="static"&&!!l&&(l.position==="absolute"||l.position==="fixed")||Ar(d)&&!p&&o2(e,d))?o=o.filter(g=>g!==d):l=f,d=Us(d)}return n.set(e,o),o}function J3(e){let{element:n,boundary:s,rootBoundary:o,strategy:l}=e;const d=[...s==="clippingAncestors"?mf(n)?[]:W3(n,this._c):[].concat(s),o],f=v_(n,d[0],l);let p=f.top,m=f.right,g=f.bottom,b=f.left;for(let v=1;v<d.length;v++){const S=v_(n,d[v],l);p=ba(S.top,p),m=wl(S.right,m),g=wl(S.bottom,g),b=ba(S.left,b)}return{width:m-b,height:g-p,x:b,y:p}}function e5(e){const{width:n,height:s}=a2(e);return{width:n,height:s}}function t5(e,n,s){const o=Gt(n),l=is(n),c=s==="fixed",d=fo(e,!0,c,n);let f={scrollLeft:0,scrollTop:0};const p=rs(0);function m(){p.x=wf(l)}if(o||!o&&!c)if((Hn(n)!=="body"||Ar(l))&&(f=hf(n)),o){const S=fo(n,!0,c,n);p.x=S.x+n.clientLeft,p.y=S.y+n.clientTop}else l&&m();c&&!o&&l&&m();const g=l&&!o&&!c?r2(l,f):rs(0),b=d.left+f.scrollLeft-p.x-g.x,v=d.top+f.scrollTop-p.y-g.y;return{x:b,y:v,width:d.width,height:d.height}}function fg(e){return oa(e).position==="static"}function y_(e,n){if(!Gt(e)||oa(e).position==="fixed")return null;if(n)return n(e);let s=e.offsetParent;return is(e)===s&&(s=s.ownerDocument.body),s}function l2(e,n){const s=Qt(e);if(mf(e))return s;if(!Gt(e)){let l=Us(e);for(;l&&!Ls(l);){if(dt(l)&&!fg(l))return l;l=Us(l)}return s}let o=y_(e,n);for(;o&&xM(o)&&fg(o);)o=y_(o,n);return o&&Ls(o)&&fg(o)&&!kx(o)?s:o||yM(e)||s}const n5=async function(e){const n=this.getOffsetParent||l2,s=this.getDimensions,o=await s(e.floating);return{reference:t5(e.reference,await n(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function a5(e){return oa(e).direction==="rtl"}const i2={convertOffsetParentRelativeRectToViewportRelativeRect:Y3,getDocumentElement:is,getClippingRect:J3,getOffsetParent:l2,getElementRects:n5,getClientRects:X3,getDimensions:e5,getScale:gl,isElement:dt,isRTL:a5};function c2(e,n){return e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height}function s5(e,n){let s=null,o;const l=is(e);function c(){var f;clearTimeout(o),(f=s)==null||f.disconnect(),s=null}function d(f,p){f===void 0&&(f=!1),p===void 0&&(p=1),c();const m=e.getBoundingClientRect(),{left:g,top:b,width:v,height:S}=m;if(f||n(),!v||!S)return;const C=ro(b),_=ro(l.clientWidth-(g+v)),w=ro(l.clientHeight-(b+S)),k=ro(g),N={rootMargin:-C+"px "+-_+"px "+-w+"px "+-k+"px",threshold:ba(0,wl(1,p))||1};let R=!0;function T(O){const A=O[0].intersectionRatio;if(A!==p){if(!R)return d();A?d(!1,A):o=setTimeout(()=>{d(!1,1e-7)},1e3)}A===1&&!c2(m,e.getBoundingClientRect())&&d(),R=!1}try{s=new IntersectionObserver(T,{...N,root:l.ownerDocument})}catch{s=new IntersectionObserver(T,N)}s.observe(e)}return d(!0),c}function __(e,n,s,o){o===void 0&&(o={});const{ancestorScroll:l=!0,ancestorResize:c=!0,elementResize:d=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:p=!1}=o,m=Hx(e),g=l||c?[...m?mc(m):[],...n?mc(n):[]]:[];g.forEach(k=>{l&&k.addEventListener("scroll",s,{passive:!0}),c&&k.addEventListener("resize",s)});const b=m&&f?s5(m,s):null;let v=-1,S=null;d&&(S=new ResizeObserver(k=>{let[E]=k;E&&E.target===m&&S&&n&&(S.unobserve(n),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var N;(N=S)==null||N.observe(n)})),s()}),m&&!p&&S.observe(m),n&&S.observe(n));let C,_=p?fo(e):null;p&&w();function w(){const k=fo(e);_&&!c2(_,k)&&s(),_=k,C=requestAnimationFrame(w)}return s(),()=>{var k;g.forEach(E=>{l&&E.removeEventListener("scroll",s),c&&E.removeEventListener("resize",s)}),b?.(),(k=S)==null||k.disconnect(),S=null,p&&cancelAnimationFrame(C)}}const r5=H3,o5=V3,l5=I3,i5=$3,c5=B3,u5=q3,d5=(e,n,s)=>{const o=new Map,l={platform:i2,...s},c={...l.platform,_c:o};return P3(e,n,{...l,platform:c})};var f5=typeof document<"u",p5=function(){},Cd=f5?h.useLayoutEffect:p5;function Gd(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(typeof e=="function"&&e.toString()===n.toString())return!0;let s,o,l;if(e&&n&&typeof e=="object"){if(Array.isArray(e)){if(s=e.length,s!==n.length)return!1;for(o=s;o--!==0;)if(!Gd(e[o],n[o]))return!1;return!0}if(l=Object.keys(e),s=l.length,s!==Object.keys(n).length)return!1;for(o=s;o--!==0;)if(!{}.hasOwnProperty.call(n,l[o]))return!1;for(o=s;o--!==0;){const c=l[o];if(!(c==="_owner"&&e.$$typeof)&&!Gd(e[c],n[c]))return!1}return!0}return e!==e&&n!==n}function u2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function j_(e,n){const s=u2(e);return Math.round(n*s)/s}function pg(e){const n=h.useRef(e);return Cd(()=>{n.current=e}),n}function m5(e){e===void 0&&(e={});const{placement:n="bottom",strategy:s="absolute",middleware:o=[],platform:l,elements:{reference:c,floating:d}={},transform:f=!0,whileElementsMounted:p,open:m}=e,[g,b]=h.useState({x:0,y:0,strategy:s,placement:n,middlewareData:{},isPositioned:!1}),[v,S]=h.useState(o);Gd(v,o)||S(o);const[C,_]=h.useState(null),[w,k]=h.useState(null),E=h.useCallback(Z=>{Z!==O.current&&(O.current=Z,_(Z))},[]),N=h.useCallback(Z=>{Z!==A.current&&(A.current=Z,k(Z))},[]),R=c||C,T=d||w,O=h.useRef(null),A=h.useRef(null),z=h.useRef(g),B=p!=null,L=pg(p),D=pg(l),P=pg(m),H=h.useCallback(()=>{if(!O.current||!A.current)return;const Z={placement:n,strategy:s,middleware:v};D.current&&(Z.platform=D.current),d5(O.current,A.current,Z).then(G=>{const X={...G,isPositioned:P.current!==!1};q.current&&!Gd(z.current,X)&&(z.current=X,Rr.flushSync(()=>{b(X)}))})},[v,n,s,D,P]);Cd(()=>{m===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,b(Z=>({...Z,isPositioned:!1})))},[m]);const q=h.useRef(!1);Cd(()=>(q.current=!0,()=>{q.current=!1}),[]),Cd(()=>{if(R&&(O.current=R),T&&(A.current=T),R&&T){if(L.current)return L.current(R,T,H);H()}},[R,T,H,L,B]);const Y=h.useMemo(()=>({reference:O,floating:A,setReference:E,setFloating:N}),[E,N]),V=h.useMemo(()=>({reference:R,floating:T}),[R,T]),$=h.useMemo(()=>{const Z={position:s,left:0,top:0};if(!V.floating)return Z;const G=j_(V.floating,g.x),X=j_(V.floating,g.y);return f?{...Z,transform:"translate("+G+"px, "+X+"px)",...u2(V.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:G,top:X}},[s,f,V.floating,g.x,g.y]);return h.useMemo(()=>({...g,update:H,refs:Y,elements:V,floatingStyles:$}),[g,H,Y,V,$])}const g5=(e,n)=>{const s=r5(e);return{name:s.name,fn:s.fn,options:[e,n]}},h5=(e,n)=>{const s=o5(e);return{name:s.name,fn:s.fn,options:[e,n]}},x5=(e,n)=>({fn:u5(e).fn,options:[e,n]}),b5=(e,n)=>{const s=l5(e);return{name:s.name,fn:s.fn,options:[e,n]}},v5=(e,n)=>{const s=i5(e);return{name:s.name,fn:s.fn,options:[e,n]}},y5=(e,n)=>{const s=c5(e);return{name:s.name,fn:s.fn,options:[e,n]}},ze=(e,n,s,o,l,c,...d)=>{if(d.length>0)throw new Error(Mn(1));let f;if(e)f=e;else throw new Error("Missing arguments");return f};var mg={exports:{}},gg={};/**
576
+ * @license React
577
+ * use-sync-external-store-shim.production.js
578
+ *
579
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
580
+ *
581
+ * This source code is licensed under the MIT license found in the
582
+ * LICENSE file in the root directory of this source tree.
583
+ */var w_;function _5(){if(w_)return gg;w_=1;var e=Sc();function n(b,v){return b===v&&(b!==0||1/b===1/v)||b!==b&&v!==v}var s=typeof Object.is=="function"?Object.is:n,o=e.useState,l=e.useEffect,c=e.useLayoutEffect,d=e.useDebugValue;function f(b,v){var S=v(),C=o({inst:{value:S,getSnapshot:v}}),_=C[0].inst,w=C[1];return c(function(){_.value=S,_.getSnapshot=v,p(_)&&w({inst:_})},[b,S,v]),l(function(){return p(_)&&w({inst:_}),b(function(){p(_)&&w({inst:_})})},[b]),d(S),S}function p(b){var v=b.getSnapshot;b=b.value;try{var S=v();return!s(b,S)}catch{return!0}}function m(b,v){return v()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:f;return gg.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,gg}var S_;function d2(){return S_||(S_=1,mg.exports=_5()),mg.exports}var Fd=d2(),hg={exports:{}},xg={};/**
584
+ * @license React
585
+ * use-sync-external-store-shim/with-selector.production.js
586
+ *
587
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
588
+ *
589
+ * This source code is licensed under the MIT license found in the
590
+ * LICENSE file in the root directory of this source tree.
591
+ */var C_;function j5(){if(C_)return xg;C_=1;var e=Sc(),n=d2();function s(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var o=typeof Object.is=="function"?Object.is:s,l=n.useSyncExternalStore,c=e.useRef,d=e.useEffect,f=e.useMemo,p=e.useDebugValue;return xg.useSyncExternalStoreWithSelector=function(m,g,b,v,S){var C=c(null);if(C.current===null){var _={hasValue:!1,value:null};C.current=_}else _=C.current;C=f(function(){function k(O){if(!E){if(E=!0,N=O,O=v(O),S!==void 0&&_.hasValue){var A=_.value;if(S(A,O))return R=A}return R=O}if(A=R,o(N,O))return A;var z=v(O);return S!==void 0&&S(A,z)?(N=O,A):(N=O,R=z)}var E=!1,N,R,T=b===void 0?null:b;return[function(){return k(g())},T===null?void 0:function(){return k(T())}]},[g,b,v,S]);var w=l(m,C[0],C[1]);return d(function(){_.hasValue=!0,_.value=w},[w]),p(w),w},xg}var k_;function w5(){return k_||(k_=1,hg.exports=j5()),hg.exports}var S5=w5();const C5=Lx(19),k5=C5?N5:R5;function tt(e,n,s,o,l){return k5(e,n,s,o,l)}function E5(e,n,s,o,l){const c=h.useCallback(()=>n(e.getSnapshot(),s,o,l),[e,n,s,o,l]);return Fd.useSyncExternalStore(e.subscribe,c,c)}rM({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let n=!1;for(let s=0;s<e.syncHooks.length;s+=1){const o=e.syncHooks[s],l=o.selector(o.store.state,o.a1,o.a2,o.a3);(o.didChange||!Object.is(o.value,l))&&(n=!0,o.value=l,o.didChange=!1)}return n&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=n=>{const s=new Set;for(const l of e.syncHooks)s.add(l.store);const o=[];for(const l of s)o.push(l.subscribe(n));return()=>{for(const l of o)l()}}),Fd.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function N5(e,n,s,o,l){const c=sM();if(!c)return E5(e,n,s,o,l);const d=c.syncIndex;c.syncIndex+=1;let f;return c.didInitialize?(f=c.syncHooks[d],(f.store!==e||f.selector!==n||!Object.is(f.a1,s)||!Object.is(f.a2,o)||!Object.is(f.a3,l))&&(f.store!==e&&(c.didChangeStore=!0),f.store=e,f.selector=n,f.a1=s,f.a2=o,f.a3=l,f.didChange=!0)):(f={store:e,selector:n,a1:s,a2:o,a3:l,value:n(e.getSnapshot(),s,o,l),didChange:!1},c.syncHooks.push(f)),f.value}function R5(e,n,s,o,l){return S5.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,c=>n(c,s,o,l))}class f2{constructor(n){this.state=n,this.listeners=new Set,this.updateTick=0}subscribe=n=>(this.listeners.add(n),()=>{this.listeners.delete(n)});getSnapshot=()=>this.state;setState(n){if(this.state===n)return;this.state=n,this.updateTick+=1;const s=this.updateTick;for(const o of this.listeners){if(s!==this.updateTick)return;o(n)}}update(n){for(const s in n)if(!Object.is(this.state[s],n[s])){this.setState({...this.state,...n});return}}set(n,s){Object.is(this.state[n],s)||this.setState({...this.state,[n]:s})}notifyAll(){const n={...this.state};this.setState(n)}use(n,s,o,l){return tt(this,n,s,o,l)}}class Vx extends f2{constructor(n,s={},o){super(n),this.context=s,this.selectors=o}useSyncedValue(n,s){h.useDebugValue(n);const o=this;Me(()=>{o.state[n]!==s&&o.set(n,s)},[o,n,s])}useSyncedValueWithCleanup(n,s){const o=this;Me(()=>(o.state[n]!==s&&o.set(n,s),()=>{o.set(n,void 0)}),[o,n,s])}useSyncedValues(n){const s=this,o=Object.values(n);Me(()=>{s.update(n)},[s,...o])}useControlledProp(n,s){h.useDebugValue(n);const o=this,l=s!==void 0;Me(()=>{l&&!Object.is(o.state[n],s)&&o.setState({...o.state,[n]:s})},[o,n,s,l])}select(n,s,o,l){const c=this.selectors[n];return c(this.state,s,o,l)}useState(n,s,o,l){return h.useDebugValue(n),tt(this,this.selectors[n],s,o,l)}useContextCallback(n,s){h.useDebugValue(n);const o=Le(s??Bn);this.context[n]=o}useStateSetter(n){const s=h.useRef(void 0);return s.current===void 0&&(s.current=o=>{this.set(n,o)}),s.current}observe(n,s){let o;typeof n=="function"?o=n:o=this.selectors[n];let l=o(this.state);return s(l,l,this),this.subscribe(c=>{const d=o(c);if(!Object.is(l,d)){const f=l;l=d,s(d,f,this)}})}}const T5={open:ze(e=>e.open),transitionStatus:ze(e=>e.transitionStatus),domReferenceElement:ze(e=>e.domReferenceElement),referenceElement:ze(e=>e.positionReference??e.referenceElement),floatingElement:ze(e=>e.floatingElement),floatingId:ze(e=>e.floatingId)};class Sf extends Vx{constructor(n){const{syncOnly:s,nested:o,onOpenChange:l,triggerElements:c,...d}=n;super({...d,positionReference:d.referenceElement,domReferenceElement:d.referenceElement},{onOpenChange:l,dataRef:{current:{}},events:w3(),nested:o,triggerElements:c},T5),this.syncOnly=s}syncOpenEvent=(n,s)=>{(!n||!this.state.open||s!=null&&hM(s))&&(this.context.dataRef.current.openEvent=n?s:void 0)};dispatchOpenChange=(n,s)=>{this.syncOpenEvent(n,s.event);const o={open:n,reason:s.reason,nativeEvent:s.event,nested:this.context.nested,triggerElement:s.trigger};this.context.events.emit("openchange",o)};setOpen=(n,s)=>{if(this.syncOnly){this.context.onOpenChange?.(n,s);return}this.dispatchOpenChange(n,s),this.context.onOpenChange?.(n,s)}}function A5(e){const{popupStore:n,treatPopupAsFloatingElement:s=!1,floatingRootContext:o,floatingId:l,nested:c,onOpenChange:d}=e,f=n.useState("open"),p=n.useState("activeTriggerElement"),m=n.useState(s?"popupElement":"positionerElement"),g=n.context.triggerElements,b=d,v=h.useRef(null);o===void 0&&v.current===null&&(v.current=new Sf({open:f,transitionStatus:void 0,referenceElement:p,floatingElement:m,triggerElements:g,onOpenChange:b,floatingId:l,syncOnly:!0,nested:c}));const S=o??v.current;return n.useSyncedValue("floatingId",l),Me(()=>{const C={open:f,floatingId:l,referenceElement:p,floatingElement:m};dt(p)&&(C.domReferenceElement=p),S.state.positionReference===S.state.referenceElement&&(C.positionReference=p),S.update(C)},[f,l,p,m,S]),S.context.onOpenChange=b,S.context.nested=c,S}function Ac(e,n=!1,s=!1){const[o,l]=h.useState(e&&n?"idle":void 0),[c,d]=h.useState(e);return e&&!c&&(d(!0),l("starting")),!e&&c&&o!=="ending"&&!s&&l("ending"),!e&&!c&&o==="ending"&&l(void 0),Me(()=>{if(!e&&c&&o!=="ending"&&s){const f=es.request(()=>{l("ending")});return()=>{es.cancel(f)}}},[e,c,o,s]),Me(()=>{if(!e||n)return;const f=es.request(()=>{l(void 0)});return()=>{es.cancel(f)}},[n,e]),Me(()=>{if(!e||!n)return;e&&c&&o!=="idle"&&l("starting");const f=es.request(()=>{l("idle")});return()=>{es.cancel(f)}},[n,e,c,o]),{mounted:c,setMounted:d,transitionStatus:o}}let po=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const M5={[po.startingStyle]:""},O5={[po.endingStyle]:""},Bl={transitionStatus(e){return e==="starting"?M5:e==="ending"?O5:null}};function z5(e,n=!1,s=!0){const o=jl();return Le((l,c=null)=>{o.cancel();const d=Os(e);if(d==null)return;const f=d,p=()=>{Rr.flushSync(l)};if(typeof f.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){l();return}function m(){Promise.all(f.getAnimations().map(g=>g.finished)).then(()=>{c?.aborted||p()}).catch(()=>{if(s){c?.aborted||p();return}const g=f.getAnimations();!c?.aborted&&g.length>0&&g.some(b=>b.pending||b.playState!=="finished")&&m()})}if(n){const g=po.startingStyle;if(!f.hasAttribute(g)){o.request(m);return}const b=new MutationObserver(()=>{f.hasAttribute(g)||(b.disconnect(),m())});b.observe(f,{attributes:!0,attributeFilter:[g]}),c?.addEventListener("abort",()=>b.disconnect(),{once:!0});return}o.request(m)})}function Or(e){const{enabled:n=!0,open:s,ref:o,onComplete:l}=e,c=Le(l),d=z5(o,s,!1);h.useEffect(()=>{if(!n)return;const f=new AbortController;return d(c,f.signal),()=>{f.abort()}},[n,s,c,d])}const Cf={tabIndex:-1,[_h]:""};function p2(e,n,s=!1){const o=_f(),l=jf()!=null,c=h.useRef(null);e===void 0&&c.current===null&&(c.current=n(o,l));const d=e??c.current;return A5({popupStore:d,treatPopupAsFloatingElement:s,floatingRootContext:d.state.floatingRootContext,floatingId:o,nested:l,onOpenChange:d.setOpen}),{store:d,internalStore:c.current}}function D5(e,n){const s=h.useRef(null),o=h.useRef(null);return h.useCallback(l=>{if(e===void 0)return;let c=!1;if(s.current!==null){const d=s.current,f=o.current,p=n.context.triggerElements.getById(d);f&&p===f&&(n.context.triggerElements.delete(d),c=!0),s.current=null,o.current=null}if(l!==null&&(s.current=e,o.current=l,n.context.triggerElements.add(e,l),c=!0),c){const d=n.context.triggerElements.size;n.select("open")&&n.state.triggerCount!==d&&n.set("triggerCount",d)}},[n,e])}function m2(e,n,s){const o=s?.id??null;(o||n)&&(e.activeTriggerId=o,e.activeTriggerElement=s??null)}function L5(e,n,s,o){const l=s.useState("isMountedByTrigger",e),c=D5(e,s),d=Le(f=>{if(c(f),!f)return;const p=s.select("open"),m=s.select("activeTriggerId");if(m===e){s.update({activeTriggerElement:f,...p?o:null});return}m==null&&p&&s.update({activeTriggerId:e,activeTriggerElement:f,...o})});return Me(()=>{l&&s.update({activeTriggerElement:n.current,...o})},[l,s,n,...Object.values(o)]),{registerTrigger:d,isMountedByThisTrigger:l}}function g2(e){const n=e.useState("open"),s=e.useState("triggerCount");Me(()=>{if(!n){e.state.triggerCount!==0&&e.set("triggerCount",0);return}const o=e.context.triggerElements.size,l={};if(e.state.triggerCount!==o&&(l.triggerCount=o),!e.select("activeTriggerId")&&o===1){const c=e.context.triggerElements.entries().next();if(!c.done){const[d,f]=c.value;l.activeTriggerId=d,l.activeTriggerElement=f}}(l.triggerCount!==void 0||l.activeTriggerId!==void 0)&&e.update(l)},[n,e,s])}function h2(e,n,s){const{mounted:o,setMounted:l,transitionStatus:c}=Ac(e);n.useSyncedValues({mounted:o,transitionStatus:c});const d=Le(()=>{l(!1),n.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n.context.onOpenChangeComplete?.(!1)}),f=n.useState("preventUnmountingOnClose");return Or({enabled:o&&!e&&!f,open:e,ref:n.context.popupRef,onComplete(){e||d()}}),{forceUnmount:d,transitionStatus:c}}function x2(e,n){e.useSyncedValues(n),Me(()=>()=>{e.update({activeTriggerProps:un,inactiveTriggerProps:un,popupProps:un})},[e])}function P5(e,n){Me(()=>{!n&&e.state.openMethod!==null&&e.set("openMethod",null)},[n,e]),Me(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class kf{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(n,s){const o=this.idMap.get(n);o!==s&&(o!==void 0&&this.elementsSet.delete(o),this.elementsSet.add(s),this.idMap.set(n,s))}delete(n){const s=this.idMap.get(n);s&&(this.elementsSet.delete(s),this.idMap.delete(n))}hasElement(n){return this.elementsSet.has(n)}hasMatchingElement(n){for(const s of this.elementsSet)if(n(s))return!0;return!1}getById(n){return this.idMap.get(n)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function I5(){return new Sf({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new kf,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function b2(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:I5(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:un,inactiveTriggerProps:un,popupProps:un}}function v2(e,n,s=!1){return new Sf({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:n,syncOnly:!0,nested:s,onOpenChange:void 0})}const sc=ze(e=>e.triggerIdProp??e.activeTriggerId),qx=ze(e=>e.openProp??e.open),E_=ze(e=>(e.popupElement?.id??e.floatingId)||void 0);function y2(e,n){return n!==void 0&&qx(e)&&sc(e)===n}function B5(e,n){return y2(e,n)?!0:n!==void 0&&qx(e)&&sc(e)==null&&e.triggerCount===1}const _2={open:qx,mounted:ze(e=>e.mounted),transitionStatus:ze(e=>e.transitionStatus),floatingRootContext:ze(e=>e.floatingRootContext),triggerCount:ze(e=>e.triggerCount),preventUnmountingOnClose:ze(e=>e.preventUnmountingOnClose),payload:ze(e=>e.payload),activeTriggerId:sc,activeTriggerElement:ze(e=>e.mounted?e.activeTriggerElement:null),popupId:E_,isTriggerActive:ze((e,n)=>n!==void 0&&sc(e)===n),isOpenedByTrigger:ze((e,n)=>y2(e,n)),isMountedByTrigger:ze((e,n)=>n!==void 0&&sc(e)===n&&e.mounted),triggerProps:ze((e,n)=>n?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:ze((e,n)=>B5(e,n)?E_(e):void 0),popupProps:ze(e=>e.popupProps),popupElement:ze(e=>e.popupElement),positionerElement:ze(e=>e.positionerElement)};function j2(e){const{open:n=!1,onOpenChange:s,elements:o={}}=e,l=_f(),c=jf()!=null,d=va(()=>new Sf({open:n,transitionStatus:void 0,onOpenChange:s,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new kf,floatingId:l,syncOnly:!1,nested:c})).current;return Me(()=>{const f={open:n,floatingId:l};o.reference!==void 0&&(f.referenceElement=o.reference,f.domReferenceElement=dt(o.reference)?o.reference:null),o.floating!==void 0&&(f.floatingElement=o.floating),d.update(f)},[n,l,o.reference,o.floating,d]),d.context.onOpenChange=s,d.context.nested=c,d}function U5(e={}){const{nodeId:n,externalTree:s}=e,o=j2(e),l=e.rootContext||o,c=l.useState("referenceElement"),d=l.useState("floatingElement"),f=l.useState("domReferenceElement"),p=l.useState("open"),m=l.useState("floatingId"),[g,b]=h.useState(null),[v,S]=h.useState(void 0),[C,_]=h.useState(void 0),w=h.useRef(null),k=Il(s),E=h.useMemo(()=>({reference:c,floating:d,domReference:f}),[c,d,f]),N=m5({...e,elements:{...E,...g&&{reference:g}}}),R=dt(v)?v:null,T=C===void 0?l.state.floatingElement:C;l.useSyncedValue("referenceElement",v??null),l.useSyncedValue("domReferenceElement",v===void 0?f:R),l.useSyncedValue("floatingElement",T);const O=h.useCallback(P=>{const H=dt(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;b(H),N.refs.setReference(H)},[N.refs]),A=h.useCallback(P=>{(dt(P)||P===null)&&(w.current=P,S(P)),(dt(N.refs.reference.current)||N.refs.reference.current===null||P!==null&&!dt(P))&&N.refs.setReference(P)},[N.refs,S]),z=h.useCallback(P=>{_(P),N.refs.setFloating(P)},[N.refs]),B=h.useMemo(()=>({...N.refs,setReference:A,setFloating:z,setPositionReference:O,domReference:w}),[N.refs,A,z,O]),L=h.useMemo(()=>({...N.elements,domReference:f}),[N.elements,f]),D=h.useMemo(()=>({...N,dataRef:l.context.dataRef,open:p,onOpenChange:l.setOpen,events:l.context.events,floatingId:m,refs:B,elements:L,nodeId:n,rootStore:l}),[N,B,L,n,l,p,m]);return Me(()=>{f&&(w.current=f)},[f]),Me(()=>{l.context.dataRef.current.floatingContext=D;const P=k?.nodesRef.current.find(H=>H.id===n);P&&(P.context=D)}),h.useMemo(()=>({...N,context:D,refs:B,elements:L,rootStore:l}),[N,B,L,D,l])}const bg=dM&&xS;function H5(e,n={}){const{enabled:s=!0,delay:o}=n,l="rootStore"in e?e.rootStore:e,{events:c,dataRef:d}=l.context,f=h.useRef(!1),p=h.useRef(null),m=h.useRef(!0),g=sa();h.useEffect(()=>{const v=l.select("domReferenceElement");if(!s)return;const S=Qt(v);function C(){const k=l.select("domReferenceElement");!l.select("open")&&Gt(k)&&k===Pn(yt(k))&&(f.current=!0)}function _(){m.current=!0}function w(){m.current=!1}return ss(ft(S,"blur",C),bg&&ft(S,"keydown",_,!0),bg&&ft(S,"pointerdown",w,!0))},[l,s]),h.useEffect(()=>{if(!s)return;function v(S){if(S.reason===hc||S.reason===Rx){const C=l.select("domReferenceElement");dt(C)&&(p.current=C,f.current=!0)}}return c.on("openchange",v),()=>{c.off("openchange",v)}},[c,s,l]);const b=h.useMemo(()=>{function v(){f.current=!1,p.current=null}return{onMouseLeave(){v()},onFocus(S){const C=S.currentTarget;if(f.current){if(p.current===C)return;v()}const _=Tn(S.nativeEvent);if(dt(_)){if(bg&&!S.relatedTarget){if(!m.current&&!xf(_))return}else if(!wM(_))return}const w=Pd(S.relatedTarget,l.context.triggerElements),{nativeEvent:k,currentTarget:E}=S,N=typeof o=="function"?o():o;if(l.select("open")&&w||N===0||N===void 0){l.setOpen(!0,lt(jd,k,E));return}g.start(N,()=>{f.current||l.setOpen(!0,lt(jd,k,E))})},onBlur(S){v();const C=S.relatedTarget,_=S.nativeEvent,w=dt(C)&&C.hasAttribute(vc("focus-guard"))&&C.getAttribute("data-type")==="outside";g.start(0,()=>{const k=l.select("domReferenceElement"),E=Pn(yt(k));!C&&E===k||Ze(d.current.floatingContext?.refs.floating.current,E)||Ze(k,E)||w||Pd(C??E,l.context.triggerElements)||l.setOpen(!1,lt(jd,_))})}}},[d,o,l,g]);return h.useMemo(()=>s?{reference:b,trigger:b}:{},[s,b])}class $x{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Ga,this.restTimeout=new Ga,this.handleCloseOptions=void 0}static create(){return new $x}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const Yd=new WeakMap;function Xd(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&Yd.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),Yd.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function w2(e,n){const{scopeElement:s,referenceElement:o,floatingElement:l}=n,c=Yd.get(s);c&&c!==e&&Xd(c),Xd(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=s,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=l,Yd.set(s,e),s.style.pointerEvents="none",o.style.pointerEvents="auto",l.style.pointerEvents="auto"}function Gx(e){const n=e.context.dataRef.current,s=va(()=>n.hoverInteractionState??$x.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=s),jx(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function V5(e,n={}){const{enabled:s=!0,closeDelay:o=0,nodeId:l}=n,c="rootStore"in e?e.rootStore:e,d=c.useState("open"),f=c.useState("floatingElement"),p=c.useState("domReferenceElement"),{dataRef:m}=c.context,g=Il(),b=jf(),v=Gx(c),S=sa(),C=Le(()=>jS(m.current.openEvent?.type,v.interactedInside)),_=Le(()=>CM(m.current.openEvent?.type)),w=Le(()=>{Xd(v)});Me(()=>{d||(v.pointerType=void 0,v.restTimeoutPending=!1,v.interactedInside=!1,w())},[d,v,w]),h.useEffect(()=>w,[w]),Me(()=>{if(s&&d&&v.handleCloseOptions?.blockPointerEvents&&_()&&dt(p)&&f){const k=p,E=f,N=yt(f),R=g?.nodesRef.current.find(z=>z.id===b)?.context?.elements.floating;R&&(R.style.pointerEvents="");const T=v.pointerEventsScopeElement!==E?v.pointerEventsScopeElement:null,O=R!==E?R:null,A=v.handleCloseOptions?.getScope?.()??T??O??k.closest("[data-rootownerid]")??N.body;return w2(v,{scopeElement:A,referenceElement:k,floatingElement:E}),()=>{w()}}},[s,d,p,f,v,_,g,b,w]),h.useEffect(()=>{if(!s)return;function k(){return!!(g&&b&&Er(g.nodesRef.current,b).length>0)}function E(z){const B=Bd(o,"close",v.pointerType),L=()=>{c.setOpen(!1,lt($n,z)),g?.events.emit("floating.closed",z)};B?v.openChangeTimeout.start(B,L):(v.openChangeTimeout.clear(),L())}function N(z){const B=Tn(z);if(!jM(B)){v.interactedInside=!1;return}v.interactedInside=B?.closest("[aria-haspopup]")!=null}function R(){v.openChangeTimeout.clear(),S.clear(),g?.events.off("floating.closed",O),w()}function T(z){if(k()&&g){g.events.on("floating.closed",O);return}if(Pd(z.relatedTarget,c.context.triggerElements))return;const B=m.current.floatingContext?.nodeId??l,L=z.relatedTarget;if(!(g&&B&&dt(L)&&Er(g.nodesRef.current,B,!1).some(P=>Ze(P.context?.elements.floating,L)))){if(v.handler){v.handler(z);return}w(),C()||E(z)}}function O(z){!g||!b||k()||S.start(0,()=>{g.events.off("floating.closed",O),c.setOpen(!1,lt($n,z)),g.events.emit("floating.closed",z)})}const A=f;return ss(A&&ft(A,"mouseenter",R),A&&ft(A,"mouseleave",T),A&&ft(A,"pointerdown",N,!0),()=>{g?.events.off("floating.closed",O)})},[s,f,c,m,o,l,C,w,v,g,b,S])}const q5={current:null};function $5(e,n={}){const{enabled:s=!0,delay:o=0,handleClose:l=null,mouseOnly:c=!1,restMs:d=0,move:f=!0,triggerElementRef:p=q5,externalTree:m,isActiveTrigger:g=!0,getHandleCloseContext:b,isClosing:v,shouldOpen:S}=n,C="rootStore"in e?e.rootStore:e,{dataRef:_,events:w}=C.context,k=Il(m),E=Gx(C),N=h.useRef(!1),R=mn(l),T=mn(o),O=mn(d),A=mn(s),z=mn(S),B=mn(v),L=Le(()=>jS(_.current.openEvent?.type,E.interactedInside)),D=Le(()=>z.current?.()!==!1),P=Le((Y,V,$)=>{const Z=C.context.triggerElements;if(Z.hasElement(V))return!Y||!Ze(Y,V);if(!dt($))return!1;const G=$;return Z.hasMatchingElement(X=>Ze(X,G))&&(!Y||!Ze(Y,G))}),H=Le(()=>{if(!E.handler)return;yt(C.select("domReferenceElement")).removeEventListener("mousemove",E.handler),E.handler=void 0}),q=Le(()=>{Xd(E)});return g&&(E.handleCloseOptions=R.current?.__options),h.useEffect(()=>H,[H]),h.useEffect(()=>{if(!s)return;function Y(V){V.open?N.current=!1:(N.current=V.reason===$n,H(),E.openChangeTimeout.clear(),E.restTimeout.clear(),E.blockMouseMove=!0,E.restTimeoutPending=!1)}return w.on("openchange",Y),()=>{w.off("openchange",Y)}},[s,w,E,H]),h.useEffect(()=>{if(!s)return;function Y(G,X=!0){const U=Bd(T.current,"close",E.pointerType);U?E.openChangeTimeout.start(U,()=>{C.setOpen(!1,lt($n,G)),k?.events.emit("floating.closed",G)}):X&&(E.openChangeTimeout.clear(),C.setOpen(!1,lt($n,G)),k?.events.emit("floating.closed",G))}const V=p.current??(g?C.select("domReferenceElement"):null);if(!dt(V))return;function $(G){if(E.openChangeTimeout.clear(),E.blockMouseMove=!1,c&&!uo(E.pointerType))return;const X=Z1(O.current),U=Bd(T.current,"open",E.pointerType),K=Tn(G),F=G.currentTarget??null,J=C.select("domReferenceElement");let ie=F;if(dt(K)&&!C.context.triggerElements.hasElement(K)){for(const Ne of C.context.triggerElements.elements())if(Ze(Ne,K)){ie=Ne;break}}dt(F)&&dt(J)&&!C.context.triggerElements.hasElement(F)&&Ze(F,J)&&(ie=J);const re=ie==null?!1:P(J,ie,K),oe=C.select("open"),ce=B.current?.()??C.select("transitionStatus")==="ending",ee=!oe&&ce&&N.current,Te=!re&&dt(ie)&&dt(J)&&Ze(J,ie)&&ee,Fe=X>0&&!U,ve=re&&(oe||ee)||Te,Ce=!oe||re;if(ve){D()&&C.setOpen(!0,lt($n,G,ie));return}Fe||(U?E.openChangeTimeout.start(U,()=>{Ce&&D()&&C.setOpen(!0,lt($n,G,ie))}):Ce&&D()&&C.setOpen(!0,lt($n,G,ie)))}function Z(G){if(L()){q();return}H();const X=C.select("domReferenceElement"),U=yt(X);E.restTimeout.clear(),E.restTimeoutPending=!1;const K=_.current.floatingContext??b?.();if(Pd(G.relatedTarget,C.context.triggerElements))return;if(R.current&&K){C.select("open")||E.openChangeTimeout.clear();const J=p.current;E.handler=R.current({...K,tree:k,x:G.clientX,y:G.clientY,onClose(){q(),H(),A.current&&!L()&&J===C.select("domReferenceElement")&&Y(G,!0)}}),U.addEventListener("mousemove",E.handler),E.handler(G);return}(E.pointerType==="touch"?!Ze(C.select("floatingElement"),G.relatedTarget):!0)&&Y(G)}return f?ss(ft(V,"mousemove",$,{once:!0}),ft(V,"mouseenter",$),ft(V,"mouseleave",Z)):ss(ft(V,"mouseenter",$),ft(V,"mouseleave",Z))},[H,q,_,T,C,s,R,E,g,P,L,c,f,O,p,k,A,b,B,D]),h.useMemo(()=>{if(!s)return;function Y(V){E.pointerType=V.pointerType}return{onPointerDown:Y,onPointerEnter:Y,onMouseMove(V){const{nativeEvent:$}=V,Z=V.currentTarget,G=C.select("domReferenceElement"),X=C.select("open"),U=P(G,Z,V.target);if(c&&!uo(E.pointerType))return;if(X&&U&&E.handleCloseOptions?.blockPointerEvents){const J=C.select("floatingElement");if(J){const ie=E.handleCloseOptions?.getScope?.()??Z.ownerDocument.body;w2(E,{scopeElement:ie,referenceElement:Z,floatingElement:J})}}const K=Z1(O.current);if(X&&!U||K===0||!U&&E.restTimeoutPending&&V.movementX**2+V.movementY**2<2)return;E.restTimeout.clear();function F(){if(E.restTimeoutPending=!1,L())return;const J=C.select("open");!E.blockMouseMove&&(!J||U)&&D()&&C.setOpen(!0,lt($n,$,Z))}E.pointerType==="touch"?Rr.flushSync(()=>{F()}):U&&X?F():(E.restTimeoutPending=!0,E.restTimeout.start(K,F))}}},[s,E,L,P,c,C,O,D])}const G5="Escape";function Ef(e,n,s){switch(e){case"vertical":return n;case"horizontal":return s;default:return n||s}}function ed(e,n){return Ef(n,e===Ex||e===Tc,e===jr||e===wr)}function vg(e,n,s){return Ef(n,e===Tc,s?e===jr:e===wr)||e==="Enter"||e===" "||e===""}function F5(e,n,s){return Ef(n,s?e===jr:e===wr,e===Tc)}function Y5(e,n,s,o){const l=s?e===wr:e===jr,c=e===Ex;return n==="both"||n==="horizontal"&&o&&o>1?e===G5:Ef(n,l,c)}function X5(e,n){const{listRef:s,activeIndex:o,onNavigate:l=()=>{},enabled:c=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:p=!1,nested:m=!1,rtl:g=!1,virtual:b=!1,focusItemOnOpen:v="auto",focusItemOnHover:S=!0,openOnArrowKeyDown:C=!0,disabledIndices:_=void 0,orientation:w="vertical",parentOrientation:k,cols:E=1,id:N,resetOnPointerLeave:R=!0,externalTree:T}=n,O="rootStore"in e?e.rootStore:e,A=O.useState("open"),z=O.useState("floatingElement"),B=O.useState("domReferenceElement"),L=O.context.dataRef,D=Id(z),P=jh(B),H=mn(D),q=jf(),Y=Il(T),V=h.useRef(v),$=h.useRef(d??-1),Z=h.useRef(null),G=h.useRef(!0),X=Le(ye=>{l($.current===-1?null:$.current,ye)}),U=h.useRef(X),K=h.useRef(!!z),F=h.useRef(A),J=h.useRef(!1),ie=h.useRef(!1),re=h.useRef(null),oe=mn(_),ce=mn(A),ee=mn(d),Te=mn(R),Fe=jl(),ve=jl(),Ce=Le(()=>{function ye(Ue){b?Y?.events.emit("virtualfocus",Ue):re.current=Sd(Ue,{sync:J.current,preventScroll:!0})}const le=s.current[$.current],je=ie.current;le&&ye(le),(J.current?Ue=>Ue():Ue=>Fe.request(Ue))(()=>{const Ue=s.current[$.current]||le;if(!Ue)return;le||ye(Ue),we&&(je||!G.current)&&Ue.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Me(()=>{L.current.orientation=w},[L,w]),Me(()=>{c&&(A&&z?($.current=d??-1,V.current&&d!=null&&(ie.current=!0,X())):K.current&&($.current=-1,U.current()))},[c,A,z,d,X]),Me(()=>{if(c){if(!A){J.current=!1;return}if(z)if(o==null){if(J.current=!1,ee.current!=null)return;if(K.current&&($.current=-1,Ce()),(!F.current||!K.current)&&V.current&&(Z.current!=null||V.current===!0&&Z.current==null)){let ye=0;const le=()=>{s.current[0]==null?(ye<2&&(ye?Se=>ve.request(Se):queueMicrotask)(le),ye+=1):($.current=Z.current==null||vg(Z.current,w,g)||m?wd(s):Ch(s),Z.current=null,X())};le()}}else bc(s.current,o)||($.current=o,Ce(),ie.current=!1)}},[c,A,z,o,ee,m,s,w,g,X,Ce,ve]),Me(()=>{if(!c||z||!Y||b||!K.current)return;const ye=Y.nodesRef.current,le=ye.find(Ue=>Ue.id===q)?.context?.elements.floating,je=Pn(yt(z)),Se=ye.some(Ue=>Ue.context&&Ze(Ue.context.elements.floating,je));le&&!Se&&G.current&&le.focus({preventScroll:!0})},[c,z,Y,q,b]),Me(()=>{U.current=X,F.current=A,K.current=!!z}),Me(()=>{A||(Z.current=null,V.current=v)},[A,v]);const Ne=o!=null,Pe=Le(ye=>{if(!ce.current)return;const le=s.current.indexOf(ye.currentTarget);le!==-1&&($.current!==le||o!==le)&&($.current=le,X(ye))}),Ie=Le(()=>k??Y?.nodesRef.current.find(ye=>ye.id===q)?.context?.dataRef?.current.orientation),be=Le(()=>wd(s,oe.current)),Ae=Le(ye=>{if(G.current=!1,J.current=!0,ye.which===229||!ce.current&&ye.currentTarget===H.current)return;if(m&&Y5(ye.key,w,g,E)){ed(ye.key,Ie())||xa(ye),O.setOpen(!1,lt(W1,ye.nativeEvent)),Gt(B)&&(b?Y?.events.emit("virtualfocus",B):B.focus());return}const le=$.current,je=wd(s,_),Se=Ch(s,_);if(P||(ye.key==="Home"&&(xa(ye),$.current=je,X(ye)),ye.key==="End"&&(xa(ye),$.current=Se,X(ye))),E>1){const Ue=Array.from({length:s.current.length},()=>({width:1,height:1})),Je=MS(Ue,E,!1),_t=Je.findIndex(Ee=>Ee!=null&&!Ps(s.current,Ee,_)),zt=Je.reduce((Ee,Re,qe)=>Re!=null&&!Ps(s.current,Re,_)?qe:Ee,-1),pe=Je[AS(Je.map(Ee=>Ee!=null?s.current[Ee]:null),{event:ye,orientation:w,loopFocus:p,rtl:g,cols:E,disabledIndices:zS([...(typeof _!="function"?_:null)||s.current.map((Ee,Re)=>Ps(s.current,Re,_)?Re:void 0),void 0],Je),minIndex:_t,maxIndex:zt,prevIndex:OS($.current>Se?je:$.current,Ue,Je,E,ye.key===Tc?"bl":ye.key===(g?jr:wr)?"tr":"tl"),stopEvent:!0})];if(pe!=null&&($.current=pe,X(ye)),w==="both")return}if(ed(ye.key,w)){if(xa(ye),A&&!b&&Pn(ye.currentTarget.ownerDocument)===ye.currentTarget){$.current=vg(ye.key,w,g)?je:Se,X(ye);return}vg(ye.key,w,g)?p?le>=Se?f&&le!==s.current.length?$.current=-1:(J.current=!1,$.current=je):$.current=Ln(s.current,{startingIndex:le,disabledIndices:_}):$.current=Math.min(Se,Ln(s.current,{startingIndex:le,disabledIndices:_})):p?le<=je?f&&le!==-1?$.current=s.current.length:(J.current=!1,$.current=Se):$.current=Ln(s.current,{startingIndex:le,decrement:!0,disabledIndices:_}):$.current=Math.max(je,Ln(s.current,{startingIndex:le,decrement:!0,disabledIndices:_})),bc(s.current,$.current)&&($.current=-1),X(ye)}}),we=h.useMemo(()=>({onFocus(le){J.current=!0,Pe(le)},onClick:({currentTarget:le})=>le.focus({preventScroll:!0}),onMouseMove(le){J.current=!0,ie.current=!1,S&&Pe(le)},onPointerLeave(le){if(!ce.current||!G.current||le.pointerType==="touch")return;J.current=!0;const je=le.relatedTarget;if(!(!S||s.current.includes(je))&&Te.current&&(re.current?.(),re.current=null,$.current=-1,X(le),!b)){const Se=H.current,Ue=Pn(yt(Se));Se&&Ze(Se,Ue)&&Se.focus({preventScroll:!0})}}}),[Pe,ce,H,S,s,X,Te,b]),Be=h.useMemo(()=>b&&A&&Ne&&{"aria-activedescendant":`${N}-${o}`},[b,A,Ne,N,o]),Xe=h.useMemo(()=>({"aria-orientation":w==="both"?void 0:w,...P?{}:Be,onKeyDown(ye){if(ye.key==="Tab"&&ye.shiftKey&&A&&!b){const le=Tn(ye.nativeEvent);if(le&&!Ze(H.current,le))return;xa(ye),O.setOpen(!1,lt(bf,ye.nativeEvent)),Gt(B)&&B.focus();return}Ae(ye)},onPointerMove(){G.current=!0}}),[Be,Ae,H,w,P,O,A,b,B]),Ye=h.useMemo(()=>{function ye(Se){O.setOpen(!0,lt(W1,Se.nativeEvent,Se.currentTarget))}function le(Se){v==="auto"&&Sx(Se.nativeEvent)&&(V.current=!b)}function je(Se){V.current=v,v==="auto"&&vS(Se.nativeEvent)&&(V.current=!0)}return{onKeyDown(Se){const Ue=O.select("open");G.current=!1;const Je=Se.key.startsWith("Arrow"),_t=F5(Se.key,Ie(),g),zt=ed(Se.key,w),pe=(m?_t:zt)||Se.key==="Enter"||Se.key.trim()==="";if(b&&Ue)return Ae(Se);if(!(!Ue&&!C&&Je)){if(pe){const Ee=ed(Se.key,Ie());Z.current=m&&Ee?null:Se.key}if(m){_t&&(xa(Se),Ue?($.current=be(),X(Se)):ye(Se));return}zt&&(ee.current!=null&&($.current=ee.current),xa(Se),!Ue&&C?ye(Se):Ae(Se),Ue&&X(Se))}},onFocus(Se){O.select("open")&&!b&&($.current=-1,X(Se))},onPointerDown:je,onPointerEnter:je,onMouseDown:le,onClick:le}},[Ae,v,be,m,X,O,C,w,Ie,g,ee,b]),De=h.useMemo(()=>({...Be,...Ye}),[Be,Ye]);return h.useMemo(()=>c?{reference:De,floating:Xe,item:we,trigger:Ye}:{},[c,De,Xe,Ye,we])}function K5(e,n){const{listRef:s,elementsRef:o,activeIndex:l,onMatch:c,onTyping:d,enabled:f=!0,resetMs:p=750,selectedIndex:m=null}=n,g="rootStore"in e?e.rootStore:e,b=g.useState("open"),v=sa(),S=h.useRef(""),C=h.useRef(m??l??-1),_=h.useRef(null),w=Le(N=>{function R(P){const H=o?.current[P];return!H||vf(H)}function T(P,H,q=0){if(P.length===0)return-1;const Y=(q%P.length+P.length)%P.length,V=H.toLocaleLowerCase();for(let $=0;$<P.length;$+=1){const Z=(Y+$)%P.length;if(!(!P[Z]?.toLocaleLowerCase().startsWith(V)||!R(Z)))return Z}return-1}const O=s.current;if(S.current.length>0&&N.key===" "&&(xa(N),d?.(!0)),S.current.length>0&&S.current[0]!==" "&&T(O,S.current)===-1&&N.key!==" "&&d?.(!1),O==null||N.key.length!==1||N.ctrlKey||N.metaKey||N.altKey)return;b&&N.key!==" "&&(xa(N),d?.(!0));const A=S.current==="";A&&(C.current=m??l??-1),O.every(P=>P?P[0]?.toLocaleLowerCase()!==P[1]?.toLocaleLowerCase():!0)&&S.current===N.key&&(S.current="",C.current=_.current),S.current+=N.key,v.start(p,()=>{S.current="",C.current=_.current,d?.(!1)});const L=((A?m??l??-1:C.current)??0)+1,D=T(O,S.current,L);D!==-1?(c?.(D),_.current=D):N.key!==" "&&(S.current="",d?.(!1))}),k=Le(N=>{const R=N.relatedTarget,T=g.select("domReferenceElement"),O=g.select("floatingElement");Ze(T,R)||Ze(O,R)||(v.clear(),S.current="",C.current=_.current,d?.(!1))});Me(()=>{!b&&m!==null||(v.clear(),_.current=null,S.current!==""&&(S.current=""))},[b,m,v]),Me(()=>{b&&S.current===""&&(C.current=m??l??-1)},[b,m,l]);const E=h.useMemo(()=>({onKeyDown:w,onBlur:k}),[w,k]);return h.useMemo(()=>f?{reference:E,floating:E}:{},[f,E])}const N_=.1,Q5=N_*N_,Bt=.5;function td(e,n,s,o,l,c){return o>=n!=c>=n&&e<=(l-s)*(n-o)/(c-o)+s}function nd(e,n,s,o,l,c,d,f,p,m){let g=!1;return td(e,n,s,o,l,c)&&(g=!g),td(e,n,l,c,d,f)&&(g=!g),td(e,n,d,f,p,m)&&(g=!g),td(e,n,p,m,s,o)&&(g=!g),g}function Z5(e,n,s){return e>=s.x&&e<=s.x+s.width&&n>=s.y&&n<=s.y+s.height}function ad(e,n,s,o,l,c){const d=Math.min(s,l),f=Math.max(s,l),p=Math.min(o,c),m=Math.max(o,c);return e>=d&&e<=f&&n>=p&&n<=m}function W5(e={}){const{blockPointerEvents:n=!1}=e,s=new Ga,o=({x:l,y:c,placement:d,elements:f,onClose:p,nodeId:m,tree:g})=>{const b=d?.split("-")[0];let v=!1,S=null,C=null,_=typeof performance<"u"?performance.now():0;function w(E,N){const R=performance.now(),T=R-_;if(S===null||C===null||T===0)return S=E,C=N,_=R,!1;const O=E-S,A=N-C,z=O*O+A*A,B=T*T*Q5;return S=E,C=N,_=R,z<B}function k(){s.clear(),p()}return function(N){s.clear();const R=f.domReference,T=f.floating;if(!R||!T||b==null||l==null||c==null)return;const{clientX:O,clientY:A}=N,z=Tn(N),B=N.type==="mouseleave",L=Ze(T,z),D=Ze(R,z);if(L&&(v=!0,!B))return;if(D&&(v=!1,!B)){v=!0;return}if(B&&dt(N.relatedTarget)&&Ze(T,N.relatedTarget))return;function P(){return!!(g&&Er(g.nodesRef.current,m).length>0)}function H(){P()||k()}if(P())return;const q=R.getBoundingClientRect(),Y=T.getBoundingClientRect(),V=l>Y.right-Y.width/2,$=c>Y.bottom-Y.height/2,Z=Y.width>q.width,G=Y.height>q.height,X=(Z?q:Y).left,U=(Z?q:Y).right,K=(G?q:Y).top,F=(G?q:Y).bottom;if(b==="top"&&c>=q.bottom-1||b==="bottom"&&c<=q.top+1||b==="left"&&l>=q.right-1||b==="right"&&l<=q.left+1){H();return}let J=!1;switch(b){case"top":J=ad(O,A,X,q.top+1,U,Y.bottom-1);break;case"bottom":J=ad(O,A,X,Y.top+1,U,q.bottom-1);break;case"left":J=ad(O,A,Y.right-1,F,q.left+1,K);break;case"right":J=ad(O,A,q.right-1,F,Y.left+1,K);break}if(J)return;if(v&&!Z5(O,A,q)){H();return}if(!B&&w(O,A)){H();return}let ie=!1;switch(b){case"top":{const re=Z?Bt/2:Bt*4,oe=Z||V?l+re:l-re,ce=Z?l-re:V?l+re:l-re,ee=c+Bt+1,Te=V||Z?Y.bottom-Bt:Y.top,Fe=V?Z?Y.bottom-Bt:Y.top:Y.bottom-Bt;ie=nd(O,A,oe,ee,ce,ee,Y.left,Te,Y.right,Fe);break}case"bottom":{const re=Z?Bt/2:Bt*4,oe=Z||V?l+re:l-re,ce=Z?l-re:V?l+re:l-re,ee=c-Bt,Te=V||Z?Y.top+Bt:Y.bottom,Fe=V?Z?Y.top+Bt:Y.bottom:Y.top+Bt;ie=nd(O,A,oe,ee,ce,ee,Y.left,Te,Y.right,Fe);break}case"left":{const re=G?Bt/2:Bt*4,oe=G||$?c+re:c-re,ce=G?c-re:$?c+re:c-re,ee=l+Bt+1,Te=$||G?Y.right-Bt:Y.left,Fe=$?G?Y.right-Bt:Y.left:Y.right-Bt;ie=nd(O,A,Te,Y.top,Fe,Y.bottom,ee,oe,ee,ce);break}case"right":{const re=G?Bt/2:Bt*4,oe=G||$?c+re:c-re,ce=G?c-re:$?c+re:c-re,ee=l-Bt,Te=$||G?Y.left+Bt:Y.right,Fe=$?G?Y.left+Bt:Y.right:Y.left+Bt;ie=nd(O,A,ee,oe,ee,ce,Te,Y.top,Fe,Y.bottom);break}}ie?v||s.start(40,H):H()}};return o.__options={...e,blockPointerEvents:n},o}const J5={..._2,disabled:ze(e=>e.disabled),instantType:ze(e=>e.instantType),isInstantPhase:ze(e=>e.isInstantPhase),trackCursorAxis:ze(e=>e.trackCursorAxis),disableHoverablePopup:ze(e=>e.disableHoverablePopup),lastOpenChangeReason:ze(e=>e.openChangeReason),closeOnClick:ze(e=>e.closeOnClick),closeDelay:ze(e=>e.closeDelay),hasViewport:ze(e=>e.hasViewport)};class Fx extends Vx{constructor(n,s,o=!1){const l=new kf,c={...e4(),...n};c.floatingRootContext=v2(l,s,o),super(c,{popupRef:h.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:l},J5)}setOpen=(n,s)=>{const o=s.reason,l=o===$n,c=n&&o===jd,d=!n&&(o===hc||o===Rx);if(s.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(n,s),s.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,s);const f=()=>{const p={open:n,openChangeReason:o};c?p.instantType="focus":d?p.instantType="dismiss":o===$n&&(p.instantType=void 0),m2(p,n,s.trigger),this.update(p)};l?Rr.flushSync(f):f()};cancelPendingOpen(n){this.state.floatingRootContext.dispatchOpenChange(!1,lt(hc,n))}static useStore(n,s){return p2(n,(l,c)=>new Fx(s,l,c)).store}}function e4(){return{...b2(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}const t4=fS(function(n){const{disabled:s=!1,defaultOpen:o=!1,open:l,disableHoverablePopup:c=!1,trackCursorAxis:d="none",actionsRef:f,onOpenChange:p,onOpenChangeComplete:m,handle:g,triggerId:b,defaultTriggerId:v=null,children:S}=n,C=Fx.useStore(g?.store,{open:o,openProp:l,activeTriggerId:v,triggerIdProp:b});_x(()=>{l===void 0&&C.state.open===!1&&o===!0&&C.update({open:!0,activeTriggerId:v})}),C.useControlledProp("openProp",l),C.useControlledProp("triggerIdProp",b),C.useContextCallback("onOpenChange",p),C.useContextCallback("onOpenChangeComplete",m);const _=C.useState("open"),w=!s&&_,k=C.useState("activeTriggerId"),E=C.useState("mounted"),N=C.useState("payload");C.useSyncedValues({trackCursorAxis:d,disableHoverablePopup:c}),C.useSyncedValue("disabled",s),g2(C);const{forceUnmount:R,transitionStatus:T}=h2(w,C),O=C.useState("isInstantPhase"),A=C.useState("instantType"),z=C.useState("lastOpenChangeReason"),B=h.useRef(null);Me(()=>{_&&s&&C.setOpen(!1,lt(wS))},[_,s,C]),Me(()=>{T==="ending"&&z===Hs||T!=="ending"&&O?(A!=="delay"&&(B.current=A),C.set("instantType","delay")):B.current!==null&&(C.set("instantType",B.current),B.current=null)},[T,O,z,A,C]),Me(()=>{w&&k==null&&C.set("payload",void 0)},[C,k,w]);const L=h.useCallback(()=>{C.setOpen(!1,lt(SS))},[C]);h.useImperativeHandle(f,()=>({unmount:R,close:L}),[R,L]);const D=w||E||!s&&d!=="none";return r.jsxs(pS.Provider,{value:C,children:[D&&r.jsx(n4,{store:C,disabled:s,trackCursorAxis:d}),typeof S=="function"?S({payload:N}):S]})});function n4({store:e,disabled:n,trackCursorAxis:s}){const o=e.useState("floatingRootContext"),l=Ux(o,{enabled:!n,referencePress:()=>e.select("closeOnClick")}),c=A3(o,{enabled:!n&&s!=="none",axis:s==="none"?void 0:s}),d=h.useMemo(()=>Da(c.reference,l.reference),[c.reference,l.reference]),f=h.useMemo(()=>Da(c.trigger,l.trigger),[c.trigger,l.trigger]),p=h.useMemo(()=>Da(Cf,c.floating,l.floating),[c.floating,l.floating]);return x2(e,{activeTriggerProps:d,inactiveTriggerProps:f,popupProps:p}),null}let oo=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=po.startingStyle]="startingStyle",e[e.endingStyle=po.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),Kd=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const a4={[Kd.popupOpen]:""},s4={[Kd.popupOpen]:"",[Kd.pressed]:""},r4={[oo.open]:""},o4={[oo.closed]:""},l4={[oo.anchorHidden]:""},S2={open(e){return e?a4:null}},i4={open(e){return e?s4:null}},Ul={open(e){return e?r4:o4},anchorHidden(e){return e?l4:null}};function zr(e){return _f(e,"base-ui")}const C2=h.createContext(void 0);function c4(){return h.useContext(C2)}let u4=(function(e){return e[e.popupOpen=Kd.popupOpen]="popupOpen",e.triggerDisabled="data-trigger-disabled",e})({});const d4=600,k2="data-base-ui-tooltip-trigger";function R_(e){if("composedPath"in e){const s=e.composedPath();for(let o=0;o<s.length;o+=1){const l=s[o];if(dt(l))return l}}const n=e.target;return dt(n)?n:null}function f4(e){let n=e;for(;n;){if(n.hasAttribute(k2))return n;const s=n.parentElement;if(s){n=s;continue}const o=n.getRootNode();n="host"in o&&dt(o.host)?o.host:null}return null}const p4=oM(function(n,s){const{render:o,className:l,style:c,handle:d,payload:f,disabled:p,delay:m,closeOnClick:g=!0,closeDelay:b,id:v,...S}=n,C=Rc(!0),_=d?.store??C;if(!_)throw new Error(Mn(82));const w=zr(v),k=_.useState("isTriggerActive",w),E=_.useState("isOpenedByTrigger",w),N=_.useState("floatingRootContext"),R=h.useRef(null),T=m??d4,O=b??0,{registerTrigger:A,isMountedByThisTrigger:z}=L5(w,R,_,{payload:f,closeOnClick:g,closeDelay:O}),B=c4(),{delayRef:L,isInstantPhase:D,hasProvider:P}=TM(N,{open:E}),H=Gx(N);_.useSyncedValue("isInstantPhase",D);const q=_.useState("disabled"),Y=p??q,V=mn(Y),$=_.useState("trackCursorAxis"),Z=_.useState("disableHoverablePopup"),G=h.useRef(!1),X=sa(),U=h.useRef(void 0);function K(){const ve=B?.delay,Ce=typeof L.current=="object"?L.current.open:void 0;let Ne=T;return P&&(Ce!==0?Ne=m??ve??T:Ne=0),Ne}function F(ve){const Ce=R.current;if(!Ce||!ve)return!1;const Ne=f4(ve);return Ne!==null&&Ne!==Ce&&Ze(Ce,Ne)}function J(ve){const Ce=F(ve);return G.current=Ce,Ce&&(H.openChangeTimeout.clear(),H.restTimeout.clear(),H.restTimeoutPending=!1,X.clear()),Ce}const ie=$5(N,{enabled:!Y,mouseOnly:!0,move:!1,handleClose:!Z&&$!=="both"?W5():null,restMs:K,delay(){const ve=typeof L.current=="object"?L.current.close:void 0;let Ce=O;return b==null&&P&&(Ce=ve),{close:Ce}},triggerElementRef:R,isActiveTrigger:k,isClosing:()=>_.select("transitionStatus")==="ending",shouldOpen(){return!G.current}}),re=H5(N,{enabled:!Y}).reference,oe=ve=>{const Ce=G.current,Ne=R_(ve),Pe=J(Ne),Ie=R.current,be=Ie&&Ne&&Ze(Ie,Ne);if(Pe&&_.select("open")&&_.select("lastOpenChangeReason")===$n){_.setOpen(!1,lt($n,ve));return}if(Ce&&!Pe&&be&&!V.current&&!_.select("open")&&Ie&&uo(U.current)){const Ae=()=>{!G.current&&!V.current&&!_.select("open")&&_.setOpen(!0,lt($n,ve,Ie))},we=K();we===0?(X.clear(),Ae()):X.start(we,Ae)}},ce=_.useState("triggerProps",z);return Ht("button",n,{state:{open:E},ref:[s,A,R],props:[ie,re,z||$!=="none"?ce:void 0,{onMouseOver(ve){oe(ve.nativeEvent)},onFocus(ve){F(R_(ve.nativeEvent))&&ve.preventBaseUIHandler()},onMouseLeave(){G.current=!1,X.clear(),U.current=void 0},onPointerEnter(ve){U.current=ve.pointerType},onPointerDown(ve){U.current=ve.pointerType,_.set("closeOnClick",g),g&&!_.select("open")&&_.cancelPendingOpen(ve.nativeEvent)},onClick(ve){g&&!_.select("open")&&_.cancelPendingOpen(ve.nativeEvent)},id:w,[u4.triggerDisabled]:Y?"":void 0,[k2]:Y?void 0:""},S],stateAttributesMapping:S2})}),E2=h.createContext(void 0);function m4(){const e=h.useContext(E2);if(e===void 0)throw new Error(Mn(70));return e}const g4=h.forwardRef(function(n,s){const{children:o,container:l,className:c,render:d,style:f,...p}=n,{portalNode:m,portalSubtree:g}=JS({container:l,ref:s,componentProps:n,elementProps:p});return!g&&!m?null:r.jsxs(h.Fragment,{children:[g,m&&Rr.createPortal(o,m)]})}),h4=h.forwardRef(function(n,s){const{keepMounted:o=!1,...l}=n;return Rc().useState("mounted")||o?r.jsx(E2.Provider,{value:o,children:r.jsx(g4,{ref:s,...l})}):null}),N2=h.createContext(void 0);function R2(){const e=h.useContext(N2);if(e===void 0)throw new Error(Mn(71));return e}const x4=h.createContext(void 0);function Yx(){return h.useContext(x4)?.direction??"ltr"}const b4=e=>({name:"arrow",options:e,async fn(n){const{x:s,y:o,placement:l,rects:c,platform:d,elements:f,middlewareData:p}=n,{element:m,padding:g=0,offsetParent:b="real"}=qs(e,n)||{};if(m==null)return{};const v=TS(g),S={x:s,y:o},C=zx(l),_=Ox(C),w=await d.getDimensions(m),k=C==="y",E=k?"top":"left",N=k?"bottom":"right",R=k?"clientHeight":"clientWidth",T=c.reference[_]+c.reference[C]-S[C]-c.floating[_],O=S[C]-c.reference[C],A=b==="real"?await d.getOffsetParent?.(m):f.floating;let z=f.floating[R]||c.floating[_];(!z||!await d.isElement?.(A))&&(z=f.floating[R]||c.floating[_]);const B=T/2-O/2,L=z/2-w[_]/2-1,D=Math.min(v[E],L),P=Math.min(v[N],L),H=D,q=z-w[_]-P,Y=z/2-w[_]/2+B,V=wh(H,Y,q),$=!p.arrow&&Mr(l)!=null&&Y!==V&&c.reference[_]/2-(Y<H?D:P)-w[_]/2<0,Z=$?Y<H?Y-H:Y-q:0;return{[C]:S[C]+Z,data:{[C]:V,centerOffset:Y-V-Z,...$&&{alignmentOffset:Z}},reset:$}}}),v4=(e,n)=>({...b4(e),options:[e,n]}),y4={name:"hide",async fn(e){const{width:n,height:s,x:o,y:l}=e.rects.reference,c=n===0&&s===0&&o===0&&l===0;return{data:{referenceHidden:(await y5().fn(e)).data?.referenceHidden||c}}}},kd={sideX:"left",sideY:"top"},_4={name:"adaptiveOrigin",async fn(e){const{x:n,y:s,rects:{floating:o},elements:{floating:l},platform:c,strategy:d,placement:f}=e,p=Qt(l),m=p.getComputedStyle(l);if(!(m.transitionDuration!=="0s"&&m.transitionDuration!==""))return{x:n,y:s,data:kd};const b=await c.getOffsetParent?.(l);let v={width:0,height:0};if(d==="fixed"&&p?.visualViewport)v={width:p.visualViewport.width,height:p.visualViewport.height};else if(b===p){const E=yt(l);v={width:E.documentElement.clientWidth,height:E.documentElement.clientHeight}}else await c.isElement?.(b)&&(v=await c.getDimensions(b));const S=ra(f);let C=n,_=s;S==="left"&&(C=v.width-(n+o.width)),S==="top"&&(_=v.height-(s+o.height));const w=S==="left"?"right":kd.sideX,k=S==="top"?"bottom":kd.sideY;return{x:C,y:_,data:{sideX:w,sideY:k}}}};function T2(e,n,s){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?s?"inline-start":"inline-end":"right",bottom:"bottom",left:o?s?"inline-end":"inline-start":"left"}[n]}function T_(e,n,s){const{rects:o,placement:l}=e;return{side:T2(n,ra(l),s),align:Mr(l)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function A2(e){const{anchor:n,positionMethod:s="absolute",side:o="bottom",sideOffset:l=0,align:c="center",alignOffset:d=0,collisionBoundary:f,collisionPadding:p=5,sticky:m=!1,arrowPadding:g=5,disableAnchorTracking:b=!1,inline:v,keepMounted:S=!1,floatingRootContext:C,mounted:_,collisionAvoidance:w,shiftCrossAxis:k=!1,nodeId:E,adaptiveOrigin:N,lazyFlip:R=!1,externalTree:T}=e,[O,A]=h.useState(null);!_&&O!==null&&A(null);const z=w.side||"flip",B=w.align||"flip",L=w.fallbackAxisSide||"end",D=typeof n=="function"?n:void 0,P=Le(D),H=D?P:n,q=mn(n),Y=mn(_),$=Yx()==="rtl",Z=O||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":$?"left":"right","inline-start":$?"right":"left"}[o],G=c==="center"?Z:`${Z}-${c}`;let X=p;const U=1,K=o==="bottom"?U:0,F=o==="top"?U:0,J=o==="right"?U:0,ie=o==="left"?U:0;typeof X=="number"?X={top:X+K,right:X+ie,bottom:X+F,left:X+J}:X&&(X={top:(X.top||0)+K,right:(X.right||0)+ie,bottom:(X.bottom||0)+F,left:(X.left||0)+J});const re={boundary:f==="clipping-ancestors"?"clippingAncestors":f,padding:X},oe=h.useRef(null),ce=mn(l),ee=mn(d),Te=typeof l!="function"?l:0,Fe=typeof d!="function"?d:0,ve=[];v&&ve.push(v),ve.push(g5(mt=>{const Nt=T_(mt,o,$),Wt=typeof ce.current=="function"?ce.current(Nt):ce.current,St=typeof ee.current=="function"?ee.current(Nt):ee.current;return{mainAxis:Wt,crossAxis:St,alignmentAxis:St}},[Te,Fe,$,o]));const Ce=B==="none"&&z!=="shift",Ne=!Ce&&(m||k||z==="shift"),Pe=z==="none"?null:b5({...re,padding:{top:X.top+U,right:X.right+U,bottom:X.bottom+U,left:X.left+U},mainAxis:!k&&z==="flip",crossAxis:B==="flip"?"alignment":!1,fallbackAxisSideDirection:L}),Ie=Ce?null:h5(mt=>{const Nt=yt(mt.elements.floating).documentElement;return{...re,rootBoundary:k?{x:0,y:0,width:Nt.clientWidth,height:Nt.clientHeight}:void 0,mainAxis:B!=="none",crossAxis:Ne,limiter:m||k?void 0:x5(Wt=>{if(!oe.current)return{};const{width:St,height:sn}=oe.current.getBoundingClientRect(),Ft=Oa(ra(Wt.placement)),dn=Ft==="y"?St:sn,On=Ft==="y"?X.left+X.right:X.top+X.bottom;return{offset:dn/2+On/2}})}},[re,m,k,X,B]);z==="shift"||B==="shift"||c==="center"?ve.push(Ie,Pe):ve.push(Pe,Ie),ve.push(v5({...re,apply({elements:{floating:mt},availableWidth:Nt,availableHeight:Wt,rects:St}){if(!Y.current)return;const sn=mt.style;sn.setProperty("--available-width",`${Nt}px`),sn.setProperty("--available-height",`${Wt}px`);const Ft=Qt(mt).devicePixelRatio||1,{x:dn,y:On,width:Kn,height:ia}=St.reference,Qn=(Math.round((dn+Kn)*Ft)-Math.round(dn*Ft))/Ft,us=(Math.round((On+ia)*Ft)-Math.round(On*Ft))/Ft;sn.setProperty("--anchor-width",`${Qn}px`),sn.setProperty("--anchor-height",`${us}px`)}}),v4(mt=>({element:oe.current||yt(mt.elements.floating).createElement("div"),padding:g,offsetParent:"floating"}),[g]),{name:"transformOrigin",fn(mt){const{elements:Nt,middlewareData:Wt,placement:St,rects:sn,y:Ft}=mt,dn=ra(St),On=Oa(dn),Kn=oe.current,ia=Wt.arrow?.x||0,Qn=Wt.arrow?.y||0,us=Kn?.clientWidth||0,zn=Kn?.clientHeight||0,ca=ia+us/2,Ia=Qn+zn/2,ds=Math.abs(Wt.shift?.y||0),it=sn.reference.height/2,Dt=typeof l=="function"?l(T_(mt,o,$)):l,Sn=ds>Dt,rn={top:`${ca}px calc(100% + ${Dt}px)`,bottom:`${ca}px ${-Dt}px`,left:`calc(100% + ${Dt}px) ${Ia}px`,right:`${-Dt}px ${Ia}px`}[dn],Rt=`${ca}px ${sn.reference.y+it-Ft}px`;return Nt.floating.style.setProperty("--transform-origin",Ne&&On==="y"&&Sn?Rt:rn),{}}},y4,N),Me(()=>{!_&&C&&C.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[_,C]);const be=h.useMemo(()=>({elementResize:!b&&typeof ResizeObserver<"u",layoutShift:!b&&typeof IntersectionObserver<"u"}),[b]),{refs:Ae,elements:we,x:Be,y:Xe,middlewareData:Ye,update:De,placement:ye,context:le,isPositioned:je,floatingStyles:Se}=U5({rootContext:C,open:S?_:void 0,placement:G,middleware:ve,strategy:s,whileElementsMounted:S?void 0:(...mt)=>__(...mt,be),nodeId:E,externalTree:T}),{sideX:Ue,sideY:Je}=Ye.adaptiveOrigin||kd,_t=je?s:"fixed",zt=h.useMemo(()=>{const mt=N?{position:_t,[Ue]:Be,[Je]:Xe}:{position:_t,...Se};return je||(mt.opacity=0),mt},[N,_t,Ue,Be,Je,Xe,Se,je]),pe=h.useRef(null);Me(()=>{if(!_)return;const mt=q.current,Nt=typeof mt=="function"?mt():mt,St=(A_(Nt)?Nt.current:Nt)||null||null;St!==pe.current&&(Ae.setPositionReference(St),pe.current=St)},[_,Ae,H,q]),h.useEffect(()=>{if(!_)return;const mt=q.current;typeof mt!="function"&&A_(mt)&&mt.current!==pe.current&&(Ae.setPositionReference(mt.current),pe.current=mt.current)},[_,Ae,H,q]),h.useEffect(()=>{if(S&&_&&we.domReference&&we.floating)return __(we.domReference,we.floating,De,be)},[S,_,we,De,be]);const Ee=ra(ye),Re=T2(o,Ee,$),qe=Mr(ye)||"center",st=!!Ye.hide?.referenceHidden;Me(()=>{R&&_&&je&&A(Ee)},[R,_,je,Ee]);const an=h.useMemo(()=>({position:"absolute",top:Ye.arrow?.y,left:Ye.arrow?.x}),[Ye.arrow]),Vt=Ye.arrow?.centerOffset!==0;return h.useMemo(()=>({positionerStyles:zt,arrowStyles:an,arrowRef:oe,arrowUncentered:Vt,side:Re,align:qe,physicalSide:Ee,anchorHidden:st,refs:Ae,context:le,isPositioned:je,update:De}),[zt,an,oe,Vt,Re,qe,Ee,st,Ae,le,je,De])}function A_(e){return e!=null&&"current"in e}function Xx(e){return e==="starting"?x3:un}function M2(e,n,{styles:s,transitionStatus:o,props:l,refs:c,hidden:d,inert:f=!1}){const p={...s};return f&&(p.pointerEvents="none"),Ht("div",e,{state:n,ref:c,props:[{role:"presentation",hidden:d,style:p},Xx(o),l],stateAttributesMapping:Ul})}const j4=h.forwardRef(function(n,s){const{render:o,className:l,anchor:c,positionMethod:d="absolute",side:f="top",align:p="center",sideOffset:m=0,alignOffset:g=0,collisionBoundary:b="clipping-ancestors",collisionPadding:v=5,arrowPadding:S=5,sticky:C=!1,disableAnchorTracking:_=!1,collisionAvoidance:w=y3,style:k,...E}=n,N=Rc(),R=m4(),T=N.useState("open"),O=N.useState("mounted"),A=N.useState("trackCursorAxis"),z=N.useState("disableHoverablePopup"),B=N.useState("floatingRootContext"),L=N.useState("instantType"),D=N.useState("transitionStatus"),P=N.useState("hasViewport"),H=A2({anchor:c,positionMethod:d,floatingRootContext:B,mounted:O,side:f,sideOffset:m,align:p,alignOffset:g,collisionBoundary:b,collisionPadding:v,sticky:C,arrowPadding:S,disableAnchorTracking:_,keepMounted:R,collisionAvoidance:w,adaptiveOrigin:P?_4:void 0}),q=h.useMemo(()=>({open:T,side:H.side,align:H.align,anchorHidden:H.anchorHidden,instant:A!=="none"?"tracking-cursor":L}),[T,H.side,H.align,H.anchorHidden,A,L]),Y=M2(n,q,{styles:H.positionerStyles,transitionStatus:D,props:E,refs:[s,N.useStateSetter("positionerElement")],hidden:!O,inert:!T||A==="both"||z});return r.jsx(N2.Provider,{value:H,children:Y})}),w4={...Ul,...Bl},S4=h.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,f=Rc(),{side:p,align:m}=R2(),g=f.useState("open"),b=f.useState("instantType"),v=f.useState("transitionStatus"),S=f.useState("popupProps"),C=f.useState("floatingRootContext"),_=f.useState("disabled"),w=f.useState("closeDelay");Or({open:g,ref:f.context.popupRef,onComplete(){g&&f.context.onOpenChangeComplete?.(!0)}}),V5(C,{enabled:!_,closeDelay:w});const k=f.useStateSetter("popupElement");return Ht("div",n,{state:{open:g,side:p,align:m,instant:b,transitionStatus:v},ref:[s,f.context.popupRef,k],props:[S,Xx(v),d],stateAttributesMapping:w4})}),C4=h.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,f=Rc(),{arrowRef:p,side:m,align:g,arrowUncentered:b,arrowStyles:v}=R2(),S=f.useState("open"),C=f.useState("instantType");return Ht("div",n,{state:{open:S,side:m,align:g,uncentered:b,instant:C},ref:[s,p],props:[{style:v,"aria-hidden":!0},d],stateAttributesMapping:Ul})}),k4=function(n){const{delay:s,closeDelay:o,timeout:l=400}=n,c=h.useMemo(()=>({delay:s,closeDelay:o}),[s,o]),d=h.useMemo(()=>({open:s,close:o}),[s,o]);return r.jsx(C2.Provider,{value:c,children:r.jsx(RM,{delay:d,timeoutMs:l,children:n.children})})};function Kx(e){return Lx(19)?e:e?"true":void 0}function E4(e){const[n,s]=h.useState({current:e,previous:null});return e!==n.current&&s({current:e,previous:n.current}),n.previous}function Ot(...e){return dS(pc(e))}function N4({delay:e=0,...n}){return r.jsx(k4,{"data-slot":"tooltip-provider",delay:e,...n})}function Qx({...e}){return r.jsx(t4,{"data-slot":"tooltip",...e})}function Zx({...e}){return r.jsx(p4,{"data-slot":"tooltip-trigger",...e})}function Wx({className:e,side:n="top",sideOffset:s=4,align:o="center",alignOffset:l=0,children:c,...d}){return r.jsx(h4,{children:r.jsx(j4,{align:o,alignOffset:l,side:n,sideOffset:s,className:"isolate z-50",children:r.jsxs(S4,{"data-slot":"tooltip-content",className:Ot("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...d,children:[c,r.jsx(C4,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}function Ii({label:e,active:n,onClick:s,isAdd:o,isSettings:l,isDefault:c,icon:d,title:f,testId:p}){const m=e.trim()||"·",{initials:g,subLabel:b}=R4(m),v=o||l?"indigo":A4(m),S=b&&!o&&!l&&!c;return r.jsxs(Qx,{children:[r.jsx(Zx,{render:r.jsxs("button",{type:"button",onClick:s,"data-testid":p,className:"group relative flex w-full cursor-pointer flex-col items-center gap-1",children:[r.jsx("span",{className:Oe("flex size-10 items-center justify-center rounded-xl text-sm font-bold transition-all",n&&"ring-2 ring-foreground ring-offset-2 ring-offset-card",o&&"border border-dashed border-muted-fg/50 bg-transparent text-muted-fg hover:bg-accent/60 hover:text-foreground",l&&"bg-muted text-muted-fg hover:bg-accent hover:text-foreground",c&&"overflow-hidden bg-muted",!o&&!l&&!c&&n&&D4(v),!o&&!l&&!c&&!n&&z4(v)),children:d??g}),S&&r.jsx("span",{className:"block max-w-[3.6rem] truncate text-[9px] leading-tight text-muted-fg group-hover:text-foreground",children:b})]})}),r.jsx(Wx,{side:"right",children:f||e})]})}function R4(e){const n=e.trim().replace(/[_\-.]+/g," ").replace(/\s+/g," ");if(!n)return{initials:"·",subLabel:null};const s=n.split(" ");if(s.length>=2)return{initials:(s[0][0]+s[1][0]).toUpperCase(),subLabel:T4(n)};const o=s[0];return o.length<=4?{initials:o[0].toUpperCase(),subLabel:o}:{initials:o[0].toUpperCase(),subLabel:o.slice(0,4)+"…"}}function T4(e){return e.length>6?e.slice(0,5)+"…":e}function A4(e){let n=0;for(let s=0;s<e.length;s++)n=n*31+e.charCodeAt(s)|0;return Y1[Math.abs(n)%Y1.length]}const M4={sky:"bg-sky-500/15 text-sky-300 hover:bg-sky-500/25",violet:"bg-violet-500/15 text-violet-300 hover:bg-violet-500/25",emerald:"bg-emerald-500/15 text-emerald-300 hover:bg-emerald-500/25",amber:"bg-amber-500/15 text-amber-300 hover:bg-amber-500/25",rose:"bg-rose-500/15 text-rose-300 hover:bg-rose-500/25",indigo:"bg-indigo-500/15 text-indigo-300 hover:bg-indigo-500/25",teal:"bg-teal-500/15 text-teal-300 hover:bg-teal-500/25",fuchsia:"bg-fuchsia-500/15 text-fuchsia-300 hover:bg-fuchsia-500/25"},O4={sky:"bg-sky-500/30 text-sky-100",violet:"bg-violet-500/30 text-violet-100",emerald:"bg-emerald-500/30 text-emerald-100",amber:"bg-amber-500/30 text-amber-100",rose:"bg-rose-500/30 text-rose-100",indigo:"bg-indigo-500/30 text-indigo-100",teal:"bg-teal-500/30 text-teal-100",fuchsia:"bg-fuchsia-500/30 text-fuchsia-100"};function z4(e){return M4[e]}function D4(e){return O4[e]}function Mt({content:e,side:n="top",children:s}){return e?r.jsxs(Qx,{children:[r.jsx(Zx,{render:s}),r.jsx(Wx,{side:n,children:e})]}):s}const O2=0,z2=1,D2=2,M_=3;var O_=Object.prototype.hasOwnProperty;function Rh(e,n){var s,o;if(e===n)return!0;if(e&&n&&(s=e.constructor)===n.constructor){if(s===Date)return e.getTime()===n.getTime();if(s===RegExp)return e.toString()===n.toString();if(s===Array){if((o=e.length)===n.length)for(;o--&&Rh(e[o],n[o]););return o===-1}if(!s||typeof e=="object"){o=0;for(s in e)if(O_.call(e,s)&&++o&&!O_.call(n,s)||!(s in n)||!Rh(e[s],n[s]))return!1;return Object.keys(n).length===o}}return e!==e&&n!==n}const zs=new WeakMap,Ds=()=>{},Un=Ds(),Th=Object,vt=e=>e===Un,ts=e=>typeof e=="function",Nr=(e,n)=>({...e,...n}),L2=e=>ts(e.then),yg={},sd={},Jx="undefined",Mc=typeof window!=Jx,Ah=typeof document!=Jx,L4=Mc&&"Deno"in window,P4=()=>Mc&&typeof window.requestAnimationFrame!=Jx,P2=(e,n)=>{const s=zs.get(e);return[()=>!vt(n)&&e.get(n)||yg,o=>{if(!vt(n)){const l=e.get(n);n in sd||(sd[n]=l),s[5](n,Nr(l,o),l||yg)}},s[6],()=>!vt(n)&&n in sd?sd[n]:!vt(n)&&e.get(n)||yg]};let Mh=!0;const I4=()=>Mh,[Oh,zh]=Mc&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Ds,Ds],B4=()=>{const e=Ah&&document.visibilityState;return vt(e)||e!=="hidden"},U4=e=>(Ah&&document.addEventListener("visibilitychange",e),Oh("focus",e),()=>{Ah&&document.removeEventListener("visibilitychange",e),zh("focus",e)}),H4=e=>{const n=()=>{Mh=!0,e()},s=()=>{Mh=!1};return Oh("online",n),Oh("offline",s),()=>{zh("online",n),zh("offline",s)}},V4={isOnline:I4,isVisible:B4},q4={initFocus:U4,initReconnect:H4},z_=!Cc.useId,hl=!Mc||L4,$4=e=>P4()?window.requestAnimationFrame(e):setTimeout(e,1),_g=hl?h.useEffect:h.useLayoutEffect,jg=typeof navigator<"u"&&navigator.connection,D_=!hl&&jg&&(["slow-2g","2g"].includes(jg.effectiveType)||jg.saveData),rd=new WeakMap,G4=e=>Th.prototype.toString.call(e),wg=(e,n)=>e===`[object ${n}]`;let F4=0;const Dh=e=>{const n=typeof e,s=G4(e),o=wg(s,"Date"),l=wg(s,"RegExp"),c=wg(s,"Object");let d,f;if(Th(e)===e&&!o&&!l){if(d=rd.get(e),d)return d;if(d=++F4+"~",rd.set(e,d),Array.isArray(e)){for(d="@",f=0;f<e.length;f++)d+=Dh(e[f])+",";rd.set(e,d)}if(c){d="#";const p=Th.keys(e).sort();for(;!vt(f=p.pop());)vt(e[f])||(d+=f+":"+Dh(e[f])+",");rd.set(e,d)}}else d=o?e.toJSON():n=="symbol"?e.toString():n=="string"?JSON.stringify(e):""+e;return d},eb=e=>{if(ts(e))try{e=e()}catch{e=""}const n=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Dh(e):"",[e,n]};let Y4=0;const Lh=()=>++Y4;async function I2(...e){const[n,s,o,l]=e,c=Nr({populateCache:!0,throwOnError:!0},typeof l=="boolean"?{revalidate:l}:l||{});let d=c.populateCache;const f=c.rollbackOnError;let p=c.optimisticData;const m=v=>typeof f=="function"?f(v):f!==!1,g=c.throwOnError;if(ts(s)){const v=s,S=[],C=n.keys();for(const _ of C)!/^\$(inf|sub)\$/.test(_)&&v(n.get(_)._k)&&S.push(_);return Promise.all(S.map(b))}return b(s);async function b(v){const[S]=eb(v);if(!S)return;const[C,_]=P2(n,S),[w,k,E,N]=zs.get(n),R=()=>{const q=w[S];return(ts(c.revalidate)?c.revalidate(C().data,v):c.revalidate!==!1)&&(delete E[S],delete N[S],q&&q[0])?q[0](D2).then(()=>C().data):C().data};if(e.length<3)return R();let T=o,O,A=!1;const z=Lh();k[S]=[z,0];const B=!vt(p),L=C(),D=L.data,P=L._c,H=vt(P)?D:P;if(B&&(p=ts(p)?p(H,D):p,_({data:p,_c:H})),ts(T))try{T=T(H)}catch(q){O=q,A=!0}if(T&&L2(T))if(T=await T.catch(q=>{O=q,A=!0}),z!==k[S][0]){if(A)throw O;return T}else A&&B&&m(O)&&(d=!0,_({data:H,_c:Un}));if(d&&!A)if(ts(d)){const q=d(T,H);_({data:q,error:Un,_c:Un})}else _({data:T,error:Un,_c:Un});if(k[S][1]=Lh(),Promise.resolve(R()).then(()=>{_({_c:Un})}),A){if(g)throw O;return}return T}}const L_=(e,n)=>{for(const s in e)e[s][0]&&e[s][0](n)},X4=(e,n)=>{if(!zs.has(e)){const s=Nr(q4,n),o=Object.create(null),l=I2.bind(Un,e);let c=Ds;const d=Object.create(null),f=(g,b)=>{const v=d[g]||[];return d[g]=v,v.push(b),()=>v.splice(v.indexOf(b),1)},p=(g,b,v)=>{e.set(g,b);const S=d[g];if(S)for(const C of S)C(b,v)},m=()=>{if(!zs.has(e)&&(zs.set(e,[o,Object.create(null),Object.create(null),Object.create(null),l,p,f]),!hl)){const g=s.initFocus(setTimeout.bind(Un,L_.bind(Un,o,O2))),b=s.initReconnect(setTimeout.bind(Un,L_.bind(Un,o,z2)));c=()=>{g&&g(),b&&b(),zs.delete(e)}}};return m(),[e,l,m,c]}return[e,zs.get(e)[4]]},K4=(e,n,s,o,l)=>{const c=s.errorRetryCount,d=l.retryCount,f=~~((Math.random()+.5)*(1<<(d<8?d:8)))*s.errorRetryInterval;!vt(c)&&d>c||setTimeout(o,f,l)},Q4=Rh,[B2,Z4]=X4(new Map),W4=Nr({onLoadingSlow:Ds,onSuccess:Ds,onError:Ds,onErrorRetry:K4,onDiscarded:Ds,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:D_?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:D_?5e3:3e3,compare:Q4,isPaused:()=>!1,cache:B2,mutate:Z4,fallback:{}},V4),J4=(e,n)=>{const s=Nr(e,n);if(n){const{use:o,fallback:l}=e,{use:c,fallback:d}=n;o&&c&&(s.use=o.concat(c)),l&&d&&(s.fallback=Nr(l,d))}return s},eO=h.createContext({}),tO="$inf$",U2=Mc&&window.__SWR_DEVTOOLS_USE__,nO=U2?window.__SWR_DEVTOOLS_USE__:[],aO=()=>{U2&&(window.__SWR_DEVTOOLS_REACT__=Cc)},sO=e=>ts(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],H2=()=>{const e=h.useContext(eO);return h.useMemo(()=>Nr(W4,e),[e])},rO=e=>(n,s,o)=>e(n,s&&((...c)=>{const[d]=eb(n),[,,,f]=zs.get(B2);if(d.startsWith(tO))return s(...c);const p=f[d];return vt(p)?s(...c):(delete f[d],p)}),o),oO=nO.concat(rO),lO=e=>function(...s){const o=H2(),[l,c,d]=sO(s),f=J4(o,d);let p=e;const{use:m}=f,g=(m||[]).concat(oO);for(let b=g.length;b--;)p=g[b](p);return p(l,c||f.fetcher||null,f)},iO=(e,n,s)=>{const o=n[e]||(n[e]=[]);return o.push(s),()=>{const l=o.indexOf(s);l>=0&&(o[l]=o[o.length-1],o.pop())}};aO();const Sg=Cc.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(n=>{e.status="fulfilled",e.value=n},n=>{e.status="rejected",e.reason=n}),e}}),Cg={dedupe:!0},P_=Promise.resolve(Un),cO=()=>Ds,uO=(e,n,s)=>{const{cache:o,compare:l,suspense:c,fallbackData:d,revalidateOnMount:f,revalidateIfStale:p,refreshInterval:m,refreshWhenHidden:g,refreshWhenOffline:b,keepPreviousData:v,strictServerPrefetchWarning:S}=s,[C,_,w,k]=zs.get(o),[E,N]=eb(e),R=h.useRef(!1),T=h.useRef(!1),O=h.useRef(E),A=h.useRef(n),z=h.useRef(s),B=()=>z.current,L=()=>B().isVisible()&&B().isOnline(),[D,P,H,q]=P2(o,E),Y=h.useRef({}).current,V=vt(d)?vt(s.fallback)?Un:s.fallback[E]:d,$=(be,Ae)=>{for(const we in Y){const Be=we;if(Be==="data"){if(!l(be[Be],Ae[Be])&&(!vt(be[Be])||!l(re,Ae[Be])))return!1}else if(Ae[Be]!==be[Be])return!1}return!0},Z=!R.current,G=h.useMemo(()=>{const be=D(),Ae=q(),we=De=>{const ye=Nr(De);return delete ye._k,(()=>{if(!E||!n||B().isPaused())return!1;if(Z&&!vt(f))return f;const je=vt(V)?ye.data:V;return vt(je)||p})()?{isValidating:!0,isLoading:!0,...ye}:ye},Be=we(be),Xe=be===Ae?Be:we(Ae);let Ye=Be;return[()=>{const De=we(D());return $(De,Ye)?(Ye.data=De.data,Ye.isLoading=De.isLoading,Ye.isValidating=De.isValidating,Ye.error=De.error,Ye):(Ye=De,De)},()=>Xe]},[o,E]),X=Fd.useSyncExternalStore(h.useCallback(be=>H(E,(Ae,we)=>{$(we,Ae)||be()}),[o,E]),G[0],G[1]),U=C[E]&&C[E].length>0,K=X.data,F=vt(K)?V&&L2(V)?Sg(V):V:K,J=X.error,ie=h.useRef(F),re=v?vt(K)?vt(ie.current)?F:ie.current:K:F,oe=E&&vt(F),ce=h.useRef(null);!hl&&Fd.useSyncExternalStore(cO,()=>(ce.current=!1,ce),()=>(ce.current=!0,ce));const ee=ce.current;S&&ee&&!c&&oe&&console.warn(`Missing pre-initiated data for serialized key "${E}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);const Te=!E||!n||B().isPaused()||U&&!vt(J)?!1:Z&&!vt(f)?f:c?vt(F)?!1:p:vt(F)||p,Fe=Z&&Te,ve=vt(X.isValidating)?Fe:X.isValidating,Ce=vt(X.isLoading)?Fe:X.isLoading,Ne=h.useCallback(async be=>{const Ae=A.current;if(!E||!Ae||T.current||B().isPaused())return!1;let we,Be,Xe=!0;const Ye=be||{},De=!w[E]||!Ye.dedupe,ye=()=>z_?!T.current&&E===O.current&&R.current:E===O.current,le={isValidating:!1,isLoading:!1},je=()=>{P(le)},Se=()=>{const Je=w[E];Je&&Je[1]===Be&&delete w[E]},Ue={isValidating:!0};vt(D().data)&&(Ue.isLoading=!0);try{if(De&&(P(Ue),s.loadingTimeout&&vt(D().data)&&setTimeout(()=>{Xe&&ye()&&B().onLoadingSlow(E,s)},s.loadingTimeout),w[E]=[Ae(N),Lh()]),[we,Be]=w[E],we=await we,De&&setTimeout(Se,s.dedupingInterval),!w[E]||w[E][1]!==Be)return De&&ye()&&B().onDiscarded(E),!1;le.error=Un;const Je=_[E];if(!vt(Je)&&(Be<=Je[0]||Be<=Je[1]||Je[1]===0))return je(),De&&ye()&&B().onDiscarded(E),!1;const _t=D().data;le.data=l(_t,we)?_t:we,De&&ye()&&B().onSuccess(we,E,s)}catch(Je){Se();const _t=B(),{shouldRetryOnError:zt}=_t;_t.isPaused()||(le.error=Je,De&&ye()&&(_t.onError(Je,E,_t),(zt===!0||ts(zt)&&zt(Je))&&(!B().revalidateOnFocus||!B().revalidateOnReconnect||L())&&_t.onErrorRetry(Je,E,_t,pe=>{const Ee=C[E];Ee&&Ee[0]&&Ee[0](M_,pe)},{retryCount:(Ye.retryCount||0)+1,dedupe:!0})))}return Xe=!1,je(),!0},[E,o]),Pe=h.useCallback((...be)=>I2(o,O.current,...be),[]);if(_g(()=>{A.current=n,z.current=s,vt(K)||(ie.current=K)}),_g(()=>{if(!E)return;const be=Ne.bind(Un,Cg);let Ae=0;B().revalidateOnFocus&&(Ae=Date.now()+B().focusThrottleInterval);const Be=iO(E,C,(Xe,Ye={})=>{if(Xe==O2){const De=Date.now();B().revalidateOnFocus&&De>Ae&&L()&&(Ae=De+B().focusThrottleInterval,be())}else if(Xe==z2)B().revalidateOnReconnect&&L()&&be();else{if(Xe==D2)return Ne();if(Xe==M_)return Ne(Ye)}});return T.current=!1,O.current=E,R.current=!0,P({_k:N}),Te&&(w[E]||(vt(F)||hl?be():$4(be))),()=>{T.current=!0,Be()}},[E]),_g(()=>{let be;function Ae(){const Be=ts(m)?m(D().data):m;Be&&be!==-1&&(be=setTimeout(we,Be))}function we(){!D().error&&(g||B().isVisible())&&(b||B().isOnline())?Ne(Cg).then(Ae):Ae()}return Ae(),()=>{be&&(clearTimeout(be),be=-1)}},[m,g,b,E]),h.useDebugValue(re),c){if(!z_&&hl&&oe)throw new Error("Fallback data is required when using Suspense in SSR.");oe&&(A.current=n,z.current=s,T.current=!1);const be=k[E],Ae=!vt(be)&&oe?Pe(be):P_;if(Sg(Ae),!vt(J)&&oe)throw J;const we=oe?Ne(Cg):P_;!vt(re)&&oe&&(we.status="fulfilled",we.value=!0),Sg(we)}return{mutate:Pe,get data(){return Y.data=!0,re},get error(){return Y.error=!0,J},get isValidating(){return Y.isValidating=!0,ve},get isLoading(){return Y.isLoading=!0,Ce}}},Qe=lO(uO);let Sl=null;function so(e){Sl=e}function tb(){return Sl}class Oc extends Error{status;body;constructor(n,s,o){super(s),this.status=n,this.body=o}}async function Bi(e,n,s,o={}){const l={"content-type":"application/json",...Sl?{authorization:`Bearer ${Sl}`}:{},...o.headers||{}},c=await fetch(n,{...o,method:e,headers:l,body:s!==void 0?JSON.stringify(s):void 0});if(!c.ok){let d="",f=null;try{f=await c.json(),d=f?.error||JSON.stringify(f)}catch{d=await c.text()}throw new Oc(c.status,`${e} ${n} → ${c.status}: ${d}`,f)}if(c.status!==204)return await c.json()}const me={get:e=>Bi("GET",e),post:(e,n)=>Bi("POST",e,n),put:(e,n)=>Bi("PUT",e,n),patch:(e,n)=>Bi("PATCH",e,n),del:e=>Bi("DELETE",e)};async function V2(e,n,s,o){const l=await fetch(e,{method:"POST",signal:o,headers:{"content-type":"application/json",...Sl?{authorization:`Bearer ${Sl}`}:{}},body:JSON.stringify(n)});if(!l.ok||!l.body){const p=await l.text().catch(()=>"");throw new Oc(l.status,`POST ${e} → ${l.status}: ${p||"stream failed"}`)}const c=l.body.getReader(),d=new TextDecoder("utf-8");let f="";for(;;){const{value:p,done:m}=await c.read();if(m)break;f+=d.decode(p,{stream:!0});let g=f.indexOf(`
592
+ `);for(;g>=0;){const b=f.slice(0,g).trim();if(f=f.slice(g+1),b)try{s(JSON.parse(b))}catch{}g=f.indexOf(`
593
+ `)}}if(f.trim())try{s(JSON.parse(f.trim()))}catch{}}const dO={get:()=>me.get("/health")},aa={list:()=>me.get("/projects"),register:e=>me.post("/projects",{path:e}),remove:e=>me.del(`/projects/${encodeURIComponent(e)}`),rebuild:e=>me.post(`/projects/${encodeURIComponent(e)}/rebuild`),config:{show:e=>me.get(`/projects/${e}/config`),set:(e,n)=>me.patch(`/projects/${e}/config`,{set:n}),unset:(e,n)=>me.patch(`/projects/${e}/config`,{unset:n}),put:(e,n)=>me.put(`/projects/${e}/config`,n)},apcProject:{set:(e,n,s)=>me.patch(`/projects/${e}/apc-project`,{set:n,unset:s}),put:(e,n)=>me.put(`/projects/${e}/apc-project`,n)},memory:{get:e=>me.get(`/projects/${e}/memory`),put:(e,n)=>me.put(`/projects/${e}/memory`,{body:n})}},tn={list:e=>me.get(`/projects/${e}/agents`),get:(e,n)=>me.get(`/projects/${e}/agents/${n}`),create:(e,n)=>me.post(`/projects/${e}/agents`,n),update:(e,n,s)=>me.patch(`/projects/${e}/agents/${encodeURIComponent(n)}`,s),remove:(e,n)=>me.del(`/projects/${e}/agents/${encodeURIComponent(n)}`),chat:(e,n,s)=>me.post(`/projects/${e}/agents/${encodeURIComponent(n)}/chat`,s),memory:{get:(e,n)=>me.get(`/projects/${e}/agents/${n}/memory`),put:(e,n,s)=>me.put(`/projects/${e}/agents/${n}/memory`,{body:s})},vault:e=>me.get(e?.includeRemoved?"/agents/vault?include_removed=1":"/agents/vault"),vaultCreate:(e,n={},s="")=>me.post("/agents/vault",{slug:e,fields:n,body:s}),vaultPatch:(e,n)=>me.patch(`/agents/vault/${encodeURIComponent(e)}`,n),vaultRemove:e=>me.del(`/agents/vault/${encodeURIComponent(e)}`),vaultRestore:e=>me.post(`/agents/vault/${encodeURIComponent(e)}/restore`),import:(e,n)=>me.post(`/projects/${e}/agents/import`,{slug:n})},nb={list:(e,n)=>me.get(`/projects/${e}/agents/${n}/conversations`),get:(e,n,s)=>me.get(`/projects/${e}/agents/${n}/conversations/${s}`),compact:(e,n,s)=>me.post(s?`/projects/${e}/agents/${n}/conversations/${s}/compact`:`/projects/${e}/agents/${n}/compact`,{})},xr={list:e=>me.get(`/projects/${e}/routines`),get:(e,n)=>me.get(`/projects/${e}/routines/${n}`),run:(e,n)=>me.post(`/projects/${e}/routines/${n}/run`),enable:(e,n)=>me.post(`/projects/${e}/routines/${n}/enable`),disable:(e,n)=>me.post(`/projects/${e}/routines/${n}/disable`),upsert:(e,n)=>me.post(`/projects/${e}/routines`,n),remove:(e,n)=>me.del(`/projects/${e}/routines/${encodeURIComponent(n)}`)},br={list:(e,n="open")=>me.get(`/projects/${e}/tasks?state=${n}`),global:(e="open")=>me.get(`/tasks?state=${e}`),add:(e,n)=>me.post(`/projects/${e}/tasks`,n),done:(e,n)=>me.post(`/projects/${e}/tasks/${n}/done`),drop:(e,n)=>me.post(`/projects/${e}/tasks/${n}/drop`),reopen:(e,n)=>me.post(`/projects/${e}/tasks/${n}/reopen`)},vr={list:e=>me.get(`/projects/${e}/mcps`),check:e=>me.get(`/projects/${e}/mcps/check`),add:(e,n,s)=>me.post(`/projects/${e}/mcps?scope=${n}`,s),remove:(e,n,s="shared")=>me.del(`/projects/${e}/mcps/${encodeURIComponent(n)}?scope=${s}`),test:(e,n)=>me.post(`/projects/${e}/mcps/${encodeURIComponent(n)}/test`,{}),logs:(e,n)=>me.get(`/projects/${e}/mcps/${encodeURIComponent(n)}/logs`)},yc={list:(e,n={})=>me.get(`/projects/${e}/vars${n.reveal?"?reveal=1":""}`),get:(e,n,s={})=>me.get(`/projects/${e}/vars/${encodeURIComponent(n)}${s.reveal?"?reveal=1":""}`),upsert:(e,n)=>me.post(`/projects/${e}/vars`,n),remove:(e,n,s="project")=>me.del(`/projects/${e}/vars/${encodeURIComponent(n)}?scope=${s}`)},kg=e=>{const n=new URLSearchParams;for(const[o,l]of Object.entries(e))l!==void 0&&l!==""&&n.set(o,String(l));const s=n.toString();return s?`?${s}`:""},Ph={global:(e={})=>me.get(`/messages/global${kg(e)}`),project:(e,n={})=>me.get(`/projects/${e}/messages${kg(n)}`),search:(e,n,s=50)=>me.get(`/projects/${e}/messages/search${kg({q:n,limit:s})}`)},fO={global:e=>me.get(`/sessions${e?`?engine=${encodeURIComponent(e)}`:""}`)},pO={list:()=>me.get("/tools")},An={channels:{list:()=>me.get("/telegram/channels"),upsert:e=>me.post("/telegram/channels",e),patch:(e,n)=>me.patch(`/telegram/channels/${e}`,n),remove:e=>me.del(`/telegram/channels/${encodeURIComponent(e)}`)},contacts:{list:()=>me.get("/telegram/contacts"),patch:(e,n)=>me.patch(`/telegram/contacts/${encodeURIComponent(String(e))}`,n),remove:e=>me.del(`/telegram/contacts/${encodeURIComponent(String(e))}`)},roles:{list:()=>me.get("/telegram/roles"),set:(e,n)=>me.put(`/telegram/roles/${encodeURIComponent(e)}`,{tools:n}),remove:e=>me.del(`/telegram/roles/${encodeURIComponent(e)}`)},status:()=>me.get("/telegram/status"),start:()=>me.post("/telegram/start"),stop:()=>me.post("/telegram/stop"),send:e=>me.post("/telegram/send",e)},Qd={list:()=>me.get("/engines"),models:e=>me.post("/engines/models",e)},Cl={reload:()=>me.post("/admin/reload"),shutdown:()=>me.post("/admin/shutdown"),config:{get:()=>me.get("/admin/config"),patch:e=>me.patch("/admin/config",e)},superAgent:()=>me.get("/admin/super-agent"),logs:(e="errors",n=200)=>me.get(`/admin/logs?file=${e}&limit=${n}`)},kl={list:()=>me.get("/pair/list"),revoke:e=>me.del(`/pair/revoke/${encodeURIComponent(e)}`),init:()=>me.post("/pair/init",{}),status:e=>me.get(`/pair/status/${encodeURIComponent(e)}`),confirm:e=>me.post("/pair/confirm",e)},I_={get:()=>me.get("/identity"),patch:e=>me.patch("/identity",e)},q2={send:(e,n)=>me.post(`/projects/${e}/super-agent/chat`,n),stream:(e,n,s,o)=>V2(`/projects/${e}/super-agent/chat/stream`,n,s,o),summarize:e=>me.post("/super-agent/summarize",e)},mO={dirs:e=>me.get(`/admin/fs/dirs?path=${encodeURIComponent(e)}`)},gO=["alloy","echo","fable","onyx","nova","shimmer"],hO=["Kore","Puck","Charon","Fenrir","Aoede"],xO=["eleven_multilingual_v2","eleven_turbo_v2_5","eleven_flash_v2_5"],bO=["tts-1","tts-1-hd"],vO=["tiny","base","small","medium","large-v2","large-v3"],Zd={piper:{name:"Piper",note:"Local, offline (CLI + modelo .onnx). Sin API key.",local:!0},elevenlabs:{name:"ElevenLabs",note:"Cloud, multilingüe. Requiere API key."},openai:{name:"OpenAI",note:"Cloud (tts-1 / tts-1-hd). Usa la key de OpenAI."},gemini:{name:"Gemini",note:"Cloud (preview). Usa la key de Gemini."},mock:{name:"Mock",note:"Silencio de prueba. Fallback siempre disponible.",local:!0}};async function yO(e){const n=tb(),s=await fetch(`/voice/tts?path=${encodeURIComponent(e)}`,{headers:n?{authorization:`Bearer ${n}`}:{}});if(!s.ok){const l=await s.text().catch(()=>"");throw new Error(`No se pudo leer el audio (${s.status}): ${l.slice(0,160)}`)}const o=await s.blob();return URL.createObjectURL(o)}const $2={providers:()=>me.get("/tts/providers"),say:e=>me.post("/tts/say",e),turn:e=>me.post("/voice/turn",e)},B_={manifest:()=>me.get("/deck/manifest"),setWidget:(e,n)=>me.patch(`/deck/widgets/${encodeURIComponent(e)}`,n),exec:e=>me.post("/deck/exec",e)},to=e=>`/projects/${e}/code/sessions`,As={sessions:{list:e=>me.get(to(e)).then(n=>n.sessions),get:(e,n)=>me.get(`${to(e)}/${n}`),create:(e,n={})=>me.post(to(e),n),update:(e,n,s)=>me.patch(`${to(e)}/${n}`,s),remove:(e,n)=>me.del(`${to(e)}/${n}`)},changes:(e,n)=>me.get(`${to(e)}/${n}/changes`),stream:(e,n,s,o,l)=>V2(`${to(e)}/${n}/chat/stream`,s,o,l)},xl={list:e=>me.get(`/projects/${encodeURIComponent(e)}/artifacts`),read:(e,n)=>me.get(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(n)}`),run:(e,n,s=[])=>me.post(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(n)}/run`,{args:s}),remove:(e,n)=>me.del(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(n)}`),write:(e,n,s)=>me.patch(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(n)}`,{content:s}),rename:(e,n,s)=>me.patch(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(n)}`,{newName:s})},Qi={list:e=>me.get(e?`/skills?project_path=${encodeURIComponent(e)}`:"/skills"),inspector:()=>me.get("/skills/inspector"),updateInspector:e=>me.put("/skills/inspector",e),index:(e={})=>me.post("/skills/index",e),inspect:(e,n)=>me.post("/skills/inspect",{prompt:e,project_path:n})};function zc(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/projects",()=>aa.list(),{refreshInterval:ff.projects});return{projects:(e||[]).slice().sort((c,d)=>{const f=Number(c.id),p=Number(d.id);return f===0&&p!==0?-1:p===0&&f!==0?1:f-p}),error:n,isLoading:s,mutate:o}}function ab(e){const{projects:n,isLoading:s,mutate:o}=zc();return{project:n.find(c=>String(c.id)===e)??null,isLoading:s,mutate:o}}const _O={common:{loading:"Cargando…",saving:"Guardando…",cancel:"Cancelar",save:"Guardar",delete:"Borrar",edit:"Editar",create:"Crear",add:"Agregar",remove:"Quitar",reload:"Recargar",shutdown:"Apagar",enabled:"Habilitado",disabled:"Deshabilitado",enable:"Habilitar",disable:"Deshabilitar",open:"Abrir",close:"Cerrar",confirm:"Confirmar",optional:"(opcional)",none:"—",none_yet:"Todavía no hay nada.",error_generic:"Algo salió mal.",search:"Buscar",new:"Nuevo",restore:"Restaurar",show:"Mostrar",hide:"Ocultar",copy:"Copiar",run:"Ejecutar"},daemon:{connecting:"Conectando con el daemon…",unreachable:"No pude llegar al daemon en localhost:7430.",unreachable_hint:"Arrancá APX con `apx daemon start` y refrescá.",version:"Versión",uptime:"Uptime",status:"Status",running:"running",down:"down",reload_hint:"POST /admin/reload — relee ~/.apx/config.json sin reiniciar.",shutdown_confirm:"¿Apagar el daemon? Las próximas requests fallarán hasta levantarlo de nuevo.",shutdown_done:"Daemon detenido."},pairing:{title:"Vincular este equipo",subtitle:"Estás entrando desde fuera de esta máquina. Por seguridad, vinculá este navegador con un código de pairing.",steps_title:"Cómo obtener el código",step_1:"En la PC donde corre APX, abrí una terminal.",step_2:"Ejecutá `apx pair` (o escaneá el QR con APX Deck).",step_3:"Copiá el código que aparece debajo del QR y pegalo acá.",code_label:"Código de pairing",code_ph:"p. ej. 7f3a1c9e-…",label_label:"Nombre de este equipo",label_ph:"p. ej. Notebook del living",submit:"Vincular",linking:"Vinculando…",success:"Equipo vinculado ✓",err_required:"Pegá el código de pairing.",err_expired:"El código expiró. Volvé a correr `apx pair` y probá de nuevo.",err_unknown:"Código desconocido o ya usado. Generá uno nuevo con `apx pair`.",err_generic:"No se pudo vincular. Revisá el código e intentá otra vez.",revoke_hint:"Podés revocar este equipo cuando quieras desde Settings o con `apx pair revoke`."},nav:{apx_admin:"APX",settings:"Settings",project:"Proyecto",add_project:"Agregar proyecto",modules:{voice:"Voces",desktop:"Escritorio",deck:"Deck",code:"Code"}},topbar:{breadcrumb_root:"APX",breadcrumb_settings:"APX › Settings",breadcrumb_project:"APX › Proyecto",breadcrumb_base:"Base",breadcrumb_projects:"Proyectos",light:"Cambiar a claro",dark:"Cambiar a oscuro",lang_toggle:"Idioma"},admin:{title:"APX",subtitle:"Panel general. Configuración global, canales y proyectos.",engines_title:"Engines",engines_subtitle:"Adaptadores LLM disponibles. Las API keys viven en ~/.apx/config.json.",telegram_title:"Telegram",telegram_subtitle:"Canales configurados. Cada uno puede estar pineado a un proyecto.",telegram_polling_on:"Polling activo",telegram_polling_off:"Deshabilitado",telegram_add_channel:"Canal",telegram_send_test:"Probar",telegram_send_test_title:"Enviar a",telegram_default_message:"Mensaje de prueba desde el panel de APX ✅",projects_title:"Proyectos registrados",projects_subtitle:"Click en un proyecto para abrir su panel.",unregister:"Desregistrar",unregister_confirm:"¿Quitar {label} de APX? La carpeta no se borra; sólo se desregistra.",reload_success:"Config recargada.",telegram_polling_started:"Polling iniciado.",telegram_polling_stopped:"Polling detenido.",telegram_channel_removed:"Canal eliminado.",agents_badge:"agents",engine_badge:"sí",engine_badge_no:"no",base_label:"Base"},add_project:{title:"Agregar proyecto",subtitle:"APX indexará .apc/, agents y AGENTS.md en esa carpeta.",path_label:"Ruta absoluta",path_hint:"Equivalente a apx project add /ruta/al/proyecto",path_placeholder:"/Volumes/SSDT7Shield/proyectos_varios/mi-proyecto",register:"Registrar",path_required:"Ruta requerida.",registered:"Proyecto #{id} registrado.",search_btn:"Buscar",browser_unavailable:"Explorador no disponible hasta reiniciar daemon. Pegá ruta manual.",no_folders:"Sin carpetas."},settings:{title:"Settings",subtitle:"Preferencias del panel + diagnóstico del daemon local.",appearance:"Apariencia",light_mode:"Claro",dark_mode:"Oscuro",language:"Idioma",daemon:"Daemon",daemon_sub:"Estado del proceso local que sirve esta web y orquesta los agentes.",engines:"Engines disponibles",engines_sub:"Adaptadores LLM compilados con el daemon.",token:"Token para esta sesión",token_sub:"Si esta web no logró auto-cargar el token, pegalo acá.",token_active:"(ya hay token activo)",token_paste:"Pegá el bearer del daemon",token_saved:"Token guardado.",devices:"Dispositivos pareados",devices_sub:"GET /pair/list. Revocar invalida ese bearer en el daemon.",devices_empty:"No hay clientes pareados todavía.",devices_revoke_confirm:"Revocar cliente {id}?",devices_revoke_success:"Cliente revocado.",devices_pair_btn:"Vincular dispositivo",devices_pair_title:"Vincular dispositivo",devices_pair_desc:"Escaneá el QR con la cámara del celu para entrar directo, o pegá el código en la otra PC.",devices_pair_scan:"Escaneá con la cámara del teléfono — te abre la web ya vinculada.",devices_pair_code:"O pegá este código en la pantalla de pairing:",devices_pair_url:"URL de acceso",devices_pair_link:"O copiá este link y abrilo en el otro dispositivo (entra solo):",devices_pair_copy:"Copiar",devices_pair_copied:"Link copiado al portapapeles.",devices_pair_copied_code:"Código copiado.",devices_pair_expires:"Expira en {s}s",devices_pair_expired:"El código expiró.",devices_pair_regen:"Generar otro",devices_pair_waiting:"Esperando que el dispositivo confirme…",devices_pair_done:"Dispositivo vinculado ✓",devices_pair_localhost_only:"Solo se pueden generar códigos desde la PC del daemon (localhost).",devices_last_seen:"visto:",devices_never:"nunca",devices_revoke:"Revocar",account_section:"Cuenta",agents_section:"Agentes & modelos",channels_section:"Canales & dispositivos",advanced_section:"Avanzado",tabs:{identity:"Identidad",super_agent:"Super-agente",engines:"Engines & modelos",telegram:"Telegram",devices:"Dispositivos",advanced:"Avanzado"},identity:{title:"Identidad",subtitle:"Datos del usuario. Configuración del agente va en Super-agente.",agent_name:"Nombre del agente",owner_name:"Tu nombre",personality:"Personalidad",owner_context:"Contexto del dueño",owner_context_hint:"Quién sos, en qué trabajás, qué le interesa al agente saber de vos.",language:"Idioma preferido",timezone:"Timezone (IANA)",timezone_hint:"ej. America/Argentina/Buenos_Aires",saved:"Identidad guardada."},super_agent:{title:"Super-agente",subtitle:"Personalidad, modelo, prompt y modos del super-agente.",personality:"Personalidad",model:"Modelo activo",model_hint:"Ej: anthropic:claude-sonnet-4.5, ollama:gemma2:9b",permission_mode:"Permission mode",system:"Prompt extra (system)",system_hint:"Texto que se prepende al system prompt base.",fallback_title:"Fallback chain",fallback_hint:"Si el modelo activo falla, prueba estos en orden.",fallback_add:"Agregar modelo a la cadena",saved:"Super-agente guardado.",enabled_label:"Super-agente habilitado",model_active:"Modelo activo (router)",model_configure:"Configurar en Modelos",behavior_subtitle:"Comportamiento del super-agente. El modelo y la cadena de fallback se configuran en el Router de modelos."},engines_keys:{title:"API keys de modelos",subtitle:"Cada engine guarda su key en ~/.apx/config.json. Los valores ya seteados muestran sufijo seguro.",ollama_url:"Ollama URL",ollama_hint:"Por defecto: http://127.0.0.1:11434",key_label:"API key",key_placeholder:"(no seteada)",clear:"Borrar key",saved:"Key guardada.",cleared:"Key borrada."},telegram_global:{title:"Telegram (default)",subtitle:"Canal default — los proyectos pueden overridear con su propio canal.",bot_token:"Bot token",chat_id:"Chat ID por defecto",poll_interval:"Poll interval (ms)",respond_with_engine:"Respond with engine",enabled:"Polling habilitado",saved:"Telegram guardado."},advanced:{title:"Avanzado",subtitle:"Editor raw del ~/.apx/config.json. Los secretos se ven *** set *** pero podés escribir uno nuevo.",write:"Aplicar cambios",written:"Config aplicada y daemon recargado.",reload_success:"Config recargada."}},project:{not_found:"Proyecto {pid} no encontrado.",rebuild:"Rebuild context",rebuild_done:"Rebuild OK.",unregister_confirm:"¿Desregistrar {label}? La carpeta no se borra.",unregistered:"Desregistrado.",base_subtitle:"Espacio general · super-agente",danger:{title:"Zona peligrosa",subtitle:"Acciones que afectan el registro del proyecto en APX. No tocan archivos del repo.",rebuild_desc:"Re-escanea .apc/, MCPs y agents y regenera el contexto del super-agente para este proyecto.",unregister_desc:"Quita el proyecto del registry de APX. La carpeta del disco se mantiene intacta.",rebuild_confirm_title:"Rebuild context",rebuild_confirm_desc:"Regenerar contexto de {label}.",rebuild_long:"Vuelve a leer la config APC, lista MCPs y agents disponibles, y reconstruye el system prompt del super-agente. Es seguro de correr — no borra nada. Usalo después de tocar .apc/ a mano o si los cambios no se reflejan.",unregister_confirm_title:"Desregistrar proyecto",unregister_long:"El proyecto deja de aparecer en `apx`. Los archivos del disco (.apc/, código, todo) se mantienen. Podés volver a registrarlo con `apx project register <path>`."},nav:{overview:"Overview",chat:"Chat",config:"Config",telegram:"Telegram",agents:"Agents",routines:"Rutinas",tasks:"Tasks",mcps:"MCPs",vars:"Variables",logs:"Logs",memories:"Memorias"},sections:{workspace:"Workspace",automation:"Automatización",knowledge:"Conversaciones",config:"Config"},overview:{tasks_open:"Tasks abiertas",routines:"Rutinas",agents:"Agents",mcps:"MCPs",chat:"Chat (super-agent)",chat_value:"abrir"},chat:{title:"Chat con agente",subtitle:"Chat directo con el agente del proyecto.",superagent_title:"Chat con {persona}",superagent_subtitle:"Chat con {persona} — el super-agente APX. Puede usar tools (proyectos, tasks, mcps, agentes).",loaded_subtitle:"Conversación cargada con {slug}. Lo que mandes se agrega a este chat.",empty:"Mandá un mensaje para arrancar la conversación.",placeholder:"Escribí algo y enter para enviar (shift+enter = nueva línea)",send:"Enviar",stop:"Stop",clear:"Limpiar",copy:"copiar",copied:"Copiado.",stopped_marker:" [detenido]",create_agent:"Crear agente",create_agent_title:"Crear agente",create_agent_desc:"Necesario para iniciar chat en proyecto.",role_label:"rol",model_label:"modelo",model_hint:"ej. openai:gpt-5, groq:llama-3.3-70b-versatile",master_label:"Agente master",list:{title:"Chats",new:"Nuevo",search:"Buscar chats…",all_agents:"Todos los agentes",empty:"No hay conversaciones todavía. Arrancá una desde la derecha.",count:"{n} en total",live_with:"Live · {slug}",live_subtitle:"Sesión en memoria"}},tasks:{title:"Tasks (TODOs)",subtitle:"Append-only JSONL en ~/.apx/projects/<id>/tasks/.",add:"agregar",add_label:"Nueva task",add_placeholder:"ej. revisar bug del scroll",empty:"No hay tasks {state}.",empty_open:"No hay tasks abiertas.",created:"Task creada.",create_error:"no pude crear la task",done:"✓ done",drop:"✗ drop",reopen:"↻ reopen",due:"vence",via:"via",aria_done:"marcar done",aria_drop:"descartar task",aria_reopen:"reabrir task"},global_tasks:{title:"Tasks (todos los proyectos)",subtitle:"Tareas agregadas de todos los proyectos registrados.",empty:"Sin tasks.",due:"vence",go_project:"Ir al proyecto"},routines:{title:"Heartbeats / Routines",subtitle:"Cron, every:Nm, once:ISO. Cada rutina dispara un agente o un shell.",empty:"Sin rutinas. Creá una arriba.",new:"nueva",new_btn:"Nueva",delete_confirm:"Borrar rutina {name}?",saved:"Rutina guardada.",paused:"pausada",next_run:"próxima:",last_run:"última:",enabled_hint:"Activa · corre según el intervalo",disabled_hint:"Pausada · solo con el botón Run",enabled_label:"Habilitada",new_title:"Nueva rutina",edit_title:"Editar {name}",dialog_desc:"Se guarda en .apc/routines.json. La rutina corre mientras el daemon está activo.",name_field:"Nombre (name)",name_no_edit:"No se puede cambiar al editar.",kind_field:"Acción (kind)",schedule_field:"Intervalo (schedule)",schedule_hint:"Elegí un preset o escribilo a mano. Manual = solo corre con el botón Run.",vars_title:"Variables disponibles",what_happens:"Qué va a pasar",agent_field:"Agente (spec.agent)",agent_hint:"Quién ejecuta la rutina.",agent_loading:"cargando…",agent_pick:"— elegí un agente —",prompt_exec:"Prompt (spec.prompt)",prompt_exec_ph:"qué pendiente hay para hoy?",prompt_super:"Prompt (spec.prompt)",prompt_super_ph:"resumí el estado del proyecto",pre_field:"Pre-commands (pre_commands)",pre_hint:"Shell ANTES del prompt. Uno por línea.",post_field:"Post-commands (post_commands)",post_hint:"Shell DESPUÉS del prompt. Uno por línea.",tg_channel:"Canal (spec.channel)",tg_chat_id:"Chat ID (spec.chat_id)",tg_text:"Texto (spec.text)",tg_text_hint:"Mensaje fijo a enviar. No usa modelo.",shell_field:"Comando (spec.command)",shell_hint:"Corre tal cual en el shell. Sin prompt ni pre/post.",hb_channel:"Canal (spec.channel)",hb_message:"Mensaje (spec.message)",name_required:"name requerido",save_error:"save falló",run_error:"run falló",toggle_error:"toggle falló",delete_error:"delete falló",run_success:"{name} disparada.",delete_success:"borrada."},agents:{title:"Agents",subtitle:"Definidos en AGENTS.md + .apc/agents/<slug>.md.",subtitle_full:"Definidos en AGENTS.md + .apc/agents/<slug>.md. La memoria runtime vive en ~/.apx/projects/<id>/agents/<slug>/.",empty:"Sin agents. Agregá uno con <code>apx agent add</code> o el botón.",empty_text:"Sin agents. Agregá uno con `apx agent add` o el botón de arriba.",new:"Agente",created:"Agent {slug} creado.",slug_invalid:"slug debe matchear /^[a-z][a-z0-9_-]*$/",hierarchy:"Jerarquía",list_view:"Lista",import:"Importar",chat:"Chat",view:"Ver",orchestrator:"Orquestador",new_title:"Nuevo agent",new_desc:"POST /projects/:pid/agents — escribe .apc/agents/<slug>.md.",slug_label:"slug",slug_ph:"cody",role_label:"role (opcional)",role_ph:"code refactor",model_label:"model (opcional)",model_hint:"ej. ollama:gemma2:9b, openai:gpt-4o-mini",lang_label:"language (opcional)",desc_label:"description (opcional)",desc_ph:"Qué hace este agente…",skills_label:"skills (coma)",skills_ph:"skill-a, skill-b",tools_label:"tools (coma)",tools_ph:"tool-a, tool-b",parent_label:"reporta a (parent, opcional)",parent_hint:"Subagente de un orquestador.",none_parent:"— ninguno —",master_label:"Orquestador (master)",create_success:"Agent {slug} creado.",create_error:"create falló",import_title:"Importar del vault",import_desc:"Plantillas en ~/.apx/agents. Se registran en este proyecto (.apc/agents/<slug>.md).",import_empty:"Sin plantillas en el vault.",import_success:"Importado: {slug}",import_already:"ya está",import_btn:"Importar"},agent_detail:{not_found:"Agente no encontrado.",chat_btn:"Chat con {slug}",reports_to:"↳ reporta a",no_threads:"Sin threads.",no_activity:"Sin actividad registrada.",threads_recent:"Threads recientes",subagents:"Subagentes",subagents_desc:"Agentes que reportan a este orquestador.",config_title:"Configuración del agente",type_label:"Tipología (type)",area_label:"Área",area_hint:"ej. operaciones, marketing",area_ph:"operaciones",role_label:"Role",parent_label:"Reporta a (parent)",none_parent:"— ninguno —",model_label:"Modelo base",model_hint:"Vacío = usa el modelo del Router (default). Setealo solo para forzar un modelo a este agente.",model_ph:"(vacío = router default)",skills_label:"Skills (coma)",bio_label:"Bio / descripción",system_label:"System prompt",system_hint:"Define personalidad y comportamiento (cuerpo del AGENT.md).",master_label:"Orquestador (master)",delete_btn:"Borrar agente",save_btn:"Guardar cambios",delete_confirm:'Borrar el agente "{slug}"? Se elimina .apc/agents/{slug}.md y sus datos runtime locales.',update_success:"Agente actualizado.",delete_success:"Agente borrado.",tools_hint:"Qué tools puede usar el agente. Tocá para activar/desactivar; o editá la lista abajo.",tools_custom_ph:"lista (coma): echo, http_fetch",memory_title:"Memoria del agente",memory_empty:"(memoria vacía)",memory_saved:"Memoria guardada.",records_title:"Records",records_desc:"Log de actividad del agente (mensajes/acciones). Lo más nuevo primero.",sleep_title:"Sleep / Heartbeat",sleep_desc:"Estado de ejecución del agente, derivado de sus rutinas.",sleep_deep:"Deep sleep · sin heartbeat",sleep_deep_desc:"Este agente no tiene ninguna rutina que lo dispare. No se ejecuta de forma autónoma; solo responde cuando lo invocás (chat / tarea).",brain_title:"Brain",brain_desc:"Grafo de relaciones reales del agente: memoria, threads, tasks, heartbeats y jerarquía. (primera versión — lo refinamos)",brain_empty:"Aún no hay relaciones para graficar (sin memoria, threads, tasks ni rutinas).",msgs_count:"msgs"},mcps:{title:"MCP servers",subtitle:"3 scopes: Runtime > Shared > Global. Conflictos arriba si los hay.",empty:"Sin MCPs configurados.",new:"MCP",delete_confirm:"Borrar MCP {name} de scope {scope}?",conflicts:"⚠ Conflictos: {names}",new_title:"Nuevo MCP",edit_title:"Editar MCP",new_desc:"Se guarda según el scope elegido. Los valores con ${var.X} se resuelven al arrancar el MCP.",scope_label:"Scope",scope_runtime:"Runtime",scope_shared:"Shared",scope_global:"Global",scope_runtime_desc:"Solo este proyecto · con secrets · no se commitea (~/.apx/projects/<id>/mcps.json)",scope_shared_desc:"Solo este proyecto · committeable · sin secrets (.apc/mcps.json)",scope_global_desc:"Todos los proyectos de esta máquina (~/.apx/mcps.json)",transport_stdio:"stdio",transport_http:"HTTP",transport_stdio_desc:"Proceso local — `command` + args",transport_http_desc:"Endpoint remoto — URL + headers",transport_label:"Transport",name_label:"Nombre",name_ph:"my-mcp",cmd_label:"Comando",cmd_ph:"npx",args_label:"Args",args_hint_tokens:"Una entrada por argumento. Usá el botón + para insertar variables.",env_label:"Env",env_hint_tokens:"Pares clave/valor. Los valores aceptan ${var.NOMBRE} (botón + a la derecha).",env_empty:"Sin variables de entorno.",url_label:"URL",url_ph:"https://example.com/v2/mcp",headers_label:"Headers",headers_hint:"Pares clave/valor — típicamente Authorization: Bearer ${var.TOKEN}.",headers_empty:"Sin headers.",enabled_label:"Habilitado",add_btn:"Agregar",save_btn:"Guardar",add_arg:"Agregar arg",edit_btn:"Editar",test_btn:"Probar",logs_btn:"Logs",testing:"Probando…",test_ok:"OK · {n} tools disponibles",logs_title:"Logs · {name}",logs_empty:"Sin logs todavía. Arrancá el MCP llamando un tool o probando.",logs_events:"Eventos recientes",logs_stderr:"stderr (últimos 4KB)",logs_panel_title:"Live logs",logs_panel_pick:"elegí un MCP",logs_panel_hint:"Click un MCP de la lista para ver lo que está pasando en vivo.",logs_panel_idle:"Sin actividad. Apretá Probar para arrancarlo.",name_required:"Nombre requerido",removed:"eliminado",added:"MCP agregado.",updated:"MCP actualizado."},vars:{title:"Variables",subtitle_project:"Reemplazan ${var.NOMBRE} al cargar MCPs y plantillas. Las del proyecto ganan sobre las globales. Se guardan fuera del repo (~/.apx/, chmod 0600).",subtitle_base:"Variables globales — disponibles para todos los proyectos. Se guardan en ~/.apx/vars.json (chmod 0600).",empty:"Sin variables todavía.",new:"Variable",new_title:"Nueva variable",edit_title:"Editar variable",new_desc:"Se referencia como ${var.NOMBRE} en cualquier campo que soporte interpolación.",reveal_all:"Mostrar valores",reveal:"Mostrar",hide:"Ocultar",filter_label:"Mostrar:",filter_all:"Todas",filter_project:"Sólo proyecto",filter_global:"Sólo globales",scope_label:"Scope",scope_project:"proyecto",scope_project_desc:"Sólo este proyecto. Pisa la global con mismo nombre.",scope_global:"global",scope_global_desc:"Disponible en todos los proyectos.",name_label:"Nombre",name_hint:"Mayúsculas, dígitos y _. P. ej.: MY_API_KEY, GITHUB_TOKEN.",value_label:"Valor",value_hint:"Se guarda en disco con permisos 0600. Nunca se commitea.",value_edit_ph:"(dejá vacío para no cambiarlo… aún no soportado, pegá el valor de nuevo)",add_btn:"Agregar",save_btn:"Guardar",edit_btn:"Editar",delete_btn:"Borrar",delete_confirm:"¿Borrar {name} ({scope})?",removed:"Variable eliminada.",added:"Variable agregada.",updated:"Variable actualizada.",name_required:"Nombre requerido.",value_required:"Valor requerido."},threads:{title:"Chats",subtitle:"Conversaciones por agent (vacío = ningún log persistido todavía).",no_agents:"No hay agents. Las conversaciones requieren un agent configurado.",pick:"Elegí un agent para ver sus conversaciones.",empty:"No hay conversaciones para {slug}.",conversation_title:"Conversación {id}",messages:"mensajes",via:"via"},config:{title:"Config rápida",subtitle:"Override del proyecto. Se escribe en {path}.",model:"super_agent.model",model_hint:"ej. anthropic:claude-sonnet-4.5, ollama:gemma2:9b",perm:"super_agent.permission_mode",route:"route_to_agent",route_hint:"Slug del agent que atiende por defecto en este proyecto.",use_global:"(usa global)",saved:"Guardado.",nothing:"Nada para guardar.",raw_title:"Config (JSON crudo)",raw_subtitle:"Pegá el objeto entero — equivale a PUT del archivo.",raw_save:"Reemplazar config",raw_done:"Config sobrescrita.",effective:"Effective config (read-only)",effective_sub:"Lo que ve realmente el daemon (global ⊕ override).",section_title:"Config proyecto",section_desc:"APC metadata y overrides separados. General APX vive en Settings > Config.",effective_read:"Lectura: global APX + override proyecto.",save_project:".apc/project.json guardado.",save_override:".apc/config.json guardado.",save_fields_success:"Overrides guardados.",save_meta_success:"Project metadata guardado.",no_data:"Sin datos."},telegram:{title:"Canal de Telegram (override)",subtitle:"Si seteás un canal acá, los mensajes generados por este proyecto se mandan ahí en lugar del default.",use_default:"Usar el canal default",bot_token:"Bot token (override)",chat_id:"Chat ID (override)",saved:"Override guardado.",cleared:"Override eliminado — vuelve al default.",override_active:"override activo",channel_badge:"Canal {name}",no_override:"Sin override. Los mensajes de este proyecto van al canal default.",respond_engine:"Responder con engine",route_agent:"route_to_agent",route_hint:"Slug del agent que atiende (vacío = super-agent).",bot_hint_none:"Si vacío, hereda del default."},memories:{project_title:"Memoria del proyecto",project_desc:"Hechos durables a nivel proyecto. .apc/memory.md — la leen los agentes y el super-agente.",project_ph:`# Memoria del proyecto
594
+
595
+ Hechos estables que cualquier agente debería saber…`,agents_title:"Memorias de agentes",agents_desc:"Memoria individual por agente. ~/.apx/projects/<id>/agents/<slug>/memory.md",no_agents:"Sin agentes en este proyecto.",saved:"Memoria guardada.",empty:"(memoria vacía)",chars:"chars · Markdown",save_btn:"Guardar"}},base:{title:"Base",subtitle:"Espacio general · super-agente",nav_general:"General",nav_activity:"Actividad",nav_system:"Sistema",workspaces_title:"Workspaces",workspaces_desc:"Todos los proyectos registrados en APX.",workspaces_new:"Nuevo proyecto",workspaces_empty:"Sin proyectos. Agregá uno con el botón de arriba.",sessions_title:"Sessions",sessions_desc:"Sesiones de todos los engines (apx · claude · codex), más nuevas primero.",sessions_all:"Todos los engines",sessions_empty:"Sin sesiones.",sessions_error:"No pude leer las sesiones: {msg}",defaults_title:"Agent defaults",defaults_desc:"Plantillas globales del vault. Las bundled vienen con APX y siempre están; las que crees o edites quedan en ~/.apx/agents y se superponen. Importalas a un proyecto desde Agents › Importar.",defaults_show_removed:"Mostrar removidos",defaults_new:"Nuevo",defaults_empty:"Sin plantillas en el vault.",defaults_hide:"Ocultar",defaults_restore:"Restaurar",defaults_edit:"Editar",defaults_remove:"Ocultar",defaults_delete:"Borrar",defaults_tombstone_msg:'Ocultar el default "{slug}"? Es bundled — quedá tombstoneado y lo recuperás con Restaurar.',defaults_delete_msg:'Borrar el template "{slug}"?',defaults_hidden:"Ocultado.",defaults_deleted:"Borrado.",defaults_restored:"Restaurado.",defaults_new_title:"Nuevo template",defaults_new_desc:"POST /agents/vault — se guarda en ~/.apx/agents/<slug>.md",defaults_edit_title:'Editar "{slug}"',defaults_bundled_desc:"Es un default bundled. Al guardar se hace copy-on-write a ~/.apx/agents/<slug>.md (queda como override).",defaults_user_desc:"PATCH /agents/vault/:slug — edita el archivo en ~/.apx/agents.",defaults_master_label:"Agente master",defaults_slug_invalid:"slug inválido (debe matchear /^[a-z][a-z0-9_-]*$/)",defaults_created:'Template "{slug}" creado.',defaults_saved:'Template "{slug}" guardado.'},logs:{title:"Logs",desc_global:"Actividad del daemon (canales globales: telegram, direct…). ~/.apx/messages/<channel>/.",desc_project:"Actividad del proyecto. ~/.apx/projects/<id>/messages/.",filter_channel:"filtrar canal (ej. telegram)",filter_dir:"dirección",all_directions:"Todas las direcciones",in:"Entrada (in)",out:"Salida (out)",filter_type:"tipo",all_types:"Todos los tipos",search_text:"buscar en el texto…",count_of:"de",no_activity:"Sin actividad.",no_activity_ch:'Sin actividad en el canal "{ch}".',error:"No pude leer los mensajes: {msg}",show_more:"ver más",show_less:"ver menos",daemon_errors:"Errores del daemon (~/.apx/logs/errors.jsonl)",no_errors:"Sin errores registrados. 🎉"},telegram_contacts:{title:"Contactos de Telegram",desc:"Quién le escribe a los bots. El rol define qué herramientas puede usar; un invitado no tiene permisos hasta que le asignes un rol.",empty:"Todavía no hay contactos — se registran solos cuando alguien escribe a un bot.",owner_badge:"dueño",assign_role:"Asignar rol",owner_hint:"Es dueño de un canal — cambialo desde el canal",removed:"Contacto eliminado.",delete_confirm:"¿Borrar el contacto {name}?",last_seen:"visto:",tools_all:"tools: todas",tools_none:"tools: ninguna",tools_label:"tools:"},telegram_channels:{title:"Canales",desc:"Cada canal es un bot que el daemon polea. Acá podés añadir/quitar canales, cambiar el agente que contesta, el proyecto al que pertenece y su dueño.",new_btn:"Nuevo canal",empty:"Todavía no hay canales — agregá el primero.",removed:"Canal eliminado.",delete_confirm:"¿Borrar el canal {name}?",no_owner:"sin dueño (se reclama al primer DM)",owner_label:"dueño:"},telegram_channel_dialog:{new_title:"Nuevo canal de Telegram",edit_title:"Editar canal: {name}",name_label:"name (slug interno)",token_label:"bot_token",chat_id:"chat_id",project_label:"project",project_hint:"Slug o id del proyecto al que pinear este canal (opcional).",route_label:"route_to_agent",route_hint:"Agente que contesta; vacío = super-agent APX.",owner_label:"owner_user_id",owner_hint:"user_id de Telegram del dueño de este canal. Override del rol global a 'owner' acá. Si lo dejás vacío, el primer mensaje privado lo reclama.",owner_ph:"889721252",respond_label:"Responder con engine (no echo)",name_required:"name requerido",saved:"Canal guardado."},telegram_send_dialog:{title:"Enviar a {name}",default_msg:"Mensaje de prueba desde el panel de APX ✅"},telegram_roles:{title:"Roles",desc:"Cada rol define qué herramientas del super-agent puede usar quien lo tenga asignado. 'owner' siempre = todas; 'guest' siempre = ninguna (solo chat).",empty:"No hay roles definidos.",tools_all:"todas las herramientas",tools_none:"ninguna herramienta",builtin:"built-in",delete_confirm:'¿Borrar el rol "{name}"?',removed:"Rol eliminado.",saved:'Rol "{name}" guardado.',name_required:"Nombre requerido.",builtin_error:'"{name}" es un rol built-in.',new_title:"Nuevo rol o reemplazar uno custom",name_label:"Nombre",name_ph:"editor",tools_label:"Tools (separadas por coma)",tools_hint:"Vacío = ninguna. Ejemplos: call_agent, list_tasks, create_task.",tools_ph:"call_agent, list_tasks",full_access:"Acceso total (todas las tools)",save_btn:"Guardar rol",delete_btn:"Borrar"},superagent:{title:"{persona}",badge:"super-agent · APX",desc:"Conversación rápida con tu super-agente. Tiene acceso a tools (proyectos, tasks, mcps, agentes); para un hilo más largo y persistente, abrí Chats.",empty:"Mandale un mensaje a {persona} para arrancar.",thinking:"{persona} está pensando…",talk:"Hablar con {persona}",new_chat:"Nuevo chat",placeholder:"Escribí y enter para enviar (shift+enter = nueva línea)…"},not_found:{title:"404",message:"Esa ruta no existe."},ask_panel:{answers_header:"Respuestas",other:"Otro",other_placeholder:"Escribí tu propia respuesta acá",text_placeholder:"Escribí tu respuesta…",back:"Atrás",skip:"Omitir",next:"Siguiente",submit:"Enviar",status_waiting:"Esperando respuesta…",status_received:"Respuestas recibidas"},code_module:{title:"Code",badge:"super-agent",desc:"Sesiones de código estilo OpenCode. Elegí un proyecto, abrí una sesión y pedile que lea, planifique, edite o ejecute.",no_projects:"No hay proyectos registrados. Registrá uno con `apx project add` para usar Code.",sessions:"Sesiones",new_session:"Nueva sesión",untitled:"Nueva sesión",no_sessions:"Todavía no hay sesiones — creá una para empezar a codear.",pick_project:"Elegí un proyecto para ver sus sesiones.",rename:"Renombrar",delete:"Eliminar",delete_confirm:"¿Eliminar esta sesión? Se borra la transcripción; tus archivos quedan intactos.",empty_chat:"Mandá una instrucción de código para arrancar.",placeholder:"Pedí un cambio… (enter envía, shift+enter = nueva línea)",mode_build:"Build",mode_plan:"Plan",mode_build_hint:"Build — edita archivos y ejecuta comandos",mode_plan_hint:"Plan — solo lectura, propone cambios sin tocar archivos",tab_context:"Contexto",tab_changes:"Cambios",tab_artifacts:"Artifacts",artifacts_none:"Todavía no hay artifacts. Pedile al agente que cree un script en `artifacts/<nombre>`.",artifacts_count:"{n} artifact(s)",artifacts_copy_path:"Copiar path",artifacts_run:"Run",artifacts_run_hint:"Para ejecutarlo desde la terminal:",artifacts_delete:"Eliminar",artifacts_delete_confirm:"¿Eliminar este artifact? El archivo se borra del disco.",ctx_model:"Modelo",ctx_tokens:"Tokens",ctx_input:"Entrada",ctx_output:"Salida",ctx_messages:"Mensajes",ctx_breakdown:"Desglose de contexto",ctx_none:"Sin uso todavía — mandá un turno para ver tokens.",seg_system:"Sistema",seg_user:"Usuario",seg_assistant:"Asistente",seg_tool:"Tools",seg_other:"Otro",changes_none:"Todavía no hay cambios en esta sesión.",changes_no_git:"Los cambios necesitan un repo git. Este proyecto no lo es.",changes_files:"{n} archivo(s) cambiados",stopped:"[detenido]",close:"Cerrar",reload:"Recargar",discard_changes:"Descartar cambios",save_shortcut_hint:"Guardar (Cmd/Ctrl+S)",artifacts_rename:"Renombrar",artifacts_view:"Ver contenido",artifacts_edit:"Editar contenido",tree_collapse_all:"Colapsar todo",terminal_clear:"Limpiar",terminal_close:"Cerrar terminal"},desktop_screen:{status_title:"Estado",autostart_title:"Arranque automático",shortcut_title:"Atajo de teclado",appearance_title:"Apariencia",activation_title:"Activación + transcripción",last_conv_title:"Última conversación"},voice_screen:{providers_title:"Proveedores de voz (TTS)",test_title:"Probar voz",stt_title:"Transcripción (STT)",configure_provider:"Configurar {name}"},deck_screen:{widgets_title:"Widgets",context_title:"Contexto APX",reload_manifest:"Recargar manifest",widget_native:"Widget nativo APX",widget_external:"Widget externo"},memory_panel:{embeddings_title:"Embeddings (RAG)",ollama_title:"Ollama (local)",openai_title:"OpenAI",gemini_title:"Gemini",compaction_title:"Compactación de historial"},router_panel:{title:"Router de modelos"},engines_panel:{title:"Proveedores",new_btn:"Nuevo proveedor"},providers_modal:{new_title:"Nuevo proveedor",edit_title:"Editar {name}",list_models_hint:"Listar los modelos reales del proveedor",toggle_active:"Activo · click para desactivar",toggle_inactive:"Inactivo · click para activar",delete:"Borrar"},chat_ui:{copy:"Copiar",stop:"Detener",send:"Enviar",pick_model:"Elegir modelo (o Auto)",insert_variable:"Insertar variable"},sidebar_ui:{toggle:"Mostrar/ocultar sidebar"},models_ui:{invalid_hint:"Modelo/proveedor no disponible"},global_config:{title:"Config APX"},agent_detail_extra:{skills_title:"Skills & tools"}},jO={common:{loading:"Loading…",saving:"Saving…",cancel:"Cancel",save:"Save",delete:"Delete",edit:"Edit",create:"Create",add:"Add",remove:"Remove",reload:"Reload",shutdown:"Shut down",enabled:"Enabled",disabled:"Disabled",enable:"Enable",disable:"Disable",open:"Open",close:"Close",confirm:"Confirm",optional:"(optional)",none:"—",none_yet:"Nothing here yet.",error_generic:"Something went wrong.",search:"Search",new:"New",restore:"Restore",show:"Show",hide:"Hide",copy:"Copy",run:"Run"},daemon:{connecting:"Connecting to the daemon…",unreachable:"Could not reach the daemon at localhost:7430.",unreachable_hint:"Start APX with `apx daemon start` and refresh.",version:"Version",uptime:"Uptime",status:"Status",running:"running",down:"down",reload_hint:"POST /admin/reload — reloads ~/.apx/config.json without restarting.",shutdown_confirm:"Shut down the daemon? Upcoming requests will fail until it restarts.",shutdown_done:"Daemon stopped."},pairing:{title:"Pair this device",subtitle:"You are connecting from outside this machine. For security, pair this browser with a pairing code.",steps_title:"How to get the code",step_1:"On the PC where APX is running, open a terminal.",step_2:"Run `apx pair` (or scan the QR with APX Deck).",step_3:"Copy the code shown below the QR and paste it here.",code_label:"Pairing code",code_ph:"e.g. 7f3a1c9e-…",label_label:"Device name",label_ph:"e.g. Living room laptop",submit:"Pair",linking:"Pairing…",success:"Device paired ✓",err_required:"Paste the pairing code.",err_expired:"The code expired. Run `apx pair` again and try again.",err_unknown:"Unknown or already-used code. Generate a new one with `apx pair`.",err_generic:"Could not pair. Check the code and try again.",revoke_hint:"You can revoke this device at any time from Settings or with `apx pair revoke`."},nav:{apx_admin:"APX",settings:"Settings",project:"Project",add_project:"Add project",modules:{voice:"Voices",desktop:"Desktop",deck:"Deck",code:"Code"}},topbar:{breadcrumb_root:"APX",breadcrumb_settings:"APX › Settings",breadcrumb_project:"APX › Project",breadcrumb_base:"Base",breadcrumb_projects:"Projects",light:"Switch to light",dark:"Switch to dark",lang_toggle:"Language"},admin:{title:"APX",subtitle:"Admin panel. Global config, channels and projects.",engines_title:"Engines",engines_subtitle:"Available LLM adapters. API keys live in ~/.apx/config.json.",telegram_title:"Telegram",telegram_subtitle:"Configured channels. Each one can be pinned to a project.",telegram_polling_on:"Polling active",telegram_polling_off:"Disabled",telegram_add_channel:"Channel",telegram_send_test:"Test",telegram_send_test_title:"Send to",telegram_default_message:"Test message from APX panel ✅",projects_title:"Registered projects",projects_subtitle:"Click a project to open its panel.",unregister:"Unregister",unregister_confirm:"Remove {label} from APX? The folder is not deleted; only unregistered.",reload_success:"Config reloaded.",telegram_polling_started:"Polling started.",telegram_polling_stopped:"Polling stopped.",telegram_channel_removed:"Channel deleted.",agents_badge:"agents",engine_badge:"yes",engine_badge_no:"no",base_label:"Base"},add_project:{title:"Add project",subtitle:"APX will index .apc/, agents and AGENTS.md in that folder.",path_label:"Absolute path",path_hint:"Equivalent to apx project add /path/to/project",path_placeholder:"/path/to/my-project",register:"Register",path_required:"Path required.",registered:"Project #{id} registered.",search_btn:"Browse",browser_unavailable:"Browser unavailable until daemon restarts. Paste path manually.",no_folders:"No folders."},settings:{title:"Settings",subtitle:"Panel preferences + local daemon diagnostics.",appearance:"Appearance",light_mode:"Light",dark_mode:"Dark",language:"Language",daemon:"Daemon",daemon_sub:"Status of the local process that serves this web and orchestrates agents.",engines:"Available engines",engines_sub:"LLM adapters compiled with the daemon.",token:"Session token",token_sub:"If this web could not auto-load the token, paste it here.",token_active:"(token already active)",token_paste:"Paste daemon bearer",token_saved:"Token saved.",devices:"Paired devices",devices_sub:"GET /pair/list. Revoking invalidates that bearer on the daemon.",devices_empty:"No paired clients yet.",devices_revoke_confirm:"Revoke client {id}?",devices_revoke_success:"Client revoked.",devices_pair_btn:"Pair device",devices_pair_title:"Pair device",devices_pair_desc:"Scan the QR with your phone camera to open the web already paired, or paste the code on another PC.",devices_pair_scan:"Scan with your phone camera — opens the web already paired.",devices_pair_code:"Or paste this code on the pairing screen:",devices_pair_url:"Access URL",devices_pair_link:"Or copy this link and open it on the other device (enters automatically):",devices_pair_copy:"Copy",devices_pair_copied:"Link copied to clipboard.",devices_pair_copied_code:"Code copied.",devices_pair_expires:"Expires in {s}s",devices_pair_expired:"The code expired.",devices_pair_regen:"Generate another",devices_pair_waiting:"Waiting for device to confirm…",devices_pair_done:"Device paired ✓",devices_pair_localhost_only:"Codes can only be generated from the daemon's PC (localhost).",devices_last_seen:"seen:",devices_never:"never",devices_revoke:"Revoke",account_section:"Account",agents_section:"Agents & models",channels_section:"Channels & devices",advanced_section:"Advanced",tabs:{identity:"Identity",super_agent:"Super-agent",engines:"Engines & models",telegram:"Telegram",devices:"Devices",advanced:"Advanced"},identity:{title:"Identity",subtitle:"User data. Agent configuration goes in Super-agent.",agent_name:"Agent name",owner_name:"Your name",personality:"Personality",owner_context:"Owner context",owner_context_hint:"Who you are, what you work on, what the agent should know about you.",language:"Preferred language",timezone:"Timezone (IANA)",timezone_hint:"e.g. America/New_York",saved:"Identity saved."},super_agent:{title:"Super-agent",subtitle:"Personality, model, prompt and modes of the super-agent.",personality:"Personality",model:"Active model",model_hint:"E.g.: anthropic:claude-sonnet-4.5, ollama:gemma2:9b",permission_mode:"Permission mode",system:"Extra prompt (system)",system_hint:"Text prepended to the base system prompt.",fallback_title:"Fallback chain",fallback_hint:"If the active model fails, these are tried in order.",fallback_add:"Add model to chain",saved:"Super-agent saved.",enabled_label:"Super-agent enabled",model_active:"Active model (router)",model_configure:"Configure in Models",behavior_subtitle:"Super-agent behavior. Model and fallback chain are configured in the Model Router."},engines_keys:{title:"Model API keys",subtitle:"Each engine stores its key in ~/.apx/config.json. Already-set values show a safe suffix.",ollama_url:"Ollama URL",ollama_hint:"Default: http://127.0.0.1:11434",key_label:"API key",key_placeholder:"(not set)",clear:"Clear key",saved:"Key saved.",cleared:"Key cleared."},telegram_global:{title:"Telegram (default)",subtitle:"Default channel — projects can override with their own channel.",bot_token:"Bot token",chat_id:"Default chat ID",poll_interval:"Poll interval (ms)",respond_with_engine:"Respond with engine",enabled:"Polling enabled",saved:"Telegram saved."},advanced:{title:"Advanced",subtitle:"Raw editor for ~/.apx/config.json. Secrets show as *** set *** but you can write a new one.",write:"Apply changes",written:"Config applied and daemon reloaded.",reload_success:"Config reloaded."}},project:{not_found:"Project {pid} not found.",rebuild:"Rebuild context",rebuild_done:"Rebuild OK.",unregister_confirm:"Unregister {label}? The folder is not deleted.",unregistered:"Unregistered.",base_subtitle:"General workspace · super-agent",danger:{title:"Danger zone",subtitle:"Actions that affect APX's project registry. They do not touch repo files.",rebuild_desc:"Re-scans .apc/, MCPs and agents and regenerates the super-agent context for this project.",unregister_desc:"Removes the project from APX's registry. The folder on disk stays intact.",rebuild_confirm_title:"Rebuild context",rebuild_confirm_desc:"Regenerate context for {label}.",rebuild_long:"Re-reads APC config, lists available MCPs and agents, and rebuilds the super-agent system prompt. Safe to run — nothing is deleted. Use it after editing .apc/ by hand or if changes are not being picked up.",unregister_confirm_title:"Unregister project",unregister_long:"The project disappears from `apx`. Files on disk (.apc/, code, everything) stay. You can re-register it with `apx project register <path>`."},nav:{overview:"Overview",chat:"Chat",config:"Config",telegram:"Telegram",agents:"Agents",routines:"Routines",tasks:"Tasks",mcps:"MCPs",vars:"Variables",logs:"Logs",memories:"Memories"},sections:{workspace:"Workspace",automation:"Automation",knowledge:"Conversations",config:"Config"},overview:{tasks_open:"Open tasks",routines:"Routines",agents:"Agents",mcps:"MCPs",chat:"Chat (super-agent)",chat_value:"open"},chat:{title:"Chat with agent",subtitle:"Direct conversations with project agents. The super-agent does not intervene.",superagent_title:"Chat with {persona}",superagent_subtitle:"Chat with {persona} — the APX super-agent. Can use tools (projects, tasks, mcps, agents).",loaded_subtitle:"Loaded conversation with {slug}. Sending will append to this thread.",empty:"Send a message to start the conversation.",placeholder:"Type something and press enter to send (shift+enter = new line)",send:"Send",stop:"Stop",clear:"Clear",copy:"copy",copied:"Copied.",stopped_marker:" [stopped]",create_agent:"Create agent",create_agent_title:"Create agent",create_agent_desc:"Required to start a chat in this project.",role_label:"role",model_label:"model",model_hint:"e.g. openai:gpt-5, groq:llama-3.3-70b-versatile",master_label:"Master agent",list:{title:"Chats",new:"New",search:"Search chats…",all_agents:"All agents",empty:"No conversations yet. Start one from the right.",count:"{n} total",live_with:"Live · {slug}",live_subtitle:"In-memory session"}},tasks:{title:"Tasks (TODOs)",subtitle:"Append-only JSONL in ~/.apx/projects/<id>/tasks/.",add:"add",add_label:"New task",add_placeholder:"e.g. fix scroll bug",empty:"No {state} tasks.",empty_open:"No open tasks.",created:"Task created.",create_error:"could not create task",done:"✓ done",drop:"✗ drop",reopen:"↻ reopen",due:"due",via:"via",aria_done:"mark done",aria_drop:"discard task",aria_reopen:"reopen task"},global_tasks:{title:"Tasks (all projects)",subtitle:"Aggregated tasks from all registered projects.",empty:"No tasks.",due:"due",go_project:"Go to project"},routines:{title:"Heartbeats / Routines",subtitle:"Cron, every:Nm, once:ISO. Each routine fires an agent or a shell.",empty:"No routines. Create one above.",new:"new",new_btn:"New",delete_confirm:"Delete routine {name}?",saved:"Routine saved.",paused:"paused",next_run:"next:",last_run:"last:",enabled_hint:"Active · runs on schedule",disabled_hint:"Paused · only via Run button",enabled_label:"Enabled",new_title:"New routine",edit_title:"Edit {name}",dialog_desc:"Saved in .apc/routines.json. The routine runs while the daemon is active.",name_field:"Name",name_no_edit:"Cannot be changed when editing.",kind_field:"Action (kind)",schedule_field:"Interval (schedule)",schedule_hint:"Choose a preset or type manually. Manual = only runs via Run button.",vars_title:"Available variables",what_happens:"What will happen",agent_field:"Agent (spec.agent)",agent_hint:"Who executes the routine.",agent_loading:"loading…",agent_pick:"— pick an agent —",prompt_exec:"Prompt (spec.prompt)",prompt_exec_ph:"what is pending for today?",prompt_super:"Prompt (spec.prompt)",prompt_super_ph:"summarize the project status",pre_field:"Pre-commands (pre_commands)",pre_hint:"Shell BEFORE the prompt. One per line.",post_field:"Post-commands (post_commands)",post_hint:"Shell AFTER the prompt. One per line.",tg_channel:"Channel (spec.channel)",tg_chat_id:"Chat ID (spec.chat_id)",tg_text:"Text (spec.text)",tg_text_hint:"Fixed message to send. Does not use a model.",shell_field:"Command (spec.command)",shell_hint:"Runs as-is in the shell. No prompt, no pre/post.",hb_channel:"Channel (spec.channel)",hb_message:"Message (spec.message)",name_required:"name required",save_error:"save failed",run_error:"run failed",toggle_error:"toggle failed",delete_error:"delete failed",run_success:"{name} fired.",delete_success:"deleted."},agents:{title:"Agents",subtitle:"Defined in AGENTS.md + .apc/agents/<slug>.md.",subtitle_full:"Defined in AGENTS.md + .apc/agents/<slug>.md. Runtime memory lives under ~/.apx/projects/<id>/agents/<slug>/.",empty:"No agents. Add one with <code>apx agent add</code> or the button.",empty_text:"No agents. Add one with `apx agent add` or the button above.",new:"Agent",created:"Agent {slug} created.",slug_invalid:"slug must match /^[a-z][a-z0-9_-]*$/",hierarchy:"Hierarchy",list_view:"List",import:"Import",chat:"Chat",view:"View",orchestrator:"Orchestrator",new_title:"New agent",new_desc:"POST /projects/:pid/agents — writes .apc/agents/<slug>.md.",slug_label:"slug",slug_ph:"cody",role_label:"role (optional)",role_ph:"code refactor",model_label:"model (optional)",model_hint:"e.g. ollama:gemma2:9b, openai:gpt-4o-mini",lang_label:"language (optional)",desc_label:"description (optional)",desc_ph:"What does this agent do…",skills_label:"skills (comma)",skills_ph:"skill-a, skill-b",tools_label:"tools (comma)",tools_ph:"tool-a, tool-b",parent_label:"reports to (parent, optional)",parent_hint:"Sub-agent of an orchestrator.",none_parent:"— none —",master_label:"Orchestrator (master)",create_success:"Agent {slug} created.",create_error:"create failed",import_title:"Import from vault",import_desc:"Templates in ~/.apx/agents. Registered in this project (.apc/agents/<slug>.md).",import_empty:"No templates in the vault.",import_success:"Imported: {slug}",import_already:"already here",import_btn:"Import"},agent_detail:{not_found:"Agent not found.",chat_btn:"Chat with {slug}",reports_to:"↳ reports to",no_threads:"No threads.",no_activity:"No recorded activity.",threads_recent:"Recent threads",subagents:"Sub-agents",subagents_desc:"Agents that report to this orchestrator.",config_title:"Agent configuration",type_label:"Type",area_label:"Area",area_hint:"e.g. operations, marketing",area_ph:"operations",role_label:"Role",parent_label:"Reports to (parent)",none_parent:"— none —",model_label:"Base model",model_hint:"Empty = uses the Router model (default). Set only to force a model for this agent.",model_ph:"(empty = router default)",skills_label:"Skills (comma)",bio_label:"Bio / description",system_label:"System prompt",system_hint:"Defines personality and behavior (body of AGENT.md).",master_label:"Orchestrator (master)",delete_btn:"Delete agent",save_btn:"Save changes",delete_confirm:'Delete agent "{slug}"? Removes .apc/agents/{slug}.md and local runtime data.',update_success:"Agent updated.",delete_success:"Agent deleted.",tools_hint:"Which tools this agent can use. Tap to toggle; or edit the list below.",tools_custom_ph:"list (comma): echo, http_fetch",memory_title:"Agent memory",memory_empty:"(empty memory)",memory_saved:"Memory saved.",records_title:"Records",records_desc:"Agent activity log (messages/actions). Newest first.",sleep_title:"Sleep / Heartbeat",sleep_desc:"Agent execution status, derived from its routines.",sleep_deep:"Deep sleep · no heartbeat",sleep_deep_desc:"This agent has no routine that triggers it. It does not run autonomously; it only responds when invoked (chat / task).",brain_title:"Brain",brain_desc:"Real relationship graph of the agent: memory, threads, tasks, heartbeats and hierarchy. (first version — will be refined)",brain_empty:"No relationships to graph yet (no memory, threads, tasks or routines).",msgs_count:"msgs"},mcps:{title:"MCP servers",subtitle:"3 scopes: runtime > shared > global. Conflicts shown above if any.",empty:"No MCPs configured.",new:"MCP",delete_confirm:"Delete MCP {name} from scope {scope}?",conflicts:"⚠ Conflicts: {names}",new_title:"New MCP",new_desc:"POST /projects/:pid/mcps?scope=…",scope_label:"Scope",transport_label:"Transport",name_label:"Name",name_ph:"filesystem",cmd_label:"Command",cmd_ph:"npx",args_label:"Args",args_hint:"space-separated",args_ph:"-y @modelcontextprotocol/server-filesystem /tmp",env_label:"Env (JSON, optional)",url_label:"URL",url_ph:"https://example.com/mcp",enabled_label:"Enabled",add_btn:"Add",name_required:"name required",env_invalid:"env must be valid JSON",removed:"removed",added:"MCP added.",updated:"MCP updated.",edit_title:"Edit MCP",save_btn:"Save",add_arg:"Add arg",edit_btn:"Edit",test_btn:"Test",logs_btn:"Logs",testing:"Testing…",test_ok:"OK · {n} tools available",logs_title:"Logs · {name}",logs_empty:"No logs yet. Start the MCP by calling a tool or running Test.",logs_events:"Recent events",logs_stderr:"stderr (last 4KB)",logs_panel_title:"Live logs",logs_panel_pick:"pick an MCP",logs_panel_hint:"Click an MCP in the list to see what's happening live.",logs_panel_idle:"No activity. Hit Test to spin it up.",scope_runtime:"Runtime",scope_shared:"Shared",scope_global:"Global",scope_runtime_desc:"This project only · with secrets · not committed (~/.apx/projects/<id>/mcps.json)",scope_shared_desc:"This project only · committeable · no secrets (.apc/mcps.json)",scope_global_desc:"All projects on this machine (~/.apx/mcps.json)",transport_stdio:"stdio",transport_http:"HTTP",transport_stdio_desc:"Local process — `command` + args",transport_http_desc:"Remote endpoint — URL + headers",args_hint_tokens:"One entry per arg. Use the + button to insert a variable.",env_hint_tokens:"Key/value pairs. Values accept ${var.NAME} (+ button on the right).",env_empty:"No env vars.",headers_label:"Headers",headers_hint:"Key/value pairs — typically Authorization: Bearer ${var.TOKEN}.",headers_empty:"No headers."},vars:{title:"Variables",subtitle_project:"Replace ${var.NAME} when loading MCPs and templates. Project vars beat globals. Stored outside the repo (~/.apx/, chmod 0600).",subtitle_base:"Global variables — available to every project. Stored in ~/.apx/vars.json (chmod 0600).",empty:"No variables yet.",new:"Variable",new_title:"New variable",edit_title:"Edit variable",new_desc:"Referenced as ${var.NAME} in any field that supports interpolation.",reveal_all:"Show values",reveal:"Show",hide:"Hide",filter_label:"Show:",filter_all:"All",filter_project:"Project only",filter_global:"Globals only",scope_label:"Scope",scope_project:"project",scope_project_desc:"This project only. Beats the global with the same name.",scope_global:"global",scope_global_desc:"Available to every project.",name_label:"Name",name_hint:"Uppercase, digits and _. E.g. MY_API_KEY, GITHUB_TOKEN.",value_label:"Value",value_hint:"Stored on disk with 0600 perms. Never committed.",value_edit_ph:"(leave empty to keep current… not yet supported, paste the value again)",add_btn:"Add",save_btn:"Save",edit_btn:"Edit",delete_btn:"Delete",delete_confirm:"Delete {name} ({scope})?",removed:"Variable removed.",added:"Variable added.",updated:"Variable updated.",name_required:"Name required.",value_required:"Value required."},threads:{title:"Chats",subtitle:"Conversations per agent (empty = no logs persisted yet).",no_agents:"No agents. Conversations require a configured agent.",pick:"Pick an agent to view its conversations.",empty:"No conversations for {slug}.",conversation_title:"Conversation {id}",messages:"messages",via:"via"},config:{title:"Quick config",subtitle:"Project override. Written to {path}.",model:"super_agent.model",model_hint:"e.g. anthropic:claude-sonnet-4.5, ollama:gemma2:9b",perm:"super_agent.permission_mode",route:"route_to_agent",route_hint:"Slug of the agent that handles this project by default.",use_global:"(uses global)",saved:"Saved.",nothing:"Nothing to save.",raw_title:"Config (raw JSON)",raw_subtitle:"Paste the entire object — equivalent to PUT the file.",raw_save:"Replace config",raw_done:"Config overwritten.",effective:"Effective config (read-only)",effective_sub:"What the daemon actually sees (global ⊕ override).",section_title:"Project config",section_desc:"APC metadata and overrides separated. General APX lives in Settings > Config.",effective_read:"Read: global APX + project override.",save_project:".apc/project.json saved.",save_override:".apc/config.json saved.",save_fields_success:"Overrides saved.",save_meta_success:"Project metadata saved.",no_data:"No data."},telegram:{title:"Telegram channel (override)",subtitle:"If you set a channel here, messages from this project go there instead of the default.",use_default:"Use default channel",bot_token:"Bot token (override)",chat_id:"Chat ID (override)",saved:"Override saved.",cleared:"Override removed — falls back to default.",override_active:"override active",channel_badge:"Channel {name}",no_override:"No override. Messages from this project go to the default channel.",respond_engine:"Respond with engine",route_agent:"route_to_agent",route_hint:"Slug of the agent that handles messages (empty = super-agent).",bot_hint_none:"If empty, inherits from default."},memories:{project_title:"Project memory",project_desc:"Durable facts at the project level. .apc/memory.md — read by agents and the super-agent.",project_ph:`# Project Memory
596
+
597
+ Stable facts that any agent should know…`,agents_title:"Agent memories",agents_desc:"Individual memory per agent. ~/.apx/projects/<id>/agents/<slug>/memory.md",no_agents:"No agents in this project.",saved:"Memory saved.",empty:"(empty memory)",chars:"chars · Markdown",save_btn:"Save"}},base:{title:"Base",subtitle:"General workspace · super-agent",nav_general:"General",nav_activity:"Activity",nav_system:"System",workspaces_title:"Workspaces",workspaces_desc:"All projects registered in APX.",workspaces_new:"New project",workspaces_empty:"No projects. Add one with the button above.",sessions_title:"Sessions",sessions_desc:"Sessions from all engines (apx · claude · codex), newest first.",sessions_all:"All engines",sessions_empty:"No sessions.",sessions_error:"Could not read sessions: {msg}",defaults_title:"Agent defaults",defaults_desc:"Global vault templates. Bundled ones come with APX and are always present; ones you create or edit go in ~/.apx/agents and override. Import them into a project from Agents › Import.",defaults_show_removed:"Show removed",defaults_new:"New",defaults_empty:"No templates in the vault.",defaults_hide:"Hide",defaults_restore:"Restore",defaults_edit:"Edit",defaults_remove:"Hide",defaults_delete:"Delete",defaults_tombstone_msg:`Hide the default "{slug}"? It's bundled — tombstoned and recoverable with Restore.`,defaults_delete_msg:'Delete the template "{slug}"?',defaults_hidden:"Hidden.",defaults_deleted:"Deleted.",defaults_restored:"Restored.",defaults_new_title:"New template",defaults_new_desc:"POST /agents/vault — saved to ~/.apx/agents/<slug>.md",defaults_edit_title:'Edit "{slug}"',defaults_bundled_desc:"This is a bundled default. Saving does a copy-on-write to ~/.apx/agents/<slug>.md (becomes an override).",defaults_user_desc:"PATCH /agents/vault/:slug — edits the file in ~/.apx/agents.",defaults_master_label:"Master agent",defaults_slug_invalid:"invalid slug (must match /^[a-z][a-z0-9_-]*$/)",defaults_created:'Template "{slug}" created.',defaults_saved:'Template "{slug}" saved.'},logs:{title:"Logs",desc_global:"Daemon activity (global channels: telegram, direct…). ~/.apx/messages/<channel>/.",desc_project:"Project activity. ~/.apx/projects/<id>/messages/.",filter_channel:"filter channel (e.g. telegram)",filter_dir:"direction",all_directions:"All directions",in:"Incoming (in)",out:"Outgoing (out)",filter_type:"type",all_types:"All types",search_text:"search text…",count_of:"of",no_activity:"No activity.",no_activity_ch:'No activity in channel "{ch}".',error:"Could not read messages: {msg}",show_more:"show more",show_less:"show less",daemon_errors:"Daemon errors (~/.apx/logs/errors.jsonl)",no_errors:"No errors recorded. 🎉"},telegram_contacts:{title:"Telegram contacts",desc:"Who writes to the bots. The role defines which tools they can use; a guest has no permissions until you assign a role.",empty:"No contacts yet — they register automatically when someone writes to a bot.",owner_badge:"owner",assign_role:"Assign role",owner_hint:"Channel owner — change it from the channel",removed:"Contact deleted.",delete_confirm:"Delete contact {name}?",last_seen:"seen:",tools_all:"tools: all",tools_none:"tools: none",tools_label:"tools:"},telegram_channels:{title:"Channels",desc:"Each channel is a bot the daemon polls. Here you can add/remove channels, change the answering agent, the project it belongs to and its owner.",new_btn:"New channel",empty:"No channels yet — add the first one.",removed:"Channel deleted.",delete_confirm:"Delete channel {name}?",no_owner:"no owner (claimed on first DM)",owner_label:"owner:"},telegram_channel_dialog:{new_title:"New Telegram channel",edit_title:"Edit channel: {name}",name_label:"name (internal slug)",token_label:"bot_token",chat_id:"chat_id",project_label:"project",project_hint:"Slug or id of the project to pin this channel to (optional).",route_label:"route_to_agent",route_hint:"Answering agent; empty = APX super-agent.",owner_label:"owner_user_id",owner_hint:"Telegram user_id of the channel owner. Overrides global role to 'owner' here. Leave empty — first private message claims it.",owner_ph:"889721252",respond_label:"Respond with engine (not echo)",name_required:"name required",saved:"Channel saved."},telegram_send_dialog:{title:"Send to {name}",default_msg:"Test message from APX panel ✅"},telegram_roles:{title:"Roles",desc:"Each role defines which super-agent tools the assigned user can invoke. 'owner' always = all; 'guest' always = none (chat only).",empty:"No roles defined.",tools_all:"all tools",tools_none:"no tools",builtin:"built-in",delete_confirm:'Delete role "{name}"?',removed:"Role deleted.",saved:'Role "{name}" saved.',name_required:"Name required.",builtin_error:'"{name}" is a built-in role.',new_title:"New role or replace a custom one",name_label:"Name",name_ph:"editor",tools_label:"Tools (comma-separated)",tools_hint:"Empty = none. Examples: call_agent, list_tasks, create_task.",tools_ph:"call_agent, list_tasks",full_access:"Full access (all tools)",save_btn:"Save role",delete_btn:"Delete"},superagent:{title:"{persona}",badge:"super-agent · APX",desc:"Quick chat with your super-agent. Has access to tools (projects, tasks, mcps, agents); for a longer persistent thread, open Chats.",empty:"Send {persona} a message to get started.",thinking:"{persona} is thinking…",talk:"Talk to {persona}",new_chat:"New chat",placeholder:"Type and press enter to send (shift+enter = new line)…"},not_found:{title:"404",message:"That route does not exist."},ask_panel:{answers_header:"Answers",other:"Other",other_placeholder:"Write your own answer here",text_placeholder:"Type your answer…",back:"Back",skip:"Skip",next:"Next",submit:"Send",status_waiting:"Waiting for your answer…",status_received:"Answers received"},code_module:{title:"Code",badge:"super-agent",desc:"OpenCode-style coding sessions. Pick a project, open a session, and ask it to read, plan, edit or run.",no_projects:"No registered projects. Register one with `apx project add` to use Code.",sessions:"Sessions",new_session:"New session",untitled:"New session",no_sessions:"No sessions yet — create one to start coding.",pick_project:"Pick a project to see its sessions.",rename:"Rename",delete:"Delete",delete_confirm:"Delete this session? The transcript is removed; your files are untouched.",empty_chat:"Send a coding instruction to get started.",placeholder:"Ask for a change… (enter sends, shift+enter = new line)",mode_build:"Build",mode_plan:"Plan",mode_build_hint:"Build — edits files and runs commands",mode_plan_hint:"Plan — read-only, proposes changes without touching files",tab_context:"Context",tab_changes:"Changes",tab_artifacts:"Artifacts",artifacts_none:"No artifacts yet. Ask the agent to create a script under `artifacts/<name>`.",artifacts_count:"{n} artifact(s)",artifacts_copy_path:"Copy path",artifacts_run:"Run",artifacts_run_hint:"Run it from your terminal:",artifacts_delete:"Delete",artifacts_delete_confirm:"Delete this artifact? The file will be removed from disk.",ctx_model:"Model",ctx_tokens:"Tokens",ctx_input:"Input",ctx_output:"Output",ctx_messages:"Messages",ctx_breakdown:"Context breakdown",ctx_none:"No usage yet — send a turn to see tokens.",seg_system:"System",seg_user:"User",seg_assistant:"Assistant",seg_tool:"Tools",seg_other:"Other",changes_none:"No changes in this session yet.",changes_no_git:"Changes need a git repository. This project isn't one.",changes_files:"{n} file(s) changed",stopped:"[stopped]",close:"Close",reload:"Reload",discard_changes:"Discard changes",save_shortcut_hint:"Save (Cmd/Ctrl+S)",artifacts_rename:"Rename",artifacts_view:"View contents",artifacts_edit:"Edit contents",tree_collapse_all:"Collapse all",terminal_clear:"Clear",terminal_close:"Close terminal"},desktop_screen:{status_title:"Status",autostart_title:"Auto-start",shortcut_title:"Keyboard shortcut",appearance_title:"Appearance",activation_title:"Activation + transcription",last_conv_title:"Last conversation"},voice_screen:{providers_title:"Voice providers (TTS)",test_title:"Test voice",stt_title:"Transcription (STT)",configure_provider:"Configure {name}"},deck_screen:{widgets_title:"Widgets",context_title:"APX context",reload_manifest:"Reload manifest",widget_native:"Native APX widget",widget_external:"External widget"},memory_panel:{embeddings_title:"Embeddings (RAG)",ollama_title:"Ollama (local)",openai_title:"OpenAI",gemini_title:"Gemini",compaction_title:"History compaction"},router_panel:{title:"Model router"},engines_panel:{title:"Providers",new_btn:"New provider"},providers_modal:{new_title:"New provider",edit_title:"Edit {name}",list_models_hint:"List the provider's actual models",toggle_active:"Active · click to deactivate",toggle_inactive:"Inactive · click to activate",delete:"Delete"},chat_ui:{copy:"Copy",stop:"Stop",send:"Send",pick_model:"Pick model (or Auto)",insert_variable:"Insert variable"},sidebar_ui:{toggle:"Toggle sidebar"},models_ui:{invalid_hint:"Model/provider unavailable"},global_config:{title:"APX config"},agent_detail_extra:{skills_title:"Skills & tools"}},sb={es:_O,en:jO};function wO(){try{const e=localStorage.getItem(Rn.language);if(e&&e in sb)return e}catch{}return"es"}let Nf=wO();function SO(e){Nf=e;try{localStorage.setItem(Rn.language,e)}catch{}}const CO=[{value:"es",label:"Español"},{value:"en",label:"English"}];function kO(){return Nf}function EO(e){const n=sb[Nf],s=e.split(".");let o=n;for(const l of s)if(o&&typeof o=="object"&&l in o)o=o[l];else return;return typeof o=="string"?o:void 0}function NO(e,n){return n?e.replace(/\{(\w+)\}/g,(s,o)=>o in n?String(n[o]):`{${o}}`):e}function RO(e){const n=EO(e);if(n!==void 0)return n;if(Nf!=="es"){const s=sb.es,o=e.split(".");let l=s;for(const c of o)if(l&&typeof l=="object"&&c in l)l=l[c];else return;return typeof l=="string"?l:void 0}}function j(e,n){const s=RO(e);return s===void 0?e:NO(s,n)}function rb(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/identity",()=>I_.get());return{identity:e||{},error:n,isLoading:s,mutate:o,save:async c=>{const d=await I_.patch(c);return await o(d,{revalidate:!1}),d}}}function ob(){const{identity:e}=rb();return e?.agent_name?.trim()||"APX"}function TO(){return[{id:"voice",label:j("nav.modules.voice"),href:"/m/voice",icon:Ww},{id:"desktop",label:j("nav.modules.desktop"),href:"/m/desktop",icon:Jw},{id:"deck",label:j("nav.modules.deck"),href:"/m/deck",icon:sA},{id:"code",label:j("nav.modules.code"),href:"/m/code",icon:kr}]}function AO({onSelect:e,onOpenRoby:n}){const{projects:s,isLoading:o}=zc(),l=Yn(),c=TO(),d=ob(),f=g=>l.pathname===g||l.pathname.startsWith(`${g}/`),p=s.find(g=>String(g.id)==="0"),m=s.filter(g=>String(g.id)!=="0");return r.jsxs("aside",{className:"flex h-full w-20 flex-col items-center gap-3 overflow-y-auto bg-transparent py-3",children:[r.jsx(Mt,{content:j("nav.apx_admin"),side:"right",children:r.jsx("button",{type:"button",onClick:()=>e("/"),"data-testid":"nav-home",className:"mb-2 cursor-pointer",children:r.jsx(kA,{size:36})})}),o&&r.jsx("div",{className:"size-10 animate-pulse rounded-xl bg-muted"}),p&&r.jsx(Ii,{label:j("base.title"),testId:"project-avatar-0",title:j("base.subtitle"),active:f("/p/0"),isDefault:!0,icon:r.jsx("img",{src:"/modules/superagent.png",alt:j("base.title"),className:"size-7 object-contain",draggable:!1}),onClick:()=>e("/p/0")}),r.jsx("div",{className:"my-0.5 h-px w-8 rounded-full bg-border"}),c.map(g=>r.jsx(Ii,{label:g.label,testId:`module-avatar-${g.id}`,title:g.label,active:f(g.href),icon:r.jsx(g.icon,{size:18}),onClick:()=>e(g.href)},g.id)),m.length>0&&r.jsx("div",{className:"my-0.5 h-px w-8 rounded-full bg-border"}),m.map(g=>{const b=g.name||g.path.split("/").pop()||String(g.id),v=`/p/${g.id}`;return r.jsx(Ii,{label:b,testId:`project-avatar-${g.id}`,title:`${b} — ${g.path}`,active:f(v),onClick:()=>e(v)},g.id)}),r.jsx(Ii,{label:"Add",isAdd:!0,testId:"nav-add-project",icon:r.jsx(nn,{size:18}),active:!1,onClick:()=>e("/?action=add-project"),title:j("nav.add_project")}),r.jsx("div",{className:"flex-1"}),r.jsx(Ii,{label:"Settings",isSettings:!0,testId:"nav-settings",icon:r.jsx(Ld,{size:16}),active:l.pathname==="/settings"||l.pathname.startsWith("/settings/"),onClick:()=>e("/settings"),title:j("nav.settings")}),r.jsx(Mt,{content:j("superagent.talk",{persona:d}),side:"right",children:r.jsx("button",{type:"button",onClick:n,"data-testid":"nav-roby","aria-label":j("superagent.talk",{persona:d}),className:"mt-1 flex size-10 items-center justify-center rounded-xl border border-border/60 bg-muted/30 text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:r.jsx(gn,{size:18})})})]})}function G2(e){switch(e){case"personal":return"Personal";case"company":return"Company";case"app":return"App";case"software":return"Software";case"default":return"Default";case"other":return"Other";default:return j("nav.project")}}function Ge({title:e,description:n,action:s,className:o,children:l}){return r.jsxs("section",{className:Oe("rounded-xl border border-border bg-card p-5",o),children:[r.jsxs("header",{className:"mb-4 flex items-start justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:e}),n&&r.jsx("p",{className:"mt-0.5 text-sm text-muted-fg",children:n})]}),s]}),r.jsx("div",{children:l})]})}function U_({children:e}){return r.jsx("kbd",{className:"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wide text-muted-fg",children:e})}function Rf({ok:e}){return r.jsx("span",{className:Oe("inline-block size-2 rounded-full",e===null?"bg-muted-fg":e?"bg-emerald-500":"bg-red-500")})}const F2=h.createContext(void 0);function Y2(e=!1){const n=h.useContext(F2);if(n===void 0&&!e)throw new Error(Mn(16));return n}function MO(e){const{focusableWhenDisabled:n,disabled:s,composite:o=!1,tabIndex:l=0,isNativeButton:c}=e,d=o&&n!==!1,f=o&&n===!1;return{props:h.useMemo(()=>{const m={onKeyDown(g){s&&n&&g.key!=="Tab"&&g.preventDefault()}};return o||(m.tabIndex=l,!c&&s&&(m.tabIndex=n?l:-1)),(c&&(n||d)||!c&&s)&&(m["aria-disabled"]=s),c&&(!n||f)&&(m.disabled=s),m},[o,s,n,d,f,c,l])}}function Hl(e={}){const{disabled:n=!1,focusableWhenDisabled:s,tabIndex:o=0,native:l=!0,composite:c}=e,d=h.useRef(null),f=Y2(!0),p=c??f!==void 0,{props:m}=MO({focusableWhenDisabled:s,disabled:n,composite:p,tabIndex:o,isNativeButton:l}),g=h.useCallback(()=>{const S=d.current;Eg(S)&&p&&n&&m.disabled===void 0&&S.disabled&&(S.disabled=!1)},[n,m.disabled,p]);Me(g,[g]);const b=h.useCallback((S={})=>{const{onClick:C,onMouseDown:_,onKeyUp:w,onKeyDown:k,onPointerDown:E,...N}=S;return Da({onClick(R){if(n){R.preventDefault();return}C?.(R)},onMouseDown(R){n||_?.(R)},onKeyDown(R){if(n||($d(R),k?.(R),R.baseUIHandlerPrevented))return;const T=R.target===R.currentTarget,O=R.currentTarget,A=Eg(O),z=!l&&OO(O),B=T&&(l?A:!z),L=R.key==="Enter",D=R.key===" ",P=O.getAttribute("role"),H=P?.startsWith("menuitem")||P==="option"||P==="gridcell";if(T&&p&&D){if(R.defaultPrevented&&H)return;R.preventDefault(),z||l&&A?(O.click(),R.preventBaseUIHandler()):B&&(C?.(R),R.preventBaseUIHandler());return}B&&(!l&&(D||L)&&R.preventDefault(),!l&&L&&C?.(R))},onKeyUp(R){if(!n){if($d(R),w?.(R),R.target===R.currentTarget&&l&&p&&Eg(R.currentTarget)&&R.key===" "){R.preventDefault();return}R.baseUIHandlerPrevented||R.target===R.currentTarget&&!l&&!p&&R.key===" "&&C?.(R)}},onPointerDown(R){if(n){R.preventDefault();return}E?.(R)}},l?{type:"button"}:{role:"button"},m,N)},[n,m,p,l]),v=Le(S=>{d.current=S,g()});return{getButtonProps:b,buttonRef:v}}function Eg(e){return Gt(e)&&e.tagName==="BUTTON"}function OO(e){return!!(e?.tagName==="A"&&e?.href)}const zO=h.forwardRef(function(n,s){const{render:o,className:l,disabled:c=!1,focusableWhenDisabled:d=!1,nativeButton:f=!0,style:p,...m}=n,{getButtonProps:g,buttonRef:b}=Hl({disabled:c,focusableWhenDisabled:d,native:f});return Ht("button",n,{state:{disabled:c},ref:[s,b],props:[m,g]})}),H_=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,V_=pc,lb=(e,n)=>s=>{var o;if(n?.variants==null)return V_(e,s?.class,s?.className);const{variants:l,defaultVariants:c}=n,d=Object.keys(l).map(m=>{const g=s?.[m],b=c?.[m];if(g===null)return null;const v=H_(g)||H_(b);return l[m][v]}),f=s&&Object.entries(s).reduce((m,g)=>{let[b,v]=g;return v===void 0||(m[b]=v),m},{}),p=n==null||(o=n.compoundVariants)===null||o===void 0?void 0:o.reduce((m,g)=>{let{class:b,className:v,...S}=g;return Object.entries(S).every(C=>{let[_,w]=C;return Array.isArray(w)?w.includes({...c,...f}[_]):{...c,...f}[_]===w})?[...m,b,v]:m},[]);return V_(e,d,p,s?.class,s?.className)},DO=lb("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function mo({className:e,variant:n="default",size:s="default",...o}){return r.jsx(zO,{"data-slot":"button",className:Ot(DO({variant:n,size:s,className:e})),...o})}let q_=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const LO={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Zi={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},PO={disabled:!1,...Zi},ib={valid(e){return e===null?null:e?{[q_.valid]:""}:{[q_.invalid]:""}}},IO={invalid:void 0,name:void 0,validityData:{state:LO,errors:[],error:"",value:"",initialValue:null},setValidityData:Bn,disabled:void 0,touched:Zi.touched,setTouched:Bn,dirty:Zi.dirty,setDirty:Bn,filled:Zi.filled,setFilled:Bn,focused:Zi.focused,setFocused:Bn,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:PO,markedDirtyRef:{current:!1},registerFieldControl:Bn,validation:{getValidationProps:(e=un)=>e,getInputValidationProps:(e=un)=>e,inputRef:{current:null},commit:async()=>{}}},BO=h.createContext(IO);function Dc(e=!0){const n=h.useContext(BO);if(n.setValidityData===Bn&&!e)throw new Error(Mn(28));return n}const UO=h.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Bn,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function X2(){return h.useContext(UO)}const HO=h.createContext({controlId:void 0,registerControlId:Bn,labelId:void 0,setLabelId:Bn,messageIds:[],setMessageIds:Bn,getDescriptionProps:e=>e});function Tf(){return h.useContext(HO)}function VO(e,n,s,o=!0,l){const[c,d]=h.useState(),f=zr(l?`${l}-label`:void 0),p=e??n??c;return Me(()=>{const m=e||n||!o?void 0:qO(s.current,f);c!==m&&d(m)}),p}function qO(e,n){const s=$O(e);if(s)return!s.id&&n&&(s.id=n),s.id||void 0}function $O(e){if(!e)return;const n=e.parentElement;if(n&&n.tagName==="LABEL")return n;const s=e.id;if(s){const l=e.nextElementSibling;if(l&&l.htmlFor===s)return l}const o=e.labels;return o&&o[0]}function Af(e={}){const{id:n,implicit:s=!1,controlRef:o}=e,{controlId:l,registerControlId:c}=Tf(),d=zr(n),f=s?l:void 0,p=va(()=>Symbol("labelable-control")),m=h.useRef(!1),g=h.useRef(n!=null),b=Le(()=>{!m.current||c===Bn||(m.current=!1,c(p.current,void 0))});return Me(()=>{if(c===Bn)return;let v;if(s){const S=o?.current;dt(S)&&S.closest("label")!=null?v=n??null:v=f??d}else if(n!=null)g.current=!0,v=n;else if(g.current)v=d;else{b();return}if(v===void 0){b();return}m.current=!0,c(p.current,v)},[n,o,f,c,s,d,p,b]),h.useEffect(()=>b,[b]),l??d}function _c({controlled:e,default:n,name:s,state:o="value"}){const{current:l}=h.useRef(e!==void 0),[c,d]=h.useState(n),f=l?e:c,p=h.useCallback(m=>{l||d(m)},[]);return[f,p]}function cb(e,n,s,o,l=!0){const{registerFieldControl:c}=Dc(),d=h.useRef(null);d.current||(d.current=Symbol()),Me(()=>{const f=d.current;return!f||!l?void 0:(c(f,{controlRef:e,getValue:o,id:n,value:s}),()=>{c(f,void 0)})},[e,l,o,n,c,s])}const GO=h.forwardRef(function(n,s){const{render:o,className:l,id:c,name:d,value:f,disabled:p=!1,onValueChange:m,defaultValue:g,autoFocus:b=!1,style:v,...S}=n,{state:C,name:_,disabled:w,setTouched:k,setDirty:E,validityData:N,setFocused:R,setFilled:T,validationMode:O,validation:A}=Dc(),z=w||p,B=_??d,L={...C,disabled:z},{labelId:D}=Tf(),P=Af({id:c});Me(()=>{const G=f!=null;A.inputRef.current?.value||G&&f!==""?T(!0):G&&f===""&&T(!1)},[A.inputRef,T,f]);const H=h.useRef(null);Me(()=>{b&&H.current===Pn(yt(H.current))&&R(!0)},[b,R]);const[q]=_c({controlled:f,default:g,name:"FieldControl",state:"value"}),Y=f!==void 0,V=Y?q:void 0,$=Le(()=>A.inputRef.current?.value);return cb(A.inputRef,P,V,$),Ht("input",n,{ref:[s,H],state:L,props:[{id:P,disabled:z,name:B,ref:A.inputRef,"aria-labelledby":D,autoFocus:b,...Y?{value:V}:{defaultValue:g},onChange(G){const X=G.currentTarget.value;m?.(X,lt(Hs,G.nativeEvent)),E(X!==N.initialValue),T(X!=="")},onFocus(){R(!0)},onBlur(G){k(!0),R(!1),O==="onBlur"&&A.commit(G.currentTarget.value)},onKeyDown(G){G.currentTarget.tagName==="INPUT"&&G.key==="Enter"&&(k(!0),A.commit(G.currentTarget.value))}},A.getInputValidationProps(),S],stateAttributesMapping:ib})}),FO=h.forwardRef(function(n,s){return r.jsx(GO,{ref:s,...n})});function YO({className:e,type:n,...s}){return r.jsx(FO,{type:n,"data-slot":"input",className:Ot("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...s})}function XO({className:e,...n}){return r.jsx("textarea",{"data-slot":"textarea",className:Ot("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...n})}function KO(e){return Ht(e.defaultTagName??"div",e,e)}const QO=lb("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function ZO({className:e,variant:n="default",render:s,...o}){return KO({defaultTagName:"span",props:Da({className:Ot(QO({variant:n}),e)},o),render:s,state:{slot:"badge",variant:n}})}const K2=h.createContext(void 0);function WO(){const e=h.useContext(K2);if(e===void 0)throw new Error(Mn(63));return e}let $_=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Q2={...ib,checked(e){return e?{[$_.checked]:""}:{[$_.unchecked]:""}}};function ub(e,n){const s=h.useRef(e),o=Le(n);Me(()=>{s.current!==e&&o(s.current)},[e,o]),Me(()=>{s.current=e},[e])}const JO=h.forwardRef(function(n,s){const{checked:o,className:l,defaultChecked:c,"aria-labelledby":d,form:f,id:p,inputRef:m,name:g,nativeButton:b=!1,onCheckedChange:v,readOnly:S=!1,required:C=!1,disabled:_=!1,render:w,uncheckedValue:k,value:E,style:N,...R}=n,{clearErrors:T}=X2(),{state:O,setTouched:A,setDirty:z,validityData:B,setFilled:L,setFocused:D,shouldValidateOnChange:P,validationMode:H,disabled:q,name:Y,validation:V}=Dc(),{labelId:$}=Tf(),Z=q||_,G=Y??g,X=h.useRef(null),U=Vs(X,m,V.inputRef),K=h.useRef(null),F=zr(),J=Af({id:p,implicit:!1,controlRef:K}),ie=b?void 0:J,[re,oe]=_c({controlled:o,default:!!c,name:"Switch",state:"checked"});cb(K,F,re),Me(()=>{X.current&&L(X.current.checked)},[X,L]),ub(re,()=>{T(G),z(re!==B.initialValue),L(re),P()?V.commit(re):V.commit(re,!0)});const{getButtonProps:ce,buttonRef:ee}=Hl({disabled:Z,native:b}),Te=VO(d,$,X,!b,ie),Fe={id:b?J:F,role:"switch","aria-checked":re,"aria-readonly":S||void 0,"aria-required":C||void 0,"aria-labelledby":Te,onFocus(){Z||D(!0)},onBlur(){const Pe=X.current;!Pe||Z||(A(!0),D(!1),H==="onBlur"&&V.commit(Pe.checked))},onClick(Pe){if(S||Z)return;Pe.preventDefault();const Ie=X.current;Ie&&Ie.dispatchEvent(new(Qt(Ie)).PointerEvent("click",{bubbles:!0,shiftKey:Pe.shiftKey,ctrlKey:Pe.ctrlKey,altKey:Pe.altKey,metaKey:Pe.metaKey}))}},ve=Da({checked:re,disabled:Z,form:f,id:ie,name:G,required:C,style:G?RS:Ax,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:U,onChange(Pe){if(Pe.nativeEvent.defaultPrevented)return;if(S){Pe.preventDefault();return}const Ie=Pe.currentTarget.checked,be=lt(Hs,Pe.nativeEvent);v?.(Ie,be),!be.isCanceled&&oe(Ie)},onFocus(){K.current?.focus()}},V.getInputValidationProps,E!==void 0?{value:E}:un),Ce=h.useMemo(()=>({...O,checked:re,disabled:Z,readOnly:S,required:C}),[O,re,Z,S,C]),Ne=Ht("span",n,{state:Ce,ref:[s,K,ee],props:[Fe,V.getValidationProps,R,ce],stateAttributesMapping:Q2});return r.jsxs(K2.Provider,{value:Ce,children:[Ne,!re&&G&&k!==void 0&&r.jsx("input",{type:"hidden",form:f,name:G,value:k}),r.jsx("input",{...ve,suppressHydrationWarning:!0})]})}),ez=h.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,f=WO();return Ht("span",n,{state:f,ref:s,stateAttributesMapping:Q2,props:d})});function tz({className:e,size:n="default",...s}){return r.jsx(JO,{"data-slot":"switch","data-size":n,className:Ot("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...s,children:r.jsx(ez,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}function nz({className:e,...n}){return r.jsx(uf,{role:"status","aria-label":"Loading",className:Ot("size-4 animate-spin",e),...n})}const Z2=h.createContext(!1),W2=h.createContext(void 0);function yo(e){const n=h.useContext(W2);if(e===!1&&n===void 0)throw new Error(Mn(27));return n}const az={...Ul,...Bl},J2=h.forwardRef(function(n,s){const{render:o,className:l,style:c,forceRender:d=!1,...f}=n,{store:p}=yo(),m=p.useState("open"),g=p.useState("nested"),b=p.useState("mounted"),v=p.useState("transitionStatus");return Ht("div",n,{state:{open:m,transitionStatus:v},ref:[p.context.backdropRef,s],stateAttributesMapping:az,props:[{role:"presentation",hidden:!b,style:{userSelect:"none",WebkitUserSelect:"none"}},f],enabled:d||!g})}),Mf=h.forwardRef(function(n,s){const{render:o,className:l,style:c,disabled:d=!1,nativeButton:f=!0,...p}=n,{store:m}=yo(),g=m.useState("open"),{getButtonProps:b,buttonRef:v}=Hl({disabled:d,native:f}),S={disabled:d};function C(_){g&&m.setOpen(!1,lt(kM,_.nativeEvent))}return Ht("button",n,{state:S,ref:[s,v],props:[{onClick:C},p,b]})}),eC=h.forwardRef(function(n,s){const{render:o,className:l,style:c,id:d,...f}=n,{store:p}=yo(),m=zr(d);return p.useSyncedValueWithCleanup("descriptionElementId",m),Ht("p",n,{ref:s,props:[{id:m},f]})});let sz=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),rz=(function(e){return e[e.open=oo.open]="open",e[e.closed=oo.closed]="closed",e[e.startingStyle=oo.startingStyle]="startingStyle",e[e.endingStyle=oo.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const tC=h.createContext(void 0);function oz(){const e=h.useContext(tC);if(e===void 0)throw new Error(Mn(26));return e}const rc="ArrowUp",fl="ArrowDown",Wd="ArrowLeft",oc="ArrowRight",Of="Home",zf="End",nC=new Set([Wd,oc]),lz=new Set([Wd,oc,Of,zf]),aC=new Set([rc,fl]),iz=new Set([rc,fl,Of,zf]),sC=new Set([...nC,...aC]),db=new Set([...sC,Of,zf]),cz="Shift",uz="Control",dz="Alt",fz="Meta",pz=new Set([cz,uz,dz,fz]);function mz(e){return Gt(e)&&e.tagName==="INPUT"}function G_(e){return!!(mz(e)&&e.selectionStart!=null||Gt(e)&&e.tagName==="TEXTAREA")}function F_(e,n,s,o){if(!e||!n||!n.scrollTo)return;let l=e.scrollLeft,c=e.scrollTop;const d=e.clientWidth<e.scrollWidth,f=e.clientHeight<e.scrollHeight;if(d&&o!=="vertical"){const p=Y_(e,n,"left"),m=od(e),g=od(n);s==="ltr"&&(p+n.offsetWidth+g.scrollMarginRight>e.scrollLeft+e.clientWidth-m.scrollPaddingRight?l=p+n.offsetWidth+g.scrollMarginRight-e.clientWidth+m.scrollPaddingRight:p-g.scrollMarginLeft<e.scrollLeft+m.scrollPaddingLeft&&(l=p-g.scrollMarginLeft-m.scrollPaddingLeft)),s==="rtl"&&(p-g.scrollMarginRight<e.scrollLeft+m.scrollPaddingLeft?l=p-g.scrollMarginLeft-m.scrollPaddingLeft:p+n.offsetWidth+g.scrollMarginRight>e.scrollLeft+e.clientWidth-m.scrollPaddingRight&&(l=p+n.offsetWidth+g.scrollMarginRight-e.clientWidth+m.scrollPaddingRight))}if(f&&o!=="horizontal"){const p=Y_(e,n,"top"),m=od(e),g=od(n);p-g.scrollMarginTop<e.scrollTop+m.scrollPaddingTop?c=p-g.scrollMarginTop-m.scrollPaddingTop:p+n.offsetHeight+g.scrollMarginBottom>e.scrollTop+e.clientHeight-m.scrollPaddingBottom&&(c=p+n.offsetHeight+g.scrollMarginBottom-e.clientHeight+m.scrollPaddingBottom)}e.scrollTo({left:l,top:c,behavior:"auto"})}function Y_(e,n,s){const o=s==="left"?"offsetLeft":"offsetTop";let l=0;for(;n.offsetParent&&(l+=n[o],n.offsetParent!==e);)n=n.offsetParent;return l}function od(e){const n=getComputedStyle(e);return{scrollMarginTop:parseFloat(n.scrollMarginTop)||0,scrollMarginRight:parseFloat(n.scrollMarginRight)||0,scrollMarginBottom:parseFloat(n.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(n.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(n.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(n.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(n.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(n.scrollPaddingLeft)||0}}const gz={...Ul,...Bl,nestedDialogOpen(e){return e?{[rz.nestedDialogOpen]:""}:null}},rC=h.forwardRef(function(n,s){const{render:o,className:l,style:c,finalFocus:d,initialFocus:f,...p}=n,{store:m}=yo(),g=m.useState("descriptionElementId"),b=m.useState("disablePointerDismissal"),v=m.useState("floatingRootContext"),S=m.useState("popupProps"),C=m.useState("modal"),_=m.useState("mounted"),w=m.useState("nested"),k=m.useState("nestedOpenDialogCount"),E=m.useState("open"),N=m.useState("openMethod"),R=m.useState("titleElementId"),T=m.useState("transitionStatus"),O=m.useState("role"),A=v.useState("floatingId"),z=p.id??A;oz(),Or({open:E,ref:m.context.popupRef,onComplete(){E&&m.context.onOpenChangeComplete?.(!0)}});function B(Y){return Y==="touch"?m.context.popupRef.current:!0}const L=f===void 0?B:f,D=k>0,P=m.useStateSetter("popupElement"),q=Ht("div",n,{state:{open:E,nested:w,transitionStatus:T,nestedDialogOpen:D},props:[S,{id:z,"aria-labelledby":R??void 0,"aria-describedby":g??void 0,role:O,...Cf,hidden:!_,onKeyDown(Y){db.has(Y.key)&&Y.stopPropagation()},style:{[sz.nestedDialogs]:k}},p],ref:[s,m.context.popupRef,P],stateAttributesMapping:gz});return r.jsx(t2,{context:v,openInteractionType:N,disabled:!_,closeOnFocusOut:!b,initialFocus:L,returnFocus:d,modal:C!==!1,restoreFocus:"popup",children:q})}),oC=h.forwardRef(function(n,s){const{cutout:o,...l}=n;let c;if(o){const d=o.getBoundingClientRect();c=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${d.left}px ${d.top}px,${d.left}px ${d.bottom}px,${d.right}px ${d.bottom}px,${d.right}px ${d.top}px,${d.left}px ${d.top}px)`}return r.jsx("div",{ref:s,role:"presentation","data-base-ui-inert":"",...l,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})}),lC=h.forwardRef(function(n,s){const{keepMounted:o=!1,...l}=n,{store:c}=yo(),d=c.useState("mounted"),f=c.useState("modal"),p=c.useState("open");return d||o?r.jsx(tC.Provider,{value:o,children:r.jsxs(e2,{ref:s,...l,children:[d&&f===!0&&r.jsx(oC,{ref:c.context.internalBackdropRef,inert:Kx(!p)}),n.children]})}):null});let X_={},K_={},Q_="";function hz(e){if(typeof document>"u")return!1;const n=yt(e);return Qt(n).innerWidth-n.documentElement.clientWidth>0}function xz(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const s=yt(e),o=s.documentElement,l=s.body,c=Ar(o)?o:l,d=c.style.overflowY,f=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",c.style.overflowY="scroll";const p=c.offsetWidth;c.style.overflowY="hidden";const m=c.offsetWidth;return c.style.overflowY=d,o.style.scrollbarGutter=f,p===m}function bz(e){const n=yt(e),s=n.documentElement,o=n.body,l=Ar(s)?s:o,c={overflowY:l.style.overflowY,overflowX:l.style.overflowX};return Object.assign(l.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(l.style,c)}}function vz(e){const n=yt(e),s=n.documentElement,o=n.body,l=Qt(s);let c=0,d=0,f=!1;const p=es.create();if(wx&&(l.visualViewport?.scale??1)!==1)return()=>{};function m(){const S=l.getComputedStyle(s),C=l.getComputedStyle(o),k=(S.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=s.scrollTop,d=s.scrollLeft,X_={scrollbarGutter:s.style.scrollbarGutter,overflowY:s.style.overflowY,overflowX:s.style.overflowX},Q_=s.style.scrollBehavior,K_={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};const E=s.scrollHeight>s.clientHeight,N=s.scrollWidth>s.clientWidth,R=S.overflowY==="scroll"||C.overflowY==="scroll",T=S.overflowX==="scroll"||C.overflowX==="scroll",O=Math.max(0,l.innerWidth-o.clientWidth),A=Math.max(0,l.innerHeight-o.clientHeight),z=parseFloat(C.marginTop)+parseFloat(C.marginBottom),B=parseFloat(C.marginLeft)+parseFloat(C.marginRight),L=Ar(s)?s:o;if(f=xz(e),f){s.style.scrollbarGutter=k,L.style.overflowY="hidden",L.style.overflowX="hidden";return}Object.assign(s.style,{scrollbarGutter:k,overflowY:"hidden",overflowX:"hidden"}),(E||R)&&(s.style.overflowY="scroll"),(N||T)&&(s.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:z||A?`calc(100dvh - ${z+A}px)`:"100dvh",width:B||O?`calc(100vw - ${B+O}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),o.scrollTop=c,o.scrollLeft=d,s.setAttribute("data-base-ui-scroll-locked",""),s.style.scrollBehavior="unset"}function g(){Object.assign(s.style,X_),Object.assign(o.style,K_),f||(s.scrollTop=c,s.scrollLeft=d,s.removeAttribute("data-base-ui-scroll-locked"),s.style.scrollBehavior=Q_)}function b(){g(),p.request(m)}m();const v=ft(l,"resize",b);return()=>{p.cancel(),g(),typeof l.removeEventListener=="function"&&v()}}class yz{lockCount=0;restore=null;timeoutLock=Ga.create();timeoutUnlock=Ga.create();acquire(n){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(n)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(n){if(this.lockCount===0||this.restore!==null)return;const o=yt(n).documentElement,l=Qt(o).getComputedStyle(o).overflowY;if(l==="hidden"||l==="clip"){this.restore=Bn;return}const c=hS||!hz(n);this.restore=c?bz(n):vz(n)}}const _z=new yz;function iC(e=!0,n=null){Me(()=>{if(e)return _z.acquire(n)},[e,n])}function jz(e){const{store:n,parentContext:s,actionsRef:o,isDrawer:l}=e,c=n.useState("open");P5(n,c),g2(n);const{forceUnmount:d}=h2(c,n),f=h.useCallback(()=>{n.setOpen(!1,lt(SS))},[n]);return h.useImperativeHandle(o,()=>({unmount:d,close:f}),[d,f]),{parentContext:s,isDrawer:l}}function wz({store:e,dialogRoot:n}){const{parentContext:s,isDrawer:o}=n,l=e.useState("open"),c=e.useState("disablePointerDismissal"),d=e.useState("modal"),f=e.useState("popupElement"),p=e.useState("floatingRootContext"),[m,g]=h.useState(0),[b,v]=h.useState(0),S=m===0,C=Ux(p,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:d==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(E){if(!e.context.outsidePressEnabledRef.current||"button"in E&&E.button!==0||"touches"in E&&E.touches.length!==1)return!1;const N=Tn(E);if(S&&!c){const R=N;return d&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===R||e.context.backdropRef.current===R||Ze(R,f)&&!R?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:S});iC(l&&d===!0,f),e.useContextCallback("onNestedDialogOpen",(E,N)=>{g(E),v(N)}),e.useContextCallback("onNestedDialogClose",()=>{g(0),v(0)}),h.useEffect(()=>(s?.onNestedDialogOpen&&l&&s.onNestedDialogOpen(m+1,b+(o?1:0)),s?.onNestedDialogClose&&!l&&s.onNestedDialogClose(),()=>{s?.onNestedDialogClose&&l&&s.onNestedDialogClose()}),[o,l,m,b,s]);const _=C.reference??un,w=C.trigger??un,k=h.useMemo(()=>Da(Cf,C.floating),[C.floating]);return x2(e,{activeTriggerProps:_,inactiveTriggerProps:w,popupProps:k,nestedOpenDialogCount:m,nestedOpenDrawerCount:b}),null}const Sz={..._2,modal:ze(e=>e.modal),nested:ze(e=>e.nested),nestedOpenDialogCount:ze(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:ze(e=>e.nestedOpenDrawerCount),disablePointerDismissal:ze(e=>e.disablePointerDismissal),openMethod:ze(e=>e.openMethod),descriptionElementId:ze(e=>e.descriptionElementId),titleElementId:ze(e=>e.titleElementId),viewportElement:ze(e=>e.viewportElement),role:ze(e=>e.role)};class fb extends Vx{constructor(n,s,o=!1){const l=new kf,c=Cz(n);c.floatingRootContext=v2(l,s,o),super(c,{popupRef:h.createRef(),backdropRef:h.createRef(),internalBackdropRef:h.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:l,onOpenChange:void 0,onOpenChangeComplete:void 0},Sz)}setOpen=(n,s)=>{if(s.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&s.trigger==null&&this.state.activeTriggerId!=null&&(s.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(n,s),s.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,s);const o={open:n};m2(o,n,s.trigger),this.update(o)};static useStore(n,s){return p2(n,(l,c)=>new fb(s,l,c),!0).store}}function Cz(e={}){return{...b2(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function kz(e,n="dialog"){const{children:s,open:o,defaultOpen:l=!1,onOpenChange:c,onOpenChangeComplete:d,disablePointerDismissal:f=!1,modal:p=!0,actionsRef:m,handle:g,triggerId:b,defaultTriggerId:v=null}=e,S=n==="drawer",C=n==="alert-dialog",_=C?!0:p,w=C||f,k=C?"alertdialog":"dialog",E=yo(!0),R={modal:_,disablePointerDismissal:w,nested:!!E,role:k},T=fb.useStore(g?.store,{open:l,openProp:o,activeTriggerId:v,triggerIdProp:b,...R});_x(()=>{const P=o===void 0&&T.state.open===!1&&l===!0?{open:!0,activeTriggerId:v}:null;C?T.update(P?{...R,...P}:R):P&&T.update(P)}),T.useControlledProp("openProp",o),T.useControlledProp("triggerIdProp",b),T.useSyncedValues(R),T.useContextCallback("onOpenChange",c),T.useContextCallback("onOpenChangeComplete",d);const O=T.useState("open"),A=T.useState("mounted"),z=T.useState("payload"),B=jz({store:T,actionsRef:m,parentContext:E?.store.context,isDrawer:S}),L=O||A,D=h.useMemo(()=>({store:T}),[T]);return r.jsx(Z2.Provider,{value:!1,children:r.jsxs(W2.Provider,{value:D,children:[L&&r.jsx(wz,{store:T,dialogRoot:B}),typeof s=="function"?s({payload:z}):s]})})}function cC(e){const n=h.useContext(Z2)?"drawer":"dialog";return kz(e,n)}const uC=h.forwardRef(function(n,s){const{render:o,className:l,style:c,id:d,...f}=n,{store:p}=yo(),m=zr(d);return p.useSyncedValueWithCleanup("titleElementId",m),Ht("h2",n,{ref:s,props:[{id:m},f]})});function Ez(e){const n=h.useRef(""),s=h.useCallback(l=>{l.defaultPrevented||(n.current=l.pointerType,e(l,l.pointerType))},[e]);return{onClick:h.useCallback(l=>{if(l.detail===0){e(l,"keyboard");return}"pointerType"in l?e(l,l.pointerType):e(l,n.current),n.current=""},[e]),onPointerDown:s}}function Nz(e,n){const s=Le((c,d)=>{(typeof e=="function"?e():e)||n(d||(hS?"touch":""))}),{onClick:o,onPointerDown:l}=Ez(s);return h.useMemo(()=>({onClick:o,onPointerDown:l}),[o,l])}function Rz(e){const[n,s]=h.useState(null),o=Nz(e,s);return ub(e,l=>{l&&!e&&s(null)}),h.useMemo(()=>({openMethod:n,triggerProps:o}),[n,o])}function Ih({...e}){return r.jsx(cC,{"data-slot":"dialog",...e})}function Tz({...e}){return r.jsx(lC,{"data-slot":"dialog-portal",...e})}function Az({...e}){return r.jsx(Mf,{"data-slot":"dialog-close",...e})}function Mz({className:e,...n}){return r.jsx(J2,{"data-slot":"dialog-overlay",className:Ot("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...n})}function Bh({className:e,children:n,showCloseButton:s=!0,...o}){return r.jsxs(Tz,{children:[r.jsx(Mz,{}),r.jsxs(rC,{"data-slot":"dialog-content",className:Ot("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...o,children:[n,s&&r.jsxs(Mf,{"data-slot":"dialog-close",render:r.jsx(mo,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[r.jsx(vo,{}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Uh({className:e,...n}){return r.jsx("div",{"data-slot":"dialog-header",className:Ot("flex flex-col gap-2",e),...n})}function Z_({className:e,showCloseButton:n=!1,children:s,...o}){return r.jsxs("div",{"data-slot":"dialog-footer",className:Ot("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...o,children:[s,n&&r.jsx(Mf,{render:r.jsx(mo,{variant:"outline"}),children:"Close"})]})}function Hh({className:e,...n}){return r.jsx(uC,{"data-slot":"dialog-title",className:Ot("font-heading text-base leading-none font-medium",e),...n})}function Oz({className:e,...n}){return r.jsx(eC,{"data-slot":"dialog-description",className:Ot("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...n})}const zz={primary:"default",secondary:"outline",ghost:"ghost",destructive:"destructive"},Dz={sm:"sm",md:"default"};function ge({variant:e="secondary",size:n="md",loading:s,className:o,children:l,disabled:c,type:d="button",...f}){return r.jsxs(mo,{type:d,variant:zz[e],size:Dz[n],disabled:c||s,className:o,...f,children:[s?r.jsx(Pa,{size:14}):null,l]})}function ke(e){return r.jsx(YO,{...e})}function cn(e){return r.jsx(XO,{...e})}function Lz(e){return r.jsx("select",{...e,className:Oe("h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",e.className)})}function de({label:e,hint:n,badge:s,children:o}){return r.jsxs("label",{className:"block space-y-1",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[e,s&&r.jsx("span",{className:"rounded bg-muted px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground",children:s})]}),o,n&&r.jsx("span",{className:"block text-[11px] text-muted-foreground/70",children:n})]})}function Zt({checked:e,onChange:n,label:s,disabled:o}){return r.jsxs("label",{className:Oe("inline-flex items-center gap-2",o&&"opacity-50"),children:[r.jsx(tz,{checked:e,onCheckedChange:n,disabled:o}),s&&r.jsx("span",{className:"text-sm",children:s})]})}function Ve({children:e,tone:n="muted",className:s}){const o=n==="danger"?"destructive":n==="muted"?"secondary":"outline",l={muted:"",danger:"",success:"text-emerald-400 border-emerald-500/30",warning:"text-amber-400 border-amber-500/30",info:"text-sky-400 border-sky-500/30"};return r.jsx(ZO,{variant:o,className:Oe("rounded-md",l[n],s),children:e})}function Vn({open:e,onClose:n,title:s,description:o,children:l,footer:c,size:d="md"}){const f={sm:"sm:max-w-md",md:"sm:max-w-lg",lg:"sm:max-w-2xl",xl:"sm:max-w-4xl"};return r.jsx(Ih,{open:e,onOpenChange:p=>{p||n()},children:r.jsxs(Bh,{className:Oe("flex max-h-[88vh] w-full flex-col gap-0 p-0",f[d]),children:[(s||o)&&r.jsxs(Uh,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[s&&r.jsx(Hh,{children:s}),o&&r.jsx(Oz,{children:o})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-5 py-4",children:l}),c&&r.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-border px-5 py-4",children:c})]})})}function Pa({size:e=14}){return r.jsx(nz,{style:{width:e,height:e}})}function pt({children:e}){return r.jsx("div",{className:"rounded-lg border border-dashed border-border bg-muted/20 px-4 py-6 text-center text-sm text-muted-foreground",children:e})}function nt({label:e="Cargando…"}){return r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Pa,{})," ",e]})}const dC=h.createContext(null);let Pz=1;function Iz({children:e}){const[n,s]=h.useState([]),o=h.useCallback((c,d)=>{const f=Pz++;s(p=>[...p,{id:f,kind:c,message:d}]),setTimeout(()=>{s(p=>p.filter(m=>m.id!==f))},4500)},[]),l=h.useMemo(()=>({show:o,success:c=>o("success",c),error:c=>o("error",c),info:c=>o("info",c)}),[o]);return h.useEffect(()=>(window.__apxToast=l,()=>{delete window.__apxToast}),[l]),r.jsxs(dC.Provider,{value:l,children:[e,r.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-[100] flex w-80 max-w-[calc(100vw-2rem)] flex-col gap-2",children:n.map(c=>r.jsx("div",{className:Oe("pointer-events-auto overflow-hidden rounded-lg border bg-card px-3 py-2 text-sm shadow-lg",c.kind==="success"&&"border-emerald-500/40",c.kind==="error"&&"border-destructive/60",c.kind==="info"&&"border-border"),children:r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:Oe("mt-1 size-2 shrink-0 rounded-full",c.kind==="success"&&"bg-emerald-500",c.kind==="error"&&"bg-destructive",c.kind==="info"&&"bg-sky-500")}),r.jsx("span",{className:"flex-1 break-words",children:c.message})]})},c.id))})]})}function at(){const e=h.useContext(dC);if(!e)throw new Error("useToast must be used inside <ToastProvider>");return e}function fC(){const{data:e,error:n,isLoading:s}=Qe("/health",()=>dO.get(),{refreshInterval:ff.health});return{health:e,error:n,isLoading:s,isUp:!n&&!!e}}function Bz(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/engines",()=>Qd.list());return{engines:e?.engines||[],error:n,isLoading:s,mutate:o}}function Uz(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/telegram/status",()=>An.status(),{refreshInterval:ff.telegramStatus});return{status:e,error:n,isLoading:s,mutate:o}}function pb(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/telegram/channels",()=>An.channels.list());return{channels:e?.channels||[],error:n,isLoading:s,mutate:o}}function mb(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/telegram/contacts",()=>An.contacts.list());return{contacts:e?.contacts||[],roles:e?.roles||{},channelOwners:e?.channel_owners||[],error:n,isLoading:s,mutate:o}}function qa(e){return typeof e=="string"&&e.startsWith("*** set ***")}function Sr(e,n="(no seteada)"){return qa(e)?e:n}function El(e){if(typeof e!="string")return null;const n=e.match(/\(\.\.\.([^)]+)\)/);return n?n[1]:null}function pC({channel:e,onClose:n,onSaved:s}){const o=at(),[l,c]=h.useState(!1),[d,f]=h.useState({name:""});h.useEffect(()=>{f(e?{...e,bot_token:""}:{name:""})},[e?.name]);const p=async()=>{if(!d.name?.trim()){o.error("name requerido");return}c(!0);try{e&&e.name!==""&&e?.name===d.name?await An.channels.patch(e.name,d):await An.channels.upsert(d),o.success("Canal guardado."),s()}catch(m){o.error(m.message)}finally{c(!1)}};return r.jsx(Vn,{open:!!e,onClose:n,title:e?.name?j("telegram_channel_dialog.edit_title",{name:e.name}):j("telegram_channel_dialog.new_title"),description:"POST /telegram/channels (upsert) — PATCH /telegram/channels/:name (parcial).",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:n,disabled:l,children:j("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:p,loading:l,children:j("common.save")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:"name (slug interno)",children:r.jsx(ke,{value:d.name,onChange:m=>f({...d,name:m.target.value}),disabled:!!e?.name})}),r.jsx(de,{label:"bot_token",hint:e?.bot_token?Sr(e.bot_token):"Token del BotFather. Se guarda en ~/.apx/config.json.",children:r.jsx(ke,{type:"password",value:d.bot_token||"",onChange:m=>f({...d,bot_token:m.target.value}),placeholder:e?.bot_token?Sr(e.bot_token):""})}),r.jsx(de,{label:"chat_id",children:r.jsx(ke,{value:d.chat_id||"",onChange:m=>f({...d,chat_id:m.target.value})})}),r.jsx(de,{label:"project",hint:"Slug o id del proyecto al que pinear este canal (opcional).",children:r.jsx(ke,{value:d.project||"",onChange:m=>f({...d,project:m.target.value})})}),r.jsx(de,{label:"route_to_agent",hint:"Agente que contesta; vacío = super-agent APX.",children:r.jsx(ke,{value:d.route_to_agent||"",onChange:m=>f({...d,route_to_agent:m.target.value})})}),r.jsx(de,{label:"owner_user_id",hint:"user_id de Telegram del dueño de este canal. Override del rol global a 'owner' acá. Si lo dejás vacío, el primer mensaje privado lo reclama.",children:r.jsx(ke,{value:d.owner_user_id!=null?String(d.owner_user_id):"",onChange:m=>{const g=m.target.value.trim();f({...d,owner_user_id:g===""?void 0:/^\d+$/.test(g)?Number(g):g})},placeholder:"889721252"})}),r.jsx(Zt,{checked:!!d.respond_with_engine,onChange:m=>f({...d,respond_with_engine:m}),label:"Responder con engine (no echo)"})]})})}function mC({channel:e,onClose:n}){const s=at(),[o,l]=h.useState(j("admin.telegram_default_message")),[c,d]=h.useState(!1),f=async()=>{if(!(!o.trim()||!e)){d(!0);try{await An.send({text:o,channel:e.name}),s.success("Mensaje enviado."),n()}catch(p){s.error(p.message)}finally{d(!1)}}};return r.jsx(Vn,{open:!!e,onClose:n,title:e?`${j("admin.telegram_send_test_title")} ${e.name}`:"",description:e?`chat_id: ${e.chat_id||"—"}`:"",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:n,disabled:c,children:j("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:f,loading:c,children:"Enviar"})]}),children:r.jsx(de,{label:"Texto",children:r.jsx(cn,{rows:4,value:o,onChange:p=>l(p.target.value)})})})}function gC({bare:e=!1}){const n=at(),{contacts:s,roles:o,channelOwners:l,isLoading:c,mutate:d}=mb(),f=new Set(l.filter(v=>v.owner_user_id!=null).map(v=>String(v.owner_user_id))),p=Array.from(new Set(["owner","guest",...Object.keys(o)])),m=async(v,S)=>{try{await An.contacts.patch(v.user_id,{role:S}),n.success(`${v.name||v.user_id} → ${S}`),d()}catch(C){n.error(C.message)}},g=async v=>{if(confirm(j("telegram_contacts.delete_confirm",{name:v.name||String(v.user_id)})))try{await An.contacts.remove(v.user_id),n.success(j("telegram_contacts.removed")),d()}catch(S){n.error(S.message)}},b=r.jsxs(r.Fragment,{children:[c&&r.jsx(nt,{}),!c&&s.length===0&&r.jsx(pt,{children:j("telegram_contacts.empty")}),s.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:s.map(v=>{const S=f.has(String(v.user_id)),C=S?"owner":v.role||"guest";return r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("span",{className:"font-medium",children:v.name||"—"}),v.username&&r.jsxs("span",{className:"ml-2 text-xs text-muted-fg",children:["@",v.username]}),S&&r.jsx(Ve,{tone:"success",children:j("telegram_contacts.owner_badge")})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Lz,{value:C,disabled:S,onChange:_=>m(v,_.target.value),title:j(S?"telegram_contacts.owner_hint":"telegram_contacts.assign_role"),children:p.map(_=>r.jsx("option",{value:_,children:_},_))}),r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>g(v),children:j("common.delete")})]})]}),r.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[r.jsxs("span",{children:["user_id: ",String(v.user_id)]}),r.jsxs("span",{children:[j("telegram_contacts.last_seen")," ",v.last_seen?v.last_seen.slice(0,10):"—"]}),r.jsx("span",{children:Hz(o[C])})]})]},String(v.user_id))})})]});return e?b:r.jsx(Ge,{title:j("telegram_contacts.title"),description:j("telegram_contacts.desc"),children:b})}function Hz(e){return!e||e.tools===void 0?"":e.tools==="*"?j("telegram_contacts.tools_all"):Array.isArray(e.tools)?e.tools.length?`${j("telegram_contacts.tools_label")} ${e.tools.join(", ")}`:j("telegram_contacts.tools_none"):""}function Vz(){const e=_a(),n=at(),{health:s,isUp:o}=fC(),{projects:l,isLoading:c,mutate:d}=zc(),{engines:f,isLoading:p}=Bz(),{status:m,mutate:g}=Uz(),{channels:b,isLoading:v,mutate:S}=pb(),[C,_]=h.useState(null),[w,k]=h.useState(null),E=async()=>{try{await Cl.reload(),n.success(j("admin.reload_success"))}catch(O){n.error(O.message)}},N=async()=>{try{m?.enabled?(await An.stop(),n.info(j("admin.telegram_polling_stopped"))):(await An.start(),n.success(j("admin.telegram_polling_started"))),g()}catch(O){n.error(O.message)}},R=async O=>{if(confirm(j("telegram_channels.delete_confirm",{name:O})))try{await An.channels.remove(O),n.success(j("admin.telegram_channel_removed")),S()}catch(A){n.error(A.message)}},T=async(O,A)=>{if(confirm(j("admin.unregister_confirm",{label:A})))try{await aa.remove(O),n.success(j("project.unregistered")),d()}catch(z){n.error(z.message)}};return r.jsxs("div",{className:"mx-auto max-w-5xl space-y-6 p-6","data-testid":"screen-admin",children:[r.jsxs("header",{className:"flex items-end justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:j("admin.title")}),r.jsx("p",{className:"text-sm text-muted-fg",children:j("admin.subtitle")})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ge,{size:"sm",onClick:E,title:j("daemon.reload_hint"),children:[j("common.reload")," config"]}),r.jsxs(ge,{size:"sm",variant:"primary",onClick:()=>e("/?action=add-project"),children:[r.jsx(nn,{size:14})," ",j("nav.project")]})]})]}),r.jsx(Ge,{title:j("daemon.version"),children:r.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[r.jsx(Ng,{label:j("daemon.version"),value:s?.version||"—"}),r.jsx(Ng,{label:j("daemon.uptime"),value:s?`${s.uptime_s}s`:"—"}),r.jsx(Ng,{label:j("daemon.status"),value:j(o?"daemon.running":"daemon.down"),ok:o})]})}),r.jsxs(Ge,{title:j("admin.engines_title"),description:j("admin.engines_subtitle"),children:[p&&r.jsx(nt,{}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:f.map(O=>r.jsx(Ve,{tone:"info",children:O},O))})]}),r.jsxs(Ge,{title:j("admin.telegram_title"),description:j("admin.telegram_subtitle"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zt,{checked:!!m?.enabled,onChange:N,label:m?.enabled?j("admin.telegram_polling_on"):j("admin.telegram_polling_off")}),r.jsxs(ge,{size:"sm",onClick:()=>_({name:""}),children:[r.jsx(nn,{size:14})," ",j("admin.telegram_add_channel")]})]}),children:[v&&r.jsx(nt,{}),b.length===0&&r.jsx(pt,{children:j("common.none_yet")}),r.jsx("ul",{className:"space-y-2 text-sm",children:b.map(O=>r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-medium",children:O.name}),r.jsxs("div",{className:"flex items-center gap-2",children:[O.project&&r.jsxs(Ve,{tone:"success",children:["project = ",O.project]}),r.jsxs(ge,{size:"sm",variant:"ghost",onClick:()=>k(O),children:[r.jsx(Ya,{size:13})," ",j("admin.telegram_send_test")]}),r.jsx(ge,{size:"sm",variant:"secondary",onClick:()=>_(O),children:j("common.edit")}),r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>R(O.name),children:j("common.delete")})]})]}),r.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[r.jsxs("span",{children:["chat_id: ",O.chat_id||"—"]}),r.jsxs("span",{children:["route_to_agent: ",O.route_to_agent||"default APX"]}),r.jsxs("span",{children:["engine: ",O.respond_with_engine?j("admin.engine_badge"):j("admin.engine_badge_no")]})]})]},O.name))})]}),r.jsx(gC,{}),r.jsxs(Ge,{title:j("admin.projects_title"),description:j("admin.projects_subtitle"),children:[c&&r.jsx(nt,{}),r.jsx("ul",{className:"divide-y divide-border",children:l.map(O=>r.jsxs("li",{className:"flex items-center gap-3 py-2",children:[r.jsxs("span",{className:"w-10 font-mono text-xs text-muted-fg",children:["#",O.id]}),r.jsxs("button",{type:"button",className:"flex-1 text-left hover:underline",onClick:()=>e(`/p/${O.id}`),children:[r.jsx("span",{className:"font-medium",children:O.name||O.path.split("/").pop()}),r.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:O.path})]}),r.jsxs(Ve,{children:[O.agents??0," ",j("admin.agents_badge")]}),Number(O.id)!==0&&r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>T(String(O.id),O.name||O.path),children:j("admin.unregister")})]},O.id))})]}),r.jsx(pC,{channel:C,onClose:()=>_(null),onSaved:()=>{_(null),S()}}),r.jsx(mC,{channel:w,onClose:()=>k(null)})]})}function Ng({label:e,value:n,ok:s}){return r.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[r.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),r.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[s!==void 0&&r.jsx(Rf,{ok:s}),r.jsx("span",{children:n})]})]})}function hC(e){const[n,s]=h.useState(!1);h.useEffect(()=>{try{s(localStorage.getItem(e)==="true")}catch{}},[e]);const o=h.useCallback(()=>s(l=>{const c=!l;try{localStorage.setItem(e,String(c))}catch{}return c}),[e]);return{collapsed:n,toggle:o}}function qz({collapsed:e,onToggle:n}){return r.jsx(Mt,{content:e?"Expandir menú":"Colapsar menú",side:"bottom",children:r.jsx("button",{type:"button",onClick:n,"aria-label":e?"Expandir menú":"Colapsar menú",className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:r.jsx(eS,{className:Oe("size-4 transition-transform",e&&"rotate-180")})})})}function $z({sections:e,active:n,onChange:s,collapsed:o=!1}){return r.jsx("nav",{className:Oe("hidden md:flex shrink-0 flex-col gap-1 py-3 transition-all",o?"w-12 items-center px-1":"w-52 px-2"),children:e.map((l,c)=>r.jsxs("div",{className:Oe("w-full",c>0&&"mt-2"),children:[!o&&l.title&&r.jsx("p",{className:"mb-1 px-2 text-[9px] font-semibold uppercase tracking-wider text-muted-fg/70",children:l.title}),r.jsx("div",{className:"space-y-0.5",children:l.items.map(({key:d,label:f,icon:p,badge:m})=>{const g=n===d,b=r.jsxs("button",{type:"button",onClick:()=>s(d),"data-testid":`tabnav-${d||"index"}`,className:Oe("flex cursor-pointer items-center rounded-lg transition-colors",o?"size-9 justify-center":"w-full gap-2 px-2.5 py-1.5",g?"bg-accent text-accent-fg":"text-muted-fg hover:bg-accent/60 hover:text-foreground"),children:[r.jsx(p,{className:"size-4 shrink-0"}),!o&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"flex-1 truncate text-left text-xs",children:f}),m!==void 0&&r.jsx("span",{className:"rounded-full bg-muted px-1.5 text-[9px] text-muted-fg",children:m})]})]});return o?r.jsx(Mt,{content:f,side:"right",children:b},d):r.jsx(h.Fragment,{children:b},d)})})]},c))})}const xC=h.createContext(null),bC=h.createContext(null),vC=h.createContext(""),yC=h.createContext(null),_C=h.createContext(null),jC=h.createContext(null);function Gz({children:e}){const[n,s]=h.useState(null),[o,l]=h.useState(""),[c,d]=h.useState(null);return r.jsx(bC.Provider,{value:s,children:r.jsx(xC.Provider,{value:n,children:r.jsx(yC.Provider,{value:l,children:r.jsx(vC.Provider,{value:o,children:r.jsx(jC.Provider,{value:d,children:r.jsx(_C.Provider,{value:c,children:e})})})})})})}function Fz(){return h.useContext(xC)}function Yz(e,n){const s=h.useContext(bC);h.useEffect(()=>(s?.({collapsed:e,toggle:n}),()=>s?.(null)),[e,n,s])}function Xz(){return h.useContext(vC)}function Kz(e){const n=h.useContext(yC);h.useEffect(()=>(n?.(e),()=>n?.("")),[e,n])}function Qz(){return h.useContext(_C)}function Zz(e){const n=h.useContext(jC);h.useEffect(()=>(n?.(e),()=>n?.(null)),[e,n])}function wC({sections:e,active:n,onChange:s,collapsed:o,onToggleCollapse:l,actions:c,contentClassName:d,testId:f,children:p}){return Yz(o,l),r.jsxs("div",{className:"flex h-full",children:[r.jsx($z,{sections:e,active:n,onChange:s,collapsed:o}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[c?r.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 px-6 pt-3",children:c}):null,r.jsx("div",{className:Oe("flex-1 min-h-0 overflow-y-auto",d),"data-testid":f,children:p})]})]})}function W_({pid:e}){const n=Qe(`/projects/${e}/tasks?state=open`,()=>br.list(e)),s=Qe(`/projects/${e}/routines`,()=>xr.list(e)),o=Qe(`/projects/${e}/agents`,()=>tn.list(e)),l=Qe(`/projects/${e}/mcps`,()=>vr.list(e));return r.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3",children:[r.jsx(Ui,{title:j("project.overview.tasks_open"),value:n.data?.length??"…",href:`/p/${e}/tasks`,icon:fc}),r.jsx(Ui,{title:j("project.overview.routines"),value:s.data?.length??"…",href:`/p/${e}/routines`,icon:yl}),r.jsx(Ui,{title:j("project.overview.agents"),value:o.data?.length??"…",href:`/p/${e}/agents`,icon:gn}),r.jsx(Ui,{title:j("project.overview.mcps"),value:l.data?.length??"…",href:`/p/${e}/mcps`,icon:gh}),r.jsx(Ui,{title:j("project.overview.chat"),value:j("project.overview.chat_value"),href:`/p/${e}/chat`,icon:zd})]})}function Ui({title:e,value:n,href:s,icon:o}){return r.jsxs(Iw,{to:s,className:"flex items-center gap-3 rounded-xl border border-border bg-card p-4 hover:bg-accent/40",children:[r.jsx("span",{className:"grid size-10 place-items-center rounded-lg bg-muted text-muted-fg",children:r.jsx(o,{size:20})}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),r.jsx("div",{className:"text-2xl font-semibold",children:n})]})]})}function Wz(){const e=_a(),{projects:n,isLoading:s}=zc();return r.jsxs(Ge,{title:j("base.workspaces_title"),description:j("base.workspaces_desc"),action:r.jsxs(ge,{size:"sm",variant:"primary",onClick:()=>e("/p/0/workspaces?action=add-project"),children:[r.jsx(nn,{size:14})," ",j("base.workspaces_new")]}),children:[s&&r.jsx(nt,{}),!s&&n.length===0&&r.jsx(pt,{children:j("base.workspaces_empty")}),r.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:n.map(o=>{const l=String(o.id)==="0",c=l?j("base.title"):o.name||o.path.split("/").pop()||String(o.id);return r.jsxs("button",{type:"button",onClick:()=>e(`/p/${o.id}`),className:"flex cursor-pointer flex-col gap-2 rounded-xl border border-border bg-card p-4 text-left transition-colors hover:border-muted-fg/50",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Kw,{className:"size-4 text-muted-fg"}),r.jsx("span",{className:"truncate text-sm font-semibold",children:c}),r.jsx(Ve,{tone:l?"success":"info",children:l?j("base.title"):G2(o.kind)})]}),r.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:o.path})]},o.id)})})]})}const SC=h.createContext(null),CC=h.createContext(null);function cs(){const e=h.useContext(SC);if(e===null)throw new Error(Mn(60));return e}function kC(){const e=h.useContext(CC);if(e===null)throw new Error(Mn(61));return e}const Jz=(e,n)=>Object.is(e,n);function Nl(e,n,s){return e==null||n==null?Object.is(e,n):s(e,n)}function eD(e,n,s){return!e||e.length===0?!1:e.some(o=>o===void 0?!1:Nl(n,o,s))}function lc(e,n,s){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Nl(o,n,s))}function tD(e,n,s){return e.filter(o=>!Nl(n,o,s))}function Vh(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function EC(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function nD(e){if(!Array.isArray(e))return e!=null&&"null"in e;const n=e;if(EC(n)){for(const s of n)for(const o of s.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const s of n)if(s&&s.value==null&&s.label!=null)return!0;return!1}function NC(e,n){if(n&&e!=null)return n(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Vh(e)}function ul(e,n){return n&&e!=null?n(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Vh(e.value):Vh(e)}function RC(e,n,s){function o(){return NC(e,s)}if(s&&e!=null)return s(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(n&&!Array.isArray(n))return n[e]??o();if(Array.isArray(n)){const l=n,c=EC(l)?l.flatMap(d=>d.items):l;if(e==null||typeof e!="object"){const d=c.find(f=>f.value===e);return d&&d.label!=null?d.label:o()}if("value"in e){const d=c.find(f=>f&&f.value===e.value);if(d&&d.label!=null)return d.label}}return o()}function aD(e,n,s){return e.reduce((o,l,c)=>(c>0&&o.push(", "),o.push(r.jsx(h.Fragment,{children:RC(l,n,s)},c)),o),[])}const We={id:ze(e=>e.id),labelId:ze(e=>e.labelId),modal:ze(e=>e.modal),multiple:ze(e=>e.multiple),items:ze(e=>e.items),itemToStringLabel:ze(e=>e.itemToStringLabel),itemToStringValue:ze(e=>e.itemToStringValue),isItemEqualToValue:ze(e=>e.isItemEqualToValue),value:ze(e=>e.value),hasSelectedValue:ze(e=>{const{value:n,multiple:s,itemToStringValue:o}=e;return n==null?!1:s&&Array.isArray(n)?n.length>0:ul(n,o)!==""}),hasNullItemLabel:ze((e,n)=>n?nD(e.items):!1),open:ze(e=>e.open),mounted:ze(e=>e.mounted),forceMount:ze(e=>e.forceMount),transitionStatus:ze(e=>e.transitionStatus),openMethod:ze(e=>e.openMethod),activeIndex:ze(e=>e.activeIndex),selectedIndex:ze(e=>e.selectedIndex),isActive:ze((e,n)=>e.activeIndex===n),isSelected:ze((e,n,s)=>{const o=e.isItemEqualToValue,l=e.value;return e.multiple?Array.isArray(l)&&l.some(c=>Nl(s,c,o)):e.selectedIndex===n&&e.selectedIndex!==null?!0:Nl(s,l,o)}),isSelectedByFocus:ze((e,n)=>e.selectedIndex===n),popupProps:ze(e=>e.popupProps),triggerProps:ze(e=>e.triggerProps),triggerElement:ze(e=>e.triggerElement),positionerElement:ze(e=>e.positionerElement),listElement:ze(e=>e.listElement),popupSide:ze(e=>e.popupSide),scrollUpArrowVisible:ze(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:ze(e=>e.scrollDownArrowVisible),hasScrollArrows:ze(e=>e.hasScrollArrows)};function Wi(e,n=Number.MIN_SAFE_INTEGER,s=Number.MAX_SAFE_INTEGER){return Math.max(n,Math.min(e,s))}const Va=1;function gb(e,n){return Math.max(0,e-n)}function Jd(e,n){if(n<=0)return 0;const s=Wi(e,0,n),o=s,l=n-s,c=o<=Va,d=l<=Va;return c&&d?o<=l?0:n:c?0:d?n:s}function sD(e){const{id:n,value:s,defaultValue:o=null,onValueChange:l,open:c,defaultOpen:d=!1,onOpenChange:f,name:p,form:m,autoComplete:g,disabled:b=!1,readOnly:v=!1,required:S=!1,modal:C=!0,actionsRef:_,inputRef:w,onOpenChangeComplete:k,items:E,multiple:N=!1,itemToStringLabel:R,itemToStringValue:T,isItemEqualToValue:O=Jz,highlightItemOnHover:A=!0,children:z}=e,{clearErrors:B}=X2(),{setDirty:L,setTouched:D,setFocused:P,shouldValidateOnChange:H,validityData:q,setFilled:Y,name:V,disabled:$,validation:Z,validationMode:G}=Dc(),X=Af({id:n}),U=$||b,K=V??p,[F,J]=_c({controlled:s,default:N?o??gc:o,name:"Select",state:"value"}),[ie,re]=_c({controlled:c,default:d,name:"Select",state:"open"}),oe=h.useRef([]),ce=h.useRef([]),ee=h.useRef(null),Te=h.useRef(null),Fe=h.useRef(0),ve=h.useRef(null),Ce=h.useRef([]),Ne=h.useRef(!1),Pe=h.useRef(!1),Ie=h.useRef(null),be=h.useRef(null),Ae=h.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),we=h.useRef(!1),{mounted:Be,setMounted:Xe,transitionStatus:Ye}=Ac(ie),{openMethod:De,triggerProps:ye}=Rz(ie),le=va(()=>new f2({id:X,labelId:void 0,modal:C,multiple:N,itemToStringLabel:R,itemToStringValue:T,isItemEqualToValue:O,value:F,open:ie,mounted:Be,transitionStatus:Ye,items:E,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,je=tt(le,We.activeIndex),Se=tt(le,We.selectedIndex),Ue=tt(le,We.triggerElement),Je=tt(le,We.positionerElement),_t=E4(De),zt=De??_t,pe=h.useMemo(()=>N&&Array.isArray(F)&&F.length===0?"":ul(F,T),[N,F,T]),Ee=h.useMemo(()=>N&&Array.isArray(F)?F.map(it=>ul(it,T)):ul(F,T),[N,F,T]),Re=mn(le.state.triggerElement),qe=Le(()=>Ee);cb(Re,X,F,qe);const st=h.useRef(F),an=N?Array.isArray(F)&&F.length>0:F!=null;Me(()=>{F!==st.current&&le.set("forceMount",!0)},[le,F]),Me(()=>{Y(an)},[an,Y]),Me(function(){const Dt=Ce.current;let Sn;if(N){const rn=Array.isArray(F)?F:[];if(rn.length===0)Sn=null;else{const Rt=rn[rn.length-1],hn=lc(Dt,Rt,O);Sn=hn===-1?null:hn}}else{const rn=lc(Dt,F,O);Sn=rn===-1?null:rn}Sn===null&&(be.current=null),!ie&&le.set("selectedIndex",Sn)},[an,N,ie,F,Ce,O,le,be]),ub(F,()=>{B(K),L(F!==q.initialValue),H()?Z.commit(F):Z.commit(F,!0)});const Vt=Le((it,Dt)=>{if(f?.(it,Dt),!Dt.isCanceled&&(re(it),!it&&(Dt.reason===bf||Dt.reason===Nx)&&(D(!0),P(!1),G==="onBlur"&&Z.commit(F)),!it&&le.state.activeIndex!==null)){const Sn=oe.current[le.state.activeIndex];queueMicrotask(()=>{Sn?.setAttribute("tabindex","-1")})}}),mt=Le(()=>{Xe(!1),le.update({activeIndex:null,openMethod:null}),k?.(!1)});Or({enabled:!_,open:ie,ref:ee,onComplete(){ie||mt()}}),h.useImperativeHandle(_,()=>({unmount:mt}),[mt]);const Nt=Le((it,Dt)=>{l?.(it,Dt),!Dt.isCanceled&&J(it)}),Wt=Le(()=>{const it=le.state.listElement||ee.current;if(!it)return;const Dt=gb(it.scrollHeight,it.clientHeight),Sn=Jd(it.scrollTop,Dt),rn=Sn>0,Rt=Sn<Dt;le.state.scrollUpArrowVisible!==rn&&le.set("scrollUpArrowVisible",rn),le.state.scrollDownArrowVisible!==Rt&&le.set("scrollDownArrowVisible",Rt)}),St=j2({open:ie,onOpenChange:Vt,elements:{reference:Ue,floating:Je}}),sn=R3(St,{enabled:!v&&!U,event:"mousedown"}),Ft=Ux(St),dn=X5(St,{enabled:!v&&!U,listRef:oe,activeIndex:je,selectedIndex:Se,disabledIndices:gc,onNavigate(it){it===null&&!ie||le.set("activeIndex",it)},focusItemOnHover:A}),On=K5(St,{enabled:!v&&!U&&(ie||!N),listRef:ce,activeIndex:je,selectedIndex:Se,onMatch(it){ie?le.set("activeIndex",it):Nt(Ce.current[it],lt("none"))},onTyping(it){Ne.current=it}}),Kn=h.useMemo(()=>{const it=Da(On.reference,dn.reference,Ft.reference,sn.reference,ye);return X&&(it.id=X),it},[sn.reference,On.reference,dn.reference,Ft.reference,ye,X]),ia=h.useMemo(()=>Da(Cf,On.floating,dn.floating,Ft.floating),[On.floating,dn.floating,Ft.floating]),Qn=dn.item??un;_x(()=>{le.update({popupProps:ia,triggerProps:Kn})}),Me(()=>{le.update({id:X,modal:C,multiple:N,value:F,open:ie,mounted:Be,transitionStatus:Ye,popupProps:ia,triggerProps:Kn,items:E,itemToStringLabel:R,itemToStringValue:T,isItemEqualToValue:O,openMethod:zt})},[le,X,C,N,F,ie,Be,Ye,ia,Kn,E,R,T,O,zt]);const us=h.useMemo(()=>({store:le,name:K,required:S,disabled:U,readOnly:v,multiple:N,highlightItemOnHover:A,setValue:Nt,setOpen:Vt,listRef:oe,popupRef:ee,scrollHandlerRef:Te,handleScrollArrowVisibility:Wt,scrollArrowsMountedCountRef:Fe,itemProps:Qn,events:St.context.events,valueRef:ve,valuesRef:Ce,labelsRef:ce,typingRef:Ne,selectionRef:Ae,firstItemTextRef:Ie,selectedItemTextRef:be,validation:Z,onOpenChangeComplete:k,keyboardActiveRef:Pe,alignItemWithTriggerActiveRef:we,initialValueRef:st}),[le,K,S,U,v,N,A,Nt,Vt,Qn,St.context.events,Z,k,Wt]),zn=Vs(w,Z.inputRef),ca=N&&Array.isArray(F)&&F.length>0,Ia=N?void 0:K,ds=h.useMemo(()=>!N||!Array.isArray(F)||!K?null:F.map(it=>{const Dt=ul(it,T);return r.jsx("input",{type:"hidden",form:m,name:K,value:Dt},Dt)}),[N,F,m,K,T]);return r.jsx(SC.Provider,{value:us,children:r.jsxs(CC.Provider,{value:St,children:[z,r.jsx("input",{...Z.getInputValidationProps({onFocus(){le.state.triggerElement?.focus({focusVisible:!0})},onChange(it){if(it.nativeEvent.defaultPrevented||U||v){it.preventBaseUIHandler?.();return}const Dt=it.currentTarget.value,Sn=lt(Hs,it.nativeEvent);function rn(){if(N)return;const Rt=Ce.current.find(hn=>ul(hn,T).toLowerCase()===Dt.toLowerCase()||NC(hn,R).toLowerCase()===Dt.toLowerCase());Rt!=null&&(L(Rt!==q.initialValue),Nt(Rt,Sn),H()&&Z.commit(Rt))}le.set("forceMount",!0),queueMicrotask(rn)}}),id:X&&Ia==null?`${X}-hidden-input`:void 0,form:m,name:Ia,autoComplete:g,value:pe,disabled:U,required:S&&!ca,readOnly:v,ref:zn,style:K?RS:Ax,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ds]})})}function rD(e,n){return e??n}function oD(e){const n=e.getBoundingClientRect(),s=Qt(e),o=s.getComputedStyle(e,"::before"),l=s.getComputedStyle(e,"::after");if(!(o.content!=="none"||l.content!=="none"))return n;const d=parseFloat(o.width)||0,f=parseFloat(o.height)||0,p=parseFloat(l.width)||0,m=parseFloat(l.height)||0,g=Math.max(n.width,d,p),b=Math.max(n.height,f,m),v=g-n.width,S=b-n.height;return{left:n.left-v/2,right:n.right+v/2,top:n.top-S/2,bottom:n.bottom+S/2}}const ld=2,lD=400,iD={...i4,...ib,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},cD=h.forwardRef(function(n,s){const{render:o,className:l,id:c,disabled:d=!1,nativeButton:f=!0,style:p,...m}=n,{setTouched:g,setFocused:b,validationMode:v,state:S,disabled:C}=Dc(),{labelId:_}=Tf(),{store:w,setOpen:k,selectionRef:E,validation:N,readOnly:R,required:T,alignItemWithTriggerActiveRef:O,disabled:A,keyboardActiveRef:z}=cs(),B=C||A||d,L=tt(w,We.open),D=tt(w,We.mounted),P=tt(w,We.value),H=tt(w,We.triggerProps),q=tt(w,We.positionerElement),Y=tt(w,We.listElement),V=tt(w,We.popupSide),$=tt(w,We.id),Z=tt(w,We.labelId),G=tt(w,We.hasSelectedValue),X=D&&q?V:null,U=c??$,K=rD(_,Z);Af({id:U});const F=mn(q),J=h.useRef(null),{getButtonProps:ie,buttonRef:re}=Hl({disabled:B,native:f}),oe=Le(Ne=>{w.set("triggerElement",Ne)}),ce=Vs(s,J,re,oe),ee=sa(),Te=sa(),Fe=sa();h.useEffect(()=>{if(L)return Fe.start(lD,()=>{E.current.allowUnselectedMouseUp=!0,E.current.allowSelectedMouseUp=!0}),()=>{Fe.clear()};E.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},Te.clear()},[L,E,Te,Fe]);const ve=Da(H,{id:U,role:"combobox","aria-expanded":L?"true":"false","aria-haspopup":"listbox","aria-controls":L?Y?.id??Id(q)?.id:void 0,"aria-labelledby":K,"aria-readonly":R||void 0,"aria-required":T||void 0,tabIndex:B?-1:0,ref:ce,onFocus(Ne){b(!0),L&&O.current&&k(!1,lt(Hs,Ne.nativeEvent)),ee.start(0,()=>{w.set("forceMount",!0)})},onBlur(Ne){Ze(q,Ne.relatedTarget)||(g(!0),b(!1),v==="onBlur"&&N.commit(P))},onPointerMove(){z.current=!1},onKeyDown(){z.current=!0},onMouseDown(Ne){if(L)return;const Pe=yt(Ne.currentTarget);function Ie(be){if(!J.current)return;const Ae=be.target;if(Ze(J.current,Ae)||Ze(F.current,Ae)||Ae===J.current)return;const we=oD(J.current);be.clientX>=we.left-ld&&be.clientX<=we.right+ld&&be.clientY>=we.top-ld&&be.clientY<=we.bottom+ld||k(!1,lt(EM,be))}Te.start(0,()=>{Pe.addEventListener("mouseup",Ie,{once:!0})})}},N.getValidationProps,m,ie);ve.role="combobox";const Ce={...S,open:L,disabled:B,value:P,readOnly:R,popupSide:X,placeholder:!G};return Ht("button",n,{ref:[s,J],state:Ce,stateAttributesMapping:iD,props:ve})}),uD={value:()=>null},dD=h.forwardRef(function(n,s){const{className:o,render:l,children:c,placeholder:d,style:f,...p}=n,{store:m,valueRef:g}=cs(),b=tt(m,We.value),v=tt(m,We.items),S=tt(m,We.itemToStringLabel),C=tt(m,We.hasSelectedValue),_=!C&&d!=null&&c==null,w=tt(m,We.hasNullItemLabel,_),k={value:b,placeholder:!C};let E=null;return typeof c=="function"?E=c(b):c!=null?E=c:!C&&d!=null&&!w?E=d:Array.isArray(b)?E=aD(b,v,S):E=RC(b,v,S),Ht("span",n,{state:k,ref:[s,g],props:[{children:E},p],stateAttributesMapping:uD})}),fD=h.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,{store:f}=cs(),m={open:tt(f,We.open)};return Ht("span",n,{state:m,ref:s,props:[{"aria-hidden":!0,children:"▼"},d],stateAttributesMapping:S2})}),pD=h.createContext(void 0),mD=h.forwardRef(function(n,s){const{store:o}=cs(),l=tt(o,We.mounted),c=tt(o,We.forceMount);return l||c?r.jsx(pD.Provider,{value:!0,children:r.jsx(e2,{ref:s,...n})}):null}),TC=h.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function gD(){return h.useContext(TC)}function hb(e){const{children:n,elementsRef:s,labelsRef:o,onMapChange:l}=e,c=Le(l),d=h.useRef(0),f=va(xD).current,p=va(hD).current,[m,g]=h.useState(0),b=h.useRef(m),v=Le((k,E)=>{p.set(k,E??null),b.current+=1,g(b.current)}),S=Le(k=>{p.delete(k),b.current+=1,g(b.current)}),C=h.useMemo(()=>{const k=new Map;return Array.from(p.keys()).filter(N=>N.isConnected).sort(bD).forEach((N,R)=>{const T=p.get(N)??{};k.set(N,{...T,index:R})}),k},[p,m]);Me(()=>{if(typeof MutationObserver!="function"||C.size===0)return;const k=new MutationObserver(E=>{const N=new Set,R=T=>N.has(T)?N.delete(T):N.add(T);E.forEach(T=>{T.removedNodes.forEach(R),T.addedNodes.forEach(R)}),N.size===0&&(b.current+=1,g(b.current))});return C.forEach((E,N)=>{N.parentElement&&k.observe(N.parentElement,{childList:!0})}),()=>{k.disconnect()}},[C]),Me(()=>{b.current===m&&(s.current.length!==C.size&&(s.current.length=C.size),o&&o.current.length!==C.size&&(o.current.length=C.size),d.current=C.size),c(C)},[c,C,s,o,m]),Me(()=>()=>{s.current=[]},[s]),Me(()=>()=>{o&&(o.current=[])},[o]);const _=Le(k=>(f.add(k),()=>{f.delete(k)}));Me(()=>{f.forEach(k=>k(C))},[f,C]);const w=h.useMemo(()=>({register:v,unregister:S,subscribeMapChange:_,elementsRef:s,labelsRef:o,nextIndexRef:d}),[v,S,_,s,o,d]);return r.jsx(TC.Provider,{value:w,children:n})}function hD(){return new Map}function xD(){return new Set}function bD(e,n){const s=e.compareDocumentPosition(n);return s&Node.DOCUMENT_POSITION_FOLLOWING||s&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:s&Node.DOCUMENT_POSITION_PRECEDING||s&Node.DOCUMENT_POSITION_CONTAINS?1:0}const AC=h.createContext(void 0);function xb(){const e=h.useContext(AC);if(!e)throw new Error(Mn(59));return e}function ef(e,n){e&&Object.assign(e.style,n)}const MC={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},vD=20;function yD(e,n,s,o){const[l,c]=h.useState(!1);Me(()=>{if(!e||!n||s==null){c(!1);return}const d=yt(s).documentElement.clientWidth,f=s.offsetWidth;c(d>0&&f>0&&f>=d-vD)},[e,n,s]),iC(e&&(!n||l),o)}const _D={position:"fixed"},jD=h.forwardRef(function(n,s){const{anchor:o,positionMethod:l="absolute",className:c,render:d,side:f="bottom",align:p="center",sideOffset:m=0,alignOffset:g=0,collisionBoundary:b="clipping-ancestors",collisionPadding:v,arrowPadding:S=5,sticky:C=!1,disableAnchorTracking:_,alignItemWithTrigger:w=!0,collisionAvoidance:k=v3,style:E,...N}=n,{store:R,listRef:T,labelsRef:O,alignItemWithTriggerActiveRef:A,selectedItemTextRef:z,valuesRef:B,initialValueRef:L,popupRef:D,setValue:P}=cs(),H=kC(),q=tt(R,We.open),Y=tt(R,We.mounted),V=tt(R,We.modal),$=tt(R,We.value),Z=tt(R,We.openMethod),G=tt(R,We.positionerElement),X=tt(R,We.triggerElement),U=tt(R,We.isItemEqualToValue),K=tt(R,We.transitionStatus),F=h.useRef(null),J=h.useRef(null),[ie,re]=h.useState(w),oe=Y&&ie&&Z!=="touch";!Y&&ie!==w&&re(w),Me(()=>{Y||(We.scrollUpArrowVisible(R.state)&&R.set("scrollUpArrowVisible",!1),We.scrollDownArrowVisible(R.state)&&R.set("scrollDownArrowVisible",!1))},[R,Y]),h.useImperativeHandle(A,()=>oe),yD((oe||V)&&q,Z==="touch",G,X);const ce=A2({anchor:o,floatingRootContext:H,positionMethod:l,mounted:Y,side:f,sideOffset:m,align:p,alignOffset:g,arrowPadding:S,collisionBoundary:b,collisionPadding:v,sticky:C,disableAnchorTracking:_??oe,collisionAvoidance:k,keepMounted:!0}),ee=oe?"none":ce.side,Te=oe?_D:ce.positionerStyles,Fe={open:q,side:ee,align:ce.align,anchorHidden:ce.anchorHidden};Me(()=>{R.set("popupSide",ce.side)},[R,ce.side]);const ve=Le(be=>{R.set("positionerElement",be)}),Ce=M2(n,Fe,{styles:Te,transitionStatus:K,props:N,refs:[s,ve],hidden:!Y,inert:!q}),Ne=h.useRef(0),Pe=Le(be=>{if(be.size===0&&Ne.current===0||B.current.length===0)return;const Ae=Ne.current;if(Ne.current=be.size,be.size===Ae)return;const we=lt(Hs);if(Ae!==0&&!R.state.multiple&&$!==null&&lc(B.current,$,U)===-1){const Xe=L.current,De=Xe!=null&&lc(B.current,Xe,U)!==-1?Xe:null;P(De,we),De===null&&(R.set("selectedIndex",null),z.current=null)}if(Ae!==0&&R.state.multiple&&Array.isArray($)){const Be=Ye=>lc(B.current,Ye,U)!==-1,Xe=$.filter(Ye=>Be(Ye));(Xe.length!==$.length||Xe.some(Ye=>!eD($,Ye,U)))&&(P(Xe,we),Xe.length===0&&(R.set("selectedIndex",null),z.current=null))}if(q&&oe){R.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Be={height:""};ef(G,Be),ef(D.current,Be)}}),Ie=h.useMemo(()=>({...ce,side:ee,alignItemWithTriggerActive:oe,setControlledAlignItemWithTrigger:re,scrollUpArrowRef:F,scrollDownArrowRef:J}),[ce,ee,oe,re]);return r.jsx(hb,{elementsRef:T,labelsRef:O,onMapChange:Pe,children:r.jsxs(AC.Provider,{value:Ie,children:[Y&&V&&r.jsx(oC,{inert:Kx(!q),cutout:X}),Ce]})})}),id="base-ui-disable-scrollbar",qh={className:id,getElement(e){return r.jsx("style",{nonce:e,href:id,precedence:"base-ui:low",children:`.${id}{scrollbar-width:none}.${id}::-webkit-scrollbar{display:none}`})}},wD=h.createContext(void 0);function SD(e){return h.useContext(wD)}const CD=h.createContext(void 0),kD={disableStyleElements:!1};function ED(){return h.useContext(CD)??kD}const ND={...Ul,...Bl},RD=h.forwardRef(function(n,s){const{render:o,className:l,style:c,finalFocus:d,...f}=n,{store:p,popupRef:m,onOpenChangeComplete:g,setOpen:b,valueRef:v,firstItemTextRef:S,selectedItemTextRef:C,keyboardActiveRef:_,multiple:w,handleScrollArrowVisibility:k,scrollHandlerRef:E,listRef:N,highlightItemOnHover:R}=cs(),{side:T,align:O,alignItemWithTriggerActive:A,isPositioned:z,setControlledAlignItemWithTrigger:B,scrollDownArrowRef:L,scrollUpArrowRef:D}=xb(),P=SD()!=null,H=kC(),q=Yx(),{nonce:Y,disableStyleElements:V}=ED(),$=tt(p,We.id),Z=tt(p,We.open),G=tt(p,We.mounted),X=tt(p,We.popupProps),U=tt(p,We.transitionStatus),K=tt(p,We.triggerElement),F=tt(p,We.positionerElement),J=tt(p,We.listElement),ie=h.useRef(!1),re=h.useRef(!1),oe=h.useRef({}),ce=jl(),ee=Le(Ce=>{if(!F||!m.current||!re.current)return;if(ie.current||!A){k();return}const Ne=F.style.top==="0px",Pe=F.style.bottom==="0px";if(!Ne&&!Pe){k();return}const Ie=ej(F),be=Ji(F.getBoundingClientRect().height,"y",Ie),Ae=yt(F),we=getComputedStyle(F),Be=parseFloat(we.marginTop),Xe=parseFloat(we.marginBottom),Ye=J_(getComputedStyle(m.current)),De=Math.min(Ae.documentElement.clientHeight-Be-Xe,Ye),ye=Ce.scrollTop,le=cd(Ce);let je=0,Se=null,Ue=!1,Je=!1;const _t=Re=>{F.style.height=`${Re}px`},zt=(Re,qe)=>{const st=Wi(Re,0,De-be);st>0&&_t(be+st),Ce.scrollTop=qe,De-(be+st)<=Va&&(ie.current=!0),k()},pe=Ne?le-ye:ye,Ee=Math.min(be+pe,De);if(je=Ee,pe<=Va){zt(pe,Ne?le:0);return}if(De-Ee>Va)Ne?Je=!0:Se=0;else if(Ue=!0,Pe&&ye<le){const Re=be+pe-De;Se=ye-(pe-Re)}if(je=Math.ceil(je),je!==0&&_t(je),Je||Se!=null){const Re=cd(Ce),qe=Je?Re:Wi(Se,0,Re);Math.abs(Ce.scrollTop-qe)>Va&&(Ce.scrollTop=qe)}(Ue||je>=De-Va)&&(ie.current=!0),k()});h.useImperativeHandle(E,()=>ee,[ee]),Or({open:Z,ref:m,onComplete(){Z&&g?.(!0)}});const Te={open:Z,transitionStatus:U,side:T,align:O};Me(()=>{!F||!m.current||Object.keys(oe.current).length||(oe.current={top:F.style.top||"0",left:F.style.left||"0",right:F.style.right,height:F.style.height,bottom:F.style.bottom,minHeight:F.style.minHeight,maxHeight:F.style.maxHeight,marginTop:F.style.marginTop,marginBottom:F.style.marginBottom})},[m,F]),Me(()=>{Z||A||(re.current=!1,ie.current=!1,ef(F,oe.current))},[Z,A,F,m]),Me(()=>{const Ce=m.current;if(!Z||!K||!F||!Ce||A&&!z||p.state.transitionStatus==="ending")return;if(!A){re.current=!0,ce.request(k),Ce.style.removeProperty("--transform-origin");return}const Ne=TD(Ce);Ce.style.removeProperty("--transform-origin");try{let Pe=C.current;Pe?.isConnected||(Pe=!We.hasSelectedValue(p.state)&&S.current?.isConnected?S.current:null);const Ie=v.current,be=getComputedStyle(F),Ae=getComputedStyle(Ce),we=yt(K),Be=Qt(F),Xe=ej(K),Ye=ud(K.getBoundingClientRect(),Xe),De=ud(F.getBoundingClientRect(),Xe),ye=Ye.height,le=J||Ce,je=le.scrollHeight,Se=parseFloat(Ae.borderBottomWidth),Ue=parseFloat(be.marginTop)||10,Je=parseFloat(be.marginBottom)||10,_t=parseFloat(be.minHeight)||100,zt=J_(Ae),pe=5,Ee=5,Re=20,qe=we.documentElement.clientHeight-Ue-Je,st=we.documentElement.clientWidth,an=qe-Ye.bottom+ye;let Vt,mt=q==="rtl"?Ye.right-De.width:Ye.left,Nt=0;if(Pe&&Ie){const zn=ud(Ie.getBoundingClientRect(),Xe);Vt=ud(Pe.getBoundingClientRect(),Xe),mt=De.left+(q==="rtl"?zn.right-Vt.right:zn.left-Vt.left);const ca=zn.top-Ye.top+zn.height/2;Nt=Vt.top-De.top+Vt.height/2-ca}const Wt=an+Nt+Je+Se;let St=Math.min(qe,Wt);const sn=qe-Ue-Je,Ft=Wt-St,dn=st-Ee;F.style.left=`${Wi(mt,pe,dn-De.width)}px`,F.style.height=`${St}px`,F.style.maxHeight="auto",F.style.marginTop=`${Ue}px`,F.style.marginBottom=`${Je}px`,Ce.style.height="100%";const On=cd(le),Kn=Ft>=On-Va;Kn&&(St=Math.min(qe,De.height)-(Ft-On));const ia=Ye.top<Re||Ye.bottom>qe-Re||Math.ceil(St)+Va<Math.min(je,_t),Qn=(Be.visualViewport?.scale??1)!==1&&wx;if(ia||Qn){re.current=!0,ef(F,oe.current),B(!1);return}const us=Math.max(_t,St);if(Kn){const zn=Math.max(0,qe-Wt);F.style.top=De.height>=sn?"0":`${zn}px`,F.style.height=`${St}px`,le.scrollTop=cd(le)}else F.style.bottom="0",le.scrollTop=Ft;if(Vt){const zn=De.top,ca=De.height,Ia=Vt.top+Vt.height/2,ds=ca>0?(Ia-zn)/ca*100:50,it=Wi(ds,0,100);Ce.style.setProperty("--transform-origin",`50% ${it}%`)}(us===qe||St>=zt)&&(ie.current=!0),k(),R&&p.state.selectedIndex===null&&p.state.activeIndex===null&&N.current[0]!=null&&p.set("activeIndex",0),re.current=!0}finally{Ne()}},[p,Z,F,K,v,S,C,m,k,A,B,ce,L,D,J,N,R,q,z]),h.useEffect(()=>{if(!A||!F||!Z)return;const Ce=Qt(F);function Ne(Pe){b(!1,lt(NM,Pe))}return ft(Ce,"resize",Ne)},[b,A,F,Z]);const Fe={...J?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":w||void 0,id:`${$}-list`},onKeyDown(Ce){_.current=!0,P&&db.has(Ce.key)&&Ce.stopPropagation()},onMouseMove(){_.current=!1},onScroll(Ce){J||ee(Ce.currentTarget)},...A&&{style:J?{height:"100%"}:MC}},ve=Ht("div",n,{ref:[s,m],state:Te,stateAttributesMapping:ND,props:[X,Fe,Xx(U),{className:!J&&A?qh.className:void 0},f]});return r.jsxs(h.Fragment,{children:[!V&&qh.getElement(Y),r.jsx(t2,{context:H,modal:!1,disabled:!G,returnFocus:d,restoreFocus:!0,children:ve})]})});function J_(e){const n=e.maxHeight||"";return n.endsWith("px")&&parseFloat(n)||1/0}function cd(e){return gb(e.scrollHeight,e.clientHeight)}function ej(e){return i2.getScale(e)}function Ji(e,n,s){return e/s[n]}function ud(e,n){return xc({x:Ji(e.x,"x",n),y:Ji(e.y,"y",n),width:Ji(e.width,"x",n),height:Ji(e.height,"y",n)})}const tj=[["transform","none"],["scale","1"],["translate","0 0"]];function TD(e){const{style:n}=e,s={};for(const[o,l]of tj)s[o]=n.getPropertyValue(o),n.setProperty(o,l,"important");return()=>{for(const[o]of tj){const l=s[o];l?n.setProperty(o,l):n.removeProperty(o)}}}const AD=h.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,{store:f,scrollHandlerRef:p}=cs(),{alignItemWithTriggerActive:m}=xb(),g=tt(f,We.hasScrollArrows),b=tt(f,We.openMethod),v=tt(f,We.multiple),C={id:`${tt(f,We.id)}-list`,role:"listbox","aria-multiselectable":v||void 0,onScroll(w){p.current?.(w.currentTarget)},...m&&{style:MC},className:g&&b!=="touch"?qh.className:void 0},_=Le(w=>{f.set("listElement",w)});return Ht("div",n,{ref:[s,_],props:[C,d]})});let OC=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function bb(e={}){const{label:n,metadata:s,textRef:o,indexGuessBehavior:l,index:c}=e,{register:d,unregister:f,subscribeMapChange:p,elementsRef:m,labelsRef:g,nextIndexRef:b}=gD(),v=h.useRef(-1),[S,C]=h.useState(c??(l===OC.GuessFromOrder?()=>{if(v.current===-1){const k=b.current;b.current+=1,v.current=k}return v.current}:-1)),_=h.useRef(null),w=h.useCallback(k=>{if(_.current=k,S!==-1&&k!==null&&(m.current[S]=k,g)){const E=n!==void 0;g.current[S]=E?n:o?.current?.textContent??k.textContent}},[S,m,g,n,o]);return Me(()=>{if(c!=null)return;const k=_.current;if(k)return d(k,s),()=>{f(k)}},[c,d,f,s]),Me(()=>{if(c==null)return p(k=>{const E=_.current?k.get(_.current)?.index:null;E!=null&&C(E)})},[c,p,C]),h.useMemo(()=>({ref:w,index:S}),[S,w])}const zC=h.createContext(void 0);function vb(){const e=h.useContext(zC);if(!e)throw new Error(Mn(57));return e}const MD=h.memo(h.forwardRef(function(n,s){const{render:o,className:l,style:c,value:d=null,label:f,disabled:p=!1,nativeButton:m=!1,...g}=n,b=h.useRef(null),v=bb({label:f,textRef:b,indexGuessBehavior:OC.GuessFromOrder}),{store:S,itemProps:C,setOpen:_,setValue:w,selectionRef:k,typingRef:E,valuesRef:N,multiple:R,selectedItemTextRef:T}=cs(),O=tt(S,We.isActive,v.index),A=tt(S,We.isSelected,v.index,d),z=tt(S,We.isSelectedByFocus,v.index),B=tt(S,We.isItemEqualToValue),L=v.index,D=L!==-1,P=h.useRef(null);Me(()=>{if(!D)return;const J=N.current;return J[L]=d,()=>{delete J[L]}},[D,L,d,N]),Me(()=>{if(!D)return;const J=S.state.value;let ie=J;R&&Array.isArray(J)&&J.length>0&&(ie=J[J.length-1]),ie!==void 0&&Nl(d,ie,B)&&(S.set("selectedIndex",L),b.current&&(T.current=b.current))},[D,L,R,B,S,d,T]);const H=h.useRef(null),q=h.useRef("mouse"),Y=h.useRef(!1),{getButtonProps:V,buttonRef:$}=Hl({disabled:p,focusableWhenDisabled:!0,native:m,composite:!0}),Z={disabled:p,selected:A,highlighted:O};function G(J){const ie=S.state.value;if(R){const re=Array.isArray(ie)?ie:[],oe=A?tD(re,d,B):[...re,d];w(oe,lt(rg,J))}else w(d,lt(rg,J)),_(!1,lt(rg,J))}function X(){k.current.dragY=0}const U={role:"option","aria-selected":A,tabIndex:O?0:-1,onKeyDown(J){H.current=J.key,S.set("activeIndex",L),J.key===" "&&E.current&&J.preventDefault()},onClick(J){const ie=J.type==="click"&&q.current!=="touch",re=J.nativeEvent.pointerType,oe=ie&&Sx(J.nativeEvent)&&(re!==void 0||O),ce=ie&&!oe&&!Y.current;Y.current=!1,!(J.type==="keydown"&&H.current===null)&&(p||J.type==="keydown"&&H.current===" "&&E.current||ce||(H.current=null,G(J.nativeEvent)))},onPointerEnter(J){q.current=J.pointerType},onPointerMove(J){if(J.pointerType==="mouse"&&J.buttons===1){const ie=k.current;ie.dragY+=J.movementY,ie.dragY**2>=64&&(ie.allowUnselectedMouseUp=!0)}},onPointerDown(J){q.current=J.pointerType,Y.current=!0,X()},onMouseUp(){if(X(),p||q.current==="touch"||Y.current)return;const J=!k.current.allowSelectedMouseUp&&A,ie=!k.current.allowUnselectedMouseUp&&!A;J||ie||(Y.current=!0,P.current?.click(),Y.current=!1)}},K=Ht("div",n,{ref:[$,s,v.ref,P],state:Z,props:[C,U,g,V]}),F=h.useMemo(()=>({selected:A,index:L,textRef:b,selectedByFocus:z,hasRegistered:D}),[A,L,b,z,D]);return r.jsx(zC.Provider,{value:F,children:K})})),OD=h.forwardRef(function(n,s){const o=n.keepMounted??!1,{selected:l}=vb();return o||l?r.jsx(zD,{...n,ref:s}):null}),zD=h.memo(h.forwardRef((e,n)=>{const{render:s,className:o,style:l,keepMounted:c,...d}=e,{selected:f}=vb(),p=h.useRef(null),{transitionStatus:m,setMounted:g}=Ac(f),v=Ht("span",e,{ref:[n,p],state:{selected:f,transitionStatus:m},props:[{"aria-hidden":!0,children:"✔️"},d],stateAttributesMapping:Bl});return Or({open:f,ref:p,onComplete(){f||g(!1)}}),v})),DD=h.memo(h.forwardRef(function(n,s){const{index:o,textRef:l,selectedByFocus:c,hasRegistered:d}=vb(),{firstItemTextRef:f,selectedItemTextRef:p}=cs(),{render:m,className:g,style:b,...v}=n,S=h.useCallback(_=>{_&&(d&&o===0&&(f.current=_),d&&c&&(p.current=_))},[f,p,o,c,d]);return Ht("div",n,{ref:[S,s,l],props:v})})),DC=h.forwardRef(function(n,s){const{render:o,className:l,style:c,direction:d,keepMounted:f=!1,...p}=n,m=d==="up",{store:g,popupRef:b,listRef:v,handleScrollArrowVisibility:S,scrollArrowsMountedCountRef:C}=cs(),{side:_,scrollDownArrowRef:w,scrollUpArrowRef:k}=xb(),E=m?We.scrollUpArrowVisible:We.scrollDownArrowVisible,N=tt(g,E),R=tt(g,We.openMethod),T=N&&R!=="touch",O=sa(),A=m?k:w,{transitionStatus:z,setMounted:B}=Ac(T);Me(()=>(C.current+=1,g.state.hasScrollArrows||g.set("hasScrollArrows",!0),()=>{C.current=Math.max(0,C.current-1),C.current===0&&g.state.hasScrollArrows&&g.set("hasScrollArrows",!1)}),[g,C]),Or({open:T,ref:A,onComplete(){T||B(!1)}});const P=Ht("div",n,{ref:[s,A],state:{direction:d,visible:T,side:_,transitionStatus:z},props:[{"aria-hidden":!0,children:m?"▲":"▼",style:{position:"absolute"},onMouseMove(q){if(q.movementX===0&&q.movementY===0||O.isStarted())return;g.set("activeIndex",null);function Y(){const V=g.state.listElement??b.current;if(!V)return;g.set("activeIndex",null),S();const $=gb(V.scrollHeight,V.clientHeight),Z=Jd(V.scrollTop,$),G=Z===(m?0:$),X=v.current;if(Z!==V.scrollTop&&(V.scrollTop=Z),X.length===0&&g.set(m?"scrollUpArrowVisible":"scrollDownArrowVisible",!G),G){O.clear();return}if(X.length>0){const U=A.current?.offsetHeight||0;V.scrollTop=LD(X,m,Z,V.clientHeight,U,$)}O.start(40,Y)}O.start(40,Y)},onMouseLeave(){O.clear()}},p]});return T||f?P:null});function LD(e,n,s,o,l,c){if(n){let g=0;const b=s+l-Va;for(let C=0;C<e.length;C+=1){const _=e[C];if(_&&_.offsetTop>=b){g=C;break}}const v=Math.max(0,g-1),S=e[v];return v<g&&S?Jd(S.offsetTop-l,c):0}let d=e.length-1;const f=s+o-l+Va;for(let g=0;g<e.length;g+=1){const b=e[g];if(b&&b.offsetTop+b.offsetHeight>f){d=Math.max(0,g-1);break}}const p=Math.min(e.length-1,d+1),m=e[p];return p>d&&m?Jd(m.offsetTop+m.offsetHeight-o+l,c):c}const PD=h.forwardRef(function(n,s){return r.jsx(DC,{...n,ref:s,direction:"down"})}),ID=h.forwardRef(function(n,s){return r.jsx(DC,{...n,ref:s,direction:"up"})}),BD=sD;function UD({className:e,...n}){return r.jsx(dD,{"data-slot":"select-value",className:Ot("flex flex-1 text-left",e),...n})}function HD({className:e,size:n="default",children:s,...o}){return r.jsxs(cD,{"data-slot":"select-trigger","data-size":n,className:Ot("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[s,r.jsx(fD,{render:r.jsx(Tr,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function VD({className:e,children:n,side:s="bottom",sideOffset:o=4,align:l="center",alignOffset:c=0,alignItemWithTrigger:d=!0,...f}){return r.jsx(mD,{children:r.jsx(jD,{side:s,sideOffset:o,align:l,alignOffset:c,alignItemWithTrigger:d,className:"isolate z-50",children:r.jsxs(RD,{"data-slot":"select-content","data-align-trigger":d,className:Ot("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...f,children:[r.jsx($D,{}),r.jsx(AD,{children:n}),r.jsx(GD,{})]})})})}function qD({className:e,children:n,...s}){return r.jsxs(MD,{"data-slot":"select-item",className:Ot("relative flex w-full cursor-default items-center gap-2 rounded-md py-2 pr-8 pl-2.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...s,children:[r.jsx(DD,{className:"flex min-w-0 flex-1 gap-2 overflow-hidden whitespace-nowrap",children:n}),r.jsx(OD,{render:r.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:r.jsx(dc,{className:"pointer-events-none"})})]})}function $D({className:e,...n}){return r.jsx(ID,{"data-slot":"select-scroll-up-button",className:Ot("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...n,children:r.jsx(Fw,{})})}function GD({className:e,...n}){return r.jsx(PD,{"data-slot":"select-scroll-down-button",className:Ot("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...n,children:r.jsx(Tr,{})})}function wt({value:e,onChange:n,options:s,placeholder:o="— elegir —",disabled:l,className:c,showIcon:d=!1}){return r.jsxs(BD,{value:e,onValueChange:f=>n(f??""),disabled:l,children:[r.jsx(HD,{className:Oe("h-9 w-full",c),children:r.jsx(UD,{placeholder:o,children:f=>{const p=s.find(g=>g.value===f),m=d?p?.icon:void 0;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[m&&r.jsx(m,{className:"size-3.5 shrink-0"}),r.jsx("span",{className:"truncate",children:p?.label??f})]})}})}),r.jsx(VD,{side:"bottom",sideOffset:6,align:"start",alignItemWithTrigger:!1,className:"w-[var(--anchor-width)] p-1.5",children:s.map(f=>{const p=f.icon;return r.jsx(qD,{value:f.value,children:r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[p?r.jsx(p,{className:"size-4 shrink-0 text-muted-fg"}):null,f.description?r.jsxs("span",{className:"flex min-w-0 flex-col leading-tight",children:[r.jsx("span",{className:"truncate font-medium",children:f.label}),r.jsx("span",{className:"truncate text-[11px] text-muted-fg",children:f.description})]}):r.jsx("span",{className:"truncate",children:f.label})]})},f.value)})})]})}const nj=320;function FD(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleString(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function YD(e){return e.agent_slug||e.actor_id||e.author||e.actor_kind||"—"}function XD({m:e}){const[n,s]=h.useState(!1),o=(e.body?.length||0)>nj,l=!o||n?e.body:`${e.body.slice(0,nj)}…`;return r.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"mt-0.5 shrink-0",children:e.direction==="in"?r.jsx(qw,{size:14,className:"text-blue-400"}):r.jsx(Gw,{size:14,className:"text-emerald-400"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[r.jsx("span",{className:"font-mono",children:FD(e.ts)}),r.jsx(Ve,{tone:"info",children:e.channel}),e.type&&r.jsx(Ve,{children:e.type}),r.jsx("span",{className:"font-medium text-foreground",children:YD(e)})]}),e.body&&r.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:l}),o&&r.jsx("button",{type:"button",onClick:()=>s(c=>!c),className:"mt-1 text-[11px] font-medium text-sky-400 hover:underline",children:j(n?"logs.show_less":"logs.show_more")})]})]})}function KD(){const[e,n]=h.useState(!1),s=Qe(e?"/admin/logs?errors":null,()=>Cl.logs("errors",200)),o=s.data?.entries||[];return r.jsxs("details",{className:"mb-3 rounded-lg border border-border bg-muted/20",onToggle:l=>n(l.target.open),children:[r.jsxs("summary",{className:"cursor-pointer px-3 py-2 text-xs font-medium text-muted-fg",children:[j("logs.daemon_errors"),o.length?` · ${o.length}`:""]}),r.jsxs("div",{className:"border-t border-border p-3",children:[s.isLoading&&r.jsx(nt,{}),e&&!s.isLoading&&o.length===0&&r.jsx("p",{className:"text-xs text-muted-fg",children:j("logs.no_errors")}),r.jsx("ul",{className:"space-y-1",children:o.map((l,c)=>r.jsxs("li",{className:"rounded-md bg-card px-2 py-1 text-[11px]",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-fg",children:[typeof l.ts=="string"&&r.jsx("span",{className:"font-mono",children:new Date(l.ts).toLocaleString()}),typeof l.level=="string"&&r.jsx("span",{className:"text-destructive",children:l.level})]}),r.jsx("p",{className:"whitespace-pre-wrap break-words font-mono",children:String(l.msg??l.message??l.error??l.raw??JSON.stringify(l)).slice(0,500)})]},c))})]})]})}function QD({pid:e}){const n=!e||String(e)==="0",[s,o]=h.useState(""),[l,c]=h.useState(""),[d,f]=h.useState(""),[p,m]=h.useState(""),g=s.trim()||void 0,b=n?`/messages/global?channel=${g??""}`:`/projects/${e}/messages?channel=${g??""}`,v=Qe(b,()=>n?Ph.global({channel:g,limit:300}):Ph.project(e,{channel:g,limit:300})),S=h.useMemo(()=>[...v.data||[]].sort((w,k)=>(k.ts||"").localeCompare(w.ts||"")),[v.data]),C=h.useMemo(()=>Array.from(new Set(S.map(w=>w.type).filter(Boolean))),[S]),_=h.useMemo(()=>S.filter(w=>!(l&&w.direction!==l||d&&w.type!==d||p&&!(w.body||"").toLowerCase().includes(p.toLowerCase()))),[S,l,d,p]);return r.jsxs(Ge,{title:j("logs.title"),description:j(n?"logs.desc_global":"logs.desc_project"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ke,{placeholder:j("logs.filter_channel"),value:s,onChange:w=>o(w.target.value),className:"w-44"}),r.jsx(ge,{size:"sm",variant:"secondary",onClick:()=>v.mutate(),children:r.jsx(os,{size:13})})]}),children:[n&&r.jsx(KD,{}),r.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[r.jsx("div",{className:"w-36",children:r.jsx(wt,{value:l,onChange:c,placeholder:j("logs.filter_dir"),options:[{value:"",label:j("logs.all_directions")},{value:"in",label:j("logs.in")},{value:"out",label:j("logs.out")}]})}),r.jsx("div",{className:"w-40",children:r.jsx(wt,{value:d,onChange:f,placeholder:j("logs.filter_type"),options:[{value:"",label:j("logs.all_types")},...C.map(w=>({value:w,label:w}))]})}),r.jsx(ke,{placeholder:j("logs.search_text"),value:p,onChange:w=>m(w.target.value),className:"w-56"}),r.jsxs("span",{className:"text-[11px] text-muted-fg",children:[_.length," ",j("logs.count_of")," ",S.length]})]}),v.isLoading&&r.jsx(nt,{}),v.error&&r.jsx(pt,{children:j("logs.error",{msg:v.error.message})}),!v.isLoading&&!v.error&&_.length===0&&r.jsx(pt,{children:g?j("logs.no_activity_ch",{ch:g}):j("logs.no_activity")}),r.jsx("ul",{className:"space-y-1 text-sm",children:_.map((w,k)=>r.jsx(XD,{m:w},`${w.ts}-${k}`))})]})}function LC({value:e,onChange:n,options:s,placeholder:o="elegí o escribí un modelo…",invalid:l,invalidHint:c,className:d}){const[f,p]=h.useState(!1),[m,g]=h.useState(e),b=h.useRef(null),v=h.useRef(null),[S,C]=h.useState(null);h.useEffect(()=>{g(e)},[e]),h.useLayoutEffect(()=>{if(!f)return;const N=()=>{const R=b.current;if(!R)return;const T=R.getBoundingClientRect();C({top:T.bottom+4,left:T.left,width:T.width})};return N(),window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[f]),h.useEffect(()=>{if(!f)return;const N=R=>{const T=R.target;b.current?.contains(T)||v.current?.contains(T)||p(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[f]);const _=m.trim().toLowerCase(),k=_&&!(m===e)?s.filter(N=>N.toLowerCase().includes(_)):s,E=N=>{n(N),g(N),p(!1)};return r.jsxs("div",{ref:b,className:Oe("relative",d),children:[r.jsxs("div",{className:Oe("flex items-center gap-1 rounded-lg border bg-background px-2.5 transition-colors focus-within:border-ring focus-within:ring-1 focus-within:ring-ring",l?"border-amber-500/60":"border-border"),children:[l&&r.jsx("span",{title:c||j("models_ui.invalid_hint"),children:r.jsx(aS,{className:"size-3.5 shrink-0 text-amber-400"})}),r.jsx("input",{value:m,placeholder:o,onChange:N=>{g(N.target.value),n(N.target.value),p(!0)},onFocus:()=>p(!0),className:"w-full bg-transparent py-1.5 text-sm outline-none placeholder:text-muted-fg/60"}),r.jsx("button",{type:"button",tabIndex:-1,onClick:()=>p(N=>!N),className:"shrink-0 text-muted-fg hover:text-foreground",children:r.jsx(Tr,{className:"size-4"})})]}),f&&k.length>0&&S&&Rr.createPortal(r.jsx("ul",{ref:v,style:{position:"fixed",top:S.top,left:S.left,width:S.width},className:"z-[1000] max-h-56 overflow-y-auto rounded-lg border border-border bg-popover p-1 shadow-md ring-1 ring-foreground/10",children:k.map(N=>r.jsx("li",{children:r.jsx("button",{type:"button",onMouseDown:R=>{R.preventDefault(),E(N)},className:Oe("flex w-full items-center rounded-md px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-fg",N===e&&"bg-accent/50"),children:r.jsx("span",{className:"truncate font-mono text-xs",children:N})})},N))}),document.body)]})}function Dr(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/admin/config",()=>Cl.config.get()),l=async(c,d)=>{const f=await Cl.config.patch({set:c,unset:d});return await o({config:f.config},{revalidate:!1}),f.config};return{config:e?.config||{},error:n,isLoading:s,mutate:o,patch:l}}function PC(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/admin/super-agent",()=>Cl.superAgent());return{superAgent:e,error:n,isLoading:s,mutate:o}}const ZD={anthropic:"from-orange-600 to-amber-600",openai:"from-emerald-600 to-teal-600",gemini:"from-blue-600 to-indigo-600",groq:"from-cyan-600 to-teal-600",openrouter:"from-violet-600 to-indigo-600",ollama:"from-amber-600 to-orange-600",azure:"from-blue-600 to-cyan-600",mock:"from-slate-600 to-gray-600",custom:"from-slate-600 to-gray-600"},WD={anthropic:"bg-orange-500/20 text-orange-300 border border-orange-500/40",openai:"bg-emerald-500/20 text-emerald-300 border border-emerald-500/40",gemini:"bg-blue-500/20 text-blue-300 border border-blue-500/40",groq:"bg-cyan-500/20 text-cyan-300 border border-cyan-500/40",openrouter:"bg-violet-500/20 text-violet-300 border border-violet-500/40",ollama:"bg-amber-500/20 text-amber-300 border border-amber-500/40",azure:"bg-blue-500/20 text-blue-300 border border-blue-500/40",mock:"bg-slate-500/20 text-slate-300 border border-slate-500/40",custom:"bg-slate-500/20 text-slate-300 border border-slate-500/40"},ic=[{value:"anthropic",label:"Anthropic"},{value:"openai",label:"OpenAI-compatible"},{value:"gemini",label:"Gemini"},{value:"groq",label:"Groq"},{value:"openrouter",label:"OpenRouter"},{value:"ollama",label:"Ollama"},{value:"azure",label:"Azure OpenAI"},{value:"mock",label:"Mock (test)"},{value:"custom",label:"Custom"}];function Rg(e,n){return n&&n in e?e[n]:e.custom}const tf={anthropic:ls,openai:gn,gemini:ZT,groq:fc,openrouter:px,ollama:tS,azure:IT,mock:Xw,custom:Dl},lo={anthropic:{base_url:"",default_model:"claude-sonnet-4.6",api_key_env:"ANTHROPIC_API_KEY",known_models:["claude-opus-4.8","claude-opus-4.7","claude-opus-4.6","claude-sonnet-4.6","claude-sonnet-4.5","claude-haiku-4.5"]},openai:{base_url:"https://api.openai.com/v1",default_model:"gpt-4o-mini",api_key_env:"OPENAI_API_KEY",known_models:["gpt-4o","gpt-4o-mini","gpt-4.1","gpt-4.1-mini","o3-mini"]},gemini:{base_url:"https://generativelanguage.googleapis.com/v1beta/openai",default_model:"gemini-2.5-flash",api_key_env:"GEMINI_API_KEY",known_models:["gemini-3.5-pro","gemini-3.5-flash","gemini-3.1-pro","gemini-3.1-flash","gemini-2.5-pro","gemini-2.5-flash","gemini-2.5-flash-lite"]},groq:{base_url:"https://api.groq.com/openai/v1",default_model:"llama-3.3-70b-versatile",api_key_env:"GROQ_API_KEY",known_models:["llama-3.3-70b-versatile","llama-3.1-8b-instant","meta-llama/llama-4-scout-17b-16e-instruct","openai/gpt-oss-120b","openai/gpt-oss-20b","groq/compound","groq/compound-mini","qwen/qwen3-32b","whisper-large-v3-turbo"]},openrouter:{base_url:"https://openrouter.ai/api/v1",default_model:"openrouter/auto",api_key_env:"OPENROUTER_API_KEY",known_models:["openrouter/auto","openrouter/free","deepseek/deepseek-r1:free","meta-llama/llama-3.3-70b-instruct:free","google/gemini-2.0-flash-exp:free","qwen/qwen3-235b-a22b:free","anthropic/claude-sonnet-4.5","openai/gpt-4o-mini"]},ollama:{base_url:"http://127.0.0.1:11434",default_model:"gemma2:9b",api_key_env:"",known_models:[]},azure:{base_url:"",default_model:"gpt-4o-mini",api_key_env:"AZURE_OPENAI_API_KEY",known_models:["gpt-4o","gpt-4o-mini"]},mock:{base_url:"",default_model:"mock",api_key_env:"",known_models:["mock"]},custom:{base_url:"",default_model:"",api_key_env:"",known_models:[]}};function IC(e){const n=e.indexOf(":");return n<0?{provider:e,model:""}:{provider:e.slice(0,n),model:e.slice(n+1)}}function Tg({value:e,onChange:n,providers:s}){const{provider:o,model:l}=IC(e),c=s.find(g=>g.slug===o),d=!!o&&!c,f=h.useMemo(()=>{const g=c?lo[c.engine]?.known_models||[]:[];return Array.from(new Set([...c?.default_model?[c.default_model]:[],...g]))},[c]),p=g=>{const b=s.find(S=>S.slug===g),v=b?.default_model||lo[b?.engine]?.default_model||"";n(v?`${g}:${v}`:`${g}:`)},m=g=>n(`${o}:${g}`);return r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsx(wt,{value:o,onChange:p,placeholder:d?`⚠ ${o} (no existe)`:"— proveedor —",options:s.map(g=>({value:g.slug,label:g.slug,icon:tf[g.engine]}))}),r.jsx(LC,{value:l,onChange:m,options:f,invalid:d,invalidHint:`El proveedor "${o}" no está configurado.`})]})}function JD(){const e=at(),{superAgent:n,isLoading:s,mutate:o}=PC(),{config:l,patch:c}=Dr(),[d,f]=h.useState(""),[p,m]=h.useState([]),[g,b]=h.useState(""),[v,S]=h.useState(null),[C,_]=h.useState(!1),[w,k]=h.useState({model:"",fallback:[]});h.useEffect(()=>{if(!n)return;const L=n.model_fallback?.models||[],D=Array.isArray(L)?L:[];f(n.model||""),m(D),k({model:n.model||"",fallback:D})},[n]);const E=h.useMemo(()=>{const L=l.engines||{};return Object.entries(L).map(([D,P])=>({slug:D,engine:P?.engine||D,default_model:P?.default_model||lo[P?.engine||D]?.default_model}))},[l.engines]),N=L=>{const{provider:D}=IC(L);return E.some(P=>P.slug===D)};if(s||!n)return r.jsx(nt,{});const R=d!==w.model||JSON.stringify(p)!==JSON.stringify(w.fallback),T=async()=>{_(!0);try{await c({"super_agent.model":d,"super_agent.model_fallback.enabled":p.length>0,"super_agent.model_fallback.models":p}),e.success("Router guardado."),k({model:d,fallback:p}),o()}catch(L){e.error(L.message)}finally{_(!1)}},O=()=>{const L=g.trim().replace(/:$/,"");!L||!L.includes(":")||p.includes(L)||(m([...p,L]),b(""))},A=(L,D)=>{const P=[...p];P[L]=D,m(P)},z=L=>{m(p.filter((D,P)=>P!==L)),v===L&&S(null)},B=(L,D)=>{const P=L+D;if(P<0||P>=p.length)return;const H=[...p];[H[L],H[P]]=[H[P],H[L]],m(H)};return r.jsx(Ge,{title:j("router_panel.title"),description:"Un solo router general (sin casos por tarea). Elegí proveedor y modelo; si el activo falla, prueba la cadena de fallback en orden.",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs(Ve,{tone:"success",children:[r.jsx(px,{size:11})," default"]}),r.jsx("span",{className:`font-mono text-xs ${!N(d)&&d?"text-amber-400":""}`,children:d||"—"}),p.map(L=>r.jsxs("span",{className:"flex items-center gap-2 text-muted-fg",children:[r.jsx($w,{size:12}),r.jsx("span",{className:`font-mono text-xs ${N(L)?"":"text-amber-400"}`,children:L})]},L))]}),E.length===0?r.jsx("p",{className:"text-xs text-muted-fg",children:"Agregá un proveedor abajo para poder elegir modelos."}):r.jsx(de,{label:"Modelo activo (default)",hint:"Proveedor + modelo. Se guarda como provider:model.",children:r.jsx(Tg,{value:d,onChange:f,providers:E})}),r.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs("div",{className:"mb-2",children:[r.jsx("div",{className:"text-sm font-medium",children:"Cadena de fallback"}),r.jsx("div",{className:"text-xs text-muted-fg",children:"Si el modelo activo falla, prueba estos en orden. Click en uno para editarlo."})]}),r.jsxs("ul",{className:"mb-3 space-y-1",children:[p.map((L,D)=>{const P=!N(L),H=v===D;return r.jsx("li",{className:"rounded-md bg-card px-2 py-1.5 text-xs",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"w-6 text-muted-fg",children:["#",D+1]}),H?r.jsx("div",{className:"flex-1",children:r.jsx(Tg,{value:L,onChange:q=>A(D,q),providers:E})}):r.jsxs("button",{type:"button",onClick:()=>S(D),className:"flex flex-1 items-center gap-1.5 text-left",children:[P&&r.jsx(aS,{size:12,className:"text-amber-400"}),r.jsx("span",{className:`font-mono ${P?"text-amber-400":""}`,children:L})]}),H?r.jsx(ge,{size:"sm",variant:"secondary",onClick:()=>S(null),children:"listo"}):r.jsx(ge,{size:"sm",variant:"ghost",onClick:()=>S(D),children:r.jsx(zl,{size:12})}),r.jsx(ge,{size:"sm",variant:"ghost",onClick:()=>B(D,-1),disabled:D===0,children:"↑"}),r.jsx(ge,{size:"sm",variant:"ghost",onClick:()=>B(D,1),disabled:D===p.length-1,children:"↓"}),r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>z(D),children:r.jsx(la,{size:12})})]})},`${D}-${L}`)}),p.length===0&&r.jsx("li",{className:"text-xs text-muted-fg",children:"Sin fallback configurado."})]}),E.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-xs text-muted-fg",children:"Agregar a la cadena"}),r.jsx(Tg,{value:g,onChange:b,providers:E}),r.jsxs(ge,{size:"sm",variant:"secondary",onClick:O,disabled:!g.includes(":")||g.endsWith(":"),children:[r.jsx(nn,{size:13})," Agregar a la cadena"]})]})]}),r.jsx(ge,{variant:"primary",loading:C,disabled:!R,onClick:T,children:R?"Guardar router":"Guardado"})]})})}function e6({provider:e,onEdit:n,onDelete:s,onToggle:o}){const l=Rg(ZD,e.engine),c=Rg(WD,e.engine),d=Rg(tf,e.engine),f=ic.find(b=>b.value===e.engine)?.label||e.engine,p=typeof e.api_key=="string"&&e.api_key.length>0,m=El(e.api_key),g=e.is_active!==!1;return r.jsxs("div",{className:"group flex h-full cursor-pointer flex-col gap-3 rounded-xl border border-border bg-card p-4 transition-colors hover:border-muted-fg/50",onClick:n,children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:Oe("flex size-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",l),children:r.jsx(d,{className:"size-5 text-white"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"truncate text-sm font-semibold",children:e.name||e.slug}),r.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:e.slug}),r.jsxs("span",{className:Oe("mt-1 inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium",c),children:[r.jsx(d,{className:"size-3"})," ",f]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r.jsx(Mt,{content:j(g?"providers_modal.toggle_active":"providers_modal.toggle_inactive"),children:r.jsxs("button",{type:"button",onClick:b=>{b.stopPropagation(),o()},className:Oe("flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[10px] font-medium transition-colors",g?"border-emerald-500/40 text-emerald-400 hover:bg-emerald-500/10":"border-border text-muted-fg hover:text-foreground"),children:[r.jsx("span",{className:Oe("size-1.5 rounded-full",g?"bg-emerald-400":"bg-muted-fg/40")}),g?"Active":"Off"]})}),r.jsx(Mt,{content:j("providers_modal.delete"),children:r.jsx("button",{type:"button",onClick:b=>{b.stopPropagation(),s()},className:"rounded-md p-1 text-muted-fg hover:bg-destructive/10 hover:text-destructive",children:r.jsx(la,{className:"size-3.5"})})})]})]}),r.jsxs("div",{className:"mt-auto space-y-1 text-xs",children:[r.jsx(Hi,{label:"Modelo",value:e.default_model||"—",mono:!0}),e.base_url&&r.jsx(Hi,{label:"Base URL",value:e.base_url,mono:!0,truncate:!0}),r.jsx(Hi,{label:"API key",value:p?m?`…${m}`:"✓ seteada":"—",mono:!!m}),e.default_temperature!==void 0&&r.jsx(Hi,{label:"Temp",value:e.default_temperature.toFixed(1)}),e.pricing?.input_per_million!==void 0&&r.jsx(Hi,{label:"$ in/out (1M)",value:`${e.pricing.input_per_million??0} / ${e.pricing.output_per_million??0}`})]})]})}function Hi({label:e,value:n,mono:s,truncate:o}){return r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:e}),r.jsx("span",{className:Oe("text-foreground",s&&"font-mono",o&&"max-w-[180px] truncate"),children:n})]})}const aj={name:"",slug:"",engine:"anthropic",base_url:"",api_key_value:"",default_model:"",default_temperature:.7,default_max_tokens:4096,is_active:!0,context_limit_tokens:2e5,model_context_limits_json:"",p_input:"",p_output:"",p_cache_read:"",p_cache_write:""},t6=["anthropic","openai","gemini","groq","openrouter","ollama","custom"];function Vi(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function dd(e){if(e==null)return"";const n=Number(e);return Number.isFinite(n)?String(n):""}function n6(e){return{name:e.name||e.slug,slug:e.slug,engine:e.engine||"custom",base_url:e.base_url||"",api_key_value:"",default_model:e.default_model||"",default_temperature:e.default_temperature??.7,default_max_tokens:e.default_max_tokens??4096,is_active:e.is_active!==!1,context_limit_tokens:e.context_limit_tokens??2e5,model_context_limits_json:e.model_context_limits?JSON.stringify(e.model_context_limits,null,2):"",p_input:dd(e.pricing?.input_per_million),p_output:dd(e.pricing?.output_per_million),p_cache_read:dd(e.pricing?.cache_read_per_million),p_cache_write:dd(e.pricing?.cache_write_per_million)}}function a6({open:e,initial:n,existingSlugs:s,onClose:o,onSave:l}){const c=!!n,[d,f]=h.useState(aj),[p,m]=h.useState(!1),[g,b]=h.useState(null),[v,S]=h.useState([]),[C,_]=h.useState(!1),[w,k]=h.useState(null),[E,N]=h.useState(!1),[R,T]=h.useState("");h.useEffect(()=>{if(!e)return;const G=n?n6(n):aj;f(G),b(null),k(null),N(!1);const X=lo[G.engine];S(X?.known_models||[])},[e,n]);const O=G=>f(X=>({...X,...G})),A=G=>{const X=lo[G];O({engine:G,name:G==="custom"?d.name:ic.find(U=>U.value===G)?.label||G,slug:G==="custom"?d.slug:G,base_url:X.base_url,default_model:X.default_model}),S(X.known_models),k(null)},z=G=>{const X=lo[G];O({engine:G,base_url:d.base_url||X.base_url,default_model:d.default_model||X.default_model}),S(X.known_models)},B=async()=>{_(!0),k(null);try{const G=await Qd.models({engine:d.engine,slug:d.slug||Vi(d.name),base_url:d.base_url||void 0,api_key:d.api_key_value||void 0});if(G.error){k(G.error);return}S(G.models),G.models.length===0&&k("Sin modelos. ¿Key/URL correctas?")}catch(G){k(G.message||"No se pudo listar modelos.")}finally{_(!1)}},L=h.useMemo(()=>d.default_model&&!v.includes(d.default_model)?[d.default_model,...v]:v,[v,d.default_model]),D=()=>{const G=(d.slug||Vi(d.name)).trim();if(!G)return b("Slug requerido."),null;if(!c&&s.includes(G))return b(`Ya existe un provider "${G}".`),null;let X;if(d.model_context_limits_json.trim())try{const F=JSON.parse(d.model_context_limits_json);if(!F||typeof F!="object"||Array.isArray(F))throw new Error;X=F}catch{return b("Límites de contexto por modelo: JSON inválido."),null}const K=[d.p_input,d.p_output,d.p_cache_read,d.p_cache_write].map(F=>F.trim()).some(Boolean)?{input_per_million:Number(d.p_input||0),output_per_million:Number(d.p_output||0),cache_read_per_million:Number(d.p_cache_read||0),cache_write_per_million:Number(d.p_cache_write||0)}:void 0;return{provider:{slug:G,name:d.name.trim()||G,engine:d.engine,base_url:d.base_url.trim()||void 0,default_model:d.default_model.trim()||void 0,default_temperature:d.default_temperature,default_max_tokens:d.default_max_tokens,is_active:d.is_active,context_limit_tokens:d.context_limit_tokens||void 0,model_context_limits:X,pricing:K},modelLimits:X}},P=()=>{const G=D();if(!G)return;const{provider:X}=G,U={name:X.name,engine:X.engine,is_active:X.is_active!==!1,default_temperature:X.default_temperature,default_max_tokens:X.default_max_tokens};X.base_url&&(U.base_url=X.base_url),X.default_model&&(U.default_model=X.default_model),X.context_limit_tokens&&(U.context_limit_tokens=X.context_limit_tokens),X.model_context_limits&&(U.model_context_limits=X.model_context_limits),X.pricing&&(U.pricing=X.pricing),d.api_key_value.trim()&&(U.api_key=d.api_key_value.trim()),T(JSON.stringify(U,null,2)),b(null),N(!0)},H=async()=>{m(!0),b(null);try{if(E){const X=(d.slug||Vi(d.name)).trim();if(!X){b("Slug requerido (en el formulario).");return}let U;try{U=JSON.parse(R)}catch{b("JSON inválido: revisá la sintaxis.");return}if(!U||typeof U!="object"||Array.isArray(U)){b("El JSON debe ser un objeto con la config del provider.");return}const K=U;if(!K.engine||typeof K.engine!="string"){b('Falta "engine" (ej. "anthropic", "ollama").');return}const F={slug:X,name:typeof K.name=="string"?K.name:X,engine:String(K.engine),base_url:typeof K.base_url=="string"?K.base_url:void 0,default_model:typeof K.default_model=="string"?K.default_model:void 0,is_active:K.is_active!==!1};await l({provider:F,raw:K,originalSlug:n?.slug}),o();return}const G=D();if(!G)return;await l({provider:G.provider,apiKeyValue:d.api_key_value.trim()||void 0,originalSlug:n?.slug}),o()}catch(G){b(G.message||"Error al guardar.")}finally{m(!1)}},q=c&&qa(n?.api_key),Y=El(n?.api_key),V=q?`…${Y??""} (ya seteada)`:"sk-…",$=d.engine==="ollama",Z=lo[d.engine]?.api_key_env;return r.jsx(Vn,{open:e,onClose:o,title:c?j("providers_modal.edit_title",{name:n?.name||n?.slug||""}):j("providers_modal.new_title"),description:"Proveedor LLM. El motor (engine) define qué adapter usa (openai, ollama, …).",size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:o,disabled:p,children:"Cancelar"}),r.jsx(ge,{variant:"primary",onClick:H,loading:p,children:c?"Guardar":"Crear"})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[c?r.jsx("span",{}):r.jsx("div",{className:"flex flex-wrap gap-1.5",children:t6.map(G=>{const X=tf[G],U=G==="custom"?"Custom":ic.find(F=>F.value===G)?.label||G,K=d.engine===G;return r.jsxs("button",{type:"button",onClick:()=>A(G),className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${K?"border-emerald-500/50 bg-emerald-500/10 text-emerald-400":"border-border text-muted-fg hover:border-muted-fg/60 hover:text-foreground"}`,children:[r.jsx(X,{className:"size-3.5"})," ",U]},G)})}),r.jsxs("button",{type:"button",onClick:()=>E?N(!1):P(),className:`flex shrink-0 items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${E?"border-sky-500/50 bg-sky-500/10 text-sky-400":"border-border text-muted-fg hover:text-foreground"}`,children:[r.jsx(MT,{className:"size-3.5"})," ",E?"Volver al formulario":"JSON"]})]}),E?r.jsxs("div",{className:"space-y-2",children:[r.jsx(de,{label:"Config del provider (JSON)",hint:`Se guarda como engines.${d.slug||Vi(d.name)||"<slug>"} en config.json`,children:r.jsx(cn,{rows:14,className:"font-mono text-xs",value:R,onChange:G=>T(G.target.value),spellCheck:!1})}),r.jsxs("p",{className:"text-[11px] text-muted-fg",children:["Debe ser un objeto JSON válido con al menos ",r.jsx("code",{children:"engine"}),". El slug se toma del formulario."]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:"Nombre",children:r.jsx(ke,{value:d.name,onChange:G=>O({name:G.target.value,slug:c?d.slug:Vi(G.target.value)}),placeholder:"Mi provider"})}),r.jsx(de,{label:"Motor (engine)",children:r.jsx(wt,{value:d.engine,onChange:G=>z(G),options:ic.map(G=>({value:G.value,label:G.label,icon:tf[G.value]}))})})]}),r.jsx(de,{label:"URL base (base_url)",hint:"Se completa sola al elegir un proveedor.",children:r.jsx(ke,{value:d.base_url,onChange:G=>O({base_url:G.target.value}),placeholder:"https://api.openai.com/v1"})}),!$&&r.jsx(de,{label:"API key",hint:q?"Dejá en blanco para mantener la actual.":Z?`Se guarda como secreto. Env sugerida: ${Z}`:"Se guarda como secreto.",children:r.jsx(ke,{type:"password",autoComplete:"new-password",value:d.api_key_value,onChange:G=>O({api_key_value:G.target.value}),placeholder:V})}),r.jsx(de,{label:"Modelo por defecto",children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(LC,{value:d.default_model,onChange:G=>O({default_model:G}),options:L,className:"flex-1"}),r.jsxs(ge,{size:"sm",variant:"secondary",onClick:B,disabled:C,title:j("providers_modal.list_models_hint"),"aria-label":j("providers_modal.list_models_hint"),children:[C?r.jsx(uf,{className:"size-3.5 animate-spin"}):r.jsx(os,{className:"size-3.5"}),"Cargar modelos"]})]}),w&&r.jsx("p",{className:"text-[11px] text-amber-400",children:w})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:"Máx. tokens (max_tokens)",children:r.jsx(ke,{type:"number",min:256,step:256,value:d.default_max_tokens,onChange:G=>O({default_max_tokens:parseInt(G.target.value)||4096})})}),r.jsx(de,{label:`Temperatura: ${d.default_temperature.toFixed(1)}`,children:r.jsx("input",{type:"range",min:0,max:2,step:.1,value:d.default_temperature,onChange:G=>O({default_temperature:parseFloat(G.target.value)}),className:"mt-2 w-full accent-foreground"})})]}),r.jsxs("details",{className:"rounded-md border border-border bg-muted/20 p-3",children:[r.jsx("summary",{className:"cursor-pointer text-xs font-medium text-muted-fg",children:"Análisis de tokens / pricing (opcional)"}),r.jsxs("div",{className:"mt-3 space-y-3",children:[r.jsx(de,{label:"Límite de contexto (tokens)",children:r.jsx(ke,{type:"number",min:0,step:1024,value:d.context_limit_tokens,onChange:G=>O({context_limit_tokens:parseInt(G.target.value)||0})})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:"$ entrada / 1M",children:r.jsx(ke,{type:"number",min:0,step:1e-4,value:d.p_input,onChange:G=>O({p_input:G.target.value}),placeholder:"0.15"})}),r.jsx(de,{label:"$ salida / 1M",children:r.jsx(ke,{type:"number",min:0,step:1e-4,value:d.p_output,onChange:G=>O({p_output:G.target.value}),placeholder:"0.60"})}),r.jsx(de,{label:"$ cache read / 1M",children:r.jsx(ke,{type:"number",min:0,step:1e-4,value:d.p_cache_read,onChange:G=>O({p_cache_read:G.target.value}),placeholder:"0.03"})}),r.jsx(de,{label:"$ cache write / 1M",children:r.jsx(ke,{type:"number",min:0,step:1e-4,value:d.p_cache_write,onChange:G=>O({p_cache_write:G.target.value}),placeholder:"0.00"})})]}),r.jsx(de,{label:"Límites de contexto por modelo (JSON)",hint:'{"gpt-4o-mini":128000}',children:r.jsx(cn,{rows:3,className:"font-mono text-xs",value:d.model_context_limits_json,onChange:G=>O({model_context_limits_json:G.target.value})})})]})]}),r.jsx(Zt,{checked:d.is_active,onChange:G=>O({is_active:G}),label:"Activo (los agentes pueden usarlo)"})]}),g&&r.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:g})]})})}const s6=new Set(ic.map(e=>e.value));function r6(e,n){const s=typeof n.engine=="string"&&n.engine||(s6.has(e)?e:"custom");return{slug:e,name:typeof n.name=="string"?n.name:void 0,engine:s,base_url:typeof n.base_url=="string"?n.base_url:void 0,api_key:typeof n.api_key=="string"?n.api_key:void 0,default_model:typeof n.default_model=="string"?n.default_model:void 0,default_temperature:typeof n.default_temperature=="number"?n.default_temperature:void 0,default_max_tokens:typeof n.default_max_tokens=="number"?n.default_max_tokens:void 0,is_active:typeof n.is_active=="boolean"?n.is_active:void 0,context_limit_tokens:typeof n.context_limit_tokens=="number"?n.context_limit_tokens:void 0,model_context_limits:n.model_context_limits||void 0,pricing:n.pricing||void 0}}function o6(){const e=at(),{config:n,isLoading:s,patch:o,mutate:l}=Dr(),[c,d]=h.useState(!1),[f,p]=h.useState(null);if(s)return r.jsx(nt,{});const m=n.engines||{},g=Object.entries(m).map(([k,E])=>r6(k,E||{})),b=g.map(k=>k.slug),v=()=>{p(null),d(!0)},S=k=>{p(k),d(!0)},C=async({provider:k,apiKeyValue:E,raw:N})=>{if(N){await o({[`engines.${k.slug}`]:N}),e.success("Provider guardado (JSON)."),l();return}const R=`engines.${k.slug}`,T={[`${R}.name`]:k.name,[`${R}.engine`]:k.engine,[`${R}.is_active`]:k.is_active!==!1,[`${R}.default_temperature`]:k.default_temperature,[`${R}.default_max_tokens`]:k.default_max_tokens},O=[],A=(z,B)=>{B===void 0||B===""?O.push(`${R}.${z}`):T[`${R}.${z}`]=B};A("base_url",k.base_url),A("default_model",k.default_model),A("context_limit_tokens",k.context_limit_tokens),A("pricing",k.pricing),A("model_context_limits",k.model_context_limits),E&&(T[`${R}.api_key`]=E),await o(T,O),e.success("Provider guardado."),l()},_=async k=>{try{await o({[`engines.${k.slug}.is_active`]:k.is_active===!1}),l()}catch(E){e.error(E.message)}},w=async k=>{if(confirm(`Borrar provider ${k.name||k.slug}?`))try{await o(void 0,[`engines.${k.slug}`]),e.success("Provider borrado."),l()}catch(E){e.error(E.message)}};return r.jsxs(Ge,{title:j("engines_panel.title"),description:"Proveedores LLM (API). Cada provider usa un engine/adapter (openai, ollama, …) con su key y URL.",action:r.jsxs(ge,{size:"sm",variant:"primary",onClick:v,children:[r.jsx(nn,{size:14})," ",j("engines_panel.new_btn")]}),children:[g.length===0?r.jsx(pt,{children:"Sin providers. Agregá uno con el botón de arriba."}):r.jsxs("div",{className:"grid grid-cols-1 items-stretch gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[g.map(k=>r.jsx(e6,{provider:k,onEdit:()=>S(k),onDelete:()=>w(k),onToggle:()=>_(k)},k.slug)),r.jsxs("button",{type:"button",onClick:v,className:"flex min-h-[120px] flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-border text-muted-fg transition-colors hover:border-muted-fg/60 hover:text-foreground",children:[r.jsx(nn,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:"Agregar provider"})]})]}),r.jsx(a6,{open:c,initial:f,existingSlugs:b,onClose:()=>{d(!1),p(null)},onSave:C})]})}function BC(){return r.jsxs("div",{className:"space-y-6",children:[r.jsx(JD,{}),r.jsx(o6,{})]})}function l6(){const e=at(),[n,s]=h.useState(!1),l=Qe(n?"/agents/vault?include_removed=1":"/agents/vault",()=>tn.vault({includeRemoved:n})),c=l.data||[],[d,f]=h.useState(null),p=async g=>{const b=g.source!=="user",v=b?j("base.defaults_tombstone_msg",{slug:g.slug}):j("base.defaults_delete_msg",{slug:g.slug});if(confirm(v))try{await tn.vaultRemove(g.slug),e.success(j(b?"base.defaults_hidden":"base.defaults_deleted")),l.mutate()}catch(S){e.error(S.message)}},m=async g=>{try{await tn.vaultRestore(g),e.success(j("base.defaults_restored")),l.mutate()}catch(b){e.error(b.message)}};return r.jsxs(Ge,{title:j("base.defaults_title"),description:j("base.defaults_desc"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zt,{checked:n,onChange:s,label:j("base.defaults_show_removed")}),r.jsxs(ge,{size:"sm",onClick:()=>f("new"),children:[r.jsx(nn,{size:14})," ",j("base.defaults_new")]})]}),children:[l.isLoading&&r.jsx(nt,{}),!l.isLoading&&c.length===0&&r.jsx(pt,{children:j("base.defaults_empty")}),r.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:c.map(g=>{const b=n&&g.tombstoned;return r.jsxs("div",{className:`flex flex-col gap-2 rounded-xl border bg-card p-4 ${b?"border-dashed border-border opacity-60":"border-border"}`,children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-slate-600 to-gray-600",children:g.is_master?r.jsx(Bs,{className:"size-4 text-white"}):r.jsx(gn,{className:"size-4 text-white"})}),r.jsx("span",{className:"truncate text-sm font-semibold",children:g.slug}),r.jsx(i6,{source:g.source})]}),r.jsx("div",{className:"flex shrink-0 items-center gap-0.5",children:b?r.jsx(Ag,{label:j("base.defaults_restore"),onClick:()=>m(g.slug),variant:"secondary",children:r.jsx(hx,{size:13})}):r.jsxs(r.Fragment,{children:[r.jsx(Ag,{label:j("base.defaults_edit"),onClick:()=>f(g),variant:"ghost",children:r.jsx(zl,{size:13})}),r.jsx(Ag,{label:g.source==="user"?j("base.defaults_delete"):j("base.defaults_hide"),onClick:()=>p(g),variant:"ghost-destructive",children:r.jsx(la,{size:13})})]})})]}),g.model?r.jsx(Ve,{tone:"info",children:g.model}):r.jsx("span",{className:"text-[10px] text-muted-fg",children:"modelo: default del router"}),g.description&&r.jsx("p",{className:"line-clamp-3 text-xs text-muted-fg",children:g.description}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[g.role&&r.jsx(Ve,{children:g.role}),g.skills?.map(v=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(ls,{size:9})," ",v]},v)),g.tools?.map(v=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(Dl,{size:9})," ",v]},v))]})]},g.slug)})}),d!==null&&r.jsx(c6,{agent:d==="new"?null:d,onClose:()=>f(null),onSaved:()=>{f(null),l.mutate()}})]})}function i6({source:e}){return e==="user"?r.jsx(Ve,{tone:"success",children:"user"}):e==="user-override"?r.jsx(Ve,{tone:"warning",children:"override"}):r.jsx(Ve,{tone:"muted",children:"bundled"})}function Ag({label:e,onClick:n,variant:s="ghost",children:o}){const l="inline-flex size-7 items-center justify-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",c={ghost:"text-muted-fg hover:bg-accent hover:text-accent-fg","ghost-destructive":"text-muted-fg hover:bg-destructive/15 hover:text-destructive",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80"};return r.jsxs(Qx,{children:[r.jsx(Zx,{render:r.jsx("button",{type:"button",onClick:n,"aria-label":e,className:`${l} ${c[s]}`,children:o})}),r.jsx(Wx,{children:e})]})}function c6({agent:e,onClose:n,onSaved:s}){const o=at(),[l,c]=h.useState(!1),d=!e,[f,p]=h.useState(e?.slug??""),[m,g]=h.useState(e?.role??""),[b,v]=h.useState(e?.model??""),[S,C]=h.useState(e?.description??""),[_,w]=h.useState(e?.language??"es"),[k,E]=h.useState((e?.skills??[]).join(", ")),[N,R]=h.useState((e?.tools??[]).join(", ")),[T,O]=h.useState(!!e?.is_master),[A,z]=h.useState(e?.body??""),B=async()=>{const L={role:m||void 0,model:b||void 0,description:S||void 0,language:_||void 0,skills:k,tools:N,is_master:T};c(!0);try{if(d){if(!/^[a-z][a-z0-9_-]*$/.test(f))throw new Error(j("base.defaults_slug_invalid"));await tn.vaultCreate(f,L,A),o.success(j("base.defaults_created",{slug:f}))}else await tn.vaultPatch(e.slug,{fields:L,body:A}),o.success(j("base.defaults_saved",{slug:e.slug}));s()}catch(D){o.error(D.message)}finally{c(!1)}};return r.jsx(Vn,{open:!0,onClose:n,title:d?j("base.defaults_new_title"):j("base.defaults_edit_title",{slug:e.slug}),description:d?j("base.defaults_new_desc"):e.source==="bundled"?j("base.defaults_bundled_desc"):j("base.defaults_user_desc"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:n,disabled:l,children:j("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:B,loading:l,children:j("common.save")})]}),children:r.jsxs("div",{className:"space-y-3",children:[d&&r.jsx(de,{label:"slug",hint:"kebab-case, ej. reviewer, my-agent, content-writer",children:r.jsx(ke,{autoFocus:!0,value:f,onChange:L=>p(L.target.value),placeholder:"reviewer"})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:"role",children:r.jsx(ke,{value:m,onChange:L=>g(L.target.value),placeholder:"Code reviewer"})}),r.jsx(de,{label:"model",children:r.jsx(ke,{value:b,onChange:L=>v(L.target.value),placeholder:"openrouter:..."})}),r.jsx(de,{label:"language",children:r.jsx(ke,{value:_,onChange:L=>w(L.target.value),placeholder:"es"})}),r.jsx(de,{label:"is_master",children:r.jsx("div",{className:"flex h-9 items-center",children:r.jsx(Zt,{checked:T,onChange:O,label:j("base.defaults_master_label")})})})]}),r.jsx(de,{label:"description",children:r.jsx(ke,{value:S,onChange:L=>C(L.target.value)})}),r.jsx(de,{label:"skills",hint:"separadas por coma",children:r.jsx(ke,{value:k,onChange:L=>E(L.target.value),placeholder:"code-review, git"})}),r.jsx(de,{label:"tools",hint:"separadas por coma",children:r.jsx(ke,{value:N,onChange:L=>R(L.target.value),placeholder:"read, write, run"})}),r.jsx(de,{label:"body",hint:"markdown — extiende el system prompt del agente",children:r.jsx(cn,{value:A,onChange:L=>z(L.target.value),rows:10,placeholder:"# Mission\\n..."})})]})})}const u6={apx:"success",claude:"info",codex:"warning"};function d6(){const[e,n]=h.useState(""),s=Qe(`/sessions?engine=${e}`,()=>fO.global(e||void 0)),o=s.data?.sessions||[];return r.jsxs(Ge,{title:j("base.sessions_title"),description:j("base.sessions_desc"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-40",children:r.jsx(wt,{value:e,onChange:n,options:[{value:"",label:j("base.sessions_all")},{value:"apx",label:"apx"},{value:"claude",label:"claude"},{value:"codex",label:"codex"}]})}),r.jsx(ge,{size:"sm",variant:"secondary",onClick:()=>s.mutate(),children:r.jsx(os,{size:13})})]}),children:[s.isLoading&&r.jsx(nt,{}),s.error&&r.jsx(pt,{children:j("base.sessions_error",{msg:s.error.message})}),!s.isLoading&&!s.error&&o.length===0&&r.jsx(pt,{children:j("base.sessions_empty")}),r.jsx("ul",{className:"space-y-1 text-sm",children:o.map((l,c)=>r.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx(Ve,{tone:u6[l.engine]||"muted",children:l.engine}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"truncate",children:l.title||l.id}),r.jsx("div",{className:"truncate font-mono text-[10px] text-muted-fg",children:l.cwd})]}),l.mtime>0&&r.jsx("span",{className:"shrink-0 text-[11px] text-muted-fg",children:new Date(l.mtime).toLocaleString()})]},`${l.engine}-${l.id}-${c}`))})]})}function f6(){const e=_a(),[n,s]=h.useState("open"),o=Qe(`/tasks?state=${n}`,()=>br.global(n));return r.jsxs(Ge,{title:j("project.global_tasks.title"),description:j("project.global_tasks.subtitle"),action:r.jsx("div",{className:"flex gap-1",children:["open","done","dropped","all"].map(l=>r.jsx(ge,{size:"sm",variant:n===l?"primary":"ghost",onClick:()=>s(l),children:l},l))}),children:[o.isLoading&&r.jsx(nt,{}),!o.isLoading&&(o.data?.length??0)===0&&r.jsx(pt,{children:j("project.global_tasks.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:(o.data||[]).map(l=>r.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("button",{type:"button",onClick:()=>e(`/p/${l.project_id}/tasks`),title:j("project.global_tasks.go_project"),children:r.jsx(Ve,{tone:"info",children:(l.project_name||"").split("/").pop()||l.project_id})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"font-medium",children:l.title}),r.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[r.jsx("span",{children:l.state}),l.agent&&r.jsxs(Ve,{tone:"muted",children:["@",l.agent]}),l.tags?.map(c=>r.jsxs("span",{children:["#",c]},c)),l.due&&r.jsxs("span",{children:[j("project.global_tasks.due")," ",l.due]})]})]})]},`${l.project_id}-${l.id}`))})]})}const UC=h.createContext(void 0);function yb(){const e=h.useContext(UC);if(e===void 0)throw new Error(Mn(64));return e}let p6=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const _b={tabActivationDirection:e=>({[p6.activationDirection]:e})},m6=h.forwardRef(function(n,s){const{className:o,defaultValue:l=0,onValueChange:c,orientation:d="horizontal",render:f,value:p,style:m,...g}=n,b=n.defaultValue!==void 0,v=h.useRef([]),[S,C]=h.useState(()=>new Map),[_,w]=_c({controlled:p,default:l,name:"Tabs",state:"value"}),k=p!==void 0,[E,N]=h.useState(()=>new Map),R=h.useCallback(oe=>{if(oe===void 0)return null;for(const[ce,ee]of E.entries())if(ee!=null&&oe===(ee.value??ee.index))return ce;return null},[E]),[T,O]=h.useState(()=>({previousValue:_,tabActivationDirection:"none"})),{previousValue:A,tabActivationDirection:z}=T;let B=z,L=!1;A!==_&&(B=sj(A,_,d,E),L=A!=null&&_!=null&&R(_)==null);const D=L?A:_,P=A!==D||z!==B;Me(()=>{P&&O({previousValue:D,tabActivationDirection:B})},[D,P,B]);const H=Le((oe,ce)=>{const ee=sj(_,oe,d,E);ce.activationDirection=ee,c?.(oe,ce),!ce.isCanceled&&w(oe)}),q=Le((oe,ce)=>{c?.(oe,lt(ce,void 0,void 0,{activationDirection:"none"}))}),Y=Le((oe,ce)=>{C(ee=>{if(ee.get(oe)===ce)return ee;const Te=new Map(ee);return Te.set(oe,ce),Te})}),V=Le((oe,ce)=>{C(ee=>{if(!ee.has(oe)||ee.get(oe)!==ce)return ee;const Te=new Map(ee);return Te.delete(oe),Te})}),$=h.useCallback(oe=>S.get(oe),[S]),Z=h.useCallback(oe=>{for(const ce of E.values())if(oe===ce?.value)return ce?.id},[E]),G=h.useMemo(()=>({getTabElementBySelectedValue:R,getTabIdByPanelValue:Z,getTabPanelIdByValue:$,onValueChange:H,orientation:d,registerMountedTabPanel:Y,setTabMap:N,unregisterMountedTabPanel:V,tabActivationDirection:B,value:_}),[R,Z,$,H,d,Y,N,V,B,_]),X=h.useMemo(()=>{for(const oe of E.values())if(oe!=null&&oe.value===_)return oe},[E,_]),U=h.useMemo(()=>{for(const oe of E.values())if(oe!=null&&!oe.disabled)return oe.value},[E]),K=h.useRef(!b),F=h.useRef(b),J=h.useRef(!1);Me(()=>{if(k)return;function oe(Fe,ve){w(Fe),O(Ce=>Ce.previousValue===Fe&&Ce.tabActivationDirection==="none"?Ce:{previousValue:Fe,tabActivationDirection:"none"}),q(Fe,ve),K.current=!1}if(E.size===0){if(!J.current||_===null)return;oe(null,J1);return}J.current=!0;const ce=X?.disabled,ee=X==null&&_!==null;if(!ce&&_===l&&(F.current=!1),F.current&&ce&&_===l)return;const Te=K.current;if(ce||ee){const Fe=U??null;if(_===Fe){K.current=!1;return}let ve=J1;Te?ve=e_:ce&&(ve=wS),oe(Fe,ve);return}Te&&X!=null&&(q(_,e_),K.current=!1)},[l,U,k,q,X,w,E,_]);const re=Ht("div",n,{state:{orientation:d,tabActivationDirection:B},ref:s,props:g,stateAttributesMapping:_b});return r.jsx(UC.Provider,{value:G,children:r.jsx(hb,{elementsRef:v,children:re})})});function sj(e,n,s,o){if(e==null||n==null)return"none";let l=null,c=null;for(const[p,m]of o.entries()){if(m==null)continue;const g=m.value??m.index;if(e===g&&(l=p),n===g&&(c=p),l!=null&&c!=null)break}if(l==null||c==null)return l!==c&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof n?s==="horizontal"?n>e?"right":"left":n>e?"down":"up":"none";const d=l.getBoundingClientRect(),f=c.getBoundingClientRect();if(s==="horizontal"){if(f.left<d.left)return"left";if(f.left>d.left)return"right"}else{if(f.top<d.top)return"up";if(f.top>d.top)return"down"}return"none"}const HC="data-composite-item-active";function g6(e={}){const{highlightItemOnHover:n,highlightedIndex:s,onHighlightedIndexChange:o}=Y2(),{ref:l,index:c}=bb(e),d=s===c,f=h.useRef(null),p=Vs(l,f);return{compositeProps:h.useMemo(()=>({tabIndex:d?0:-1,onFocus(){o(c)},onMouseMove(){const g=f.current;if(!n||!g)return;const b=g.hasAttribute("disabled")||g.ariaDisabled==="true";!d&&!b&&g.focus()}}),[d,o,c,n]),compositeRef:p,index:c}}const VC=h.createContext(void 0);function h6(){const e=h.useContext(VC);if(e===void 0)throw new Error(Mn(65));return e}const x6=h.forwardRef(function(n,s){const{className:o,disabled:l=!1,render:c,value:d,id:f,nativeButton:p=!0,style:m,...g}=n,{value:b,getTabPanelIdByValue:v,orientation:S}=yb(),{activateOnFocus:C,highlightedTabIndex:_,onTabActivation:w,registerTabResizeObserverElement:k,setHighlightedTabIndex:E,tabsListElement:N}=h6(),R=zr(f),T=h.useMemo(()=>({disabled:l,id:R,value:d}),[l,R,d]),{compositeProps:O,compositeRef:A,index:z}=g6({metadata:T}),B=d===b,L=h.useRef(!1),D=h.useRef(null);h.useEffect(()=>{const K=D.current;if(K)return k(K)},[k]),Me(()=>{if(L.current){L.current=!1;return}if(!(B&&z>-1&&_!==z))return;const K=N;if(K!=null){const F=Pn(yt(K));if(F&&Ze(K,F))return}l||E(z)},[B,z,_,E,l,N]);const{getButtonProps:P,buttonRef:H}=Hl({disabled:l,native:p,focusableWhenDisabled:!0}),q=v(d),Y=h.useRef(!1),V=h.useRef(!1);function $(K){B||l||w(d,lt(Hs,K.nativeEvent,void 0,{activationDirection:"none"}))}function Z(K){B||(z>-1&&!l&&E(z),!l&&C&&(!Y.current||Y.current&&V.current)&&w(d,lt(Hs,K.nativeEvent,void 0,{activationDirection:"none"})))}function G(K){if(B||l)return;Y.current=!0;function F(){Y.current=!1,V.current=!1}(!K.button||K.button===0)&&(V.current=!0,yt(K.currentTarget).addEventListener("pointerup",F,{once:!0}))}return Ht("button",n,{state:{disabled:l,active:B,orientation:S},ref:[s,H,A,D],props:[O,{role:"tab","aria-controls":q,"aria-selected":B,id:R,onClick:$,onFocus:Z,onPointerDown:G,[HC]:B?"":void 0,onKeyDownCapture(){L.current=!0}},g,P]})});let b6=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e[e.startingStyle=po.startingStyle]="startingStyle",e[e.endingStyle=po.endingStyle]="endingStyle",e})({});const v6={..._b,...Bl},y6=h.forwardRef(function(n,s){const{className:o,value:l,render:c,keepMounted:d=!1,style:f,...p}=n,{value:m,getTabIdByPanelValue:g,orientation:b,tabActivationDirection:v,registerMountedTabPanel:S,unregisterMountedTabPanel:C}=yb(),_=zr(),w=h.useMemo(()=>({id:_,value:l}),[_,l]),{ref:k,index:E}=bb({metadata:w}),N=l===m,{mounted:R,transitionStatus:T,setMounted:O}=Ac(N),A=!R,z=g(l),B={hidden:A,orientation:b,tabActivationDirection:v,transitionStatus:T},L=h.useRef(null),D=Ht("div",n,{state:B,ref:[s,k,L],props:[{"aria-labelledby":z,hidden:A,id:_,role:"tabpanel",tabIndex:N?0:-1,inert:Kx(!N),[b6.index]:E},p],stateAttributesMapping:v6});return Or({open:N,ref:L,onComplete(){N||O(!1)}}),Me(()=>{if(!(A&&!d)&&_!=null)return S(l,_),()=>{C(l,_)}},[A,d,l,_,S,C]),d||R?D:null});function _6(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const j6=[];function w6(e){const{itemSizes:n,cols:s=1,loopFocus:o=!0,onLoop:l,dense:c=!1,orientation:d="both",direction:f,highlightedIndex:p,onHighlightedIndexChange:m,rootRef:g,enableHomeAndEndKeys:b=!1,stopEventPropagation:v=!1,disabledIndices:S,modifierKeys:C=j6}=e,[_,w]=h.useState(0),k=s>1,E=h.useRef(null),N=Vs(E,g),R=h.useRef([]),T=h.useRef(!1),O=p??_,A=Le((D,P=!1)=>{if((m??w)(D),P){const H=R.current[D];F_(E.current,H,f,d)}}),z=Le(D=>{if(D.size===0||T.current)return;T.current=!0;const P=Array.from(D.keys()),H=P.find(Y=>Y?.hasAttribute(HC))??null,q=H?P.indexOf(H):-1;q!==-1&&A(q),F_(E.current,H,f,d)}),B=Le((D,P,H)=>l?l?.(D,P,H,R):H),L=h.useMemo(()=>({"aria-orientation":d==="both"?void 0:d,ref:N,onFocus(D){const P=E.current,H=Tn(D.nativeEvent);!P||H==null||!G_(H)||H.setSelectionRange(0,H.value.length??0)},onKeyDown(D){const P=b?db:sC;if(!P.has(D.key)||S6(D,C)||!E.current)return;const q=f==="rtl",Y=q?Wd:oc,V={horizontal:Y,vertical:fl,both:Y}[d],$=q?oc:Wd,Z={horizontal:$,vertical:rc,both:$}[d],G=Tn(D.nativeEvent);if(G!=null&&G_(G)&&!_6(G)){const re=G.selectionStart,oe=G.selectionEnd,ce=G.value??"";if(re==null||D.shiftKey||re!==oe||D.key!==Z&&re<ce.length||D.key!==V&&re>0)return}let X=O;const U=wd(R,S),K=Ch(R,S);if(k){const re=n||Array.from({length:R.current.length},()=>({width:1,height:1})),oe=MS(re,s,c),ce=oe.findIndex(Te=>Te!=null&&!Ps(R.current,Te,S)),ee=oe.reduce((Te,Fe,ve)=>Fe!=null&&!Ps(R.current,Fe,S)?ve:Te,-1);X=oe[AS(oe.map(Te=>Te!=null?R.current[Te]:null),{event:D,orientation:d,loopFocus:o,onLoop:B,cols:s,disabledIndices:zS([...S||R.current.map((Te,Fe)=>Ps(R.current,Fe)?Fe:void 0),void 0],oe),minIndex:ce,maxIndex:ee,prevIndex:OS(O>K?U:O,re,oe,s,D.key===fl?"bl":D.key===oc?"tr":"tl"),rtl:q})]}const F={horizontal:[Y],vertical:[fl],both:[Y,fl]}[d],J={horizontal:[$],vertical:[rc],both:[$,rc]}[d],ie=k?P:{horizontal:b?lz:nC,vertical:b?iz:aC,both:P}[d];b&&(D.key===Of?X=U:D.key===zf&&(X=K)),X===O&&(F.includes(D.key)||J.includes(D.key))&&(o&&X===K&&F.includes(D.key)?(X=U,l&&(X=l(D,O,X,R))):o&&X===U&&J.includes(D.key)?(X=K,l&&(X=l(D,O,X,R))):X=Ln(R.current,{startingIndex:X,decrement:J.includes(D.key),disabledIndices:S})),X!==O&&!bc(R.current,X)&&(v&&D.stopPropagation(),ie.has(D.key)&&D.preventDefault(),A(X,!0),queueMicrotask(()=>{R.current[X]?.focus()}))}}),[s,c,f,S,R,b,O,k,n,o,l,B,N,C,A,d,v]);return h.useMemo(()=>({props:L,highlightedIndex:O,onHighlightedIndexChange:A,elementsRef:R,disabledIndices:S,onMapChange:z,relayKeyboardEvent:L.onKeyDown}),[L,O,A,R,S,z])}function S6(e,n){for(const s of pz.values())if(!n.includes(s)&&e.getModifierState(s))return!0;return!1}function C6(e){const{render:n,className:s,style:o,refs:l=gc,props:c=gc,state:d=un,stateAttributesMapping:f,highlightedIndex:p,onHighlightedIndexChange:m,orientation:g,dense:b,itemSizes:v,loopFocus:S,onLoop:C,cols:_,enableHomeAndEndKeys:w,onMapChange:k,stopEventPropagation:E=!0,rootRef:N,disabledIndices:R,modifierKeys:T,highlightItemOnHover:O=!1,tag:A="div",...z}=e,B=Yx(),{props:L,highlightedIndex:D,onHighlightedIndexChange:P,elementsRef:H,onMapChange:q,relayKeyboardEvent:Y}=w6({itemSizes:v,cols:_,loopFocus:S,onLoop:C,dense:b,orientation:g,highlightedIndex:p,onHighlightedIndexChange:m,rootRef:N,stopEventPropagation:E,enableHomeAndEndKeys:w,direction:B,disabledIndices:R,modifierKeys:T}),V=Ht(A,e,{state:d,ref:l,props:[L,...c,z],stateAttributesMapping:f}),$=h.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:P,highlightItemOnHover:O,relayKeyboardEvent:Y}),[D,P,O,Y]);return r.jsx(F2.Provider,{value:$,children:r.jsx(hb,{elementsRef:H,onMapChange:Z=>{k?.(Z),q(Z)},children:V})})}const k6=h.forwardRef(function(n,s){const{activateOnFocus:o=!1,className:l,loopFocus:c=!0,render:d,style:f,...p}=n,{onValueChange:m,orientation:g,value:b,setTabMap:v,tabActivationDirection:S}=yb(),[C,_]=h.useState(0),[w,k]=h.useState(null),E=h.useRef(new Set),N=h.useRef(new Set),R=h.useRef(null);h.useEffect(()=>{if(typeof ResizeObserver>"u")return;const D=new ResizeObserver(()=>{E.current.forEach(P=>{P()})});return R.current=D,w&&D.observe(w),N.current.forEach(P=>{D.observe(P)}),()=>{D.disconnect(),R.current=null}},[w]);const T=Le(D=>(E.current.add(D),()=>{E.current.delete(D)})),O=Le(D=>(N.current.add(D),R.current?.observe(D),()=>{N.current.delete(D),R.current?.unobserve(D)})),A=Le((D,P)=>{D!==b&&m(D,P)}),z={orientation:g,tabActivationDirection:S},B={"aria-orientation":g==="vertical"?"vertical":void 0,role:"tablist"},L=h.useMemo(()=>({activateOnFocus:o,highlightedTabIndex:C,registerIndicatorUpdateListener:T,registerTabResizeObserverElement:O,onTabActivation:A,setHighlightedTabIndex:_,tabsListElement:w}),[o,C,T,O,A,_,w]);return r.jsx(VC.Provider,{value:L,children:r.jsx(C6,{render:d,className:l,style:f,state:z,refs:[s,k],props:[B,p],stateAttributesMapping:_b,highlightedIndex:C,enableHomeAndEndKeys:!0,loopFocus:c,orientation:g,onHighlightedIndexChange:_,onMapChange:v,disabledIndices:gc})})});function Df({className:e,...n}){return r.jsx(m6,{"data-slot":"tabs",className:Ot("flex flex-col gap-4",e),...n})}const E6=lb("inline-flex h-9 w-fit items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground data-[variant=line]:h-8 data-[variant=line]:gap-1 data-[variant=line]:rounded-none data-[variant=line]:bg-transparent data-[variant=line]:p-0",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Lf({className:e,variant:n="default",...s}){return r.jsx(k6,{"data-slot":"tabs-list","data-variant":n,className:Ot(E6({variant:n}),e),...s})}function ns({className:e,...n}){return r.jsx(x6,{"data-slot":"tabs-trigger",className:Ot("inline-flex h-7 items-center justify-center gap-1.5 rounded-md border border-transparent px-3 py-1 text-sm font-medium whitespace-nowrap text-muted-fg transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 data-active:bg-background data-active:text-foreground data-active:shadow-sm dark:data-active:border-input dark:data-active:bg-input/30 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n})}function za({className:e,...n}){return r.jsx(y6,{"data-slot":"tabs-content",className:Ot("text-sm outline-none",e),...n})}function rj(e,n){let s=e;for(const o of n.split(".")){if(!s||typeof s!="object"||Array.isArray(s))return;s=s[o]}return s}function jb(e,n=""){const s={};for(const[o,l]of Object.entries(e)){const c=n?`${n}.${o}`:o;l&&typeof l=="object"&&!Array.isArray(l)?Object.assign(s,jb(l,c)):s[c]=l}return s}function N6(e){const n=JSON.parse(e);if(!n||typeof n!="object"||Array.isArray(n))throw new Error("JSON debe ser objeto.");return n}function $h({sections:e,source:n,placeholderSource:s,jsonTitle:o,jsonDescription:l,saveLabel:c="Guardar",onSaveFields:d,onSaveJson:f,busy:p}){const m=e[0]?.key||"json",[g,b]=h.useState({}),[v,S]=h.useState(""),[C,_]=h.useState("");h.useEffect(()=>{const N={};for(const R of e.flatMap(T=>T.fields))N[R.path]=rj(n,R.path)??"";b(N),S(JSON.stringify(n||{},null,2)),_("")},[n,e]);const w=h.useMemo(()=>new Set(e.flatMap(N=>N.fields.map(R=>R.path))),[e]),k=async()=>{const N={},R=[];for(const T of e.flatMap(O=>O.fields)){const O=g[T.path];if(!qa(O)){if(O===""||O===void 0||O===null){R.push(T.path);continue}if(T.kind==="number"){const A=Number(O);Number.isFinite(A)&&(N[T.path]=A)}else N[T.path]=O}}await d(N,R.filter(T=>w.has(T)))},E=async()=>{_("");try{await f(N6(v))}catch(N){_(N.message)}};return r.jsxs(Df,{defaultValue:m,className:"space-y-4",children:[r.jsxs(Lf,{className:"flex flex-wrap",children:[e.map(N=>r.jsx(ns,{value:N.key,children:N.label},N.key)),r.jsx(ns,{value:"json",children:"JSON"})]}),e.map(N=>r.jsx(za,{value:N.key,children:r.jsxs("div",{className:"space-y-4",children:[N.description&&r.jsx("p",{className:"text-sm text-muted-fg",children:N.description}),r.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:N.fields.map(R=>r.jsx(R6,{field:R,value:g[R.path],inherited:rj(s,R.path),onChange:T=>b(O=>({...O,[R.path]:T}))},R.path))}),r.jsx(ge,{variant:"primary",loading:p,onClick:k,children:c})]})},N.key)),r.jsx(za,{value:"json",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium",children:o}),l&&r.jsx("p",{className:"text-xs text-muted-fg",children:l})]}),r.jsx(cn,{rows:18,className:"font-mono text-xs",value:v,onChange:N=>S(N.target.value)}),C&&r.jsx("p",{className:"text-xs text-destructive",children:C}),r.jsx(ge,{variant:"primary",loading:p,onClick:E,children:"Guardar JSON"})]})})]})}function R6({field:e,value:n,inherited:s,onChange:o}){const l=e.placeholder||oj(s)||(qa(n)?Sr(n):""),c=e.hint||(s!==void 0?`Heredado: ${oj(s)}`:void 0);return e.kind==="boolean"?r.jsx("div",{className:"flex items-end pb-1",children:r.jsx(Zt,{checked:n===!0,onChange:o,label:e.label})}):r.jsx(de,{label:e.label,hint:c,children:e.kind==="select"?r.jsx(wt,{value:String(n||""),onChange:o,placeholder:l||"(sin override)",options:[{value:"",label:l||"(sin override)"},...(e.options||[]).map(d=>({value:String(d.value),label:d.label}))]}):e.kind==="textarea"?r.jsx(cn,{rows:4,value:String(n||""),placeholder:l,onChange:d=>o(d.target.value)}):r.jsx(ke,{type:e.kind==="password"?"password":e.kind==="number"?"number":"text",value:String(qa(n)?"":n||""),placeholder:e.kind==="password"&&qa(n)?Sr(n):e.kind==="password"&&qa(s)?Sr(s):l,onChange:d=>o(d.target.value)})})}function oj(e){return e==null||e===""?"":qa(e)?Sr(e):Array.isArray(e)?e.join(", "):typeof e=="object"?JSON.stringify(e):String(e)}const T6=[{key:"routing",label:"Overrides",description:".apc/config.json. Sólo valores propios del proyecto; vacío hereda global/effective.",fields:[{path:"route_to_agent",label:"Route to agent",placeholder:"master"},{path:"super_agent.model",label:"Super-agent model"},{path:"super_agent.permission_mode",label:"Permission mode",kind:"select",options:bx.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:"Prompt extra",kind:"textarea"}]},{key:"telegram",label:"Telegram",fields:[{path:"telegram.route_to_agent",label:"Route to agent"},{path:"telegram.chat_id",label:"Chat ID"},{path:"telegram.bot_token",label:"Bot token",kind:"password"},{path:"telegram.respond_with_engine",label:"Responder con engine",kind:"boolean"}]},{key:"engines",label:"Engines",fields:[{path:"engines.ollama.base_url",label:"Ollama URL"},{path:"engines.anthropic.api_key",label:"Anthropic API key",kind:"password"},{path:"engines.openai.api_key",label:"OpenAI API key",kind:"password"},{path:"engines.groq.api_key",label:"Groq API key",kind:"password"},{path:"engines.openrouter.api_key",label:"OpenRouter API key",kind:"password"},{path:"engines.gemini.api_key",label:"Gemini API key",kind:"password"}]}],A6=[{key:"identity",label:"Proyecto",description:".apc/project.json. Metadata APC portable; no secrets, no runtime.",fields:[{path:"name",label:"Name"},{path:"version",label:"Version"},{path:"apf",label:"APC spec"},{path:"apx",label:"APX install state"},{path:"apx_id",label:"APX storage id"}]}];function M6({pid:e}){const n=at(),s=_a(),{project:o,mutate:l}=ab(e),c=Qe(`/projects/${e}/config`,()=>aa.config.show(e)),d=String(e)==="0";if(c.isLoading)return r.jsx(nt,{});if(!c.data)return r.jsx(pt,{children:j("project.config.no_data")});const f=async m=>{await aa.apcProject.put(e,m),n.success(j("project.config.save_project")),c.mutate()},p=async m=>{await aa.config.put(e,m),n.success(j("project.config.save_override")),c.mutate()};return r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ge,{title:j("project.config.section_title"),description:j("project.config.section_desc"),children:r.jsxs(Df,{defaultValue:"override",className:"space-y-4",children:[r.jsxs(Lf,{children:[r.jsx(ns,{value:"override",children:"Override"}),r.jsx(ns,{value:"project",children:"APC project"}),r.jsx(ns,{value:"effective",children:"Effective"})]}),r.jsx(za,{value:"override",children:r.jsx($h,{sections:T6,source:c.data.project_only,placeholderSource:c.data.effective,jsonTitle:c.data.project_config_path,jsonDescription:".apc/config.json. Overrides del proyecto.",onSaveFields:async(m,g)=>{await aa.config.set(e,m),g.length&&await aa.config.unset(e,g),n.success(j("project.config.save_fields_success")),c.mutate()},onSaveJson:p})}),r.jsx(za,{value:"project",children:r.jsx($h,{sections:A6,source:c.data.apc_project||{},jsonTitle:c.data.project_json_path,jsonDescription:".apc/project.json. Metadata APC portable.",onSaveFields:async(m,g)=>{await aa.apcProject.set(e,z6(m),g),n.success(j("project.config.save_meta_success")),c.mutate()},onSaveJson:f})}),r.jsx(za,{value:"effective",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs text-muted-fg",children:j("project.config.effective_read")}),r.jsx("pre",{className:"max-h-96 overflow-auto rounded-lg border border-border bg-muted/40 p-3 text-xs",children:JSON.stringify(c.data.effective,null,2)})]})})]})}),!d&&o?r.jsx(O6,{pid:e,label:o.name||o.path,onRebuilt:()=>c.mutate(),onUnregistered:()=>{l(),s("/")}}):null]})}function O6({pid:e,label:n,onRebuilt:s,onUnregistered:o}){const l=at(),[c,d]=h.useState(null),[f,p]=h.useState(null),m=async()=>{d("rebuild");try{await aa.rebuild(e),l.success(j("project.rebuild_done")),s()}catch(b){l.error(b.message)}finally{d(null),p(null)}},g=async()=>{d("unregister");try{await aa.remove(e),l.success(j("project.unregistered")),o()}catch(b){l.error(b.message)}finally{d(null),p(null)}};return r.jsxs(r.Fragment,{children:[r.jsx(Ge,{title:j("project.danger.title"),description:j("project.danger.subtitle"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-border bg-muted/30 px-3 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:j("project.rebuild")}),r.jsx("div",{className:"text-xs text-muted-fg",children:j("project.danger.rebuild_desc")})]}),r.jsxs(ge,{size:"sm",variant:"secondary",onClick:()=>p("rebuild"),children:[r.jsx(os,{size:13})," ",j("project.rebuild")]})]}),r.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-red-500/40 bg-red-500/5 px-3 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:j("admin.unregister")}),r.jsx("div",{className:"text-xs text-muted-fg",children:j("project.danger.unregister_desc")})]}),r.jsxs(ge,{size:"sm",variant:"destructive",onClick:()=>p("unregister"),children:[r.jsx(la,{size:13})," ",j("admin.unregister")]})]})]})}),r.jsx(Vn,{open:f==="rebuild",onClose:()=>c?null:p(null),title:j("project.danger.rebuild_confirm_title"),description:j("project.danger.rebuild_confirm_desc",{label:n}),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:()=>p(null),disabled:c!==null,children:j("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:m,loading:c==="rebuild",children:j("project.rebuild")})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:j("project.danger.rebuild_long")})}),r.jsx(Vn,{open:f==="unregister",onClose:()=>c?null:p(null),title:j("project.danger.unregister_confirm_title"),description:j("project.unregister_confirm",{label:n}),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:()=>p(null),disabled:c!==null,children:j("common.cancel")}),r.jsx(ge,{variant:"destructive",onClick:g,loading:c==="unregister",children:j("admin.unregister")})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:j("project.danger.unregister_long")})})]})}function z6(e){const n={};for(const[s,o]of Object.entries(jb(e)))qa(o)||(n[s]=o);return n}const D6=["","es","en","pt","fr","it","de"],lj=e=>e.split(",").map(n=>n.trim()).filter(Boolean);function qC(e){return e.is_master?{gradient:"from-violet-600 to-indigo-600",Icon:Bs}:{gradient:"from-slate-600 to-gray-600",Icon:gn}}function L6(e){const n=e.filter(d=>d.is_master),s=n.length===1?n[0]:null,o=d=>d.parent?d.parent:s&&!d.is_master&&d.slug!==s.slug?s.slug:null,l=new Map,c=[];for(const d of e){const f=o(d);f&&e.some(p=>p.slug===f)?(l.has(f)||l.set(f,[]),l.get(f).push(d)):c.push(d)}return{roots:c,childrenByParent:l}}function P6({pid:e}){const n=_a();at();const s=Qe(`/projects/${e}/agents`,()=>tn.list(e)),[o,l]=h.useState("hierarchy"),[c,d]=h.useState(!1),[f,p]=h.useState(!1),m=s.data||[],g=C=>n(`/p/${e}/agents/${C}`),b=C=>n(C?`/p/${e}/chat?agent=${C}`:`/p/${e}/chat`),{roots:v,childrenByParent:S}=h.useMemo(()=>L6(m),[m]);return r.jsxs(Ge,{title:j("project.agents.title"),description:j("project.agents.subtitle_full"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex rounded-lg border border-border p-0.5",children:[r.jsxs("button",{onClick:()=>l("hierarchy"),className:Oe("flex items-center gap-1 rounded-md px-2 py-1 text-xs",o==="hierarchy"?"bg-accent text-accent-fg":"text-muted-fg"),children:[r.jsx(px,{size:13})," ",j("project.agents.hierarchy")]}),r.jsxs("button",{onClick:()=>l("list"),className:Oe("flex items-center gap-1 rounded-md px-2 py-1 text-xs",o==="list"?"bg-accent text-accent-fg":"text-muted-fg"),children:[r.jsx(oA,{size:13})," ",j("project.agents.list_view")]})]}),r.jsxs(ge,{size:"sm",variant:"ghost",onClick:()=>p(!0),children:[r.jsx(bA,{size:13})," ",j("project.agents.import")]}),r.jsxs(ge,{size:"sm",variant:"secondary",onClick:()=>b(),children:[r.jsx(Ya,{size:13})," ",j("project.agents.chat")]}),r.jsxs(ge,{size:"sm",variant:"primary","data-testid":"agent-new",onClick:()=>d(!0),children:[r.jsx(nn,{size:14})," ",j("project.agents.new")]})]}),children:[s.isLoading&&r.jsx(nt,{}),!s.isLoading&&m.length===0&&r.jsx(pt,{children:j("project.agents.empty_text")}),!s.isLoading&&m.length>0&&(o==="hierarchy"?r.jsx(B6,{roots:v,childrenByParent:S,onOpen:g,onChat:b}):r.jsx(U6,{agents:m,onOpen:g,onChat:b})),r.jsx(H6,{open:c,pid:e,agents:m,onClose:()=>d(!1),onCreated:()=>{d(!1),s.mutate()}}),r.jsx(I6,{open:f,pid:e,existing:m.map(C=>C.slug),onClose:()=>p(!1),onImported:()=>s.mutate()})]})}function I6({open:e,onClose:n,onImported:s,pid:o,existing:l}){const c=at(),d=Qe(e?"/agents/vault":null,()=>tn.vault()),[f,p]=h.useState(""),m=d.data||[],g=async b=>{p(b);try{await tn.import(o,b),c.success(j("project.agents.import_success",{slug:b})),s()}catch(v){c.error(v.message)}finally{p("")}};return r.jsxs(Vn,{open:e,onClose:n,title:j("project.agents.import_title"),description:j("project.agents.import_desc"),size:"lg",footer:r.jsx(ge,{variant:"ghost",onClick:n,children:j("common.close")}),children:[d.isLoading&&r.jsx(nt,{}),!d.isLoading&&m.length===0&&r.jsx(pt,{children:j("project.agents.import_empty")}),r.jsx("ul",{className:"space-y-2",children:m.map(b=>{const v=l.includes(b.slug);return r.jsxs("li",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted/30 p-3",children:[r.jsx(gn,{size:16,className:"shrink-0 text-muted-fg"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-sm font-medium",children:b.slug}),b.is_master&&r.jsxs(Ve,{tone:"success",children:[r.jsx(Bs,{size:9})," ",j("project.agents.orchestrator")]}),b.model&&r.jsx(Ve,{tone:"info",children:b.model})]}),b.description&&r.jsx("p",{className:"truncate text-xs text-muted-fg",children:b.description})]}),r.jsx(ge,{size:"sm",variant:"primary",disabled:v||f===b.slug,loading:f===b.slug,onClick:()=>g(b.slug),children:j(v?"project.agents.import_already":"project.agents.import_btn")})]},b.slug)})})]})}function B6({roots:e,childrenByParent:n,onOpen:s,onChat:o}){return r.jsx("div",{className:"space-y-8",children:e.map(l=>{const c=n.get(l.slug)||[];return r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(Mg,{agent:l,onOpen:s,onChat:o,wide:!0}),c.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-5 w-px bg-border"}),r.jsx("div",{className:"flex flex-wrap items-start justify-center gap-4 border-t border-border pt-5",children:c.map(d=>r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(Mg,{agent:d,onOpen:s,onChat:o}),(n.get(d.slug)||[]).length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-4 w-px bg-border"}),r.jsx("div",{className:"flex flex-wrap justify-center gap-3 border-t border-border pt-4",children:(n.get(d.slug)||[]).map(f=>r.jsx(Mg,{agent:f,onOpen:s,onChat:o,compact:!0},f.slug))})]})]},d.slug))})]})]},l.slug)})})}function Mg({agent:e,onOpen:n,onChat:s,wide:o,compact:l}){const{gradient:c,Icon:d}=qC(e);return r.jsxs("div",{"data-testid":`agent-card-${e.slug}`,className:Oe("cursor-pointer rounded-xl border border-border bg-card p-3 transition-colors hover:border-muted-fg/50",o?"w-64":l?"w-44":"w-52"),onClick:()=>n(e.slug),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:Oe("flex size-8 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br",c),children:r.jsx(d,{className:"size-4 text-white"})}),r.jsx("span",{className:"truncate text-sm font-semibold",children:e.slug})]}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1",children:[e.is_master&&r.jsxs(Ve,{tone:"success",children:[r.jsx(Bs,{size:9})," ",j("project.agents.orchestrator")]}),e.role&&r.jsx(Ve,{children:e.role}),e.model&&!l&&r.jsx(Ve,{tone:"info",children:e.model})]}),r.jsxs("div",{className:"mt-2 flex items-center gap-3 border-t border-border pt-2 text-xs text-muted-fg",onClick:f=>f.stopPropagation(),children:[r.jsxs("button",{onClick:()=>n(e.slug),className:"flex items-center gap-1 hover:text-foreground",children:[r.jsx(lf,{size:12})," ",j("project.agents.view")]}),r.jsxs("button",{onClick:()=>s(e.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[r.jsx(Ya,{size:12})," ",j("project.agents.chat")]})]})]})}function U6({agents:e,onOpen:n,onChat:s}){const o=[...e].sort((l,c)=>+!!c.is_master-+!!l.is_master||l.slug.localeCompare(c.slug));return r.jsx("div",{className:"space-y-2",children:o.map(l=>{const{gradient:c,Icon:d}=qC(l);return r.jsxs("div",{"data-testid":`agent-card-${l.slug}`,className:"flex cursor-pointer items-center gap-4 rounded-xl border border-border bg-muted/30 p-3 hover:border-muted-fg/50",onClick:()=>n(l.slug),children:[r.jsx("div",{className:Oe("flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",c),children:r.jsx(d,{className:"size-4 text-white"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-sm font-semibold",children:l.slug}),l.is_master&&r.jsxs(Ve,{tone:"success",children:[r.jsx(Bs,{size:10})," ",j("project.agents.orchestrator")]}),l.role&&r.jsx(Ve,{children:l.role}),l.model&&r.jsx(Ve,{tone:"info",children:l.model}),l.parent&&r.jsxs("span",{className:"text-[10px] text-violet-400",children:["↳ ",l.parent]})]}),l.description&&r.jsx("p",{className:"mt-1 truncate text-xs text-muted-fg",children:l.description}),r.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[l.skills?.map(f=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(ls,{size:9})," ",f]},f)),l.tools?.map(f=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(Dl,{size:9})," ",f]},f))]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-3 text-xs text-muted-fg",onClick:f=>f.stopPropagation(),children:[r.jsxs("button",{onClick:()=>n(l.slug),className:"flex items-center gap-1 hover:text-foreground",children:[r.jsx(lf,{size:12})," ",j("project.agents.view")]}),r.jsxs("button",{onClick:()=>s(l.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[r.jsx(Ya,{size:12})," ",j("project.agents.chat")]})]})]},l.slug)})})}function H6({open:e,onClose:n,onCreated:s,pid:o,agents:l}){const c=at(),[d,f]=h.useState(""),[p,m]=h.useState(""),[g,b]=h.useState(""),[v,S]=h.useState(""),[C,_]=h.useState(""),[w,k]=h.useState(""),[E,N]=h.useState(""),[R,T]=h.useState(!1),[O,A]=h.useState(""),[z,B]=h.useState(!1),L=()=>{f(""),m(""),b(""),S(""),_(""),k(""),N(""),T(!1),A("")},D=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(d)){c.error(j("project.agents.slug_invalid"));return}B(!0);try{await tn.create(o,{slug:d,role:p||void 0,model:g||void 0,language:v||void 0,description:C||void 0,skills:lj(w),tools:lj(E),is_master:R,parent:O||void 0}),c.success(j("project.agents.create_success",{slug:d})),s(),L()}catch(P){c.error(P?.message||j("project.agents.create_error"))}finally{B(!1)}};return r.jsx(Vn,{open:e,onClose:n,title:j("project.agents.new_title"),description:j("project.agents.new_desc"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:n,disabled:z,children:j("common.cancel")}),r.jsx(ge,{variant:"primary","data-testid":"agent-create-submit",onClick:D,loading:z,children:j("common.create")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:j("project.agents.slug_label"),children:r.jsx(ke,{autoFocus:!0,"data-testid":"agent-slug",value:d,onChange:P=>f(P.target.value),placeholder:j("project.agents.slug_ph")})}),r.jsx(de,{label:j("project.agents.role_label"),children:r.jsx(ke,{value:p,onChange:P=>m(P.target.value),placeholder:j("project.agents.role_ph")})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:j("project.agents.model_label"),hint:j("project.agents.model_hint"),children:r.jsx(ke,{value:g,onChange:P=>b(P.target.value)})}),r.jsx(de,{label:j("project.agents.lang_label"),children:r.jsx(wt,{value:v,onChange:S,options:D6.map(P=>({value:P,label:P||"—"}))})})]}),r.jsx(de,{label:j("project.agents.desc_label"),children:r.jsx(cn,{rows:2,value:C,onChange:P=>_(P.target.value),placeholder:j("project.agents.desc_ph")})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:j("project.agents.skills_label"),children:r.jsx(ke,{value:w,onChange:P=>k(P.target.value),placeholder:j("project.agents.skills_ph")})}),r.jsx(de,{label:j("project.agents.tools_label"),children:r.jsx(ke,{value:E,onChange:P=>N(P.target.value),placeholder:j("project.agents.tools_ph")})})]}),r.jsxs("div",{className:"grid grid-cols-2 items-end gap-3",children:[r.jsx(de,{label:j("project.agents.parent_label"),hint:j("project.agents.parent_hint"),children:r.jsx(wt,{value:O,onChange:A,placeholder:j("project.agents.none_parent"),options:[{value:"",label:j("project.agents.none_parent")},...l.filter(P=>P.slug!==d).map(P=>({value:P.slug,label:P.slug}))]})}),r.jsx(Zt,{checked:R,onChange:T,label:j("project.agents.master_label")})]})]})})}function fd(e){return e.split(`
598
+ `).map(n=>n.trim()).filter(Boolean)}const io={exec_agent:{label:"Agente del proyecto",desc:"Ejecuta un agente del proyecto con un prompt. Elegís cuál.",icon:gn},super_agent:{label:"Super-agente",desc:"Llama al super-agente de APX con un prompt.",icon:Bs},telegram:{label:"Telegram",desc:"Manda un mensaje fijo a un canal de Telegram. No usa modelo ni agente.",icon:Ya},shell:{label:"Shell",desc:"Corre un comando de shell. Sin prompt ni pre/post — el comando es la acción.",icon:kr},heartbeat:{label:"Latido (heartbeat)",desc:"No hace nada salvo escribir una línea en los logs cada vez que corre. Sirve para confirmar que el scheduler está vivo. Si no sabés si lo necesitás, no lo uses.",icon:yl}},V6=Object.keys(io).map(e=>({value:e,label:io[e].label,description:io[e].desc,icon:io[e].icon}));function $C(e){if(!e)return"—";if(e.startsWith("every:")){const n=e.slice(6),s=n.match(/^(\d+)(s|m|h|d)$/);if(s){const o=s[1],l={s:"segundos",m:"minutos",h:"horas",d:"días"}[s[2]]||s[2];return`cada ${o} ${l}`}return`cada ${n}`}return e.startsWith("once:")?`una vez · ${new Date(e.slice(5)).toLocaleString()}`:e.startsWith("cron ")?`cron · ${e.slice(5)}`:e}const q6=[{label:"cada 10 min",value:"every:10m"},{label:"cada hora",value:"every:1h"},{label:"diario 9am",value:"cron 0 9 * * *"},{label:"días hábiles 9am",value:"cron 0 9 * * 1-5"}],$6=[{v:"{{pre_output}}",where:"prompt",desc:"Salida de los pre-commands, inyectada en el prompt."},{v:"$APX_LLM_OUTPUT",where:"post",desc:"Respuesta del agente / super-agente."},{v:"$APX_STATUS",where:"post",desc:"ok | error."},{v:"$APX_SKIPPED",where:"post",desc:"1 si la acción se salteó."},{v:"$APX_PRE_OUTPUT",where:"post",desc:"Salida de los pre-commands."},{v:"$APX_PRE_OUTPUT_FILE",where:"post",desc:"Archivo con la salida de pre (para outputs grandes)."},{v:"$APX_PRE_EXIT",where:"post",desc:"Exit code de los pre-commands."},{v:"$APX_ROUTINE",where:"pre/post",desc:"Nombre de la rutina."}];function G6(e,n){switch(e){case"exec_agent":return n.agent?`Ejecuta el agente "${n.agent}"`:"Ejecuta un agente (falta elegir)";case"super_agent":return"Llama al super-agente";case"telegram":return`Envía Telegram a "${n.channel||"default"}"`;case"shell":return n.command?`Corre: ${String(n.command).slice(0,40)}`:"Corre un comando shell";case"heartbeat":return"Deja un latido en logs"}}function F6({pid:e}){const n=at(),s=Qe(`/projects/${e}/routines`,()=>xr.list(e)),[o,l]=h.useState(null),c=async p=>{try{await(p.enabled?xr.disable:xr.enable)(e,p.name),s.mutate()}catch(m){n.error(m?.message||j("project.routines.toggle_error"))}},d=async p=>{try{await xr.run(e,p.name),n.success(j("project.routines.run_success",{name:p.name}))}catch(m){n.error(m?.message||j("project.routines.run_error"))}},f=async p=>{if(confirm(j("project.routines.delete_confirm",{name:p.name})))try{await xr.remove(e,p.name),n.success(j("project.routines.delete_success")),s.mutate()}catch(m){n.error(m?.message||j("project.routines.delete_error"))}};return r.jsxs(Ge,{title:j("project.routines.title"),description:j("project.routines.subtitle"),action:r.jsxs(ge,{size:"sm",variant:"primary",onClick:()=>l({kind:"super_agent",schedule:"every:10m",enabled:!0}),children:[r.jsx(nn,{size:14})," ",j("project.routines.new_btn")]}),children:[s.isLoading&&r.jsx(nt,{}),!s.isLoading&&(s.data?.length??0)===0&&r.jsx(pt,{children:j("project.routines.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:(s.data||[]).map(p=>{const m=io[p.kind],g=m?.icon||fc,b=p.last_status==="error";return r.jsxs("li",{className:"cursor-pointer rounded-xl border border-border bg-muted/30 p-3 hover:border-muted-fg/50",onClick:()=>l({...p}),children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:Oe("flex size-7 items-center justify-center rounded-lg",p.enabled?"bg-emerald-500/15 text-emerald-400":"bg-muted text-muted-fg"),children:r.jsx(g,{size:14})}),r.jsx("span",{className:"font-medium",children:p.name}),r.jsx(Ve,{tone:p.kind==="shell"?"warning":"info",children:m?.label||p.kind}),!p.enabled&&r.jsx(Ve,{tone:"muted",children:j("project.routines.paused")})]}),r.jsxs("div",{className:"flex items-center gap-2",onClick:v=>v.stopPropagation(),children:[r.jsx(Zt,{checked:p.enabled,onChange:()=>c(p)}),r.jsxs(ge,{size:"sm",variant:"secondary",onClick:()=>d(p),children:[r.jsx(gx,{size:13})," Run"]}),r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>f(p),children:r.jsx(la,{size:13})})]})]}),r.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-fg",children:[r.jsxs("span",{children:["⏱ ",$C(p.schedule)]}),r.jsx("span",{children:G6(p.kind,p.spec||{})}),p.next_run_at&&r.jsxs("span",{children:[j("project.routines.next_run")," ",new Date(p.next_run_at).toLocaleString()]}),r.jsxs("span",{className:Oe(p.last_status==="ok"&&"text-emerald-500",b&&"text-destructive"),children:["última: ",p.last_status||"—"]})]}),p.last_error&&r.jsx("div",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive",children:p.last_error})]},p.name)})}),r.jsx(Y6,{draft:o,onClose:()=>l(null),onSaved:()=>{l(null),s.mutate()},pid:e})]})}function Y6({draft:e,onClose:n,onSaved:s,pid:o}){const l=at(),c=Qe(e?`/projects/${o}/agents`:null,()=>tn.list(o)),[d,f]=h.useState(!1),[p,m]=h.useState(""),[g,b]=h.useState("super_agent"),[v,S]=h.useState("every:10m"),[C,_]=h.useState(!0),[w,k]=h.useState(""),[E,N]=h.useState(""),[R,T]=h.useState("default"),[O,A]=h.useState(""),[z,B]=h.useState(""),[L,D]=h.useState(""),[P,H]=h.useState("heartbeat"),[q,Y]=h.useState(""),[V,$]=h.useState(""),[Z,G]=h.useState("");h.useEffect(()=>{if(!e)return;const ee=e.spec&&typeof e.spec=="object"?e.spec:{};m(e.name||""),b(e.kind||"super_agent"),S(e.schedule||"every:10m"),_(e.enabled??!0),k(ee.agent||""),N(ee.prompt||""),T(ee.channel||"default"),A(ee.chat_id?String(ee.chat_id):""),B(ee.text||""),D(ee.command||""),H(ee.channel||"heartbeat"),Y(ee.message||""),$((e.pre_commands||[]).join(`
599
+ `)),G((e.post_commands||[]).join(`
600
+ `))},[e]);const X=()=>{switch(g){case"exec_agent":return{agent:w,prompt:E};case"super_agent":return{prompt:E};case"telegram":return{channel:R,...O?{chat_id:O}:{},text:z};case"shell":return{command:L};case"heartbeat":return{channel:P,message:q}}},U=async()=>{if(!p){l.error(j("project.routines.name_required"));return}f(!0);try{const ee=g==="exec_agent"||g==="super_agent";await xr.upsert(o,{name:p,kind:g,schedule:v,enabled:C,spec:X(),pre_commands:ee?fd(V):[],post_commands:ee?fd(Z):[]}),l.success(j("project.routines.saved")),s()}catch(ee){l.error(ee?.message||j("project.routines.save_error"))}finally{f(!1)}},K=g==="exec_agent"||g==="super_agent",F=K?fd(V):[],J=K?fd(Z):[],ie=(()=>{switch(g){case"exec_agent":return w?`Agente "${w}" responde el prompt`:"Agente (elegí cuál) responde el prompt";case"super_agent":return"El super-agente responde el prompt";case"telegram":return`Manda Telegram al canal "${R}"`;case"shell":return L?`Corre: ${L.slice(0,48)}`:"Corre el comando shell";case"heartbeat":return"Deja un latido en logs"}})(),re=K,oe=io[g].icon,ce=[...F.map((ee,Te)=>({id:`pre-${Te}`,icon:kr,label:"Pre",detail:ee,action:!1})),{id:"action",icon:oe,label:ie,detail:re&&E?E.slice(0,90):void 0,action:!0},...J.map((ee,Te)=>({id:`post-${Te}`,icon:kr,label:"Post",detail:ee,action:!1}))];return r.jsx(Vn,{open:!!e,onClose:n,title:e?.name?j("project.routines.edit_title",{name:e.name}):j("project.routines.new_title"),description:j("project.routines.dialog_desc"),size:"xl",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:n,disabled:d,children:j("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:U,loading:d,children:j("common.save")})]}),children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 px-3 py-2",children:[r.jsx(Zt,{checked:C,onChange:_,label:j("project.routines.enabled_label")}),r.jsx("span",{className:"text-[11px] text-muted-fg",children:j(C?"project.routines.enabled_hint":"project.routines.disabled_hint")})]}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:j("project.routines.name_field"),hint:e?.name?j("project.routines.name_no_edit"):void 0,children:r.jsx(ke,{value:p,disabled:!!e?.name,onChange:ee=>m(ee.target.value),placeholder:"resumen-diario"})}),r.jsx(de,{label:j("project.routines.kind_field"),children:r.jsx(wt,{value:g,onChange:ee=>b(ee),options:V6})}),r.jsx("p",{className:"-mt-1 text-[11px] text-muted-fg",children:io[g].desc}),g==="exec_agent"&&r.jsx(de,{label:j("project.routines.agent_field"),hint:j("project.routines.agent_hint"),children:r.jsx(wt,{value:w,onChange:k,placeholder:c.isLoading?j("project.routines.agent_loading"):j("project.routines.agent_pick"),options:(c.data||[]).map(ee=>({value:ee.slug,label:ee.slug,description:[ee.role,ee.model].filter(Boolean).join(" · ")||void 0}))})}),r.jsx(de,{label:j("project.routines.schedule_field"),hint:j("project.routines.schedule_hint"),children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap gap-1",children:[q6.map(ee=>r.jsx("button",{type:"button",onClick:()=>S(ee.value),className:Oe("rounded-md border px-2 py-0.5 text-[11px]",v===ee.value?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:ee.label},ee.value)),r.jsx("button",{type:"button",onClick:()=>S("manual"),className:Oe("rounded-md border px-2 py-0.5 text-[11px]",v==="manual"?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:"Manual"})]}),r.jsx(ke,{value:v,onChange:ee=>S(ee.target.value),placeholder:"every:10m · cron 0 9 * * 1-5 · once:ISO · manual"})]})})]}),r.jsxs("div",{className:"space-y-3",children:[K&&r.jsx(de,{label:j("project.routines.pre_field"),hint:j("project.routines.pre_hint"),children:r.jsx(cn,{rows:2,className:"font-mono text-xs",value:V,onChange:ee=>$(ee.target.value),placeholder:"curl -s https://wttr.in/Bariloche"})}),g==="exec_agent"&&r.jsx(de,{label:j("project.routines.prompt_exec"),children:r.jsx(cn,{rows:4,value:E,onChange:ee=>N(ee.target.value),placeholder:j("project.routines.prompt_exec_ph")})}),g==="super_agent"&&r.jsx(de,{label:j("project.routines.prompt_super"),children:r.jsx(cn,{rows:4,value:E,onChange:ee=>N(ee.target.value),placeholder:j("project.routines.prompt_super_ph")})}),g==="telegram"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:j("project.routines.tg_channel"),children:r.jsx(ke,{value:R,onChange:ee=>T(ee.target.value),placeholder:"default"})}),r.jsx(de,{label:j("project.routines.tg_chat_id"),children:r.jsx(ke,{value:O,onChange:ee=>A(ee.target.value),placeholder:"(usa el del canal)"})})]}),r.jsx(de,{label:j("project.routines.tg_text"),hint:j("project.routines.tg_text_hint"),children:r.jsx(cn,{rows:8,value:z,onChange:ee=>B(ee.target.value),placeholder:"mensaje a enviar"})})]}),g==="shell"&&r.jsx(de,{label:j("project.routines.shell_field"),hint:j("project.routines.shell_hint"),children:r.jsx(cn,{rows:11,className:"font-mono text-xs",value:L,onChange:ee=>D(ee.target.value),placeholder:"cd /repo && git pull && npm test"})}),g==="heartbeat"&&r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:j("project.routines.hb_channel"),children:r.jsx(ke,{value:P,onChange:ee=>H(ee.target.value),placeholder:"heartbeat"})}),r.jsx(de,{label:j("project.routines.hb_message"),children:r.jsx(ke,{value:q,onChange:ee=>Y(ee.target.value),placeholder:"sigo vivo"})})]}),K&&r.jsx(de,{label:j("project.routines.post_field"),hint:j("project.routines.post_hint"),children:r.jsx(cn,{rows:2,className:"font-mono text-xs",value:Z,onChange:ee=>G(ee.target.value),placeholder:'apx telegram send "$APX_LLM_OUTPUT"'})})]})]}),r.jsxs("div",{className:"rounded-lg border border-border bg-muted/10 p-3",children:[r.jsx("div",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:j("project.routines.vars_title")}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:$6.map(ee=>r.jsxs("span",{title:ee.desc,className:"inline-flex items-center gap-1 rounded-md border border-border bg-card px-1.5 py-0.5 font-mono text-[10px]",children:[ee.v,r.jsxs("span",{className:"not-italic text-muted-fg",children:["· ",ee.where]})]},ee.v))})]}),r.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs("div",{className:"mb-2 text-xs font-semibold text-muted-fg",children:[j("project.routines.what_happens")," ",r.jsxs("span",{className:"font-normal text-muted-fg",children:["· ⏱ ",$C(v)]})]}),r.jsx("div",{className:"flex flex-wrap items-stretch gap-2",children:ce.map((ee,Te)=>r.jsxs("div",{className:"flex items-stretch gap-2",children:[r.jsxs("div",{className:Oe("flex max-w-[240px] flex-col gap-1 rounded-lg border px-2.5 py-2",ee.action?"border-emerald-500/40 bg-emerald-500/5":"border-border bg-card"),children:[r.jsxs("div",{className:Oe("flex items-center gap-1.5 text-[11px] font-medium",ee.action?"text-emerald-400":"text-muted-fg"),children:[r.jsx(ee.icon,{size:12})," ",ee.label]}),ee.detail&&r.jsx("div",{className:"line-clamp-2 font-mono text-[10px] text-muted-fg",children:ee.detail})]}),Te<ce.length-1&&r.jsx($w,{size:14,className:"shrink-0 self-center text-muted-fg"})]},ee.id))})]})]})})}function X6({pid:e}){const[n,s]=h.useState("open"),o=at(),l=Qe(`/projects/${e}/tasks?state=${n}`,()=>br.list(e,n),{dedupingInterval:0,revalidateOnFocus:!0}),[c,d]=h.useState(""),[f,p]=h.useState(!1),m=async()=>{if(c.trim()){p(!0);try{await br.add(e,{title:c.trim()}),d(""),o.success(j("project.tasks.created")),l.mutate()}catch(b){o.error(b?.message||j("project.tasks.create_error"))}finally{p(!1)}}},g=async(b,v)=>{try{await b(),o.success(v),l.mutate()}catch(S){o.error(S?.message||j("common.error_generic"))}};return r.jsxs(Ge,{title:j("project.tasks.title"),description:j("project.tasks.subtitle"),action:r.jsx("div",{className:"flex gap-1",children:["open","done","dropped"].map(b=>r.jsx(ge,{size:"sm","data-testid":`task-filter-${b}`,variant:n===b?"primary":"ghost",onClick:()=>s(b),children:b},b))}),children:[r.jsxs("div",{className:"mb-4 flex items-end gap-2",children:[r.jsx(de,{label:j("project.tasks.add_label"),children:r.jsx(ke,{"data-testid":"task-input",placeholder:j("project.tasks.add_placeholder"),value:c,onChange:b=>d(b.target.value),onKeyDown:b=>{b.key==="Enter"&&m()}})}),r.jsxs(ge,{variant:"primary","data-testid":"task-add",onClick:m,loading:f,children:[r.jsx(nn,{size:14})," ",j("project.tasks.add")]})]}),l.isLoading&&r.jsx(nt,{}),!l.isLoading&&(l.data?.length??0)===0&&r.jsxs(pt,{children:[n==="open"?j("project.tasks.empty_open"):j("project.tasks.empty",{state:n})," ",r.jsx("code",{children:'apx task add "…"'})]}),r.jsx("ul",{className:"space-y-2 text-sm","data-testid":"task-list",children:(l.data||[]).map(b=>r.jsxs("li",{"data-testid":`task-${b.id}`,className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"mt-0.5 font-mono text-[10px] text-muted-fg",children:b.id}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium",children:b.title}),r.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[b.tags?.map(v=>r.jsxs(Ve,{children:["#",v]},v)),b.agent&&r.jsxs(Ve,{tone:"info",children:["@",b.agent]}),b.source&&r.jsxs("span",{children:[j("project.tasks.via")," ",b.source]}),b.due&&r.jsxs("span",{children:[j("project.tasks.due")," ",b.due]})]})]}),r.jsxs("div",{className:"flex gap-1",children:[n==="open"&&r.jsxs(r.Fragment,{children:[r.jsx(ge,{size:"sm",variant:"secondary","aria-label":j("project.tasks.aria_done"),"data-testid":`task-done-${b.id}`,onClick:()=>g(()=>br.done(e,b.id),j("project.tasks.done")),children:r.jsx(dc,{size:13})}),r.jsx(ge,{size:"sm",variant:"destructive","aria-label":j("project.tasks.aria_drop"),"data-testid":`task-drop-${b.id}`,onClick:()=>g(()=>br.drop(e,b.id),j("project.tasks.drop")),children:r.jsx(la,{size:13})})]}),n!=="open"&&r.jsx(ge,{size:"sm",variant:"ghost","aria-label":j("project.tasks.aria_reopen"),"data-testid":`task-reopen-${b.id}`,onClick:()=>g(()=>br.reopen(e,b.id),j("project.tasks.reopen")),children:r.jsx(hx,{size:13})})]})]},b.id))})]})}const K6="\\$\\{var\\.([^}\\s]+)\\}";function GC(e="g"){return new RegExp(K6,e)}function FC(e){return GC("").test(e)}function Q6(e){const n=[];let s=0;for(const o of e.matchAll(GC("g"))){const l=o.index??0;l>s&&n.push({type:"text",value:e.slice(s,l)}),n.push({type:"var",value:o[1]}),s=l+o[0].length}return s<e.length&&n.push({type:"text",value:e.slice(s)}),n}function Og(e){let n="";for(const s of Array.from(e.childNodes))if(s.nodeType===Node.TEXT_NODE)n+=s.textContent??"";else if(s instanceof HTMLElement){const o=s.dataset.varName;o?n+=`\${var.${o}}`:s.tagName==="BR"?n+="":n+=s.textContent??""}return n.replace(/[\u200B-\u200F\u202A-\u202E\u2060\uFEFF]/g,"").replace(/\u00A0/g," ")}function ij(e,n){e.replaceChildren();const s=Q6(n);for(const o of s)o.type==="text"?e.appendChild(document.createTextNode(o.value)):e.appendChild(YC(o.value));(s.length===0||s[s.length-1].type==="var")&&e.appendChild(document.createTextNode(""))}function YC(e){const n=document.createElement("span");return n.contentEditable="false",n.dataset.varName=e,n.className="inline-flex items-baseline px-1 rounded bg-primary/10 text-primary font-mono text-[12px] select-none cursor-default whitespace-nowrap",n.textContent=`$${e}`,n.title=`\${var.${e}}`,n}function Z6(e,n){e.deleteContents(),e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const s=window.getSelection();s?.removeAllRanges(),s?.addRange(e)}function W6(e){const n=document.createRange();n.selectNodeContents(e),n.collapse(!1);const s=window.getSelection();s?.removeAllRanges(),s?.addRange(n)}const wb=h.forwardRef(function({value:n,onChange:s,placeholder:o,className:l,varNames:c=[],onCreateVar:d},f){const p=h.useRef(null),m=h.useRef(null),[g,b]=h.useState(!1),[v,S]=h.useState(""),C=h.useRef(n);h.useEffect(()=>{const T=p.current;T&&(n===C.current&&T.childNodes.length>0||(ij(T,n),C.current=n))},[n]);const _=h.useCallback(()=>{const T=p.current;if(!T)return;const O=Og(T);C.current=O,O!==n&&s(O)},[s,n]),w=h.useCallback(()=>{const T=p.current;if(!T)return;const O=Og(T);if(FC(O)&&eL(T)){const A=tL(T);ij(T,O),A!=null&&nL(T,A)}C.current=Og(T),C.current!==n&&s(C.current)},[s,n]),k=h.useCallback(()=>{const T=window.getSelection();if(!T||T.rangeCount===0)return;const O=T.getRangeAt(0),A=p.current;A&&A.contains(O.startContainer)&&(m.current=O.cloneRange())},[]),E=h.useCallback(T=>{if(T.key==="Enter"){T.preventDefault(),T.currentTarget.blur();return}if(T.key==="Backspace"){const O=window.getSelection();if(!O||O.rangeCount===0)return;const A=O.getRangeAt(0);if(!A.collapsed)return;const{startContainer:z,startOffset:B}=A;if(z.nodeType===Node.TEXT_NODE&&B===0){const L=z.previousSibling;if(L instanceof HTMLElement&&L.dataset.varName){T.preventDefault(),L.remove(),_();return}}else if(z===p.current){const L=z.childNodes[B-1];if(L instanceof HTMLElement&&L.dataset.varName){T.preventDefault(),L.remove(),_();return}}}},[_]),N=h.useCallback(T=>{const O=p.current;if(!O)return;const A=m.current;O.focus();let z;A&&O.contains(A.startContainer)?z=A:(z=document.createRange(),z.selectNodeContents(O),z.collapse(!1)),Z6(z,YC(T)),m.current=null,_()},[_]);h.useImperativeHandle(f,()=>({insertVar:N,focus:()=>p.current?.focus()}),[N]);const R=c.filter(T=>T.toLowerCase().includes(v.toLowerCase()));return r.jsxs("div",{className:Oe("group flex items-stretch w-full min-w-0 rounded-lg border border-input bg-transparent dark:bg-input/30 transition-colors","focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50",l),children:[r.jsxs("div",{className:"relative flex-1 min-w-0",children:[r.jsx("div",{ref:p,role:"textbox",contentEditable:!0,suppressContentEditableWarning:!0,onInput:w,onKeyDown:E,onBlur:_,onFocus:k,onMouseUp:k,onKeyUp:k,className:Oe("h-8 w-full whitespace-nowrap overflow-x-auto px-2.5 py-1 text-sm rounded-l-lg","focus:outline-none font-mono leading-7","[&_*]:align-baseline"),"data-placeholder":o||"",style:{caretColor:"currentColor"}}),n===""&&o&&r.jsx("span",{className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 select-none text-sm text-muted-foreground font-mono",children:o})]}),r.jsxs("div",{className:"relative flex",children:[r.jsx("button",{type:"button",onMouseDown:T=>{T.preventDefault(),k()},onClick:()=>b(T=>!T),"aria-label":j("chat_ui.insert_variable"),title:j("chat_ui.insert_variable"),className:Oe("flex items-center justify-center px-2 min-w-8 border-l border-input text-muted-foreground rounded-r-lg","hover:bg-muted/60 hover:text-foreground transition-colors",g&&"bg-muted/60 text-foreground"),children:r.jsx(nn,{size:14})}),g&&r.jsx(J6,{query:v,onQuery:S,varNames:R,onPick:T=>{N(T),b(!1),S("")},onClose:()=>{b(!1),S("")},onCreateVar:d})]})]})});function J6({query:e,onQuery:n,varNames:s,onPick:o,onClose:l,onCreateVar:c}){const d=h.useRef(null),f=h.useRef(null);return h.useEffect(()=>{f.current?.focus({preventScroll:!0})},[]),h.useEffect(()=>{function p(m){d.current&&!d.current.contains(m.target)&&l()}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[l]),r.jsxs("div",{ref:d,className:"absolute right-0 top-full z-50 mt-1 w-64 rounded-md border border-border bg-popover shadow-lg",children:[r.jsx("div",{className:"border-b border-border p-2",children:r.jsx("input",{ref:f,value:e,onChange:p=>n(p.target.value),placeholder:"buscar variable…",className:"w-full rounded bg-muted/40 px-2 py-1 text-xs font-mono outline-none"})}),r.jsxs("ul",{className:"max-h-44 overflow-auto p-1 text-xs",children:[s.length===0&&r.jsx("li",{className:"px-2 py-1.5 text-muted-foreground",children:"sin coincidencias"}),s.map(p=>r.jsx("li",{children:r.jsx("button",{type:"button",onMouseDown:m=>m.preventDefault(),onClick:()=>o(p),className:"block w-full rounded px-2 py-1.5 text-left font-mono hover:bg-muted/60",children:p})},p))]}),c&&r.jsx("div",{className:"border-t border-border p-1",children:r.jsxs("button",{type:"button",onMouseDown:p=>p.preventDefault(),onClick:()=>{c(),l()},className:"flex w-full items-center gap-1 rounded px-2 py-1.5 text-left text-xs hover:bg-muted/60",children:[r.jsx(nn,{size:12})," Crear nueva variable…"]})})]})}function eL(e){for(const n of Array.from(e.childNodes))if(n.nodeType===Node.TEXT_NODE&&FC(n.textContent??""))return!0;return!1}function tL(e){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const s=n.getRangeAt(0);if(!e.contains(s.startContainer))return null;const o=s.cloneRange();return o.selectNodeContents(e),o.setEnd(s.startContainer,s.startOffset),o.toString().length}function nL(e,n){const s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=n,l=s.nextNode();for(;l;){const c=(l.textContent??"").length;if(o<=c){const d=document.createRange();d.setStart(l,o),d.collapse(!0);const f=window.getSelection();f?.removeAllRanges(),f?.addRange(d);return}o-=c,l=s.nextNode()}W6(e)}function cj(e){return e?Object.entries(e).map(([n,s])=>({key:n,value:String(s)})):[]}function uj(e){const n={};for(const s of e)s.key.trim()&&(n[s.key.trim()]=s.value);return n}function dj({rows:e,onChange:n,keyPlaceholder:s="KEY",valuePlaceholder:o="value",varNames:l,onCreateVar:c,emptyLabel:d}){const f=(g,b)=>{const v=e.slice();v[g]={...v[g],...b},n(v)},p=g=>n(e.filter((b,v)=>v!==g)),m=()=>n([...e,{key:"",value:""}]);return r.jsxs("div",{className:"space-y-2",children:[e.length===0&&d&&r.jsx("p",{className:"text-[11px] text-muted-foreground",children:d}),e.map((g,b)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(ke,{value:g.key,onChange:v=>f(b,{key:v.target.value}),placeholder:s,className:"w-40 font-mono text-xs"}),r.jsx("div",{className:"flex-1",children:r.jsx(wb,{value:g.value,onChange:v=>f(b,{value:v}),placeholder:o,varNames:l,onCreateVar:c})}),r.jsx(ge,{type:"button",size:"sm",variant:"ghost",onClick:()=>p(b),"aria-label":"quitar fila",children:r.jsx(la,{size:13})})]},b)),r.jsxs(ge,{type:"button",size:"sm",variant:"ghost",onClick:m,children:[r.jsx(nn,{size:12})," Agregar fila"]})]})}const aL={apc:"Shared",runtime:"Runtime",global:"Global"},sL={apc:"info",runtime:"success",global:"muted"};function Gh(e){return e==="runtime"?"runtime":e==="global"?"global":"shared"}function rL(e){return aL[e]??e}function oL({pid:e}){const n=at(),s=Qe(`/projects/${e}/mcps`,()=>vr.list(e)),o=Qe(`/projects/${e}/mcps/check`,()=>vr.check(e)),l=Qe(`/projects/${e}/vars`,()=>yc.list(e)),[c,d]=h.useState(null),[f,p]=h.useState(null),[m,g]=h.useState(null),b=h.useMemo(()=>l.data?Object.keys(l.data.effective).sort():[],[l.data]),v=async(_,w)=>{if(confirm(j("project.mcps.delete_confirm",{name:_,scope:w})))try{await vr.remove(e,_,w),n.success(j("project.mcps.removed")),s.mutate(),f===_&&p(null)}catch(k){n.error(k?.message||j("common.error_generic"))}},S=async _=>{try{await vr.add(e,Gh(_.source),{name:_.name,enabled:!_.enabled}),s.mutate()}catch(w){n.error(w?.message||j("common.error_generic"))}},C=async _=>{p(_),g({name:_,busy:!0});try{const w=await vr.test(e,_);g({name:_,result:w})}catch(w){g({name:_,result:{ok:!1,error:w?.message||"error"}})}};return r.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-4",children:[r.jsx("div",{className:"lg:col-span-3",children:r.jsxs(Ge,{title:j("project.mcps.title"),description:j("project.mcps.subtitle"),action:r.jsxs(ge,{size:"sm",variant:"primary",onClick:()=>d({kind:"new"}),children:[r.jsx(nn,{size:14})," ",j("project.mcps.new")]}),children:[o.data?.conflicts?.length?r.jsx("div",{className:"mb-3 rounded-md border border-amber-500/40 bg-amber-500/10 p-2 text-xs",children:j("project.mcps.conflicts",{names:o.data.conflicts.map(_=>_.name).join(", ")})}):null,s.isLoading&&r.jsx(nt,{}),!s.isLoading&&(s.data?.length??0)===0&&r.jsx(pt,{children:j("project.mcps.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:(s.data||[]).map(_=>{const w=_.source==="apc"||_.source==="runtime"||_.source==="global",k=Gh(_.source),E=f===_.name;return r.jsxs("li",{className:"rounded-md border px-3 py-2 transition-colors "+(E?"border-primary/50 bg-primary/5":"border-border bg-muted/30 hover:bg-muted/50"),onClick:()=>p(_.name),role:"button",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx("span",{className:"font-medium",children:_.name}),r.jsx(Ve,{tone:sL[_.source]??"muted",children:rL(_.source)}),r.jsx("span",{className:"ml-auto text-xs text-muted-fg",children:(_.transport||"stdio").toUpperCase()}),r.jsx("div",{onClick:N=>N.stopPropagation(),children:r.jsx(Zt,{checked:_.enabled!==!1,onChange:()=>S(_),label:""})}),r.jsx(ge,{size:"sm",variant:"ghost",onClick:N=>{N.stopPropagation(),C(_.name)},"aria-label":j("project.mcps.test_btn"),title:j("project.mcps.test_btn"),children:r.jsx(Xw,{size:13})}),r.jsx(ge,{size:"sm",variant:"ghost",onClick:N=>{N.stopPropagation(),p(_.name)},"aria-label":j("project.mcps.logs_btn"),title:j("project.mcps.logs_btn"),children:r.jsx(Dd,{size:13})}),w&&r.jsx(ge,{size:"sm",variant:"ghost",onClick:N=>{N.stopPropagation(),d({kind:"edit",entry:_})},"aria-label":j("project.mcps.edit_btn"),title:j("project.mcps.edit_btn"),children:r.jsx(zl,{size:13})}),w&&r.jsx(ge,{size:"sm",variant:"destructive",onClick:N=>{N.stopPropagation(),v(_.name,k)},children:r.jsx(la,{size:13})})]}),m?.name===_.name&&r.jsx(lL,{result:m.result,busy:!!m.busy,onClose:()=>g(null)})]},`${_.source}-${_.name}`)})}),c&&r.jsx(cL,{mode:c,pid:e,varNames:b,onClose:()=>d(null),onSaved:()=>{d(null),s.mutate()},onVarsChanged:()=>l.mutate()})]})}),r.jsx("div",{className:"lg:col-span-1",children:r.jsx(iL,{pid:e,mcpName:f,runningTest:!!m?.busy})})]})}function lL({result:e,busy:n,onClose:s}){return r.jsxs("div",{className:"mt-2 rounded border border-border/60 bg-background/40 p-2 text-xs",children:[r.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[n&&r.jsx("span",{className:"text-muted-fg",children:j("project.mcps.testing")}),!n&&e?.ok&&r.jsxs("span",{className:"flex items-center gap-1 text-emerald-400",children:[r.jsx(ux,{size:12})," ",j("project.mcps.test_ok",{n:String(e.tool_count??0)})]}),!n&&e&&!e.ok&&r.jsxs("span",{className:"flex items-center gap-1 text-red-400",children:[r.jsx(zT,{size:12})," ",e.error]}),r.jsx("button",{className:"ml-auto text-muted-fg hover:text-fg",onClick:s,children:"×"})]}),!n&&e?.ok&&e.tools&&e.tools.length>0&&r.jsxs("ul",{className:"space-y-0.5 font-mono",children:[e.tools.slice(0,10).map(o=>r.jsxs("li",{className:"truncate",children:[r.jsx("span",{className:"text-primary",children:o.name}),o.description&&r.jsxs("span",{className:"ml-2 text-muted-fg",children:["— ",o.description]})]},o.name)),e.tools.length>10&&r.jsxs("li",{className:"text-muted-fg",children:["… +",e.tools.length-10]})]})]})}function iL({pid:e,mcpName:n,runningTest:s}){const[o,l]=h.useState(null),[c,d]=h.useState(null),f=h.useRef(null);h.useEffect(()=>{if(!n){l(null),d(null);return}f.current!==n&&(l(null),d(null),f.current=n);let m=!1;const g=async()=>{try{const S=await vr.logs(e,n);m||(l(S),d(null))}catch(S){m||d(S?.message||"error")}};g();const v=setInterval(g,s?1200:4e3);return()=>{m=!0,clearInterval(v)}},[e,n,s]);const p=h.useRef(null);return h.useEffect(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[o?.events?.length,o?.stderr_tail]),r.jsxs("div",{className:"sticky top-3 flex h-[calc(100vh-7rem)] min-h-[24rem] flex-col rounded-xl border border-border bg-card",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2 text-xs",children:[r.jsx(kr,{size:13,className:"text-muted-fg"}),r.jsx("span",{className:"font-medium",children:j("project.mcps.logs_panel_title")}),n?r.jsx(Ve,{tone:"info",children:n}):r.jsxs("span",{className:"text-muted-fg",children:["— ",j("project.mcps.logs_panel_pick")]})]}),r.jsxs("div",{ref:p,className:"flex-1 overflow-auto bg-background/60 px-3 py-2 font-mono text-[11px]",children:[!n&&r.jsx("p",{className:"text-muted-fg",children:j("project.mcps.logs_panel_hint")}),n&&c&&r.jsx("p",{className:"text-red-400",children:c}),n&&!c&&o&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"mb-2 text-muted-fg",children:[o.transport.toUpperCase(),o.url?` · ${o.url}`:o.command?` · ${o.command}`:"",o.last_error?` · last_error: ${o.last_error}`:""]}),o.note&&r.jsx("p",{className:"text-muted-fg",children:o.note}),(!o.events||o.events.length===0)&&!o.stderr_tail&&!o.note&&r.jsx("p",{className:"text-muted-fg",children:j("project.mcps.logs_panel_idle")}),o.events?.map((m,g)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:m.ts.slice(11,19)}),r.jsx("span",{className:m.level==="error"?"text-red-400":m.level==="stderr"?"text-amber-400":"text-emerald-400",children:m.level}),r.jsx("span",{className:"flex-1 break-all",children:m.msg})]},g)),o.stderr_tail&&r.jsxs("div",{className:"mt-2 border-t border-border/60 pt-2",children:[r.jsx("div",{className:"mb-1 text-muted-fg",children:"stderr"}),r.jsx("pre",{className:"whitespace-pre-wrap break-all text-amber-300/80",children:o.stderr_tail})]})]})]})]})}function cL({mode:e,pid:n,varNames:s,onClose:o,onSaved:l,onVarsChanged:c}){const d=at(),f=e.kind==="edit",p=f?e.entry:null,[m,g]=h.useState(!1),[b,v]=h.useState(p?Gh(p.source):"runtime"),[S,C]=h.useState(p?.name||""),[_,w]=h.useState(p?.transport==="http"||p?.url?"http":"stdio"),[k,E]=h.useState(p?.command||""),[N,R]=h.useState(p?.args&&p.args.length?p.args:[""]),[T,O]=h.useState(cj(p?.env)),[A,z]=h.useState(p?.url||""),[B,L]=h.useState(cj(p?.headers)),[D,P]=h.useState(p?.enabled!==!1),[H,q]=h.useState(!1),Y=async()=>{if(!S.trim()){d.error(j("project.mcps.name_required"));return}g(!0);try{const V=N.map(Z=>Z.trim()).filter(Boolean),$=_==="stdio"?{name:S.trim(),command:k.trim(),args:V.length?V:void 0,env:T.length?uj(T):void 0,enabled:D}:{name:S.trim(),url:A.trim(),headers:B.length?uj(B):void 0,enabled:D};await vr.add(n,b,$),d.success(j(f?"project.mcps.updated":"project.mcps.added")),l()}catch(V){d.error(V?.message||j("common.error_generic"))}finally{g(!1)}};return r.jsxs(r.Fragment,{children:[r.jsx(Vn,{open:!0,onClose:()=>m?null:o(),title:j(f?"project.mcps.edit_title":"project.mcps.new_title"),description:f?p?.name:j("project.mcps.new_desc"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:o,disabled:m,children:j("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:Y,loading:m,children:j(f?"project.mcps.save_btn":"project.mcps.add_btn")})]}),children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:j("project.mcps.scope_label"),children:r.jsx(wt,{value:b,onChange:V=>v(V),options:[{value:"runtime",label:j("project.mcps.scope_runtime"),description:j("project.mcps.scope_runtime_desc")},{value:"shared",label:j("project.mcps.scope_shared"),description:j("project.mcps.scope_shared_desc")},{value:"global",label:j("project.mcps.scope_global"),description:j("project.mcps.scope_global_desc")}]})}),r.jsx(de,{label:j("project.mcps.transport_label"),children:r.jsx(wt,{value:_,onChange:V=>w(V),options:[{value:"stdio",label:j("project.mcps.transport_stdio"),description:j("project.mcps.transport_stdio_desc")},{value:"http",label:j("project.mcps.transport_http"),description:j("project.mcps.transport_http_desc")}]})})]}),r.jsx(de,{label:j("project.mcps.name_label"),children:r.jsx(ke,{value:S,onChange:V=>C(V.target.value),placeholder:j("project.mcps.name_ph"),disabled:f})}),_==="stdio"?r.jsxs(r.Fragment,{children:[r.jsx(de,{label:j("project.mcps.cmd_label"),children:r.jsx(ke,{value:k,onChange:V=>E(V.target.value),placeholder:j("project.mcps.cmd_ph")})}),r.jsx(de,{label:j("project.mcps.args_label"),hint:j("project.mcps.args_hint_tokens"),children:r.jsx(uL,{args:N,onChange:R,varNames:s,onCreateVar:()=>q(!0)})}),r.jsx(de,{label:j("project.mcps.env_label"),hint:j("project.mcps.env_hint_tokens"),children:r.jsx(dj,{rows:T,onChange:O,keyPlaceholder:"API_KEY",valuePlaceholder:"${var.MY_TOKEN}",varNames:s,onCreateVar:()=>q(!0),emptyLabel:j("project.mcps.env_empty")})})]}):r.jsxs(r.Fragment,{children:[r.jsx(de,{label:j("project.mcps.url_label"),children:r.jsx(wb,{value:A,onChange:z,placeholder:j("project.mcps.url_ph"),varNames:s,onCreateVar:()=>q(!0)})}),r.jsx(de,{label:j("project.mcps.headers_label"),hint:j("project.mcps.headers_hint"),children:r.jsx(dj,{rows:B,onChange:L,keyPlaceholder:"Authorization",valuePlaceholder:"Bearer ${var.TOKEN}",varNames:s,onCreateVar:()=>q(!0),emptyLabel:j("project.mcps.headers_empty")})})]}),r.jsx(Zt,{checked:D,onChange:P,label:j("project.mcps.enabled_label")})]})}),H&&r.jsx(dL,{pid:n,onClose:()=>q(!1),onCreated:()=>{q(!1),c()}})]})}function uL({args:e,onChange:n,varNames:s,onCreateVar:o}){const l=(f,p)=>{const m=e.slice();m[f]=p,n(m)},c=f=>n(e.filter((p,m)=>m!==f)),d=()=>n([...e,""]);return r.jsxs("div",{className:"space-y-2",children:[e.map((f,p)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("div",{className:"flex-1",children:r.jsx(wb,{value:f,onChange:m=>l(p,m),placeholder:"--flag o valor",varNames:s,onCreateVar:o})}),r.jsx(ge,{type:"button",size:"sm",variant:"ghost",onClick:()=>c(p),"aria-label":"quitar arg",children:r.jsx(la,{size:13})})]},p)),r.jsxs(ge,{type:"button",size:"sm",variant:"ghost",onClick:d,children:[r.jsx(nn,{size:12})," ",j("project.mcps.add_arg")]})]})}function dL({pid:e,onClose:n,onCreated:s}){const o=at(),l=String(e)==="0",[c,d]=h.useState(""),[f,p]=h.useState(""),[m,g]=h.useState(!1),[b,v]=h.useState(l?"global":"project"),S=async()=>{if(!c.trim()){o.error(j("project.vars.name_required"));return}if(!f){o.error(j("project.vars.value_required"));return}g(!0);try{await yc.upsert(e,{name:c.trim(),value:f,scope:b}),o.success(j("project.vars.added")),s()}catch(C){o.error(C?.message||j("common.error_generic"))}finally{g(!1)}};return r.jsx(Vn,{open:!0,onClose:()=>m?null:n(),title:j("project.vars.new_title"),description:j("project.vars.new_desc"),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:n,disabled:m,children:j("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:S,loading:m,children:j("project.vars.add_btn")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:j("project.vars.scope_label"),children:r.jsx(wt,{value:b,onChange:C=>v(C),options:[...l?[]:[{value:"project",label:j("project.vars.scope_project"),description:j("project.vars.scope_project_desc")}],{value:"global",label:j("project.vars.scope_global"),description:j("project.vars.scope_global_desc")}]})}),r.jsx(de,{label:j("project.vars.name_label"),hint:j("project.vars.name_hint"),children:r.jsx(ke,{value:c,onChange:C=>d(C.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",autoFocus:!0})}),r.jsx(de,{label:j("project.vars.value_label"),hint:j("project.vars.value_hint"),children:r.jsx(ke,{type:"password",value:f,onChange:C=>p(C.target.value),className:"font-mono text-xs"})})]})})}function fL({pid:e}){const n=at(),s=String(e)==="0",[o,l]=h.useState(s?"global":"all"),[c,d]=h.useState(!1),f=Qe(`/projects/${e}/vars?reveal=${c?1:0}`,()=>yc.list(e,{reveal:c})),[p,m]=h.useState(null),g=h.useMemo(()=>{if(!f.data)return[];const v=[],S=f.data.project||{},C=f.data.global||{};for(const[_,w]of Object.entries(S))v.push({name:_,scope:"project",masked:w});for(const[_,w]of Object.entries(C))S[_]===void 0&&v.push({name:_,scope:"global",masked:w});return v.filter(_=>o==="all"?!0:_.scope===o).sort((_,w)=>_.name.localeCompare(w.name))},[f.data,o]),b=async(v,S)=>{if(confirm(j("project.vars.delete_confirm",{name:v,scope:S})))try{await yc.remove(e,v,S),n.success(j("project.vars.removed")),f.mutate()}catch(C){n.error(C?.message||j("common.error_generic"))}};return r.jsxs(Ge,{title:j("project.vars.title"),description:j(s?"project.vars.subtitle_base":"project.vars.subtitle_project"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zt,{checked:c,onChange:d,label:j("project.vars.reveal_all")}),r.jsxs(ge,{size:"sm",variant:"primary",onClick:()=>m({}),children:[r.jsx(nn,{size:14})," ",j("project.vars.new")]})]}),children:[!s&&r.jsxs("div",{className:"mb-3 flex items-center gap-2 text-xs",children:[r.jsx("span",{className:"text-muted-fg",children:j("project.vars.filter_label")}),r.jsx(zg,{active:o==="all",onClick:()=>l("all"),children:j("project.vars.filter_all")}),r.jsx(zg,{active:o==="project",onClick:()=>l("project"),children:j("project.vars.filter_project")}),r.jsx(zg,{active:o==="global",onClick:()=>l("global"),children:j("project.vars.filter_global")})]}),f.isLoading&&r.jsx(nt,{}),!f.isLoading&&g.length===0&&r.jsx(pt,{children:j("project.vars.empty")}),g.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:g.map(v=>r.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"font-mono text-xs font-medium",children:v.name}),r.jsx(Ve,{tone:v.scope==="project"?"info":"muted",children:v.scope==="project"?j("project.vars.scope_project"):j("project.vars.scope_global")}),r.jsx("span",{className:"ml-2 font-mono text-xs text-muted-fg",children:v.masked}),r.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[r.jsx(ge,{size:"sm",variant:"ghost",onClick:()=>m({name:v.name,scope:v.scope}),"aria-label":j("project.vars.edit_btn"),children:r.jsx(zl,{size:13})}),!(s&&v.scope==="project")&&r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>b(v.name,v.scope),"aria-label":j("project.vars.delete_btn"),children:r.jsx(la,{size:13})})]})]},`${v.scope}-${v.name}`))}),r.jsx(pL,{open:p!==null,initial:p||void 0,onClose:()=>m(null),pid:e,isBase:s,onSaved:()=>{m(null),f.mutate()}})]})}function zg({active:e,onClick:n,children:s}){return r.jsx("button",{type:"button",onClick:n,className:e?"rounded-full border border-primary/50 bg-primary/10 px-2 py-0.5 text-xs":"rounded-full border border-border bg-muted/30 px-2 py-0.5 text-xs hover:bg-muted/60",children:s})}function pL({open:e,onClose:n,pid:s,isBase:o,initial:l,onSaved:c}){const d=at(),[f,p]=h.useState(!1),[m,g]=h.useState(!1),[b,v]=h.useState(l?.name||""),[S,C]=h.useState(l?.value||""),[_,w]=h.useState(l?.scope||(o?"global":"project")),k=!!l?.name;h.useEffect(()=>{e&&(v(l?.name||""),C(l?.value||""),w(l?.scope||(o?"global":"project")),g(!1))},[e,l?.name,l?.scope,l?.value,o]);const E=async()=>{if(!b.trim()){d.error(j("project.vars.name_required"));return}if(!S){d.error(j("project.vars.value_required"));return}p(!0);try{await yc.upsert(s,{name:b.trim(),value:S,scope:_}),d.success(j(k?"project.vars.updated":"project.vars.added")),c()}catch(N){d.error(N?.message||j("common.error_generic"))}finally{p(!1)}};return r.jsx(Vn,{open:e,onClose:()=>f?null:n(),title:j(k?"project.vars.edit_title":"project.vars.new_title"),description:j("project.vars.new_desc"),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:n,disabled:f,children:j("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:E,loading:f,children:j(k?"project.vars.save_btn":"project.vars.add_btn")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:j("project.vars.scope_label"),children:r.jsx(wt,{value:_,onChange:N=>w(N),options:[...o?[]:[{value:"project",label:j("project.vars.scope_project"),description:j("project.vars.scope_project_desc")}],{value:"global",label:j("project.vars.scope_global"),description:j("project.vars.scope_global_desc")}]})}),r.jsx(de,{label:j("project.vars.name_label"),hint:j("project.vars.name_hint"),children:r.jsx(ke,{value:b,onChange:N=>v(N.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",disabled:k,autoFocus:!k})}),r.jsx(de,{label:j("project.vars.value_label"),hint:j("project.vars.value_hint"),children:r.jsxs("div",{className:"relative",children:[r.jsx(ke,{type:m?"text":"password",value:S,onChange:N=>C(N.target.value),placeholder:k?j("project.vars.value_edit_ph"):"",className:"pr-9 font-mono text-xs",autoFocus:k}),r.jsx("button",{type:"button",onClick:()=>g(N=>!N),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-fg hover:text-fg","aria-label":j(m?"project.vars.hide":"project.vars.reveal"),children:m?r.jsx(VT,{size:14}):r.jsx(lf,{size:14})})]})})]})})}function Sb({value:e,onValueChange:n,onSubmit:s,onStop:o,busy:l=!1,disabled:c=!1,placeholder:d,autoFocus:f,minRows:p=2,maxRows:m=8,footer:g,className:b}){const v=h.useRef(null);h.useLayoutEffect(()=>{const C=v.current;if(!C)return;const _=()=>{C.style.height="auto",C.offsetHeight;const k=parseFloat(getComputedStyle(C).lineHeight)||20,E=k*p,N=k*m;C.style.height=`${Math.min(Math.max(C.scrollHeight,E),N)}px`,C.style.overflowY=C.scrollHeight>N?"auto":"hidden"};_();const w=requestAnimationFrame(_);return()=>cancelAnimationFrame(w)},[e,p,m]);const S=e.trim().length>0&&!c;return r.jsxs("div",{className:Ot("flex flex-col gap-1.5 rounded-2xl border border-border bg-muted/60 p-2 shadow-sm transition-colors","focus-within:border-foreground/25 focus-within:bg-muted",c&&"opacity-60",b),children:[r.jsx("textarea",{ref:v,rows:p,value:e,autoFocus:f,disabled:c,placeholder:d,onChange:C=>n(C.target.value),onKeyDown:C=>{if(C.key==="Enter"&&!C.shiftKey){if(C.preventDefault(),l||!S)return;s()}},className:"w-full resize-none bg-transparent px-2 pt-1 text-sm leading-relaxed outline-none placeholder:text-muted-foreground"}),r.jsxs("div",{className:"flex items-center justify-between gap-2 pl-1",children:[r.jsx("div",{className:"flex min-w-0 items-center gap-2 text-[11px] text-muted-foreground",children:g}),l&&o?r.jsx(mo,{type:"button",size:"icon-sm",variant:"destructive",onClick:o,"aria-label":j("chat_ui.stop"),title:j("chat_ui.stop"),children:r.jsx(nS,{className:"size-3.5",fill:"currentColor"})}):r.jsx(mo,{type:"button",size:"icon-sm",variant:"default",onClick:s,disabled:!S,"aria-label":j("chat_ui.send"),title:j("chat_ui.send"),children:r.jsx(TT,{className:"size-4"})})]})]})}function Cb({value:e,onChange:n,disabled:s}){const[o,l]=h.useState(!1),[c,d]=h.useState(""),[f,p]=h.useState([]),[m,g]=h.useState(!1),b=h.useRef(null);h.useEffect(()=>{if(!o)return;const w=k=>{b.current&&!b.current.contains(k.target)&&l(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),h.useEffect(()=>{if(!o||m)return;let w=!1;return(async()=>{try{const{engines:k}=await Qd.list(),E=await Promise.all(k.map(N=>Qd.models({engine:N}).then(R=>(R.models||[]).map(T=>T.includes(":")?T:`${N}:${T}`)).catch(()=>[])));if(!w){const N=Array.from(new Set(E.flat())).sort();p(N),g(!0)}}catch{w||g(!0)}})(),()=>{w=!0}},[o,m]);const v=c.trim().toLowerCase(),S=v?f.filter(w=>w.toLowerCase().includes(v)):f,C=e||"Auto",_=w=>{n(w),l(!1),d("")};return r.jsxs("div",{ref:b,className:"relative",children:[r.jsxs("button",{type:"button",disabled:s,onClick:()=>l(w=>!w),"data-testid":"chat-model-picker",className:Oe("flex max-w-[200px] items-center gap-1 rounded-md border border-transparent px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors","hover:bg-accent/60 hover:text-foreground",e&&"text-foreground"),title:j("chat_ui.pick_model"),"aria-label":j("chat_ui.pick_model"),children:[r.jsx(tS,{className:"size-3 shrink-0"}),r.jsx("span",{className:"truncate font-mono",children:C}),r.jsx(Tr,{className:"size-3 shrink-0 opacity-60"})]}),o&&r.jsxs("div",{className:"absolute bottom-full left-0 z-50 mb-1.5 w-64 rounded-lg border border-border bg-popover p-1.5 shadow-md ring-1 ring-foreground/10",children:[r.jsx("input",{autoFocus:!0,value:c,placeholder:"filtrar o escribir modelo…",onChange:w=>d(w.target.value),onKeyDown:w=>{w.key==="Enter"&&c.trim()&&_(c.trim())},className:"mb-1 w-full rounded-md border border-border bg-background px-2 py-1 text-xs outline-none focus:border-foreground/30"}),r.jsxs("ul",{className:"max-h-56 overflow-y-auto",children:[r.jsx("li",{children:r.jsxs("button",{type:"button",onMouseDown:w=>{w.preventDefault(),_("")},className:Oe("flex w-full items-center justify-between rounded-md px-2 py-1 text-left text-xs hover:bg-accent hover:text-accent-fg",!e&&"bg-accent/50"),children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(vo,{className:"size-3"})," Auto (router decide)"]}),!e&&r.jsx(dc,{className:"size-3"})]})}),!m&&r.jsx("li",{className:"px-2 py-1 text-[11px] text-muted-fg",children:"cargando modelos…"}),m&&S.length===0&&c.trim()&&r.jsx("li",{children:r.jsxs("button",{type:"button",onMouseDown:w=>{w.preventDefault(),_(c.trim())},className:"w-full rounded-md px-2 py-1 text-left font-mono text-xs hover:bg-accent hover:text-accent-fg",children:["usar “",c.trim(),"”"]})}),S.map(w=>r.jsx("li",{children:r.jsxs("button",{type:"button",onMouseDown:k=>{k.preventDefault(),_(w)},className:Oe("flex w-full items-center justify-between rounded-md px-2 py-1 text-left font-mono text-xs hover:bg-accent hover:text-accent-fg",w===e&&"bg-accent/50"),children:[r.jsx("span",{className:"truncate",children:w}),w===e&&r.jsx(dc,{className:"size-3 shrink-0"})]})},w))]})]})]})}function mL({onSend:e,onStop:n,streaming:s,model:o,onModelChange:l}){const[c,d]=h.useState(""),f=()=>{const p=c.trim();p&&(d(""),e(p))};return r.jsx("div",{className:"border-t border-border bg-card/60 p-3",children:r.jsx(Sb,{value:c,onValueChange:d,onSubmit:f,onStop:n,busy:s,placeholder:j("project.chat.placeholder"),maxRows:12,footer:l?r.jsx(Cb,{value:o||"",onChange:l,disabled:s}):void 0})})}const gL={read_file:{icon:FT,label:"Leer archivo"},write_file:{icon:GT,label:"Escribir archivo"},edit_file:{icon:Od,label:"Editar archivo"},list_files:{icon:Qw,label:"Listar archivos"},search_files:{icon:_d,label:"Buscar en archivos"},search_messages:{icon:_d,label:"Buscar mensajes"},tail_messages:{icon:_d,label:"Últimos mensajes"},run_shell:{icon:kr,label:"Ejecutar shell"},send_telegram:{icon:Ya,label:"Enviar Telegram"},call_agent:{icon:gn,label:"Llamar agente"},call_mcp:{icon:dA,label:"Llamar MCP"},call_runtime:{icon:gn,label:"Llamar runtime"},create_task:{icon:rA,label:"Crear tarea"}},XC=new Set(["write_file","edit_file"]);function hL(e){return gL[e]||{icon:Dl,label:e}}function xL(e,n){if(!n)return"";const s=l=>typeof n[l]=="string"?n[l]:void 0,o=s("path")||s("file")||s("pattern")||s("query")||s("command")||s("slug")||s("name")||s("agent");return o?String(o):""}function fj(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function bL({status:e}){return e==="running"?r.jsx(uf,{className:"size-3 shrink-0 animate-spin text-sky-400"}):e==="error"?r.jsx(vo,{className:"size-3 shrink-0 text-rose-400"}):e==="deduped"?r.jsx(UT,{className:"size-3 shrink-0 text-amber-400"}):r.jsx(dc,{className:"size-3 shrink-0 text-emerald-400"})}function vL({part:e}){const[n,s]=h.useState(!1),{icon:o,label:l}=hL(e.tool),c=xL(e.tool,e.args),d=XC.has(e.tool),f=!!e.args||e.result!==void 0;return r.jsxs("div",{className:Oe("rounded-lg border bg-muted/30 text-[12px]",e.status==="error"?"border-rose-500/30":"border-border"),children:[r.jsxs("button",{type:"button",onClick:()=>f&&s(p=>!p),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left",children:[f?r.jsx(Nc,{className:Oe("size-3 shrink-0 text-muted-foreground transition-transform",n&&"rotate-90")}):r.jsx("span",{className:"size-3 shrink-0"}),r.jsx(o,{className:Oe("size-3.5 shrink-0",d?"text-violet-400":"text-muted-foreground")}),r.jsx("span",{className:"shrink-0 font-medium",children:l}),c&&r.jsx("span",{className:"truncate font-mono text-muted-foreground",children:c}),r.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[e.status==="deduped"&&r.jsx("span",{className:"text-[10px] text-amber-400",children:"dedup"}),r.jsx(bL,{status:e.status})]})]}),n&&f&&r.jsxs("div",{className:"space-y-2 border-t border-border/60 px-2.5 py-2",children:[e.args&&Object.keys(e.args).length>0&&r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:"args"}),r.jsx("pre",{className:"max-h-48 overflow-auto rounded-md bg-background/60 p-2 font-mono text-[11px] leading-relaxed text-foreground",children:fj(e.args)})]}),e.result!==void 0&&r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:"result"}),r.jsx("pre",{className:Oe("max-h-64 overflow-auto rounded-md bg-background/60 p-2 font-mono text-[11px] leading-relaxed",e.status==="error"?"text-rose-300":"text-foreground"),children:fj(e.result)})]})]})]})}function yL(e){const n=e.args;return(n&&Array.isArray(n.questions)?n.questions:[]).map(o=>typeof o=="string"?o:o&&typeof o=="object"&&typeof o.question=="string"?o.question:null).filter(o=>!!o)}function _L({part:e,pending:n}){const s=yL(e),o=j(n?"ask_panel.status_waiting":"ask_panel.status_received");return r.jsxs("div",{className:Oe("rounded-2xl border px-3 py-2 text-sm shadow-sm",n?"rounded-bl-sm border-amber-500/30 bg-amber-500/5 text-foreground":"rounded-bl-sm border-emerald-500/30 bg-emerald-500/5 text-foreground"),"data-testid":"ask-questions-card","data-state":n?"pending":"answered",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[n?r.jsx(uf,{className:"size-3.5 shrink-0 animate-spin text-amber-600 dark:text-amber-400"}):r.jsx(ux,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),r.jsx(Zw,{className:"size-3.5 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"text-[12px] font-medium",children:o}),s.length>1&&r.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[s.length," preguntas"]})]}),s.length>0&&r.jsx("ul",{className:"mt-1.5 space-y-0.5 pl-5 text-[12px] text-muted-foreground",children:s.map((l,c)=>r.jsx("li",{className:"list-disc",children:l},c))})]})}function KC(e){const n=e.split(`
601
+ `),s=[];let o=null;for(const l of n)if(l.startsWith("- "))o&&s.push(o),o={question:l.slice(2),answer:"",skipped:!1};else if(l.startsWith(" → ")&&o){const c=l.slice(4);o.answer=c,o.skipped=c==="(omitido)"}else return null;return o&&s.push(o),s.length>0?s:null}function jL({text:e}){const n=KC(e);return n?r.jsx("div",{className:"flex w-full justify-center",children:r.jsxs("div",{className:"w-full max-w-[85%] rounded-2xl border border-border/70 bg-card/40 px-4 py-3 shadow-sm","data-testid":"ask-answers-card",children:[r.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[r.jsx(Zw,{className:"size-3.5"}),r.jsx("span",{children:j("ask_panel.answers_header")})]}),r.jsx("ul",{className:"space-y-2.5",children:n.map((s,o)=>r.jsxs("li",{className:"space-y-0.5",children:[r.jsx("div",{className:"text-sm font-medium leading-snug text-foreground",children:s.question}),r.jsx("div",{className:Oe("whitespace-pre-wrap text-[13px] leading-snug",s.skipped?"italic text-muted-foreground/70":"text-muted-foreground"),children:s.answer})]},o))})]})}):null}function Fh(e){return e.parts.filter(n=>n.kind==="text").map(n=>n.text).join(`
602
+
603
+ `).trim()}function wL(e){const n=e.args?.questions;if(!Array.isArray(n)||n.length===0)return null;const s=n.map(o=>{if(typeof o=="string")return`- ${o}`;if(!o||typeof o!="object")return null;const l=o;if(typeof l.question!="string")return null;const d=(Array.isArray(l.options)?l.options:[]).map(f=>typeof f=="string"?f:f&&typeof f=="object"&&typeof f.label=="string"?f.label:"").filter(f=>f).join(", ");return d?`- ${l.question} (opciones: ${d})`:`- ${l.question}`}).filter(o=>!!o);return s.length===0?null:`[ask_questions]
604
+ ${s.join(`
605
+ `)}`}function SL(e){const n=[];for(const s of e.parts)if(s.kind==="text"&&s.text)n.push(s.text);else if(s.kind==="tool"&&s.tool==="ask_questions"){const o=wL(s);o&&n.push(o)}return n.join(`
606
+
607
+ `).trim()}const CL=e=>[{kind:"text",text:e}];function kL(e){if(!e||typeof e!="object")return!1;const n=e;return"error"in n&&!!n.error}function kb(e,n){const s=o=>({...e,notes:[...e.notes||[],o]});switch(n.type){case"model_start":return n.model?{...e,model:n.model}:e;case"model_routed":{const o=n.model?{...e,model:n.model}:e;return n.from_fallback?{...o,notes:[...o.notes||[],`routing fell back → ${n.model}`]}:o}case"engine_failed":return s(`engine ${n.model||"?"} failed → ${n.retry_with||"retry"}`);case"model_retry":return s(`retry (${n.reason||"?"})`);case"tools_suppressed":return s(`tools suppressed: ${(n.tools||[]).join(", ")}`);case"skill_inspector":{const o=n.inspector;return!o||!o.loaded?.length&&!o.hinted?.length?e:{...e,inspector:{embedder:o.embedder,loaded:o.loaded||[],hinted:o.hinted||[]}}}case"assistant_text":return n.text?{...e,parts:[...e.parts,{kind:"text",text:n.text}]}:e;case"tool_start":return n.trace?{...e,parts:[...e.parts,{kind:"tool",id:n.trace.id,tool:n.trace.tool,args:n.trace.args,status:"running"}]}:e;case"tool_deduped":return n.trace?{...e,parts:e.parts.map(o=>o.kind==="tool"&&o.id===n.trace.id?{...o,status:"deduped"}:o)}:e;case"tool_result":if(!n.trace)return e;{const o=kL(n.trace.result);return{...e,parts:e.parts.map(l=>l.kind==="tool"&&l.id===n.trace.id?{...l,result:n.trace.result,status:o?"error":l.status==="deduped"?"deduped":"done"}:l)}}case"final":return{...e,pending:!1,usage:n.result?.usage??e.usage,model:e.model??n.result?.name,parts:n.result?.text&&!e.parts.some(o=>o.kind==="text")?[...e.parts,{kind:"text",text:n.result.text}]:e.parts};default:{const o=n.delta||n.content||"";if(!o)return e;const l=[...e.parts],c=l[l.length-1];return c&&c.kind==="text"?l[l.length-1]={...c,text:c.text+o}:l.push({kind:"text",text:o}),{...e,parts:l}}}}function EL(e,n){const[s,o]=h.useState([]),[l,c]=h.useState(!1),[d,f]=h.useState(void 0),p=h.useRef(null),m=h.useRef(void 0),g=h.useCallback(w=>{o(k=>{const E=[...k],N=E[E.length-1];return N&&N.role==="assistant"&&(E[E.length-1]=w(N)),E})},[]),b=h.useCallback(w=>{if(w.type==="error"){n?.(w.error||"stream error");return}g(k=>kb(k,w))},[g,n]),v=h.useCallback(async(w,k={})=>{const E=w.trim();if(!E||l)return;const N=()=>new Date().toISOString(),R=s.map(O=>({role:O.role,content:SL(O)}));if(o(O=>[...O,{role:"user",parts:CL(E),ts:N()},{role:"assistant",parts:[],ts:N(),pending:!0}]),c(!0),k.agentSlug){try{const O=await tn.chat(e,k.agentSlug,{prompt:E,conversation_id:m.current,model:k.model||void 0,channel:"web"});m.current=O.conversation_id,f(O.conversation_id),g(A=>({...A,pending:!1,model:O.engine,parts:[{kind:"text",text:O.text}]}))}catch(O){n?.(O?.message||"fallo"),o(A=>A.filter((z,B)=>B!==A.length-1))}finally{c(!1)}return}const T=new AbortController;p.current=T;try{await q2.stream(e,{prompt:E,previousMessages:R,model:k.model||void 0,channel:"web"},b,T.signal),g(O=>({...O,pending:!1}))}catch(O){T.signal.aborted?g(A=>({...A,pending:!1,parts:[...A.parts,{kind:"text",text:"[detenido]"}]})):(n?.(O?.message||"stream falló"),o(A=>A.filter((z,B)=>B!==A.length-1)))}finally{c(!1),p.current=null}},[e,s,l,b,g,n]),S=h.useCallback(()=>p.current?.abort(),[]),C=h.useCallback(()=>{l||(m.current=void 0,f(void 0),o([]))},[l]),_=h.useCallback(async(w,k)=>{if(!l)try{const N=(await nb.get(e,w,k)).messages.filter(R=>R.role==="user"||R.role==="assistant").map(R=>({role:R.role,parts:[{kind:"text",text:R.content}],ts:R.ts||new Date().toISOString()}));m.current=k,f(k),o(N)}catch(E){n?.(E?.message||"could not load conversation")}},[e,l,n]);return{msgs:s,send:v,stop:S,clear:C,load:_,streaming:l,conversationId:d}}function NL({msg:e,isLast:n,isAskAnswer:s,onCopy:o}){const l=e.role==="user",c=Fh(e),d=e.parts.some(f=>f.kind==="tool");if(l&&s){const f=Fh(e);if(KC(f))return r.jsx(jL,{text:f})}return r.jsxs("div",{className:Oe("group flex items-start gap-2",l?"justify-end":"justify-start"),children:[!l&&r.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:r.jsx(gn,{size:14})}),r.jsxs("div",{className:Oe("flex min-w-0 flex-col gap-1.5",l?"items-end":"w-full max-w-[85%]"),children:[!l&&e.notes&&e.notes.length>0&&r.jsx("div",{className:"flex flex-col gap-0.5",children:e.notes.map((f,p)=>r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-amber-400/80",children:[r.jsx(nA,{size:10})," ",f]},p))}),!l&&e.inspector&&(e.inspector.loaded?.length||e.inspector.hinted?.length)?r.jsxs("div",{className:"flex flex-wrap items-center gap-1 text-[10px] text-sky-400/90",title:`Skill Inspector (${e.inspector.embedder||"RAG"}) eligió estas skills para este turno`,children:[r.jsx(ls,{size:10}),e.inspector.loaded?.map(f=>r.jsx("span",{className:"rounded bg-sky-500/15 px-1 py-0.5 font-mono",children:f},`l-${f}`)),e.inspector.hinted?.map(f=>r.jsxs("span",{className:"rounded border border-sky-500/30 px-1 py-0.5 font-mono opacity-70",children:[f,"?"]},`h-${f}`))]}):null,e.parts.map((f,p)=>f.kind==="tool"?f.tool==="ask_questions"&&!l?r.jsx(_L,{part:f,pending:!!n},`${f.id}-${p}`):r.jsx(vL,{part:f},`${f.id}-${p}`):f.text?r.jsx("div",{className:Oe("whitespace-pre-wrap rounded-2xl px-3 py-2 text-sm leading-relaxed shadow-sm",l?"rounded-br-sm border border-emerald-500/30 bg-emerald-500/10 text-foreground dark:bg-emerald-500/15":"w-full rounded-bl-sm border border-border bg-card text-foreground"),children:f.text},p):null),!l&&e.pending&&e.parts.length===0&&r.jsx("div",{className:"rounded-2xl rounded-bl-sm border border-border bg-card px-3 py-2 text-sm text-muted-foreground",children:"…"}),r.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",children:[r.jsx("span",{children:RL(e.ts)}),!l&&e.model&&r.jsxs("span",{className:"font-mono",children:["· ",e.model]}),!l&&d&&r.jsxs("span",{children:["· ",e.parts.filter(f=>f.kind==="tool").length," tools"]}),o&&c&&r.jsxs("button",{type:"button",onClick:()=>o(c),className:"inline-flex items-center gap-1 hover:text-foreground",title:j("chat_ui.copy"),"aria-label":j("chat_ui.copy"),children:[r.jsx(Md,{size:10})," ",j("chat_ui.copy")]})]})]}),l&&r.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:r.jsx(xx,{size:14})})]})}function RL(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function Eb({msgs:e,onCopy:n}){const s=h.useRef(null);if(h.useEffect(()=>{s.current?.scrollIntoView({behavior:"smooth",block:"end"})},[e]),e.length===0)return r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(pt,{children:j("project.chat.empty")})});const o=e.length-1;return r.jsxs("div",{className:"space-y-4 px-3 py-4",children:[e.map((l,c)=>r.jsx(NL,{msg:l,isLast:c===o,isAskAnswer:TL(e,c),onCopy:n},c)),r.jsx("div",{ref:s})]})}function TL(e,n){const s=e[n];if(!s||s.role!=="user")return!1;const o=e[n-1];if(!o||o.role!=="assistant")return!1;for(let l=o.parts.length-1;l>=0;l--){const c=o.parts[l];if(c.kind==="tool")return c.tool==="ask_questions"}return!1}function AL(e){if(!e)return;const n=e.path??e.file??e.filename;return typeof n=="string"?n:void 0}function QC({msgs:e}){const[n,s]=h.useState(!1),{inTok:o,outTok:l,toolCount:c,changed:d,model:f}=h.useMemo(()=>{let m=0,g=0,b=0,v;const S=new Set,C=[];for(const _ of e)if(_.role==="assistant"){_.usage&&(m+=_.usage.input_tokens||0,g+=_.usage.output_tokens||0),_.model&&(v=_.model);for(const w of _.parts)if(w.kind==="tool"&&(b+=1,XC.has(w.tool)&&w.status!=="error")){const k=AL(w.args);k&&!S.has(k)&&(S.add(k),C.push({path:k,tool:w.tool}))}}return{inTok:m,outTok:g,toolCount:b,changed:C,model:v}},[e]),p=o+l;return p===0&&c===0?null:r.jsxs("div",{className:"shrink-0 border-t border-border bg-card/40 text-[11px]",children:[r.jsxs("button",{type:"button",onClick:()=>d.length>0&&s(m=>!m),className:Oe("flex w-full items-center gap-3 px-4 py-1.5 text-muted-foreground",d.length>0&&"hover:text-foreground"),children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(cf,{size:12})," ",Dg(p)," tok",r.jsxs("span",{className:"text-muted-foreground/60",children:["(",Dg(o),"↑ / ",Dg(l),"↓)"]})]}),c>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Dl,{size:12})," ",c," tools"]}),d.length>0&&r.jsxs("span",{className:"flex items-center gap-1 text-violet-400",children:[r.jsx(Od,{size:12})," ",d.length," archivos"]}),f&&r.jsx("span",{className:"ml-auto font-mono text-muted-foreground/70",children:f}),d.length>0&&r.jsx(Tr,{className:Oe("size-3 shrink-0 transition-transform",n&&"rotate-180")})]}),n&&d.length>0&&r.jsx("ul",{className:"max-h-40 space-y-0.5 overflow-y-auto border-t border-border/60 px-4 py-2",children:d.map(m=>r.jsxs("li",{className:"flex items-center gap-2 font-mono text-[11px]",children:[r.jsx(Od,{size:11,className:"shrink-0 text-violet-400"}),r.jsx("span",{className:"truncate",children:m.path}),r.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-muted-foreground/60",children:m.tool==="write_file"?"write":"edit"})]},m.path))})]})}function Dg(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function dl(){return{picked:new Set,text:"",skipped:!1}}function pj(e,n){const s=[];return e.forEach((o,l)=>{const c=n[l]||dl();if(c.skipped){s.push(`- ${o.question}
608
+ → (omitido)`);return}const d=[];if(o.options&&o.options.length>0){const m=[...c.picked].sort((g,b)=>g-b).map(g=>o.options[g]?.label).filter(Boolean);m.length>0&&d.push(m.join(", "))}const f=c.text.trim();f&&d.push(o.options&&o.options.length>0?`(Otro: ${f})`:f);const p=d.length>0?d.join(" "):"(sin respuesta)";s.push(`- ${o.question}
609
+ → ${p}`)}),s.join(`
610
+ `)}function ZC({turnKey:e,questions:n,onSubmit:s,onDismiss:o,disabled:l}){const c=n.length,[d,f]=h.useState(0),[p,m]=h.useState(()=>n.map(()=>dl()));h.useEffect(()=>{f(0),m(n.map(()=>dl()))},[e,n]);const g=n[d],b=p[d]||dl(),v=!!g?.options&&g.options.length>0,S=!!g?.multiSelect,C=g?.allowText!==!1,_=O=>{m(A=>{const z=[...A],B=z[d]||dl();return z[d]={...B,...O,skipped:!1},z})},w=O=>{m(A=>{const z=[...A],B=z[d]||dl(),L=new Set(B.picked);return S?L.has(O)?L.delete(O):L.add(O):(L.clear(),L.add(O)),z[d]={...B,picked:L,skipped:!1},z})},k=h.useMemo(()=>!0,[]),E=d===c-1,N=()=>f(O=>Math.max(0,O-1)),R=()=>{if(E){s(pj(n,p));return}f(O=>Math.min(c-1,O+1))},T=()=>{if(m(O=>{const A=[...O];return A[d]={picked:new Set,text:"",skipped:!0},A}),E){const O=p.map((A,z)=>z===d?{picked:new Set,text:"",skipped:!0}:A);s(pj(n,O))}else f(O=>Math.min(c-1,O+1))};return h.useEffect(()=>{const O=A=>{if(l)return;const z=A.target?.tagName?.toLowerCase(),B=z==="input"||z==="textarea";if(A.key==="Enter"&&(A.metaKey||A.ctrlKey)){A.preventDefault(),R();return}if(!B&&v&&/^[1-9]$/.test(A.key)){const L=parseInt(A.key,10)-1;L<(g?.options?.length||0)&&(A.preventDefault(),w(L))}};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)}),!g||c===0?null:r.jsxs("div",{className:Oe("mx-3 mb-2 rounded-xl border border-border bg-card/95 shadow-xl backdrop-blur supports-[backdrop-filter]:bg-card/80",l&&"pointer-events-none opacity-60"),"data-testid":"inline-ask-panel",children:[r.jsxs("header",{className:"flex items-start gap-2 border-b border-border px-3 py-2",children:[r.jsxs("span",{className:"mt-0.5 shrink-0 rounded-md bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-mono font-medium text-amber-700 dark:text-amber-300",children:[d+1,"/",c]}),g.header&&r.jsx("span",{className:"mt-0.5 shrink-0 rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:g.header}),r.jsx("p",{className:"min-w-0 flex-1 text-sm font-semibold leading-snug",children:g.question}),o&&r.jsx("button",{type:"button",onClick:o,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground","aria-label":j("common.close"),children:r.jsx(vo,{className:"size-3.5"})})]}),r.jsxs("div",{className:"space-y-1 px-2 py-2",children:[v&&g.options.map((O,A)=>{const z=b.picked.has(A);return r.jsxs("button",{type:"button",onClick:()=>w(A),className:Oe("flex w-full items-start gap-2 rounded-md border border-transparent px-2 py-1.5 text-left transition",z?"border-emerald-500/40 bg-emerald-500/10":"hover:border-border hover:bg-accent/40"),children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-xs font-medium",children:O.label}),O.description&&r.jsx("div",{className:"text-[11px] text-muted-foreground",children:O.description})]}),S?r.jsx("span",{className:Oe("mt-0.5 grid size-4 shrink-0 place-items-center rounded border",z?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-background"),children:z&&r.jsx("span",{className:"text-[10px] leading-none",children:"✓"})}):r.jsx("span",{className:Oe("mt-0.5 grid size-4 shrink-0 place-items-center rounded border font-mono text-[10px]",z?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-muted text-muted-foreground"),children:A+1})]},`${A}:${O.label}`)}),(C||!v)&&r.jsxs("div",{className:"rounded-md border border-transparent px-2 py-1.5 hover:border-border",children:[v&&r.jsx("div",{className:"mb-1 text-xs font-medium",children:j("ask_panel.other")}),r.jsx("input",{type:"text",value:b.text,onChange:O=>_({text:O.target.value}),placeholder:j(v?"ask_panel.other_placeholder":"ask_panel.text_placeholder"),className:"w-full rounded border border-border bg-background px-2 py-1 text-xs outline-none focus:border-emerald-500"})]})]}),r.jsxs("footer",{className:"flex items-center justify-between gap-2 border-t border-border px-3 py-2",children:[r.jsx("button",{type:"button",onClick:N,disabled:d===0,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent disabled:opacity-30",children:j("ask_panel.back")}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:T,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent",children:j("ask_panel.skip")}),r.jsxs("button",{type:"button",onClick:R,disabled:!k,className:"inline-flex items-center gap-1 rounded bg-emerald-500/15 px-2 py-1 text-[11px] font-medium text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300",children:[j(E?"ask_panel.submit":"ask_panel.next"),r.jsx(BT,{className:"size-3 opacity-60"})]})]})]})]})}function ML(e){if(typeof e=="string")return{question:e,options:[],multiSelect:!1,allowText:!0};if(!e||typeof e!="object")return null;const n=e,s=typeof n.question=="string"?n.question:"";if(!s)return null;const l=(Array.isArray(n.options)?n.options:[]).map(c=>{if(typeof c=="string")return{label:c};if(c&&typeof c=="object"&&typeof c.label=="string"){const d=c;return{label:d.label,description:typeof d.description=="string"?d.description:void 0}}return null}).filter(c=>c!==null);return{question:s,header:typeof n.header=="string"?n.header:void 0,options:l,multiSelect:n.multiSelect===!0,allowText:n.allowText!==!1}}function WC(e){if(!e.length)return null;const n=e[e.length-1];if(n.role!=="assistant")return null;let s=null,o=-1;for(let m=n.parts.length-1;m>=0;m--){const g=n.parts[m];if(g.kind==="tool"&&g.tool==="ask_questions"){s=g,o=m;break}}if(!s||o<0)return null;let l=null;if(typeof s.result=="string")try{l=JSON.parse(s.result)}catch{l=null}else s.result&&typeof s.result=="object"&&(l=s.result);const c=[];Array.isArray(s.args?.questions)&&c.push(s.args.questions),l&&Array.isArray(l.questions)&&c.push(l.questions);let d=[];for(const m of c)if(d=m.map(ML).filter(g=>!!g),d.length>0)break;return d.length?{turnKey:`${n.ts||""}#${o}`,questions:d}:null}const Yh={live:{label:"Live",icon:ls,order:0},telegram:{label:"Telegram",icon:Ya,order:1},voice:{label:"Voice",icon:Ww,order:2},desktop:{label:"Desktop",icon:Jw,order:3},web:{label:"Web",icon:mx,order:4},a2a:{label:"Agent ↔ Agent",icon:gn,order:5},schedule:{label:"Schedule",icon:xA,order:6},other:{label:"Other",icon:fx,order:7}};function OL(e){if(!e)return"web";const n=e.toLowerCase();return n==="telegram"?"telegram":n==="voice"||n==="overlay"?"voice":n==="desktop"?"desktop":n==="web"||n==="sidebar"||n==="web-sidebar"?"web":n==="a2a"||n.startsWith("agent")?"a2a":n==="schedule"||n==="cron"||n==="routine"?"schedule":"other"}function zL({pid:e,slug:n,onLoaded:s}){const{data:o}=Qe(`/projects/${e}/agents/${n}/conversations`,()=>nb.list(e,n),{revalidateOnFocus:!1});return h.useEffect(()=>{s(n,o)},[n,o]),null}function DL({pid:e,agents:n,superAgentSlug:s,superAgentLabel:o,selected:l,onSelect:c,onNewChat:d}){const[f,p]=h.useState(""),[m,g]=h.useState(""),[b,v]=h.useState({}),[S,C]=h.useState({}),_=(A,z)=>{z&&C(B=>{const L=B[A];return L&&L.length===z.length&&L===z?B:{...B,[A]:z}})},w=h.useMemo(()=>{const A=[];for(const z of n)for(const B of S[z.slug]||[])A.push({...B,agent_slug:B.agent_slug||z.slug});return A},[n,S]),k=h.useMemo(()=>{const A=f.trim().toLowerCase();return w.filter(z=>!(m&&z.agent_slug!==m||A&&!`${z.title||""} ${z.id} ${z.agent_slug}`.toLowerCase().includes(A)))},[w,f,m]),E=h.useMemo(()=>{const A=new Map;for(const z of k){const B=OL(z.channel),L=A.get(B);L?L.push(z):A.set(B,[z])}return Array.from(A.entries()).map(([z,B])=>({key:z,items:B.sort((L,D)=>new Date(D.started_at||0).getTime()-new Date(L.started_at||0).getTime())})).sort((z,B)=>Yh[z.key].order-Yh[B.key].order)},[k]),N=h.useMemo(()=>{if(m===s)return[{slug:s,label:o}];const A=[];m||A.push({slug:s,label:o});for(const z of n)m&&z.slug!==m||A.push({slug:z.slug,label:z.slug});return A},[n,m,s,o]),R=h.useMemo(()=>[{value:"",label:j("project.chat.list.all_agents")},{value:s,label:o},...n.map(A=>({value:A.slug,label:A.slug}))],[n,s,o]),T=w.length+N.length,O=Object.keys(S).length>0||n.length===0;return r.jsxs("aside",{className:"flex h-full w-72 shrink-0 flex-col border-r border-border bg-card/30",children:[n.map(A=>r.jsx(zL,{pid:e,slug:A.slug,onLoaded:_},A.slug)),r.jsxs("header",{className:"flex h-[57px] shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"truncate text-sm font-semibold",children:j("project.chat.list.title")}),r.jsx("p",{className:"text-[10px] text-muted-fg",children:j("project.chat.list.count",{n:T})})]}),r.jsxs("button",{type:"button",onClick:d,className:"inline-flex items-center gap-1 rounded-md border border-border bg-accent/60 px-2 py-1 text-[11px] font-medium hover:bg-accent",children:[r.jsx(nn,{className:"size-3"})," ",j("project.chat.list.new")]})]}),r.jsxs("div",{className:"space-y-2 border-b border-border p-2",children:[r.jsx(ke,{value:f,onChange:A=>p(A.target.value),placeholder:j("project.chat.list.search")}),r.jsx(wt,{value:m,onChange:g,options:R})]}),r.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-2",children:[!O&&r.jsx("div",{className:"px-2 py-1",children:r.jsx(nt,{})}),N.length>0&&r.jsx(mj,{keyName:"live",count:N.length,collapsed:!!b.live,onToggle:()=>v(A=>({...A,live:!A.live})),children:N.map(A=>{const z=A.slug===s,B=l.kind==="live"&&l.agentSlug===A.slug;return r.jsx(gj,{title:z?A.label:j("project.chat.list.live_with",{slug:A.slug}),subtitle:j("project.chat.list.live_subtitle"),badge:z?"super":A.slug,selected:B,onClick:()=>c({kind:"live",agentSlug:A.slug})},`live-${A.slug}`)})}),E.map(A=>r.jsx(mj,{keyName:A.key,count:A.items.length,collapsed:!!b[A.key],onToggle:()=>v(z=>({...z,[A.key]:!z[A.key]})),children:A.items.map(z=>{const B=l.kind==="conv"&&l.agentSlug===z.agent_slug&&l.convId===z.id;return r.jsx(gj,{title:z.title||z.id,subtitle:[z.agent_slug,`${z.messages??0} msg`].filter(Boolean).join(" · "),badge:z.agent_slug,timeAgo:z.started_at,selected:B,onClick:()=>c({kind:"conv",agentSlug:z.agent_slug,convId:z.id})},`${z.agent_slug}-${z.id}`)})},A.key)),O&&w.length===0&&r.jsx("p",{className:"px-3 py-6 text-center text-xs text-muted-fg",children:j("project.chat.list.empty")})]})]})}function mj({keyName:e,count:n,collapsed:s,onToggle:o,children:l}){const c=Yh[e],d=c.icon;return r.jsxs("section",{className:"space-y-1",children:[r.jsxs("button",{type:"button",onClick:o,className:"flex w-full items-center justify-between rounded-md px-2 py-1 text-muted-fg hover:bg-accent/30",children:[r.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s?r.jsx(Nc,{className:"size-3"}):r.jsx(Tr,{className:"size-3"}),r.jsx(d,{className:"size-3"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",children:c.label})]}),r.jsx("span",{className:"text-[10px]",children:n})]}),!s&&r.jsx("div",{className:"space-y-0.5",children:l})]})}function gj({title:e,subtitle:n,badge:s,timeAgo:o,selected:l,onClick:c}){return r.jsxs("button",{type:"button",onClick:c,className:pc("w-full rounded-md border px-2.5 py-2 text-left transition-colors",l?"border-primary/50 bg-primary/10":"border-transparent hover:border-border hover:bg-accent/40"),children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx("p",{className:pc("truncate text-sm",l?"font-semibold":"font-medium"),children:e}),o&&r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[10px] text-muted-fg",children:[r.jsx(PT,{className:"size-2.5"}),LL(o)]})]}),r.jsxs("div",{className:"mt-0.5 flex items-center justify-between gap-2 text-[10px] text-muted-fg",children:[r.jsx("span",{className:"truncate",children:n}),s&&r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-accent/50 px-1.5 py-0.5",children:[r.jsx(xx,{className:"size-2.5"}),s]})]})]})}function LL(e){if(!e)return"";const n=new Date(e).getTime();if(!Number.isFinite(n))return"";const s=Date.now()-n,o=Math.floor(s/6e4);if(o<1)return"now";if(o<60)return`${o}m`;const l=Math.floor(o/60);return l<24?`${l}h`:`${Math.floor(l/24)}d`}const pd="__super_agent__";function PL({pid:e}){const n=at(),[s]=Uw(),o=Qe(`/projects/${e}/agents`,()=>tn.list(e)),[l,c]=h.useState(!1),[d,f]=h.useState(""),[p,m]=h.useState(null),{msgs:g,send:b,stop:v,clear:S,load:C,streaming:_,conversationId:w}=EL(e,q=>n.error(q)),k=ob(),E=s.get("agent"),[N,R]=h.useState(E?{kind:"live",agentSlug:E}:{kind:"live",agentSlug:pd}),T=o.data||[],O=q=>q===pd,A=h.useMemo(()=>N.kind==="live"?T.find(q=>q.slug===N.agentSlug):T.find(q=>q.slug===N.agentSlug),[T,N]),z=O(N.agentSlug);h.useEffect(()=>{N.kind==="conv"?C(N.agentSlug,N.convId):w&&S()},[N.kind,N.kind==="conv"?N.convId:N.agentSlug]);const B=async q=>{if(z){await b(q,{model:d||void 0});return}A&&await b(q,{model:d||void 0,agentSlug:A.slug})},L=async q=>{try{await navigator.clipboard.writeText(q),n.info(j("project.chat.copied"))}catch{}},D=()=>{R({kind:"live",agentSlug:pd}),S()},P=z?j("project.chat.superagent_title",{persona:k}):N.kind==="conv"?N.convId:j("project.chat.title"),H=z?j("project.chat.superagent_subtitle",{persona:k}):N.kind==="conv"?j("project.chat.loaded_subtitle",{slug:N.agentSlug}):j("project.chat.subtitle");return o.isLoading?r.jsx(nt,{}):r.jsxs("div",{className:"flex h-full overflow-hidden rounded-xl border border-border bg-card/40",children:[r.jsx(DL,{pid:e,agents:T,superAgentSlug:pd,superAgentLabel:`${k} (super-agent)`,selected:N,onSelect:R,onNewChat:D}),r.jsxs("section",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-sm font-semibold",children:P}),r.jsx("p",{className:"truncate text-[11px] text-muted-fg",children:H})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[z?r.jsx(Ve,{tone:"success",children:"super-agent"}):A?.model&&r.jsx(Ve,{tone:"info",children:A.model}),N.kind==="conv"&&r.jsx(Ve,{tone:"info",children:w||"…"}),!T.length&&!z&&r.jsxs(ge,{variant:"primary",size:"sm",onClick:()=>c(!0),children:[r.jsx(nn,{size:14})," ",j("project.chat.create_agent")]}),r.jsxs(ge,{variant:"ghost",size:"sm",disabled:_||g.length===0,onClick:D,children:[r.jsx(la,{size:13})," ",j("project.chat.clear")]})]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:g.length?r.jsx(Eb,{msgs:g,onCopy:L}):r.jsx("div",{className:"flex h-full items-center justify-center p-8",children:r.jsx("p",{className:"text-sm text-muted-fg",children:j("project.chat.empty")})})}),r.jsx(QC,{msgs:g}),(()=>{const q=_?null:WC(g);return!q||q.turnKey===p?null:r.jsx(ZC,{turnKey:q.turnKey,questions:q.questions,onSubmit:Y=>void B(Y),onDismiss:()=>m(q.turnKey),disabled:_})})(),r.jsx(mL,{onSend:B,onStop:v,streaming:_,model:d,onModelChange:f})]}),r.jsx(IL,{open:l,pid:e,onClose:()=>c(!1),onCreated:()=>{c(!1),o.mutate()}})]})}function IL({open:e,onClose:n,onCreated:s,pid:o}){const l=at(),[c,d]=h.useState(""),[f,p]=h.useState("master"),[m,g]=h.useState(""),[b,v]=h.useState(!0),[S,C]=h.useState(!1),_=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(c)){l.error(j("project.agents.slug_invalid"));return}C(!0);try{await tn.create(o,{slug:c,role:f,model:m||void 0,is_master:b}),l.success(j("project.agents.created",{slug:c})),d(""),p("master"),g(""),v(!0),s()}catch(w){l.error(w.message)}finally{C(!1)}};return r.jsx(Vn,{open:e,onClose:n,title:j("project.chat.create_agent_title"),description:j("project.chat.create_agent_desc"),footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:n,disabled:S,children:j("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:_,loading:S,children:j("common.create")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:"slug",children:r.jsx(ke,{autoFocus:!0,value:c,onChange:w=>d(w.target.value),placeholder:"master"})}),r.jsx(de,{label:j("project.chat.role_label"),children:r.jsx(ke,{value:f,onChange:w=>p(w.target.value),placeholder:"master"})}),r.jsx(de,{label:j("project.chat.model_label"),hint:j("project.chat.model_hint"),children:r.jsx(ke,{value:m,onChange:w=>g(w.target.value)})}),r.jsx(Zt,{checked:b,onChange:v,label:j("project.chat.master_label")})]})})}function BL({pid:e}){const n=at(),{project:s}=ab(e),{channels:o,isLoading:l,mutate:c}=pb(),d=String(e),f=s?.name||s?.path?.split("/").pop()||d,p=`proj-${d}`,m=o.find(A=>A.project===d||A.project===f||A.name===p),[g,b]=h.useState(!!m),[v,S]=h.useState(""),[C,_]=h.useState(""),[w,k]=h.useState(""),[E,N]=h.useState(!0),[R,T]=h.useState(!1);if(h.useEffect(()=>{m?(b(!0),S(""),_(m.chat_id||""),k(m.route_to_agent||""),N(m.respond_with_engine??!0)):(b(!1),S(""),_(""),k(""),N(!0))},[m?.name,m?.chat_id,m?.route_to_agent]),l)return r.jsx(nt,{});const O=async()=>{T(!0);try{if(!g){m&&(await An.channels.remove(m.name),n.success(j("project.telegram.cleared"))),await c();return}const A={name:m?.name||p,project:d,chat_id:C,route_to_agent:w,respond_with_engine:E,...v?{bot_token:v}:{}};m?await An.channels.patch(m.name,A):await An.channels.upsert(A),n.success(j("project.telegram.saved")),await c(),S("")}catch(A){n.error(A.message)}finally{T(!1)}};return r.jsx(Ge,{title:j("project.telegram.title"),description:j("project.telegram.subtitle"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Zt,{checked:g,onChange:b,label:j(g?"project.telegram.override_active":"project.telegram.use_default")}),m&&r.jsx(Ve,{tone:"success",children:j("project.telegram.channel_badge",{name:m.name})})]}),g&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:j("project.telegram.bot_token"),hint:m?.bot_token?`${Sr(m.bot_token)} — vacío = mantener`:j("project.telegram.bot_hint_none"),children:r.jsx(ke,{type:"password",value:v,onChange:A=>S(A.target.value),placeholder:m?.bot_token?Sr(m.bot_token):""})}),r.jsx(de,{label:j("project.telegram.chat_id"),children:r.jsx(ke,{value:C,onChange:A=>_(A.target.value)})}),r.jsx(de,{label:j("project.telegram.route_agent"),hint:j("project.telegram.route_hint"),children:r.jsx(ke,{value:w,onChange:A=>k(A.target.value)})})]}),r.jsx(Zt,{checked:E,onChange:N,label:j("project.telegram.respond_engine")})]}),r.jsx("div",{className:"pt-2",children:r.jsx(ge,{variant:"primary",loading:R,onClick:O,children:j("common.save")})}),!g&&!m&&r.jsx(pt,{children:j("project.telegram.no_override")})]})})}function JC({load:e,save:n,rows:s=10,placeholder:o}){const l=at(),[c,d]=h.useState(null),[f,p]=h.useState(""),[m,g]=h.useState(!1);if(h.useEffect(()=>{let S=!0;return e().then(C=>{S&&(d(C),p(C))}).catch(()=>{S&&(d(""),p(""))}),()=>{S=!1}},[e]),c===null)return r.jsx(nt,{});const b=f!==c,v=async()=>{g(!0);try{await n(f),d(f),l.success(j("project.memories.saved"))}catch(S){l.error(S.message)}finally{g(!1)}};return r.jsxs("div",{className:"space-y-2",children:[r.jsx(cn,{rows:s,className:"font-mono text-xs",value:f,onChange:S=>p(S.target.value),placeholder:o}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-[11px] text-muted-fg",children:[f.length," ",j("project.memories.chars")]}),r.jsxs(ge,{size:"sm",variant:"primary",loading:m,disabled:!b,onClick:v,children:[r.jsx(df,{size:12})," ",j("project.memories.save_btn")]})]})]})}function UL({pid:e,agent:n}){const[s,o]=h.useState(!1),l=n.is_master?Bs:gn;return r.jsxs("li",{className:"rounded-xl border border-border bg-muted/30",children:[r.jsxs("button",{type:"button",onClick:()=>o(c=>!c),className:"flex w-full items-center gap-3 px-3 py-2 text-left",children:[s?r.jsx(Tr,{size:14,className:"text-muted-fg"}):r.jsx(Nc,{size:14,className:"text-muted-fg"}),r.jsx(l,{size:14,className:n.is_master?"text-violet-400":"text-muted-fg"}),r.jsx("span",{className:"text-sm font-medium",children:n.slug}),n.role&&r.jsxs("span",{className:"text-xs text-muted-fg",children:["· ",n.role]})]}),s&&r.jsx("div",{className:"border-t border-border p-3",children:r.jsx(JC,{rows:8,load:()=>tn.memory.get(e,n.slug).then(c=>c.body),save:c=>tn.memory.put(e,n.slug,c).then(()=>{})})})]})}function HL({pid:e}){const n=Qe(`/projects/${e}/agents`,()=>tn.list(e));return r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ge,{title:j("project.memories.project_title"),description:j("project.memories.project_desc"),children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"mt-1 flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-sky-600 to-indigo-600",children:r.jsx(Ad,{className:"size-4 text-white"})}),r.jsx("div",{className:"min-w-0 flex-1",children:r.jsx(JC,{rows:12,load:()=>aa.memory.get(e).then(s=>s.body),save:s=>aa.memory.put(e,s).then(()=>{}),placeholder:j("project.memories.project_ph")})})]})}),r.jsxs(Ge,{title:j("project.memories.agents_title"),description:j("project.memories.agents_desc"),children:[n.isLoading&&r.jsx(nt,{}),!n.isLoading&&(n.data?.length??0)===0&&r.jsx(pt,{children:j("project.memories.no_agents")}),r.jsx("ul",{className:"space-y-2",children:(n.data||[]).map(s=>r.jsx(UL,{pid:e,agent:s},s.slug))})]})]})}function VL(e,n){var s,o=1;e==null&&(e=0),n==null&&(n=0);function l(){var c,d=s.length,f,p=0,m=0;for(c=0;c<d;++c)f=s[c],p+=f.x,m+=f.y;for(p=(p/d-e)*o,m=(m/d-n)*o,c=0;c<d;++c)f=s[c],f.x-=p,f.y-=m}return l.initialize=function(c){s=c},l.x=function(c){return arguments.length?(e=+c,l):e},l.y=function(c){return arguments.length?(n=+c,l):n},l.strength=function(c){return arguments.length?(o=+c,l):o},l}function qL(e){const n=+this._x.call(null,e),s=+this._y.call(null,e);return ek(this.cover(n,s),n,s,e)}function ek(e,n,s,o){if(isNaN(n)||isNaN(s))return e;var l,c=e._root,d={data:o},f=e._x0,p=e._y0,m=e._x1,g=e._y1,b,v,S,C,_,w,k,E;if(!c)return e._root=d,e;for(;c.length;)if((_=n>=(b=(f+m)/2))?f=b:m=b,(w=s>=(v=(p+g)/2))?p=v:g=v,l=c,!(c=c[k=w<<1|_]))return l[k]=d,e;if(S=+e._x.call(null,c.data),C=+e._y.call(null,c.data),n===S&&s===C)return d.next=c,l?l[k]=d:e._root=d,e;do l=l?l[k]=new Array(4):e._root=new Array(4),(_=n>=(b=(f+m)/2))?f=b:m=b,(w=s>=(v=(p+g)/2))?p=v:g=v;while((k=w<<1|_)===(E=(C>=v)<<1|S>=b));return l[E]=c,l[k]=d,e}function $L(e){var n,s,o=e.length,l,c,d=new Array(o),f=new Array(o),p=1/0,m=1/0,g=-1/0,b=-1/0;for(s=0;s<o;++s)isNaN(l=+this._x.call(null,n=e[s]))||isNaN(c=+this._y.call(null,n))||(d[s]=l,f[s]=c,l<p&&(p=l),l>g&&(g=l),c<m&&(m=c),c>b&&(b=c));if(p>g||m>b)return this;for(this.cover(p,m).cover(g,b),s=0;s<o;++s)ek(this,d[s],f[s],e[s]);return this}function GL(e,n){if(isNaN(e=+e)||isNaN(n=+n))return this;var s=this._x0,o=this._y0,l=this._x1,c=this._y1;if(isNaN(s))l=(s=Math.floor(e))+1,c=(o=Math.floor(n))+1;else{for(var d=l-s||1,f=this._root,p,m;s>e||e>=l||o>n||n>=c;)switch(m=(n<o)<<1|e<s,p=new Array(4),p[m]=f,f=p,d*=2,m){case 0:l=s+d,c=o+d;break;case 1:s=l-d,c=o+d;break;case 2:l=s+d,o=c-d;break;case 3:s=l-d,o=c-d;break}this._root&&this._root.length&&(this._root=f)}return this._x0=s,this._y0=o,this._x1=l,this._y1=c,this}function FL(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function YL(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Gn(e,n,s,o,l){this.node=e,this.x0=n,this.y0=s,this.x1=o,this.y1=l}function XL(e,n,s){var o,l=this._x0,c=this._y0,d,f,p,m,g=this._x1,b=this._y1,v=[],S=this._root,C,_;for(S&&v.push(new Gn(S,l,c,g,b)),s==null?s=1/0:(l=e-s,c=n-s,g=e+s,b=n+s,s*=s);C=v.pop();)if(!(!(S=C.node)||(d=C.x0)>g||(f=C.y0)>b||(p=C.x1)<l||(m=C.y1)<c))if(S.length){var w=(d+p)/2,k=(f+m)/2;v.push(new Gn(S[3],w,k,p,m),new Gn(S[2],d,k,w,m),new Gn(S[1],w,f,p,k),new Gn(S[0],d,f,w,k)),(_=(n>=k)<<1|e>=w)&&(C=v[v.length-1],v[v.length-1]=v[v.length-1-_],v[v.length-1-_]=C)}else{var E=e-+this._x.call(null,S.data),N=n-+this._y.call(null,S.data),R=E*E+N*N;if(R<s){var T=Math.sqrt(s=R);l=e-T,c=n-T,g=e+T,b=n+T,o=S.data}}return o}function KL(e){if(isNaN(g=+this._x.call(null,e))||isNaN(b=+this._y.call(null,e)))return this;var n,s=this._root,o,l,c,d=this._x0,f=this._y0,p=this._x1,m=this._y1,g,b,v,S,C,_,w,k;if(!s)return this;if(s.length)for(;;){if((C=g>=(v=(d+p)/2))?d=v:p=v,(_=b>=(S=(f+m)/2))?f=S:m=S,n=s,!(s=s[w=_<<1|C]))return this;if(!s.length)break;(n[w+1&3]||n[w+2&3]||n[w+3&3])&&(o=n,k=w)}for(;s.data!==e;)if(l=s,!(s=s.next))return this;return(c=s.next)&&delete s.next,l?(c?l.next=c:delete l.next,this):n?(c?n[w]=c:delete n[w],(s=n[0]||n[1]||n[2]||n[3])&&s===(n[3]||n[2]||n[1]||n[0])&&!s.length&&(o?o[k]=s:this._root=s),this):(this._root=c,this)}function QL(e){for(var n=0,s=e.length;n<s;++n)this.remove(e[n]);return this}function ZL(){return this._root}function WL(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function JL(e){var n=[],s,o=this._root,l,c,d,f,p;for(o&&n.push(new Gn(o,this._x0,this._y0,this._x1,this._y1));s=n.pop();)if(!e(o=s.node,c=s.x0,d=s.y0,f=s.x1,p=s.y1)&&o.length){var m=(c+f)/2,g=(d+p)/2;(l=o[3])&&n.push(new Gn(l,m,g,f,p)),(l=o[2])&&n.push(new Gn(l,c,g,m,p)),(l=o[1])&&n.push(new Gn(l,m,d,f,g)),(l=o[0])&&n.push(new Gn(l,c,d,m,g))}return this}function eP(e){var n=[],s=[],o;for(this._root&&n.push(new Gn(this._root,this._x0,this._y0,this._x1,this._y1));o=n.pop();){var l=o.node;if(l.length){var c,d=o.x0,f=o.y0,p=o.x1,m=o.y1,g=(d+p)/2,b=(f+m)/2;(c=l[0])&&n.push(new Gn(c,d,f,g,b)),(c=l[1])&&n.push(new Gn(c,g,f,p,b)),(c=l[2])&&n.push(new Gn(c,d,b,g,m)),(c=l[3])&&n.push(new Gn(c,g,b,p,m))}s.push(o)}for(;o=s.pop();)e(o.node,o.x0,o.y0,o.x1,o.y1);return this}function tP(e){return e[0]}function nP(e){return arguments.length?(this._x=e,this):this._x}function aP(e){return e[1]}function sP(e){return arguments.length?(this._y=e,this):this._y}function Nb(e,n,s){var o=new Rb(n??tP,s??aP,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function Rb(e,n,s,o,l,c){this._x=e,this._y=n,this._x0=s,this._y0=o,this._x1=l,this._y1=c,this._root=void 0}function hj(e){for(var n={data:e.data},s=n;e=e.next;)s=s.next={data:e.data};return n}var Xn=Nb.prototype=Rb.prototype;Xn.copy=function(){var e=new Rb(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root,s,o;if(!n)return e;if(!n.length)return e._root=hj(n),e;for(s=[{source:n,target:e._root=new Array(4)}];n=s.pop();)for(var l=0;l<4;++l)(o=n.source[l])&&(o.length?s.push({source:o,target:n.target[l]=new Array(4)}):n.target[l]=hj(o));return e};Xn.add=qL;Xn.addAll=$L;Xn.cover=GL;Xn.data=FL;Xn.extent=YL;Xn.find=XL;Xn.remove=KL;Xn.removeAll=QL;Xn.root=ZL;Xn.size=WL;Xn.visit=JL;Xn.visitAfter=eP;Xn.x=nP;Xn.y=sP;function co(e){return function(){return e}}function _r(e){return(e()-.5)*1e-6}function rP(e){return e.x+e.vx}function oP(e){return e.y+e.vy}function lP(e){var n,s,o,l=1,c=1;typeof e!="function"&&(e=co(e==null?1:+e));function d(){for(var m,g=n.length,b,v,S,C,_,w,k=0;k<c;++k)for(b=Nb(n,rP,oP).visitAfter(f),m=0;m<g;++m)v=n[m],_=s[v.index],w=_*_,S=v.x+v.vx,C=v.y+v.vy,b.visit(E);function E(N,R,T,O,A){var z=N.data,B=N.r,L=_+B;if(z){if(z.index>v.index){var D=S-z.x-z.vx,P=C-z.y-z.vy,H=D*D+P*P;H<L*L&&(D===0&&(D=_r(o),H+=D*D),P===0&&(P=_r(o),H+=P*P),H=(L-(H=Math.sqrt(H)))/H*l,v.vx+=(D*=H)*(L=(B*=B)/(w+B)),v.vy+=(P*=H)*L,z.vx-=D*(L=1-L),z.vy-=P*L)}return}return R>S+L||O<S-L||T>C+L||A<C-L}}function f(m){if(m.data)return m.r=s[m.data.index];for(var g=m.r=0;g<4;++g)m[g]&&m[g].r>m.r&&(m.r=m[g].r)}function p(){if(n){var m,g=n.length,b;for(s=new Array(g),m=0;m<g;++m)b=n[m],s[b.index]=+e(b,m,n)}}return d.initialize=function(m,g){n=m,o=g,p()},d.iterations=function(m){return arguments.length?(c=+m,d):c},d.strength=function(m){return arguments.length?(l=+m,d):l},d.radius=function(m){return arguments.length?(e=typeof m=="function"?m:co(+m),p(),d):e},d}function iP(e){return e.index}function xj(e,n){var s=e.get(n);if(!s)throw new Error("node not found: "+n);return s}function cP(e){var n=iP,s=b,o,l=co(30),c,d,f,p,m,g=1;e==null&&(e=[]);function b(w){return 1/Math.min(f[w.source.index],f[w.target.index])}function v(w){for(var k=0,E=e.length;k<g;++k)for(var N=0,R,T,O,A,z,B,L;N<E;++N)R=e[N],T=R.source,O=R.target,A=O.x+O.vx-T.x-T.vx||_r(m),z=O.y+O.vy-T.y-T.vy||_r(m),B=Math.sqrt(A*A+z*z),B=(B-c[N])/B*w*o[N],A*=B,z*=B,O.vx-=A*(L=p[N]),O.vy-=z*L,T.vx+=A*(L=1-L),T.vy+=z*L}function S(){if(d){var w,k=d.length,E=e.length,N=new Map(d.map((T,O)=>[n(T,O,d),T])),R;for(w=0,f=new Array(k);w<E;++w)R=e[w],R.index=w,typeof R.source!="object"&&(R.source=xj(N,R.source)),typeof R.target!="object"&&(R.target=xj(N,R.target)),f[R.source.index]=(f[R.source.index]||0)+1,f[R.target.index]=(f[R.target.index]||0)+1;for(w=0,p=new Array(E);w<E;++w)R=e[w],p[w]=f[R.source.index]/(f[R.source.index]+f[R.target.index]);o=new Array(E),C(),c=new Array(E),_()}}function C(){if(d)for(var w=0,k=e.length;w<k;++w)o[w]=+s(e[w],w,e)}function _(){if(d)for(var w=0,k=e.length;w<k;++w)c[w]=+l(e[w],w,e)}return v.initialize=function(w,k){d=w,m=k,S()},v.links=function(w){return arguments.length?(e=w,S(),v):e},v.id=function(w){return arguments.length?(n=w,v):n},v.iterations=function(w){return arguments.length?(g=+w,v):g},v.strength=function(w){return arguments.length?(s=typeof w=="function"?w:co(+w),C(),v):s},v.distance=function(w){return arguments.length?(l=typeof w=="function"?w:co(+w),_(),v):l},v}var uP={value:()=>{}};function tk(){for(var e=0,n=arguments.length,s={},o;e<n;++e){if(!(o=arguments[e]+"")||o in s||/[\s.]/.test(o))throw new Error("illegal type: "+o);s[o]=[]}return new Ed(s)}function Ed(e){this._=e}function dP(e,n){return e.trim().split(/^|\s+/).map(function(s){var o="",l=s.indexOf(".");if(l>=0&&(o=s.slice(l+1),s=s.slice(0,l)),s&&!n.hasOwnProperty(s))throw new Error("unknown type: "+s);return{type:s,name:o}})}Ed.prototype=tk.prototype={constructor:Ed,on:function(e,n){var s=this._,o=dP(e+"",s),l,c=-1,d=o.length;if(arguments.length<2){for(;++c<d;)if((l=(e=o[c]).type)&&(l=fP(s[l],e.name)))return l;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++c<d;)if(l=(e=o[c]).type)s[l]=bj(s[l],e.name,n);else if(n==null)for(l in s)s[l]=bj(s[l],e.name,null);return this},copy:function(){var e={},n=this._;for(var s in n)e[s]=n[s].slice();return new Ed(e)},call:function(e,n){if((l=arguments.length-2)>0)for(var s=new Array(l),o=0,l,c;o<l;++o)s[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(c=this._[e],o=0,l=c.length;o<l;++o)c[o].value.apply(n,s)},apply:function(e,n,s){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],l=0,c=o.length;l<c;++l)o[l].value.apply(n,s)}};function fP(e,n){for(var s=0,o=e.length,l;s<o;++s)if((l=e[s]).name===n)return l.value}function bj(e,n,s){for(var o=0,l=e.length;o<l;++o)if(e[o].name===n){e[o]=uP,e=e.slice(0,o).concat(e.slice(o+1));break}return s!=null&&e.push({name:n,value:s}),e}var Rl=0,ec=0,qi=0,nk=1e3,nf,tc,af=0,go=0,Pf=0,jc=typeof performance=="object"&&performance.now?performance:Date,ak=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function sk(){return go||(ak(pP),go=jc.now()+Pf)}function pP(){go=0}function Xh(){this._call=this._time=this._next=null}Xh.prototype=rk.prototype={constructor:Xh,restart:function(e,n,s){if(typeof e!="function")throw new TypeError("callback is not a function");s=(s==null?sk():+s)+(n==null?0:+n),!this._next&&tc!==this&&(tc?tc._next=this:nf=this,tc=this),this._call=e,this._time=s,Kh()},stop:function(){this._call&&(this._call=null,this._time=1/0,Kh())}};function rk(e,n,s){var o=new Xh;return o.restart(e,n,s),o}function mP(){sk(),++Rl;for(var e=nf,n;e;)(n=go-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Rl}function vj(){go=(af=jc.now())+Pf,Rl=ec=0;try{mP()}finally{Rl=0,hP(),go=0}}function gP(){var e=jc.now(),n=e-af;n>nk&&(Pf-=n,af=e)}function hP(){for(var e,n=nf,s,o=1/0;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(s=n._next,n._next=null,n=e?e._next=s:nf=s);tc=e,Kh(o)}function Kh(e){if(!Rl){ec&&(ec=clearTimeout(ec));var n=e-go;n>24?(e<1/0&&(ec=setTimeout(vj,e-jc.now()-Pf)),qi&&(qi=clearInterval(qi))):(qi||(af=jc.now(),qi=setInterval(gP,nk)),Rl=1,ak(vj))}}const xP=1664525,bP=1013904223,yj=4294967296;function vP(){let e=1;return()=>(e=(xP*e+bP)%yj)/yj}function yP(e){return e.x}function _P(e){return e.y}var jP=10,wP=Math.PI*(3-Math.sqrt(5));function SP(e){var n,s=1,o=.001,l=1-Math.pow(o,1/300),c=0,d=.6,f=new Map,p=rk(b),m=tk("tick","end"),g=vP();e==null&&(e=[]);function b(){v(),m.call("tick",n),s<o&&(p.stop(),m.call("end",n))}function v(_){var w,k=e.length,E;_===void 0&&(_=1);for(var N=0;N<_;++N)for(s+=(c-s)*l,f.forEach(function(R){R(s)}),w=0;w<k;++w)E=e[w],E.fx==null?E.x+=E.vx*=d:(E.x=E.fx,E.vx=0),E.fy==null?E.y+=E.vy*=d:(E.y=E.fy,E.vy=0);return n}function S(){for(var _=0,w=e.length,k;_<w;++_){if(k=e[_],k.index=_,k.fx!=null&&(k.x=k.fx),k.fy!=null&&(k.y=k.fy),isNaN(k.x)||isNaN(k.y)){var E=jP*Math.sqrt(.5+_),N=_*wP;k.x=E*Math.cos(N),k.y=E*Math.sin(N)}(isNaN(k.vx)||isNaN(k.vy))&&(k.vx=k.vy=0)}}function C(_){return _.initialize&&_.initialize(e,g),_}return S(),n={tick:v,restart:function(){return p.restart(b),n},stop:function(){return p.stop(),n},nodes:function(_){return arguments.length?(e=_,S(),f.forEach(C),n):e},alpha:function(_){return arguments.length?(s=+_,n):s},alphaMin:function(_){return arguments.length?(o=+_,n):o},alphaDecay:function(_){return arguments.length?(l=+_,n):+l},alphaTarget:function(_){return arguments.length?(c=+_,n):c},velocityDecay:function(_){return arguments.length?(d=1-_,n):1-d},randomSource:function(_){return arguments.length?(g=_,f.forEach(C),n):g},force:function(_,w){return arguments.length>1?(w==null?f.delete(_):f.set(_,C(w)),n):f.get(_)},find:function(_,w,k){var E=0,N=e.length,R,T,O,A,z;for(k==null?k=1/0:k*=k,E=0;E<N;++E)A=e[E],R=_-A.x,T=w-A.y,O=R*R+T*T,O<k&&(z=A,k=O);return z},on:function(_,w){return arguments.length>1?(m.on(_,w),n):m.on(_)}}}function CP(){var e,n,s,o,l=co(-30),c,d=1,f=1/0,p=.81;function m(S){var C,_=e.length,w=Nb(e,yP,_P).visitAfter(b);for(o=S,C=0;C<_;++C)n=e[C],w.visit(v)}function g(){if(e){var S,C=e.length,_;for(c=new Array(C),S=0;S<C;++S)_=e[S],c[_.index]=+l(_,S,e)}}function b(S){var C=0,_,w,k=0,E,N,R;if(S.length){for(E=N=R=0;R<4;++R)(_=S[R])&&(w=Math.abs(_.value))&&(C+=_.value,k+=w,E+=w*_.x,N+=w*_.y);S.x=E/k,S.y=N/k}else{_=S,_.x=_.data.x,_.y=_.data.y;do C+=c[_.data.index];while(_=_.next)}S.value=C}function v(S,C,_,w){if(!S.value)return!0;var k=S.x-n.x,E=S.y-n.y,N=w-C,R=k*k+E*E;if(N*N/p<R)return R<f&&(k===0&&(k=_r(s),R+=k*k),E===0&&(E=_r(s),R+=E*E),R<d&&(R=Math.sqrt(d*R)),n.vx+=k*S.value*o/R,n.vy+=E*S.value*o/R),!0;if(S.length||R>=f)return;(S.data!==n||S.next)&&(k===0&&(k=_r(s),R+=k*k),E===0&&(E=_r(s),R+=E*E),R<d&&(R=Math.sqrt(d*R)));do S.data!==n&&(N=c[S.data.index]*o/R,n.vx+=k*N,n.vy+=E*N);while(S=S.next)}return m.initialize=function(S,C){e=S,s=C,g()},m.strength=function(S){return arguments.length?(l=typeof S=="function"?S:co(+S),g(),m):l},m.distanceMin=function(S){return arguments.length?(d=S*S,m):Math.sqrt(d)},m.distanceMax=function(S){return arguments.length?(f=S*S,m):Math.sqrt(f)},m.theta=function(S){return arguments.length?(p=S*S,m):Math.sqrt(p)},m}const $i={agent:"#a78bfa",memory:"#38bdf8",thread:"#34d399",task:"#fbbf24",routine:"#f472b6",agentlink:"#c084fc"},_j={agent:"agente",memory:"memoria",thread:"thread",task:"task",routine:"rutina",agentlink:"jerarquía"},Gi=760,Fi=460;function kP({center:e,nodes:n}){const s=h.useRef(null),o=h.useRef(null),l=h.useRef([]),c=h.useRef([]),d=h.useRef(null),[,f]=h.useState(0),[p,m]=h.useState(null);h.useEffect(()=>{const w={id:"__center",label:e,kind:"agent",relation:"self",x:Gi/2,y:Fi/2,fx:Gi/2,fy:Fi/2},k=[w,...n.map(R=>({...R}))],E=k.slice(1).map(R=>({source:w,target:R}));l.current=k,c.current=E;const N=SP(k).force("link",cP(E).distance(120).strength(.5)).force("charge",CP().strength(-220)).force("center",VL(Gi/2,Fi/2).strength(.05)).force("collide",lP(26)).on("tick",()=>f(R=>R+1));return o.current=N,()=>{N.stop()}},[e,n]);const g=w=>{const k=s.current.getBoundingClientRect();return{x:(w.clientX-k.left)/k.width*Gi,y:(w.clientY-k.top)/k.height*Fi}},b=w=>k=>{w.id!=="__center"&&(d.current=w,k.target.setPointerCapture?.(k.pointerId),o.current?.alphaTarget(.3).restart())},v=w=>{const k=d.current;if(!k)return;const{x:E,y:N}=g(w);k.fx=E,k.fy=N},S=()=>{const w=d.current;w&&(w.fx=null,w.fy=null),d.current=null,o.current?.alphaTarget(0)},C=l.current,_=c.current;return r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-muted/10",children:r.jsxs("svg",{ref:s,viewBox:`0 0 ${Gi} ${Fi}`,className:"h-[460px] w-full touch-none select-none",onPointerMove:v,onPointerUp:S,onPointerLeave:S,children:[_.map((w,k)=>r.jsx("line",{x1:w.source.x,y1:w.source.y,x2:w.target.x,y2:w.target.y,stroke:$i[w.target.kind],strokeOpacity:.22,strokeWidth:1.5},k)),C.map(w=>{if(w.id==="__center")return r.jsxs("g",{transform:`translate(${w.x},${w.y})`,children:[r.jsx("circle",{r:22,fill:$i.agent}),r.jsx("text",{textAnchor:"middle",y:4,fontSize:11,fontWeight:700,fill:"#1a1a1a",children:e.length>8?e.slice(0,8):e})]},w.id);const k=p?.id===w.id;return r.jsxs("g",{transform:`translate(${w.x},${w.y})`,className:"cursor-grab active:cursor-grabbing",onPointerDown:b(w),onClick:()=>m(w),children:[r.jsx("circle",{r:k?9:6,fill:$i[w.kind],fillOpacity:k?1:.9,stroke:k?"#fff":"none",strokeWidth:k?2:0}),r.jsx("text",{x:10,y:4,fontSize:10,className:"fill-foreground/80",children:w.label.length>22?`${w.label.slice(0,22)}…`:w.label})]},w.id)})]})}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[11px] text-muted-fg",children:[Object.keys(_j).filter(w=>w!=="agent").map(w=>r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx("span",{className:"size-2 rounded-full",style:{background:$i[w]}})," ",_j[w]]},w)),r.jsxs("span",{className:"ml-auto",children:[n.length," nodos · arrastrá para reacomodar"]})]}),p&&r.jsxs("div",{className:"rounded-lg border border-border bg-card p-3 text-xs",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"size-2 rounded-full",style:{background:$i[p.kind]}}),r.jsx("span",{className:"font-medium",children:p.label}),r.jsxs("span",{className:"text-muted-fg",children:["· ",p.relation]})]}),p.detail&&r.jsx("p",{className:"mt-1 whitespace-pre-wrap text-muted-fg",children:p.detail})]})]})}function EP(){return[{key:"overview",label:"Explorer",icon:cf},{key:"memories",label:j("project.nav.memories"),icon:Ad},{key:"records",label:j("project.agent_detail.records_title"),icon:Vw},{key:"sleep",label:j("project.agent_detail.sleep_title"),icon:yl},{key:"brain",label:j("project.agent_detail.brain_title"),icon:ls},{key:"config",label:j("settings.tabs.advanced"),icon:Ld}]}const NP=[{value:"",label:"— sin tipo —"},{value:"orchestrator",label:"Orchestrator",description:"Coordina al equipo y delega."},{value:"specialist",label:"Specialist",description:"Experto en un dominio; ejecuta tareas."},{value:"assistant",label:"Assistant",description:"Ayudante conversacional."},{value:"worker",label:"Worker",description:"Corre tareas autónomas."},{value:"monitor",label:"Monitor",description:"Observa estado y reporta."}],Qh=e=>e.split(",").map(n=>n.trim()).filter(Boolean),RP=(e,n)=>e.filter(s=>s.spec?.agent===n||n==="super-agent"&&s.kind==="super_agent");function TP(e){return e.split(`
611
+ `).map(n=>n.replace(/^[-*#>\s]+/,"").trim()).filter(n=>n.length>2&&!n.startsWith("```")).slice(0,12)}function AP({pid:e}){const{slug:n=""}=Aw(),s=_a(),[o,l]=h.useState("overview"),c=EP(),d=Qe(`/projects/${e}/agents/${n}`,()=>tn.get(e,n)),f=Qe(`/projects/${e}/agents`,()=>tn.list(e)),p=Qe(`/projects/${e}/routines`,()=>xr.list(e)),m=Qe(`/projects/${e}/messages?agent=${n}`,()=>Ph.project(e,{agent:n,limit:200})),g=Qe(`/projects/${e}/agents/${n}/conversations`,()=>nb.list(e,n)),b=Qe(`/projects/${e}/tasks?all`,()=>br.list(e,"all")),v=d.data,S=RP(p.data||[],n),C=(b.data||[]).filter(k=>k.agent===n),_=(f.data||[]).filter(k=>k.parent===n);if(d.isLoading)return r.jsx(nt,{});if(!v)return r.jsx("div",{className:"text-sm text-muted-fg",children:j("project.agent_detail.not_found")});const w=v.is_master?Bs:gn;return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("button",{onClick:()=>s(`/p/${e}/agents`),className:"mt-1 text-muted-fg hover:text-foreground",children:r.jsx(RT,{size:16})}),r.jsx("div",{className:Oe("flex size-11 items-center justify-center rounded-xl bg-gradient-to-br",v.is_master?"from-violet-600 to-indigo-600":"from-slate-600 to-gray-600"),children:r.jsx(w,{className:"size-5 text-white"})}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("h1",{className:"text-lg font-semibold",children:v.slug}),v.is_master&&r.jsxs(Ve,{tone:"success",children:[r.jsx(Bs,{size:10})," ",j("project.agents.orchestrator")]}),v.role&&r.jsx(Ve,{children:v.role}),v.model&&r.jsx(Ve,{tone:"info",children:v.model}),v.parent&&r.jsxs("button",{onClick:()=>s(`/p/${e}/agents/${v.parent}`),className:"text-[11px] text-violet-400 hover:underline",children:[j("project.agent_detail.reports_to")," ",v.parent]})]}),v.description&&r.jsx("p",{className:"mt-0.5 max-w-2xl text-xs text-muted-fg",children:v.description})]})]}),r.jsxs(ge,{size:"sm",variant:"primary",onClick:()=>s(`/p/${e}/chat?agent=${n}`),children:[r.jsx(Ya,{size:13})," ",j("project.agent_detail.chat_btn",{slug:v.slug})]})]}),r.jsx("div",{className:"flex flex-wrap gap-1 border-b border-border",children:c.map(({key:k,label:E,icon:N})=>r.jsxs("button",{onClick:()=>l(k),className:Oe("flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm transition-colors -mb-px",o===k?"border-foreground text-foreground":"border-transparent text-muted-fg hover:text-foreground"),children:[r.jsx(N,{size:14})," ",E]},k))}),o==="overview"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[r.jsx(md,{label:"Threads",value:g.data?.length??0,icon:zd}),r.jsx(md,{label:"Records",value:m.data?.length??0,icon:Vw}),r.jsx(md,{label:"Tasks",value:C.length,icon:cf}),r.jsx(md,{label:"Heartbeats",value:S.length,icon:yl})]}),r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsx(Ge,{title:j("agent_detail_extra.skills_title"),description:"",children:r.jsxs("div",{className:"flex flex-wrap gap-1",children:[v.skills?.map(k=>r.jsxs(Ve,{tone:"info",children:[r.jsx(ls,{size:10})," ",k]},k)),v.tools?.map(k=>r.jsxs(Ve,{children:[r.jsx(Dl,{size:10})," ",k]},k)),!v.skills?.length&&!v.tools?.length&&r.jsx("span",{className:"text-xs text-muted-fg",children:"—"})]})}),r.jsx(Ge,{title:j("project.agent_detail.threads_recent"),description:"",children:r.jsxs("ul",{className:"space-y-1 text-xs",children:[(g.data||[]).slice(0,6).map(k=>r.jsxs("li",{className:"flex items-center justify-between rounded-md bg-muted/30 px-2 py-1",children:[r.jsx("span",{className:"truncate",children:k.title||k.filename}),r.jsxs("span",{className:"shrink-0 text-muted-fg",children:[k.messages??0," ",j("project.agent_detail.msgs_count")]})]},k.id)),!g.data?.length&&r.jsx("li",{className:"text-muted-fg",children:j("project.agent_detail.no_threads")})]})})]}),_.length>0&&r.jsx(Ge,{title:j("project.agent_detail.subagents"),description:j("project.agent_detail.subagents_desc"),children:r.jsx("div",{className:"flex flex-wrap gap-2",children:_.map(k=>r.jsxs("button",{onClick:()=>s(`/p/${e}/agents/${k.slug}`),className:"flex items-center gap-2 rounded-lg border border-border bg-muted/30 px-3 py-1.5 text-sm hover:border-muted-fg/50",children:[r.jsx(gn,{size:14,className:"text-muted-fg"})," ",k.slug]},k.slug))})})]}),o==="memories"&&r.jsx(OP,{pid:e,slug:n,initial:v.memory||"",onSaved:()=>d.mutate()}),o==="records"&&r.jsx(zP,{records:m.data||[],loading:m.isLoading}),o==="sleep"&&r.jsx(DP,{routines:S}),o==="brain"&&r.jsx(PP,{slug:n,memory:v.memory||"",threads:(g.data||[]).map(k=>({id:k.id,label:k.title||k.filename})),tasks:C.map(k=>({id:k.id,label:k.title,detail:k.body||void 0})),routines:S,parent:v.parent||null,children:_.map(k=>k.slug)}),o==="config"&&r.jsx(MP,{pid:e,agent:v,agents:f.data||[],onSaved:()=>{d.mutate(),f.mutate()},onDeleted:()=>{f.mutate(),s(`/p/${e}/agents`)}})]})}function MP({pid:e,agent:n,agents:s,onSaved:o,onDeleted:l}){const c=at(),[d,f]=h.useState(n.type||""),[p,m]=h.useState(n.area||""),[g,b]=h.useState(n.role||""),[v,S]=h.useState(n.model||""),[C,_]=h.useState(n.parent||""),[w,k]=h.useState(!!n.is_master),[E,N]=h.useState((n.skills||[]).join(", ")),[R,T]=h.useState((n.tools||[]).join(", ")),[O,A]=h.useState(n.description||""),[z,B]=h.useState(n.system||""),[L,D]=h.useState(!1),P=async()=>{D(!0);try{await tn.update(e,n.slug,{type:d||null,area:p||null,role:g||null,model:v||null,parent:C||null,is_master:w||d==="orchestrator",skills:Qh(E),tools:Qh(R),description:O||null,system:z}),c.success(j("project.agent_detail.update_success")),o()}catch(q){c.error(q.message)}finally{D(!1)}},H=async()=>{if(confirm(j("project.agent_detail.delete_confirm",{slug:n.slug})))try{await tn.remove(e,n.slug),c.success(j("project.agent_detail.delete_success")),l()}catch(q){c.error(q.message)}};return r.jsx(Ge,{title:j("project.agent_detail.config_title"),description:`.apc/agents/${n.slug}.md — definición (frontmatter + system prompt).`,children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:j("project.agent_detail.type_label"),children:r.jsx(wt,{value:d,onChange:f,options:NP})}),r.jsx(de,{label:j("project.agent_detail.area_label"),hint:j("project.agent_detail.area_hint"),children:r.jsx(ke,{value:p,onChange:q=>m(q.target.value),placeholder:j("project.agent_detail.area_ph")})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:j("project.agent_detail.role_label"),children:r.jsx(ke,{value:g,onChange:q=>b(q.target.value),placeholder:"Operations Lead"})}),r.jsx(de,{label:j("project.agent_detail.parent_label"),children:r.jsx(wt,{value:C,onChange:_,placeholder:j("project.agent_detail.none_parent"),options:[{value:"",label:j("project.agent_detail.none_parent")},...s.filter(q=>q.slug!==n.slug).map(q=>({value:q.slug,label:q.slug}))]})})]}),r.jsx(de,{label:j("project.agent_detail.model_label"),hint:j("project.agent_detail.model_hint"),children:r.jsx(ke,{value:v,onChange:q=>S(q.target.value),placeholder:j("project.agent_detail.model_ph")})}),r.jsx(de,{label:j("project.agent_detail.skills_label"),children:r.jsx(ke,{value:E,onChange:q=>N(q.target.value),placeholder:"skill-a, skill-b"})}),r.jsx(LP,{value:R,onChange:T}),r.jsx(de,{label:j("project.agent_detail.bio_label"),children:r.jsx(cn,{rows:2,value:O,onChange:q=>A(q.target.value)})}),r.jsx(de,{label:j("project.agent_detail.system_label"),hint:j("project.agent_detail.system_hint"),children:r.jsx(cn,{rows:10,className:"font-mono text-xs",value:z,onChange:q=>B(q.target.value),placeholder:"You are…"})}),r.jsx(Zt,{checked:w,onChange:k,label:j("project.agent_detail.master_label")}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border pt-3",children:[r.jsxs(ge,{variant:"destructive",onClick:H,children:[r.jsx(la,{size:13})," ",j("project.agent_detail.delete_btn")]}),r.jsxs(ge,{variant:"primary",loading:L,onClick:P,children:[r.jsx(df,{size:13})," ",j("project.agent_detail.save_btn")]})]})]})})}function md({label:e,value:n,icon:s}){return r.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[r.jsx(s,{size:13})," ",e]}),r.jsx("div",{className:"mt-1 text-2xl font-semibold",children:n})]})}function OP({pid:e,slug:n,initial:s,onSaved:o}){const l=at(),[c,d]=h.useState(s),[f,p]=h.useState(!1);h.useEffect(()=>{d(s)},[s]);const m=c!==s,g=async()=>{p(!0);try{await tn.memory.put(e,n,c),l.success(j("project.agent_detail.memory_saved")),o()}catch(b){l.error(b.message)}finally{p(!1)}};return r.jsxs(Ge,{title:j("project.agent_detail.memory_title"),description:`~/.apx/projects/<id>/agents/${n}/memory.md — hechos durables que el agente recuerda.`,children:[r.jsx(cn,{rows:16,className:"font-mono text-xs",value:c,onChange:b=>d(b.target.value),placeholder:j("project.agent_detail.memory_empty")}),r.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[r.jsxs("span",{className:"text-[11px] text-muted-fg",children:[c.length," ",j("project.memories.chars")]}),r.jsxs(ge,{size:"sm",variant:"primary",loading:f,disabled:!m,onClick:g,children:[r.jsx(df,{size:12})," ",j("project.memories.save_btn")]})]})]})}function zP({records:e,loading:n}){const s=h.useMemo(()=>[...e].sort((o,l)=>(l.ts||"").localeCompare(o.ts||"")),[e]);return r.jsxs(Ge,{title:j("project.agent_detail.records_title"),description:j("project.agent_detail.records_desc"),children:[n&&r.jsx(nt,{}),!n&&s.length===0&&r.jsx("p",{className:"text-xs text-muted-fg",children:j("project.agent_detail.no_activity")}),r.jsx("ul",{className:"space-y-1 text-sm",children:s.map((o,l)=>r.jsxs("li",{className:"flex items-start gap-2 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"mt-0.5 shrink-0",children:o.direction==="in"?r.jsx(qw,{size:13,className:"text-blue-400"}):r.jsx(Gw,{size:13,className:"text-emerald-400"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-fg",children:[r.jsx("span",{className:"font-mono",children:new Date(o.ts).toLocaleString()}),r.jsx(Ve,{tone:"info",children:o.channel}),o.type&&r.jsx(Ve,{children:o.type})]}),o.body&&r.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:o.body.length>400?`${o.body.slice(0,400)}…`:o.body})]})]},`${o.ts}-${l}`))})]})}function DP({routines:e}){return e.length===0?r.jsx(Ge,{title:j("project.agent_detail.sleep_title"),description:j("project.agent_detail.sleep_desc"),children:r.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4 text-sm",children:[r.jsx("div",{className:"font-medium text-amber-400",children:j("project.agent_detail.sleep_deep")}),r.jsx("p",{className:"mt-1 text-xs text-muted-fg",children:j("project.agent_detail.sleep_deep_desc")})]})}):r.jsx(Ge,{title:j("project.agent_detail.sleep_title"),description:j("project.agent_detail.sleep_desc"),children:r.jsx("div",{className:"space-y-3",children:e.map(n=>{const s=n.enabled,o=n.last_status==="error";return r.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:Oe("size-2 rounded-full",o?"bg-destructive":s?"bg-emerald-400":"bg-muted-fg/40")}),r.jsx("span",{className:"text-sm font-medium",children:n.name}),r.jsx(Ve,{tone:s?"success":"muted",children:s?"running":"paused"}),o&&r.jsx(Ve,{tone:"danger",children:"last: error"})]}),r.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-2 text-xs sm:grid-cols-4",children:[r.jsx(gd,{label:"Tick",value:n.schedule}),r.jsx(gd,{label:"Next tick",value:n.next_run_at?new Date(n.next_run_at).toLocaleString():"—"}),r.jsx(gd,{label:"Last tick",value:n.last_run_at?new Date(n.last_run_at).toLocaleString():"—"}),r.jsx(gd,{label:"Last run",value:n.last_status||"—"})]}),n.last_error&&r.jsx("p",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1 text-[11px] text-destructive",children:n.last_error})]},n.name)})})})}function gd({label:e,value:n}){return r.jsxs("div",{className:"rounded-md border border-border bg-card p-2",children:[r.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-fg",children:e}),r.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px]",children:n})]})}function LP({value:e,onChange:n}){const s=Qe("/tools",()=>pO.list()),o=Qh(e),l=s.data||[],c=f=>{const p=new Set(o);p.has(f)?p.delete(f):p.add(f),n([...p].join(", "))},d=o.filter(f=>!l.some(p=>p.name===f));return r.jsxs(de,{label:"Tools",hint:j("project.agent_detail.tools_hint"),children:[r.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[l.map(f=>{const p=o.includes(f.name);return r.jsx("button",{type:"button",title:f.description||f.name,onClick:()=>c(f.name),className:Oe("rounded-md border px-2 py-0.5 font-mono text-[11px] transition-colors",p?"border-emerald-500/50 bg-emerald-500/10 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:f.name},f.name)}),d.map(f=>r.jsxs("button",{type:"button",onClick:()=>c(f),className:"rounded-md border border-sky-500/50 bg-sky-500/10 px-2 py-0.5 font-mono text-[11px] text-sky-400",children:[f," ✕"]},f))]}),r.jsx(ke,{className:"mt-2",value:e,onChange:f=>n(f.target.value),placeholder:j("project.agent_detail.tools_custom_ph")})]})}function PP({slug:e,memory:n,threads:s,tasks:o,routines:l,parent:c,children:d}){const f=h.useMemo(()=>{const p=[];return TP(n).forEach((m,g)=>p.push({id:`m${g}`,label:m,kind:"memory",relation:"knows",detail:m})),s.slice(0,8).forEach(m=>p.push({id:`th-${m.id}`,label:m.label,kind:"thread",relation:"in_thread"})),o.slice(0,8).forEach(m=>p.push({id:`ts-${m.id}`,label:m.label,kind:"task",relation:"handles_task",detail:m.detail})),l.forEach(m=>p.push({id:`rt-${m.name}`,label:m.name,kind:"routine",relation:"ticks",detail:`schedule: ${m.schedule}`})),c&&p.push({id:`p-${c}`,label:c,kind:"agentlink",relation:"reports_to"}),d.forEach(m=>p.push({id:`c-${m}`,label:m,kind:"agentlink",relation:"orchestrates"})),p},[n,s,o,l,c,d]);return r.jsx(Ge,{title:j("project.agent_detail.brain_title"),description:j("project.agent_detail.brain_desc"),children:f.length===0?r.jsx("p",{className:"text-xs text-muted-fg",children:j("project.agent_detail.brain_empty")}):r.jsx(kP,{center:e,nodes:f})})}function IP(){const e=_a(),n=Yn(),{pid:s=""}=Aw(),{project:o}=ab(s),{collapsed:l,toggle:c}=hC(Rn.sidebarCollapsed+".project"),d=String(s)==="0",f=h.useMemo(()=>d?[{title:j("base.nav_general"),items:[{key:"",label:"Dashboard",icon:aA},{key:"workspaces",label:j("base.workspaces_title"),icon:AT},{key:"models",label:j("settings.tabs.engines"),icon:dx},{key:"agent-defaults",label:j("base.defaults_title"),icon:gn}]},{title:j("base.nav_activity"),items:[{key:"chat",label:j("project.nav.chat"),icon:zd},{key:"sessions",label:j("base.sessions_title"),icon:eA},{key:"tasks",label:j("project.nav.tasks"),icon:fc},{key:"logs",label:j("project.nav.logs"),icon:Dd}]},{title:j("base.nav_system"),items:[{key:"agents",label:j("project.nav.agents"),icon:gn},{key:"memories",label:j("project.nav.memories"),icon:Ad},{key:"routines",label:j("project.nav.routines"),icon:yl},{key:"mcps",label:j("project.nav.mcps"),icon:gh},{key:"vars",label:j("project.nav.vars"),icon:mh},{key:"config",label:j("project.nav.config"),icon:Ld}]}]:[{title:j("project.sections.workspace"),items:[{key:"",label:j("project.nav.overview"),icon:Kw},{key:"telegram",label:j("project.nav.telegram"),icon:Ya},{key:"chat",label:j("project.nav.chat"),icon:zd},{key:"agents",label:j("project.nav.agents"),icon:gn},{key:"memories",label:j("project.nav.memories"),icon:Ad}]},{title:j("project.sections.automation"),items:[{key:"routines",label:j("project.nav.routines"),icon:yl},{key:"tasks",label:j("project.nav.tasks"),icon:fc},{key:"mcps",label:j("project.nav.mcps"),icon:gh},{key:"vars",label:j("project.nav.vars"),icon:mh},{key:"logs",label:j("project.nav.logs"),icon:Dd}]},{title:j("project.sections.config"),items:[{key:"config",label:j("project.nav.config"),icon:Ld}]}],[d]),p=n.pathname.replace(`/p/${s}`,"").replace(/^\//,"").split("/")[0];if(!o)return r.jsx("div",{className:"p-8 text-muted-fg",children:j("project.not_found",{pid:s})});const m=g=>{const b=g?`/p/${s}/${g}`:`/p/${s}`;e(b)};return r.jsx(wC,{sections:f,active:p,onChange:m,collapsed:l,onToggleCollapse:c,contentClassName:"w-full space-y-6 p-6 pt-3",testId:`project-tab-${p||"overview"}`,children:r.jsxs(Dw,{children:[r.jsx($t,{index:!0,element:r.jsx(W_,{pid:s})}),r.jsx($t,{path:"workspaces",element:r.jsx(Wz,{})}),r.jsx($t,{path:"models",element:r.jsx(BC,{})}),r.jsx($t,{path:"agent-defaults",element:r.jsx(l6,{})}),r.jsx($t,{path:"sessions",element:r.jsx(d6,{})}),r.jsx($t,{path:"logs",element:r.jsx(QD,{pid:s})}),r.jsx($t,{path:"config",element:r.jsx(M6,{pid:s})}),r.jsx($t,{path:"telegram",element:r.jsx(BL,{pid:s})}),r.jsx($t,{path:"agents",element:r.jsx(P6,{pid:s})}),r.jsx($t,{path:"agents/:slug",element:r.jsx(AP,{pid:s})}),r.jsx($t,{path:"memories",element:r.jsx(HL,{pid:s})}),r.jsx($t,{path:"routines",element:r.jsx(F6,{pid:s})}),r.jsx($t,{path:"tasks",element:d?r.jsx(f6,{}):r.jsx(X6,{pid:s})}),r.jsx($t,{path:"mcps",element:r.jsx(oL,{pid:s})}),r.jsx($t,{path:"vars",element:r.jsx(fL,{pid:s})}),r.jsx($t,{path:"threads",element:r.jsx(GR,{to:`/p/${s}/chat`,replace:!0})}),r.jsx($t,{path:"chat",element:r.jsx(PL,{pid:s})}),r.jsx($t,{path:"*",element:r.jsx(W_,{pid:s})})]})})}const BP=["es","en","pt","fr","it","de"];function UP(){const e=at(),{identity:n,isLoading:s,save:o}=rb(),[l,c]=h.useState({}),[d,f]=h.useState(!1);if(h.useEffect(()=>{c(n)},[n]),s)return r.jsx(nt,{});const p=async()=>{f(!0);try{await o({owner_name:l.owner_name,owner_context:l.owner_context,language:l.language,timezone:l.timezone}),e.success(j("settings.identity.saved"))}catch(m){e.error(m.message)}finally{f(!1)}};return r.jsxs(Ge,{title:j("settings.identity.title"),description:j("settings.identity.subtitle"),children:[n?null:r.jsx(pt,{children:j("common.none_yet")}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:j("settings.identity.owner_name"),children:r.jsx(ke,{value:l.owner_name||"",onChange:m=>c({...l,owner_name:m.target.value})})}),r.jsx(de,{label:j("settings.identity.language"),children:r.jsx(wt,{value:l.language||"es",onChange:m=>c({...l,language:m}),options:BP.map(m=>({value:m,label:m}))})}),r.jsx(de,{label:j("settings.identity.timezone"),hint:"ej. America/Argentina/Buenos_Aires",children:r.jsx(ke,{value:l.timezone||"",onChange:m=>c({...l,timezone:m.target.value})})})]}),r.jsx("div",{className:"mt-3",children:r.jsx(de,{label:j("settings.identity.owner_context"),hint:"Quién sos, en qué trabajás, qué le interesa al agente saber de vos.",children:r.jsx(cn,{rows:3,value:l.owner_context||"",onChange:m=>c({...l,owner_context:m.target.value})})})}),r.jsx("div",{className:"mt-4",children:r.jsx(ge,{variant:"primary",loading:d,onClick:p,children:j("common.save")})})]})}function HP(){const e=at(),n=_a(),{superAgent:s,isLoading:o,mutate:l}=PC(),{patch:c}=Dr(),{identity:d,save:f}=rb(),[p,m]=h.useState(!0),[g,b]=h.useState(""),[v,S]=h.useState(""),[C,_]=h.useState("permiso"),[w,k]=h.useState(!1);if(h.useEffect(()=>{s&&(m(!!s.enabled),b(s.system||""),_(s.permission_mode||"permiso"))},[s]),h.useEffect(()=>{S(d.personality||"")},[d.personality]),o||!s)return r.jsx(nt,{});const E=async()=>{k(!0);try{await c({"super_agent.enabled":p,"super_agent.system":g,"super_agent.permission_mode":C},["super_agent.name"]),await f({personality:v}),e.success(j("settings.super_agent.saved")),l()}catch(N){e.error(N.message)}finally{k(!1)}};return r.jsx(Ge,{title:j("settings.super_agent.title"),description:"Comportamiento del super-agente. El modelo y la cadena de fallback se configuran en el Router de modelos.",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center gap-3",children:r.jsx(Zt,{checked:p,onChange:m,label:"Super-agente habilitado"})}),r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:"Modelo activo (router)"}),r.jsx("div",{className:"truncate font-mono text-xs text-muted-fg",children:s.model||"—"})]}),r.jsxs(ge,{size:"sm",variant:"secondary",onClick:()=>n("/p/0/models"),children:[r.jsx(dx,{size:13})," Configurar en Modelos"]})]}),r.jsx(de,{label:j("settings.super_agent.permission_mode"),children:r.jsx(wt,{value:C,onChange:_,options:bx.map(N=>({value:N,label:N}))})}),r.jsx(de,{label:j("settings.super_agent.personality"),children:r.jsx(cn,{rows:2,value:v,onChange:N=>S(N.target.value)})}),r.jsx(de,{label:j("settings.super_agent.system"),hint:j("settings.super_agent.system_hint"),children:r.jsx(cn,{rows:6,className:"font-mono text-xs",value:g,onChange:N=>b(N.target.value),placeholder:"(Vacío = se usa el prompt base de core/agent/prompts/super-agent-base.md)"})}),r.jsx(ge,{variant:"primary",loading:w,onClick:E,children:j("common.save")})]})})}const Lg={providers:()=>me.get("/embeddings/providers"),test:(e={})=>me.post("/embeddings/test",e),reindex:()=>me.post("/embeddings/reindex",{})},VP=[{value:"auto",label:"Automático (cadena: Ollama → Gemini → OpenAI → offline)"},{value:"ollama",label:"Ollama — local, sin API key (nomic-embed-text)"},{value:"gemini",label:"Gemini — free tier con key (text-embedding-004)"},{value:"openai",label:"OpenAI — text-embedding-3-small (cloud)"},{value:"tf",label:"Offline (term-frequency, sin modelo — degradado)"}],qP=[{value:"chain",label:"Cadena (fallback automático)"},{value:"single",label:"Único (usa solo el elegido)"}],jj=e=>e.startsWith("***");function $P(){const e=at(),{config:n,isLoading:s,patch:o}=Dr(),{data:l,mutate:c}=Qe("/embeddings/providers",()=>Lg.providers()),[d,f]=h.useState(!1),[p,m]=h.useState(null);if(s)return r.jsx(nt,{});const g=n.memory||{},b=g.embeddings||{},v=l?.configured_provider||b.provider||"auto",S=l?.mode||b.mode||"chain",C=l?.engines||[],_=async E=>{f(!0);try{await o(E),await c()}catch(N){e.error(`No se pudo guardar: ${N.message}`)}finally{f(!1)}},w=async()=>{f(!0),m(null);try{const E=await Lg.test({});m(`${E.embedder} · dim ${E.dim} · ${E.ms}ms`),e.success(`Embedding OK con ${E.embedder}`)}catch(E){e.error(`Falló el test: ${E.message}`)}finally{f(!1)}},k=async()=>{f(!0);try{const E=await Lg.reindex();e.success(`Reindexado: ${E.indexed} chunks (limpiados ${E.cleared}).`)}catch(E){e.error(`Falló el reindex: ${E.message}`)}finally{f(!1)}};return r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[r.jsx(Ge,{title:j("memory_panel.embeddings_title"),description:"Modelo que vectoriza el historial de todos los canales para la memoria relevante. Igual que TTS/STT: elegí proveedor y modelo. 'Automático' prueba local primero y cae al offline si no hay nada.",children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:"Proveedor",hint:"Ollama es local y gratis. Gemini/OpenAI usan la API key de su sección en Modelos (o la de acá abajo).",children:r.jsx(wt,{value:v,onChange:E=>_({"memory.embeddings.provider":E}),options:VP,disabled:d,className:"max-w-xl"})}),r.jsx(de,{label:"Modo de selección",hint:"Cadena cae al siguiente si uno falla; Único usa exactamente el proveedor elegido.",children:r.jsx(wt,{value:S,onChange:E=>_({"memory.embeddings.mode":E}),options:qP,disabled:d,className:"max-w-md"})}),r.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:C.map(E=>r.jsxs(Ve,{tone:E.available?"success":"muted",children:[E.id,": ",E.available?"disponible":"no disp."]},E.id))}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[r.jsxs(ge,{variant:"secondary",onClick:w,loading:d,children:[r.jsx(ls,{size:14})," Probar embedding"]}),r.jsxs(ge,{variant:"secondary",onClick:k,loading:d,children:[r.jsx(Yw,{size:14})," Reindexar memoria"]}),p&&r.jsx("span",{className:"text-sm text-muted-foreground",children:p})]})]})}),r.jsxs(Ge,{title:j("memory_panel.ollama_title"),description:"Sin API key. Corre nomic-embed-text en tu Ollama local o cloud.",children:[r.jsx(de,{label:"Modelo",children:r.jsx(ke,{defaultValue:b.ollama?.model||"nomic-embed-text",placeholder:"nomic-embed-text",disabled:d,onBlur:E=>{const N=E.target.value.trim();N&&N!==b.ollama?.model&&_({"memory.embeddings.ollama.model":N})},className:"max-w-md"})}),r.jsx(de,{label:"Base URL",hint:"Vacío usa engines.ollama.base_url (por defecto http://localhost:11434).",children:r.jsx(ke,{defaultValue:b.ollama?.base_url||"",placeholder:"http://localhost:11434",disabled:d,onBlur:E=>_({"memory.embeddings.ollama.base_url":E.target.value.trim()}),className:"max-w-md"})})]}),r.jsxs(Ge,{title:j("memory_panel.openai_title"),description:"text-embedding-3-small (1536 dims) u otro modelo compatible.",children:[r.jsx(de,{label:"Modelo",children:r.jsx(ke,{defaultValue:b.openai?.model||"text-embedding-3-small",placeholder:"text-embedding-3-small",disabled:d,onBlur:E=>{const N=E.target.value.trim();N&&N!==b.openai?.model&&_({"memory.embeddings.openai.model":N})},className:"max-w-md"})}),r.jsx(de,{label:"API key",hint:"Vacío reusa engines.openai.api_key. Dejalo en blanco para no tocar la guardada.",children:r.jsx(ke,{type:"password",defaultValue:b.openai?.api_key||"",placeholder:"sk-…",disabled:d,onBlur:E=>{const N=E.target.value;N&&!jj(N)&&_({"memory.embeddings.openai.api_key":N})},className:"max-w-md"})})]}),r.jsxs(Ge,{title:j("memory_panel.gemini_title"),description:"text-embedding-004 (768 dims). Free tier con API key de Google.",children:[r.jsx(de,{label:"Modelo",children:r.jsx(ke,{defaultValue:b.gemini?.model||"text-embedding-004",placeholder:"text-embedding-004",disabled:d,onBlur:E=>{const N=E.target.value.trim();N&&N!==b.gemini?.model&&_({"memory.embeddings.gemini.model":N})},className:"max-w-md"})}),r.jsx(de,{label:"API key",hint:"Vacío reusa engines.gemini.api_key.",children:r.jsx(ke,{type:"password",defaultValue:b.gemini?.api_key||"",placeholder:"AIza…",disabled:d,onBlur:E=>{const N=E.target.value;N&&!jj(N)&&_({"memory.embeddings.gemini.api_key":N})},className:"max-w-md"})})]}),r.jsxs(Ge,{title:j("memory_panel.compaction_title"),description:"Cuando un chat supera el umbral de turnos, los más viejos se resumen con un LLM liviano (local) y se guardan como [RESUMEN COMPACTADO], manteniendo el contexto acotado. Corre fuera del hot-path: el turno actual usa el resumen que ya exista.",children:[r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsx(de,{label:"Umbral de compactación",hint:"Compactar una vez que el chat supera estos turnos (por defecto 60).",children:r.jsx(ke,{type:"number",min:1,defaultValue:g.compact_threshold??60,placeholder:"60",disabled:d,onBlur:E=>{const N=parseInt(E.target.value,10);Number.isFinite(N)&&N>0&&N!==g.compact_threshold&&_({"memory.compact_threshold":N})},className:"max-w-[10rem]"})}),r.jsx(de,{label:"Turnos recientes a preservar",hint:"Turnos verbatim que NUNCA se compactan (por defecto 40). Debe ser menor al umbral.",children:r.jsx(ke,{type:"number",min:1,defaultValue:g.keep_recent??40,placeholder:"40",disabled:d,onBlur:E=>{const N=parseInt(E.target.value,10);Number.isFinite(N)&&N>0&&N!==g.keep_recent&&_({"memory.keep_recent":N})},className:"max-w-[10rem]"})})]}),r.jsx(de,{label:"Modelo de compactación",hint:"LLM liviano para resumir. Ideal uno local (Ollama) para no gastar. Formato proveedor:modelo.",children:r.jsx(ke,{defaultValue:g.compact_model||"ollama:gemma4:31b-cloud",placeholder:"ollama:gemma4:31b-cloud",disabled:d,onBlur:E=>{const N=E.target.value.trim();N&&N!==g.compact_model&&_({"memory.compact_model":N})},className:"max-w-md"})}),r.jsx(de,{label:"Modelo de fallback",hint:"Se usa si el de compactación falla. Vacío cae al modelo del super-agente.",children:r.jsx(ke,{defaultValue:g.compact_fallback_model||"",placeholder:"(vacío → modelo del super-agente)",disabled:d,onBlur:E=>{const N=E.target.value.trim();N!==(g.compact_fallback_model||"")&&_({"memory.compact_fallback_model":N})},className:"max-w-md"})})]})]})}const GP=[{key:"load_threshold",label:"Umbral de carga",hint:"Similitud mínima para inyectar el CUERPO de la skill (alto = más estricto).",step:.01,min:0,max:1},{key:"hint_threshold",label:"Umbral de sugerencia",hint:"Similitud mínima para solo SUGERIR la skill (que el agente la cargue si quiere).",step:.01,min:0,max:1},{key:"margin",label:"Margen sobre el 2º",hint:"El top debe superar al segundo por este margen para cargar su cuerpo (evita empates flojos).",step:.01,min:0,max:1},{key:"max_loaded",label:"Máx. cuerpos cargados",hint:"Cuántas skills se inyectan completas por turno.",step:1,min:0,max:5},{key:"max_hints",label:"Máx. sugerencias",hint:"Cuántas skills extra se nombran como sugerencia.",step:1,min:0,max:8},{key:"prompt_floor",label:"Largo mínimo del prompt",hint:"Mensajes más cortos que esto se ignoran (evita 'ok', 'hola').",step:1,min:0,max:40},{key:"body_char_cap",label:"Tope de chars del cuerpo",hint:"Recorta cuerpos de skill largos para no inflar el contexto.",step:500,min:500,max:2e4}];function FP(){const e=at(),{data:n,mutate:s,isLoading:o}=Qe("/skills/inspector",()=>Qi.inspector()),[l,c]=h.useState(!1),[d,f]=h.useState(""),[p,m]=h.useState(null);if(o||!n)return r.jsx(nt,{});const g=n.config,b=n.index,v=async _=>{c(!0);try{await Qi.updateInspector(_),await s()}catch(w){e.error(`No se pudo guardar: ${w.message}`)}finally{c(!1)}},S=async(_=!1)=>{c(!0);try{const w=await Qi.index({force:_});e.success(`Indexado con ${w.embedder} (dim ${w.dim}): +${w.changed.added} ~${w.changed.refreshed} -${w.changed.removed}.`),await s()}catch(w){e.error(`Falló el index: ${w.message}`)}finally{c(!1)}},C=async()=>{if(d.trim()){c(!0),m(null);try{const _=await Qi.inspect(d.trim());m(_.trace)}catch(_){e.error(`Falló el dry-run: ${_.message}`)}finally{c(!1)}}};return r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[r.jsx(Ge,{title:"Skill Inspector (RAG por turno)",description:"Función experimental. Cuando está activa, el agente NO recibe la lista completa de skills en su prompt; en cada mensaje un RAG local decide qué skill(s) cargar — el cuerpo completo si hay match fuerte, una sugerencia si hay match medio, nada si no aplica. Se reevalúa cada turno: una skill que dejó de ser relevante desaparece del contexto.",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx(de,{label:"Activar inspector",hint:"Apagado = comportamiento clásico (lista de slugs + sugerencia pasiva). Encendido = el RAG decide por turno.",children:r.jsx(Zt,{checked:g.enabled,disabled:l,onChange:_=>v({enabled:_}),label:g.enabled?"Encendido":"Apagado"})}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[r.jsxs(Ve,{tone:b.count>0?"success":"warning",children:["Índice: ",b.count," skills"]}),r.jsx(Ve,{tone:"muted",children:b.embedder||"sin indexar"}),b.dim?r.jsxs(Ve,{tone:"muted",children:["dim ",b.dim]}):null,b.updated_at?r.jsxs("span",{className:"text-xs text-muted-foreground",children:["actualizado ",new Date(b.updated_at).toLocaleString()]}):null]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[r.jsxs(ge,{variant:"secondary",onClick:()=>S(!1),loading:l,children:[r.jsx(os,{size:14})," Reindexar"]}),r.jsxs(ge,{variant:"secondary",onClick:()=>S(!0),loading:l,children:[r.jsx(os,{size:14})," Reindexar (forzado)"]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"El embedder sale de Memoria (RAG). Local con Ollama, u offline si no hay proveedor."})]})]})}),r.jsx(Ge,{title:"Umbrales y límites",description:"Ajustá qué tan agresivo es el inspector. Subir los umbrales = menos falsos positivos pero más riesgo de perderse una skill; bajarlos = lo contrario.",children:r.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:GP.map(_=>r.jsx(de,{label:_.label,hint:_.hint,children:r.jsx(ke,{type:"number",step:_.step,min:_.min,max:_.max,defaultValue:String(g[_.key]),disabled:l,onBlur:w=>{const k=Number(w.target.value);Number.isFinite(k)&&k!==g[_.key]&&v({[_.key]:k})},className:"max-w-[12rem]"})},_.key))})}),r.jsx(Ge,{title:"Probar (dry-run)",description:"Escribí un mensaje como lo haría un usuario y mirá qué skills cargaría/sugeriría el inspector — sin llamar al modelo. Fuerza el inspector activo aunque esté apagado arriba.",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(ke,{value:d,placeholder:"ej: necesito crear un video promocional con voz en off",disabled:l,onChange:_=>f(_.target.value),onKeyDown:_=>{_.key==="Enter"&&C()},className:"max-w-xl flex-1"}),r.jsxs(ge,{variant:"primary",onClick:C,loading:l,children:[r.jsx(yA,{size:14})," Probar"]})]}),p&&r.jsxs("div",{className:"rounded-md border border-border/60 bg-muted/30 p-3 text-sm",children:[r.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[r.jsx(ls,{size:14,className:"text-muted-foreground"}),r.jsx("span",{className:"text-muted-foreground",children:p.embedder||"—"}),p.jit?r.jsx(Ve,{tone:"warning",children:"JIT (índice vacío)"}):null,p.reason&&!p.loaded?.length&&!p.hinted?.length?r.jsx(Ve,{tone:"muted",children:p.reason}):null]}),p.loaded?.length?r.jsxs("div",{className:"mb-1",children:[r.jsx("span",{className:"text-muted-foreground",children:"Cargadas: "}),p.loaded.map(_=>r.jsx(Ve,{tone:"success",className:"mr-1",children:_},_))]}):null,p.hinted?.length?r.jsxs("div",{className:"mb-1",children:[r.jsx("span",{className:"text-muted-foreground",children:"Sugeridas: "}),p.hinted.map(_=>r.jsx(Ve,{tone:"info",className:"mr-1",children:_},_))]}):null,p.scored?.length?r.jsx("div",{className:"mt-2 space-y-0.5 font-mono text-xs text-muted-foreground",children:p.scored.map(_=>r.jsxs("div",{children:[_.sim.toFixed(3)," ",_.slug]},_.slug))}):null]})]})})]})}function YP(){const e=at(),{config:n,isLoading:s,patch:o,mutate:l}=Dr(),c=n.telegram?.channels||[],d=Math.max(0,c.findIndex(T=>T.name==="default")),f=c[d],[p,m]=h.useState(!0),[g,b]=h.useState(1500),[v,S]=h.useState(!0),[C,_]=h.useState(""),[w,k]=h.useState(""),[E,N]=h.useState(!1);if(h.useEffect(()=>{m(!!n.telegram?.enabled),b(Number(n.telegram?.poll_interval_ms||1500)),S(!!n.telegram?.respond_with_engine),_(""),k(f?.chat_id||"")},[n,f?.chat_id]),s)return r.jsx(nt,{});const R=async()=>{N(!0);try{const T=c.slice(),O={name:"default",chat_id:w,respond_with_engine:v,...C?{bot_token:C}:{}};c.length===0?T.push(O):T[d]={...f,...O},await o({"telegram.enabled":p,"telegram.poll_interval_ms":g,"telegram.respond_with_engine":v,"telegram.channels":T}),e.success(j("settings.telegram_global.saved")),l(),_("")}catch(T){e.error(T.message)}finally{N(!1)}};return r.jsx(Ge,{title:j("settings.telegram_global.title"),description:j("settings.telegram_global.subtitle"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Zt,{checked:p,onChange:m,label:j("settings.telegram_global.enabled")}),r.jsx(Zt,{checked:v,onChange:S,label:j("settings.telegram_global.respond_with_engine")})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:j("settings.telegram_global.bot_token"),hint:f?.bot_token?`…${El(f.bot_token)??""} (seteado — escribí para reemplazar)`:"Token del BotFather.",children:r.jsx(ke,{type:"password",value:C,onChange:T=>_(T.target.value),placeholder:f?.bot_token?`…${El(f.bot_token)??""} (ya seteado)`:""})}),r.jsx(de,{label:j("settings.telegram_global.chat_id"),children:r.jsx(ke,{value:w,onChange:T=>k(T.target.value),placeholder:"889721252"})}),r.jsx(de,{label:j("settings.telegram_global.poll_interval"),children:r.jsx(ke,{type:"number",value:String(g),onChange:T=>b(Number(T.target.value)||1500)})})]}),r.jsx(ge,{variant:"primary",loading:E,onClick:R,children:j("common.save")})]})})}function XP(){const e=at(),{channels:n,isLoading:s,mutate:o}=pb(),{contacts:l}=mb(),[c,d]=h.useState(null),[f,p]=h.useState(null),m=new Map;for(const b of l)m.set(String(b.user_id),b.name||`@${b.username||b.user_id}`);const g=async b=>{if(confirm(j("telegram_channels.delete_confirm",{name:b})))try{await An.channels.remove(b),e.success(j("telegram_channels.removed")),o()}catch(v){e.error(v.message)}};return r.jsxs(Ge,{title:j("telegram_channels.title"),description:j("telegram_channels.desc"),action:r.jsxs(ge,{size:"sm",onClick:()=>d({name:""}),children:[r.jsx(nn,{size:14})," ",j("telegram_channels.new_btn")]}),children:[s&&r.jsx(nt,{}),!s&&n.length===0&&r.jsx(pt,{children:j("telegram_channels.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:n.map(b=>{const v=b.owner_user_id!=null?m.get(String(b.owner_user_id))||`user_id ${b.owner_user_id}`:j("telegram_channels.no_owner");return r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-medium",children:b.name}),r.jsxs("div",{className:"flex items-center gap-2",children:[b.project&&r.jsxs(Ve,{tone:"success",children:["project = ",b.project]}),r.jsxs(ge,{size:"sm",variant:"ghost",onClick:()=>p(b),children:[r.jsx(Ya,{size:13})," ",j("admin.telegram_send_test")]}),r.jsx(ge,{size:"sm",variant:"secondary",onClick:()=>d(b),children:j("common.edit")}),r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>g(b.name),children:j("common.delete")})]})]}),r.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-2 text-xs text-muted-fg",children:[r.jsxs("span",{children:["chat_id: ",b.chat_id||"—"]}),r.jsxs("span",{children:["bot_token: ",b.bot_token?`…${El(b.bot_token)??""}`:"—"]}),r.jsxs("span",{children:["route_to_agent: ",b.route_to_agent||"default APX"]}),r.jsxs("span",{children:["engine: ",b.respond_with_engine?"sí":"no"]}),r.jsxs("span",{className:"col-span-2",children:[j("telegram_channels.owner_label")," ",v]})]})]},b.name)})}),r.jsx(pC,{channel:c,onClose:()=>d(null),onSaved:()=>{d(null),o()}}),r.jsx(mC,{channel:f,onClose:()=>p(null)})]})}const wj=new Set(["owner","guest"]);function KP(){const e=at(),{roles:n,mutate:s,isLoading:o}=mb(),[l,c]=h.useState(""),[d,f]=h.useState(""),[p,m]=h.useState(!1),[g,b]=h.useState(!1),v=async()=>{const _=l.trim();if(!_){e.error(j("telegram_roles.name_required"));return}if(wj.has(_)){e.error(j("telegram_roles.builtin_error",{name:_}));return}b(!0);try{const w=p?"*":d.split(",").map(k=>k.trim()).filter(Boolean);await An.roles.set(_,w),e.success(j("telegram_roles.saved",{name:_})),c(""),f(""),m(!1),s()}catch(w){e.error(w.message)}finally{b(!1)}},S=async _=>{if(confirm(j("telegram_roles.delete_confirm",{name:_})))try{await An.roles.remove(_),e.success(j("telegram_roles.removed")),s()}catch(w){e.error(w.message)}},C=Object.entries(n);return r.jsxs(Ge,{title:j("telegram_roles.title"),description:j("telegram_roles.desc"),children:[o&&r.jsx(nt,{}),C.length===0&&!o&&r.jsx(pt,{children:j("telegram_roles.empty")}),C.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:C.map(([_,w])=>{const k=wj.has(_),E=w?.tools==="*"?j("telegram_roles.tools_all"):Array.isArray(w?.tools)&&w.tools.length>0?w.tools.join(", "):j("telegram_roles.tools_none");return r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("span",{className:"font-medium",children:_}),k&&r.jsx(Ve,{tone:"info",children:j("telegram_roles.builtin")})]}),!k&&r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>S(_),children:j("telegram_roles.delete_btn")})]}),r.jsxs("div",{className:"mt-1 text-xs text-muted-fg",children:["tools: ",E]})]},_)})}),r.jsxs("div",{className:"mt-4 space-y-3 rounded-md border border-dashed border-border p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r.jsx(nn,{size:14})," ",j("telegram_roles.new_title")]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:j("telegram_roles.name_label"),children:r.jsx(ke,{value:l,onChange:_=>c(_.target.value),placeholder:j("telegram_roles.name_ph")})}),r.jsx(de,{label:j("telegram_roles.tools_label"),hint:j("telegram_roles.tools_hint"),children:r.jsx(ke,{value:d,onChange:_=>f(_.target.value),disabled:p,placeholder:j("telegram_roles.tools_ph")})})]}),r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(Zt,{checked:p,onChange:m,label:j("telegram_roles.full_access")}),r.jsx(ge,{variant:"primary",loading:g,onClick:v,children:j("telegram_roles.save_btn")})]})]})]})}const ok="apx.settings.telegramTab";function QP(){if(typeof window>"u")return"default";const e=window.localStorage.getItem(ok);return e==="channels"||e==="contacts"||e==="roles"||e==="default"?e:"default"}function ZP(){const[e,n]=h.useState("default");h.useEffect(()=>{n(QP())},[]);const s=o=>{const l=o==="channels"||o==="contacts"||o==="roles"||o==="default"?o:"default";n(l);try{window.localStorage.setItem(ok,l)}catch{}};return r.jsxs(Df,{value:e,onValueChange:s,className:"w-full",children:[r.jsxs(Lf,{children:[r.jsx(ns,{value:"default",children:j("settings.telegram_global.title")}),r.jsx(ns,{value:"channels",children:j("telegram_channels.title")}),r.jsx(ns,{value:"contacts",children:j("telegram_contacts.title")}),r.jsx(ns,{value:"roles",children:j("telegram_roles.title")})]}),r.jsx(za,{value:"default",className:"mt-4",children:r.jsx(YP,{})}),r.jsx(za,{value:"channels",className:"mt-4",children:r.jsx(XP,{})}),r.jsx(za,{value:"contacts",className:"mt-4",children:r.jsx(gC,{})}),r.jsx(za,{value:"roles",className:"mt-4",children:r.jsx(KP,{})})]})}function WP(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/pair/list",()=>kl.list(),{refreshInterval:ff.pairList});return{clients:e?.clients||[],error:n,isLoading:s,mutate:o}}var il={},Pg,Sj;function JP(){return Sj||(Sj=1,Pg=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Pg}var Ig={},hr={},Cj;function _o(){if(Cj)return hr;Cj=1;let e;const n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return hr.getSymbolSize=function(o){if(!o)throw new Error('"version" cannot be null or undefined');if(o<1||o>40)throw new Error('"version" should be in range from 1 to 40');return o*4+17},hr.getSymbolTotalCodewords=function(o){return n[o]},hr.getBCHDigit=function(s){let o=0;for(;s!==0;)o++,s>>>=1;return o},hr.setToSJISFunction=function(o){if(typeof o!="function")throw new Error('"toSJISFunc" is not a valid function.');e=o},hr.isKanjiModeEnabled=function(){return typeof e<"u"},hr.toSJIS=function(o){return e(o)},hr}var Bg={},kj;function Tb(){return kj||(kj=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function n(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+s)}}e.isValid=function(o){return o&&typeof o.bit<"u"&&o.bit>=0&&o.bit<4},e.from=function(o,l){if(e.isValid(o))return o;try{return n(o)}catch{return l}}})(Bg)),Bg}var Ug,Ej;function e8(){if(Ej)return Ug;Ej=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(n){const s=Math.floor(n/8);return(this.buffer[s]>>>7-n%8&1)===1},put:function(n,s){for(let o=0;o<s;o++)this.putBit((n>>>s-o-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(n){const s=Math.floor(this.length/8);this.buffer.length<=s&&this.buffer.push(0),n&&(this.buffer[s]|=128>>>this.length%8),this.length++}},Ug=e,Ug}var Hg,Nj;function t8(){if(Nj)return Hg;Nj=1;function e(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n)}return e.prototype.set=function(n,s,o,l){const c=n*this.size+s;this.data[c]=o,l&&(this.reservedBit[c]=!0)},e.prototype.get=function(n,s){return this.data[n*this.size+s]},e.prototype.xor=function(n,s,o){this.data[n*this.size+s]^=o},e.prototype.isReserved=function(n,s){return this.reservedBit[n*this.size+s]},Hg=e,Hg}var Vg={},Rj;function n8(){return Rj||(Rj=1,(function(e){const n=_o().getSymbolSize;e.getRowColCoords=function(o){if(o===1)return[];const l=Math.floor(o/7)+2,c=n(o),d=c===145?26:Math.ceil((c-13)/(2*l-2))*2,f=[c-7];for(let p=1;p<l-1;p++)f[p]=f[p-1]-d;return f.push(6),f.reverse()},e.getPositions=function(o){const l=[],c=e.getRowColCoords(o),d=c.length;for(let f=0;f<d;f++)for(let p=0;p<d;p++)f===0&&p===0||f===0&&p===d-1||f===d-1&&p===0||l.push([c[f],c[p]]);return l}})(Vg)),Vg}var qg={},Tj;function a8(){if(Tj)return qg;Tj=1;const e=_o().getSymbolSize,n=7;return qg.getPositions=function(o){const l=e(o);return[[0,0],[l-n,0],[0,l-n]]},qg}var $g={},Aj;function s8(){return Aj||(Aj=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const n={N1:3,N2:3,N3:40,N4:10};e.isValid=function(l){return l!=null&&l!==""&&!isNaN(l)&&l>=0&&l<=7},e.from=function(l){return e.isValid(l)?parseInt(l,10):void 0},e.getPenaltyN1=function(l){const c=l.size;let d=0,f=0,p=0,m=null,g=null;for(let b=0;b<c;b++){f=p=0,m=g=null;for(let v=0;v<c;v++){let S=l.get(b,v);S===m?f++:(f>=5&&(d+=n.N1+(f-5)),m=S,f=1),S=l.get(v,b),S===g?p++:(p>=5&&(d+=n.N1+(p-5)),g=S,p=1)}f>=5&&(d+=n.N1+(f-5)),p>=5&&(d+=n.N1+(p-5))}return d},e.getPenaltyN2=function(l){const c=l.size;let d=0;for(let f=0;f<c-1;f++)for(let p=0;p<c-1;p++){const m=l.get(f,p)+l.get(f,p+1)+l.get(f+1,p)+l.get(f+1,p+1);(m===4||m===0)&&d++}return d*n.N2},e.getPenaltyN3=function(l){const c=l.size;let d=0,f=0,p=0;for(let m=0;m<c;m++){f=p=0;for(let g=0;g<c;g++)f=f<<1&2047|l.get(m,g),g>=10&&(f===1488||f===93)&&d++,p=p<<1&2047|l.get(g,m),g>=10&&(p===1488||p===93)&&d++}return d*n.N3},e.getPenaltyN4=function(l){let c=0;const d=l.data.length;for(let p=0;p<d;p++)c+=l.data[p];return Math.abs(Math.ceil(c*100/d/5)-10)*n.N4};function s(o,l,c){switch(o){case e.Patterns.PATTERN000:return(l+c)%2===0;case e.Patterns.PATTERN001:return l%2===0;case e.Patterns.PATTERN010:return c%3===0;case e.Patterns.PATTERN011:return(l+c)%3===0;case e.Patterns.PATTERN100:return(Math.floor(l/2)+Math.floor(c/3))%2===0;case e.Patterns.PATTERN101:return l*c%2+l*c%3===0;case e.Patterns.PATTERN110:return(l*c%2+l*c%3)%2===0;case e.Patterns.PATTERN111:return(l*c%3+(l+c)%2)%2===0;default:throw new Error("bad maskPattern:"+o)}}e.applyMask=function(l,c){const d=c.size;for(let f=0;f<d;f++)for(let p=0;p<d;p++)c.isReserved(p,f)||c.xor(p,f,s(l,p,f))},e.getBestMask=function(l,c){const d=Object.keys(e.Patterns).length;let f=0,p=1/0;for(let m=0;m<d;m++){c(m),e.applyMask(m,l);const g=e.getPenaltyN1(l)+e.getPenaltyN2(l)+e.getPenaltyN3(l)+e.getPenaltyN4(l);e.applyMask(m,l),g<p&&(p=g,f=m)}return f}})($g)),$g}var hd={},Mj;function lk(){if(Mj)return hd;Mj=1;const e=Tb(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],s=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return hd.getBlocksCount=function(l,c){switch(c){case e.L:return n[(l-1)*4+0];case e.M:return n[(l-1)*4+1];case e.Q:return n[(l-1)*4+2];case e.H:return n[(l-1)*4+3];default:return}},hd.getTotalCodewordsCount=function(l,c){switch(c){case e.L:return s[(l-1)*4+0];case e.M:return s[(l-1)*4+1];case e.Q:return s[(l-1)*4+2];case e.H:return s[(l-1)*4+3];default:return}},hd}var Gg={},Yi={},Oj;function r8(){if(Oj)return Yi;Oj=1;const e=new Uint8Array(512),n=new Uint8Array(256);return(function(){let o=1;for(let l=0;l<255;l++)e[l]=o,n[o]=l,o<<=1,o&256&&(o^=285);for(let l=255;l<512;l++)e[l]=e[l-255]})(),Yi.log=function(o){if(o<1)throw new Error("log("+o+")");return n[o]},Yi.exp=function(o){return e[o]},Yi.mul=function(o,l){return o===0||l===0?0:e[n[o]+n[l]]},Yi}var zj;function o8(){return zj||(zj=1,(function(e){const n=r8();e.mul=function(o,l){const c=new Uint8Array(o.length+l.length-1);for(let d=0;d<o.length;d++)for(let f=0;f<l.length;f++)c[d+f]^=n.mul(o[d],l[f]);return c},e.mod=function(o,l){let c=new Uint8Array(o);for(;c.length-l.length>=0;){const d=c[0];for(let p=0;p<l.length;p++)c[p]^=n.mul(l[p],d);let f=0;for(;f<c.length&&c[f]===0;)f++;c=c.slice(f)}return c},e.generateECPolynomial=function(o){let l=new Uint8Array([1]);for(let c=0;c<o;c++)l=e.mul(l,new Uint8Array([1,n.exp(c)]));return l}})(Gg)),Gg}var Fg,Dj;function l8(){if(Dj)return Fg;Dj=1;const e=o8();function n(s){this.genPoly=void 0,this.degree=s,this.degree&&this.initialize(this.degree)}return n.prototype.initialize=function(o){this.degree=o,this.genPoly=e.generateECPolynomial(this.degree)},n.prototype.encode=function(o){if(!this.genPoly)throw new Error("Encoder not initialized");const l=new Uint8Array(o.length+this.degree);l.set(o);const c=e.mod(l,this.genPoly),d=this.degree-c.length;if(d>0){const f=new Uint8Array(this.degree);return f.set(c,d),f}return c},Fg=n,Fg}var Yg={},Xg={},Kg={},Lj;function ik(){return Lj||(Lj=1,Kg.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}),Kg}var Wa={},Pj;function ck(){if(Pj)return Wa;Pj=1;const e="[0-9]+",n="[A-Z $%*+\\-./:]+";let s="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";s=s.replace(/u/g,"\\u");const o="(?:(?![A-Z0-9 $%*+\\-./:]|"+s+`)(?:.|[\r
612
+ ]))+`;Wa.KANJI=new RegExp(s,"g"),Wa.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Wa.BYTE=new RegExp(o,"g"),Wa.NUMERIC=new RegExp(e,"g"),Wa.ALPHANUMERIC=new RegExp(n,"g");const l=new RegExp("^"+s+"$"),c=new RegExp("^"+e+"$"),d=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Wa.testKanji=function(p){return l.test(p)},Wa.testNumeric=function(p){return c.test(p)},Wa.testAlphanumeric=function(p){return d.test(p)},Wa}var Ij;function jo(){return Ij||(Ij=1,(function(e){const n=ik(),s=ck();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(c,d){if(!c.ccBits)throw new Error("Invalid mode: "+c);if(!n.isValid(d))throw new Error("Invalid version: "+d);return d>=1&&d<10?c.ccBits[0]:d<27?c.ccBits[1]:c.ccBits[2]},e.getBestModeForData=function(c){return s.testNumeric(c)?e.NUMERIC:s.testAlphanumeric(c)?e.ALPHANUMERIC:s.testKanji(c)?e.KANJI:e.BYTE},e.toString=function(c){if(c&&c.id)return c.id;throw new Error("Invalid mode")},e.isValid=function(c){return c&&c.bit&&c.ccBits};function o(l){if(typeof l!="string")throw new Error("Param is not a string");switch(l.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+l)}}e.from=function(c,d){if(e.isValid(c))return c;try{return o(c)}catch{return d}}})(Xg)),Xg}var Bj;function i8(){return Bj||(Bj=1,(function(e){const n=_o(),s=lk(),o=Tb(),l=jo(),c=ik(),d=7973,f=n.getBCHDigit(d);function p(v,S,C){for(let _=1;_<=40;_++)if(S<=e.getCapacity(_,C,v))return _}function m(v,S){return l.getCharCountIndicator(v,S)+4}function g(v,S){let C=0;return v.forEach(function(_){const w=m(_.mode,S);C+=w+_.getBitsLength()}),C}function b(v,S){for(let C=1;C<=40;C++)if(g(v,C)<=e.getCapacity(C,S,l.MIXED))return C}e.from=function(S,C){return c.isValid(S)?parseInt(S,10):C},e.getCapacity=function(S,C,_){if(!c.isValid(S))throw new Error("Invalid QR Code version");typeof _>"u"&&(_=l.BYTE);const w=n.getSymbolTotalCodewords(S),k=s.getTotalCodewordsCount(S,C),E=(w-k)*8;if(_===l.MIXED)return E;const N=E-m(_,S);switch(_){case l.NUMERIC:return Math.floor(N/10*3);case l.ALPHANUMERIC:return Math.floor(N/11*2);case l.KANJI:return Math.floor(N/13);case l.BYTE:default:return Math.floor(N/8)}},e.getBestVersionForData=function(S,C){let _;const w=o.from(C,o.M);if(Array.isArray(S)){if(S.length>1)return b(S,w);if(S.length===0)return 1;_=S[0]}else _=S;return p(_.mode,_.getLength(),w)},e.getEncodedBits=function(S){if(!c.isValid(S)||S<7)throw new Error("Invalid QR Code version");let C=S<<12;for(;n.getBCHDigit(C)-f>=0;)C^=d<<n.getBCHDigit(C)-f;return S<<12|C}})(Yg)),Yg}var Qg={},Uj;function c8(){if(Uj)return Qg;Uj=1;const e=_o(),n=1335,s=21522,o=e.getBCHDigit(n);return Qg.getEncodedBits=function(c,d){const f=c.bit<<3|d;let p=f<<10;for(;e.getBCHDigit(p)-o>=0;)p^=n<<e.getBCHDigit(p)-o;return(f<<10|p)^s},Qg}var Zg={},Wg,Hj;function u8(){if(Hj)return Wg;Hj=1;const e=jo();function n(s){this.mode=e.NUMERIC,this.data=s.toString()}return n.getBitsLength=function(o){return 10*Math.floor(o/3)+(o%3?o%3*3+1:0)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(o){let l,c,d;for(l=0;l+3<=this.data.length;l+=3)c=this.data.substr(l,3),d=parseInt(c,10),o.put(d,10);const f=this.data.length-l;f>0&&(c=this.data.substr(l),d=parseInt(c,10),o.put(d,f*3+1))},Wg=n,Wg}var Jg,Vj;function d8(){if(Vj)return Jg;Vj=1;const e=jo(),n=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function s(o){this.mode=e.ALPHANUMERIC,this.data=o}return s.getBitsLength=function(l){return 11*Math.floor(l/2)+6*(l%2)},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(l){let c;for(c=0;c+2<=this.data.length;c+=2){let d=n.indexOf(this.data[c])*45;d+=n.indexOf(this.data[c+1]),l.put(d,11)}this.data.length%2&&l.put(n.indexOf(this.data[c]),6)},Jg=s,Jg}var eh,qj;function f8(){if(qj)return eh;qj=1;const e=jo();function n(s){this.mode=e.BYTE,typeof s=="string"?this.data=new TextEncoder().encode(s):this.data=new Uint8Array(s)}return n.getBitsLength=function(o){return o*8},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(s){for(let o=0,l=this.data.length;o<l;o++)s.put(this.data[o],8)},eh=n,eh}var th,$j;function p8(){if($j)return th;$j=1;const e=jo(),n=_o();function s(o){this.mode=e.KANJI,this.data=o}return s.getBitsLength=function(l){return l*13},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(o){let l;for(l=0;l<this.data.length;l++){let c=n.toSJIS(this.data[l]);if(c>=33088&&c<=40956)c-=33088;else if(c>=57408&&c<=60351)c-=49472;else throw new Error("Invalid SJIS character: "+this.data[l]+`
613
+ Make sure your charset is UTF-8`);c=(c>>>8&255)*192+(c&255),o.put(c,13)}},th=s,th}var nh={exports:{}},Gj;function m8(){return Gj||(Gj=1,(function(e){var n={single_source_shortest_paths:function(s,o,l){var c={},d={};d[o]=0;var f=n.PriorityQueue.make();f.push(o,0);for(var p,m,g,b,v,S,C,_,w;!f.empty();){p=f.pop(),m=p.value,b=p.cost,v=s[m]||{};for(g in v)v.hasOwnProperty(g)&&(S=v[g],C=b+S,_=d[g],w=typeof d[g]>"u",(w||_>C)&&(d[g]=C,f.push(g,C),c[g]=m))}if(typeof l<"u"&&typeof d[l]>"u"){var k=["Could not find a path from ",o," to ",l,"."].join("");throw new Error(k)}return c},extract_shortest_path_from_predecessor_list:function(s,o){for(var l=[],c=o;c;)l.push(c),s[c],c=s[c];return l.reverse(),l},find_path:function(s,o,l){var c=n.single_source_shortest_paths(s,o,l);return n.extract_shortest_path_from_predecessor_list(c,l)},PriorityQueue:{make:function(s){var o=n.PriorityQueue,l={},c;s=s||{};for(c in o)o.hasOwnProperty(c)&&(l[c]=o[c]);return l.queue=[],l.sorter=s.sorter||o.default_sorter,l},default_sorter:function(s,o){return s.cost-o.cost},push:function(s,o){var l={value:s,cost:o};this.queue.push(l),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=n})(nh)),nh.exports}var Fj;function g8(){return Fj||(Fj=1,(function(e){const n=jo(),s=u8(),o=d8(),l=f8(),c=p8(),d=ck(),f=_o(),p=m8();function m(k){return unescape(encodeURIComponent(k)).length}function g(k,E,N){const R=[];let T;for(;(T=k.exec(N))!==null;)R.push({data:T[0],index:T.index,mode:E,length:T[0].length});return R}function b(k){const E=g(d.NUMERIC,n.NUMERIC,k),N=g(d.ALPHANUMERIC,n.ALPHANUMERIC,k);let R,T;return f.isKanjiModeEnabled()?(R=g(d.BYTE,n.BYTE,k),T=g(d.KANJI,n.KANJI,k)):(R=g(d.BYTE_KANJI,n.BYTE,k),T=[]),E.concat(N,R,T).sort(function(A,z){return A.index-z.index}).map(function(A){return{data:A.data,mode:A.mode,length:A.length}})}function v(k,E){switch(E){case n.NUMERIC:return s.getBitsLength(k);case n.ALPHANUMERIC:return o.getBitsLength(k);case n.KANJI:return c.getBitsLength(k);case n.BYTE:return l.getBitsLength(k)}}function S(k){return k.reduce(function(E,N){const R=E.length-1>=0?E[E.length-1]:null;return R&&R.mode===N.mode?(E[E.length-1].data+=N.data,E):(E.push(N),E)},[])}function C(k){const E=[];for(let N=0;N<k.length;N++){const R=k[N];switch(R.mode){case n.NUMERIC:E.push([R,{data:R.data,mode:n.ALPHANUMERIC,length:R.length},{data:R.data,mode:n.BYTE,length:R.length}]);break;case n.ALPHANUMERIC:E.push([R,{data:R.data,mode:n.BYTE,length:R.length}]);break;case n.KANJI:E.push([R,{data:R.data,mode:n.BYTE,length:m(R.data)}]);break;case n.BYTE:E.push([{data:R.data,mode:n.BYTE,length:m(R.data)}])}}return E}function _(k,E){const N={},R={start:{}};let T=["start"];for(let O=0;O<k.length;O++){const A=k[O],z=[];for(let B=0;B<A.length;B++){const L=A[B],D=""+O+B;z.push(D),N[D]={node:L,lastCount:0},R[D]={};for(let P=0;P<T.length;P++){const H=T[P];N[H]&&N[H].node.mode===L.mode?(R[H][D]=v(N[H].lastCount+L.length,L.mode)-v(N[H].lastCount,L.mode),N[H].lastCount+=L.length):(N[H]&&(N[H].lastCount=L.length),R[H][D]=v(L.length,L.mode)+4+n.getCharCountIndicator(L.mode,E))}}T=z}for(let O=0;O<T.length;O++)R[T[O]].end=0;return{map:R,table:N}}function w(k,E){let N;const R=n.getBestModeForData(k);if(N=n.from(E,R),N!==n.BYTE&&N.bit<R.bit)throw new Error('"'+k+'" cannot be encoded with mode '+n.toString(N)+`.
614
+ Suggested mode is: `+n.toString(R));switch(N===n.KANJI&&!f.isKanjiModeEnabled()&&(N=n.BYTE),N){case n.NUMERIC:return new s(k);case n.ALPHANUMERIC:return new o(k);case n.KANJI:return new c(k);case n.BYTE:return new l(k)}}e.fromArray=function(E){return E.reduce(function(N,R){return typeof R=="string"?N.push(w(R,null)):R.data&&N.push(w(R.data,R.mode)),N},[])},e.fromString=function(E,N){const R=b(E,f.isKanjiModeEnabled()),T=C(R),O=_(T,N),A=p.find_path(O.map,"start","end"),z=[];for(let B=1;B<A.length-1;B++)z.push(O.table[A[B]].node);return e.fromArray(S(z))},e.rawSplit=function(E){return e.fromArray(b(E,f.isKanjiModeEnabled()))}})(Zg)),Zg}var Yj;function h8(){if(Yj)return Ig;Yj=1;const e=_o(),n=Tb(),s=e8(),o=t8(),l=n8(),c=a8(),d=s8(),f=lk(),p=l8(),m=i8(),g=c8(),b=jo(),v=g8();function S(O,A){const z=O.size,B=c.getPositions(A);for(let L=0;L<B.length;L++){const D=B[L][0],P=B[L][1];for(let H=-1;H<=7;H++)if(!(D+H<=-1||z<=D+H))for(let q=-1;q<=7;q++)P+q<=-1||z<=P+q||(H>=0&&H<=6&&(q===0||q===6)||q>=0&&q<=6&&(H===0||H===6)||H>=2&&H<=4&&q>=2&&q<=4?O.set(D+H,P+q,!0,!0):O.set(D+H,P+q,!1,!0))}}function C(O){const A=O.size;for(let z=8;z<A-8;z++){const B=z%2===0;O.set(z,6,B,!0),O.set(6,z,B,!0)}}function _(O,A){const z=l.getPositions(A);for(let B=0;B<z.length;B++){const L=z[B][0],D=z[B][1];for(let P=-2;P<=2;P++)for(let H=-2;H<=2;H++)P===-2||P===2||H===-2||H===2||P===0&&H===0?O.set(L+P,D+H,!0,!0):O.set(L+P,D+H,!1,!0)}}function w(O,A){const z=O.size,B=m.getEncodedBits(A);let L,D,P;for(let H=0;H<18;H++)L=Math.floor(H/3),D=H%3+z-8-3,P=(B>>H&1)===1,O.set(L,D,P,!0),O.set(D,L,P,!0)}function k(O,A,z){const B=O.size,L=g.getEncodedBits(A,z);let D,P;for(D=0;D<15;D++)P=(L>>D&1)===1,D<6?O.set(D,8,P,!0):D<8?O.set(D+1,8,P,!0):O.set(B-15+D,8,P,!0),D<8?O.set(8,B-D-1,P,!0):D<9?O.set(8,15-D-1+1,P,!0):O.set(8,15-D-1,P,!0);O.set(B-8,8,1,!0)}function E(O,A){const z=O.size;let B=-1,L=z-1,D=7,P=0;for(let H=z-1;H>0;H-=2)for(H===6&&H--;;){for(let q=0;q<2;q++)if(!O.isReserved(L,H-q)){let Y=!1;P<A.length&&(Y=(A[P]>>>D&1)===1),O.set(L,H-q,Y),D--,D===-1&&(P++,D=7)}if(L+=B,L<0||z<=L){L-=B,B=-B;break}}}function N(O,A,z){const B=new s;z.forEach(function(q){B.put(q.mode.bit,4),B.put(q.getLength(),b.getCharCountIndicator(q.mode,O)),q.write(B)});const L=e.getSymbolTotalCodewords(O),D=f.getTotalCodewordsCount(O,A),P=(L-D)*8;for(B.getLengthInBits()+4<=P&&B.put(0,4);B.getLengthInBits()%8!==0;)B.putBit(0);const H=(P-B.getLengthInBits())/8;for(let q=0;q<H;q++)B.put(q%2?17:236,8);return R(B,O,A)}function R(O,A,z){const B=e.getSymbolTotalCodewords(A),L=f.getTotalCodewordsCount(A,z),D=B-L,P=f.getBlocksCount(A,z),H=B%P,q=P-H,Y=Math.floor(B/P),V=Math.floor(D/P),$=V+1,Z=Y-V,G=new p(Z);let X=0;const U=new Array(P),K=new Array(P);let F=0;const J=new Uint8Array(O.buffer);for(let ee=0;ee<P;ee++){const Te=ee<q?V:$;U[ee]=J.slice(X,X+Te),K[ee]=G.encode(U[ee]),X+=Te,F=Math.max(F,Te)}const ie=new Uint8Array(B);let re=0,oe,ce;for(oe=0;oe<F;oe++)for(ce=0;ce<P;ce++)oe<U[ce].length&&(ie[re++]=U[ce][oe]);for(oe=0;oe<Z;oe++)for(ce=0;ce<P;ce++)ie[re++]=K[ce][oe];return ie}function T(O,A,z,B){let L;if(Array.isArray(O))L=v.fromArray(O);else if(typeof O=="string"){let Y=A;if(!Y){const V=v.rawSplit(O);Y=m.getBestVersionForData(V,z)}L=v.fromString(O,Y||40)}else throw new Error("Invalid data");const D=m.getBestVersionForData(L,z);if(!D)throw new Error("The amount of data is too big to be stored in a QR Code");if(!A)A=D;else if(A<D)throw new Error(`
615
+ The chosen QR Code version cannot contain this amount of data.
616
+ Minimum version required to store current data is: `+D+`.
617
+ `);const P=N(A,z,L),H=e.getSymbolSize(A),q=new o(H);return S(q,A),C(q),_(q,A),k(q,z,0),A>=7&&w(q,A),E(q,P),isNaN(B)&&(B=d.getBestMask(q,k.bind(null,q,z))),d.applyMask(B,q),k(q,z,B),{modules:q,version:A,errorCorrectionLevel:z,maskPattern:B,segments:L}}return Ig.create=function(A,z){if(typeof A>"u"||A==="")throw new Error("No input text");let B=n.M,L,D;return typeof z<"u"&&(B=n.from(z.errorCorrectionLevel,n.M),L=m.from(z.version),D=d.from(z.maskPattern),z.toSJISFunc&&e.setToSJISFunction(z.toSJISFunc)),T(A,L,B,D)},Ig}var ah={},sh={},Xj;function uk(){return Xj||(Xj=1,(function(e){function n(s){if(typeof s=="number"&&(s=s.toString()),typeof s!="string")throw new Error("Color should be defined as hex string");let o=s.slice().replace("#","").split("");if(o.length<3||o.length===5||o.length>8)throw new Error("Invalid hex color: "+s);(o.length===3||o.length===4)&&(o=Array.prototype.concat.apply([],o.map(function(c){return[c,c]}))),o.length===6&&o.push("F","F");const l=parseInt(o.join(""),16);return{r:l>>24&255,g:l>>16&255,b:l>>8&255,a:l&255,hex:"#"+o.slice(0,6).join("")}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const l=typeof o.margin>"u"||o.margin===null||o.margin<0?4:o.margin,c=o.width&&o.width>=21?o.width:void 0,d=o.scale||4;return{width:c,scale:c?4:d,margin:l,color:{dark:n(o.color.dark||"#000000ff"),light:n(o.color.light||"#ffffffff")},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(o,l){return l.width&&l.width>=o+l.margin*2?l.width/(o+l.margin*2):l.scale},e.getImageWidth=function(o,l){const c=e.getScale(o,l);return Math.floor((o+l.margin*2)*c)},e.qrToImageData=function(o,l,c){const d=l.modules.size,f=l.modules.data,p=e.getScale(d,c),m=Math.floor((d+c.margin*2)*p),g=c.margin*p,b=[c.color.light,c.color.dark];for(let v=0;v<m;v++)for(let S=0;S<m;S++){let C=(v*m+S)*4,_=c.color.light;if(v>=g&&S>=g&&v<m-g&&S<m-g){const w=Math.floor((v-g)/p),k=Math.floor((S-g)/p);_=b[f[w*d+k]?1:0]}o[C++]=_.r,o[C++]=_.g,o[C++]=_.b,o[C]=_.a}}})(sh)),sh}var Kj;function x8(){return Kj||(Kj=1,(function(e){const n=uk();function s(l,c,d){l.clearRect(0,0,c.width,c.height),c.style||(c.style={}),c.height=d,c.width=d,c.style.height=d+"px",c.style.width=d+"px"}function o(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(c,d,f){let p=f,m=d;typeof p>"u"&&(!d||!d.getContext)&&(p=d,d=void 0),d||(m=o()),p=n.getOptions(p);const g=n.getImageWidth(c.modules.size,p),b=m.getContext("2d"),v=b.createImageData(g,g);return n.qrToImageData(v.data,c,p),s(b,m,g),b.putImageData(v,0,0),m},e.renderToDataURL=function(c,d,f){let p=f;typeof p>"u"&&(!d||!d.getContext)&&(p=d,d=void 0),p||(p={});const m=e.render(c,d,p),g=p.type||"image/png",b=p.rendererOpts||{};return m.toDataURL(g,b.quality)}})(ah)),ah}var rh={},Qj;function b8(){if(Qj)return rh;Qj=1;const e=uk();function n(l,c){const d=l.a/255,f=c+'="'+l.hex+'"';return d<1?f+" "+c+'-opacity="'+d.toFixed(2).slice(1)+'"':f}function s(l,c,d){let f=l+c;return typeof d<"u"&&(f+=" "+d),f}function o(l,c,d){let f="",p=0,m=!1,g=0;for(let b=0;b<l.length;b++){const v=Math.floor(b%c),S=Math.floor(b/c);!v&&!m&&(m=!0),l[b]?(g++,b>0&&v>0&&l[b-1]||(f+=m?s("M",v+d,.5+S+d):s("m",p,0),p=0,m=!1),v+1<c&&l[b+1]||(f+=s("h",g),g=0)):p++}return f}return rh.render=function(c,d,f){const p=e.getOptions(d),m=c.modules.size,g=c.modules.data,b=m+p.margin*2,v=p.color.light.a?"<path "+n(p.color.light,"fill")+' d="M0 0h'+b+"v"+b+'H0z"/>':"",S="<path "+n(p.color.dark,"stroke")+' d="'+o(g,m,p.margin)+'"/>',C='viewBox="0 0 '+b+" "+b+'"',w='<svg xmlns="http://www.w3.org/2000/svg" '+(p.width?'width="'+p.width+'" height="'+p.width+'" ':"")+C+' shape-rendering="crispEdges">'+v+S+`</svg>
618
+ `;return typeof f=="function"&&f(null,w),w},rh}var Zj;function v8(){if(Zj)return il;Zj=1;const e=JP(),n=h8(),s=x8(),o=b8();function l(c,d,f,p,m){const g=[].slice.call(arguments,1),b=g.length,v=typeof g[b-1]=="function";if(!v&&!e())throw new Error("Callback required as last argument");if(v){if(b<2)throw new Error("Too few arguments provided");b===2?(m=f,f=d,d=p=void 0):b===3&&(d.getContext&&typeof m>"u"?(m=p,p=void 0):(m=p,p=f,f=d,d=void 0))}else{if(b<1)throw new Error("Too few arguments provided");return b===1?(f=d,d=p=void 0):b===2&&!d.getContext&&(p=f,f=d,d=void 0),new Promise(function(S,C){try{const _=n.create(f,p);S(c(_,d,p))}catch(_){C(_)}})}try{const S=n.create(f,p);m(null,c(S,d,p))}catch(S){m(S)}}return il.create=n.create,il.toCanvas=l.bind(null,s.render),il.toDataURL=l.bind(null,s.renderToDataURL),il.toString=l.bind(null,function(c,d,f){return o.render(c,f)}),il}var y8=v8();const _8=ex(y8);function j8({value:e,size:n=200}){const[s,o]=h.useState(null);return h.useEffect(()=>{let l=!0;return _8.toDataURL(e,{margin:2,width:n*2,errorCorrectionLevel:"M"}).then(c=>{l&&o(c)}).catch(()=>{l&&o(null)}),()=>{l=!1}},[e,n]),r.jsx("div",{className:"grid place-items-center rounded-lg bg-white p-3",style:{width:n+24,height:n+24},children:s?r.jsx("img",{src:s,width:n,height:n,alt:"QR"}):r.jsx("div",{className:"size-full animate-pulse rounded bg-muted"})})}function w8(e){return e.find(n=>!n.includes("127.0.0.1")&&!n.includes("localhost"))||e[0]||window.location.origin}function S8({open:e,onClose:n,onPaired:s}){const o=at(),[l,c]=h.useState(null),[d,f]=h.useState(null),[p,m]=h.useState(0),[g,b]=h.useState(!1),v=h.useRef(null),S=h.useCallback(async()=>{c(null),f(null),b(!1);try{const E=await kl.init();c(E),m(Math.round((E.ttl_ms||9e4)/1e3))}catch(E){E instanceof Oc&&E.status===403?f(j("settings.devices_pair_localhost_only")):f(E.message)}},[]);h.useEffect(()=>{e?S():(c(null),f(null),b(!1))},[e,S]),h.useEffect(()=>{if(!l||g||p<=0)return;const E=window.setTimeout(()=>m(N=>N-1),1e3);return()=>window.clearTimeout(E)},[l,p,g]),h.useEffect(()=>{if(!e||!l||g)return;let E=!0;const N=async()=>{try{const R=await kl.status(l.pairing_id);if(!E)return;if(R.status==="confirmed"){b(!0),o.success(j("settings.devices_pair_done")),s(),window.setTimeout(()=>{E&&n()},900);return}if(R.status==="expired"||R.status==="unknown"){m(0);return}}catch{}v.current=window.setTimeout(N,1500)};return v.current=window.setTimeout(N,1500),()=>{E=!1,v.current&&window.clearTimeout(v.current)}},[e,l,g,n,s,o]);const C=!!l&&!g&&p<=0,_=l?w8(l.lan_urls):"",w=l?`${_}/#pair=${l.pairing_id}`:"",k=async(E,N)=>{try{await navigator.clipboard.writeText(E),o.success(N)}catch{o.error(E)}};return r.jsxs(Vn,{open:e,onClose:n,title:j("settings.devices_pair_title"),description:j("settings.devices_pair_desc"),footer:r.jsx(ge,{variant:"secondary",onClick:n,children:j("common.close")}),children:[d&&r.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:d}),!d&&!l&&r.jsxs("div",{className:"flex items-center gap-2 py-8 text-sm text-muted-fg",children:[r.jsx(Pa,{})," ",j("common.loading")]}),!d&&l&&r.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r.jsx("div",{className:C?"opacity-40":"",children:r.jsx(j8,{value:w,size:196})}),g?r.jsx("p",{className:"text-sm font-medium text-emerald-500",children:j("settings.devices_pair_done")}):C?r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("p",{className:"text-sm text-muted-fg",children:j("settings.devices_pair_expired")}),r.jsx(ge,{variant:"primary",onClick:()=>void S(),children:j("settings.devices_pair_regen")})]}):r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-center text-xs text-muted-fg",children:j("settings.devices_pair_scan")}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[r.jsx(Pa,{size:12}),r.jsx("span",{children:j("settings.devices_pair_waiting")}),r.jsxs("span",{className:"tabular-nums",children:["· ",j("settings.devices_pair_expires",{s:p})]})]}),r.jsxs("div",{className:"w-full space-y-3 border-t border-border pt-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs text-muted-fg",children:j("settings.devices_pair_link")}),r.jsxs("div",{className:"flex items-stretch gap-2",children:[r.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-xs",children:w}),r.jsx(ge,{size:"sm",variant:"secondary",onClick:()=>k(w,j("settings.devices_pair_copied")),title:j("settings.devices_pair_copy"),children:r.jsx(Md,{size:14})})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs text-muted-fg",children:j("settings.devices_pair_code")}),r.jsxs("div",{className:"flex items-stretch gap-2",children:[r.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-center text-sm",children:l.pairing_id}),r.jsx(ge,{size:"sm",variant:"secondary",onClick:()=>k(l.pairing_id,j("settings.devices_pair_copied_code")),title:j("settings.devices_pair_copy"),children:r.jsx(Md,{size:14})})]})]})]})]})]})]})}function C8(){const e=at(),{clients:n,isLoading:s,mutate:o}=WP(),[l,c]=h.useState(!1),d=async f=>{if(confirm(j("settings.devices_revoke_confirm",{id:f})))try{await kl.revoke(f),e.success("Cliente revocado."),o()}catch(p){e.error(p.message)}};return r.jsxs(Ge,{title:j("settings.devices"),description:j("settings.devices_sub"),action:r.jsxs(ge,{size:"sm",variant:"primary",onClick:()=>c(!0),children:[r.jsx(fA,{size:14})," ",j("settings.devices_pair_btn")]}),children:[s&&r.jsx(nt,{}),!s&&n.length===0&&r.jsx(pt,{children:j("settings.devices_empty")}),n.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:n.map(f=>r.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"font-medium",children:f.label||f.id}),r.jsx(Ve,{tone:f.kind==="web"?"info":f.kind==="deck"?"success":"muted",children:f.kind}),r.jsxs("span",{className:"font-mono text-xs text-muted-fg",children:["…",f.token_suffix]}),r.jsxs("span",{className:"ml-auto text-xs text-muted-fg",children:["visto: ",f.last_seen?new Date(f.last_seen).toLocaleString():"nunca"]}),r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>d(f.id),children:"Revocar"})]},f.id))}),r.jsx(S8,{open:l,onClose:()=>c(!1),onPaired:()=>o()})]})}const k8=[{key:"daemon",label:"Daemon",description:"~/.apx/config.json. Config general APX.",fields:[{path:"port",label:"Port",kind:"number",placeholder:"7430"},{path:"host",label:"Host",placeholder:"127.0.0.1"},{path:"log_level",label:"Log level",placeholder:"info"},{path:"user.language",label:"Idioma",placeholder:"es"},{path:"user.locale",label:"Locale",placeholder:"es-AR"},{path:"user.timezone",label:"Timezone",placeholder:"America/Argentina/Salta"}]},{key:"super-agent",label:"Super-agente",fields:[{path:"super_agent.enabled",label:"Super-agente habilitado",kind:"boolean"},{path:"super_agent.model",label:"Modelo",placeholder:"gemini:gemini-2.5-flash"},{path:"super_agent.permission_mode",label:"Permission mode",kind:"select",options:bx.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:"Prompt extra",kind:"textarea"}]},{key:"telegram",label:"Telegram",fields:[{path:"telegram.enabled",label:"Polling habilitado",kind:"boolean"},{path:"telegram.poll_interval_ms",label:"Poll interval ms",kind:"number",placeholder:"1500"},{path:"telegram.respond_with_engine",label:"Responder con engine",kind:"boolean"},{path:"telegram.route_to_agent",label:"Route to agent",placeholder:"master"},{path:"telegram.channels.0.chat_id",label:"Default chat ID"},{path:"telegram.channels.0.bot_token",label:"Default bot token",kind:"password"}]},{key:"engines",label:"Engines",fields:[{path:"engines.anthropic.api_key",label:"Anthropic API key",kind:"password"},{path:"engines.openai.api_key",label:"OpenAI API key",kind:"password"},{path:"engines.openai.base_url",label:"OpenAI base URL",placeholder:"https://api.openai.com/v1"},{path:"engines.groq.api_key",label:"Groq API key",kind:"password"},{path:"engines.groq.base_url",label:"Groq base URL",placeholder:"https://api.groq.com/openai/v1"},{path:"engines.openrouter.api_key",label:"OpenRouter API key",kind:"password"},{path:"engines.openrouter.base_url",label:"OpenRouter base URL",placeholder:"https://openrouter.ai/api/v1"},{path:"engines.gemini.api_key",label:"Gemini API key",kind:"password"},{path:"engines.ollama.base_url",label:"Ollama URL",placeholder:"http://localhost:11434"}]}];function E8(){const{config:e,isLoading:n,patch:s,mutate:o}=Dr();if(n)return r.jsx(nt,{});const l=async c=>{const d={};for(const[f,p]of Object.entries(jb(c)))qa(p)||(d[f]=p);await s(d),o()};return r.jsx(Ge,{title:j("global_config.title"),description:"Config general en ~/.apx/config.json. Editable por tabs; JSON queda separado.",children:r.jsx($h,{sections:k8,source:e,jsonTitle:"~/.apx/config.json",jsonDescription:"Secretos redacted no se sobrescriben.",onSaveFields:async(c,d)=>{await s(c,d),o()},onSaveJson:l})})}function N8(){const e=at(),{health:n,isUp:s}=fC(),o=async()=>{try{await Cl.reload(),e.success("Config recargada.")}catch(l){e.error(l.message)}};return r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ge,{title:j("daemon.version"),action:r.jsx(ge,{size:"sm",onClick:o,children:j("common.reload")}),children:r.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[r.jsx(oh,{label:j("daemon.version"),value:n?.version||"—"}),r.jsx(oh,{label:j("daemon.uptime"),value:n?`${n.uptime_s}s`:"—"}),r.jsx(oh,{label:j("daemon.status"),value:j(s?"daemon.running":"daemon.down"),ok:s})]})}),r.jsx(E8,{})]})}function oh({label:e,value:n,ok:s}){return r.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[r.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),r.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[s!==void 0&&r.jsx(Rf,{ok:s}),r.jsx("span",{children:n})]})]})}function R8(){const e=at(),{theme:n,set:s}=vx(),[o,l]=h.useState(""),[c,d]=h.useState(kO()),f=()=>{const m=o.trim();if(m){so(m);try{localStorage.setItem(Rn.token,m)}catch{}l(""),e.success(j("settings.token_saved"))}},p=m=>{SO(m),d(m),window.location.reload()};return r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[r.jsx(Ge,{title:j("settings.appearance"),children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ge,{variant:n==="light"?"primary":"secondary",onClick:()=>s("light"),children:j("settings.light_mode")}),r.jsx(ge,{variant:n==="dark"?"primary":"secondary",onClick:()=>s("dark"),children:j("settings.dark_mode")})]})}),r.jsx(Ge,{title:j("settings.language"),children:r.jsx("div",{className:"flex items-center gap-2",children:CO.map(m=>r.jsx(ge,{variant:c===m.value?"primary":"secondary",onClick:()=>p(m.value),children:m.label},m.value))})}),r.jsxs(Ge,{title:j("settings.token"),description:j("settings.token_sub"),children:[r.jsx(de,{label:"Bearer",children:r.jsx(ke,{type:"password",placeholder:tb()?j("settings.token_active"):j("settings.token_paste"),value:o,onChange:m=>l(m.target.value),className:"font-mono",onKeyDown:m=>{m.key==="Enter"&&f()}})}),r.jsx("div",{className:"mt-2",children:r.jsx(ge,{variant:"primary",onClick:f,children:j("common.save")})})]})]})}const T8=[{title:j("settings.account_section"),items:[{key:"identity",label:j("settings.tabs.identity"),icon:xx},{key:"appearance",label:j("settings.appearance"),icon:cA}]},{title:j("settings.agents_section"),items:[{key:"super_agent",label:j("settings.tabs.super_agent"),icon:gn},{key:"engines",label:j("settings.tabs.engines"),icon:dx},{key:"memory",label:"Memoria (RAG)",icon:Yw},{key:"skills",label:"Skills (RAG)",icon:ls}]},{title:j("settings.channels_section"),items:[{key:"telegram",label:j("settings.tabs.telegram"),icon:Ya},{key:"devices",label:j("settings.tabs.devices"),icon:mA}]},{title:j("settings.advanced_section"),items:[{key:"advanced",label:j("settings.tabs.advanced"),icon:Dd}]}],A8=new Set(["engines","telegram","memory","skills","appearance"]),M8={identity:()=>r.jsx(UP,{}),super_agent:()=>r.jsx(HP,{}),engines:()=>r.jsx(BC,{}),memory:()=>r.jsx($P,{}),skills:()=>r.jsx(FP,{}),telegram:()=>r.jsx(ZP,{}),devices:()=>r.jsx(C8,{}),appearance:()=>r.jsx(R8,{}),advanced:()=>r.jsx(N8,{})};function O8(){const e=_a(),n=Yn(),s=z8(n.pathname),o=M8[s],{collapsed:l,toggle:c}=hC(Rn.sidebarCollapsed+".settings");return r.jsx(wC,{sections:T8,active:s,onChange:d=>e(d==="identity"?"/settings":`/settings/${D8(d)}`),collapsed:l,onToggleCollapse:c,contentClassName:`w-full ${A8.has(s)?"":"mx-auto max-w-3xl"} space-y-6 p-6 pt-3`,testId:`settings-tab-${s}`,children:r.jsx(o,{})})}function z8(e){switch(e.split("/").filter(Boolean)[1]||"identity"){case"super-agent":return"super_agent";case"engines":return"engines";case"memory":return"memory";case"skills":return"skills";case"telegram":return"telegram";case"devices":return"devices";case"appearance":return"appearance";case"config":case"advanced":return"advanced";default:return"identity"}}function D8(e){return e==="super_agent"?"super-agent":e==="advanced"?"config":e}function L8({engines:e,order:n,mode:s,configuredProvider:o,onSetMode:l,onSetDefault:c,onToggleEnabled:d,onReorder:f,onConfigure:p,busy:m}){const g=new Map(e.map(C=>[C.id,C])),b=[...n.filter(C=>g.has(C)),...e.map(C=>C.id).filter(C=>!n.includes(C))],v=s==="chain",S=(C,_)=>{const w=b.indexOf(C),k=w+_;if(w<0||k<0||k>=b.length)return;const E=[...b];[E[w],E[k]]=[E[k],E[w]],f(E)};return r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"rounded-lg border border-border p-3",children:r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:"Modo de selección"}),r.jsx("div",{className:"text-xs text-muted-fg",children:v?"Cadena con fallback: usa el primer motor disponible según el orden de abajo.":"Solo el motor por defecto: usa siempre el elegido; los demás quedan configurados para otras cosas."})]}),r.jsxs("div",{className:"flex shrink-0 overflow-hidden rounded-md border border-border",role:"group",children:[r.jsx("button",{type:"button",onClick:()=>l("chain"),disabled:m,"data-testid":"voice-mode-chain",className:Oe("px-3 py-1.5 text-xs font-medium transition-colors",v?"bg-emerald-500/15 text-emerald-300":"text-muted-fg hover:text-fg"),children:"Cadena (router)"}),r.jsx("button",{type:"button",onClick:()=>l("single"),disabled:m,"data-testid":"voice-mode-single",className:Oe("border-l border-border px-3 py-1.5 text-xs font-medium transition-colors",v?"text-muted-fg hover:text-fg":"bg-emerald-500/15 text-emerald-300"),children:"Solo el motor por defecto"})]})]})}),r.jsx("div",{className:"space-y-2",children:b.map((C,_)=>{const w=g.get(C),k=Zd[C]||{name:C,note:""},E=!v&&o===C,N=C==="mock";return r.jsxs("div",{"data-testid":`voice-provider-${C}`,className:Oe("flex items-center gap-3 rounded-lg border px-3 py-2.5",E?"border-emerald-500/50 bg-emerald-500/10":"border-border",v&&!N&&!w.enabled&&"opacity-60"),children:[v&&r.jsxs("div",{className:"flex flex-col",children:[r.jsx("button",{type:"button",onClick:()=>S(C,-1),disabled:m||_===0,"aria-label":"Subir","data-testid":`voice-provider-${C}-up`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:r.jsx(Fw,{className:"size-3.5"})}),r.jsx("button",{type:"button",onClick:()=>S(C,1),disabled:m||_===b.length-1,"aria-label":"Bajar","data-testid":`voice-provider-${C}-down`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:r.jsx(Tr,{className:"size-3.5"})})]}),r.jsx(Rf,{ok:w.available?!0:w.configured?!1:null}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm font-medium",children:k.name}),k.local&&r.jsx(Ve,{tone:"info",children:"local"}),w.available?r.jsx(Ve,{tone:"success",children:"disponible"}):w.configured?r.jsx(Ve,{tone:"warning",children:"configurado, no disponible"}):r.jsx(Ve,{tone:"muted",children:"sin configurar"}),E&&r.jsx(Ve,{tone:"success",children:"por defecto"})]}),r.jsx("div",{className:"truncate text-xs text-muted-fg",children:k.note})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[v?r.jsx(Zt,{checked:N?!0:w.enabled,onChange:R=>d(C,R),disabled:m||N}):!E&&r.jsxs(ge,{size:"sm",variant:"ghost",onClick:()=>c(C),disabled:m,"data-testid":`voice-provider-${C}-default`,children:[r.jsx(DT,{className:"size-3.5"})," Usar por defecto"]}),E&&r.jsx(ux,{className:"size-4 text-emerald-400"}),r.jsxs(ge,{size:"sm",variant:"secondary",onClick:()=>p(C),"data-testid":`voice-provider-${C}-config`,children:[r.jsx(pA,{className:"size-3.5"})," Configurar"]})]})]},C)})})]})}function Ma(e){return typeof e=="string"?e:e==null?"":String(e)}function P8({open:e,providerId:n,config:s,onClose:o,onSave:l}){const[c,d]=h.useState(!1),[f,p]=h.useState(null),[m,g]=h.useState(""),[b,v]=h.useState({});if(h.useEffect(()=>{if(!e||!n)return;p(null),g("");const R=s||{};if(n==="piper"){const T=R;v({bin:Ma(T.bin),model:Ma(T.model),speaker:Ma(T.speaker)})}else if(n==="elevenlabs"){const T=R;v({model:Ma(T.model),voice_id:Ma(T.voice_id),output_format:Ma(T.output_format)})}else if(n==="openai"){const T=R;v({model:Ma(T.model)||"tts-1",voice:Ma(T.voice)||"alloy",format:Ma(T.format)||"mp3"})}else if(n==="gemini"){const T=R;v({model:Ma(T.model),voice:Ma(T.voice)||"Kore",style:Ma(T.style)})}else v({})},[e,n,s]),!n)return null;const S=Zd[n],C=`voice.tts.${n}`,_=R=>v(T=>({...T,...R})),w=n!=="piper"&&n!=="mock",k=w&&qa(s?.api_key),E=k?`…${El(s?.api_key)??""} (ya seteada)`:"API key",N=async()=>{d(!0),p(null);try{const R={},T=[],O=(A,z)=>{z.trim()?R[`${C}.${A}`]=z.trim():T.push(`${C}.${A}`)};n==="piper"?(O("bin",b.bin),O("model",b.model),b.speaker.trim()?R[`${C}.speaker`]=b.speaker.trim():T.push(`${C}.speaker`)):n==="elevenlabs"?(O("model",b.model),O("voice_id",b.voice_id),O("output_format",b.output_format)):n==="openai"?(O("model",b.model),O("voice",b.voice),O("format",b.format)):n==="gemini"&&(O("model",b.model),O("voice",b.voice),O("style",b.style)),w&&m.trim()&&(R[`${C}.api_key`]=m.trim()),await l({set:R,unset:T}),o()}catch(R){p(R.message||"Error al guardar.")}finally{d(!1)}};return r.jsx(Vn,{open:e,onClose:o,title:j("voice_screen.configure_provider",{name:S?.name||n||""}),description:S?.note,size:"md",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:o,disabled:c,children:"Cancelar"}),r.jsx(ge,{variant:"primary",onClick:N,loading:c,"data-testid":"voice-provider-save",children:"Guardar"})]}),children:r.jsxs("div",{className:"space-y-3",children:[n==="piper"&&r.jsxs(r.Fragment,{children:[r.jsx(de,{label:"Binario (bin)",hint:"Ruta o nombre del CLI piper (PATH).",children:r.jsx(ke,{value:b.bin,onChange:R=>_({bin:R.target.value}),placeholder:"piper"})}),r.jsx(de,{label:"Modelo (.onnx)",hint:"Ruta absoluta al modelo de voz piper.",children:r.jsx(ke,{value:b.model,onChange:R=>_({model:R.target.value}),placeholder:"/abs/path/voz.onnx"})}),r.jsx(de,{label:"Speaker (opcional)",hint:"Id de hablante para modelos multi-voz.",children:r.jsx(ke,{value:b.speaker,onChange:R=>_({speaker:R.target.value}),placeholder:"0"})})]}),n==="elevenlabs"&&r.jsxs(r.Fragment,{children:[r.jsx(de,{label:"API key",hint:k?"Dejá en blanco para mantener la actual.":"Se guarda como secreto. Env: ELEVENLABS_API_KEY",children:r.jsx(ke,{type:"password",autoComplete:"new-password",value:m,onChange:R=>g(R.target.value),placeholder:E})}),r.jsx(de,{label:"Modelo",children:r.jsx(wt,{value:b.model||"",onChange:R=>_({model:R}),options:xO.map(R=>({value:R,label:R})),placeholder:"eleven_multilingual_v2"})}),r.jsx(de,{label:"Voice ID",hint:"Id de la voz de ElevenLabs (vacío = default).",children:r.jsx(ke,{value:b.voice_id,onChange:R=>_({voice_id:R.target.value}),placeholder:"EXAVITQu4vr4xnSDxMaL"})}),r.jsx(de,{label:"Formato de salida",children:r.jsx(ke,{value:b.output_format,onChange:R=>_({output_format:R.target.value}),placeholder:"mp3_44100_128"})})]}),n==="openai"&&r.jsxs(r.Fragment,{children:[r.jsx(de,{label:"API key",hint:k?"Dejá en blanco para mantener la actual.":"Se reusa engines.openai.api_key si la dejás en blanco. Env: OPENAI_API_KEY",children:r.jsx(ke,{type:"password",autoComplete:"new-password",value:m,onChange:R=>g(R.target.value),placeholder:E})}),r.jsx(de,{label:"Modelo",children:r.jsx(wt,{value:b.model||"tts-1",onChange:R=>_({model:R}),options:bO.map(R=>({value:R,label:R}))})}),r.jsx(de,{label:"Voz",children:r.jsx(wt,{value:b.voice||"alloy",onChange:R=>_({voice:R}),options:gO.map(R=>({value:R,label:R}))})}),r.jsx(de,{label:"Formato",children:r.jsx(wt,{value:b.format||"mp3",onChange:R=>_({format:R}),options:["mp3","opus","aac","flac","wav"].map(R=>({value:R,label:R}))})})]}),n==="gemini"&&r.jsxs(r.Fragment,{children:[r.jsx(de,{label:"API key",hint:k?"Dejá en blanco para mantener la actual.":"Se reusa engines.gemini.api_key si la dejás en blanco. Env: GEMINI_API_KEY",children:r.jsx(ke,{type:"password",autoComplete:"new-password",value:m,onChange:R=>g(R.target.value),placeholder:E})}),r.jsx(de,{label:"Modelo",hint:"TTS de Gemini sigue en preview.",children:r.jsx(ke,{value:b.model,onChange:R=>_({model:R.target.value}),placeholder:"gemini-2.5-flash-preview-tts"})}),r.jsx(de,{label:"Voz",children:r.jsx(wt,{value:b.voice||"Kore",onChange:R=>_({voice:R}),options:hO.map(R=>({value:R,label:R}))})}),r.jsx(de,{label:"Estilo (cómo querés que hable)",hint:"Instrucción en lenguaje natural. Vacío = sin estilo. Ej: 'hablá en tono alegre y pausado'.",children:r.jsx(cn,{rows:2,value:b.style||"",onChange:R=>_({style:R.target.value}),placeholder:"hablá en tono alegre y enérgico"})})]}),n==="mock"&&r.jsxs("p",{className:"text-sm text-muted-fg",children:["El motor ",r.jsx("strong",{children:"mock"})," genera un WAV silencioso de prueba. No tiene parámetros: sirve como fallback garantizado cuando no hay otro motor configurado."]}),f&&r.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:f})]})})}function I8(){const e=h.useRef(null),n=h.useRef(null),[s,o]=h.useState(!1),[l,c]=h.useState(!1),d=h.useCallback(()=>{n.current&&(URL.revokeObjectURL(n.current),n.current=null)},[]);h.useEffect(()=>()=>{e.current&&(e.current.pause(),e.current=null),d()},[d]);const f=h.useCallback(async m=>{c(!0);try{d();const g=await yO(m);n.current=g,e.current||(e.current=new Audio);const b=e.current;b.src=g,b.onended=()=>o(!1),b.onerror=()=>o(!1),await b.play(),o(!0)}finally{c(!1)}},[d]),p=h.useCallback(()=>{e.current&&(e.current.pause(),e.current.currentTime=0),o(!1)},[]);return{play:f,stop:p,playing:s,loading:l}}function B8({engines:e,defaultProvider:n,mode:s}){const o=at(),{play:l,stop:c,playing:d,loading:f}=I8(),[p,m]=h.useState("Hola, soy APX. Esto es una prueba de voz."),[g,b]=h.useState(""),[v,S]=h.useState(""),[C,_]=h.useState(!1),[w,k]=h.useState(null),N=[{value:"",label:s==="single"&&n&&n!=="auto"?`Por defecto (${Zd[n]?.name||n})`:"Por defecto (cadena)"},...e.map(T=>({value:T.id,label:`${Zd[T.id]?.name||T.id}${T.available?"":" · no disponible"}`}))],R=async()=>{const T=p.trim();if(!T){o.error("Escribí algo para decir.");return}_(!0);try{const O=await $2.say({text:T,provider:g||void 0,style:v.trim()||void 0});k(O),await l(O.audio_path)}catch(O){o.error(O.message||"No se pudo sintetizar.")}finally{_(!1)}};return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsx(de,{label:"Motor",hint:"Override del por defecto para probar.",children:r.jsx(wt,{value:g,onChange:b,options:N})}),r.jsx(de,{label:"Estilo (solo Gemini)",hint:"Cómo querés que hable. Vacío = sin estilo.",children:r.jsx(ke,{value:v,onChange:T=>S(T.target.value),placeholder:"hablá en tono alegre y enérgico","data-testid":"voice-test-style"})})]}),r.jsx(de,{label:"Texto a decir",children:r.jsx(cn,{rows:2,value:p,onChange:T=>m(T.target.value),placeholder:"Escribí lo que querés que diga…","data-testid":"voice-test-input"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ge,{variant:"primary",onClick:R,loading:C,disabled:f,"data-testid":"voice-test-say",children:[r.jsx(vA,{className:"size-4"})," Decir esto"]}),d?r.jsxs(ge,{variant:"secondary",onClick:c,"data-testid":"voice-test-stop",children:[r.jsx(nS,{className:"size-4"})," Parar"]}):w?r.jsxs(ge,{variant:"secondary",onClick:()=>l(w.audio_path),loading:f,"data-testid":"voice-test-replay",children:[r.jsx(gx,{className:"size-4"})," Repetir"]}):null,w&&r.jsxs("span",{className:"text-xs text-muted-fg",children:["Motor: ",r.jsx("strong",{children:w.provider}),w.duration_s?` · ${w.duration_s.toFixed(1)}s`:""]})]})]})}const U8=[{value:"auto",label:"Automático (local, luego OpenAI)"},{value:"local",label:"Local — faster-whisper (offline)"},{value:"openai",label:"OpenAI — Whisper-1 (cloud)"}],H8=[{value:"auto",label:"Auto-detectar"},{value:"es",label:"Español"},{value:"en",label:"Inglés"},{value:"pt",label:"Portugués"},{value:"fr",label:"Francés"},{value:"it",label:"Italiano"},{value:"de",label:"Alemán"}];function V8({config:e,onPatch:n,busy:s}){const o=e.provider||"auto",l=e.local||{},c=l.model||"small",d=l.language||"auto",f=o!=="openai";return r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:"Motor de transcripción",hint:"Local usa faster-whisper (requiere python3 + faster-whisper). OpenAI usa la key de engines.openai.",children:r.jsx(wt,{value:o,onChange:p=>n({"transcription.provider":p}),options:U8,disabled:s,className:"max-w-md"})}),f&&r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(de,{label:"Modelo local (whisper)",hint:"Más grande = más preciso y más lento.",children:r.jsx(wt,{value:c,onChange:p=>n({"transcription.local.model":p}),options:vO.map(p=>({value:p,label:p})),disabled:s})}),r.jsx(de,{label:"Idioma",hint:'Para español, fijá "Español" mejora la precisión.',children:r.jsx(wt,{value:d,onChange:p=>n({"transcription.local.language":p}),options:H8,disabled:s})})]})]})}function q8(){const e=at(),{config:n,isLoading:s,patch:o,mutate:l}=Dr(),{data:c,isLoading:d,error:f,mutate:p}=Qe("/tts/providers",()=>$2.providers()),[m,g]=h.useState(null),[b,v]=h.useState(!1),S=n,C=S.voice?.tts||{},_=S.transcription||{},w=c?.configured_provider||C.provider||"auto",k=c?.mode||C.mode||"chain",E=c?.engines||[],N=c?.order||[],R=h.useMemo(()=>m?C[m]||{}:{},[m,C]),T=async D=>{v(!0);try{await o({"voice.tts.provider":D,"voice.tts.mode":"single"}),await p(),e.success(`Motor por defecto: ${D}.`)}catch(P){e.error(P.message)}finally{v(!1)}},O=async D=>{v(!0);try{const P={"voice.tts.mode":D};if(D==="single"&&(w==="auto"||!w)){const H=E.find(q=>q.available)?.id||N[0]||"mock";P["voice.tts.provider"]=H}await o(P),await p(),e.success(D==="chain"?"Modo: cadena con fallback.":"Modo: solo el motor por defecto.")}catch(P){e.error(P.message)}finally{v(!1)}},A=async(D,P)=>{v(!0);try{await o({[`voice.tts.${D}.enabled`]:P}),await p()}catch(H){e.error(H.message)}finally{v(!1)}},z=async D=>{v(!0);try{await o({"voice.tts.order":D}),await p()}catch(P){e.error(P.message)}finally{v(!1)}},B=async({set:D,unset:P})=>{await o(D,P.length?P:void 0),await p(),await l(),e.success("Configuración de voz guardada.")},L=async(D,P)=>{try{await o(D,P),e.success("Transcripción actualizada.")}catch(H){e.error(H.message)}};return r.jsxs("div",{className:"p-6","data-testid":"screen-voice",children:[r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2",children:[r.jsx(Ge,{title:j("voice_screen.providers_title"),description:"Motores de síntesis. El estado lo reporta el daemon en vivo. Elegí cuál usar por defecto.",children:d||s?r.jsx(nt,{}):f?r.jsxs(pt,{children:["No se pudieron cargar los proveedores: ",f.message]}):r.jsx(L8,{engines:E,order:N,mode:k,configuredProvider:w,onSetMode:O,onSetDefault:T,onToggleEnabled:A,onReorder:z,onConfigure:D=>g(D),busy:b})}),r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ge,{title:j("voice_screen.test_title"),description:"Elegí con qué motor sintetizar y, si aplica, cómo querés que hable.",children:r.jsx(B8,{engines:E,defaultProvider:w,mode:k})}),r.jsx(Ge,{title:j("voice_screen.stt_title"),description:"Motor de voz a texto que usan el deck, Telegram y la CLI al escuchar.",children:s?r.jsx(nt,{}):r.jsx(V8,{config:_,onPatch:L})})]})]}),r.jsx(P8,{open:!!m,providerId:m,config:R,onClose:()=>g(null),onSave:B})]})}const lh={status:()=>me.get("/desktop/status"),autostartGet:()=>me.get("/desktop/autostart"),autostartSet:e=>me.post("/desktop/autostart",{enable:e})};function $8(e=30){return me.get(`/messages/global?channel=desktop&limit=${e}`)}const Wj="CommandOrControl+G",G8=[{value:"left",label:"Izquierda"},{value:"center",label:"Centro"},{value:"right",label:"Derecha"}],F8=[{value:"light",label:"Claro"},{value:"dark",label:"Oscuro"}];function Y8(){const e=at(),{config:n,isLoading:s,patch:o}=Dr(),l=n,c=l.desktop?.shortcut||l.overlay?.shortcut||Wj,d=l.desktop?.enabled!==!1,f=l.desktop?.theme||"light",p=l.desktop?.position||"right",{data:m,isLoading:g,mutate:b}=Qe("/desktop/status",()=>lh.status(),{refreshInterval:5e3}),v=!!m?.running,{data:S,mutate:C}=Qe("/desktop/autostart",()=>lh.autostartGet()),{data:_,isLoading:w,mutate:k}=Qe("/messages/global?channel=desktop",()=>$8(40),{refreshInterval:8e3}),[E,N]=h.useState(c),[R,T]=h.useState(!1),[O,A]=h.useState(!1);h.useEffect(()=>N(c),[c]);const z=async()=>{const D=E.trim();if(!(!D||D===c)){T(!0);try{await o({"desktop.shortcut":D}),e.success("Atajo guardado. Reiniciá la ventana (apx desktop stop && start) para aplicarlo.")}catch(P){e.error(P.message)}finally{T(!1)}}},B=async(D,P,H)=>{T(!0);try{await o({[D]:P}),e.success(H)}catch(q){e.error(q.message)}finally{T(!1)}},L=async D=>{A(!0);try{await lh.autostartSet(D),await C(),e.success(D?"Autostart activado para el próximo login.":"Autostart desactivado.")}catch(P){e.error(P.message)}finally{A(!1)}};return r.jsx("div",{className:"mx-auto max-w-6xl space-y-6 p-6","data-testid":"screen-desktop",children:r.jsxs("div",{className:"grid gap-6 xl:grid-cols-[1fr_1fr]",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ge,{title:j("desktop_screen.status_title"),description:"La ventana se lanza desde la terminal o por autostart.",children:[g?r.jsx(nt,{}):r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Rf,{ok:v}),r.jsx("span",{className:"font-medium",children:v?"En ejecución":"Detenida"}),r.jsx("button",{type:"button",onClick:()=>b(),className:"ml-2 text-xs text-muted-fg underline-offset-2 hover:underline",children:"refrescar"})]}),r.jsxs("p",{className:"mt-3 text-xs text-muted-fg",children:["Desde terminal: ",r.jsx(U_,{children:"apx desktop start"})," · ",r.jsx(U_,{children:"apx desktop --debug"})]})]}),r.jsx(Ge,{title:j("desktop_screen.autostart_title"),description:"Lanza la ventana al iniciar sesión del usuario. Equivalente a `apx desktop install` (no requiere sudo).",children:S?r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(Zt,{checked:S.enabled,onChange:L,disabled:O,label:S.enabled?"Activado":"Desactivado"}),r.jsxs("span",{className:"text-xs text-muted-fg",children:["platform: ",S.platform]})]}):r.jsx(nt,{})}),r.jsx(Ge,{title:j("desktop_screen.shortcut_title"),description:"Botón de acceso rápido global que muestra/oculta la ventana y arranca a escuchar.",children:s?r.jsx(nt,{}):r.jsxs("div",{className:"flex items-end gap-3",children:[r.jsx("div",{className:"flex-1",children:r.jsx(de,{label:"Acelerador",hint:'Formato Electron, p. ej. "CommandOrControl+G" o "CommandOrControl+Shift+Space". Reiniciá la ventana para aplicar.',children:r.jsx(ke,{value:E,onChange:D=>N(D.target.value),onKeyDown:D=>{D.key==="Enter"&&z()},placeholder:Wj,className:"max-w-md font-mono",disabled:R})})}),r.jsx(ge,{variant:"primary",onClick:z,loading:R,disabled:!E.trim()||E.trim()===c,children:"Guardar"})]})}),r.jsx(Ge,{title:j("desktop_screen.appearance_title"),description:"Tema y posición de la ventana en la pantalla.",children:s?r.jsx(nt,{}):r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(de,{label:"Tema",hint:"Reiniciá la ventana para aplicar.",children:r.jsx(wt,{value:f,onChange:D=>B("desktop.theme",D,`Tema: ${D}.`),options:F8,disabled:R})}),r.jsx(de,{label:"Posición",hint:'"izquierda" / "centro" / "derecha" del borde superior.',children:r.jsx(wt,{value:p,onChange:D=>B("desktop.position",D,`Posición: ${D}.`),options:G8,disabled:R})})]})}),r.jsx(Ge,{title:j("desktop_screen.activation_title"),description:"El plugin del daemon procesa los mensajes. STT se configura en Voces.",children:s?r.jsx(nt,{}):r.jsxs("div",{className:"space-y-3",children:[r.jsx(Zt,{checked:d,onChange:D=>B("desktop.enabled",D,D?"Desktop activado.":"Desktop desactivado."),disabled:R,label:d?"Plugin activado (responde mensajes)":"Plugin desactivado"}),r.jsxs("p",{className:"text-xs text-muted-fg",children:["Motor de voz a texto: ",r.jsx(cx,{to:"/m/voice",className:"font-medium text-fg underline underline-offset-2",children:"Voces"})," ","(whisper local, idioma, modelo)."]})]})})]}),r.jsx("div",{children:r.jsx(Ge,{title:j("desktop_screen.last_conv_title"),description:"Lo último charlado con el agente desde la ventana flotante.",action:r.jsx("button",{type:"button",onClick:()=>k(),className:"text-xs text-muted-fg underline-offset-2 hover:underline",children:"refrescar"}),children:r.jsx(X8,{messages:_||[],loading:w})})})]})})}function X8({messages:e,loading:n}){const s=h.useMemo(()=>Q8(e),[e]);return n?r.jsx(nt,{}):e.length?r.jsx("div",{className:"space-y-3 max-h-[560px] overflow-y-auto pr-1",children:s.slice().reverse().map((o,l)=>r.jsx("div",{className:"rounded-lg border border-border bg-card/40 p-3",children:o.map((c,d)=>r.jsx(K8,{m:c},d))},l))}):r.jsx(pt,{children:"Sin mensajes todavía. Mandale algo a la ventana de escritorio para que aparezca aquí."})}function K8({m:e}){const n=e.direction==="in",s=Z8(e.ts);return r.jsxs("div",{className:"py-1",children:[r.jsxs("div",{className:"flex items-baseline gap-2 text-[11px] text-muted-fg",children:[r.jsx("span",{className:"font-semibold",children:n?"Vos":"Roby"}),r.jsx("span",{children:s})]}),r.jsx("div",{className:"mt-0.5 text-sm leading-snug whitespace-pre-wrap "+(n?"text-muted-fg":"text-fg"),children:(e.body||"").trim()||r.jsx("span",{className:"italic opacity-50",children:"(vacío)"})})]})}function Q8(e){const n=[];for(const s of e)s.direction==="in"||!n.length?n.push([s]):n[n.length-1].push(s);return n}function Z8(e){try{const n=new Date(e);return n.toDateString()===new Date().toDateString()?n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):n.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return""}}function W8(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}function J8({manifest:e}){const n=e.daemon,s=e.safety;return r.jsxs("div",{"data-testid":"deck-daemon-card",className:"rounded-xl border border-border bg-muted/10 px-4 py-3 text-xs",children:[r.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("span",{className:"font-semibold text-foreground",children:[n.name," ",r.jsxs("span",{className:"font-normal text-muted-fg",children:["v",n.version]})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"size-2 rounded-full bg-emerald-500"}),r.jsxs("span",{className:"text-muted-fg",children:["activo · ",W8(n.uptime_s)]})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs("span",{className:"text-muted-fg",children:[n.host,":",n.port]}),r.jsx("span",{className:"text-muted-fg",children:"·"}),r.jsxs("span",{className:"text-muted-fg",children:["iniciado"," ",new Date(n.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),r.jsxs("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[s.direct_shell===!1&&r.jsx(Ve,{tone:"success",children:"sin shell directo"}),s.arbitrary_commands===!1&&r.jsx(Ve,{tone:"success",children:"comandos arbitrarios bloqueados"}),s.dangerous_actions_require_confirmation&&r.jsx(Ve,{tone:"info",children:"acciones peligrosas requieren confirmación"})]})]})}function e7(e){return e==="available"?"success":e==="configured"?"info":"muted"}function t7(e){return e==="available"?"activo":e==="configured"?"configurado":e==="disabled"?"deshabilitado":"sin configurar"}function n7(e){return e==="voice"?"warning":e==="plugin"?"info":"muted"}function a7({widget:e,onToggle:n}){const s=e.source==="external",[o,l]=h.useState(!1),c=e.user_enabled===!0,d=async f=>{if(!(!n||o)){l(!0);try{await n(f)}finally{l(!1)}}};return r.jsxs("li",{"data-testid":`deck-widget-${e.id}`,className:Oe("flex items-center gap-3 rounded-lg border px-3 py-2.5 text-sm transition-colors",s?"border-border bg-muted/20 hover:border-muted-fg/30":"border-border/50 bg-muted/10"),children:[r.jsx("span",{title:e.source==="apx"?j("deck_screen.widget_native"):j("deck_screen.widget_external"),className:Oe("size-2 shrink-0 rounded-full",e.source==="apx"?"bg-emerald-500":"bg-sky-400")}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"font-medium",children:e.title}),r.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:e.desktop})]}),r.jsx(Ve,{tone:n7(e.kind),children:e.kind}),r.jsx(Ve,{tone:e7(e.status),children:t7(e.status)}),s?r.jsx("span",{"data-testid":`deck-widget-toggle-${e.id}`,children:r.jsx(Zt,{checked:c,onChange:d,disabled:o||!n})}):r.jsx("span",{className:"w-9 shrink-0","aria-hidden":!0})]})}function s7({desktop:e,widgets:n,onToggle:s}){return n.length===0?null:r.jsxs("div",{"data-testid":`deck-desktop-${e.id}`,className:"space-y-1.5",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-fg",children:e.title}),r.jsx("ul",{className:"space-y-1.5",children:n.map(o=>r.jsx(a7,{widget:o,onToggle:o.source==="external"?l=>s(o.id,l):void 0},o.id))})]})}function r7(){const e=at(),{data:n,error:s,isLoading:o,mutate:l}=Qe("/deck/manifest",()=>B_.manifest(),{refreshInterval:3e4}),c=async(b,v)=>{try{await B_.setWidget(b,{enabled:v}),await l(S=>S&&{...S,deck:{...S.deck,widgets:S.deck.widgets.map(C=>C.id===b?{...C,user_enabled:v,status:v?C.daemon_status?"available":"configured":"disabled"}:C)}},{revalidate:!1}),e.success(v?`Widget ${b} habilitado.`:`Widget ${b} deshabilitado.`),setTimeout(()=>l(),800)}catch(S){const C=S instanceof Error?S.message:"Error al guardar";e.error(C)}},d=n?.deck.desktops??[],f=n?.deck.widgets??[],p=d.map(b=>({desktop:b,widgets:f.filter(v=>v.desktop===b.id)})),g=f.filter(b=>b.source==="external").filter(b=>b.user_enabled===!0).length;return r.jsxs("div",{className:"mx-auto max-w-4xl space-y-6 p-6","data-testid":"screen-deck",children:[n&&r.jsx(J8,{manifest:n}),r.jsxs(Ge,{title:j("deck_screen.widgets_title"),description:o?"Cargando manifest…":s?"Error al cargar el manifest.":`${f.length} widgets · ${g} externos habilitados`,action:r.jsx(ge,{size:"sm",variant:"ghost",onClick:()=>l(),disabled:o,title:j("deck_screen.reload_manifest"),"aria-label":j("deck_screen.reload_manifest"),children:r.jsx(os,{size:14,className:o?"animate-spin":""})}),children:[o&&r.jsx(nt,{label:"Cargando manifest del Deck…"}),!o&&s&&r.jsxs(pt,{children:["No se pudo cargar el manifest del Deck."," ",r.jsx("button",{type:"button",className:"ml-1 underline",onClick:()=>l(),children:"Reintentar"})]}),!o&&!s&&f.length===0&&r.jsx(pt,{children:"No hay widgets en el manifest."}),!o&&!s&&f.length>0&&r.jsx("div",{className:"space-y-5","data-testid":"deck-desktop-list",children:p.filter(b=>b.widgets.length>0).map(b=>r.jsx(s7,{desktop:b.desktop,widgets:b.widgets,onToggle:c},b.desktop.id))})]}),n?.apx&&r.jsx(Ge,{title:j("deck_screen.context_title"),description:"Información que el Deck ve del daemon.",children:r.jsxs("div",{className:"space-y-2 text-sm","data-testid":"deck-apx-context",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:"Proyecto activo:"}),r.jsx("span",{className:"font-medium",children:n.apx.active_project?n.apx.active_project.name:"ninguno"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:"Proyectos registrados:"}),r.jsx("span",{className:"font-medium",children:n.apx.projects.length})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:"Plugins activos:"}),r.jsx("span",{className:"font-medium",children:Object.keys(n.apx.plugins).join(", ")||"—"})]})]})})]})}function o7(e,n){const s=getComputedStyle(e),o=parseFloat(s.fontSize);return n*o}function l7(e,n){const s=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(s.fontSize);return n*o}function i7(e){return e/100*window.innerHeight}function c7(e){return e/100*window.innerWidth}function u7(e){switch(typeof e){case"number":return[e,"px"];case"string":{const n=parseFloat(e);return e.endsWith("%")?[n,"%"]:e.endsWith("px")?[n,"px"]:e.endsWith("rem")?[n,"rem"]:e.endsWith("em")?[n,"em"]:e.endsWith("vh")?[n,"vh"]:e.endsWith("vw")?[n,"vw"]:[n,"%"]}}}function nc({groupSize:e,panelElement:n,styleProp:s}){let o;const[l,c]=u7(s);switch(c){case"%":{o=l/100*e;break}case"px":{o=l;break}case"rem":{o=l7(n,l);break}case"em":{o=o7(n,l);break}case"vh":{o=i7(l);break}case"vw":{o=c7(l);break}}return o}function Fn(e){return parseFloat(e.toFixed(3))}function Tl({group:e}){const{orientation:n,panels:s}=e;return s.reduce((o,l)=>(o+=n==="horizontal"?l.element.offsetWidth:l.element.offsetHeight,o),0)}function Zh(e){const{panels:n}=e,s=Tl({group:e});return s===0?n.map(o=>({groupResizeBehavior:o.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:o.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:o.panelConstraints.disabled,minSize:0,maxSize:100,panelId:o.id})):n.map(o=>{const{element:l,panelConstraints:c}=o;let d=0;if(c.collapsedSize!==void 0){const g=nc({groupSize:s,panelElement:l,styleProp:c.collapsedSize});d=Fn(g/s*100)}let f;if(c.defaultSize!==void 0){const g=nc({groupSize:s,panelElement:l,styleProp:c.defaultSize});f=Fn(g/s*100)}let p=0;if(c.minSize!==void 0){const g=nc({groupSize:s,panelElement:l,styleProp:c.minSize});p=Fn(g/s*100)}let m=100;if(c.maxSize!==void 0){const g=nc({groupSize:s,panelElement:l,styleProp:c.maxSize});m=Fn(g/s*100)}return{groupResizeBehavior:c.groupResizeBehavior,collapsedSize:d,collapsible:c.collapsible===!0,defaultSize:f,disabled:c.disabled,minSize:p,maxSize:m,panelId:o.id}})}function Ut(e,n="Assertion error"){if(!e)throw Error(n)}function Wh(e,n){return Array.from(n).sort(e==="horizontal"?d7:f7)}function d7(e,n){const s=e.element.offsetLeft-n.element.offsetLeft;return s!==0?s:e.element.offsetWidth-n.element.offsetWidth}function f7(e,n){const s=e.element.offsetTop-n.element.offsetTop;return s!==0?s:e.element.offsetHeight-n.element.offsetHeight}function dk(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function fk(e,n){return{x:e.x>=n.left&&e.x<=n.right?0:Math.min(Math.abs(e.x-n.left),Math.abs(e.x-n.right)),y:e.y>=n.top&&e.y<=n.bottom?0:Math.min(Math.abs(e.y-n.top),Math.abs(e.y-n.bottom))}}function p7({orientation:e,rects:n,targetRect:s}){const o={x:s.x+s.width/2,y:s.y+s.height/2};let l,c=Number.MAX_VALUE;for(const d of n){const{x:f,y:p}=fk(o,d),m=e==="horizontal"?f:p;m<c&&(c=m,l=d)}return Ut(l,"No rect found"),l}let xd;function m7(){return xd===void 0&&(typeof matchMedia=="function"?xd=!!matchMedia("(pointer:coarse)").matches:xd=!1),xd}function pk(e){const{element:n,orientation:s,panels:o,separators:l}=e,c=Wh(s,Array.from(n.children).filter(dk).map(C=>({element:C}))).map(({element:C})=>C),d=[];let f=!1,p=!1,m=-1,g=-1,b=0,v,S=[];{let C=-1;for(const _ of c)_.hasAttribute("data-panel")&&(C++,_.hasAttribute("data-disabled")||(b++,m===-1&&(m=C),g=C))}if(b>1){let C=-1;for(const _ of c)if(_.hasAttribute("data-panel")){C++;const w=o.find(k=>k.element===_);if(w){if(v){const k=v.element.getBoundingClientRect(),E=_.getBoundingClientRect();let N;if(p){const R=s==="horizontal"?new DOMRect(k.right,k.top,0,k.height):new DOMRect(k.left,k.bottom,k.width,0),T=s==="horizontal"?new DOMRect(E.left,E.top,0,E.height):new DOMRect(E.left,E.top,E.width,0);switch(S.length){case 0:{N=[R,T];break}case 1:{const O=S[0],A=p7({orientation:s,rects:[k,E],targetRect:O.element.getBoundingClientRect()});N=[O,A===k?T:R];break}default:{N=S;break}}}else S.length?N=S:N=[s==="horizontal"?new DOMRect(k.right,E.top,E.left-k.right,E.height):new DOMRect(E.left,k.bottom,E.width,E.top-k.bottom)];for(const R of N){let T="width"in R?R:R.element.getBoundingClientRect();const O=m7()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(T.width<O){const z=O-T.width;T=new DOMRect(T.x-z/2,T.y,T.width+z,T.height)}if(T.height<O){const z=O-T.height;T=new DOMRect(T.x,T.y-z/2,T.width,T.height+z)}const A=C<=m||C>g;!f&&!A&&d.push({group:e,groupSize:Tl({group:e}),panels:[v,w],separator:"width"in R?void 0:R,rect:T}),f=!1}}p=!1,v=w,S=[]}}else if(_.hasAttribute("data-separator")){_.ariaDisabled!==null&&(f=!0);const w=l.find(k=>k.element===_);w?S.push(w):(v=void 0,S=[])}else p=!0}return d}class mk{#e={};addListener(n,s){const o=this.#e[n];return o===void 0?this.#e[n]=[s]:o.includes(s)||o.push(s),()=>{this.removeListener(n,s)}}emit(n,s){const o=this.#e[n];if(o!==void 0)if(o.length===1)o[0].call(null,s);else{let l=!1,c=null;const d=Array.from(o);for(let f=0;f<d.length;f++){const p=d[f];try{p.call(null,s)}catch(m){c===null&&(l=!0,c=m)}}if(l)throw c}}removeAllListeners(){this.#e={}}removeListener(n,s){const o=this.#e[n];if(o!==void 0){const l=o.indexOf(s);l>=0&&o.splice(l,1)}}}let as=new Map;const gk=new mk;function g7(e){as=new Map(as),as.delete(e)}function Jj(e,n){for(const[s]of as)if(s.id===e)return s}function Cr(e,n){for(const[s,o]of as)if(s.id===e)return o;if(n)throw Error(`Could not find data for Group with id ${e}`)}function wo(){return as}function Ab(e,n){return gk.addListener("groupChange",s=>{s.group.id===e&&n(s)})}function $s(e,n){const s=as.get(e);as=new Map(as),as.set(e,n),gk.emit("groupChange",{group:e,prev:s,next:n})}function h7(e,n,s){let o,l={x:1/0,y:1/0};for(const c of n){const d=fk(s,c.rect);switch(e){case"horizontal":{d.x<=l.x&&(o=c,l=d);break}case"vertical":{d.y<=l.y&&(o=c,l=d);break}}}return o?{distance:l,hitRegion:o}:void 0}function x7(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function b7(e,n){if(e===n)throw new Error("Cannot compare node with itself");const s={a:nw(e),b:nw(n)};let o;for(;s.a.at(-1)===s.b.at(-1);)o=s.a.pop(),s.b.pop();Ut(o,"Stacking order can only be calculated for elements with a common ancestor");const l={a:tw(ew(s.a)),b:tw(ew(s.b))};if(l.a===l.b){const c=o.childNodes,d={a:s.a.at(-1),b:s.b.at(-1)};let f=c.length;for(;f--;){const p=c[f];if(p===d.a)return 1;if(p===d.b)return-1}}return Math.sign(l.a-l.b)}const v7=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function y7(e){const n=getComputedStyle(hk(e)??e).display;return n==="flex"||n==="inline-flex"}function _7(e){const n=getComputedStyle(e);return!!(n.position==="fixed"||n.zIndex!=="auto"&&(n.position!=="static"||y7(e))||+n.opacity<1||"transform"in n&&n.transform!=="none"||"webkitTransform"in n&&n.webkitTransform!=="none"||"mixBlendMode"in n&&n.mixBlendMode!=="normal"||"filter"in n&&n.filter!=="none"||"webkitFilter"in n&&n.webkitFilter!=="none"||"isolation"in n&&n.isolation==="isolate"||v7.test(n.willChange)||n.webkitOverflowScrolling==="touch")}function ew(e){let n=e.length;for(;n--;){const s=e[n];if(Ut(s,"Missing node"),_7(s))return s}return null}function tw(e){return e&&Number(getComputedStyle(e).zIndex)||0}function nw(e){const n=[];for(;e;)n.push(e),e=hk(e);return n}function hk(e){const{parentNode:n}=e;return x7(n)?n.host:n}function j7(e,n){return e.x<n.x+n.width&&e.x+e.width>n.x&&e.y<n.y+n.height&&e.y+e.height>n.y}function w7({groupElement:e,hitRegion:n,pointerEventTarget:s}){if(!dk(s)||s.contains(e)||e.contains(s))return!0;if(b7(s,e)>0){let o=s;for(;o;){if(o.contains(e))return!0;if(j7(o.getBoundingClientRect(),n))return!1;o=o.parentElement}}return!0}function Mb(e,n){const s=[];return n.forEach((o,l)=>{if(l.disabled)return;const c=pk(l),d=h7(l.orientation,c,{x:e.clientX,y:e.clientY});d&&d.distance.x<=0&&d.distance.y<=0&&w7({groupElement:l.element,hitRegion:d.hitRegion.rect,pointerEventTarget:e.target})&&s.push(d.hitRegion)}),s}function S7(e,n){if(e.length!==n.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!=n[s])return!1;return!0}function In(e,n,s=0){return Math.abs(Fn(e)-Fn(n))<=s}function Ja(e,n){return In(e,n)?0:e>n?1:-1}function pl({overrideDisabledPanels:e,panelConstraints:n,prevSize:s,size:o}){const{collapsedSize:l=0,collapsible:c,disabled:d,maxSize:f=100,minSize:p=0}=n;if(d&&!e)return s;if(Ja(o,p)<0)if(c){const m=(l+p)/2;Ja(o,m)<0?o=l:o=p}else o=p;return o=Math.min(f,o),o=Fn(o),o}function wc({delta:e,initialLayout:n,panelConstraints:s,pivotIndices:o,prevLayout:l,trigger:c}){if(In(e,0))return n;const d=c==="imperative-api",f=Object.values(n),p=Object.values(l),m=[...f],[g,b]=o;Ut(g!=null,"Invalid first pivot index"),Ut(b!=null,"Invalid second pivot index");let v=0;switch(c){case"keyboard":{{const _=e<0?b:g,w=s[_];Ut(w,`Panel constraints not found for index ${_}`);const{collapsedSize:k=0,collapsible:E,minSize:N=0}=w;if(E){const R=f[_];if(Ut(R!=null,`Previous layout not found for panel index ${_}`),In(R,k)){const T=N-R;Ja(T,Math.abs(e))>0&&(e=e<0?0-T:T)}}}{const _=e<0?g:b,w=s[_];Ut(w,`No panel constraints found for index ${_}`);const{collapsedSize:k=0,collapsible:E,minSize:N=0}=w;if(E){const R=f[_];if(Ut(R!=null,`Previous layout not found for panel index ${_}`),In(R,N)){const T=R-k;Ja(T,Math.abs(e))>0&&(e=e<0?0-T:T)}}}break}default:{const _=e<0?b:g,w=s[_];Ut(w,`Panel constraints not found for index ${_}`);const k=f[_],{collapsible:E,collapsedSize:N,minSize:R}=w;if(E&&Ja(k,R)<0)if(e>0){const T=R-N,O=T/2,A=k+e;Ja(A,R)<0&&(e=Ja(e,O)<=0?0:T)}else{const T=R-N,O=100-T/2,A=k-e;Ja(A,R)<0&&(e=Ja(100+e,O)>0?0:-T)}break}}{const _=e<0?1:-1;let w=e<0?b:g,k=0;for(;;){const N=f[w];Ut(N!=null,`Previous layout not found for panel index ${w}`);const R=pl({overrideDisabledPanels:d,panelConstraints:s[w],prevSize:N,size:100})-N;if(k+=R,w+=_,w<0||w>=s.length)break}const E=Math.min(Math.abs(e),Math.abs(k));e=e<0?0-E:E}{let _=e<0?g:b;for(;_>=0&&_<s.length;){const w=Math.abs(e)-Math.abs(v),k=f[_];Ut(k!=null,`Previous layout not found for panel index ${_}`);const E=k-w,N=pl({overrideDisabledPanels:d,panelConstraints:s[_],prevSize:k,size:E});if(!In(k,N)&&(v+=k-N,m[_]=N,v.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?_--:_++}}if(S7(p,m))return l;{const _=e<0?b:g,w=f[_];Ut(w!=null,`Previous layout not found for panel index ${_}`);const k=w+v,E=pl({overrideDisabledPanels:d,panelConstraints:s[_],prevSize:w,size:k});if(m[_]=E,!In(E,k)){let N=k-E,R=e<0?b:g;for(;R>=0&&R<s.length;){const T=m[R];Ut(T!=null,`Previous layout not found for panel index ${R}`);const O=T+N,A=pl({overrideDisabledPanels:d,panelConstraints:s[R],prevSize:T,size:O});if(In(T,A)||(N-=A-T,m[R]=A),In(N,0))break;e>0?R--:R++}}}const S=Object.values(m).reduce((_,w)=>w+_,0);if(!In(S,100,.1))return l;const C=Object.keys(l);return m.reduce((_,w,k)=>(_[C[k]]=w,_),{})}function ho(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const s in e)if(n[s]===void 0||Ja(e[s],n[s])!==0)return!1;return!0}function xo({layout:e,panelConstraints:n}){const s=Object.values(e),o=[...s],l=o.reduce((f,p)=>f+p,0);if(o.length!==n.length)throw Error(`Invalid ${n.length} panel layout: ${o.map(f=>`${f}%`).join(", ")}`);if(!In(l,100)&&o.length>0)for(let f=0;f<n.length;f++){const p=o[f];Ut(p!=null,`No layout data found for index ${f}`);const m=100/l*p;o[f]=m}let c=0;for(let f=0;f<n.length;f++){const p=s[f];Ut(p!=null,`No layout data found for index ${f}`);const m=o[f];Ut(m!=null,`No layout data found for index ${f}`);const g=pl({overrideDisabledPanels:!0,panelConstraints:n[f],prevSize:p,size:m});m!=g&&(c+=m-g,o[f]=g)}if(!In(c,0))for(let f=0;f<n.length;f++){const p=o[f];Ut(p!=null,`No layout data found for index ${f}`);const m=p+c,g=pl({overrideDisabledPanels:!0,panelConstraints:n[f],prevSize:p,size:m});if(p!==g&&(c-=g-p,o[f]=g,In(c,0)))break}const d=Object.keys(e);return o.reduce((f,p,m)=>(f[d[m]]=p,f),{})}function xk({groupId:e,panelId:n}){const s=()=>{const p=wo();for(const[m,{defaultLayoutDeferred:g,derivedPanelConstraints:b,layout:v,groupSize:S,separatorToPanels:C}]of p)if(m.id===e)return{defaultLayoutDeferred:g,derivedPanelConstraints:b,group:m,groupSize:S,layout:v,separatorToPanels:C};throw Error(`Group ${e} not found`)},o=()=>{const p=s().derivedPanelConstraints.find(m=>m.panelId===n);if(p!==void 0)return p;throw Error(`Panel constraints not found for Panel ${n}`)},l=()=>{const p=s().group.panels.find(m=>m.id===n);if(p!==void 0)return p;throw Error(`Layout not found for Panel ${n}`)},c=()=>{const p=s().layout[n];if(p!==void 0)return p;throw Error(`Layout not found for Panel ${n}`)},d=({nextSize:p,panels:m,prevLayout:g,derivedPanelConstraints:b})=>{const v=c(),S=m.findIndex(w=>w.id===n),C=S===0,_=S===m.length-1;if(_&&p<v&&(C||m.slice(0,S).every((w,k)=>{const E=b[k];return E?.collapsible&&In(E.collapsedSize,g[E.panelId])}))){const w=m.slice(0,S).reduce((k,E)=>k+g[E.id],0);return{...g,[n]:Fn(100-w)}}return wc({delta:_?v-p:p-v,initialLayout:g,panelConstraints:b,pivotIndices:_?[S-1,S]:[S,S+1],prevLayout:g,trigger:"imperative-api"})},f=p=>{const m=c();if(p===m)return;const{defaultLayoutDeferred:g,derivedPanelConstraints:b,group:v,groupSize:S,layout:C,separatorToPanels:_}=s(),w=d({nextSize:p,panels:v.panels,prevLayout:C,derivedPanelConstraints:b}),k=xo({layout:w,panelConstraints:b});ho(C,k)||$s(v,{defaultLayoutDeferred:g,derivedPanelConstraints:b,groupSize:S,layout:k,separatorToPanels:_})};return{collapse:()=>{const{collapsible:p,collapsedSize:m}=o(),{mutableValues:g}=l(),b=c();p&&b!==m&&(g.expandToSize=b,f(m))},expand:()=>{const{collapsible:p,collapsedSize:m,minSize:g}=o(),{mutableValues:b}=l(),v=c();if(p&&v===m){let S=b.expandToSize??g;S===0&&(S=1),f(S)}},getSize:()=>{const{group:p}=s(),m=c(),{element:g}=l(),b=p.orientation==="horizontal"?g.offsetWidth:g.offsetHeight;return{asPercentage:m,inPixels:b}},isCollapsed:()=>{const{collapsible:p,collapsedSize:m}=o(),g=c();return p&&In(m,g)},resize:p=>{const{group:m}=s(),{element:g}=l(),b=Tl({group:m}),v=nc({groupSize:b,panelElement:g,styleProp:p}),S=Fn(v/b*100);f(S)}}}function aw(e){if(e.defaultPrevented)return;const n=wo();Mb(e,n).forEach(s=>{if(s.separator&&!s.separator.disableDoubleClick){const o=s.panels.find(l=>l.panelConstraints.defaultSize!==void 0);if(o){const l=o.panelConstraints.defaultSize,c=xk({groupId:s.group.id,panelId:o.id});c&&l!==void 0&&(c.resize(l),e.preventDefault())}}})}function Nd(e){const n=wo();for(const[s]of n)if(s.separators.some(o=>o.element===e))return s;throw Error("Could not find parent Group for separator element")}function bk({groupId:e}){const n=()=>{const s=wo();for(const[o,l]of s)if(o.id===e)return{group:o,...l};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:s,layout:o}=n();return s?{}:o},setLayout(s){const{defaultLayoutDeferred:o,derivedPanelConstraints:l,group:c,groupSize:d,layout:f,separatorToPanels:p}=n(),m=xo({layout:s,panelConstraints:l});return o?f:(ho(f,m)||$s(c,{defaultLayoutDeferred:o,derivedPanelConstraints:l,groupSize:d,layout:m,separatorToPanels:p}),m)}}}function no(e,n){const s=Nd(e),o=Cr(s.id,!0),l=s.separators.find(g=>g.element===e);Ut(l,"Matching separator not found");const c=o.separatorToPanels.get(l);Ut(c,"Matching panels not found");const d=c.map(g=>s.panels.indexOf(g)),f=bk({groupId:s.id}).getLayout(),p=wc({delta:n,initialLayout:f,panelConstraints:o.derivedPanelConstraints,pivotIndices:d,prevLayout:f,trigger:"keyboard"}),m=xo({layout:p,panelConstraints:o.derivedPanelConstraints});ho(f,m)||$s(s,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:m,separatorToPanels:o.separatorToPanels})}function sw(e){if(e.defaultPrevented)return;const n=e.currentTarget,s=Nd(n);if(!s.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),s.orientation==="vertical"&&no(n,5);break}case"ArrowLeft":{e.preventDefault(),s.orientation==="horizontal"&&no(n,-5);break}case"ArrowRight":{e.preventDefault(),s.orientation==="horizontal"&&no(n,5);break}case"ArrowUp":{e.preventDefault(),s.orientation==="vertical"&&no(n,-5);break}case"End":{e.preventDefault(),no(n,100);break}case"Enter":{e.preventDefault();const o=Nd(n),l=Cr(o.id,!0),{derivedPanelConstraints:c,layout:d,separatorToPanels:f}=l,p=o.separators.find(v=>v.element===n);Ut(p,"Matching separator not found");const m=f.get(p);Ut(m,"Matching panels not found");const g=m[0],b=c.find(v=>v.panelId===g.id);if(Ut(b,"Panel metadata not found"),b.collapsible){const v=d[g.id],S=b.collapsedSize===v?o.mutableState.expandedPanelSizes[g.id]??b.minSize:b.collapsedSize;no(n,S-v)}break}case"F6":{e.preventDefault();const o=Nd(n).separators.map(d=>d.element),l=Array.from(o).findIndex(d=>d===e.currentTarget);Ut(l!==null,"Index not found");const c=e.shiftKey?l>0?l-1:o.length-1:l+1<o.length?l+1:0;o[c].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),no(n,-100);break}}}let bl={cursorFlags:0,state:"inactive"};const Ob=new mk;function bo(){return bl}function C7(e){return Ob.addListener("change",e)}function k7(e){const n=bl,s={...bl};s.cursorFlags=e,bl=s,Ob.emit("change",{prev:n,next:s})}function vl(e){const n=bl;bl=e,Ob.emit("change",{prev:n,next:e})}function rw(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const n=wo(),s=Mb(e,n),o=new Map;let l=!1;s.forEach(c=>{c.separator&&(l||(l=!0,c.separator.element.focus({focusVisible:!1,preventScroll:!0})));const d=n.get(c.group);d&&o.set(c.group,d.layout)}),vl({cursorFlags:0,hitRegions:s,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),s.length&&e.preventDefault()}const E7=e=>e,ih=()=>{},vk=1,yk=2,_k=4,jk=8,ow=3,lw=12;let bd;function iw(){return bd===void 0&&(bd=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(bd=!0)),bd}function N7({cursorFlags:e,groups:n,state:s}){let o=0,l=0;switch(s){case"active":case"hover":n.forEach(c=>{if(!c.mutableState.disableCursor)switch(c.orientation){case"horizontal":{o++;break}case"vertical":{l++;break}}})}if(!(o===0&&l===0)){switch(s){case"active":{if(e&&iw()){const c=(e&vk)!==0,d=(e&yk)!==0,f=(e&_k)!==0,p=(e&jk)!==0;if(c)return f?"se-resize":p?"ne-resize":"e-resize";if(d)return f?"sw-resize":p?"nw-resize":"w-resize";if(f)return"s-resize";if(p)return"n-resize"}break}}return iw()?o>0&&l>0?"move":o>0?"ew-resize":"ns-resize":o>0&&l>0?"grab":o>0?"col-resize":"row-resize"}}const cw=new WeakMap;function zb(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:n,styleSheet:s}=cw.get(e)??{};s===void 0&&(s=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(s):e.adoptedStyleSheets=[...e.adoptedStyleSheets,s]));const o=bo();switch(o.state){case"active":case"hover":{const l=N7({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(d=>d.group),state:o.state}),c=`*, *:hover {cursor: ${l} !important; }`;if(n===c)return;n=c,l?s.cssRules.length===0?s.insertRule(c):s.replaceSync(c):s.cssRules.length===1&&s.deleteRule(0);break}case"inactive":{n=void 0,s.cssRules.length===1&&s.deleteRule(0);break}}cw.set(e,{prevStyle:n,styleSheet:s})}function wk({document:e,event:n,hitRegions:s,initialLayoutMap:o,mountedGroups:l,pointerDownAtPoint:c,prevCursorFlags:d}){let f=0;s.forEach(m=>{const{group:g,groupSize:b}=m,{orientation:v,panels:S}=g,{disableCursor:C}=g.mutableState;let _=0;c?v==="horizontal"?_=(n.clientX-c.x)/b*100:_=(n.clientY-c.y)/b*100:v==="horizontal"?_=n.clientX<0?-100:100:_=n.clientY<0?-100:100;const w=o.get(g),k=l.get(g);if(!w||!k)return;const{defaultLayoutDeferred:E,derivedPanelConstraints:N,groupSize:R,layout:T,separatorToPanels:O}=k;if(N&&T&&O){const A=wc({delta:_,initialLayout:w,panelConstraints:N,pivotIndices:m.panels.map(z=>S.indexOf(z)),prevLayout:T,trigger:"mouse-or-touch"});if(ho(A,T)){if(_!==0&&!C)switch(v){case"horizontal":{f|=_<0?vk:yk;break}case"vertical":{f|=_<0?_k:jk;break}}}else $s(m.group,{defaultLayoutDeferred:E,derivedPanelConstraints:N,groupSize:R,layout:A,separatorToPanels:O})}});let p=0;n.movementX===0?p|=d&ow:p|=f&ow,n.movementY===0?p|=d&lw:p|=f&lw,k7(p),zb(e)}function uw(e){const n=wo(),s=bo();switch(s.state){case"active":wk({document:e.currentTarget,event:e,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedGroups:n,prevCursorFlags:s.cursorFlags})}}function dw(e){if(e.defaultPrevented)return;const n=bo(),s=wo();switch(n.state){case"active":{if(e.buttons===0){vl({cursorFlags:0,state:"inactive"}),n.hitRegions.forEach(o=>{const l=Cr(o.group.id,!0);$s(o.group,l)});return}for(const o of n.hitRegions)if(o.separator){const{element:l}=o.separator;l.hasPointerCapture?.(e.pointerId)||l.setPointerCapture?.(e.pointerId)}wk({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:s,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags});break}default:{const o=Mb(e,s);o.length===0?n.state!=="inactive"&&vl({cursorFlags:0,state:"inactive"}):vl({cursorFlags:0,hitRegions:o,state:"hover"}),zb(e.currentTarget);break}}}function fw(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(bo().state){case"hover":vl({cursorFlags:0,state:"inactive"})}}function pw(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const n=bo();switch(n.state){case"active":vl({cursorFlags:0,state:"inactive"}),n.hitRegions.length>0&&(zb(e.currentTarget),n.hitRegions.forEach(s=>{const o=Cr(s.group.id,!0);$s(s.group,o)}),e.preventDefault())}}function mw(e){let n=0,s=0;const o={};for(const c of e)if(c.defaultSize!==void 0){n++;const d=Fn(c.defaultSize);s+=d,o[c.panelId]=d}else o[c.panelId]=void 0;const l=e.length-n;if(l!==0){const c=Fn((100-s)/l);for(const d of e)d.defaultSize===void 0&&(o[d.panelId]=c)}return o}function R7(e,n,s){if(!s[0])return;const o=e.panels.find(p=>p.element===n);if(!o||!o.onResize)return;const l=Tl({group:e}),c=e.orientation==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,d=o.mutableValues.prevSize,f={asPercentage:Fn(c/l*100),inPixels:c};o.mutableValues.prevSize=f,o.onResize(f,o.id,d)}function T7(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const s in e)if(e[s]!==n[s])return!1;return!0}function A7({group:e,nextGroupSize:n,prevGroupSize:s,prevLayout:o}){if(s<=0||n<=0||s===n)return o;let l=0,c=0,d=!1;const f=new Map,p=[];for(const b of e.panels){const v=o[b.id]??0;switch(b.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{d=!0;const S=v/100*s,C=Fn(S/n*100);f.set(b.id,C),l+=C;break}case"preserve-relative-size":default:{p.push(b.id),c+=v;break}}}if(!d||p.length===0)return o;const m=100-l,g={...o};if(f.forEach((b,v)=>{g[v]=b}),c>0)for(const b of p){const v=o[b]??0;g[b]=Fn(v/c*m)}else{const b=Fn(m/p.length);for(const v of p)g[v]=b}return g}function M7(e,n){const s=e.map(l=>l.id),o=Object.keys(n);if(s.length!==o.length)return!1;for(const l of s)if(!o.includes(l))return!1;return!0}const cl=new Map;function O7(e){let n=!0;Ut(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const s=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,l=new Set,c=new s(C=>{for(const _ of C){const{borderBoxSize:w,target:k}=_;if(k===e.element){if(n){const E=Tl({group:e});if(E===0)return;const N=Cr(e.id);if(!N)return;const R=Zh(e),T=N.defaultLayoutDeferred?mw(R):N.layout,O=A7({group:e,nextGroupSize:E,prevGroupSize:N.groupSize,prevLayout:T}),A=xo({layout:O,panelConstraints:R});if(!N.defaultLayoutDeferred&&ho(N.layout,A)&&T7(N.derivedPanelConstraints,R)&&N.groupSize===E)return;$s(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:R,groupSize:E,layout:A,separatorToPanels:N.separatorToPanels})}}else R7(e,k,w)}});c.observe(e.element),e.panels.forEach(C=>{Ut(!o.has(C.id),`Panel ids must be unique; id "${C.id}" was used more than once`),o.add(C.id),C.onResize&&c.observe(C.element)});const d=Tl({group:e}),f=Zh(e),p=e.panels.map(({id:C})=>C).join(",");let m=e.mutableState.defaultLayout;m&&(M7(e.panels,m)||(m=void 0));const g=e.mutableState.layouts[p]??m??mw(f),b=xo({layout:g,panelConstraints:f}),v=e.element.ownerDocument;cl.set(v,(cl.get(v)??0)+1);const S=new Map;return pk(e).forEach(C=>{C.separator&&S.set(C.separator,C.panels)}),$s(e,{defaultLayoutDeferred:d===0,derivedPanelConstraints:f,groupSize:d,layout:b,separatorToPanels:S}),e.separators.forEach(C=>{Ut(!l.has(C.id),`Separator ids must be unique; id "${C.id}" was used more than once`),l.add(C.id),C.element.addEventListener("keydown",sw)}),cl.get(v)===1&&(v.addEventListener("dblclick",aw,!0),v.addEventListener("pointerdown",rw,!0),v.addEventListener("pointerleave",uw),v.addEventListener("pointermove",dw),v.addEventListener("pointerout",fw),v.addEventListener("pointerup",pw,!0)),function(){n=!1,cl.set(v,Math.max(0,(cl.get(v)??0)-1)),g7(e),e.separators.forEach(C=>{C.element.removeEventListener("keydown",sw)}),cl.get(v)||(v.removeEventListener("dblclick",aw,!0),v.removeEventListener("pointerdown",rw,!0),v.removeEventListener("pointerleave",uw),v.removeEventListener("pointermove",dw),v.removeEventListener("pointerout",fw),v.removeEventListener("pointerup",pw,!0)),c.disconnect()}}function z7(){const[e,n]=h.useState({}),s=h.useCallback(()=>n({}),[]);return[e,s]}function Db(e){const n=h.useId();return`${e??n}`}const So=typeof window<"u"?h.useLayoutEffect:h.useEffect;function cc(e){const n=h.useRef(e);return So(()=>{n.current=e},[e]),h.useCallback((...s)=>n.current?.(...s),[n])}function Lb(...e){return cc(n=>{e.forEach(s=>{if(s)switch(typeof s){case"function":{s(n);break}case"object":{s.current=n;break}}})})}function Pb(e){const n=h.useRef({...e});return So(()=>{for(const s in e)n.current[s]=e[s]},[e]),n.current}const Sk=h.createContext(null);function D7(e,n){const s=h.useRef({getLayout:()=>({}),setLayout:E7});h.useImperativeHandle(n,()=>s.current,[]),So(()=>{Object.assign(s.current,bk({groupId:e}))})}function Jh({children:e,className:n,defaultLayout:s,disableCursor:o,disabled:l,elementRef:c,groupRef:d,id:f,onLayoutChange:p,onLayoutChanged:m,orientation:g="horizontal",resizeTargetMinimumSize:b={coarse:20,fine:10},style:v,...S}){const C=h.useRef({onLayoutChange:{},onLayoutChanged:{}}),_=cc(D=>{ho(C.current.onLayoutChange,D)||(C.current.onLayoutChange=D,p?.(D))}),w=cc(D=>{ho(C.current.onLayoutChanged,D)||(C.current.onLayoutChanged=D,m?.(D))}),k=Db(f),E=h.useRef(null),[N,R]=z7(),T=h.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:b,separators:[]}),O=Lb(E,c);D7(k,d);const A=cc((D,P)=>{const H=bo(),q=Jj(D),Y=Cr(D);if(Y){let V=!1;switch(H.state){case"active":{V=H.hitRegions.some($=>$.group===q);break}}return{flexGrow:Y.layout[P]??1,pointerEvents:V?"none":void 0}}if(s?.[P])return{flexGrow:s?.[P]}}),z=Pb({defaultLayout:s,disableCursor:o}),B=h.useMemo(()=>({get disableCursor(){return!!z.disableCursor},getPanelStyles:A,id:k,orientation:g,registerPanel:D=>{const P=T.current;return P.panels=Wh(g,[...P.panels,D]),R(),()=>{P.panels=P.panels.filter(H=>H!==D),R()}},registerSeparator:D=>{const P=T.current;return P.separators=Wh(g,[...P.separators,D]),R(),()=>{P.separators=P.separators.filter(H=>H!==D),R()}},updatePanelProps:(D,{disabled:P})=>{const H=T.current.panels.find(V=>V.id===D);H&&(H.panelConstraints.disabled=P);const q=Jj(k),Y=Cr(k);q&&Y&&$s(q,{...Y,derivedPanelConstraints:Zh(q)})},updateSeparatorProps:(D,{disabled:P,disableDoubleClick:H})=>{const q=T.current.separators.find(Y=>Y.id===D);q&&(q.disabled=P,q.disableDoubleClick=H)}}),[A,k,R,g,z]),L=h.useRef(null);return So(()=>{const D=E.current;if(D===null)return;const P=T.current;let H;if(z.defaultLayout!==void 0&&Object.keys(z.defaultLayout).length===P.panels.length){H={};for(const X of P.panels){const U=z.defaultLayout[X.id];U!==void 0&&(H[X.id]=U)}}const q={disabled:!!l,element:D,id:k,mutableState:{defaultLayout:H,disableCursor:!!z.disableCursor,expandedPanelSizes:T.current.lastExpandedPanelSizes,layouts:T.current.layouts},orientation:g,panels:P.panels,resizeTargetMinimumSize:P.resizeTargetMinimumSize,separators:P.separators};L.current=q;const Y=O7(q),{defaultLayoutDeferred:V,derivedPanelConstraints:$,layout:Z}=Cr(q.id,!0);!V&&$.length>0&&(_(Z),w(Z));const G=Ab(k,X=>{const{defaultLayoutDeferred:U,derivedPanelConstraints:K,layout:F}=X.next;if(U||K.length===0)return;const J=q.panels.map(({id:re})=>re).join(",");q.mutableState.layouts[J]=F,K.forEach(re=>{if(re.collapsible){const{layout:oe}=X.prev??{};if(oe){const ce=In(re.collapsedSize,F[re.panelId]),ee=In(re.collapsedSize,oe[re.panelId]);ce&&!ee&&(q.mutableState.expandedPanelSizes[re.panelId]=oe[re.panelId])}}});const ie=bo().state!=="active";_(F),ie&&w(F)});return()=>{L.current=null,Y(),G()}},[l,k,w,_,g,N,z]),h.useEffect(()=>{const D=L.current;D&&(D.mutableState.defaultLayout=s,D.mutableState.disableCursor=!!o)}),r.jsx(Sk.Provider,{value:B,children:r.jsx("div",{...S,className:n,"data-group":!0,"data-testid":k,id:k,ref:O,style:{height:"100%",width:"100%",overflow:"hidden",...v,display:"flex",flexDirection:g==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:g==="horizontal"?"pan-y":"pan-x"},children:e})})}Jh.displayName="Group";function Ib(){const e=h.useContext(Sk);return Ut(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function L7(e,n){const{id:s}=Ib(),o=h.useRef({collapse:ih,expand:ih,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ih});h.useImperativeHandle(n,()=>o.current,[]),So(()=>{Object.assign(o.current,xk({groupId:s,panelId:e}))})}function ao({children:e,className:n,collapsedSize:s="0%",collapsible:o=!1,defaultSize:l,disabled:c,elementRef:d,groupResizeBehavior:f="preserve-relative-size",id:p,maxSize:m="100%",minSize:g="0%",onResize:b,panelRef:v,style:S,...C}){const _=!!p,w=Db(p),k=Pb({disabled:c}),E=h.useRef(null),N=Lb(E,d),{getPanelStyles:R,id:T,orientation:O,registerPanel:A,updatePanelProps:z}=Ib(),B=b!==null,L=cc((q,Y,V)=>{b?.(q,p,V)});So(()=>{const q=E.current;if(q!==null){const Y={element:q,id:w,idIsStable:_,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:B?L:void 0,panelConstraints:{groupResizeBehavior:f,collapsedSize:s,collapsible:o,defaultSize:l,disabled:k.disabled,maxSize:m,minSize:g}};return A(Y)}},[f,s,o,l,B,w,_,m,g,L,A,k]),h.useEffect(()=>{z(w,{disabled:c})},[c,w,z]),L7(w,v);const D=()=>{const q=R(T,w);if(q)return JSON.stringify(q)},P=h.useSyncExternalStore(q=>Ab(T,q),D,D);let H;return P?H=JSON.parse(P):l!==void 0?H={flexGrow:void 0,flexShrink:void 0,flexBasis:l}:H={flexGrow:1},r.jsx("div",{...C,"data-disabled":c||void 0,"data-panel":!0,"data-testid":w,id:w,ref:N,style:{...P7,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...H},children:r.jsx("div",{className:n,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...S,touchAction:O==="horizontal"?"pan-y":"pan-x"},children:e})})}ao.displayName="Panel";const P7={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function I7({layout:e,panelConstraints:n,panelId:s,panelIndex:o}){let l,c;const d=e[s],f=n.find(p=>p.panelId===s);if(f){const p=f.maxSize,m=f.collapsible?f.collapsedSize:f.minSize,g=[o,o+1];c=xo({layout:wc({delta:m-d,initialLayout:e,panelConstraints:n,pivotIndices:g,prevLayout:e}),panelConstraints:n})[s],l=xo({layout:wc({delta:p-d,initialLayout:e,panelConstraints:n,pivotIndices:g,prevLayout:e}),panelConstraints:n})[s]}return{valueControls:s,valueMax:l,valueMin:c,valueNow:d}}function Bb({children:e,className:n,disabled:s,disableDoubleClick:o,elementRef:l,id:c,style:d,...f}){const p=Db(c),m=Pb({disabled:s,disableDoubleClick:o}),[g,b]=h.useState({}),[v,S]=h.useState("inactive"),[C,_]=h.useState(!1),w=h.useRef(null),k=Lb(w,l),{disableCursor:E,id:N,orientation:R,registerSeparator:T,updateSeparatorProps:O}=Ib(),A=R==="horizontal"?"vertical":"horizontal";So(()=>{const L=w.current;if(L!==null){const D={disabled:m.disabled,disableDoubleClick:m.disableDoubleClick,element:L,id:p},P=T(D),H=C7(Y=>{S(Y.next.state!=="inactive"&&Y.next.hitRegions.some(V=>V.separator===D)?Y.next.state:"inactive")}),q=Ab(N,Y=>{const{derivedPanelConstraints:V,layout:$,separatorToPanels:Z}=Y.next,G=Z.get(D);if(G){const X=G[0],U=G.indexOf(X);b(I7({layout:$,panelConstraints:V,panelId:X.id,panelIndex:U}))}});return()=>{H(),q(),P()}}},[N,p,T,m]),h.useEffect(()=>{O(p,{disabled:s,disableDoubleClick:o})},[s,o,p,O]);let z;s&&!E&&(z="not-allowed");let B;if(s)B="disabled";else switch(v){case"active":{B="active";break}default:C?B="focus":B=v}return r.jsx("div",{...f,"aria-controls":g.valueControls,"aria-disabled":s||void 0,"aria-orientation":A,"aria-valuemax":g.valueMax,"aria-valuemin":g.valueMin,"aria-valuenow":g.valueNow,children:e,className:n,"data-separator":B,"data-testid":p,id:p,onBlur:()=>_(!1),onFocus:()=>_(!0),ref:k,role:"separator",style:{flexBasis:"auto",cursor:z,...d,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:s?void 0:0})}Bb.displayName="Separator";function B7({projects:e,value:n,onChange:s,disabled:o}){const l=e.map(c=>{const d=c.path?.split("/").filter(Boolean).pop()||`proyecto ${c.id}`;return{value:String(c.id),label:c.name||d,icon:KT,description:c.path}});return r.jsx("div",{className:"w-full","data-testid":"code-project-select",children:r.jsx(wt,{value:n,onChange:s,options:l,placeholder:"Elegí un proyecto…",disabled:o})})}function U7({sessions:e,activeId:n,busy:s,onSelect:o,onCreate:l,onRename:c,onDelete:d}){return r.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-session-list",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:j("code_module.sessions")}),r.jsx(Mt,{content:j("code_module.new_session"),children:r.jsxs("button",{type:"button",onClick:l,disabled:s,"data-testid":"code-new-session",className:"flex items-center gap-1 rounded-md border border-border px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50",children:[r.jsx(nn,{className:"size-3"})," ",j("code_module.new_session")]})})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 pb-2",children:e.length===0?r.jsx("div",{className:"p-2",children:r.jsx(pt,{children:j("code_module.no_sessions")})}):r.jsx("ul",{className:"space-y-0.5",children:e.map(f=>r.jsxs("li",{className:"group/item relative",children:[r.jsxs("button",{type:"button",onClick:()=>o(f.id),className:Oe("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left text-xs transition-colors",f.id===n?"bg-accent text-accent-fg":"text-foreground/80 hover:bg-accent/50"),children:[r.jsx(mx,{className:"mt-0.5 size-3.5 shrink-0 opacity-60"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate font-medium",children:f.title}),r.jsxs("span",{className:"block truncate text-[10px] text-muted-foreground",children:[f.mode," · ",f.messageCount," msg",f.model?` · ${f.model}`:""]})]})]}),r.jsxs("div",{className:"absolute right-1 top-1 hidden items-center gap-0.5 group-hover/item:flex",children:[r.jsx(Mt,{content:j("code_module.rename"),children:r.jsx("button",{type:"button",onClick:()=>c(f.id,f.title),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-foreground",children:r.jsx(zl,{className:"size-3"})})}),r.jsx(Mt,{content:j("code_module.delete"),children:r.jsx("button",{type:"button",onClick:()=>d(f.id),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-rose-500",children:r.jsx(la,{className:"size-3"})})})]})]},f.id))})})]})}function H7({mode:e,onChange:n,disabled:s}){const o=(l,c,d,f)=>r.jsx(Mt,{content:d,children:r.jsxs("button",{type:"button",disabled:s,"data-testid":`code-mode-${l}`,"aria-pressed":e===l,onClick:()=>n(l),className:Oe("flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors disabled:opacity-50",e===l?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(f,{className:"size-3.5"})," ",c]})});return r.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border border-border bg-muted/60 p-0.5",children:[o("build",j("code_module.mode_build"),j("code_module.mode_build_hint"),JT),o("plan",j("code_module.mode_plan"),j("code_module.mode_plan_hint"),LT)]})}function V7({value:e,onValueChange:n,onSubmit:s,onStop:o,busy:l,disabled:c,mode:d,onModeChange:f,model:p,onModelChange:m}){return r.jsx(Sb,{value:e,onValueChange:n,onSubmit:s,onStop:o,busy:l,disabled:c,placeholder:j("code_module.placeholder"),minRows:1,maxRows:6,footer:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(H7,{mode:d,onChange:f,disabled:l}),r.jsx(Cb,{value:p,onChange:m,disabled:l})]})})}function ch(e,n){let s=0;for(const o of e.parts||[])o.kind==="text"&&n.text&&(s+=o.text.length),o.kind==="tool"&&n.tool&&(o.args&&(s+=JSON.stringify(o.args).length),o.result!==void 0&&(s+=JSON.stringify(o.result).length));return Math.ceil(s/4)}function q7(e){let n=null,s=0,o=0;for(const d of e)d.role==="user"?s++:o++,d.role==="assistant"&&d.usage&&(n={input:d.usage.input_tokens,output:d.usage.output_tokens,model:d.model});const l=n?.input??0,c=n?.output??0;return{model:n?.model??null,input:l,output:c,total:l+c,hasUsage:!!n,messages:e.length,userMsgs:s,assistantMsgs:o}}function $7(e){let n=0,s=0,o=0;for(const d of e)d.role==="user"?n+=ch(d,{text:!0}):s+=ch(d,{text:!0}),o+=ch(d,{tool:!0});const l=n+s+o||1,c=(d,f)=>({key:d,tokens:f,percent:Math.round(f/l*100)});return[c("user",n),c("assistant",s),c("tool",o)].filter(d=>d.tokens>0)}const gw={user:"bg-emerald-500",assistant:"bg-sky-500",tool:"bg-amber-500"};function Ms({label:e,value:n}){return r.jsxs("div",{className:"flex items-baseline justify-between gap-2 py-0.5",children:[r.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:e}),r.jsx("span",{className:"min-w-0 truncate text-right font-mono text-xs text-foreground",children:n})]})}function hw(e){if(!e)return"";const n=new Date(e),s=o=>String(o).padStart(2,"0");return`${s(n.getDate())} ${n.toLocaleString("es",{month:"short"})} ${n.getFullYear()}, ${s(n.getHours())}:${s(n.getMinutes())}`}function G7({turns:e,session:n}){const s=h.useMemo(()=>q7(e),[e]),o=h.useMemo(()=>$7(e),[e]);return e.length===0?r.jsx("div",{className:"p-3",children:r.jsx(pt,{children:j("code_module.ctx_none")})}):r.jsxs("div",{className:"space-y-1 p-3","data-testid":"code-context-tab",children:[r.jsx(Ms,{label:j("code_module.ctx_model"),value:s.model||"auto"}),n?.mode&&r.jsx(Ms,{label:"Modo",value:n.mode}),n?.agentSlug&&r.jsx(Ms,{label:"Agente",value:n.agentSlug}),r.jsx(Ms,{label:j("code_module.ctx_messages"),value:`${s.userMsgs} usuario · ${s.assistantMsgs} asistente`}),r.jsx(Ms,{label:j("code_module.ctx_input"),value:s.input.toLocaleString()}),r.jsx(Ms,{label:j("code_module.ctx_output"),value:s.output.toLocaleString()}),r.jsx(Ms,{label:"Tokens Total",value:(s.input+s.output).toLocaleString()}),n?.createdAt&&r.jsx(Ms,{label:"Creado",value:hw(n.createdAt)}),n?.updatedAt&&r.jsx(Ms,{label:"Actividad",value:hw(n.updatedAt)}),r.jsx("hr",{className:"border-border my-2"}),r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[11px] font-semibold text-muted-foreground",children:j("code_module.ctx_breakdown")}),o.length>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex h-2.5 w-full overflow-hidden rounded-full bg-muted",children:o.map(l=>r.jsx(Mt,{content:`${l.key}: ${l.tokens} (${l.percent}%)`,children:r.jsx("div",{className:gw[l.key],style:{width:`${l.percent}%`}})},l.key))}),r.jsx("ul",{className:"mt-2 space-y-1",children:o.map(l=>r.jsxs("li",{className:"flex items-center gap-2 text-[11px]",children:[r.jsx("span",{className:`size-2 rounded-full ${gw[l.key]}`}),r.jsx("span",{className:"flex-1 text-foreground/80",children:j(`code_module.seg_${l.key}`)}),r.jsxs("span",{className:"font-mono text-muted-foreground",children:[l.tokens," · ",l.percent,"%"]})]},l.key))})]}):r.jsx("p",{className:"text-[11px] text-muted-foreground",children:j("code_module.ctx_none")})]})]})}function F7(e){const n=[];for(const s of(e||"").split(`
619
+ `))s.startsWith("diff --git")||s.startsWith("index ")||s.startsWith("--- ")||s.startsWith("+++ ")||s.startsWith("new file")||s.startsWith("deleted file")||s.startsWith("similarity index")||s.startsWith("rename ")||(s.startsWith("@@")?n.push({kind:"hunk",text:s}):s.startsWith("+")?n.push({kind:"add",text:s.slice(1)}):s.startsWith("-")?n.push({kind:"del",text:s.slice(1)}):n.push({kind:"ctx",text:s.replace(/^ /,"")}));for(;n.length&&n[n.length-1].kind==="ctx"&&n[n.length-1].text==="";)n.pop();return n}function Y7({patch:e}){const n=h.useMemo(()=>F7(e),[e]);return n.length?r.jsx("pre",{className:"overflow-x-auto rounded-md border border-border bg-background/60 font-mono text-[11px] leading-relaxed",children:r.jsx("code",{className:"block",children:n.map((s,o)=>r.jsxs("div",{className:Oe("px-2 whitespace-pre",s.kind==="add"&&"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",s.kind==="del"&&"bg-rose-500/10 text-rose-600 dark:text-rose-400",s.kind==="hunk"&&"bg-muted/60 text-muted-foreground",s.kind==="ctx"&&"text-foreground/70"),children:[r.jsx("span",{className:"select-none opacity-50",children:s.kind==="add"?"+":s.kind==="del"?"-":" "}),s.text]},o))})}):null}const X7={added:$T,modified:Od,deleted:YT},K7={added:"text-emerald-600 dark:text-emerald-400",modified:"text-amber-600 dark:text-amber-400",deleted:"text-rose-600 dark:text-rose-400"};function Q7({file:e}){const[n,s]=h.useState(!1),o=X7[e.status];return r.jsxs("li",{className:"rounded-md border border-border",children:[r.jsxs("button",{type:"button",onClick:()=>s(l=>!l),className:"flex w-full items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-accent/40",children:[r.jsx(Nc,{className:Oe("size-3 shrink-0 transition-transform",n&&"rotate-90")}),r.jsx(o,{className:Oe("size-3.5 shrink-0",K7[e.status])}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:e.path}),r.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[e.additions!=null&&r.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400",children:["+",e.additions]}),e.deletions!=null&&r.jsxs("span",{className:"ml-1 text-rose-600 dark:text-rose-400",children:["-",e.deletions]})]})]}),n&&r.jsx("div",{className:"border-t border-border p-1.5",children:r.jsx(Y7,{patch:e.patch})})]})}function Z7({changes:e,loading:n,onRefresh:s}){const o=e?.files||[];return r.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-changes-tab",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[r.jsx("span",{className:"text-[11px] text-muted-foreground",children:o.length>0?j("code_module.changes_files",{n:o.length}):""}),r.jsx(Mt,{content:j("code_module.reload"),children:r.jsx("button",{type:"button",onClick:s,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:n?r.jsx(Pa,{size:12}):r.jsx(os,{className:"size-3"})})})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:e&&!e.git?r.jsx(pt,{children:j("code_module.changes_no_git")}):o.length===0?r.jsx(pt,{children:j("code_module.changes_none")}):r.jsx("ul",{className:"space-y-1.5",children:o.map(l=>r.jsx(Q7,{file:l},l.path))})})]})}function W7({pid:e,entry:n,onDeleted:s,onRenamed:o,onRunInTerminal:l,onEditArtifact:c}){const[d,f]=h.useState(!1),[p,m]=h.useState(null),g=at(),[b,v]=h.useState(!1),[S,C]=h.useState(n.name),_=h.useRef(null),[w,k]=h.useState(!1),[E,N]=h.useState(!1),[R,T]=h.useState(!1),O=w?["artifact",e,n.name]:null,A=Qe(O,()=>xl.read(e,n.name),{revalidateOnFocus:!1}),z=!A.data?.content||A.data.content.startsWith("#!"),B=async H=>{try{await navigator.clipboard.writeText(H),g.info("Copiado.")}catch{}},L=async()=>{T(!0);try{await xl.remove(e,n.name),N(!1),s()}catch(H){g.error(H.message)}finally{T(!1)}},D=()=>{C(n.name),v(!0),requestAnimationFrame(()=>_.current?.select())},P=async()=>{const H=S.trim();if(v(!1),!(!H||H===n.name))try{await xl.rename(e,n.name,H),o()}catch(q){g.error(q.message)}};return r.jsxs("li",{className:"rounded-md border border-border",children:[r.jsxs("div",{className:"flex w-full items-center gap-2 px-2 py-1.5 text-xs",children:[r.jsx(qT,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),b?r.jsx("input",{ref:_,value:S,onChange:H=>C(H.target.value),onBlur:()=>void P(),onKeyDown:H=>{H.key==="Enter"&&P(),H.key==="Escape"&&v(!1)},autoFocus:!0,className:"min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 font-mono text-xs outline-none focus:ring-1 focus:ring-ring"}):r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:n.name}),r.jsx(Mt,{content:j("code_module.artifacts_rename"),children:r.jsx("button",{type:"button",onClick:D,className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(zl,{className:"size-3"})})}),r.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[n.size,"b"]})]}),r.jsxs("div",{className:"space-y-2 border-t border-border p-2",children:[r.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5",children:[r.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-[10px] text-muted-foreground",children:n.path}),r.jsx(Mt,{content:j("code_module.artifacts_copy_path"),children:r.jsx("button",{type:"button",onClick:()=>void B(n.path),className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(Md,{className:"size-3"})})})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1 mt-1",children:[r.jsxs(Ih,{open:w,onOpenChange:k,children:[r.jsx(Mt,{content:j("code_module.artifacts_view"),children:r.jsxs("button",{type:"button",onClick:()=>k(!0),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-blue-500/15 text-blue-700 hover:bg-blue-500/25 dark:text-blue-300",children:[r.jsx(lf,{className:"size-3"}),"Ver"]})}),r.jsxs(Bh,{className:"sm:max-w-lg",children:[r.jsx(Uh,{children:r.jsx(Hh,{className:"font-mono text-sm",children:n.name})}),A.isLoading?r.jsx("div",{className:"flex justify-center py-6",children:r.jsx(Pa,{size:16})}):r.jsx("pre",{className:"max-h-96 overflow-auto rounded bg-muted/50 p-3 font-mono text-[11px] leading-tight whitespace-pre-wrap break-all",children:A.data?.content??""}),r.jsx(Z_,{showCloseButton:!0})]})]}),r.jsx(Mt,{content:j("code_module.artifacts_edit"),children:r.jsxs("button",{type:"button",onClick:()=>c?.(n.name),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-violet-500/15 text-violet-700 hover:bg-violet-500/25 dark:text-violet-300",children:[r.jsx(gA,{className:"size-3"}),"Editar"]})}),z&&r.jsx(Mt,{content:j("code_module.artifacts_run"),children:r.jsxs("button",{type:"button",onClick:()=>l?.(`apx artifact run ${n.name}`),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300",children:[r.jsx(gx,{className:"size-3"}),j("code_module.artifacts_run")]})}),r.jsxs(Ih,{open:E,onOpenChange:N,children:[r.jsx(Mt,{content:j("code_module.artifacts_delete"),children:r.jsx("button",{type:"button",onClick:()=>N(!0),className:"ml-auto rounded p-1 text-rose-600 hover:bg-rose-50 dark:text-rose-400 dark:hover:bg-rose-950",children:r.jsx(la,{className:"size-3"})})}),r.jsxs(Bh,{className:"sm:max-w-sm",children:[r.jsx(Uh,{children:r.jsxs(Hh,{className:"font-mono text-sm",children:[j("code_module.artifacts_delete")," — ",n.name]})}),r.jsx("p",{className:"px-1 text-sm text-muted-foreground",children:j("code_module.artifacts_delete_confirm")}),r.jsxs(Z_,{children:[r.jsx(Az,{render:r.jsx("button",{type:"button",className:"rounded px-3 py-1.5 text-xs font-medium hover:bg-accent"}),children:"Cancelar"}),r.jsxs("button",{type:"button",onClick:()=>void L(),disabled:R,className:Oe("inline-flex items-center gap-1.5 rounded px-3 py-1.5 text-xs font-medium",R?"bg-muted text-muted-foreground":"bg-rose-500/15 text-rose-700 hover:bg-rose-500/25 dark:text-rose-300"),children:[R&&r.jsx(Pa,{size:10}),"Eliminar"]})]})]})]})]}),r.jsxs("div",{className:"mt-1 text-[10px] text-muted-foreground",children:[j("code_module.artifacts_run_hint")," ",r.jsxs("code",{className:"rounded bg-muted px-1 font-mono",children:["apx artifact run ",n.name]})]}),p&&r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[r.jsxs("span",{className:Oe("rounded px-1.5 py-0.5 font-mono",p.ok?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"bg-rose-500/15 text-rose-700 dark:text-rose-300"),children:["exit ",p.exitCode??p.signal??"?"]}),p.timedOut&&r.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:"timeout"}),p.truncated&&r.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:"truncated"}),r.jsxs("span",{className:"font-mono text-muted-foreground",children:[p.durationMs,"ms"]})]}),p.stdout&&r.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-background/60 p-2 text-[10px] leading-tight",children:p.stdout}),p.stderr&&r.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-rose-500/5 p-2 text-[10px] leading-tight text-rose-700 dark:text-rose-300",children:p.stderr})]})]})]})}function J7({pid:e,onRunInTerminal:n,onEditArtifact:s}){const o=Qe(e?["artifacts",e]:null,()=>xl.list(e)),l=o.data||[];return r.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-artifacts-tab",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[r.jsx("span",{className:"text-[11px] text-muted-foreground",children:l.length>0?j("code_module.artifacts_count",{n:l.length}):""}),r.jsx(Mt,{content:j("code_module.reload"),children:r.jsx("button",{type:"button",onClick:()=>void o.mutate(),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:o.isLoading?r.jsx(Pa,{size:12}):r.jsx(os,{className:"size-3"})})})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:l.length===0?r.jsx(pt,{children:j("code_module.artifacts_none")}):r.jsx("ul",{className:"space-y-1.5",children:l.map(c=>r.jsx(W7,{pid:e,entry:c,onDeleted:()=>void o.mutate(),onRenamed:()=>void o.mutate(),onRunInTerminal:n,onEditArtifact:s},c.name))})})]})}const eI=[{value:"context",icon:cf,label:"tab_context"},{value:"changes",icon:WT,label:"tab_changes"},{value:"artifacts",icon:iA,label:"tab_artifacts"}];function tI({pid:e,turns:n,changes:s,changesLoading:o,onRefreshChanges:l,session:c,onRunInTerminal:d,onEditArtifact:f}){const[p,m]=h.useState("context"),g=s?.files.length||0;return r.jsxs(Df,{value:p,onValueChange:m,className:"flex h-full flex-col gap-0","data-testid":"code-side-panel",children:[r.jsx("div",{className:"shrink-0 border-b border-border px-2 py-2",children:r.jsx(Lf,{variant:"line",className:"w-full",children:eI.map(({value:b,icon:v,label:S})=>{const C=p===b,_=j(`code_module.${S}`);return r.jsx(Mt,{content:_,children:r.jsxs(ns,{value:b,className:C?"flex-1 min-w-0":"w-8 shrink-0",children:[r.jsx(v,{className:"size-3.5 shrink-0"}),C&&r.jsx("span",{className:"truncate text-xs",children:_}),b==="changes"&&g>0&&r.jsx("span",{className:"ml-0.5 rounded-full bg-muted px-1 text-[10px] text-muted-foreground leading-none py-0.5",children:g})]})},b)})})}),r.jsx(za,{value:"context",className:"min-h-0 flex-1 overflow-y-auto",children:r.jsx(G7,{turns:n,session:c})}),r.jsx(za,{value:"changes",className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(Z7,{changes:s,loading:o,onRefresh:l})}),r.jsx(za,{value:"artifacts",className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(J7,{pid:e,onRunInTerminal:d,onEditArtifact:f})})]})}function nI(e){const n=[];for(const o of e){const l=o.split("/").filter(Boolean);let c=n,d="";for(let f=0;f<l.length;f++){d=d?`${d}/${l[f]}`:l[f];const p=f===l.length-1;let m=c.find(g=>g.name===l[f]);m||(m={name:l[f],path:d,type:p?"file":"dir",children:p?void 0:[]},c.push(m)),p||(c=m.children)}}const s=o=>(o.forEach(l=>{l.children&&(l.children=s(l.children))}),o.sort((l,c)=>l.type!==c.type?l.type==="dir"?-1:1:l.name.localeCompare(c.name)));return s(n)}function Ck({node:e,depth:n,onOpenFile:s,openDirs:o,toggleDir:l}){const c=e.type==="dir",d=c&&o.has(e.path);return r.jsxs("li",{children:[r.jsxs("button",{type:"button",onClick:()=>c?l(e.path):s(e.path),style:{paddingLeft:`${n*12+6}px`},className:Oe("flex w-full items-center gap-1.5 py-0.5 pr-2 text-left text-[11px] rounded transition-colors","hover:bg-accent/40",c?"text-foreground/80":"text-foreground/70"),children:[c?r.jsxs(r.Fragment,{children:[r.jsx(Nc,{className:Oe("size-3 shrink-0 transition-transform",d&&"rotate-90")}),d?r.jsx(fx,{className:"size-3.5 shrink-0 text-amber-400"}):r.jsx(QT,{className:"size-3.5 shrink-0 text-amber-400"})]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"size-3 shrink-0"}),r.jsx(XT,{className:"size-3.5 shrink-0 text-sky-400"})]}),r.jsx("span",{className:"truncate",children:e.name})]}),c&&d&&e.children&&e.children.length>0&&r.jsx("ul",{children:e.children.map(f=>r.jsx(Ck,{node:f,depth:n+1,onOpenFile:s,openDirs:o,toggleDir:l},f.path))})]})}function aI({pid:e,projectPath:n,className:s,onOpenFile:o}){const[l,c]=h.useState([]),[d,f]=h.useState(!1),[p,m]=h.useState(!1),[g,b]=h.useState(()=>new Set),v=h.useCallback(async()=>{f(!0);try{const E=(await me.post("/run",{cmd:"find . -type f -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/dist/*' -not -path '*/.claude/*' | sed 's|^\\./||' | sort | head -500",project:e})).stdout.split(`
620
+ `).map(N=>N.trim()).filter(Boolean);c(E),m(!0)}catch{m(!0)}finally{f(!1)}},[e]);h.useEffect(()=>{b(new Set),v()},[v]);const S=h.useCallback(k=>{b(E=>{const N=new Set(E);return N.has(k)?N.delete(k):N.add(k),N})},[]),C=h.useCallback(()=>{b(new Set)},[]),_=nI(l),w=g.size>0;return r.jsxs("div",{className:Oe("flex h-full flex-col",s),"data-testid":"code-file-tree",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border px-3 py-2",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Archivos"}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx(Mt,{content:j("code_module.tree_collapse_all"),children:r.jsx("button",{type:"button",onClick:C,disabled:!w,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40 disabled:hover:bg-transparent",children:r.jsx(OT,{className:"size-3"})})}),r.jsx(Mt,{content:j("code_module.reload"),children:r.jsx("button",{type:"button",onClick:()=>void v(),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:d?r.jsx(Pa,{size:12}):r.jsx(os,{className:"size-3"})})})]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto py-1",children:p?_.length===0?r.jsx("div",{className:"p-3",children:r.jsx(pt,{children:"Sin archivos"})}):r.jsx("ul",{children:_.map(k=>r.jsx(Ck,{node:k,depth:0,onOpenFile:o??(()=>{}),openDirs:g,toggleDir:S},k.path))}):r.jsx("div",{className:"flex justify-center pt-6",children:r.jsx(Pa,{size:14})})})]})}function sI({path:e,content:n,loading:s,onSave:o}){const l=typeof o=="function",[c,d]=h.useState(n),[f,p]=h.useState(!1);h.useEffect(()=>{d(n)},[n]);const m=l&&c!==n,g=async()=>{if(!(!o||!m)){p(!0);try{await o(c)}finally{p(!1)}}};return r.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/40","data-testid":"code-file-viewer",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",children:[r.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",children:[e,m&&r.jsx("span",{className:"ml-1 text-amber-400",children:"•"})]}),l&&r.jsxs(r.Fragment,{children:[r.jsx(Mt,{content:j("code_module.discard_changes"),children:r.jsxs("button",{type:"button",onClick:()=>d(n),disabled:!m||f,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40",children:[r.jsx(hx,{className:"size-3"}),"Descartar"]})}),r.jsx(Mt,{content:j("code_module.save_shortcut_hint"),children:r.jsxs("button",{type:"button",onClick:()=>void g(),disabled:!m||f,className:Oe("inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-medium transition-colors",m&&!f?"bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300":"bg-muted text-muted-foreground"),children:[f?r.jsx(Pa,{size:10}):r.jsx(df,{className:"size-3"}),"Guardar"]})})]})]}),s?r.jsx("div",{className:"flex flex-1 items-center justify-center",children:r.jsx(Pa,{size:16})}):l?r.jsx("textarea",{value:c,onChange:b=>d(b.target.value),onKeyDown:b=>{(b.metaKey||b.ctrlKey)&&b.key==="s"&&(b.preventDefault(),g())},className:"min-h-0 flex-1 resize-none bg-transparent p-3 font-mono text-[12px] leading-[1.6] text-foreground/90 outline-none",spellCheck:!1}):r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsx("table",{className:"w-full border-collapse font-mono text-[12px] leading-[1.6]",children:r.jsx("tbody",{children:n.split(`
621
+ `).map((b,v)=>r.jsxs("tr",{className:"hover:bg-accent/20",children:[r.jsx("td",{className:"w-12 select-none border-r border-border/30 px-3 py-0 text-right align-top text-[10px] text-muted-foreground/40","aria-hidden":"true",children:v+1}),r.jsx("td",{className:"px-4 py-0 align-top text-foreground/90 whitespace-pre",children:b||" "})]},v))})})})]})}function rI({pid:e,className:n,initCmd:s,onClose:o}){const[l,c]=h.useState([]),[d,f]=h.useState(""),[p,m]=h.useState(!1),[g,b]=h.useState([]),[v,S]=h.useState(-1),C=h.useRef(null),_=h.useRef(null);h.useEffect(()=>{C.current?.scrollIntoView({behavior:"smooth"})},[l]),h.useEffect(()=>{s&&(f(s),setTimeout(()=>_.current?.focus(),50))},[s]);const w=async E=>{const N=E.trim();if(N){b(R=>[N,...R.slice(0,49)]),S(-1),c(R=>[...R,{type:"cmd",text:`$ ${N}`}]),m(!0);try{const R=await me.post("/run",{cmd:N,project:e});R.stdout&&c(T=>[...T,{type:"out",text:R.stdout}]),R.stderr&&c(T=>[...T,{type:"err",text:R.stderr}])}catch(R){c(T=>[...T,{type:"err",text:String(R.message)}])}finally{m(!1)}}},k=E=>{if(E.key==="Enter")w(d),f("");else if(E.key==="ArrowUp"){E.preventDefault();const N=Math.min(v+1,g.length-1);S(N),f(g[N]??"")}else if(E.key==="ArrowDown"){E.preventDefault();const N=Math.max(v-1,-1);S(N),f(N===-1?"":g[N]??"")}};return r.jsxs("div",{className:Oe("flex h-full min-h-0 flex-col bg-card/60",n),"data-testid":"code-terminal",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1",children:[r.jsx(kr,{className:"size-3 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-[11px] text-muted-foreground",children:"Terminal"}),r.jsx(Mt,{content:j("code_module.terminal_clear"),children:r.jsx("button",{type:"button",onClick:()=>c([]),className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(HT,{className:"size-3"})})}),r.jsx(Mt,{content:j("code_module.terminal_close"),children:r.jsx("button",{type:"button",onClick:()=>o?.(),className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(vo,{className:"size-3"})})})]}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-1 font-mono text-[11px] leading-snug cursor-text",onClick:()=>_.current?.focus(),children:[l.map((E,N)=>r.jsx("div",{className:Oe("whitespace-pre-wrap break-all",E.type==="cmd"&&"text-emerald-400",E.type==="err"&&"text-rose-400",E.type==="out"&&"text-foreground/90"),children:E.text},N)),r.jsx("div",{ref:C})]}),r.jsxs("div",{className:"flex shrink-0 items-center border-t border-border px-3 py-1",children:[r.jsx("span",{className:"mr-2 text-[11px] text-emerald-400 font-mono",children:"$"}),r.jsx("input",{ref:_,value:d,onChange:E=>f(E.target.value),onKeyDown:k,disabled:p,placeholder:p?"ejecutando…":"comando…",className:"flex-1 bg-transparent font-mono text-[11px] text-foreground outline-none placeholder:text-muted-foreground/50 disabled:opacity-50",spellCheck:!1,autoComplete:"off"})]})]})}const Xi="super-agent";function uh(){return r.jsx(Bb,{className:"relative z-10 w-px shrink-0 cursor-col-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function oI(){return r.jsx(Bb,{className:"relative z-10 h-px shrink-0 cursor-row-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function lI(){const e=at(),n=Qe("/projects",()=>aa.list()),s=h.useMemo(()=>n.data||[],[n.data]),[o,l]=h.useState(""),[c,d]=h.useState(null),[f,p]=h.useState(Xi),[m,g]=h.useState([]),[b,v]=h.useState(""),[S,C]=h.useState(!1),[_,w]=h.useState(!0),[k,E]=h.useState(!0),[N,R]=h.useState(!1),[T,O]=h.useState(""),[A,z]=h.useState(!1),B=h.useRef(null),[L,D]=h.useState([]),[P,H]=h.useState("chat"),q=h.useCallback(pe=>{R(!0),O(pe)},[]);h.useEffect(()=>{!o&&s.length&&l(String(s[0].id))},[o,s]);const Y=Qe(o?["code-sessions",o]:null,()=>As.sessions.list(o)),V=Qe(o?["agents",o]:null,()=>tn.list(o)),$=Qe(o&&c?["code-session",o,c]:null,()=>As.sessions.get(o,c)),Z=Qe(o&&c?["code-changes",o,c]:null,()=>As.changes(o,c));h.useEffect(()=>{const pe=Y.data||[];!c&&pe.length&&d(pe[0].id),c&&pe.length&&!pe.some(Ee=>Ee.id===c)&&d(pe[0]?.id??null)},[Y.data,c]),h.useEffect(()=>{$.data&&p($.data.agentSlug||Xi)},[$.data]),h.useEffect(()=>{S||($.data?g($.data.messages||[]):c||g([]))},[$.data,c,S]),h.useEffect(()=>()=>B.current?.abort(),[]);const G=$.data,X=G?.mode==="plan"?"plan":"build",U=G?.model||"",K=pe=>{pe===o||S||(l(pe),d(null),g([]))},F=pe=>{S||pe===c||(d(pe),g([]))},J=async()=>{if(!(!o||S))try{const pe=await As.sessions.create(o,{title:j("code_module.untitled"),agentSlug:f!==Xi?f:null});await Y.mutate(),d(pe.id),g([])}catch(pe){e.error(pe.message)}},ie=async(pe,Ee)=>{const Re=window.prompt(j("code_module.rename"),Ee);if(!(!Re||Re===Ee))try{await As.sessions.update(o,pe,{title:Re}),await Y.mutate(),pe===c&&await $.mutate()}catch(qe){e.error(qe.message)}},re=async pe=>{if(!S&&window.confirm(j("code_module.delete_confirm")))try{await As.sessions.remove(o,pe),pe===c&&(d(null),g([])),await Y.mutate()}catch(Ee){e.error(Ee.message)}},oe=async pe=>{if(p(pe),!!c)try{await As.sessions.update(o,c,{agentSlug:pe!==Xi?pe:null}),await Promise.all([$.mutate(),Y.mutate()])}catch(Ee){e.error(Ee.message)}},ce=h.useCallback(async pe=>{if(c)try{await As.sessions.update(o,c,pe),await Promise.all([$.mutate(),Y.mutate()])}catch(Ee){e.error(Ee.message)}},[o,c,$,Y,e]),ee=()=>{B.current?.abort(),C(!1)},Te=pe=>g(Ee=>{const Re=[...Ee],qe=Re[Re.length-1];return qe&&qe.role==="assistant"&&(Re[Re.length-1]=pe(qe)),Re}),Fe=async pe=>{const Ee=(pe??b).trim();if(!Ee||S||!o||!c)return;const Re=new Date().toISOString();g(an=>[...an,{role:"user",parts:[{kind:"text",text:Ee}],ts:Re},{role:"assistant",parts:[],ts:Re,pending:!0}]),v(""),C(!0);const qe=new AbortController;B.current=qe;const st=an=>{if(an.type==="error"){e.error(an.error||"error");return}Te(Vt=>kb(Vt,an))};try{await As.stream(o,c,{prompt:Ee},st,qe.signal),Te(an=>({...an,pending:!1}))}catch(an){qe.signal.aborted?Te(Vt=>({...Vt,pending:!1,parts:[...Vt.parts,{kind:"text",text:j("code_module.stopped")}]})):(e.error(an.message),g(Vt=>Vt.filter((mt,Nt)=>Nt!==Vt.length-1)))}finally{B.current===qe&&(B.current=null),C(!1),$.mutate(),Y.mutate(),Z.mutate()}},ve=async pe=>{try{await navigator.clipboard.writeText(pe),e.info("Copiado.")}catch{}},Ce=h.useCallback(pe=>{H(pe),D(Ee=>Ee.some(Re=>Re.path===pe)?Ee:[...Ee,{path:pe,content:"",loading:!0}]),me.post("/run",{cmd:`cat "${pe}"`,project:o}).then(Ee=>{const Re=Ee.stdout||Ee.stderr||"(vacío)";D(qe=>qe.map(st=>st.path===pe?{...st,content:Re,loading:!1}:st))}).catch(Ee=>{D(Re=>Re.map(qe=>qe.path===pe?{...qe,content:`Error: ${Ee.message}`,loading:!1}:qe))})},[o]),Ne=h.useCallback(pe=>{D(Ee=>Ee.filter(Re=>Re.path!==pe)),H(Ee=>Ee===pe?"chat":Ee)},[]),Pe=h.useCallback(pe=>{const Ee=`artifacts/${pe}`;H(Ee),D(Re=>Re.some(qe=>qe.path===Ee)?Re:[...Re,{path:Ee,content:"",loading:!0,artifactName:pe}]),xl.read(o,pe).then(Re=>{D(qe=>qe.map(st=>st.path===Ee?{...st,content:Re.content,loading:!1}:st))}).catch(Re=>{D(qe=>qe.map(st=>st.path===Ee?{...st,content:`Error: ${Re.message}`,loading:!1}:st))})},[o]),Ie=h.useCallback(async(pe,Ee)=>{const Re=L.find(qe=>qe.path===pe);if(Re?.artifactName)try{await xl.write(o,Re.artifactName,Ee),D(qe=>qe.map(st=>st.path===pe?{...st,content:Ee}:st)),e.info("Guardado.")}catch(qe){e.error(qe.message)}},[L,o,e]),be=!n.isLoading&&s.length>0,Ae=h.useMemo(()=>{const pe=[{value:Xi,label:"super-agent",icon:gn,description:"Agente principal con todas las herramientas"}],Ee=(V.data||[]).map(Re=>({value:Re.slug,label:Re.slug,icon:gn,description:Re.description||Re.role||void 0}));return[...pe,...Ee]},[V.data]),we=h.useMemo(()=>m,[m]),Be=h.useMemo(()=>Y.data?.find(pe=>pe.id===c)?.title||"",[Y.data,c]),Xe=h.useMemo(()=>s.find(pe=>String(pe.id)===o),[s,o]);Kz(Be);const[Ye,De]=h.useState(null),ye=S?null:WC(m),le=ye&&ye.turnKey!==Ye,je=pe=>{Fe(pe)},Se=h.useCallback(()=>w(pe=>!pe),[]),Ue=h.useCallback(()=>z(pe=>!pe),[]),Je=h.useCallback(()=>R(pe=>!pe),[]),_t=h.useCallback(()=>E(pe=>!pe),[]),zt=h.useMemo(()=>c?r.jsx("div",{className:"flex items-center gap-0.5",children:[{Icon:eS,open:_,toggle:Se,title:"Lista de sesiones"},{Icon:Qw,open:A,toggle:Ue,title:"Árbol de archivos"},{Icon:kr,open:N,toggle:Je,title:"Terminal"},{Icon:uA,open:k,toggle:_t,title:"Panel de contexto"}].map(({Icon:pe,open:Ee,toggle:Re,title:qe})=>r.jsx(Mt,{content:qe,children:r.jsx("button",{type:"button",onClick:Re,"data-active":Ee,className:"rounded p-1 text-muted-fg transition-colors hover:bg-accent hover:text-accent-fg data-[active=true]:bg-accent data-[active=true]:text-accent-fg",children:r.jsx(pe,{className:"size-3.5"})})},qe))}):null,[c,_,A,N,k,Se,Ue,Je,_t]);return Zz(zt),r.jsx("div",{className:"flex h-full min-h-0 flex-col","data-testid":"screen-code",children:n.isLoading?r.jsx(nt,{}):be?r.jsxs(Jh,{orientation:"vertical",id:"code-layout-v",className:"min-h-0 flex-1",children:[r.jsx(ao,{id:"top",defaultSize:N?"55%":"100%",minSize:"20%",children:r.jsxs(Jh,{orientation:"horizontal",id:"code-layout",className:"h-full",children:[_&&r.jsxs(r.Fragment,{children:[r.jsx(ao,{id:"left",defaultSize:"14%",minSize:"8%",children:r.jsxs("aside",{className:"flex h-full flex-col",children:[r.jsx("div",{className:"shrink-0 border-b border-border p-2",children:r.jsx(B7,{projects:s,value:o,onChange:K,disabled:S})}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(U7,{sessions:Y.data||[],activeId:c,busy:S,onSelect:F,onCreate:J,onRename:ie,onDelete:re})}),r.jsx("div",{className:"shrink-0 border-t border-border p-2",children:r.jsx(wt,{value:f,onChange:oe,options:Ae,disabled:S,showIcon:!0})})]})}),r.jsx(uh,{})]}),A&&r.jsxs(r.Fragment,{children:[r.jsx(ao,{id:"tree",defaultSize:"13%",minSize:"8%",children:r.jsx("div",{className:"h-full",children:r.jsx(aI,{pid:o,projectPath:Xe?.path,onOpenFile:Ce})})}),r.jsx(uh,{})]}),r.jsx(ao,{id:"main",defaultSize:"50%",minSize:"20%",children:r.jsxs("div",{className:"flex h-full flex-col",children:[L.length>0&&r.jsxs("div",{className:"flex shrink-0 items-center gap-0 overflow-x-auto border-b border-border",children:[r.jsxs("button",{type:"button",onClick:()=>H("chat"),"data-active":P==="chat",className:"flex shrink-0 items-center gap-1.5 border-r border-border px-3 py-2 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-accent/40 data-[active=true]:text-foreground",children:[r.jsx(mx,{className:"size-3 shrink-0"}),"Chat"]}),L.map(pe=>{const Ee=pe.path.split("/").pop()??pe.path,Re=P===pe.path;return r.jsxs("div",{"data-active":Re,className:"group flex shrink-0 items-center gap-1 border-r border-border px-2 py-2 text-[11px] text-muted-foreground transition-colors hover:bg-accent/40 data-[active=true]:text-foreground",children:[r.jsx(Mt,{content:pe.path,children:r.jsx("button",{type:"button",onClick:()=>H(pe.path),className:"min-w-0 max-w-[140px] truncate font-mono",children:Ee})}),r.jsx(Mt,{content:j("code_module.close"),children:r.jsx("button",{type:"button",onClick:()=>Ne(pe.path),className:"shrink-0 rounded p-0.5 opacity-60 hover:bg-accent hover:opacity-100",children:r.jsx(vo,{className:"size-2.5"})})})]},pe.path)})]}),P==="chat"?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"code-transcript",children:c?m.length?r.jsx(Eb,{msgs:m,onCopy:ve}):r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(pt,{children:j("code_module.empty_chat")})}):r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(pt,{children:j("code_module.pick_project")})})}),le&&ye&&r.jsx(ZC,{turnKey:ye.turnKey,questions:ye.questions,onSubmit:je,onDismiss:()=>De(ye.turnKey),disabled:S})]}):r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:(()=>{const pe=L.find(Ee=>Ee.path===P);return pe?r.jsx(sI,{path:pe.path,content:pe.content,loading:pe.loading,onSave:pe.artifactName?Ee=>Ie(pe.path,Ee):void 0}):null})()}),r.jsx("div",{className:"shrink-0 border-t border-border p-2","data-testid":"code-input",children:r.jsx(V7,{value:b,onValueChange:v,onSubmit:()=>void Fe(),onStop:ee,busy:S,disabled:!c,mode:X,onModeChange:pe=>void ce({mode:pe}),model:U,onModelChange:pe=>void ce({model:pe||null})})})]})}),k&&r.jsxs(r.Fragment,{children:[r.jsx(uh,{}),r.jsx(ao,{id:"right",defaultSize:"22%",minSize:"15%",children:r.jsx("aside",{className:"flex h-full flex-col",children:r.jsx(tI,{pid:o,turns:we,changes:Z.data,changesLoading:Z.isLoading,onRefreshChanges:()=>void Z.mutate(),session:$.data?{title:$.data.title,mode:$.data.mode,createdAt:$.data.createdAt,updatedAt:$.data.updatedAt,agentSlug:$.data.agentSlug??null}:null,onRunInTerminal:q,onEditArtifact:Pe})})})]})]})}),N&&o&&r.jsxs(r.Fragment,{children:[r.jsx(oI,{}),r.jsx(ao,{id:"terminal",defaultSize:"45%",minSize:"10%",maxSize:"80%",children:r.jsx(rI,{pid:o,initCmd:T,onClose:Je,className:"h-full"})})]})]}):r.jsx("div",{className:"grid flex-1 place-items-center",children:r.jsx(pt,{children:j("code_module.no_projects")})})})}function iI({open:e,onClose:n}){const{mutate:s}=H2(),o=at(),[l,c]=h.useState(""),[d,f]=h.useState(""),[p,m]=h.useState([]),[g,b]=h.useState(null),[v,S]=h.useState(""),[C,_]=h.useState(!1),[w,k]=h.useState(!1),E=async(R,T=!1)=>{_(!0),S("");try{const O=await mO.dirs(R||"~");f(O.path),c(O.path),b(O.parent),m(O.entries)}catch(O){const A=O.message;S(A),T||o.error(A)}finally{_(!1)}};h.useEffect(()=>{e&&!d&&E(l||"~",!0)},[e]);const N=async()=>{const R=l.trim();if(!R){o.error(j("add_project.path_required"));return}k(!0);try{const T=await aa.register(R);o.success(j("add_project.registered",{id:T.id})),await s("/projects"),c(""),n()}catch(T){o.error(T.message)}finally{k(!1)}};return r.jsx(Vn,{open:e,onClose:n,title:j("add_project.title"),description:j("add_project.subtitle"),footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:n,disabled:w,children:j("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:N,loading:w,children:j("add_project.register")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:j("add_project.path_label"),hint:j("add_project.path_hint"),children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ke,{autoFocus:!0,placeholder:j("add_project.path_placeholder"),value:l,onChange:R=>c(R.target.value),onKeyDown:R=>{R.key==="Enter"&&N()}}),r.jsxs(ge,{onClick:()=>E(l||"~"),disabled:C,children:[r.jsx(_d,{size:14})," ",j("add_project.search_btn")]})]})}),r.jsxs("div",{className:"rounded-md border border-border bg-muted/20",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[r.jsx("span",{className:"truncate font-mono text-xs text-muted-fg",children:d||l||"~"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ge,{size:"sm",variant:"ghost",onClick:()=>E("~"),disabled:C,children:r.jsx(tA,{size:13})}),r.jsx(ge,{size:"sm",variant:"ghost",onClick:()=>g&&E(g),disabled:!g||C,children:".."})]})]}),r.jsxs("div",{className:"max-h-64 overflow-y-auto p-2",children:[C&&r.jsx(nt,{}),!C&&v&&r.jsx(pt,{children:j("add_project.browser_unavailable")}),!C&&!v&&p.length===0&&r.jsx(pt,{children:j("add_project.no_folders")}),!C&&!v&&p.map(R=>r.jsxs("button",{type:"button",onClick:()=>E(R),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-accent",children:[r.jsx(fx,{size:14,className:"text-muted-fg"}),r.jsx("span",{className:"truncate",children:R.split("/").pop()}),r.jsx("span",{className:"ml-auto truncate font-mono text-[10px] text-muted-fg",children:R})]},R))]})]})]})})}function cI({onPaired:e}){const[n,s]=h.useState(""),[o,l]=h.useState(uI()),[c,d]=h.useState(!1),[f,p]=h.useState(null);async function m(){const g=n.trim();if(!g){p(j("pairing.err_required"));return}d(!0),p(null);try{const b=await kl.confirm({pairing_id:g,label:o.trim()||void 0});so(b.token);try{localStorage.setItem(Rn.token,b.token)}catch{}e()}catch(b){p(dI(b)),d(!1)}}return r.jsx("div",{className:"flex min-h-[100dvh] w-full items-center justify-center overflow-y-auto bg-background p-4 text-foreground",children:r.jsxs("div",{className:"my-auto w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm",children:[r.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[r.jsx("div",{className:"grid size-10 place-items-center rounded-lg bg-primary/10 text-primary",children:r.jsx(mh,{size:20})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-base font-semibold",children:j("pairing.title")}),r.jsx("p",{className:"text-xs text-muted-fg",children:j("pairing.subtitle")})]})]}),r.jsxs("ol",{className:"mb-5 space-y-1.5 rounded-lg bg-muted/50 p-3 text-xs text-muted-fg",children:[r.jsx("li",{className:"font-medium text-foreground",children:j("pairing.steps_title")}),r.jsxs("li",{children:["1. ",j("pairing.step_1")]}),r.jsxs("li",{children:["2. ",j("pairing.step_2")]}),r.jsxs("li",{children:["3. ",j("pairing.step_3")]})]}),r.jsxs("form",{className:"space-y-3",onSubmit:g=>{g.preventDefault(),m()},children:[r.jsx(de,{label:j("pairing.code_label"),children:r.jsx(ke,{value:n,onChange:g=>s(g.target.value),placeholder:j("pairing.code_ph"),spellCheck:!1,autoComplete:"off"})}),r.jsx(de,{label:j("pairing.label_label"),hint:j("pairing.revoke_hint"),children:r.jsx(ke,{value:o,onChange:g=>l(g.target.value),placeholder:j("pairing.label_ph")})}),f&&r.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:f}),r.jsx(ge,{type:"submit",variant:"primary",size:"md",loading:c,className:"w-full justify-center",children:j(c?"pairing.linking":"pairing.submit")})]})]})})}function uI(){const e=navigator.userAgent;return/iPhone|iPad/.test(e)?"iPhone":/Android/.test(e)?"Android":/Mac/.test(e)?"Mac":/Windows/.test(e)?"Windows PC":/Linux/.test(e)?"Linux":"browser"}function dI(e){if(e instanceof Oc){if(e.status===410)return j("pairing.err_expired");if(e.status===404||e.status===409)return j("pairing.err_unknown")}return j("pairing.err_generic")}function fI({...e}){return r.jsx(cC,{"data-slot":"sheet",...e})}function pI({...e}){return r.jsx(lC,{"data-slot":"sheet-portal",...e})}function mI({className:e,...n}){return r.jsx(J2,{"data-slot":"sheet-overlay",className:Ot("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",e),...n})}function gI({className:e,children:n,side:s="right",showCloseButton:o=!0,...l}){return r.jsxs(pI,{children:[r.jsx(mI,{}),r.jsxs(rC,{"data-slot":"sheet-content","data-side":s,className:Ot("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",e),...l,children:[n,o&&r.jsxs(Mf,{"data-slot":"sheet-close",render:r.jsx(mo,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[r.jsx(vo,{}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function hI({className:e,...n}){return r.jsx("div",{"data-slot":"sheet-header",className:Ot("flex flex-col gap-0.5 p-4",e),...n})}function xI({className:e,...n}){return r.jsx(uC,{"data-slot":"sheet-title",className:Ot("font-heading text-base font-medium text-foreground",e),...n})}function bI({className:e,...n}){return r.jsx(eC,{"data-slot":"sheet-description",className:Ot("text-sm text-muted-foreground",e),...n})}function vI({value:e,projectPath:n,onPick:s}){const o=yI(e),l=o?_I(e):"",{data:c}=Qe(o?["/skills",n||""]:null,()=>Qi.list(n)),d=c?.skills||[],f=h.useMemo(()=>{const p=l.toLowerCase();return p?d.filter(m=>m.slug.toLowerCase().includes(p)).slice(0,8):d.slice(0,8)},[d,l]);return!o||f.length===0?null:r.jsxs("div",{className:"rounded-xl border border-border bg-popover/95 text-sm shadow-md backdrop-blur",children:[r.jsx("ul",{role:"listbox",className:"max-h-64 overflow-y-auto py-1",children:f.map(p=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>s(p.slug),className:"flex w-full items-start gap-2 px-3 py-1.5 text-left hover:bg-accent hover:text-accent-foreground",children:[r.jsxs("code",{className:"rounded bg-muted px-1.5 py-0.5 text-[11px]",children:["/",p.slug]}),r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:p.description})]})},p.slug))}),r.jsx("div",{className:"border-t border-border px-3 py-1.5 text-[10px] text-muted-foreground",children:"Type a name to filter · click to insert · the skill body will be loaded for this turn."})]})}function yI(e){return!!e.match(/^\s*\/([A-Za-z0-9_-]*)$/)}function _I(e){const n=e.match(/^\s*\/([A-Za-z0-9_-]*)$/);return n?n[1]:""}function jI(){try{const e=localStorage.getItem(Rn.robyChat);if(!e)return[];const n=JSON.parse(e);return Array.isArray(n)?n.filter(s=>s&&Array.isArray(s.parts)&&!s.pending):[]}catch{return[]}}function wI({open:e,onOpenChange:n}){const s=ob(),o=at(),[l,c]=h.useState(jI),[d,f]=h.useState(""),[p,m]=h.useState(!1),[g,b]=h.useState(""),v=h.useRef(null);h.useEffect(()=>{const E=l.filter(N=>!N.pending);try{E.length?localStorage.setItem(Rn.robyChat,JSON.stringify(E)):localStorage.removeItem(Rn.robyChat)}catch{}},[l]);const S=()=>{if(!p){c([]),f("");try{localStorage.removeItem(Rn.robyChat)}catch{}}};h.useEffect(()=>()=>v.current?.abort(),[]);const C=()=>{v.current?.abort(),m(!1)},_=E=>c(N=>{const R=[...N],T=R[R.length-1];return T?.role==="assistant"&&(R[R.length-1]=E(T)),R}),w=async()=>{const E=d.trim();if(!E||p)return;const N=new Date().toISOString(),R=l.filter(z=>!z.pending).map(z=>({role:z.role,content:Fh(z)}));c(z=>[...z,{role:"user",parts:[{kind:"text",text:E}],ts:N},{role:"assistant",parts:[],ts:N,pending:!0}]),f(""),m(!0);const T=new AbortController;v.current=T;let O=!1;const A=z=>{if(z?.type==="error"){O=!0,o.error(z.error||"error"),c(B=>{const L=[...B],D=L[L.length-1];return D?.role==="assistant"&&D.pending&&L.pop(),L});return}_(B=>kb(B,z))};try{await q2.stream(0,{prompt:E,previousMessages:R,model:g||void 0,channel:"web_sidebar"},A,T.signal),_(z=>({...z,pending:!1}))}catch(z){T.signal.aborted?_(B=>({...B,pending:!1,parts:[...B.parts,{kind:"text",text:j("project.chat.stopped_marker")}]})):O||(o.error(z.message),c(B=>{const L=[...B],D=L[L.length-1];return D?.role==="assistant"&&D.pending&&L.pop(),L}))}finally{v.current===T&&(v.current=null),m(!1)}},k=async E=>{try{await navigator.clipboard.writeText(E),o.info(j("project.chat.copied"))}catch{}};return r.jsx(fI,{open:e,onOpenChange:n,children:r.jsxs(gI,{side:"right",className:"flex w-full flex-col gap-0 p-0 sm:max-w-xl data-[side=right]:sm:max-w-xl",children:[r.jsxs(hI,{className:"pr-12",children:[r.jsxs(xI,{className:"flex items-center gap-2",children:[r.jsx(gn,{size:18})," ",j("superagent.title",{persona:s}),r.jsx("span",{className:"text-xs font-normal text-muted-fg",children:j("superagent.badge")})]}),r.jsx(bI,{children:j("superagent.desc")})]}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:l.length===0?r.jsx("p",{className:"mt-6 text-center text-sm text-muted-fg",children:j("superagent.empty",{persona:s})}):r.jsx(Eb,{msgs:l,onCopy:k})}),r.jsx(QC,{msgs:l}),r.jsxs("div",{className:"border-t border-border p-3",children:[r.jsx("div",{className:"mb-1.5",children:r.jsx(vI,{value:d,onPick:E=>f(`/${E} `)})}),r.jsx(Sb,{value:d,onValueChange:f,onSubmit:()=>void w(),onStop:C,busy:p,placeholder:j("superagent.placeholder"),footer:r.jsx(Cb,{value:g,onChange:b,disabled:p})}),r.jsx("div",{className:"mt-1.5 flex justify-end",children:r.jsxs(mo,{size:"xs",variant:"ghost",onClick:S,disabled:p||l.length===0,children:[r.jsx(nn,{className:"size-3"})," ",j("superagent.new_chat")]})})]})]})})}function SI(){const e=navigator.userAgent;return/iPhone|iPad/.test(e)?"iPhone":/Android/.test(e)?"Android":/Mac/.test(e)?"Mac":/Windows/.test(e)?"Windows PC":/Linux/.test(e)?"Linux":"browser"}function CI(){const[e,n]=h.useState({status:"loading"}),[s,o]=h.useState(0),l=h.useCallback(()=>{n({status:"loading"}),o(c=>c+1)},[]);return h.useEffect(()=>{let c=!1;return(async()=>{try{const g=await fetch("/health");if(!g.ok)throw new Error(`HTTP ${g.status}`)}catch(g){c||n({status:"error",reason:String(g)});return}const d=window.location.hash.replace(/^#/,""),f=new URLSearchParams(d),p=f.get("pair");if(p){history.replaceState(null,"",window.location.pathname+window.location.search);try{const g=await kl.confirm({pairing_id:p,label:SI(),kind:"web"});so(g.token);try{localStorage.setItem(Rn.token,g.token)}catch{}c||n({status:"ok"});return}catch{}}const m=f.get("token");if(m){so(m);try{localStorage.setItem(Rn.token,m)}catch{}history.replaceState(null,"",window.location.pathname+window.location.search)}else try{const g=localStorage.getItem(Rn.token);g&&so(g)}catch{}try{const g=await fetch("/admin/web-token");if(g.ok){const b=await g.json();if(b?.token){so(b.token);try{localStorage.setItem(Rn.token,b.token)}catch{}}}}catch{}if(!tb()){c||n({status:"unpaired"});return}try{await me.get("/projects"),c||n({status:"ok"})}catch(g){if(g instanceof Oc&&(g.status===401||g.status===403)){so(null);try{localStorage.removeItem(Rn.token)}catch{}c||n({status:"unpaired"})}else c||n({status:"error",reason:String(g)})}})(),()=>{c=!0}},[s]),{...e,reload:l}}function kI(){const e=CI();return e.status==="loading"?r.jsx(xw,{text:j("daemon.connecting")}):e.status==="error"?r.jsx(xw,{text:j("daemon.unreachable"),sub:`${j("daemon.unreachable_hint")}
622
+
623
+ ${e.reason}`}):e.status==="unpaired"?r.jsx(cI,{onPaired:e.reload}):r.jsx(Iz,{children:r.jsx(N4,{delay:300,children:r.jsx(EI,{})})})}function EI(){const e=_a(),n=Yn(),[s,o]=Uw(),{theme:l,toggle:c}=vx(),d=s.get("action")==="add-project",[f,p]=h.useState(!1),m=()=>{const g=new URLSearchParams(s);g.delete("action"),o(g,{replace:!0})};return r.jsx(Gz,{children:r.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground","data-testid":"app-shell",children:[r.jsx(AO,{onSelect:g=>e(g),onOpenRoby:()=>p(!0)}),r.jsxs("main",{className:"m-2 ml-0 flex min-w-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card shadow-sm",children:[r.jsx(NI,{onToggleTheme:c,isDark:l==="dark",pathname:n.pathname}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:r.jsxs(Dw,{children:[r.jsx($t,{path:"/",element:r.jsx(Vz,{})}),r.jsx($t,{path:"/settings/*",element:r.jsx(O8,{})}),r.jsx($t,{path:"/m/voice/*",element:r.jsx(q8,{})}),r.jsx($t,{path:"/m/desktop/*",element:r.jsx(Y8,{})}),r.jsx($t,{path:"/m/deck/*",element:r.jsx(r7,{})}),r.jsx($t,{path:"/m/code/*",element:r.jsx(lI,{})}),r.jsx($t,{path:"/p/:pid/*",element:r.jsx(IP,{})}),r.jsx($t,{path:"*",element:r.jsx(MI,{})})]})})]}),r.jsx(iI,{open:d,onClose:m}),r.jsx(wI,{open:f,onOpenChange:p})]})})}function NI({onToggleTheme:e,isDark:n,pathname:s}){const{projects:o}=zc(),l=Xz(),c=s.split("/").filter(Boolean),d=c[0]==="p"?o.find(C=>String(C.id)===c[1]):void 0,f=c[0]==="settings"?TI(c[1]):c[0]==="p"?AI(c[2]):"",p=c[0]==="p"&&c[1]==="0",m=d?.name||d?.path?.split("/").pop()||j("nav.project"),g=s==="/"?j("topbar.breadcrumb_root"):c[0]==="settings"?[j("topbar.breadcrumb_root"),j("nav.settings"),f].filter(Boolean).join(" › "):c[0]==="m"?[j("topbar.breadcrumb_root"),RI(c[1]),l].filter(Boolean).join(" › "):c[0]==="p"?p?[j("topbar.breadcrumb_root"),j("topbar.breadcrumb_base"),f].filter(Boolean).join(" › "):[j("topbar.breadcrumb_root"),j("topbar.breadcrumb_projects"),m,f].filter(Boolean).join(" › "):j("topbar.breadcrumb_root"),b=s==="/"?"":c[0]==="settings"?j("settings.subtitle"):c[0]==="p"?p?j("base.subtitle"):d?`${G2(d.kind)} · ${d.path}`:"":"",v=Fz(),S=Qz();return r.jsxs("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-border/50 px-3",children:[v&&r.jsx(qz,{collapsed:v.collapsed,onToggle:v.toggle}),r.jsxs("span",{className:"min-w-0 flex-1 truncate text-[11px] tracking-wide text-muted-fg",children:[g,b&&r.jsxs("span",{className:"text-muted-fg/50",children:[" · ",b]})]}),S,r.jsx("button",{type:"button",onClick:e,title:j(n?"topbar.light":"topbar.dark"),className:"shrink-0 rounded-md p-1.5 text-muted-fg hover:bg-accent hover:text-accent-fg",children:n?r.jsx(hA,{size:14}):r.jsx(lA,{size:14})})]})}function RI(e){switch(e){case"voice":return j("nav.modules.voice");case"desktop":return j("nav.modules.desktop");case"deck":return j("nav.modules.deck");case"code":return j("nav.modules.code");default:return e||""}}function TI(e){switch(e){case"super-agent":return j("settings.tabs.super_agent");case"engines":return j("settings.tabs.engines");case"telegram":return j("settings.tabs.telegram");case"devices":return j("settings.tabs.devices");case"appearance":return j("settings.appearance");case"config":case"advanced":return j("settings.tabs.advanced");case"identity":default:return e||""}}function AI(e){switch(e){case"chat":return j("project.nav.chat");case"telegram":return j("project.nav.telegram");case"agents":return j("project.nav.agents");case"routines":return j("project.nav.routines");case"tasks":return j("project.nav.tasks");case"mcps":return j("project.nav.mcps");case"config":return j("project.nav.config");case"workspaces":return j("base.workspaces_title");case"models":return j("settings.tabs.engines");case"agent-defaults":return j("base.defaults_title");case"sessions":return j("base.sessions_title");case"logs":return j("project.nav.logs");case"memories":return j("project.nav.memories");default:return""}}function xw({text:e,sub:n}){return r.jsx("div",{className:"grid h-screen w-screen place-items-center bg-background text-foreground",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"font-mono text-xs text-muted-fg whitespace-pre leading-none mb-4",children:` ▄███████▄
624
+ █ ██ ██ █
625
+ █ ◔ ◔ █
626
+ █ ╰~╯ █
627
+ ▀███████▀`}),r.jsx("div",{className:"text-foreground",children:e}),n&&r.jsx("pre",{className:"mt-2 max-w-xl whitespace-pre-wrap text-sm text-muted-fg",children:n})]})})}function MI(){return r.jsxs("div",{className:"p-8",children:[r.jsx("h1",{className:"text-2xl",children:j("not_found.title")}),r.jsx("p",{className:"text-muted-fg",children:j("not_found.message")})]})}XN.createRoot(document.getElementById("root")).render(r.jsx(Cc.StrictMode,{children:r.jsx(xT,{children:r.jsx(wA,{children:r.jsx(kI,{})})})}));
628
+ //# sourceMappingURL=index-DJKA763h.js.map