@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.
@@ -1,618 +0,0 @@
1
- function MN(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 Zh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $m={exports:{}},Ti={};/**
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 C1;function ON(){if(C1)return Ti;C1=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 Ti.Fragment=n,Ti.jsx=s,Ti.jsxs=s,Ti}var k1;function zN(){return k1||(k1=1,$m.exports=ON()),$m.exports}var r=zN(),Gm={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 E1;function DN(){if(E1)return rt;E1=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 M(){}var O={H:null,A:null,T:null,S:null},P=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 z(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?z(""+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(M,M):(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=O,rt.__COMPILER_RUNTIME={__proto__:null,c:function(U){return O.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)!P.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)P.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=O.T,F={};O.T=F;try{var J=U(),ie=O.S;ie!==null&&ie(F,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(M,G)}catch(re){G(re)}finally{K!==null&&F.types!==null&&(K.types=F.types),O.T=K}},rt.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},rt.use=function(U){return O.H.use(U)},rt.useActionState=function(U,K,F){return O.H.useActionState(U,K,F)},rt.useCallback=function(U,K){return O.H.useCallback(U,K)},rt.useContext=function(U){return O.H.useContext(U)},rt.useDebugValue=function(){},rt.useDeferredValue=function(U,K){return O.H.useDeferredValue(U,K)},rt.useEffect=function(U,K){return O.H.useEffect(U,K)},rt.useEffectEvent=function(U){return O.H.useEffectEvent(U)},rt.useId=function(){return O.H.useId()},rt.useImperativeHandle=function(U,K,F){return O.H.useImperativeHandle(U,K,F)},rt.useInsertionEffect=function(U,K){return O.H.useInsertionEffect(U,K)},rt.useLayoutEffect=function(U,K){return O.H.useLayoutEffect(U,K)},rt.useMemo=function(U,K){return O.H.useMemo(U,K)},rt.useOptimistic=function(U,K){return O.H.useOptimistic(U,K)},rt.useReducer=function(U,K,F){return O.H.useReducer(U,K,F)},rt.useRef=function(U){return O.H.useRef(U)},rt.useState=function(U){return O.H.useState(U)},rt.useSyncExternalStore=function(U,K,F){return O.H.useSyncExternalStore(U,K,F)},rt.useTransition=function(){return O.H.useTransition()},rt.version="19.2.7",rt}var N1;function Sc(){return N1||(N1=1,Gm.exports=DN()),Gm.exports}var x=Sc();const Cc=Zh(x),LN=MN({__proto__:null,default:Cc},[x]);var Fm={exports:{}},Ai={},Ym={exports:{}},Xm={};/**
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 R1;function PN(){return R1||(R1=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,M||(M=!0,z());else{var $=s(m);$!==null&&Y(T,$.startTime-V)}}var M=!1,O=-1,P=5,B=-1;function L(){return w?!0:!(e.unstable_now()-B<P)}function D(){if(w=!1,M){var V=e.unstable_now();B=V;var $=!0;try{e:{C=!1,_&&(_=!1,E(O),O=-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{$?z():M=!1}}}var z;if(typeof N=="function")z=function(){N(D)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,q=H.port2;H.port1.onmessage=D,z=function(){q.postMessage(null)}}else z=function(){k(D,0)};function Y(V,$){O=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"):P=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(O),O=-1):_=!0,Y(T,Z-G))):(V.sortIndex=X,n(p,V),C||S||(C=!0,M||(M=!0,z()))),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}}}})(Xm)),Xm}var T1;function IN(){return T1||(T1=1,Ym.exports=PN()),Ym.exports}var Km={exports:{}},Ln={};/**
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 A1;function BN(){if(A1)return Ln;A1=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 Ln.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Ln.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)},Ln.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()}},Ln.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))},Ln.prefetchDNS=function(p){typeof p=="string"&&o.d.D(p)},Ln.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})}},Ln.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)},Ln.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})}},Ln.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)},Ln.requestFormReset=function(p){o.d.r(p)},Ln.unstable_batchedUpdates=function(p,m){return p(m)},Ln.useFormState=function(p,m,g){return d.H.useFormState(p,m,g)},Ln.useFormStatus=function(){return d.H.useHostTransitionStatus()},Ln.version="19.2.7",Ln}var M1;function dw(){if(M1)return Km.exports;M1=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(),Km.exports=BN(),Km.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 O1;function UN(){if(O1)return Ai;O1=1;var e=IN(),n=Sc(),s=dw();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 h=i.return;if(h===null)break;var y=h.alternate;if(y===null){if(u=h.return,u!==null){i=u;continue}break}if(h.child===y.child){for(y=h.child;y;){if(y===i)return p(h),t;if(y===u)return p(h),a;y=y.sibling}throw Error(o(188))}if(i.return!==u.return)i=h,u=y;else{for(var A=!1,I=h.child;I;){if(I===i){A=!0,i=h,u=y;break}if(I===u){A=!0,u=h,i=y;break}I=I.sibling}if(!A){for(I=y.child;I;){if(I===i){A=!0,i=y,u=h;break}if(I===u){A=!0,u=y,i=h;break}I=I.sibling}if(!A)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"),M=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),D=Symbol.iterator;function z(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 M: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 O:return a=t.displayName||null,a!==null?a:q(t.type)||"Memo";case P: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)?X0(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=X0(a),t=K0(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=K0(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),ki._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 h=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=u.DetermineComponentFrameRoot(),A=y[0],I=y[1];if(A&&I){var Q=A.split(`
44
- `),ae=I.split(`
45
- `);for(h=u=0;u<Q.length&&!Q[u].includes("DetermineComponentFrameRoot");)u++;for(;h<ae.length&&!ae[h].includes("DetermineComponentFrameRoot");)h++;if(u===Q.length||h===ae.length)for(u=Q.length-1,h=ae.length-1;1<=u&&0<=h&&Q[u]!==ae[h];)h--;for(;1<=u&&0<=h;u--,h--)if(Q[u]!==ae[h]){if(u!==1||h!==1)do if(u--,h--,0>h||Q[u]!==ae[h]){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<=h);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,_e=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,nn=Math.log,Vt=Math.LN2;function mt(t){return t>>>=0,t===0?32:31-(nn(t)/Vt|0)|0}var Nt=256,Wt=262144,St=4194304;function an(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 h=0,y=t.suspendedLanes,A=t.pingedLanes;t=t.warmLanes;var I=u&134217727;return I!==0?(u=I&~y,u!==0?h=an(u):(A&=I,A!==0?h=an(A):i||(i=I&~t,i!==0&&(h=an(i))))):(I=u&~y,I!==0?h=an(I):A!==0?h=an(A):i||(i=u&~t,i!==0&&(h=an(i)))),h===0?0:a!==0&&a!==h&&(a&y)===0&&(y=h&-h,i=a&-a,y>=i||y===32&&(i&4194048)!==0)?a:h}function dn(t,a){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&a)===0}function zn(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 Xn(){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 Kn(t,a){t.pendingLanes|=a,a!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function cs(t,a,i,u,h,y){var A=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=A&~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&&Dn(t,u,0),y!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=y&~(A&~a))}function Dn(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),h=1<<u;h&a|t[u]&a&&(t[u]|=a),i&=~h}}function Pa(t,a){var i=a&-a;return i=(i&42)!==0?1:us(i),(i&(t.suspendedLanes|a))!==0?0:i}function us(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 ct(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:b1(t.type))}function Sn(t,a){var i=$.p;try{return $.p=t,a()}finally{$.p=i}}var sn=Math.random().toString(36).slice(2),Rt="__reactFiber$"+sn,gn="__reactProps$"+sn,Dr="__reactContainer$"+sn,Lc="__reactEvents$"+sn,_k="__reactListeners$"+sn,jk="__reactHandles$"+sn,Db="__reactResources$"+sn,Hl="__reactMarker$"+sn;function Lf(t){delete t[Rt],delete t[gn],delete t[Lc],delete t[_k],delete t[jk]}function Co(t){var a=t[Rt];if(a)return a;for(var i=t.parentNode;i;){if(a=i[Dr]||i[Rt]){if(i=a.alternate,a.child!==null||i!==null&&i.child!==null)for(t=n1(t);t!==null;){if(i=t[Rt])return i;t=n1(t)}return a}t=i,i=t.parentNode}return null}function ko(t){if(t=t[Rt]||t[Dr]){var a=t.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return t}return null}function Vl(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[Db];return a||(a=t[Db]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function jn(t){t[Hl]=!0}var Lb=new Set,Pb={};function Lr(t,a){No(t,a),No(t+"Capture",a)}function No(t,a){for(Pb[t]=a,t=0;t<a.length;t++)Lb.add(a[t])}var wk=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]*$"),Ib={},Bb={};function Sk(t){return we.call(Bb,t)?!0:we.call(Ib,t)?!1:wk.test(t)?Bb[t]=!0:(Ib[t]=!0,!1)}function Pc(t,a,i){if(Sk(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 ds(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 ya(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Ub(t){var a=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Ck(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 h=u.get,y=u.set;return Object.defineProperty(t,a,{configurable:!0,get:function(){return h.call(this)},set:function(A){i=""+A,y.call(this,A)}}),Object.defineProperty(t,a,{enumerable:u.enumerable}),{getValue:function(){return i},setValue:function(A){i=""+A},stopTracking:function(){t._valueTracker=null,delete t[a]}}}}function Pf(t){if(!t._valueTracker){var a=Ub(t)?"checked":"value";t._valueTracker=Ck(t,a,""+t[a])}}function Hb(t){if(!t)return!1;var a=t._valueTracker;if(!a)return!0;var i=a.getValue(),u="";return t&&(u=Ub(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 kk=/[\n"\\]/g;function _a(t){return t.replace(kk,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function If(t,a,i,u,h,y,A,I){t.name="",A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?t.type=A:t.removeAttribute("type"),a!=null?A==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+ya(a)):t.value!==""+ya(a)&&(t.value=""+ya(a)):A!=="submit"&&A!=="reset"||t.removeAttribute("value"),a!=null?Bf(t,A,ya(a)):i!=null?Bf(t,A,ya(i)):u!=null&&t.removeAttribute("value"),h==null&&y!=null&&(t.defaultChecked=!!y),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?t.name=""+ya(I):t.removeAttribute("name")}function Vb(t,a,i,u,h,y,A,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)){Pf(t);return}i=i!=null?""+ya(i):"",a=a!=null?""+ya(a):i,I||a===t.value||(t.value=a),t.defaultValue=a}u=u??h,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=I?t.checked:!!u,t.defaultChecked=!!u,A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(t.name=A),Pf(t)}function Bf(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 h=0;h<i.length;h++)a["$"+i[h]]=!0;for(i=0;i<t.length;i++)h=a.hasOwnProperty("$"+t[i].value),t[i].selected!==h&&(t[i].selected=h),h&&u&&(t[i].defaultSelected=!0)}else{for(i=""+ya(i),a=null,h=0;h<t.length;h++){if(t[h].value===i){t[h].selected=!0,u&&(t[h].defaultSelected=!0);return}a!==null||t[h].disabled||(a=t[h])}a!==null&&(a.selected=!0)}}function qb(t,a,i){if(a!=null&&(a=""+ya(a),a!==t.value&&(t.value=a),i==null)){t.defaultValue!==a&&(t.defaultValue=a);return}t.defaultValue=i!=null?""+ya(i):""}function $b(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=ya(a),t.defaultValue=i,u=t.textContent,u===i&&u!==""&&u!==null&&(t.value=u),Pf(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 Ek=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 Gb(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||Ek.has(a)?a==="float"?t.cssFloat=i:t[a]=(""+i).trim():t[a]=i+"px"}function Fb(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 h in a)u=a[h],a.hasOwnProperty(h)&&i[h]!==u&&Gb(t,h,u)}else for(var y in a)a.hasOwnProperty(y)&&Gb(t,y,a[y])}function Uf(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 Nk=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"]]),Rk=/^[\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 Rk.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function fs(){}var Hf=null;function Vf(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 Yb(t){var a=ko(t);if(a&&(t=a.stateNode)){var i=t[gn]||null;e:switch(t=a.stateNode,a.type){case"input":if(If(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="'+_a(""+a)+'"][type="radio"]'),a=0;a<i.length;a++){var u=i[a];if(u!==t&&u.form===t.form){var h=u[gn]||null;if(!h)throw Error(o(90));If(u,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(a=0;a<i.length;a++)u=i[a],u.form===t.form&&Hb(u)}break e;case"textarea":qb(t,i.value,i.defaultValue);break e;case"select":a=i.value,a!=null&&Ro(t,!!i.multiple,a,!1)}}}var qf=!1;function Xb(t,a,i){if(qf)return t(a,i);qf=!0;try{var u=t(a);return u}finally{if(qf=!1,(Ao!==null||Mo!==null)&&(Eu(),Ao&&(a=Ao,t=Mo,Mo=Ao=null,Yb(a),t)))for(a=0;a<t.length;a++)Yb(t[a])}}function ql(t,a){var i=t.stateNode;if(i===null)return null;var u=i[gn]||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 ps=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$f=!1;if(ps)try{var $l={};Object.defineProperty($l,"passive",{get:function(){$f=!0}}),window.addEventListener("test",$l,$l),window.removeEventListener("test",$l,$l)}catch{$f=!1}var Gs=null,Gf=null,Hc=null;function Kb(){if(Hc)return Hc;var t,a=Gf,i=a.length,u,h="value"in Gs?Gs.value:Gs.textContent,y=h.length;for(t=0;t<i&&a[t]===h[t];t++);var A=i-t;for(u=1;u<=A&&a[i-u]===h[y-u];u++);return Hc=h.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 Qb(){return!1}function Qn(t){function a(i,u,h,y,A){this._reactName=i,this._targetInst=h,this.type=u,this.nativeEvent=y,this.target=A,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:Qb,this.isPropagationStopped=Qb,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 Pr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$c=Qn(Pr),Gl=b({},Pr,{view:0,detail:0}),Tk=Qn(Gl),Ff,Yf,Fl,Gc=b({},Gl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Kf,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!==Fl&&(Fl&&t.type==="mousemove"?(Ff=t.screenX-Fl.screenX,Yf=t.screenY-Fl.screenY):Yf=Ff=0,Fl=t),Ff)},movementY:function(t){return"movementY"in t?t.movementY:Yf}}),Zb=Qn(Gc),Ak=b({},Gc,{dataTransfer:0}),Mk=Qn(Ak),Ok=b({},Gl,{relatedTarget:0}),Xf=Qn(Ok),zk=b({},Pr,{animationName:0,elapsedTime:0,pseudoElement:0}),Dk=Qn(zk),Lk=b({},Pr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Pk=Qn(Lk),Ik=b({},Pr,{data:0}),Wb=Qn(Ik),Bk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Uk={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"},Hk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Vk(t){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(t):(t=Hk[t])?!!a[t]:!1}function Kf(){return Vk}var qk=b({},Gl,{key:function(t){if(t.key){var a=Bk[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"?Uk[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Kf,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}}),$k=Qn(qk),Gk=b({},Gc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jb=Qn(Gk),Fk=b({},Gl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Kf}),Yk=Qn(Fk),Xk=b({},Pr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Kk=Qn(Xk),Qk=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}),Zk=Qn(Qk),Wk=b({},Pr,{newState:0,oldState:0}),Jk=Qn(Wk),eE=[9,13,27,32],Qf=ps&&"CompositionEvent"in window,Yl=null;ps&&"documentMode"in document&&(Yl=document.documentMode);var tE=ps&&"TextEvent"in window&&!Yl,ev=ps&&(!Qf||Yl&&8<Yl&&11>=Yl),tv=" ",nv=!1;function av(t,a){switch(t){case"keyup":return eE.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sv(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Oo=!1;function nE(t,a){switch(t){case"compositionend":return sv(a);case"keypress":return a.which!==32?null:(nv=!0,tv);case"textInput":return t=a.data,t===tv&&nv?null:t;default:return null}}function aE(t,a){if(Oo)return t==="compositionend"||!Qf&&av(t,a)?(t=Kb(),Hc=Gf=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 ev&&a.locale!=="ko"?null:a.data;default:return null}}var sE={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 rv(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a==="input"?!!sE[t.type]:a==="textarea"}function ov(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 Xl=null,Kl=null;function rE(t){V0(t,0)}function Fc(t){var a=Vl(t);if(Hb(a))return t}function lv(t,a){if(t==="change")return a}var iv=!1;if(ps){var Zf;if(ps){var Wf="oninput"in document;if(!Wf){var cv=document.createElement("div");cv.setAttribute("oninput","return;"),Wf=typeof cv.oninput=="function"}Zf=Wf}else Zf=!1;iv=Zf&&(!document.documentMode||9<document.documentMode)}function uv(){Xl&&(Xl.detachEvent("onpropertychange",dv),Kl=Xl=null)}function dv(t){if(t.propertyName==="value"&&Fc(Kl)){var a=[];ov(a,Kl,t,Vf(t)),Xb(rE,a)}}function oE(t,a,i){t==="focusin"?(uv(),Xl=a,Kl=i,Xl.attachEvent("onpropertychange",dv)):t==="focusout"&&uv()}function lE(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Fc(Kl)}function iE(t,a){if(t==="click")return Fc(a)}function cE(t,a){if(t==="input"||t==="change")return Fc(a)}function uE(t,a){return t===a&&(t!==0||1/t===1/a)||t!==t&&a!==a}var ua=typeof Object.is=="function"?Object.is:uE;function Ql(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 h=i[u];if(!we.call(a,h)||!ua(t[h],a[h]))return!1}return!0}function fv(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function pv(t,a){var i=fv(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=fv(i)}}function mv(t,a){return t&&a?t===a?!0:t&&t.nodeType===3?!1:a&&a.nodeType===3?mv(t,a.parentNode):"contains"in t?t.contains(a):t.compareDocumentPosition?!!(t.compareDocumentPosition(a)&16):!1:!1}function gv(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 Jf(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 dE=ps&&"documentMode"in document&&11>=document.documentMode,zo=null,ep=null,Zl=null,tp=!1;function hv(t,a,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;tp||zo==null||zo!==Bc(u)||(u=zo,"selectionStart"in u&&Jf(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}),Zl&&Ql(Zl,u)||(Zl=u,u=zu(ep,"onSelect"),0<u.length&&(a=new $c("onSelect","select",null,a,i),t.push({event:a,listeners:u}),a.target=zo)))}function Ir(t,a){var i={};return i[t.toLowerCase()]=a.toLowerCase(),i["Webkit"+t]="webkit"+a,i["Moz"+t]="moz"+a,i}var Do={animationend:Ir("Animation","AnimationEnd"),animationiteration:Ir("Animation","AnimationIteration"),animationstart:Ir("Animation","AnimationStart"),transitionrun:Ir("Transition","TransitionRun"),transitionstart:Ir("Transition","TransitionStart"),transitioncancel:Ir("Transition","TransitionCancel"),transitionend:Ir("Transition","TransitionEnd")},np={},xv={};ps&&(xv=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 Br(t){if(np[t])return np[t];if(!Do[t])return t;var a=Do[t],i;for(i in a)if(a.hasOwnProperty(i)&&i in xv)return np[t]=a[i];return t}var bv=Br("animationend"),vv=Br("animationiteration"),yv=Br("animationstart"),fE=Br("transitionrun"),pE=Br("transitionstart"),mE=Br("transitioncancel"),_v=Br("transitionend"),jv=new Map,ap="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(" ");ap.push("scrollEnd");function Ia(t,a){jv.set(t,a),Lr(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)},ja=[],Lo=0,sp=0;function Xc(){for(var t=Lo,a=sp=Lo=0;a<t;){var i=ja[a];ja[a++]=null;var u=ja[a];ja[a++]=null;var h=ja[a];ja[a++]=null;var y=ja[a];if(ja[a++]=null,u!==null&&h!==null){var A=u.pending;A===null?h.next=h:(h.next=A.next,A.next=h),u.pending=h}y!==0&&wv(i,h,y)}}function Kc(t,a,i,u){ja[Lo++]=t,ja[Lo++]=a,ja[Lo++]=i,ja[Lo++]=u,sp|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function rp(t,a,i,u){return Kc(t,a,i,u),Qc(t)}function Ur(t,a){return Kc(t,null,null,a),Qc(t)}function wv(t,a,i){t.lanes|=i;var u=t.alternate;u!==null&&(u.lanes|=i);for(var h=!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||(h=!0)),t=y,y=y.return;return t.tag===3?(y=t.stateNode,h&&a!==null&&(h=31-st(i),t=y.hiddenUpdates,u=t[h],u===null?t[h]=[a]:u.push(a),a.lane=i|536870912),y):null}function Qc(t){if(50<vi)throw vi=0,mm=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 gE(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 gE(t,a,i,u)}function op(t){return t=t.prototype,!(!t||!t.isReactComponent)}function ms(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 Sv(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,h,y){var A=0;if(u=t,typeof t=="function")op(t)&&(A=1);else if(typeof t=="string")A=yN(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,h),t.elementType=B,t.lanes=y,t;case _:return Hr(i.children,h,y,a);case w:A=8,h|=24;break;case k:return t=da(12,i,a,h|2),t.elementType=k,t.lanes=y,t;case T:return t=da(13,i,a,h),t.elementType=T,t.lanes=y,t;case M:return t=da(19,i,a,h),t.elementType=M,t.lanes=y,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case N:A=10;break e;case E:A=9;break e;case R:A=11;break e;case O:A=14;break e;case P:A=16,u=null;break e}A=29,i=Error(o(130,t===null?"null":typeof t,"")),u=null}return a=da(A,i,a,h),a.elementType=t,a.type=u,a.lanes=y,a}function Hr(t,a,i,u){return t=da(7,t,u,a),t.lanes=i,t}function lp(t,a,i){return t=da(6,t,null,a),t.lanes=i,t}function Cv(t){var a=da(18,null,null,0);return a.stateNode=t,a}function ip(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 kv=new WeakMap;function wa(t,a){if(typeof t=="object"&&t!==null){var i=kv.get(t);return i!==void 0?i:(a={value:t,source:a,stack:Ae(a)},kv.set(t,a),a)}return{value:t,source:a,stack:Ae(a)}}var Io=[],Bo=0,Wc=null,Wl=0,Sa=[],Ca=0,Fs=null,Fa=1,Ya="";function gs(t,a){Io[Bo++]=Wl,Io[Bo++]=Wc,Wc=t,Wl=a}function Ev(t,a,i){Sa[Ca++]=Fa,Sa[Ca++]=Ya,Sa[Ca++]=Fs,Fs=t;var u=Fa;t=Ya;var h=32-st(u)-1;u&=~(1<<h),i+=1;var y=32-st(a)+h;if(30<y){var A=h-h%5;y=(u&(1<<A)-1).toString(32),u>>=A,h-=A,Fa=1<<32-st(a)+h|i<<h|u,Ya=y+t}else Fa=1<<y|i<<h|u,Ya=t}function cp(t){t.return!==null&&(gs(t,1),Ev(t,1,0))}function up(t){for(;t===Wc;)Wc=Io[--Bo],Io[Bo]=null,Wl=Io[--Bo],Io[Bo]=null;for(;t===Fs;)Fs=Sa[--Ca],Sa[Ca]=null,Ya=Sa[--Ca],Sa[Ca]=null,Fa=Sa[--Ca],Sa[Ca]=null}function Nv(t,a){Sa[Ca++]=Fa,Sa[Ca++]=Ya,Sa[Ca++]=Fs,Fa=a.id,Ya=a.overflow,Fs=t}var Cn=null,Yt=null,jt=!1,Ys=null,ka=!1,dp=Error(o(519));function Xs(t){var a=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Jl(wa(a,t)),dp}function Rv(t){var a=t.stateNode,i=t.type,u=t.memoizedProps;switch(a[Rt]=t,a[gn]=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<_i.length;i++)ht(_i[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),Vb(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),$b(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||F0(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=fs),a=!0):a=!1,a||Xs(t,!0)}function Tv(t){for(Cn=t.return;Cn;)switch(Cn.tag){case 5:case 31:case 13:ka=!1;return;case 27:case 3:ka=!0;return;default:Cn=Cn.return}}function Uo(t){if(t!==Cn)return!1;if(!jt)return Tv(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")||Rm(t.type,t.memoizedProps)),i=!i),i&&Yt&&Xs(t),Tv(t),a===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(o(317));Yt=t1(t)}else if(a===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(o(317));Yt=t1(t)}else a===27?(a=Yt,ir(t.type)?(t=zm,zm=null,Yt=t):Yt=a):Yt=Cn?Na(t.stateNode.nextSibling):null;return!0}function Vr(){Yt=Cn=null,jt=!1}function fp(){var t=Ys;return t!==null&&(ea===null?ea=t:ea.push.apply(ea,t),Ys=null),t}function Jl(t){Ys===null?Ys=[t]:Ys.push(t)}var pp=U(null),qr=null,hs=null;function Ks(t,a,i){F(pp,a._currentValue),a._currentValue=i}function xs(t){t._currentValue=pp.current,K(pp)}function mp(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 gp(t,a,i,u){var h=t.child;for(h!==null&&(h.return=t);h!==null;){var y=h.dependencies;if(y!==null){var A=h.child;y=y.firstContext;e:for(;y!==null;){var I=y;y=h;for(var Q=0;Q<a.length;Q++)if(I.context===a[Q]){y.lanes|=i,I=y.alternate,I!==null&&(I.lanes|=i),mp(y.return,i,t),u||(A=null);break e}y=I.next}}else if(h.tag===18){if(A=h.return,A===null)throw Error(o(341));A.lanes|=i,y=A.alternate,y!==null&&(y.lanes|=i),mp(A,i,t),A=null}else A=h.child;if(A!==null)A.return=h;else for(A=h;A!==null;){if(A===t){A=null;break}if(h=A.sibling,h!==null){h.return=A.return,A=h;break}A=A.return}h=A}}function Ho(t,a,i,u){t=null;for(var h=a,y=!1;h!==null;){if(!y){if((h.flags&524288)!==0)y=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var A=h.alternate;if(A===null)throw Error(o(387));if(A=A.memoizedProps,A!==null){var I=h.type;ua(h.pendingProps.value,A.value)||(t!==null?t.push(I):t=[I])}}else if(h===oe.current){if(A=h.alternate,A===null)throw Error(o(387));A.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(ki):t=[ki])}h=h.return}t!==null&&gp(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 $r(t){qr=t,hs=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function kn(t){return Av(qr,t)}function eu(t,a){return qr===null&&$r(t),Av(t,a)}function Av(t,a){var i=a._currentValue;if(a={context:a,memoizedValue:i,next:null},hs===null){if(t===null)throw Error(o(308));hs=a,t.dependencies={lanes:0,firstContext:a},t.flags|=524288}else hs=hs.next=a;return i}var hE=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()})}},xE=e.unstable_scheduleCallback,bE=e.unstable_NormalPriority,hn={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function hp(){return{controller:new hE,data:new Map,refCount:0}}function ei(t){t.refCount--,t.refCount===0&&xE(bE,function(){t.controller.abort()})}var ti=null,xp=0,Vo=0,qo=null;function vE(t,a){if(ti===null){var i=ti=[];xp=0,Vo=ym(),qo={status:"pending",value:void 0,then:function(u){i.push(u)}}}return xp++,a.then(Mv,Mv),a}function Mv(){if(--xp===0&&ti!==null){qo!==null&&(qo.status="fulfilled");var t=ti;ti=null,Vo=0,qo=null;for(var a=0;a<t.length;a++)(0,t[a])()}}function yE(t,a){var i=[],u={status:"pending",value:null,reason:null,then:function(h){i.push(h)}};return t.then(function(){u.status="fulfilled",u.value=a;for(var h=0;h<i.length;h++)(0,i[h])(a)},function(h){for(u.status="rejected",u.reason=h,h=0;h<i.length;h++)(0,i[h])(void 0)}),u}var Ov=V.S;V.S=function(t,a){h0=ye(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&vE(t,a),Ov!==null&&Ov(t,a)};var Gr=U(null);function bp(){var t=Gr.current;return t!==null?t:qt.pooledCache}function tu(t,a){a===null?F(Gr,Gr.current):F(Gr,a.pool)}function zv(){var t=bp();return t===null?null:{parent:hn._currentValue,pool:t}}var $o=Error(o(460)),vp=Error(o(474)),nu=Error(o(542)),au={then:function(){}};function Dv(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Lv(t,a,i){switch(i=t[i],i===void 0?t.push(a):i!==a&&(a.then(fs,fs),a=i),a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,Iv(t),t;default:if(typeof a.status=="string")a.then(fs,fs);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 h=a;h.status="fulfilled",h.value=u}},function(u){if(a.status==="pending"){var h=a;h.status="rejected",h.reason=u}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,Iv(t),t}throw Yr=a,$o}}function Fr(t){try{var a=t._init;return a(t._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(Yr=i,$o):i}}var Yr=null;function Pv(){if(Yr===null)throw Error(o(459));var t=Yr;return Yr=null,t}function Iv(t){if(t===$o||t===nu)throw Error(o(483))}var Go=null,ni=0;function su(t){var a=ni;return ni+=1,Go===null&&(Go=[]),Lv(Go,t,a)}function ai(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 Bv(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 h(te,W){return te=ms(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 A(te){return t&&te.alternate===null&&(te.flags|=67108866),te}function I(te,W,ne,he){return W===null||W.tag!==6?(W=lp(ne,te.mode,he),W.return=te,W):(W=h(W,ne),W.return=te,W)}function Q(te,W,ne,he){var Qe=ne.type;return Qe===_?fe(te,W,ne.props.children,he,ne.key):W!==null&&(W.elementType===Qe||typeof Qe=="object"&&Qe!==null&&Qe.$$typeof===P&&Fr(Qe)===W.type)?(W=h(W,ne.props),ai(W,ne),W.return=te,W):(W=Zc(ne.type,ne.key,ne.props,null,te.mode,he),ai(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=ip(ne,te.mode,he),W.return=te,W):(W=h(W,ne.children||[]),W.return=te,W)}function fe(te,W,ne,he,Qe){return W===null||W.tag!==7?(W=Hr(ne,te.mode,he,Qe),W.return=te,W):(W=h(W,ne),W.return=te,W)}function xe(te,W,ne){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return W=lp(""+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),ai(ne,W),ne.return=te,ne;case C:return W=ip(W,te.mode,ne),W.return=te,W;case P:return W=Fr(W),xe(te,W,ne)}if(Y(W)||z(W))return W=Hr(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 Qe=W!==null?W.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return Qe!==null?null:I(te,W,""+ne,he);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case S:return ne.key===Qe?Q(te,W,ne,he):null;case C:return ne.key===Qe?ae(te,W,ne,he):null;case P:return ne=Fr(ne),se(te,W,ne,he)}if(Y(ne)||z(ne))return Qe!==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,Qe){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return te=te.get(ne)||null,I(W,te,""+he,Qe);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,Qe);case C:return te=te.get(he.key===null?ne:he.key)||null,ae(W,te,he,Qe);case P:return he=Fr(he),ue(te,W,ne,he,Qe)}if(Y(he)||z(he))return te=te.get(ne)||null,fe(W,te,he,Qe,null);if(typeof he.then=="function")return ue(te,W,ne,su(he),Qe);if(he.$$typeof===N)return ue(te,W,ne,eu(W,he),Qe);ru(W,he)}return null}function He(te,W,ne,he){for(var Qe=null,Ct=null,Ge=W,ut=W=0,bt=null;Ge!==null&&ut<ne.length;ut++){Ge.index>ut?(bt=Ge,Ge=null):bt=Ge.sibling;var kt=se(te,Ge,ne[ut],he);if(kt===null){Ge===null&&(Ge=bt);break}t&&Ge&&kt.alternate===null&&a(te,Ge),W=y(kt,W,ut),Ct===null?Qe=kt:Ct.sibling=kt,Ct=kt,Ge=bt}if(ut===ne.length)return i(te,Ge),jt&&gs(te,ut),Qe;if(Ge===null){for(;ut<ne.length;ut++)Ge=xe(te,ne[ut],he),Ge!==null&&(W=y(Ge,W,ut),Ct===null?Qe=Ge:Ct.sibling=Ge,Ct=Ge);return jt&&gs(te,ut),Qe}for(Ge=u(Ge);ut<ne.length;ut++)bt=ue(Ge,te,ut,ne[ut],he),bt!==null&&(t&&bt.alternate!==null&&Ge.delete(bt.key===null?ut:bt.key),W=y(bt,W,ut),Ct===null?Qe=bt:Ct.sibling=bt,Ct=bt);return t&&Ge.forEach(function(pr){return a(te,pr)}),jt&&gs(te,ut),Qe}function et(te,W,ne,he){if(ne==null)throw Error(o(151));for(var Qe=null,Ct=null,Ge=W,ut=W=0,bt=null,kt=ne.next();Ge!==null&&!kt.done;ut++,kt=ne.next()){Ge.index>ut?(bt=Ge,Ge=null):bt=Ge.sibling;var pr=se(te,Ge,kt.value,he);if(pr===null){Ge===null&&(Ge=bt);break}t&&Ge&&pr.alternate===null&&a(te,Ge),W=y(pr,W,ut),Ct===null?Qe=pr:Ct.sibling=pr,Ct=pr,Ge=bt}if(kt.done)return i(te,Ge),jt&&gs(te,ut),Qe;if(Ge===null){for(;!kt.done;ut++,kt=ne.next())kt=xe(te,kt.value,he),kt!==null&&(W=y(kt,W,ut),Ct===null?Qe=kt:Ct.sibling=kt,Ct=kt);return jt&&gs(te,ut),Qe}for(Ge=u(Ge);!kt.done;ut++,kt=ne.next())kt=ue(Ge,te,ut,kt.value,he),kt!==null&&(t&&kt.alternate!==null&&Ge.delete(kt.key===null?ut:kt.key),W=y(kt,W,ut),Ct===null?Qe=kt:Ct.sibling=kt,Ct=kt);return t&&Ge.forEach(function(AN){return a(te,AN)}),jt&&gs(te,ut),Qe}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 Qe=ne.key;W!==null;){if(W.key===Qe){if(Qe=ne.type,Qe===_){if(W.tag===7){i(te,W.sibling),he=h(W,ne.props.children),he.return=te,te=he;break e}}else if(W.elementType===Qe||typeof Qe=="object"&&Qe!==null&&Qe.$$typeof===P&&Fr(Qe)===W.type){i(te,W.sibling),he=h(W,ne.props),ai(he,ne),he.return=te,te=he;break e}i(te,W);break}else a(te,W);W=W.sibling}ne.type===_?(he=Hr(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),ai(he,ne),he.return=te,te=he)}return A(te);case C:e:{for(Qe=ne.key;W!==null;){if(W.key===Qe)if(W.tag===4&&W.stateNode.containerInfo===ne.containerInfo&&W.stateNode.implementation===ne.implementation){i(te,W.sibling),he=h(W,ne.children||[]),he.return=te,te=he;break e}else{i(te,W);break}else a(te,W);W=W.sibling}he=ip(ne,te.mode,he),he.return=te,te=he}return A(te);case P:return ne=Fr(ne),It(te,W,ne,he)}if(Y(ne))return He(te,W,ne,he);if(z(ne)){if(Qe=z(ne),typeof Qe!="function")throw Error(o(150));return ne=Qe.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=h(W,ne),he.return=te,te=he):(i(te,W),he=lp(ne,te.mode,he),he.return=te,te=he),A(te)):i(te,W)}return function(te,W,ne,he){try{ni=0;var Qe=It(te,W,ne,he);return Go=null,Qe}catch(Ge){if(Ge===$o||Ge===nu)throw Ge;var Ct=da(29,Ge,null,te.mode);return Ct.lanes=he,Ct.return=te,Ct}finally{}}}var Xr=Bv(!0),Uv=Bv(!1),Qs=!1;function yp(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function _p(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 h=u.pending;return h===null?a.next=a:(a.next=h.next,h.next=a),u.pending=a,a=Qc(t),wv(t,null,i),a}return Kc(t,u,a,i),Qc(t)}function si(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 jp(t,a){var i=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var h=null,y=null;if(i=i.firstBaseUpdate,i!==null){do{var A={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};y===null?h=y=A:y=y.next=A,i=i.next}while(i!==null);y===null?h=y=a:y=y.next=a}else h=y=a;i={baseState:u.baseState,firstBaseUpdate:h,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 wp=!1;function ri(){if(wp){var t=qo;if(t!==null)throw t}}function oi(t,a,i,u){wp=!1;var h=t.updateQueue;Qs=!1;var y=h.firstBaseUpdate,A=h.lastBaseUpdate,I=h.shared.pending;if(I!==null){h.shared.pending=null;var Q=I,ae=Q.next;Q.next=null,A===null?y=ae:A.next=ae,A=Q;var fe=t.alternate;fe!==null&&(fe=fe.updateQueue,I=fe.lastBaseUpdate,I!==A&&(I===null?fe.firstBaseUpdate=ae:I.next=ae,fe.lastBaseUpdate=Q))}if(y!==null){var xe=h.baseState;A=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&&(wp=!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=h.callbacks,ue===null?h.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,A|=se;if(I=I.next,I===null){if(I=h.shared.pending,I===null)break;ue=I,I=ue.next,ue.next=null,h.lastBaseUpdate=ue,h.shared.pending=null}}while(!0);fe===null&&(Q=xe),h.baseState=Q,h.firstBaseUpdate=ae,h.lastBaseUpdate=fe,y===null&&(h.shared.lanes=0),ar|=A,t.lanes=A,t.memoizedState=xe}}function Hv(t,a){if(typeof t!="function")throw Error(o(191,t));t.call(a)}function Vv(t,a){var i=t.callbacks;if(i!==null)for(t.callbacks=null,t=0;t<i.length;t++)Hv(i[t],a)}var Fo=U(null),ou=U(0);function qv(t,a){t=ks,F(ou,t),F(Fo,a),ks=t|a.baseLanes}function Sp(){F(ou,ks),F(Fo,Fo.current)}function Cp(){ks=ou.current,K(Fo),K(ou)}var fa=U(null),Ea=null;function Js(t){var a=t.alternate;F(fn,fn.current&1),F(fa,t),Ea===null&&(a===null||Fo.current!==null||a.memoizedState!==null)&&(Ea=t)}function kp(t){F(fn,fn.current),F(fa,t),Ea===null&&(Ea=t)}function $v(t){t.tag===22?(F(fn,fn.current),F(fa,t),Ea===null&&(Ea=t)):er()}function er(){F(fn,fn.current),F(fa,fa.current)}function pa(t){K(fa),Ea===t&&(Ea=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||Mm(i)||Om(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 bs=0,ot=null,Lt=null,xn=null,iu=!1,Yo=!1,Kr=!1,cu=0,li=0,Xo=null,_E=0;function rn(){throw Error(o(321))}function Ep(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 Np(t,a,i,u,h,y){return bs=y,ot=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,V.H=t===null||t.memoizedState===null?Ey:qp,Kr=!1,y=i(u,h),Kr=!1,Yo&&(y=Fv(a,i,u,h)),Gv(t),y}function Gv(t){V.H=ui;var a=Lt!==null&&Lt.next!==null;if(bs=0,xn=Lt=ot=null,iu=!1,li=0,Xo=null,a)throw Error(o(300));t===null||bn||(t=t.dependencies,t!==null&&Jc(t)&&(bn=!0))}function Fv(t,a,i,u){ot=t;var h=0;do{if(Yo&&(Xo=null),li=0,Yo=!1,25<=h)throw Error(o(301));if(h+=1,xn=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=Ny,y=a(i,u)}while(Yo);return y}function jE(){var t=V.H,a=t.useState()[0];return a=typeof a.then=="function"?ii(a):a,t=t.useState()[0],(Lt!==null?Lt.memoizedState:null)!==t&&(ot.flags|=1024),a}function Rp(){var t=cu!==0;return cu=0,t}function Tp(t,a,i){a.updateQueue=t.updateQueue,a.flags&=-2053,t.lanes&=~i}function Ap(t){if(iu){for(t=t.memoizedState;t!==null;){var a=t.queue;a!==null&&(a.pending=null),t=t.next}iu=!1}bs=0,xn=Lt=ot=null,Yo=!1,li=cu=0,Xo=null}function qn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xn===null?ot.memoizedState=xn=t:xn=xn.next=t,xn}function pn(){if(Lt===null){var t=ot.alternate;t=t!==null?t.memoizedState:null}else t=Lt.next;var a=xn===null?ot.memoizedState:xn.next;if(a!==null)xn=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},xn===null?ot.memoizedState=xn=t:xn=xn.next=t}return xn}function uu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ii(t){var a=li;return li+=1,Xo===null&&(Xo=[]),t=Lv(Xo,t,a),a=ot,(xn===null?a.memoizedState:xn.next)===null&&(a=a.alternate,V.H=a===null||a.memoizedState===null?Ey:qp),t}function du(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return ii(t);if(t.$$typeof===N)return kn(t)}throw Error(o(438,String(t)))}function Mp(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(h){return h.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 vs(t,a){return typeof a=="function"?a(t):a}function fu(t){var a=pn();return Op(a,Lt,t)}function Op(t,a,i){var u=t.queue;if(u===null)throw Error(o(311));u.lastRenderedReducer=i;var h=t.baseQueue,y=u.pending;if(y!==null){if(h!==null){var A=h.next;h.next=y.next,y.next=A}a.baseQueue=h=y,u.pending=null}if(y=t.baseState,h===null)t.memoizedState=y;else{a=h.next;var I=A=null,Q=null,ae=a,fe=!1;do{var xe=ae.lane&-536870913;if(xe!==ae.lane?(xt&xe)===xe:(bs&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((bs&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,A=y):Q=Q.next=xe,ot.lanes|=se,ar|=se;xe=ae.action,Kr&&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,A=y):Q=Q.next=se,ot.lanes|=xe,ar|=xe;ae=ae.next}while(ae!==null&&ae!==a);if(Q===null?A=y:Q.next=I,!ua(y,t.memoizedState)&&(bn=!0,fe&&(i=qo,i!==null)))throw i;t.memoizedState=y,t.baseState=A,t.baseQueue=Q,u.lastRenderedState=y}return h===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function zp(t){var a=pn(),i=a.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=t;var u=i.dispatch,h=i.pending,y=a.memoizedState;if(h!==null){i.pending=null;var A=h=h.next;do y=t(y,A.action),A=A.next;while(A!==h);ua(y,a.memoizedState)||(bn=!0),a.memoizedState=y,a.baseQueue===null&&(a.baseState=y),i.lastRenderedState=y}return[y,u]}function Yv(t,a,i){var u=ot,h=pn(),y=jt;if(y){if(i===void 0)throw Error(o(407));i=i()}else i=a();var A=!ua((Lt||h).memoizedState,i);if(A&&(h.memoizedState=i,bn=!0),h=h.queue,Pp(Qv.bind(null,u,h,t),[t]),h.getSnapshot!==a||A||xn!==null&&xn.memoizedState.tag&1){if(u.flags|=2048,Ko(9,{destroy:void 0},Kv.bind(null,u,h,i,a),null),qt===null)throw Error(o(349));y||(bs&127)!==0||Xv(u,a,i)}return i}function Xv(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 Kv(t,a,i,u){a.value=i,a.getSnapshot=u,Zv(a)&&Wv(t)}function Qv(t,a,i){return i(function(){Zv(a)&&Wv(t)})}function Zv(t){var a=t.getSnapshot;t=t.value;try{var i=a();return!ua(t,i)}catch{return!0}}function Wv(t){var a=Ur(t,2);a!==null&&ta(a,t,2)}function Dp(t){var a=qn();if(typeof t=="function"){var i=t;if(t=i(),Kr){qe(!0);try{i()}finally{qe(!1)}}}return a.memoizedState=a.baseState=t,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:vs,lastRenderedState:t},a}function Jv(t,a,i,u){return t.baseState=i,Op(t,Lt,typeof u=="function"?u:vs)}function wE(t,a,i,u,h){if(gu(t))throw Error(o(485));if(t=a.action,t!==null){var y={payload:h,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(A){y.listeners.push(A)}};V.T!==null?i(!0):y.isTransition=!1,u(y),i=a.pending,i===null?(y.next=a.pending=y,ey(a,y)):(y.next=i.next,a.pending=i.next=y)}}function ey(t,a){var i=a.action,u=a.payload,h=t.state;if(a.isTransition){var y=V.T,A={};V.T=A;try{var I=i(h,u),Q=V.S;Q!==null&&Q(A,I),ty(t,a,I)}catch(ae){Lp(t,a,ae)}finally{y!==null&&A.types!==null&&(y.types=A.types),V.T=y}}else try{y=i(h,u),ty(t,a,y)}catch(ae){Lp(t,a,ae)}}function ty(t,a,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(u){ny(t,a,u)},function(u){return Lp(t,a,u)}):ny(t,a,i)}function ny(t,a,i){a.status="fulfilled",a.value=i,ay(a),t.state=i,a=t.pending,a!==null&&(i=a.next,i===a?t.pending=null:(i=i.next,a.next=i,ey(t,i)))}function Lp(t,a,i){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do a.status="rejected",a.reason=i,ay(a),a=a.next;while(a!==u)}t.action=null}function ay(t){t=t.listeners;for(var a=0;a<t.length;a++)(0,t[a])()}function sy(t,a){return a}function ry(t,a){if(jt){var i=qt.formState;if(i!==null){e:{var u=ot;if(jt){if(Yt){t:{for(var h=Yt,y=ka;h.nodeType!==8;){if(!y){h=null;break t}if(h=Na(h.nextSibling),h===null){h=null;break t}}y=h.data,h=y==="F!"||y==="F"?h:null}if(h){Yt=Na(h.nextSibling),u=h.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:sy,lastRenderedState:a},i.queue=u,i=Sy.bind(null,ot,u),u.dispatch=i,u=Dp(!1),y=Vp.bind(null,ot,!1,u.queue),u=qn(),h={state:a,dispatch:null,action:t,pending:null},u.queue=h,i=wE.bind(null,ot,h,y,i),h.dispatch=i,u.memoizedState=t,[a,i,!1]}function oy(t){var a=pn();return ly(a,Lt,t)}function ly(t,a,i){if(a=Op(t,a,sy)[0],t=fu(vs)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var u=ii(a)}catch(A){throw A===$o?nu:A}else u=a;a=pn();var h=a.queue,y=h.dispatch;return i!==a.memoizedState&&(ot.flags|=2048,Ko(9,{destroy:void 0},SE.bind(null,h,i),null)),[u,y,t]}function SE(t,a){t.action=a}function iy(t){var a=pn(),i=Lt;if(i!==null)return ly(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 cy(){return pn().memoizedState}function pu(t,a,i,u){var h=qn();ot.flags|=t,h.memoizedState=Ko(1|a,{destroy:void 0},i,u===void 0?null:u)}function mu(t,a,i,u){var h=pn();u=u===void 0?null:u;var y=h.memoizedState.inst;Lt!==null&&u!==null&&Ep(u,Lt.memoizedState.deps)?h.memoizedState=Ko(a,y,i,u):(ot.flags|=t,h.memoizedState=Ko(1|a,y,i,u))}function uy(t,a){pu(8390656,8,t,a)}function Pp(t,a){mu(2048,8,t,a)}function CE(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 dy(t){var a=pn().memoizedState;return CE({ref:a,nextImpl:t}),function(){if((Et&2)!==0)throw Error(o(440));return a.impl.apply(void 0,arguments)}}function fy(t,a){return mu(4,2,t,a)}function py(t,a){return mu(4,4,t,a)}function my(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 gy(t,a,i){i=i!=null?i.concat([t]):null,mu(4,4,my.bind(null,a,t),i)}function Ip(){}function hy(t,a){var i=pn();a=a===void 0?null:a;var u=i.memoizedState;return a!==null&&Ep(a,u[1])?u[0]:(i.memoizedState=[t,a],t)}function xy(t,a){var i=pn();a=a===void 0?null:a;var u=i.memoizedState;if(a!==null&&Ep(a,u[1]))return u[0];if(u=t(),Kr){qe(!0);try{t()}finally{qe(!1)}}return i.memoizedState=[u,a],u}function Bp(t,a,i){return i===void 0||(bs&1073741824)!==0&&(xt&261930)===0?t.memoizedState=a:(t.memoizedState=i,t=b0(),ot.lanes|=t,ar|=t,i)}function by(t,a,i,u){return ua(i,a)?i:Fo.current!==null?(t=Bp(t,i,u),ua(t,a)||(bn=!0),t):(bs&42)===0||(bs&1073741824)!==0&&(xt&261930)===0?(bn=!0,t.memoizedState=i):(t=b0(),ot.lanes|=t,ar|=t,a)}function vy(t,a,i,u,h){var y=$.p;$.p=y!==0&&8>y?y:8;var A=V.T,I={};V.T=I,Vp(t,!1,a,i);try{var Q=h(),ae=V.S;if(ae!==null&&ae(I,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var fe=yE(Q,u);ci(t,a,fe,ha(t))}else ci(t,a,u,ha(t))}catch(xe){ci(t,a,{then:function(){},status:"rejected",reason:xe},ha())}finally{$.p=y,A!==null&&I.types!==null&&(A.types=I.types),V.T=A}}function kE(){}function Up(t,a,i,u){if(t.tag!==5)throw Error(o(476));var h=yy(t).queue;vy(t,h,a,Z,i===null?kE:function(){return _y(t),i(u)})}function yy(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:vs,lastRenderedState:Z},next:null};var i={};return a.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vs,lastRenderedState:i},next:null},t.memoizedState=a,t=t.alternate,t!==null&&(t.memoizedState=a),a}function _y(t){var a=yy(t);a.next===null&&(a=t.alternate.memoizedState),ci(t,a.next.queue,{},ha())}function Hp(){return kn(ki)}function jy(){return pn().memoizedState}function wy(){return pn().memoizedState}function EE(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&&(ta(u,a,i),si(u,a,i)),a={cache:hp()},t.payload=a;return}a=a.return}}function NE(t,a,i){var u=ha();i={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},gu(t)?Cy(a,i):(i=rp(t,a,i,u),i!==null&&(ta(i,t,u),ky(i,a,u)))}function Sy(t,a,i){var u=ha();ci(t,a,i,u)}function ci(t,a,i,u){var h={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(gu(t))Cy(a,h);else{var y=t.alternate;if(t.lanes===0&&(y===null||y.lanes===0)&&(y=a.lastRenderedReducer,y!==null))try{var A=a.lastRenderedState,I=y(A,i);if(h.hasEagerState=!0,h.eagerState=I,ua(I,A))return Kc(t,a,h,0),qt===null&&Xc(),!1}catch{}finally{}if(i=rp(t,a,h,u),i!==null)return ta(i,t,u),ky(i,a,u),!0}return!1}function Vp(t,a,i,u){if(u={lane:2,revertLane:ym(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},gu(t)){if(a)throw Error(o(479))}else a=rp(t,i,u,2),a!==null&&ta(a,t,2)}function gu(t){var a=t.alternate;return t===ot||a!==null&&a===ot}function Cy(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 ky(t,a,i){if((i&4194048)!==0){var u=a.lanes;u&=t.pendingLanes,i|=u,a.lanes=i,ca(t,i)}}var ui={readContext:kn,use:du,useCallback:rn,useContext:rn,useEffect:rn,useImperativeHandle:rn,useLayoutEffect:rn,useInsertionEffect:rn,useMemo:rn,useReducer:rn,useRef:rn,useState:rn,useDebugValue:rn,useDeferredValue:rn,useTransition:rn,useSyncExternalStore:rn,useId:rn,useHostTransitionStatus:rn,useFormState:rn,useActionState:rn,useOptimistic:rn,useMemoCache:rn,useCacheRefresh:rn};ui.useEffectEvent=rn;var Ey={readContext:kn,use:du,useCallback:function(t,a){return qn().memoizedState=[t,a===void 0?null:a],t},useContext:kn,useEffect:uy,useImperativeHandle:function(t,a,i){i=i!=null?i.concat([t]):null,pu(4194308,4,my.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(Kr){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 h=i(a);if(Kr){qe(!0);try{i(a)}finally{qe(!1)}}}else h=a;return u.memoizedState=u.baseState=h,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:h},u.queue=t,t=t.dispatch=NE.bind(null,ot,t),[u.memoizedState,t]},useRef:function(t){var a=qn();return t={current:t},a.memoizedState=t},useState:function(t){t=Dp(t);var a=t.queue,i=Sy.bind(null,ot,a);return a.dispatch=i,[t.memoizedState,i]},useDebugValue:Ip,useDeferredValue:function(t,a){var i=qn();return Bp(i,t,a)},useTransition:function(){var t=Dp(!1);return t=vy.bind(null,ot,t.queue,!0,!1),qn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,a,i){var u=ot,h=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||Xv(u,a,i)}h.memoizedState=i;var y={value:i,getSnapshot:a};return h.queue=y,uy(Qv.bind(null,u,y,t),[t]),u.flags|=2048,Ko(9,{destroy:void 0},Kv.bind(null,u,y,i,a),null),i},useId:function(){var t=qn(),a=qt.identifierPrefix;if(jt){var i=Ya,u=Fa;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=_E++,a="_"+a+"r_"+i.toString(32)+"_";return t.memoizedState=a},useHostTransitionStatus:Hp,useFormState:ry,useActionState:ry,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=Vp.bind(null,ot,!0,i),i.dispatch=a,[t,a]},useMemoCache:Mp,useCacheRefresh:function(){return qn().memoizedState=EE.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)}}},qp={readContext:kn,use:du,useCallback:hy,useContext:kn,useEffect:Pp,useImperativeHandle:gy,useInsertionEffect:fy,useLayoutEffect:py,useMemo:xy,useReducer:fu,useRef:cy,useState:function(){return fu(vs)},useDebugValue:Ip,useDeferredValue:function(t,a){var i=pn();return by(i,Lt.memoizedState,t,a)},useTransition:function(){var t=fu(vs)[0],a=pn().memoizedState;return[typeof t=="boolean"?t:ii(t),a]},useSyncExternalStore:Yv,useId:jy,useHostTransitionStatus:Hp,useFormState:oy,useActionState:oy,useOptimistic:function(t,a){var i=pn();return Jv(i,Lt,t,a)},useMemoCache:Mp,useCacheRefresh:wy};qp.useEffectEvent=dy;var Ny={readContext:kn,use:du,useCallback:hy,useContext:kn,useEffect:Pp,useImperativeHandle:gy,useInsertionEffect:fy,useLayoutEffect:py,useMemo:xy,useReducer:zp,useRef:cy,useState:function(){return zp(vs)},useDebugValue:Ip,useDeferredValue:function(t,a){var i=pn();return Lt===null?Bp(i,t,a):by(i,Lt.memoizedState,t,a)},useTransition:function(){var t=zp(vs)[0],a=pn().memoizedState;return[typeof t=="boolean"?t:ii(t),a]},useSyncExternalStore:Yv,useId:jy,useHostTransitionStatus:Hp,useFormState:iy,useActionState:iy,useOptimistic:function(t,a){var i=pn();return Lt!==null?Jv(i,Lt,t,a):(i.baseState=t,[t,i.queue.dispatch])},useMemoCache:Mp,useCacheRefresh:wy};Ny.useEffectEvent=dy;function $p(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 Gp={enqueueSetState:function(t,a,i){t=t._reactInternals;var u=ha(),h=Zs(u);h.payload=a,i!=null&&(h.callback=i),a=Ws(t,h,u),a!==null&&(ta(a,t,u),si(a,t,u))},enqueueReplaceState:function(t,a,i){t=t._reactInternals;var u=ha(),h=Zs(u);h.tag=1,h.payload=a,i!=null&&(h.callback=i),a=Ws(t,h,u),a!==null&&(ta(a,t,u),si(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&&(ta(a,t,i),si(a,t,i))}};function Ry(t,a,i,u,h,y,A){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,y,A):a.prototype&&a.prototype.isPureReactComponent?!Ql(i,u)||!Ql(h,y):!0}function Ty(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&&Gp.enqueueReplaceState(a,a.state,null)}function Qr(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 h in t)i[h]===void 0&&(i[h]=t[h])}return i}function Ay(t){Yc(t)}function My(t){console.error(t)}function Oy(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 zy(t,a,i){try{var u=t.onCaughtError;u(i.value,{componentStack:i.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Fp(t,a,i){return i=Zs(i),i.tag=3,i.payload={element:null},i.callback=function(){hu(t,a)},i}function Dy(t){return t=Zs(t),t.tag=3,t}function Ly(t,a,i,u){var h=i.type.getDerivedStateFromError;if(typeof h=="function"){var y=u.value;t.payload=function(){return h(y)},t.callback=function(){zy(a,i,u)}}var A=i.stateNode;A!==null&&typeof A.componentDidCatch=="function"&&(t.callback=function(){zy(a,i,u),typeof h!="function"&&(sr===null?sr=new Set([this]):sr.add(this));var I=u.stack;this.componentDidCatch(u.value,{componentStack:I!==null?I:""})})}function RE(t,a,i,u,h){if(i.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(a=i.alternate,a!==null&&Ho(a,i,h,!0),i=fa.current,i!==null){switch(i.tag){case 31:case 13:return Ea===null?Nu():i.alternate===null&&on===0&&(on=3),i.flags&=-257,i.flags|=65536,i.lanes=h,u===au?i.flags|=16384:(a=i.updateQueue,a===null?i.updateQueue=new Set([u]):a.add(u),xm(t,u,h)),!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)),xm(t,u,h)),!1}throw Error(o(435,i.tag))}return xm(t,u,h),Nu(),!1}if(jt)return a=fa.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=h,u!==dp&&(t=Error(o(422),{cause:u}),Jl(wa(t,i)))):(u!==dp&&(a=Error(o(423),{cause:u}),Jl(wa(a,i))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,u=wa(u,i),h=Fp(t.stateNode,u,h),jp(t,h),on!==4&&(on=2)),!1;var y=Error(o(520),{cause:u});if(y=wa(y,i),bi===null?bi=[y]:bi.push(y),on!==4&&(on=2),a===null)return!0;u=wa(u,i),i=a;do{switch(i.tag){case 3:return i.flags|=65536,t=h&-h,i.lanes|=t,t=Fp(i.stateNode,u,t),jp(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,h&=-h,i.lanes|=h,h=Dy(h),Ly(h,t,i,u),jp(i,h),!1}i=i.return}while(i!==null);return!1}var Yp=Error(o(461)),bn=!1;function En(t,a,i,u){a.child=t===null?Uv(a,null,i,u):Xr(a,t.child,i,u)}function Py(t,a,i,u,h){i=i.render;var y=a.ref;if("ref"in u){var A={};for(var I in u)I!=="ref"&&(A[I]=u[I])}else A=u;return $r(a),u=Np(t,a,i,A,y,h),I=Rp(),t!==null&&!bn?(Tp(t,a,h),ys(t,a,h)):(jt&&I&&cp(a),a.flags|=1,En(t,a,u,h),a.child)}function Iy(t,a,i,u,h){if(t===null){var y=i.type;return typeof y=="function"&&!op(y)&&y.defaultProps===void 0&&i.compare===null?(a.tag=15,a.type=y,By(t,a,y,u,h)):(t=Zc(i.type,null,u,a,a.mode,h),t.ref=a.ref,t.return=a,a.child=t)}if(y=t.child,!tm(t,h)){var A=y.memoizedProps;if(i=i.compare,i=i!==null?i:Ql,i(A,u)&&t.ref===a.ref)return ys(t,a,h)}return a.flags|=1,t=ms(y,u),t.ref=a.ref,t.return=a,a.child=t}function By(t,a,i,u,h){if(t!==null){var y=t.memoizedProps;if(Ql(y,u)&&t.ref===a.ref)if(bn=!1,a.pendingProps=u=y,tm(t,h))(t.flags&131072)!==0&&(bn=!0);else return a.lanes=t.lanes,ys(t,a,h)}return Xp(t,a,i,u,h)}function Uy(t,a,i,u){var h=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,h=0;u!==null;)h=h|u.lanes|u.childLanes,u=u.sibling;u=h&~y}else u=0,a.child=null;return Hy(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?qv(a,y):Sp(),$v(a);else return u=a.lanes=536870912,Hy(t,a,y!==null?y.baseLanes|i:i,i,u)}else y!==null?(tu(a,y.cachePool),qv(a,y),er(),a.memoizedState=null):(t!==null&&tu(a,null),Sp(),er());return En(t,a,h,i),a.child}function di(t,a){return t!==null&&t.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Hy(t,a,i,u,h){var y=bp();return y=y===null?null:{parent:hn._currentValue,pool:y},a.memoizedState={baseLanes:i,cachePool:y},t!==null&&tu(a,null),Sp(),$v(a),t!==null&&Ho(t,a,u,!0),a.childLanes=h,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 Vy(t,a,i){return Xr(a,t.child,null,i),t=xu(a,a.pendingProps),t.flags|=2,pa(a),a.memoizedState=null,t}function TE(t,a,i){var u=a.pendingProps,h=(a.flags&128)!==0;if(a.flags&=-129,t===null){if(jt){if(u.mode==="hidden")return t=xu(a,u),a.lanes=536870912,di(null,t);if(kp(a),(t=Yt)?(t=e1(t,ka),t=t!==null&&t.data==="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:Fs!==null?{id:Fa,overflow:Ya}:null,retryLane:536870912,hydrationErrors:null},i=Cv(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 A=y.dehydrated;if(kp(a),h)if(a.flags&256)a.flags&=-257,a=Vy(t,a,i);else if(a.memoizedState!==null)a.child=t.child,a.flags|=128,a=null;else throw Error(o(558));else if(bn||Ho(t,a,i,!1),h=(i&t.childLanes)!==0,bn||h){if(u=qt,u!==null&&(A=Pa(u,i),A!==0&&A!==y.retryLane))throw y.retryLane=A,Ur(t,A),ta(u,t,A),Yp;Nu(),a=Vy(t,a,i)}else t=y.treeContext,Yt=Na(A.nextSibling),Cn=a,jt=!0,Ys=null,ka=!1,t!==null&&Nv(a,t),a=xu(a,u),a.flags|=4096;return a}return t=ms(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 Xp(t,a,i,u,h){return $r(a),i=Np(t,a,i,u,void 0,h),u=Rp(),t!==null&&!bn?(Tp(t,a,h),ys(t,a,h)):(jt&&u&&cp(a),a.flags|=1,En(t,a,i,h),a.child)}function qy(t,a,i,u,h,y){return $r(a),a.updateQueue=null,i=Fv(a,u,i,h),Gv(t),u=Rp(),t!==null&&!bn?(Tp(t,a,y),ys(t,a,y)):(jt&&u&&cp(a),a.flags|=1,En(t,a,i,y),a.child)}function $y(t,a,i,u,h){if($r(a),a.stateNode===null){var y=Po,A=i.contextType;typeof A=="object"&&A!==null&&(y=kn(A)),y=new i(u,y),a.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Gp,a.stateNode=y,y._reactInternals=a,y=a.stateNode,y.props=u,y.state=a.memoizedState,y.refs={},yp(a),A=i.contextType,y.context=typeof A=="object"&&A!==null?kn(A):Po,y.state=a.memoizedState,A=i.getDerivedStateFromProps,typeof A=="function"&&($p(a,i,A,u),y.state=a.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(A=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),A!==y.state&&Gp.enqueueReplaceState(y,y.state,null),oi(a,u,y,h),ri(),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=Qr(i,I);y.props=Q;var ae=y.context,fe=i.contextType;A=Po,typeof fe=="object"&&fe!==null&&(A=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!==A)&&Ty(a,y,u,A),Qs=!1;var se=a.memoizedState;y.state=se,oi(a,u,y,h),ri(),ae=a.memoizedState,I||se!==ae||Qs?(typeof xe=="function"&&($p(a,i,xe,u),ae=a.memoizedState),(Q=Qs||Ry(a,i,Q,u,se,ae,A))?(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=A,u=Q):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),u=!1)}else{y=a.stateNode,_p(t,a),A=a.memoizedProps,fe=Qr(i,A),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"||(A!==xe||se!==Q)&&Ty(a,y,u,Q),Qs=!1,se=a.memoizedState,y.state=se,oi(a,u,y,h),ri();var ue=a.memoizedState;A!==xe||se!==ue||Qs||t!==null&&t.dependencies!==null&&Jc(t.dependencies)?(typeof I=="function"&&($p(a,i,I,u),ue=a.memoizedState),(fe=Qs||Ry(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"||A===t.memoizedProps&&se===t.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||A===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"||A===t.memoizedProps&&se===t.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||A===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=Xr(a,t.child,null,h),a.child=Xr(a,null,i,h)):En(t,a,i,h),a.memoizedState=y.state,t=a.child):t=ys(t,a,h),t}function Gy(t,a,i,u){return Vr(),a.flags|=256,En(t,a,i,u),a.child}var Kp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qp(t){return{baseLanes:t,cachePool:zv()}}function Zp(t,a,i){return t=t!==null?t.childLanes&~i:0,a&&(t|=ga),t}function Fy(t,a,i){var u=a.pendingProps,h=!1,y=(a.flags&128)!==0,A;if((A=y)||(A=t!==null&&t.memoizedState===null?!1:(fn.current&2)!==0),A&&(h=!0,a.flags&=-129),A=(a.flags&32)!==0,a.flags&=-33,t===null){if(jt){if(h?Js(a):er(),(t=Yt)?(t=e1(t,ka),t=t!==null&&t.data!=="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:Fs!==null?{id:Fa,overflow:Ya}:null,retryLane:536870912,hydrationErrors:null},i=Cv(t),i.return=a,a.child=i,Cn=a,Yt=null)):t=null,t===null)throw Xs(a);return Om(t)?a.lanes=32:a.lanes=536870912,null}var I=u.children;return u=u.fallback,h?(er(),h=a.mode,I=vu({mode:"hidden",children:I},h),u=Hr(u,h,i,null),I.return=a,u.return=a,I.sibling=u,a.child=I,u=a.child,u.memoizedState=Qp(i),u.childLanes=Zp(t,A,i),a.memoizedState=Kp,di(null,u)):(Js(a),Wp(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=Jp(t,a,i)):a.memoizedState!==null?(er(),a.child=t.child,a.flags|=128,a=null):(er(),I=u.fallback,h=a.mode,u=vu({mode:"visible",children:u.children},h),I=Hr(I,h,i,null),I.flags|=2,u.return=a,I.return=a,u.sibling=I,a.child=u,Xr(a,t.child,null,i),u=a.child,u.memoizedState=Qp(i),u.childLanes=Zp(t,A,i),a.memoizedState=Kp,a=di(null,u));else if(Js(a),Om(I)){if(A=I.nextSibling&&I.nextSibling.dataset,A)var ae=A.dgst;A=ae,u=Error(o(419)),u.stack="",u.digest=A,Jl({value:u,source:null,stack:null}),a=Jp(t,a,i)}else if(bn||Ho(t,a,i,!1),A=(i&t.childLanes)!==0,bn||A){if(A=qt,A!==null&&(u=Pa(A,i),u!==0&&u!==Q.retryLane))throw Q.retryLane=u,Ur(t,u),ta(A,t,u),Yp;Mm(I)||Nu(),a=Jp(t,a,i)}else Mm(I)?(a.flags|=192,a.child=t.child,a=null):(t=Q.treeContext,Yt=Na(I.nextSibling),Cn=a,jt=!0,Ys=null,ka=!1,t!==null&&Nv(a,t),a=Wp(a,u.children),a.flags|=4096);return a}return h?(er(),I=u.fallback,h=a.mode,Q=t.child,ae=Q.sibling,u=ms(Q,{mode:"hidden",children:u.children}),u.subtreeFlags=Q.subtreeFlags&65011712,ae!==null?I=ms(ae,I):(I=Hr(I,h,i,null),I.flags|=2),I.return=a,u.return=a,u.sibling=I,a.child=u,di(null,u),u=a.child,I=t.child.memoizedState,I===null?I=Qp(i):(h=I.cachePool,h!==null?(Q=hn._currentValue,h=h.parent!==Q?{parent:Q,pool:Q}:h):h=zv(),I={baseLanes:I.baseLanes|i,cachePool:h}),u.memoizedState=I,u.childLanes=Zp(t,A,i),a.memoizedState=Kp,di(t.child,u)):(Js(a),i=t.child,t=i.sibling,i=ms(i,{mode:"visible",children:u.children}),i.return=a,i.sibling=null,t!==null&&(A=a.deletions,A===null?(a.deletions=[t],a.flags|=16):A.push(t)),a.child=i,a.memoizedState=null,i)}function Wp(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 Jp(t,a,i){return Xr(a,t.child,null,i),t=Wp(a,a.pendingProps.children),t.flags|=2,a.memoizedState=null,t}function Yy(t,a,i){t.lanes|=a;var u=t.alternate;u!==null&&(u.lanes|=a),mp(t.return,a,i)}function em(t,a,i,u,h,y){var A=t.memoizedState;A===null?t.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:u,tail:i,tailMode:h,treeForkCount:y}:(A.isBackwards=a,A.rendering=null,A.renderingStartTime=0,A.last=u,A.tail=i,A.tailMode=h,A.treeForkCount=y)}function Xy(t,a,i){var u=a.pendingProps,h=u.revealOrder,y=u.tail;u=u.children;var A=fn.current,I=(A&2)!==0;if(I?(A=A&1|2,a.flags|=128):A&=1,F(fn,A),En(t,a,u,i),u=jt?Wl:0,!I&&t!==null&&(t.flags&128)!==0)e:for(t=a.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Yy(t,i,a);else if(t.tag===19)Yy(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(h){case"forwards":for(i=a.child,h=null;i!==null;)t=i.alternate,t!==null&&lu(t)===null&&(h=i),i=i.sibling;i=h,i===null?(h=a.child,a.child=null):(h=i.sibling,i.sibling=null),em(a,!1,h,i,y,u);break;case"backwards":case"unstable_legacy-backwards":for(i=null,h=a.child,a.child=null;h!==null;){if(t=h.alternate,t!==null&&lu(t)===null){a.child=h;break}t=h.sibling,h.sibling=i,i=h,h=t}em(a,!0,i,null,y,u);break;case"together":em(a,!1,null,null,void 0,u);break;default:a.memoizedState=null}return a.child}function ys(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=ms(t,t.pendingProps),a.child=i,i.return=a;t.sibling!==null;)t=t.sibling,i=i.sibling=ms(t,t.pendingProps),i.return=a;i.sibling=null}return a.child}function tm(t,a){return(t.lanes&a)!==0?!0:(t=t.dependencies,!!(t!==null&&Jc(t)))}function AE(t,a,i){switch(a.tag){case 3:ce(a,a.stateNode.containerInfo),Ks(a,hn,t.memoizedState.cache),Vr();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,kp(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?Fy(t,a,i):(Js(a),t=ys(t,a,i),t!==null?t.sibling:null);Js(a);break;case 19:var h=(t.flags&128)!==0;if(u=(i&a.childLanes)!==0,u||(Ho(t,a,i,!1),u=(i&a.childLanes)!==0),h){if(u)return Xy(t,a,i);a.flags|=128}if(h=a.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),F(fn,fn.current),u)break;return null;case 22:return a.lanes=0,Uy(t,a,i,a.pendingProps);case 24:Ks(a,hn,t.memoizedState.cache)}return ys(t,a,i)}function Ky(t,a,i){if(t!==null)if(t.memoizedProps!==a.pendingProps)bn=!0;else{if(!tm(t,i)&&(a.flags&128)===0)return bn=!1,AE(t,a,i);bn=(t.flags&131072)!==0}else bn=!1,jt&&(a.flags&1048576)!==0&&Ev(a,Wl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var u=a.pendingProps;if(t=Fr(a.elementType),a.type=t,typeof t=="function")op(t)?(u=Qr(t,u),a.tag=1,a=$y(null,a,t,u,i)):(a.tag=0,a=Xp(null,a,t,u,i));else{if(t!=null){var h=t.$$typeof;if(h===R){a.tag=11,a=Py(null,a,t,u,i);break e}else if(h===O){a.tag=14,a=Iy(null,a,t,u,i);break e}}throw a=q(t)||t,Error(o(306,a,""))}}return a;case 0:return Xp(t,a,a.type,a.pendingProps,i);case 1:return u=a.type,h=Qr(u,a.pendingProps),$y(t,a,u,h,i);case 3:e:{if(ce(a,a.stateNode.containerInfo),t===null)throw Error(o(387));u=a.pendingProps;var y=a.memoizedState;h=y.element,_p(t,a),oi(a,u,null,i);var A=a.memoizedState;if(u=A.cache,Ks(a,hn,u),u!==y.cache&&gp(a,[hn],i,!0),ri(),u=A.element,y.isDehydrated)if(y={element:u,isDehydrated:!1,cache:A.cache},a.updateQueue.baseState=y,a.memoizedState=y,a.flags&256){a=Gy(t,a,u,i);break e}else if(u!==h){h=wa(Error(o(424)),a),Jl(h),a=Gy(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=Na(t.firstChild),Cn=a,jt=!0,Ys=null,ka=!0,i=Uv(a,null,u,i),a.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(Vr(),u===h){a=ys(t,a,i);break e}En(t,a,u,i)}a=a.child}return a;case 26:return bu(t,a),t===null?(i=o1(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[gn]=t,Nn(u,i,t),jn(u),a.stateNode=u):a.memoizedState=o1(a.type,t.memoizedProps,a.pendingProps,t.memoizedState),null;case 27:return Te(a),t===null&&jt&&(u=a.stateNode=a1(a.type,a.pendingProps,re.current),Cn=a,ka=!0,h=Yt,ir(a.type)?(zm=h,Yt=Na(u.firstChild)):Yt=h),En(t,a,a.pendingProps.children,i),bu(t,a),t===null&&(a.flags|=4194304),a.child;case 5:return t===null&&jt&&((h=u=Yt)&&(u=lN(u,a.type,a.pendingProps,ka),u!==null?(a.stateNode=u,Cn=a,Yt=Na(u.firstChild),ka=!1,h=!0):h=!1),h||Xs(a)),Te(a),h=a.type,y=a.pendingProps,A=t!==null?t.memoizedProps:null,u=y.children,Rm(h,y)?u=null:A!==null&&Rm(h,A)&&(a.flags|=32),a.memoizedState!==null&&(h=Np(t,a,jE,null,null,i),ki._currentValue=h),bu(t,a),En(t,a,u,i),a.child;case 6:return t===null&&jt&&((t=i=Yt)&&(i=iN(i,a.pendingProps,ka),i!==null?(a.stateNode=i,Cn=a,Yt=null,t=!0):t=!1),t||Xs(a)),null;case 13:return Fy(t,a,i);case 4:return ce(a,a.stateNode.containerInfo),u=a.pendingProps,t===null?a.child=Xr(a,null,u,i):En(t,a,u,i),a.child;case 11:return Py(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 h=a.type._context,u=a.pendingProps.children,$r(a),h=kn(h),u=u(h),a.flags|=1,En(t,a,u,i),a.child;case 14:return Iy(t,a,a.type,a.pendingProps,i);case 15:return By(t,a,a.type,a.pendingProps,i);case 19:return Xy(t,a,i);case 31:return TE(t,a,i);case 22:return Uy(t,a,i,a.pendingProps);case 24:return $r(a),u=kn(hn),t===null?(h=bp(),h===null&&(h=qt,y=hp(),h.pooledCache=y,y.refCount++,y!==null&&(h.pooledCacheLanes|=i),h=y),a.memoizedState={parent:u,cache:h},yp(a),Ks(a,hn,h)):((t.lanes&i)!==0&&(_p(t,a),oi(a,null,null,i),ri()),h=t.memoizedState,y=a.memoizedState,h.parent!==u?(h={parent:u,cache:u},a.memoizedState=h,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=h),Ks(a,hn,u)):(u=y.cache,Ks(a,hn,u),u!==h.cache&&gp(a,[hn],i,!0))),En(t,a,a.pendingProps.children,i),a.child;case 29:throw a.pendingProps}throw Error(o(156,a.tag))}function _s(t){t.flags|=4}function nm(t,a,i,u,h){if((a=(t.mode&32)!==0)&&(a=!1),a){if(t.flags|=16777216,(h&335544128)===h)if(t.stateNode.complete)t.flags|=8192;else if(j0())t.flags|=8192;else throw Yr=au,vp}else t.flags&=-16777217}function Qy(t,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!d1(a))if(j0())t.flags|=8192;else throw Yr=au,vp}function yu(t,a){a!==null&&(t.flags|=4),t.flags&16384&&(a=t.tag!==22?Xn():536870912,t.lanes|=a,Jo|=a)}function fi(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 h=t.child;h!==null;)i|=h.lanes|h.childLanes,u|=h.subtreeFlags&65011712,u|=h.flags&65011712,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)i|=h.lanes|h.childLanes,u|=h.subtreeFlags,u|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=u,t.childLanes=i,a}function ME(t,a,i){var u=a.pendingProps;switch(up(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),xs(hn),ee(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(t===null||t.child===null)&&(Uo(a)?_s(a):t===null||t.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,fp())),Xt(a),null;case 26:var h=a.type,y=a.memoizedState;return t===null?(_s(a),y!==null?(Xt(a),Qy(a,y)):(Xt(a),nm(a,h,null,u,i))):y?y!==t.memoizedState?(_s(a),Xt(a),Qy(a,y)):(Xt(a),a.flags&=-16777217):(t=t.memoizedProps,t!==u&&_s(a),Xt(a),nm(a,h,t,u,i)),null;case 27:if(Fe(a),i=re.current,h=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&_s(a);else{if(!u){if(a.stateNode===null)throw Error(o(166));return Xt(a),null}t=J.current,Uo(a)?Rv(a):(t=a1(h,u,i),a.stateNode=t,_s(a))}return Xt(a),null;case 5:if(Fe(a),h=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&_s(a);else{if(!u){if(a.stateNode===null)throw Error(o(166));return Xt(a),null}if(y=J.current,Uo(a))Rv(a);else{var A=Du(re.current);switch(y){case 1:y=A.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:y=A.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":y=A.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":y=A.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":y=A.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof u.is=="string"?A.createElement("select",{is:u.is}):A.createElement("select"),u.multiple?y.multiple=!0:u.size&&(y.size=u.size);break;default:y=typeof u.is=="string"?A.createElement(h,{is:u.is}):A.createElement(h)}}y[Rt]=a,y[gn]=u;e:for(A=a.child;A!==null;){if(A.tag===5||A.tag===6)y.appendChild(A.stateNode);else if(A.tag!==4&&A.tag!==27&&A.child!==null){A.child.return=A,A=A.child;continue}if(A===a)break e;for(;A.sibling===null;){if(A.return===null||A.return===a)break e;A=A.return}A.sibling.return=A.return,A=A.sibling}a.stateNode=y;e:switch(Nn(y,h,u),h){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&_s(a)}}return Xt(a),nm(a,a.type,t===null?null:t.memoizedProps,a.pendingProps,i),null;case 6:if(t&&a.stateNode!=null)t.memoizedProps!==u&&_s(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,h=Cn,h!==null)switch(h.tag){case 27:case 5:u=h.memoizedProps}t[Rt]=a,t=!!(t.nodeValue===i||u!==null&&u.suppressHydrationWarning===!0||F0(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 Vr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Xt(a),t=!1}else i=fp(),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(h=Uo(a),u!==null&&u.dehydrated!==null){if(t===null){if(!h)throw Error(o(318));if(h=a.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(o(317));h[Rt]=a}else Vr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Xt(a),h=!1}else h=fp(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)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,h=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(h=u.alternate.memoizedState.cachePool.pool),y=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(y=u.memoizedState.cachePool.pool),y!==h&&(u.flags|=2048)),i!==t&&i&&(a.child.flags|=8192),yu(a,a.updateQueue),Xt(a),null);case 4:return ee(),t===null&&Sm(a.stateNode.containerInfo),Xt(a),null;case 10:return xs(a.type),Xt(a),null;case 19:if(K(fn),u=a.memoizedState,u===null)return Xt(a),null;if(h=(a.flags&128)!==0,y=u.rendering,y===null)if(h)fi(u,!1);else{if(on!==0||t!==null&&(t.flags&128)!==0)for(t=a.child;t!==null;){if(y=lu(t),y!==null){for(a.flags|=128,fi(u,!1),t=y.updateQueue,a.updateQueue=t,yu(a,t),a.subtreeFlags=0,t=i,i=a.child;i!==null;)Sv(i,t),i=i.sibling;return F(fn,fn.current&1|2),jt&&gs(a,u.treeForkCount),a.child}t=t.sibling}u.tail!==null&&ye()>Cu&&(a.flags|=128,h=!0,fi(u,!1),a.lanes=4194304)}else{if(!h)if(t=lu(y),t!==null){if(a.flags|=128,h=!0,t=t.updateQueue,a.updateQueue=t,yu(a,t),fi(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,h=!0,fi(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,h?i&1|2:i&1),jt&&gs(a,u.treeForkCount),t):(Xt(a),null);case 22:case 23:return pa(a),Cp(),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(Gr),null;case 24:return i=null,t!==null&&(i=t.memoizedState.cache),a.memoizedState.cache!==i&&(a.flags|=2048),xs(hn),Xt(a),null;case 25:return null;case 30:return null}throw Error(o(156,a.tag))}function OE(t,a){switch(up(a),a.tag){case 1:return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 3:return xs(hn),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));Vr()}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));Vr()}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 xs(a.type),null;case 22:case 23:return pa(a),Cp(),t!==null&&K(Gr),t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 24:return xs(hn),null;case 25:return null;default:return null}}function Zy(t,a){switch(up(a),a.tag){case 3:xs(hn),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:xs(a.type);break;case 22:case 23:pa(a),Cp(),t!==null&&K(Gr);break;case 24:xs(hn)}}function pi(t,a){try{var i=a.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var h=u.next;i=h;do{if((i.tag&t)===t){u=void 0;var y=i.create,A=i.inst;u=y(),A.destroy=u}i=i.next}while(i!==h)}}catch(I){At(a,a.return,I)}}function tr(t,a,i){try{var u=a.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var y=h.next;u=y;do{if((u.tag&t)===t){var A=u.inst,I=A.destroy;if(I!==void 0){A.destroy=void 0,h=a;var Q=i,ae=I;try{ae()}catch(fe){At(h,Q,fe)}}}u=u.next}while(u!==y)}}catch(fe){At(a,a.return,fe)}}function Wy(t){var a=t.updateQueue;if(a!==null){var i=t.stateNode;try{Vv(a,i)}catch(u){At(t,t.return,u)}}}function Jy(t,a,i){i.props=Qr(t.type,t.memoizedProps),i.state=t.memoizedState;try{i.componentWillUnmount()}catch(u){At(t,a,u)}}function mi(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(h){At(t,a,h)}}function Xa(t,a){var i=t.ref,u=t.refCleanup;if(i!==null)if(typeof u=="function")try{u()}catch(h){At(t,a,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(h){At(t,a,h)}else i.current=null}function e0(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(h){At(t,t.return,h)}}function am(t,a,i){try{var u=t.stateNode;tN(u,t.type,i,a),u[gn]=a}catch(h){At(t,t.return,h)}}function t0(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ir(t.type)||t.tag===4}function sm(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||t0(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 rm(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=fs));else if(u!==4&&(u===27&&ir(t.type)&&(i=t.stateNode,a=null),t=t.child,t!==null))for(rm(t,a,i),t=t.sibling;t!==null;)rm(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 n0(t){var a=t.stateNode,i=t.memoizedProps;try{for(var u=t.type,h=a.attributes;h.length;)a.removeAttributeNode(h[0]);Nn(a,u,i),a[Rt]=t,a[gn]=i}catch(y){At(t,t.return,y)}}var js=!1,vn=!1,om=!1,a0=typeof WeakSet=="function"?WeakSet:Set,wn=null;function zE(t,a){if(t=t.containerInfo,Em=Vu,t=gv(t),Jf(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 h=u.anchorOffset,y=u.focusNode;u=u.focusOffset;try{i.nodeType,y.nodeType}catch{i=null;break e}var A=0,I=-1,Q=-1,ae=0,fe=0,xe=t,se=null;t:for(;;){for(var ue;xe!==i||h!==0&&xe.nodeType!==3||(I=A+h),xe!==y||u!==0&&xe.nodeType!==3||(Q=A+u),xe.nodeType===3&&(A+=xe.nodeValue.length),(ue=xe.firstChild)!==null;)se=xe,xe=ue;for(;;){if(xe===t)break t;if(se===i&&++ae===h&&(I=A),se===y&&++fe===u&&(Q=A),(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(Nm={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++)h=t[i],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&y!==null){t=void 0,i=a,h=y.memoizedProps,y=y.memoizedState,u=i.stateNode;try{var He=Qr(i.type,h);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)Am(t);else if(i===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Am(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 s0(t,a,i){var u=i.flags;switch(i.tag){case 0:case 11:case 15:Ss(t,i),u&4&&pi(5,i);break;case 1:if(Ss(t,i),u&4)if(t=i.stateNode,a===null)try{t.componentDidMount()}catch(A){At(i,i.return,A)}else{var h=Qr(i.type,a.memoizedProps);a=a.memoizedState;try{t.componentDidUpdate(h,a,t.__reactInternalSnapshotBeforeUpdate)}catch(A){At(i,i.return,A)}}u&64&&Wy(i),u&512&&mi(i,i.return);break;case 3:if(Ss(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{Vv(t,a)}catch(A){At(i,i.return,A)}}break;case 27:a===null&&u&4&&n0(i);case 26:case 5:Ss(t,i),a===null&&u&4&&e0(i),u&512&&mi(i,i.return);break;case 12:Ss(t,i);break;case 31:Ss(t,i),u&4&&l0(t,i);break;case 13:Ss(t,i),u&4&&i0(t,i),u&64&&(t=i.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(i=qE.bind(null,i),cN(t,i))));break;case 22:if(u=i.memoizedState!==null||js,!u){a=a!==null&&a.memoizedState!==null||vn,h=js;var y=vn;js=u,(vn=a)&&!y?Cs(t,i,(i.subtreeFlags&8772)!==0):Ss(t,i),js=h,vn=y}break;case 30:break;default:Ss(t,i)}}function r0(t){var a=t.alternate;a!==null&&(t.alternate=null,r0(a)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(a=t.stateNode,a!==null&&Lf(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,Zn=!1;function ws(t,a,i){for(i=i.child;i!==null;)o0(t,a,i),i=i.sibling}function o0(t,a,i){if(Re&&typeof Re.onCommitFiberUnmount=="function")try{Re.onCommitFiberUnmount(Ee,i)}catch{}switch(i.tag){case 26:vn||Xa(i,a),ws(t,a,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:vn||Xa(i,a);var u=Jt,h=Zn;ir(i.type)&&(Jt=i.stateNode,Zn=!1),ws(t,a,i),wi(i.stateNode),Jt=u,Zn=h;break;case 5:vn||Xa(i,a);case 6:if(u=Jt,h=Zn,Jt=null,ws(t,a,i),Jt=u,Zn=h,Jt!==null)if(Zn)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&&(Zn?(t=Jt,W0(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,i.stateNode),ll(t)):W0(Jt,i.stateNode));break;case 4:u=Jt,h=Zn,Jt=i.stateNode.containerInfo,Zn=!0,ws(t,a,i),Jt=u,Zn=h;break;case 0:case 11:case 14:case 15:tr(2,i,a),vn||tr(4,i,a),ws(t,a,i);break;case 1:vn||(Xa(i,a),u=i.stateNode,typeof u.componentWillUnmount=="function"&&Jy(i,a,u)),ws(t,a,i);break;case 21:ws(t,a,i);break;case 22:vn=(u=vn)||i.memoizedState!==null,ws(t,a,i),vn=u;break;default:ws(t,a,i)}}function l0(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 i0(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 DE(t){switch(t.tag){case 31:case 13:case 19:var a=t.stateNode;return a===null&&(a=t.stateNode=new a0),a;case 22:return t=t.stateNode,a=t._retryCache,a===null&&(a=t._retryCache=new a0),a;default:throw Error(o(435,t.tag))}}function ju(t,a){var i=DE(t);a.forEach(function(u){if(!i.has(u)){i.add(u);var h=$E.bind(null,t,u);u.then(h,h)}})}function Wn(t,a){var i=a.deletions;if(i!==null)for(var u=0;u<i.length;u++){var h=i[u],y=t,A=a,I=A;e:for(;I!==null;){switch(I.tag){case 27:if(ir(I.type)){Jt=I.stateNode,Zn=!1;break e}break;case 5:Jt=I.stateNode,Zn=!1;break e;case 3:case 4:Jt=I.stateNode.containerInfo,Zn=!0;break e}I=I.return}if(Jt===null)throw Error(o(160));o0(y,A,h),Jt=null,Zn=!1,y=h.alternate,y!==null&&(y.return=null),h.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)c0(a,t),a=a.sibling}var Ba=null;function c0(t,a){var i=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Wn(a,t),Jn(t),u&4&&(tr(3,t,t.return),pi(3,t),tr(5,t,t.return));break;case 1:Wn(a,t),Jn(t),u&512&&(vn||i===null||Xa(i,i.return)),u&64&&js&&(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 h=Ba;if(Wn(a,t),Jn(t),u&512&&(vn||i===null||Xa(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,h=h.ownerDocument||h;t:switch(u){case"title":y=h.getElementsByTagName("title")[0],(!y||y[Hl]||y[Rt]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=h.createElement(u),h.head.insertBefore(y,h.querySelector("head > title"))),Nn(y,u,i),y[Rt]=t,jn(y),u=y;break e;case"link":var A=c1("link","href",h).get(u+(i.href||""));if(A){for(var I=0;I<A.length;I++)if(y=A[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)){A.splice(I,1);break t}}y=h.createElement(u),Nn(y,u,i),h.head.appendChild(y);break;case"meta":if(A=c1("meta","content",h).get(u+(i.content||""))){for(I=0;I<A.length;I++)if(y=A[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)){A.splice(I,1);break t}}y=h.createElement(u),Nn(y,u,i),h.head.appendChild(y);break;default:throw Error(o(468,u))}y[Rt]=t,jn(y),u=y}t.stateNode=u}else u1(h,t.type,t.stateNode);else t.stateNode=i1(h,u,t.memoizedProps);else y!==u?(y===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):y.count--,u===null?u1(h,t.type,t.stateNode):i1(h,u,t.memoizedProps)):u===null&&t.stateNode!==null&&am(t,t.memoizedProps,i.memoizedProps)}break;case 27:Wn(a,t),Jn(t),u&512&&(vn||i===null||Xa(i,i.return)),i!==null&&u&4&&am(t,t.memoizedProps,i.memoizedProps);break;case 5:if(Wn(a,t),Jn(t),u&512&&(vn||i===null||Xa(i,i.return)),t.flags&32){h=t.stateNode;try{To(h,"")}catch(He){At(t,t.return,He)}}u&4&&t.stateNode!=null&&(h=t.memoizedProps,am(t,h,i!==null?i.memoizedProps:h)),u&1024&&(om=!0);break;case 6:if(Wn(a,t),Jn(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,h=Ba,Ba=Lu(a.containerInfo),Wn(a,t),Ba=h,Jn(t),u&4&&i!==null&&i.memoizedState.isDehydrated)try{ll(a.containerInfo)}catch(He){At(t,t.return,He)}om&&(om=!1,u0(t));break;case 4:u=Ba,Ba=Lu(t.stateNode.containerInfo),Wn(a,t),Jn(t),Ba=u;break;case 12:Wn(a,t),Jn(t);break;case 31:Wn(a,t),Jn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,ju(t,u)));break;case 13:Wn(a,t),Jn(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:h=t.memoizedState!==null;var Q=i!==null&&i.memoizedState!==null,ae=js,fe=vn;if(js=ae||h,vn=fe||Q,Wn(a,t),vn=fe,js=ae,Jn(t),u&8192)e:for(a=t.stateNode,a._visibility=h?a._visibility&-2:a._visibility|1,h&&(i===null||Q||js||vn||Zr(t)),i=null,a=t;;){if(a.tag===5||a.tag===26){if(i===null){Q=i=a;try{if(y=Q.stateNode,h)A=y.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.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=h?"":Q.memoizedProps}catch(He){At(Q,Q.return,He)}}}else if(a.tag===18){if(i===null){Q=a;try{var ue=Q.stateNode;h?J0(ue,!0):J0(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:Wn(a,t),Jn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,ju(t,u)));break;case 30:break;case 21:break;default:Wn(a,t),Jn(t)}}function Jn(t){var a=t.flags;if(a&2){try{for(var i,u=t.return;u!==null;){if(t0(u)){i=u;break}u=u.return}if(i==null)throw Error(o(160));switch(i.tag){case 27:var h=i.stateNode,y=sm(t);_u(t,y,h);break;case 5:var A=i.stateNode;i.flags&32&&(To(A,""),i.flags&=-33);var I=sm(t);_u(t,I,A);break;case 3:case 4:var Q=i.stateNode.containerInfo,ae=sm(t);rm(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 u0(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var a=t;u0(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),t=t.sibling}}function Ss(t,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)s0(t,a.alternate,a),a=a.sibling}function Zr(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),Zr(a);break;case 1:Xa(a,a.return);var i=a.stateNode;typeof i.componentWillUnmount=="function"&&Jy(a,a.return,i),Zr(a);break;case 27:wi(a.stateNode);case 26:case 5:Xa(a,a.return),Zr(a);break;case 22:a.memoizedState===null&&Zr(a);break;case 30:Zr(a);break;default:Zr(a)}t=t.sibling}}function Cs(t,a,i){for(i=i&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var u=a.alternate,h=t,y=a,A=y.flags;switch(y.tag){case 0:case 11:case 15:Cs(h,y,i),pi(4,y);break;case 1:if(Cs(h,y,i),u=y,h=u.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(ae){At(u,u.return,ae)}if(u=y,h=u.updateQueue,h!==null){var I=u.stateNode;try{var Q=h.shared.hiddenCallbacks;if(Q!==null)for(h.shared.hiddenCallbacks=null,h=0;h<Q.length;h++)Hv(Q[h],I)}catch(ae){At(u,u.return,ae)}}i&&A&64&&Wy(y),mi(y,y.return);break;case 27:n0(y);case 26:case 5:Cs(h,y,i),i&&u===null&&A&4&&e0(y),mi(y,y.return);break;case 12:Cs(h,y,i);break;case 31:Cs(h,y,i),i&&A&4&&l0(h,y);break;case 13:Cs(h,y,i),i&&A&4&&i0(h,y);break;case 22:y.memoizedState===null&&Cs(h,y,i),mi(y,y.return);break;case 30:break;default:Cs(h,y,i)}a=a.sibling}}function lm(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&&ei(i))}function im(t,a){t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&ei(t))}function Ua(t,a,i,u){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)d0(t,a,i,u),a=a.sibling}function d0(t,a,i,u){var h=a.flags;switch(a.tag){case 0:case 11:case 15:Ua(t,a,i,u),h&2048&&pi(9,a);break;case 1:Ua(t,a,i,u);break;case 3:Ua(t,a,i,u),h&2048&&(t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&ei(t)));break;case 12:if(h&2048){Ua(t,a,i,u),t=a.stateNode;try{var y=a.memoizedProps,A=y.id,I=y.onPostCommit;typeof I=="function"&&I(A,a.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(Q){At(a,a.return,Q)}}else Ua(t,a,i,u);break;case 31:Ua(t,a,i,u);break;case 13:Ua(t,a,i,u);break;case 23:break;case 22:y=a.stateNode,A=a.alternate,a.memoizedState!==null?y._visibility&2?Ua(t,a,i,u):gi(t,a):y._visibility&2?Ua(t,a,i,u):(y._visibility|=2,Qo(t,a,i,u,(a.subtreeFlags&10256)!==0||!1)),h&2048&&lm(A,a);break;case 24:Ua(t,a,i,u),h&2048&&im(a.alternate,a);break;default:Ua(t,a,i,u)}}function Qo(t,a,i,u,h){for(h=h&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var y=t,A=a,I=i,Q=u,ae=A.flags;switch(A.tag){case 0:case 11:case 15:Qo(y,A,I,Q,h),pi(8,A);break;case 23:break;case 22:var fe=A.stateNode;A.memoizedState!==null?fe._visibility&2?Qo(y,A,I,Q,h):gi(y,A):(fe._visibility|=2,Qo(y,A,I,Q,h)),h&&ae&2048&&lm(A.alternate,A);break;case 24:Qo(y,A,I,Q,h),h&&ae&2048&&im(A.alternate,A);break;default:Qo(y,A,I,Q,h)}a=a.sibling}}function gi(t,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var i=t,u=a,h=u.flags;switch(u.tag){case 22:gi(i,u),h&2048&&lm(u.alternate,u);break;case 24:gi(i,u),h&2048&&im(u.alternate,u);break;default:gi(i,u)}a=a.sibling}}var hi=8192;function Zo(t,a,i){if(t.subtreeFlags&hi)for(t=t.child;t!==null;)f0(t,a,i),t=t.sibling}function f0(t,a,i){switch(t.tag){case 26:Zo(t,a,i),t.flags&hi&&t.memoizedState!==null&&_N(i,Ba,t.memoizedState,t.memoizedProps);break;case 5:Zo(t,a,i);break;case 3:case 4:var u=Ba;Ba=Lu(t.stateNode.containerInfo),Zo(t,a,i),Ba=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=hi,hi=16777216,Zo(t,a,i),hi=u):Zo(t,a,i));break;default:Zo(t,a,i)}}function p0(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 xi(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,g0(u,t)}p0(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)m0(t),t=t.sibling}function m0(t){switch(t.tag){case 0:case 11:case 15:xi(t),t.flags&2048&&tr(9,t,t.return);break;case 3:xi(t);break;case 12:xi(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)):xi(t);break;default:xi(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,g0(u,t)}p0(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 g0(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:ei(i.memoizedState.cache)}if(u=i.child,u!==null)u.return=i,wn=u;else e:for(i=t;wn!==null;){u=wn;var h=u.sibling,y=u.return;if(r0(u),u===i){wn=null;break e}if(h!==null){h.return=y,wn=h;break e}wn=y}}}var LE={getCacheForType:function(t){var a=kn(hn),i=a.data.get(t);return i===void 0&&(i=t(),a.data.set(t,i)),i},cacheSignal:function(){return kn(hn).controller.signal}},PE=typeof WeakMap=="function"?WeakMap:Map,Et=0,qt=null,gt=null,xt=0,Tt=0,ma=null,nr=!1,Wo=!1,cm=!1,ks=0,on=0,ar=0,Wr=0,um=0,ga=0,Jo=0,bi=null,ea=null,dm=!1,Su=0,h0=0,Cu=1/0,ku=null,sr=null,_n=0,rr=null,el=null,Es=0,fm=0,pm=null,x0=null,vi=0,mm=null;function ha(){return(Et&2)!==0&&xt!==0?xt&-xt:V.T!==null?ym():Dt()}function b0(){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 ta(t,a,i){(t===qt&&(Tt===2||Tt===9)||t.cancelPendingCommit!==null)&&(tl(t,0),or(t,xt,ga,!1)),Kn(t,i),((Et&2)===0||t!==qt)&&(t===qt&&((Et&2)===0&&(Wr|=i),on===4&&or(t,xt,ga,!1)),Ka(t))}function v0(t,a,i){if((Et&6)!==0)throw Error(o(327));var u=!i&&(a&127)===0&&(a&t.expiredLanes)===0||dn(t,a),h=u?UE(t,a):hm(t,a,!0),y=u;do{if(h===0){Wo&&!u&&or(t,a,0,!1);break}else{if(i=t.current.alternate,y&&!IE(i)){h=hm(t,a,!1),y=!1;continue}if(h===2){if(y=a,t.errorRecoveryDisabledLanes&y)var A=0;else A=t.pendingLanes&-536870913,A=A!==0?A:A&536870912?536870912:0;if(A!==0){a=A;e:{var I=t;h=bi;var Q=I.current.memoizedState.isDehydrated;if(Q&&(tl(I,A).flags|=256),A=hm(I,A,!1),A!==2){if(cm&&!Q){I.errorRecoveryDisabledLanes|=y,Wr|=y,h=4;break e}y=ea,ea=h,y!==null&&(ea===null?ea=y:ea.push.apply(ea,y))}h=A}if(y=!1,h!==2)continue}}if(h===1){tl(t,0),or(t,a,0,!0);break}e:{switch(u=t,y=h,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:ea=null;break;case 3:case 5:break;default:throw Error(o(329))}if((a&62914560)===a&&(h=Su+300-ye(),10<h)){if(or(u,a,ga,!nr),Ft(u,0,!0)!==0)break e;Es=a,u.timeoutHandle=Q0(y0.bind(null,u,i,ea,ku,dm,a,ga,Wr,Jo,nr,y,"Throttled",-0,0),h);break e}y0(u,i,ea,ku,dm,a,ga,Wr,Jo,nr,y,null,-0,0)}}break}while(!0);Ka(t)}function y0(t,a,i,u,h,y,A,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:fs},f0(a,y,xe);var He=(y&62914560)===y?Su-ye():(y&4194048)===y?h0-ye():0;if(He=jN(xe,He),He!==null){Es=y,t.cancelPendingCommit=He(N0.bind(null,t,a,y,i,u,h,A,I,Q,fe,xe,null,se,ue)),or(t,y,A,!ae);return}}N0(t,a,y,i,u,h,A,I,Q)}function IE(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 h=i[u],y=h.getSnapshot;h=h.value;try{if(!ua(y(),h))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&=~um,a&=~Wr,t.suspendedLanes|=a,t.pingedLanes&=~a,u&&(t.warmLanes|=a),u=t.expirationTimes;for(var h=a;0<h;){var y=31-st(h),A=1<<y;u[y]=-1,h&=~A}i!==0&&Dn(t,i,a)}function Eu(){return(Et&6)===0?(yi(0),!1):!0}function gm(){if(gt!==null){if(Tt===0)var t=gt.return;else t=gt,hs=qr=null,Ap(t),Go=null,ni=0,t=gt;for(;t!==null;)Zy(t.alternate,t),t=t.return;gt=null}}function tl(t,a){var i=t.timeoutHandle;i!==-1&&(t.timeoutHandle=-1,sN(i)),i=t.cancelPendingCommit,i!==null&&(t.cancelPendingCommit=null,i()),Es=0,gm(),qt=t,gt=i=ms(t.current,null),xt=a,Tt=0,ma=null,nr=!1,Wo=dn(t,a),cm=!1,Jo=ga=um=Wr=ar=on=0,ea=bi=null,dm=!1,(a&8)!==0&&(a|=a&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=a;0<u;){var h=31-st(u),y=1<<h;a|=t[h],u&=~y}return ks=a,Xc(),i}function _0(t,a){ot=null,V.H=ui,a===$o||a===nu?(a=Pv(),Tt=3):a===vp?(a=Pv(),Tt=4):Tt=a===Yp?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,ma=a,gt===null&&(on=1,hu(t,wa(a,t.current)))}function j0(){var t=fa.current;return t===null?!0:(xt&4194048)===xt?Ea===null:(xt&62914560)===xt||(xt&536870912)!==0?t===Ea:!1}function w0(){var t=V.H;return V.H=ui,t===null?ui:t}function S0(){var t=V.A;return V.A=LE,t}function Nu(){on=4,nr||(xt&4194048)!==xt&&fa.current!==null||(Wo=!0),(ar&134217727)===0&&(Wr&134217727)===0||qt===null||or(qt,xt,ga,!1)}function hm(t,a,i){var u=Et;Et|=2;var h=w0(),y=S0();(qt!==t||xt!==a)&&(ku=null,tl(t,a)),a=!1;var A=on;e:do try{if(Tt!==0&&gt!==null){var I=gt,Q=ma;switch(Tt){case 8:gm(),A=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){A=0;break e}break;default:ae=Tt,Tt=0,ma=null,nl(t,I,Q,ae)}}BE(),A=on;break}catch(fe){_0(t,fe)}while(!0);return a&&t.shellSuspendCounter++,hs=qr=null,Et=u,V.H=h,V.A=y,gt===null&&(qt=null,xt=0,Xc()),A}function BE(){for(;gt!==null;)C0(gt)}function UE(t,a){var i=Et;Et|=2;var u=w0(),h=S0();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(Dv(y)){Tt=0,ma=null,k0(a);break}a=function(){Tt!==2&&Tt!==9||qt!==t||(Tt=7),Ka(t)},y.then(a,a);break e;case 3:Tt=7;break e;case 4:Tt=5;break e;case 7:Dv(y)?(Tt=0,ma=null,k0(a)):(Tt=0,ma=null,nl(t,a,y,7));break;case 5:var A=null;switch(gt.tag){case 26:A=gt.memoizedState;case 5:case 27:var I=gt;if(A?d1(A):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:gm(),on=6;break e;default:throw Error(o(462))}}HE();break}catch(fe){_0(t,fe)}while(!0);return hs=qr=null,V.H=u,V.A=h,Et=i,gt!==null?0:(qt=null,xt=0,Xc(),on)}function HE(){for(;gt!==null&&!Ye();)C0(gt)}function C0(t){var a=Ky(t.alternate,t,ks);t.memoizedProps=t.pendingProps,a===null?Ru(t):gt=a}function k0(t){var a=t,i=a.alternate;switch(a.tag){case 15:case 0:a=qy(i,a,a.pendingProps,a.type,void 0,xt);break;case 11:a=qy(i,a,a.pendingProps,a.type.render,a.ref,xt);break;case 5:Ap(a);default:Zy(i,a),a=gt=Sv(a,ks),a=Ky(i,a,ks)}t.memoizedProps=t.pendingProps,a===null?Ru(t):gt=a}function nl(t,a,i,u){hs=qr=null,Ap(a),Go=null,ni=0;var h=a.return;try{if(RE(t,h,a,i,xt)){on=1,hu(t,wa(i,t.current)),gt=null;return}}catch(y){if(h!==null)throw gt=h,y;on=1,hu(t,wa(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))),E0(a,t)):Ru(a)}function Ru(t){var a=t;do{if((a.flags&32768)!==0){E0(a,nr);return}t=a.return;var i=ME(a.alternate,a,ks);if(i!==null){gt=i;return}if(a=a.sibling,a!==null){gt=a;return}gt=a=t}while(a!==null);on===0&&(on=5)}function E0(t,a){do{var i=OE(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);on=6,gt=null}function N0(t,a,i,u,h,y,A,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|=sp,cs(t,i,y,A,I,Q),t===qt&&(gt=qt=null,xt=0),el=a,rr=t,Es=i,fm=y,pm=h,x0=u,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,GE(Ue,function(){return O0(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||u){u=V.T,V.T=null,h=$.p,$.p=2,A=Et,Et|=4;try{zE(t,a,i)}finally{Et=A,$.p=h,V.T=u}}_n=1,R0(),T0(),A0()}}function R0(){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 h=Et;Et|=4;try{c0(a,t);var y=Nm,A=gv(t.containerInfo),I=y.focusedElem,Q=y.selectionRange;if(A!==I&&I&&I.ownerDocument&&mv(I.ownerDocument.documentElement,I)){if(Q!==null&&Jf(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&&(A=It,It=et,et=A);var te=pv(I,et),W=pv(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=!!Em,Nm=Em=null}finally{Et=h,$.p=u,V.T=i}}t.current=a,_n=2}}function T0(){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 h=Et;Et|=4;try{s0(t,a.alternate,a)}finally{Et=h,$.p=u,V.T=i}}_n=3}}function A0(){if(_n===4||_n===3){_n=0,De();var t=rr,a=el,i=Es,u=x0;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?_n=5:(_n=0,el=rr=null,M0(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(sr=null),ct(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,h=$.p,$.p=2,V.T=null;try{for(var y=t.onRecoverableError,A=0;A<u.length;A++){var I=u[A];y(I.value,{componentStack:I.stack})}}finally{V.T=a,$.p=h}}(Es&3)!==0&&Tu(),Ka(t),h=t.pendingLanes,(i&261930)!==0&&(h&42)!==0?t===mm?vi++:(vi=0,mm=t):vi=0,yi(0)}}function M0(t,a){(t.pooledCacheLanes&=a)===0&&(a=t.pooledCache,a!=null&&(t.pooledCache=null,ei(a)))}function Tu(){return R0(),T0(),A0(),O0()}function O0(){if(_n!==5)return!1;var t=rr,a=fm;fm=0;var i=ct(Es),u=V.T,h=$.p;try{$.p=32>i?32:i,V.T=null,i=pm,pm=null;var y=rr,A=Es;if(_n=0,el=rr=null,Es=0,(Et&6)!==0)throw Error(o(331));var I=Et;if(Et|=4,m0(y.current),d0(y,y.current,A,i),Et=I,yi(0,!1),Re&&typeof Re.onPostCommitFiberRoot=="function")try{Re.onPostCommitFiberRoot(Ee,y)}catch{}return!0}finally{$.p=h,V.T=u,M0(t,a)}}function z0(t,a,i){a=wa(i,a),a=Fp(t.stateNode,a,2),t=Ws(t,a,2),t!==null&&(Kn(t,2),Ka(t))}function At(t,a,i){if(t.tag===3)z0(t,t,i);else for(;a!==null;){if(a.tag===3){z0(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=wa(i,t),i=Dy(2),u=Ws(a,i,2),u!==null&&(Ly(i,u,a,t),Kn(u,2),Ka(u));break}}a=a.return}}function xm(t,a,i){var u=t.pingCache;if(u===null){u=t.pingCache=new PE;var h=new Set;u.set(a,h)}else h=u.get(a),h===void 0&&(h=new Set,u.set(a,h));h.has(i)||(cm=!0,h.add(i),t=VE.bind(null,t,a,i),a.then(t,t))}function VE(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&&(on===4||on===3&&(xt&62914560)===xt&&300>ye()-Su?(Et&2)===0&&tl(t,0):um|=i,Jo===xt&&(Jo=0)),Ka(t)}function D0(t,a){a===0&&(a=Xn()),t=Ur(t,a),t!==null&&(Kn(t,a),Ka(t))}function qE(t){var a=t.memoizedState,i=0;a!==null&&(i=a.retryLane),D0(t,i)}function $E(t,a){var i=0;switch(t.tag){case 31:case 13:var u=t.stateNode,h=t.memoizedState;h!==null&&(i=h.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),D0(t,i)}function GE(t,a){return Be(t,a)}var Au=null,al=null,bm=!1,Mu=!1,vm=!1,lr=0;function Ka(t){t!==al&&t.next===null&&(al===null?Au=al=t:al=al.next=t),Mu=!0,bm||(bm=!0,YE())}function yi(t,a){if(!vm&&Mu){vm=!0;do for(var i=!1,u=Au;u!==null;){if(t!==0){var h=u.pendingLanes;if(h===0)var y=0;else{var A=u.suspendedLanes,I=u.pingedLanes;y=(1<<31-st(42|t)+1)-1,y&=h&~(A&~I),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(i=!0,B0(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,B0(u,y));u=u.next}while(i);vm=!1}}function FE(){L0()}function L0(){Mu=bm=!1;var t=0;lr!==0&&aN()&&(t=lr);for(var a=ye(),i=null,u=Au;u!==null;){var h=u.next,y=P0(u,a);y===0?(u.next=null,i===null?Au=h:i.next=h,h===null&&(al=i)):(i=u,(t!==0||(y&3)!==0)&&(Mu=!0)),u=h}_n!==0&&_n!==5||yi(t),lr!==0&&(lr=0)}function P0(t,a){for(var i=t.suspendedLanes,u=t.pingedLanes,h=t.expirationTimes,y=t.pendingLanes&-62914561;0<y;){var A=31-st(y),I=1<<A,Q=h[A];Q===-1?((I&i)===0||(I&u)!==0)&&(h[A]=zn(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),ct(i)){case 2:case 8:i=Se;break;case 32:i=Ue;break;case 268435456:i=_t;break;default:i=Ue}return u=I0.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 I0(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:(v0(t,u,a),P0(t,ye()),t.callbackNode!=null&&t.callbackNode===i?I0.bind(null,t):null)}function B0(t,a){if(Tu())return null;v0(t,a,!0)}function YE(){rN(function(){(Et&6)!==0?Be(_e,FE):L0()})}function ym(){if(lr===0){var t=Vo;t===0&&(t=Nt,Nt<<=1,(Nt&261888)===0&&(Nt=256)),lr=t}return lr}function U0(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Uc(""+t)}function H0(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 XE(t,a,i,u,h){if(a==="submit"&&i&&i.stateNode===h){var y=U0((h[gn]||null).action),A=u.submitter;A&&(a=(a=A[gn]||null)?U0(a.formAction):A.getAttribute("formAction"),a!==null&&(y=a,A=null));var I=new $c("action","action",null,u,h);t.push({event:I,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(lr!==0){var Q=A?H0(h,A):new FormData(h);Up(i,{pending:!0,data:Q,method:h.method,action:y},null,Q)}}else typeof y=="function"&&(I.preventDefault(),Q=A?H0(h,A):new FormData(h),Up(i,{pending:!0,data:Q,method:h.method,action:y},y,Q))},currentTarget:h}]})}}for(var _m=0;_m<ap.length;_m++){var jm=ap[_m],KE=jm.toLowerCase(),QE=jm[0].toUpperCase()+jm.slice(1);Ia(KE,"on"+QE)}Ia(bv,"onAnimationEnd"),Ia(vv,"onAnimationIteration"),Ia(yv,"onAnimationStart"),Ia("dblclick","onDoubleClick"),Ia("focusin","onFocus"),Ia("focusout","onBlur"),Ia(fE,"onTransitionRun"),Ia(pE,"onTransitionStart"),Ia(mE,"onTransitionCancel"),Ia(_v,"onTransitionEnd"),No("onMouseEnter",["mouseout","mouseover"]),No("onMouseLeave",["mouseout","mouseover"]),No("onPointerEnter",["pointerout","pointerover"]),No("onPointerLeave",["pointerout","pointerover"]),Lr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Lr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Lr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Lr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Lr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Lr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var _i="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(" "),ZE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(_i));function V0(t,a){a=(a&4)!==0;for(var i=0;i<t.length;i++){var u=t[i],h=u.event;u=u.listeners;e:{var y=void 0;if(a)for(var A=u.length-1;0<=A;A--){var I=u[A],Q=I.instance,ae=I.currentTarget;if(I=I.listener,Q!==y&&h.isPropagationStopped())break e;y=I,h.currentTarget=ae;try{y(h)}catch(fe){Yc(fe)}h.currentTarget=null,y=Q}else for(A=0;A<u.length;A++){if(I=u[A],Q=I.instance,ae=I.currentTarget,I=I.listener,Q!==y&&h.isPropagationStopped())break e;y=I,h.currentTarget=ae;try{y(h)}catch(fe){Yc(fe)}h.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)||(q0(a,t,2,!1),i.add(u))}function wm(t,a,i){var u=0;a&&(u|=4),q0(i,t,u,a)}var Ou="_reactListening"+Math.random().toString(36).slice(2);function Sm(t){if(!t[Ou]){t[Ou]=!0,Lb.forEach(function(i){i!=="selectionchange"&&(ZE.has(i)||wm(i,!1,t),wm(i,!0,t))});var a=t.nodeType===9?t:t.ownerDocument;a===null||a[Ou]||(a[Ou]=!0,wm("selectionchange",!1,a))}}function q0(t,a,i,u){switch(b1(a)){case 2:var h=CN;break;case 8:h=kN;break;default:h=Bm}i=h.bind(null,a,i,t),h=void 0,!$f||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(h=!0),u?h!==void 0?t.addEventListener(a,i,{capture:!0,passive:h}):t.addEventListener(a,i,!0):h!==void 0?t.addEventListener(a,i,{passive:h}):t.addEventListener(a,i,!1)}function Cm(t,a,i,u,h){var y=u;if((a&1)===0&&(a&2)===0&&u!==null)e:for(;;){if(u===null)return;var A=u.tag;if(A===3||A===4){var I=u.stateNode.containerInfo;if(I===h)break;if(A===4)for(A=u.return;A!==null;){var Q=A.tag;if((Q===3||Q===4)&&A.stateNode.containerInfo===h)return;A=A.return}for(;I!==null;){if(A=Co(I),A===null)return;if(Q=A.tag,Q===5||Q===6||Q===26||Q===27){u=y=A;continue e}I=I.parentNode}}u=u.return}Xb(function(){var ae=y,fe=Vf(i),xe=[];e:{var se=jv.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=$k;break;case"focusin":He="focus",ue=Xf;break;case"focusout":He="blur",ue=Xf;break;case"beforeblur":case"afterblur":ue=Xf;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=Zb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=Mk;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=Yk;break;case bv:case vv:case yv:ue=Dk;break;case _v:ue=Kk;break;case"scroll":case"scrollend":ue=Tk;break;case"wheel":ue=Zk;break;case"copy":case"cut":case"paste":ue=Pk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=Jb;break;case"toggle":case"beforetoggle":ue=Jk}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=ql(W,te),he!=null&&et.push(ji(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!==Hf&&(He=i.relatedTarget||i.fromElement)&&(Co(He)||He[Dr]))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=Zb,he="onMouseLeave",te="onMouseEnter",W="mouse",(t==="pointerout"||t==="pointerover")&&(et=Jb,he="onPointerLeave",te="onPointerEnter",W="pointer"),It=ue==null?se:Vl(ue),ne=He==null?se:Vl(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=WE,te=ue,W=He,ne=0,he=te;he;he=et(he))ne++;he=0;for(var Qe=W;Qe;Qe=et(Qe))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&&$0(xe,se,ue,et,!1),He!==null&&It!==null&&$0(xe,It,He,et,!0)}}e:{if(se=ae?Vl(ae):window,ue=se.nodeName&&se.nodeName.toLowerCase(),ue==="select"||ue==="input"&&se.type==="file")var Ct=lv;else if(rv(se))if(iv)Ct=cE;else{Ct=lE;var Ge=oE}else ue=se.nodeName,!ue||ue.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ae&&Uf(ae.elementType)&&(Ct=lv):Ct=iE;if(Ct&&(Ct=Ct(t,ae))){ov(xe,Ct,i,fe);break e}Ge&&Ge(t,se,ae),t==="focusout"&&ae&&se.type==="number"&&ae.memoizedProps.value!=null&&Bf(se,"number",se.value)}switch(Ge=ae?Vl(ae):window,t){case"focusin":(rv(Ge)||Ge.contentEditable==="true")&&(zo=Ge,ep=ae,Zl=null);break;case"focusout":Zl=ep=zo=null;break;case"mousedown":tp=!0;break;case"contextmenu":case"mouseup":case"dragend":tp=!1,hv(xe,i,fe);break;case"selectionchange":if(dE)break;case"keydown":case"keyup":hv(xe,i,fe)}var ut;if(Qf)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?av(t,i)&&(bt="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(bt="onCompositionStart");bt&&(ev&&i.locale!=="ko"&&(Oo||bt!=="onCompositionStart"?bt==="onCompositionEnd"&&Oo&&(ut=Kb()):(Gs=fe,Gf="value"in Gs?Gs.value:Gs.textContent,Oo=!0)),Ge=zu(ae,bt),0<Ge.length&&(bt=new Wb(bt,t,null,i,fe),xe.push({event:bt,listeners:Ge}),ut?bt.data=ut:(ut=sv(i),ut!==null&&(bt.data=ut)))),(ut=tE?nE(t,i):aE(t,i))&&(bt=zu(ae,"onBeforeInput"),0<bt.length&&(Ge=new Wb("onBeforeInput","beforeinput",null,i,fe),xe.push({event:Ge,listeners:bt}),Ge.data=ut)),XE(xe,t,ae,i,fe)}V0(xe,a)})}function ji(t,a,i){return{instance:t,listener:a,currentTarget:i}}function zu(t,a){for(var i=a+"Capture",u=[];t!==null;){var h=t,y=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||y===null||(h=ql(t,i),h!=null&&u.unshift(ji(t,h,y)),h=ql(t,a),h!=null&&u.push(ji(t,h,y))),t.tag===3)return u;t=t.return}return[]}function WE(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function $0(t,a,i,u,h){for(var y=a._reactName,A=[];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,h?(ae=ql(i,y),ae!=null&&A.unshift(ji(i,ae,Q))):h||(ae=ql(i,y),ae!=null&&A.push(ji(i,ae,Q)))),i=i.return}A.length!==0&&t.push({event:a,listeners:A})}var JE=/\r\n?/g,eN=/\u0000|\uFFFD/g;function G0(t){return(typeof t=="string"?t:""+t).replace(JE,`
49
- `).replace(eN,"")}function F0(t,a){return a=G0(a),G0(t)===a}function Pt(t,a,i,u,h,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":Fb(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",h.name,h,null),Pt(t,a,"formEncType",h.formEncType,h,null),Pt(t,a,"formMethod",h.formMethod,h,null),Pt(t,a,"formTarget",h.formTarget,h,null)):(Pt(t,a,"encType",h.encType,h,null),Pt(t,a,"method",h.method,h,null),Pt(t,a,"target",h.target,h,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=fs);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(h.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":ds(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":ds(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":ds(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":ds(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":ds(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":ds(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":ds(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":ds(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":ds(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=Nk.get(i)||i,Pc(t,i,u))}}function km(t,a,i,u,h,y){switch(i){case"style":Fb(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(h.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=fs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Pb.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(h=i.endsWith("Capture"),a=i.slice(2,h?i.length-7:void 0),y=t[gn]||null,y=y!=null?y[i]:null,typeof y=="function"&&t.removeEventListener(a,y,h),typeof u=="function")){typeof y!="function"&&y!==null&&(i in t?t[i]=null:t.hasAttribute(i)&&t.removeAttribute(i)),t.addEventListener(a,u,h);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,h=!1,y;for(y in i)if(i.hasOwnProperty(y)){var A=i[y];if(A!=null)switch(y){case"src":u=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,a));default:Pt(t,a,y,A,i,null)}}h&&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=A=h=null,Q=null,ae=null;for(u in i)if(i.hasOwnProperty(u)){var fe=i[u];if(fe!=null)switch(u){case"name":h=fe;break;case"type":A=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)}}Vb(t,y,I,Q,ae,A,h,!1);return;case"select":ht("invalid",t),u=A=y=null;for(h in i)if(i.hasOwnProperty(h)&&(I=i[h],I!=null))switch(h){case"value":y=I;break;case"defaultValue":A=I;break;case"multiple":u=I;default:Pt(t,a,h,I,i,null)}a=y,i=A,t.multiple=!!u,a!=null?Ro(t,!!u,a,!1):i!=null&&Ro(t,!!u,i,!0);return;case"textarea":ht("invalid",t),y=h=u=null;for(A in i)if(i.hasOwnProperty(A)&&(I=i[A],I!=null))switch(A){case"value":u=I;break;case"defaultValue":h=I;break;case"children":y=I;break;case"dangerouslySetInnerHTML":if(I!=null)throw Error(o(91));break;default:Pt(t,a,A,I,i,null)}$b(t,u,h,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<_i.length;u++)ht(_i[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(Uf(a)){for(fe in i)i.hasOwnProperty(fe)&&(u=i[fe],u!==void 0&&km(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 tN(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 h=null,y=null,A=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":h=ue;break;case"checked":ae=ue;break;case"defaultChecked":fe=ue;break;case"value":A=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)}}If(t,A,I,Q,ae,fe,y,h);return;case"select":ue=A=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(h in u)if(y=u[h],Q=i[h],u.hasOwnProperty(h)&&(y!=null||Q!=null))switch(h){case"value":se=y;break;case"defaultValue":I=y;break;case"multiple":A=y;default:y!==Q&&Pt(t,a,h,y,u,Q)}a=I,i=A,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(h=i[I],i.hasOwnProperty(I)&&h!=null&&!u.hasOwnProperty(I))switch(I){case"value":break;case"children":break;default:Pt(t,a,I,null,u,h)}for(A in u)if(h=u[A],y=i[A],u.hasOwnProperty(A)&&(h!=null||y!=null))switch(A){case"value":se=h;break;case"defaultValue":ue=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(o(91));break;default:h!==y&&Pt(t,a,A,h,u,y)}qb(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(Uf(a)){for(var It in i)se=i[It],i.hasOwnProperty(It)&&se!==void 0&&!u.hasOwnProperty(It)&&km(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||km(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 Y0(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function nN(){if(typeof performance.getEntriesByType=="function"){for(var t=0,a=0,i=performance.getEntriesByType("resource"),u=0;u<i.length;u++){var h=i[u],y=h.transferSize,A=h.initiatorType,I=h.duration;if(y&&I&&Y0(A)){for(A=0,I=h.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&&Y0(xe)&&(Q=Q.responseEnd,A+=fe*(Q<I?1:(I-ae)/(Q-ae)))}if(--u,a+=8*(y+A)/(h.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 Em=null,Nm=null;function Du(t){return t.nodeType===9?t:t.ownerDocument}function X0(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 K0(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 Rm(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 Tm=null;function aN(){var t=window.event;return t&&t.type==="popstate"?t===Tm?!1:(Tm=t,!0):(Tm=null,!1)}var Q0=typeof setTimeout=="function"?setTimeout:void 0,sN=typeof clearTimeout=="function"?clearTimeout:void 0,Z0=typeof Promise=="function"?Promise:void 0,rN=typeof queueMicrotask=="function"?queueMicrotask:typeof Z0<"u"?function(t){return Z0.resolve(null).then(t).catch(oN)}:Q0;function oN(t){setTimeout(function(){throw t})}function ir(t){return t==="head"}function W0(t,a){var i=a,u=0;do{var h=i.nextSibling;if(t.removeChild(i),h&&h.nodeType===8)if(i=h.data,i==="/$"||i==="/&"){if(u===0){t.removeChild(h),ll(a);return}u--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")u++;else if(i==="html")wi(t.ownerDocument.documentElement);else if(i==="head"){i=t.ownerDocument.head,wi(i);for(var y=i.firstChild;y;){var A=y.nextSibling,I=y.nodeName;y[Hl]||I==="SCRIPT"||I==="STYLE"||I==="LINK"&&y.rel.toLowerCase()==="stylesheet"||i.removeChild(y),y=A}}else i==="body"&&wi(t.ownerDocument.body);i=h}while(i);ll(a)}function J0(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 Am(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":Am(i),Lf(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}t.removeChild(i)}}function lN(t,a,i,u){for(;t.nodeType===1;){var h=i;if(t.nodeName.toLowerCase()!==a.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[Hl])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!==h.rel||t.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||t.getAttribute("title")!==(h.title==null?null:h.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(y=t.getAttribute("src"),(y!==(h.src==null?null:h.src)||t.getAttribute("type")!==(h.type==null?null:h.type)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&y&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(a==="input"&&t.type==="hidden"){var y=h.name==null?null:""+h.name;if(h.type==="hidden"&&t.getAttribute("name")===y)return t}else return t;if(t=Na(t.nextSibling),t===null)break}return null}function iN(t,a,i){if(a==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=Na(t.nextSibling),t===null))return null;return t}function e1(t,a){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Na(t.nextSibling),t===null))return null;return t}function Mm(t){return t.data==="$?"||t.data==="$~"}function Om(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function cN(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 Na(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 zm=null;function t1(t){t=t.nextSibling;for(var a=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"||i==="/&"){if(a===0)return Na(t.nextSibling);a--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||a++}t=t.nextSibling}return null}function n1(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 a1(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 wi(t){for(var a=t.attributes;a.length;)t.removeAttributeNode(a[0]);Lf(t)}var Ra=new Map,s1=new Set;function Lu(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Ns=$.d;$.d={f:uN,r:dN,D:fN,C:pN,L:mN,m:gN,X:xN,S:hN,M:bN};function uN(){var t=Ns.f(),a=Eu();return t||a}function dN(t){var a=ko(t);a!==null&&a.tag===5&&a.type==="form"?_y(a):Ns.r(t)}var sl=typeof document>"u"?null:document;function r1(t,a,i){var u=sl;if(u&&typeof a=="string"&&a){var h=_a(a);h='link[rel="'+t+'"][href="'+h+'"]',typeof i=="string"&&(h+='[crossorigin="'+i+'"]'),s1.has(h)||(s1.add(h),t={rel:t,crossOrigin:i,href:a},u.querySelector(h)===null&&(a=u.createElement("link"),Nn(a,"link",t),jn(a),u.head.appendChild(a)))}}function fN(t){Ns.D(t),r1("dns-prefetch",t,null)}function pN(t,a){Ns.C(t,a),r1("preconnect",t,a)}function mN(t,a,i){Ns.L(t,a,i);var u=sl;if(u&&t&&a){var h='link[rel="preload"][as="'+_a(a)+'"]';a==="image"&&i&&i.imageSrcSet?(h+='[imagesrcset="'+_a(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(h+='[imagesizes="'+_a(i.imageSizes)+'"]')):h+='[href="'+_a(t)+'"]';var y=h;switch(a){case"style":y=rl(t);break;case"script":y=ol(t)}Ra.has(y)||(t=b({rel:"preload",href:a==="image"&&i&&i.imageSrcSet?void 0:t,as:a},i),Ra.set(y,t),u.querySelector(h)!==null||a==="style"&&u.querySelector(Si(y))||a==="script"&&u.querySelector(Ci(y))||(a=u.createElement("link"),Nn(a,"link",t),jn(a),u.head.appendChild(a)))}}function gN(t,a){Ns.m(t,a);var i=sl;if(i&&t){var u=a&&typeof a.as=="string"?a.as:"script",h='link[rel="modulepreload"][as="'+_a(u)+'"][href="'+_a(t)+'"]',y=h;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=ol(t)}if(!Ra.has(y)&&(t=b({rel:"modulepreload",href:t},a),Ra.set(y,t),i.querySelector(h)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Ci(y)))return}u=i.createElement("link"),Nn(u,"link",t),jn(u),i.head.appendChild(u)}}}function hN(t,a,i){Ns.S(t,a,i);var u=sl;if(u&&t){var h=Eo(u).hoistableStyles,y=rl(t);a=a||"default";var A=h.get(y);if(!A){var I={loading:0,preload:null};if(A=u.querySelector(Si(y)))I.loading=5;else{t=b({rel:"stylesheet",href:t,"data-precedence":a},i),(i=Ra.get(y))&&Dm(t,i);var Q=A=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(A,a,u)}A={type:"stylesheet",instance:A,count:1,state:I},h.set(y,A)}}}function xN(t,a){Ns.X(t,a);var i=sl;if(i&&t){var u=Eo(i).hoistableScripts,h=ol(t),y=u.get(h);y||(y=i.querySelector(Ci(h)),y||(t=b({src:t,async:!0},a),(a=Ra.get(h))&&Lm(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(h,y))}}function bN(t,a){Ns.M(t,a);var i=sl;if(i&&t){var u=Eo(i).hoistableScripts,h=ol(t),y=u.get(h);y||(y=i.querySelector(Ci(h)),y||(t=b({src:t,async:!0,type:"module"},a),(a=Ra.get(h))&&Lm(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(h,y))}}function o1(t,a,i,u){var h=(h=re.current)?Lu(h):null;if(!h)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(h).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(h).hoistableStyles,A=y.get(t);if(A||(h=h.ownerDocument||h,A={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(t,A),(y=h.querySelector(Si(t)))&&!y._p&&(A.instance=y,A.state.loading=5),Ra.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},Ra.set(t,i),y||vN(h,t,i,A.state))),a&&u===null)throw Error(o(528,""));return A}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(h).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="'+_a(t)+'"'}function Si(t){return'link[rel="stylesheet"]['+t+"]"}function l1(t){return b({},t,{"data-precedence":t.precedence,precedence:null})}function vN(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="'+_a(t)+'"]'}function Ci(t){return"script[async]"+t}function i1(t,a,i){if(a.count++,a.instance===null)switch(a.type){case"style":var u=t.querySelector('style[data-href~="'+_a(i.href)+'"]');if(u)return a.instance=u,jn(u),u;var h=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",h),Pu(u,i.precedence,t),a.instance=u;case"stylesheet":h=rl(i.href);var y=t.querySelector(Si(h));if(y)return a.state.loading|=4,a.instance=y,jn(y),y;u=l1(i),(h=Ra.get(h))&&Dm(u,h),y=(t.ownerDocument||t).createElement("link"),jn(y);var A=y;return A._p=new Promise(function(I,Q){A.onload=I,A.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),(h=t.querySelector(Ci(y)))?(a.instance=h,jn(h),h):(u=i,(h=Ra.get(y))&&(u=b({},i),Lm(u,h)),t=t.ownerDocument||t,h=t.createElement("script"),jn(h),Nn(h,"link",u),t.head.appendChild(h),a.instance=h);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]'),h=u.length?u[u.length-1]:null,y=h,A=0;A<u.length;A++){var I=u[A];if(I.dataset.precedence===a)y=I;else if(y!==h)break}y?y.parentNode.insertBefore(t,y.nextSibling):(a=i.nodeType===9?i.head:i,a.insertBefore(t,a.firstChild))}function Dm(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.title==null&&(t.title=a.title)}function Lm(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 c1(t,a,i){if(Iu===null){var u=new Map,h=Iu=new Map;h.set(i,u)}else h=Iu,u=h.get(i),u||(u=new Map,h.set(i,u));if(u.has(t))return u;for(u.set(t,null),i=i.getElementsByTagName(t),h=0;h<i.length;h++){var y=i[h];if(!(y[Hl]||y[Rt]||t==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var A=y.getAttribute(a)||"";A=t+A;var I=u.get(A);I?I.push(y):u.set(A,[y])}}return u}function u1(t,a,i){t=t.ownerDocument||t,t.head.insertBefore(i,a==="title"?t.querySelector("head > title"):null)}function yN(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 d1(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function _N(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 h=rl(u.href),y=a.querySelector(Si(h));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=l1(u),(h=Ra.get(h))&&Dm(u,h),y=y.createElement("link"),jn(y);var A=y;A._p=new Promise(function(I,Q){A.onload=I,A.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 Pm=0;function jN(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&&Pm===0&&(Pm=62500*nN());var h=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>Pm?50:800)+a);return t.unsuspend=i,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(h)}}: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(wN,t),Uu=null,Bu.call(t))}function wN(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 h=t.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<h.length;y++){var A=h[y];(A.nodeName==="LINK"||A.getAttribute("media")!=="not all")&&(i.set(A.dataset.precedence,A),u=A)}u&&i.set(null,u)}h=a.instance,A=h.getAttribute("data-precedence"),y=i.get(A)||u,y===u&&i.set(null,h),i.set(A,h),this.count++,u=Bu.bind(this),h.addEventListener("load",u),h.addEventListener("error",u),y?y.parentNode.insertBefore(h,y.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(h,t.firstChild)),a.state.loading|=4}}var ki={$$typeof:N,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function SN(t,a,i,u,h,y,A,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=h,this.onCaughtError=y,this.onRecoverableError=A,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.incompleteTransitions=new Map}function f1(t,a,i,u,h,y,A,I,Q,ae,fe,xe){return t=new SN(t,a,i,A,Q,ae,fe,xe,I),a=1,y===!0&&(a|=24),y=da(3,null,null,a),t.current=y,y.stateNode=t,a=hp(),a.refCount++,t.pooledCache=a,a.refCount++,y.memoizedState={element:u,isDehydrated:i,cache:a},yp(y),t}function p1(t){return t?(t=Po,t):Po}function m1(t,a,i,u,h,y){h=p1(h),u.context===null?u.context=h:u.pendingContext=h,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&&(ta(i,t,a),si(i,t,a))}function g1(t,a){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<a?i:a}}function Im(t,a){g1(t,a),(t=t.alternate)&&g1(t,a)}function h1(t){if(t.tag===13||t.tag===31){var a=Ur(t,67108864);a!==null&&ta(a,t,67108864),Im(t,67108864)}}function x1(t){if(t.tag===13||t.tag===31){var a=ha();a=us(a);var i=Ur(t,a);i!==null&&ta(i,t,a),Im(t,a)}}var Vu=!0;function CN(t,a,i,u){var h=V.T;V.T=null;var y=$.p;try{$.p=2,Bm(t,a,i,u)}finally{$.p=y,V.T=h}}function kN(t,a,i,u){var h=V.T;V.T=null;var y=$.p;try{$.p=8,Bm(t,a,i,u)}finally{$.p=y,V.T=h}}function Bm(t,a,i,u){if(Vu){var h=Um(u);if(h===null)Cm(t,a,u,qu,i),v1(t,u);else if(NN(h,t,a,i,u))u.stopPropagation();else if(v1(t,u),a&4&&-1<EN.indexOf(t)){for(;h!==null;){var y=ko(h);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var A=an(y.pendingLanes);if(A!==0){var I=y;for(I.pendingLanes|=2,I.entangledLanes|=2;A;){var Q=1<<31-st(A);I.entanglements[1]|=Q,A&=~Q}Ka(y),(Et&6)===0&&(Cu=ye()+500,yi(0))}}break;case 31:case 13:I=Ur(y,2),I!==null&&ta(I,y,2),Eu(),Im(y,2)}if(y=Um(u),y===null&&Cm(t,a,u,qu,i),y===h)break;h=y}h!==null&&u.stopPropagation()}else Cm(t,a,u,null,i)}}function Um(t){return t=Vf(t),Hm(t)}var qu=null;function Hm(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 b1(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 _e:return 2;case Se:return 8;case Ue:case Je:return 32;case _t:return 268435456;default:return 32}default:return 32}}var Vm=!1,cr=null,ur=null,dr=null,Ei=new Map,Ni=new Map,fr=[],EN="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 v1(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":Ei.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ni.delete(a.pointerId)}}function Ri(t,a,i,u,h,y){return t===null||t.nativeEvent!==y?(t={blockedOn:a,domEventName:i,eventSystemFlags:u,nativeEvent:y,targetContainers:[h]},a!==null&&(a=ko(a),a!==null&&h1(a)),t):(t.eventSystemFlags|=u,a=t.targetContainers,h!==null&&a.indexOf(h)===-1&&a.push(h),t)}function NN(t,a,i,u,h){switch(a){case"focusin":return cr=Ri(cr,t,a,i,u,h),!0;case"dragenter":return ur=Ri(ur,t,a,i,u,h),!0;case"mouseover":return dr=Ri(dr,t,a,i,u,h),!0;case"pointerover":var y=h.pointerId;return Ei.set(y,Ri(Ei.get(y)||null,t,a,i,u,h)),!0;case"gotpointercapture":return y=h.pointerId,Ni.set(y,Ri(Ni.get(y)||null,t,a,i,u,h)),!0}return!1}function y1(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(){x1(i)});return}}else if(a===31){if(a=f(i),a!==null){t.blockedOn=a,Sn(t.priority,function(){x1(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=Um(t.nativeEvent);if(i===null){i=t.nativeEvent;var u=new i.constructor(i.type,i);Hf=u,i.target.dispatchEvent(u),Hf=null}else return a=ko(i),a!==null&&h1(a),t.blockedOn=i,!1;a.shift()}return!0}function _1(t,a,i){$u(t)&&i.delete(a)}function RN(){Vm=!1,cr!==null&&$u(cr)&&(cr=null),ur!==null&&$u(ur)&&(ur=null),dr!==null&&$u(dr)&&(dr=null),Ei.forEach(_1),Ni.forEach(_1)}function Gu(t,a){t.blockedOn===a&&(t.blockedOn=null,Vm||(Vm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,RN)))}var Fu=null;function j1(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],h=t[a+2];if(typeof u!="function"){if(Hm(u||i)===null)continue;break}var y=ko(i);y!==null&&(t.splice(a,3),a-=3,Up(y,{pending:!0,data:h,method:i.method,action:u},u,h))}}))}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),Ei.forEach(a),Ni.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);)y1(i),i.blockedOn===null&&fr.shift();if(i=(t.ownerDocument||t).$$reactFormReplay,i!=null)for(u=0;u<i.length;u+=3){var h=i[u],y=i[u+1],A=h[gn]||null;if(typeof y=="function")A||j1(i);else if(A){var I=null;if(y&&y.hasAttribute("formAction")){if(h=y,A=y[gn]||null)I=A.formAction;else if(Hm(h)!==null)continue}else I=A.action;typeof I=="function"?i[u+1]=I:(i.splice(u,3),u-=3),j1(i)}}}function w1(){function t(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(A){return h=A})},focusReset:"manual",scroll:"manual"})}function a(){h!==null&&(h(),h=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,h=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),h!==null&&(h(),h=null)}}}function qm(t){this._internalRoot=t}Yu.prototype.render=qm.prototype.render=function(t){var a=this._internalRoot;if(a===null)throw Error(o(409));var i=a.current,u=ha();m1(i,u,t,a,null,null)},Yu.prototype.unmount=qm.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var a=t.containerInfo;m1(t.current,2,null,t,null,null),Eu(),a[Dr]=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&&y1(t)}};var S1=n.version;if(S1!=="19.2.7")throw Error(o(527,S1,"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 TN={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(TN),Re=Xu}catch{}}return Ai.createRoot=function(t,a){if(!l(t))throw Error(o(299));var i=!1,u="",h=Ay,y=My,A=Oy;return a!=null&&(a.unstable_strictMode===!0&&(i=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(A=a.onRecoverableError)),a=f1(t,1,!1,null,null,i,u,null,h,y,A,w1),t[Dr]=a.current,Sm(t),new qm(a)},Ai.hydrateRoot=function(t,a,i){if(!l(t))throw Error(o(299));var u=!1,h="",y=Ay,A=My,I=Oy,Q=null;return i!=null&&(i.unstable_strictMode===!0&&(u=!0),i.identifierPrefix!==void 0&&(h=i.identifierPrefix),i.onUncaughtError!==void 0&&(y=i.onUncaughtError),i.onCaughtError!==void 0&&(A=i.onCaughtError),i.onRecoverableError!==void 0&&(I=i.onRecoverableError),i.formState!==void 0&&(Q=i.formState)),a=f1(t,1,!0,a,i??null,u,h,Q,y,A,I,w1),a.context=p1(null),i=a.current,u=ha(),u=us(u),h=Zs(u),h.callback=null,Ws(i,h,u),i=u,a.current.lanes=i,Kn(a,i),Ka(a),t[Dr]=a.current,Sm(t),new Yu(a)},Ai.version="19.2.7",Ai}var z1;function HN(){if(z1)return Fm.exports;z1=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(),Fm.exports=UN(),Fm.exports}var VN=HN();const qN=Zh(VN);/**
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 D1="popstate";function L1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function $N(e={}){function n(o,l){let c=l.state?.masked,{pathname:d,search:f,hash:p}=c||o.location;return ch("",{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:dc(l)}return FN(n,s,null,e)}function tn(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function $a(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function GN(){return Math.random().toString(36).substring(2,10)}function P1(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 ch(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||GN(),mask:l}}function dc({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 FN(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=L1(w)?w:ch(_.location,w,k);m=g()+1;let N=P1(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=L1(w)?w:ch(_.location,w,k);m=g();let N=P1(E,m),R=_.createHref(E.mask||E);d.replaceState(N,"",R),c&&p&&p({action:f,location:_.location,delta:0})}function C(w){return YN(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(D1,b),p=w,()=>{l.removeEventListener(D1,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 YN(e,n,s=!1){let o="http://localhost";e&&(o=e.location.origin!=="null"?e.location.origin:e.location.href),tn(o,"No window.location.(origin|href) available to create URL");let l=typeof n=="string"?n:dc(n);return l=l.replace(/ $/,"%20"),!s&&l.startsWith("//")&&(l=o+l),new URL(l,o)}function fw(e,n,s="/"){return XN(e,n,s,!1)}function XN(e,n,s,o,l){let c=typeof n=="string"?Al(n):n,d=Ps(c.pathname||"/",s);if(d==null)return null;let f=KN(e),p=null,m=lR(d);for(let g=0;p==null&&g<f.length;++g)p=rR(f[g],m,o);return p}function KN(e){let n=pw(e);return QN(n),n}function pw(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;tn(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=qa([o,g.relativePath]),v=s.concat(g);d.children&&d.children.length>0&&(tn(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),pw(d.children,n,v,b,p)),!(d.path==null&&!d.index)&&n.push({path:b,score:aR(b,d.index),routesMeta:v})};return e.forEach((d,f)=>{if(d.path===""||!d.path?.includes("?"))c(d,f);else for(let p of mw(d.path))c(d,f,!0,p)}),n}function mw(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=mw(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 QN(e){e.sort((n,s)=>n.score!==s.score?s.score-n.score:sR(n.routesMeta.map(o=>o.childrenIndex),s.routesMeta.map(o=>o.childrenIndex)))}var ZN=/^:[\w-]+$/,WN=3,JN=2,eR=1,tR=10,nR=-2,I1=e=>e==="*";function aR(e,n){let s=e.split("/"),o=s.length;return s.some(I1)&&(o+=nR),n&&(o+=JN),s.filter(l=>!I1(l)).reduce((l,c)=>l+(ZN.test(c)?WN:c===""?eR:tR),o)}function sR(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 rR(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=Nd({path:p.relativePath,caseSensitive:p.caseSensitive,end:m},g),v=p.route;if(!b&&m&&s&&!o[o.length-1].route.index&&(b=Nd({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},g)),!b)return null;Object.assign(l,b.params),d.push({params:l,pathname:qa([c,b.pathname]),pathnameBase:dR(qa([c,b.pathnameBase])),route:v}),b.pathnameBase!=="/"&&(c=qa([c,b.pathnameBase]))}return d}function Nd(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[s,o]=oR(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 oR(e,n=!1,s=!0){$a(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 lR(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return $a(!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 Ps(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 iR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function cR(e,n="/"){let{pathname:s,search:o="",hash:l=""}=typeof e=="string"?Al(e):e,c;return s?(s=hw(s),s.startsWith("/")?c=B1(s.substring(1),"/"):c=B1(s,n)):c=n,{pathname:c,search:fR(o),hash:pR(l)}}function B1(e,n){let s=Rd(n).split("/");return e.split("/").forEach(l=>{l===".."?s.length>1&&s.pop():l!=="."&&s.push(l)}),s.length>1?s.join("/"):"/"}function Qm(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 uR(e){return e.filter((n,s)=>s===0||n.route.path&&n.route.path.length>0)}function gw(e){let n=uR(e);return n.map((s,o)=>o===n.length-1?s.pathname:s.pathnameBase)}function Wh(e,n,s,o=!1){let l;typeof e=="string"?l=Al(e):(l={...e},tn(!l.pathname||!l.pathname.includes("?"),Qm("?","pathname","search",l)),tn(!l.pathname||!l.pathname.includes("#"),Qm("#","pathname","hash",l)),tn(!l.search||!l.search.includes("#"),Qm("#","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=cR(l,f),m=d&&d!=="/"&&d.endsWith("/"),g=(c||d===".")&&s.endsWith("/");return!p.pathname.endsWith("/")&&(m||g)&&(p.pathname+="/"),p}var hw=e=>e.replace(/\/\/+/g,"/"),qa=e=>hw(e.join("/")),Rd=e=>e.replace(/\/+$/,""),dR=e=>Rd(e).replace(/^\/*/,"/"),fR=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,pR=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,mR=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 gR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function hR(e){let n=e.map(s=>s.route.path).filter(Boolean);return qa(n)||"/"}var xw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function bw(e,n){let s=e;if(typeof s!="string"||!iR.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let o=s,l=!1;if(xw)try{let c=new URL(window.location.href),d=s.startsWith("//")?new URL(c.protocol+s):new URL(s),f=Ps(d.pathname,n);d.origin===c.origin&&f!=null?s=f+d.search+d.hash:l=!0}catch{$a(!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 vw=["POST","PUT","PATCH","DELETE"];new Set(vw);var xR=["GET",...vw];new Set(xR);var Ml=x.createContext(null);Ml.displayName="DataRouter";var nf=x.createContext(null);nf.displayName="DataRouterState";var yw=x.createContext(!1);function bR(){return x.useContext(yw)}var _w=x.createContext({isTransitioning:!1});_w.displayName="ViewTransition";var vR=x.createContext(new Map);vR.displayName="Fetchers";var yR=x.createContext(null);yR.displayName="Await";var Da=x.createContext(null);Da.displayName="Navigation";var kc=x.createContext(null);kc.displayName="Location";var rs=x.createContext({outlet:null,matches:[],isDataRoute:!1});rs.displayName="Route";var Jh=x.createContext(null);Jh.displayName="RouteError";var jw="REACT_ROUTER_ERROR",_R="REDIRECT",jR="ROUTE_ERROR_RESPONSE";function wR(e){if(e.startsWith(`${jw}:${_R}:{`))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 SR(e){if(e.startsWith(`${jw}:${jR}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new mR(n.status,n.statusText,n.data)}catch{}}function CR(e,{relative:n}={}){tn(Ec(),"useHref() may be used only in the context of a <Router> component.");let{basename:s,navigator:o}=x.useContext(Da),{hash:l,pathname:c,search:d}=Nc(e,{relative:n}),f=c;return s!=="/"&&(f=c==="/"?s:qa([s,c])),o.createHref({pathname:f,search:d,hash:l})}function Ec(){return x.useContext(kc)!=null}function oa(){return tn(Ec(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(kc).location}var ww="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Sw(e){x.useContext(Da).static||x.useLayoutEffect(e)}function La(){let{isDataRoute:e}=x.useContext(rs);return e?IR():kR()}function kR(){tn(Ec(),"useNavigate() may be used only in the context of a <Router> component.");let e=x.useContext(Ml),{basename:n,navigator:s}=x.useContext(Da),{matches:o}=x.useContext(rs),{pathname:l}=oa(),c=JSON.stringify(gw(o)),d=x.useRef(!1);return Sw(()=>{d.current=!0}),x.useCallback((p,m={})=>{if($a(d.current,ww),!d.current)return;if(typeof p=="number"){s.go(p);return}let g=Wh(p,JSON.parse(c),l,m.relative==="path");e==null&&n!=="/"&&(g.pathname=g.pathname==="/"?n:qa([n,g.pathname])),(m.replace?s.replace:s.push)(g,m.state,m)},[n,s,c,l,e])}x.createContext(null);function Cw(){let{matches:e}=x.useContext(rs);return e[e.length-1]?.params??{}}function Nc(e,{relative:n}={}){let{matches:s}=x.useContext(rs),{pathname:o}=oa(),l=JSON.stringify(gw(s));return x.useMemo(()=>Wh(e,JSON.parse(l),o,n==="path"),[e,l,o,n])}function ER(e,n){return kw(e,n)}function kw(e,n,s){tn(Ec(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=x.useContext(Da),{matches:l}=x.useContext(rs),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||"";Nw(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=oa(),b;if(n){let w=typeof n=="string"?Al(n):n;tn(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})):fw(e,{pathname:S});$a(m||C!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),$a(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 _=MR(C&&C.map(w=>Object.assign({},w,{params:Object.assign({},d,w.params),pathname:qa([p,o.encodeLocation?o.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?p:qa([p,o.encodeLocation?o.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),l,s);return n&&_?x.createElement(kc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...b},navigationType:"POP"}},_):_}function NR(){let e=PR(),n=gR(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=x.createElement(x.Fragment,null,x.createElement("p",null,"💿 Hey developer 👋"),x.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",x.createElement("code",{style:c},"ErrorBoundary")," or"," ",x.createElement("code",{style:c},"errorElement")," prop on your route.")),x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},n),s?x.createElement("pre",{style:l},s):null,d)}var RR=x.createElement(NR,null),Ew=class extends x.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=SR(e.digest);s&&(e=s)}let n=e!==void 0?x.createElement(rs.Provider,{value:this.props.routeContext},x.createElement(Jh.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?x.createElement(TR,{error:e},n):n}};Ew.contextType=yw;var Zm=new WeakMap;function TR({children:e,error:n}){let{basename:s}=x.useContext(Da);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let o=wR(n.digest);if(o){let l=Zm.get(n);if(l)throw l;let c=bw(o.location,s);if(xw&&!Zm.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 Zm.set(n,d),d}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c.absoluteURL||c.to}`})}}return e}function AR({routeContext:e,match:n,children:s}){let o=x.useContext(Ml);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),x.createElement(rs.Provider,{value:e},s)}function MR(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);tn(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:hR(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||RR,d&&(f<0&&v===0?(Nw("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=x.createElement(b.route.Component,null):b.route.element?N=b.route.element:N=g,x.createElement(AR,{match:b,routeContext:{outlet:g,matches:k,isDataRoute:o!=null},children:N})};return o&&(b.route.ErrorBoundary||b.route.errorElement||v===0)?x.createElement(Ew,{location:o.location,revalidation:o.revalidation,component:_,error:S,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:m}):E()},null)}function ex(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function OR(e){let n=x.useContext(Ml);return tn(n,ex(e)),n}function zR(e){let n=x.useContext(nf);return tn(n,ex(e)),n}function DR(e){let n=x.useContext(rs);return tn(n,ex(e)),n}function tx(e){let n=DR(e),s=n.matches[n.matches.length-1];return tn(s.route.id,`${e} can only be used on routes that contain a unique "id"`),s.route.id}function LR(){return tx("useRouteId")}function PR(){let e=x.useContext(Jh),n=zR("useRouteError"),s=tx("useRouteError");return e!==void 0?e:n.errors?.[s]}function IR(){let{router:e}=OR("useNavigate"),n=tx("useNavigate"),s=x.useRef(!1);return Sw(()=>{s.current=!0}),x.useCallback(async(l,c={})=>{$a(s.current,ww),s.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:n,...c}))},[e,n])}var U1={};function Nw(e,n,s){!n&&!U1[e]&&(U1[e]=!0,$a(!1,s))}x.memo(BR);function BR({routes:e,manifest:n,future:s,state:o,isStatic:l,onError:c}){return kw(e,void 0,{manifest:n,state:o,isStatic:l,onError:c})}function $t(e){tn(!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 UR({basename:e="/",children:n=null,location:s,navigationType:o="POP",navigator:l,static:c=!1,useTransitions:d}){tn(!Ec(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),p=x.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,_=x.useMemo(()=>{let w=Ps(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 $a(_!=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:x.createElement(Da.Provider,{value:p},x.createElement(kc.Provider,{children:n,value:_}))}function Rw({children:e,location:n}){return ER(uh(e),n)}function uh(e,n=[]){let s=[];return x.Children.forEach(e,(o,l)=>{if(!x.isValidElement(o))return;let c=[...n,l];if(o.type===x.Fragment){s.push.apply(s,uh(o.props.children,c));return}tn(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>`),tn(!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=uh(o.props.children,c)),s.push(d)}),s}var bd="get",vd="application/x-www-form-urlencoded";function af(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function HR(e){return af(e)&&e.tagName.toLowerCase()==="button"}function VR(e){return af(e)&&e.tagName.toLowerCase()==="form"}function qR(e){return af(e)&&e.tagName.toLowerCase()==="input"}function $R(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function GR(e,n){return e.button===0&&(!n||n==="_self")&&!$R(e)}function dh(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 FR(e,n){let s=dh(e);return n&&n.forEach((o,l)=>{s.has(l)||n.getAll(l).forEach(c=>{s.append(l,c)})}),s}var Ku=null;function YR(){if(Ku===null)try{new FormData(document.createElement("form"),0),Ku=!1}catch{Ku=!0}return Ku}var XR=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Wm(e){return e!=null&&!XR.has(e)?($a(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${vd}"`),null):e}function KR(e,n){let s,o,l,c,d;if(VR(e)){let f=e.getAttribute("action");o=f?Ps(f,n):null,s=e.getAttribute("method")||bd,l=Wm(e.getAttribute("enctype"))||vd,c=new FormData(e)}else if(HR(e)||qR(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?Ps(p,n):null,s=e.getAttribute("formmethod")||f.getAttribute("method")||bd,l=Wm(e.getAttribute("formenctype"))||Wm(f.getAttribute("enctype"))||vd,c=new FormData(f,e),!YR()){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(af(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=bd,o=null,l=vd,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 nx(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Tw(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&&Ps(l.pathname,n)==="/"?l.pathname=`${Rd(n)}/_root.${o}`:l.pathname=`${Rd(l.pathname)}.${o}`,l}async function QR(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 ZR(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 WR(e,n,s){let o=await Promise.all(e.map(async l=>{let c=n.routes[l.route.id];if(c){let d=await QR(c,s);return d.links?d.links():[]}return[]}));return nT(o.flat(1).filter(ZR).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function H1(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 JR(e,n,{includeHydrateFallback:s}={}){return eT(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 eT(e){return[...new Set(e)]}function tT(e){let n={},s=Object.keys(e).sort();for(let o of s)n[o]=e[o];return n}function nT(e,n){let s=new Set;return new Set(n),e.reduce((o,l)=>{let c=JSON.stringify(tT(l));return s.has(c)||(s.add(c),o.push({key:c,link:l})),o},[])}function ax(){let e=x.useContext(Ml);return nx(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function aT(){let e=x.useContext(nf);return nx(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var sx=x.createContext(void 0);sx.displayName="FrameworkContext";function rx(){let e=x.useContext(sx);return nx(e,"You must render this element inside a <HydratedRouter> element"),e}function sT(e,n){let s=x.useContext(sx),[o,l]=x.useState(!1),[c,d]=x.useState(!1),{onFocus:f,onBlur:p,onMouseEnter:m,onMouseLeave:g,onTouchStart:b}=n,v=x.useRef(null);x.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]),x.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:Mi(f,S),onBlur:Mi(p,C),onMouseEnter:Mi(m,S),onMouseLeave:Mi(g,C),onTouchStart:Mi(b,S)}]:[!1,v,{}]}function Mi(e,n){return s=>{e&&e(s),s.defaultPrevented||n(s)}}function rT({page:e,...n}){let s=bR(),{router:o}=ax(),l=x.useMemo(()=>fw(o.routes,e,o.basename),[o.routes,e,o.basename]);return l?s?x.createElement(lT,{page:e,matches:l,...n}):x.createElement(iT,{page:e,matches:l,...n}):null}function oT(e){let{manifest:n,routeModules:s}=rx(),[o,l]=x.useState([]);return x.useEffect(()=>{let c=!1;return WR(e,n,s).then(d=>{c||l(d)}),()=>{c=!0}},[e,n,s]),o}function lT({page:e,matches:n,...s}){let o=oa(),{future:l}=rx(),{basename:c}=ax(),d=x.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let f=Tw(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 x.createElement(x.Fragment,null,d.map(f=>x.createElement("link",{key:f,rel:"prefetch",as:"fetch",href:f,...s})))}function iT({page:e,matches:n,...s}){let o=oa(),{future:l,manifest:c,routeModules:d}=rx(),{basename:f}=ax(),{loaderData:p,matches:m}=aT(),g=x.useMemo(()=>H1(e,n,m,c,o,"data"),[e,n,m,c,o]),b=x.useMemo(()=>H1(e,n,m,c,o,"assets"),[e,n,m,c,o]),v=x.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=Tw(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=x.useMemo(()=>JR(b,c),[b,c]),C=oT(b);return x.createElement(x.Fragment,null,v.map(_=>x.createElement("link",{key:_,rel:"prefetch",as:"fetch",href:_,...s})),S.map(_=>x.createElement("link",{key:_,rel:"modulepreload",href:_,...s})),C.map(({key:_,link:w})=>x.createElement("link",{key:_,nonce:s.nonce,...w,crossOrigin:w.crossOrigin??s.crossOrigin})))}function cT(...e){return n=>{e.forEach(s=>{typeof s=="function"?s(n):s!=null&&(s.current=n)})}}var uT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{uT&&(window.__reactRouterVersion="7.17.0")}catch{}function dT({basename:e,children:n,useTransitions:s,window:o}){let l=x.useRef();l.current==null&&(l.current=$N({window:o,v5Compat:!0}));let c=l.current,[d,f]=x.useState({action:c.action,location:c.location}),p=x.useCallback(m=>{s===!1?f(m):x.startTransition(()=>f(m))},[s]);return x.useLayoutEffect(()=>c.listen(p),[c,p]),x.createElement(UR,{basename:e,children:n,location:d.location,navigationType:d.action,navigator:c,useTransitions:s})}var Aw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ox=x.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}=x.useContext(Da),N=typeof g=="string"&&Aw.test(g),R=bw(g,w);g=R.to;let T=CR(g,{relative:l}),M=oa(),O=null;if(f){let Y=Wh(f,[],M.mask?M.mask.pathname:"/",!0);w!=="/"&&(Y.pathname=Y.pathname==="/"?w:qa([w,Y.pathname])),O=k.createHref(Y)}let[P,B,L]=sT(o,C),D=mT(g,{replace:d,mask:f,state:p,target:m,preventScrollReset:b,relative:l,viewTransition:v,defaultShouldRevalidate:S,useTransitions:E});function z(Y){n&&n(Y),Y.defaultPrevented||D(Y)}let H=!(R.isExternal||c),q=x.createElement("a",{...C,...L,href:(H?O:void 0)||R.absoluteURL||T,onClick:H?z:n,ref:cT(_,B),target:m,"data-discover":!N&&s==="render"?"true":void 0});return P&&!N?x.createElement(x.Fragment,null,q,x.createElement(rT,{page:T})):q});ox.displayName="Link";var Mw=x.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=Nc(d,{relative:m.relative}),v=oa(),S=x.useContext(nf),{navigator:C,basename:_}=x.useContext(Da),w=S!=null&&vT(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=Ps(N,_)||N);const R=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let T=E===k||!l&&E.startsWith(k)&&E.charAt(R)==="/",M=N!=null&&(N===k||!l&&N.startsWith(k)&&N.charAt(k.length)==="/"),O={isActive:T,isPending:M,isTransitioning:w},P=T?n:void 0,B;typeof o=="function"?B=o(O):B=[o,T?"active":null,M?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let L=typeof c=="function"?c(O):c;return x.createElement(ox,{...m,"aria-current":P,className:B,ref:g,style:L,to:d,viewTransition:f},typeof p=="function"?p(O):p)});Mw.displayName="NavLink";var fT=x.forwardRef(({discover:e="render",fetcherKey:n,navigate:s,reloadDocument:o,replace:l,state:c,method:d=bd,action:f,onSubmit:p,relative:m,preventScrollReset:g,viewTransition:b,defaultShouldRevalidate:v,...S},C)=>{let{useTransitions:_}=x.useContext(Da),w=xT(),k=bT(f,{relative:m}),E=d.toLowerCase()==="get"?"get":"post",N=typeof f=="string"&&Aw.test(f),R=T=>{if(p&&p(T),T.defaultPrevented)return;T.preventDefault();let M=T.nativeEvent.submitter,O=M?.getAttribute("formmethod")||d,P=()=>w(M||T.currentTarget,{fetcherKey:n,method:O,navigate:s,replace:l,state:c,relative:m,preventScrollReset:g,viewTransition:b,defaultShouldRevalidate:v});_&&s!==!1?x.startTransition(()=>P()):P()};return x.createElement("form",{ref:C,method:E,action:k,onSubmit:o?p:R,...S,"data-discover":!N&&e==="render"?"true":void 0})});fT.displayName="Form";function pT(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ow(e){let n=x.useContext(Ml);return tn(n,pT(e)),n}function mT(e,{target:n,replace:s,mask:o,state:l,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:p,useTransitions:m}={}){let g=La(),b=oa(),v=Nc(e,{relative:d});return x.useCallback(S=>{if(GR(S,n)){S.preventDefault();let C=s!==void 0?s:dc(b)===dc(v),_=()=>g(e,{replace:C,mask:o,state:l,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:p});m?x.startTransition(()=>_()):_()}},[b,g,v,s,o,l,n,e,c,d,f,p,m])}function zw(e){$a(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=x.useRef(dh(e)),s=x.useRef(!1),o=oa(),l=x.useMemo(()=>FR(o.search,s.current?null:n.current),[o.search]),c=La(),d=x.useCallback((f,p)=>{const m=dh(typeof f=="function"?f(new URLSearchParams(l)):f);s.current=!0,c("?"+m,p)},[c,l]);return[l,d]}var gT=0,hT=()=>`__${String(++gT)}__`;function xT(){let{router:e}=Ow("useSubmit"),{basename:n}=x.useContext(Da),s=LR(),o=e.fetch,l=e.navigate;return x.useCallback(async(c,d={})=>{let{action:f,method:p,encType:m,formData:g,body:b}=KR(c,n);if(d.navigate===!1){let v=d.fetcherKey||hT();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 bT(e,{relative:n}={}){let{basename:s}=x.useContext(Da),o=x.useContext(rs);tn(o,"useFormAction must be used inside a RouteContext");let[l]=o.matches.slice(-1),c={...Nc(e||".",{relative:n})},d=oa();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:qa([s,c.pathname])),dc(c)}function vT(e,{relative:n}={}){let s=x.useContext(_w);tn(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=Ow("useViewTransitionState"),l=Nc(e,{relative:n});if(!s.isTransitioning)return!1;let c=Ps(s.currentLocation.pathname,o)||s.currentLocation.pathname,d=Ps(s.nextLocation.pathname,o)||s.nextLocation.pathname;return Nd(l.pathname,d)!=null||Nd(l.pathname,c)!=null}var Rr=dw();/**
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 yT=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Dw=(...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 _T={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 jT=x.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:l="",children:c,iconNode:d,...f},p)=>x.createElement("svg",{ref:p,..._T,width:n,height:n,stroke:e,strokeWidth:o?Number(s)*24/Number(n):s,className:Dw("lucide",l),...f},[...d.map(([m,g])=>x.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 je=(e,n)=>{const s=x.forwardRef(({className:o,...l},c)=>x.createElement(jT,{ref:c,iconNode:n,className:Dw(`lucide-${yT(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 Lw=je("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 Pw=je("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 wT=je("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 Iw=je("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 Bw=je("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 ST=je("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 yn=je("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 CT=je("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 kT=je("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 Td=je("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 fc=je("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 bo=je("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 sf=je("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 Uw=je("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 ET=je("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 lx=je("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 NT=je("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 RT=je("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 TT=je("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 AT=je("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
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 Ad=je("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"}]]);/**
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 MT=je("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
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 OT=je("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/**
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 ix=je("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"}]]);/**
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 Is=je("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"}]]);/**
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 Hw=je("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"}]]);/**
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 zT=je("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"}]]);/**
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 DT=je("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"}]]);/**
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 rf=je("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"}]]);/**
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 LT=je("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"}]]);/**
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 Md=je("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"}]]);/**
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 PT=je("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"}]]);/**
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 IT=je("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"}]]);/**
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 BT=je("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
251
- * @license lucide-react v0.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 UT=je("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"}]]);/**
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 HT=je("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"}]]);/**
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 Vw=je("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);/**
266
- * @license lucide-react v0.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 VT=je("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"}]]);/**
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 qw=je("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"}]]);/**
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 $w=je("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"}]]);/**
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 Gw=je("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"}]]);/**
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 qT=je("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"}]]);/**
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 of=je("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
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 $T=je("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"}]]);/**
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 cx=je("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"}]]);/**
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 GT=je("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"}]]);/**
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 FT=je("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"}]]);/**
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 yl=je("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"}]]);/**
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 YT=je("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"}]]);/**
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 XT=je("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"}]]);/**
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 KT=je("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
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 fh=je("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"}]]);/**
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 QT=je("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"}]]);/**
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 ZT=je("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"}]]);/**
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 WT=je("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"}]]);/**
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 JT=je("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"}]]);/**
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 lf=je("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
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 Fw=je("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"}]]);/**
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 Yw=je("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"}]]);/**
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 ac=je("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"}]]);/**
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 eA=je("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"}]]);/**
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 tA=je("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"}]]);/**
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 nA=je("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
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 aA=je("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"}]]);/**
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 sA=je("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"}]]);/**
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 Xw=je("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
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 rA=je("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
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 Ol=je("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"}]]);/**
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 ux=je("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
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 oA=je("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"}]]);/**
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 un=je("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
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 ph=je("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"}]]);/**
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 lA=je("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"}]]);/**
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 ss=je("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"}]]);/**
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 dx=je("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"}]]);/**
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 cf=je("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"}]]);/**
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 Od=je("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"}]]);/**
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 yd=je("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
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 os=je("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"}]]);/**
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 Kw=je("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"}]]);/**
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 iA=je("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"}]]);/**
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 zd=je("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"}]]);/**
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 cA=je("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
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 $s=je("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"}]]);/**
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 uA=je("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"}]]);/**
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 Qw=je("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
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 dA=je("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"}]]);/**
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 kr=je("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
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 la=je("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"}]]);/**
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 Zw=je("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"}]]);/**
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 fA=je("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"}]]);/**
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 Ww=je("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"}]]);/**
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 pA=je("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"}]]);/**
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 mA=je("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"}]]);/**
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 zl=je("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"}]]);/**
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 vo=je("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
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 pc=je("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"}]]),uf={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"},fx=["total","automatico","permiso"],V1=["sky","violet","emerald","amber","rose","indigo","teal","fuchsia"],gA={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 hA(){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 Jw=x.createContext(null);function xA({children:e}){const[n,s]=x.useState(hA);x.useEffect(()=>{document.documentElement.classList.toggle("dark",n==="dark");try{localStorage.setItem(Rn.theme,n)}catch{}},[n]);const o=x.useCallback(()=>{s(c=>c==="dark"?"light":"dark")},[]),l=x.useMemo(()=>({theme:n,toggle:o,set:s}),[n,o]);return r.jsx(Jw.Provider,{value:l,children:e})}function px(){const e=x.useContext(Jw);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const bA=1367/458,vA=735/1016;function yA({size:e=32,title:n="APX",variant:s="icon"}){const{theme:o}=px(),l=gA[s][o];if(s==="full"){const c=e,d=Math.round(e*bA);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/vA);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 eS(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=eS(e[n]))&&(o&&(o+=" "),o+=s)}else for(s in e)e[s]&&(o&&(o+=" "),o+=s);return o}function mx(){for(var e,n,s=0,o="",l=arguments.length;s<l;s++)(e=arguments[s])&&(n=eS(e))&&(o&&(o+=" "),o+=n);return o}const gx="-",_A=e=>{const n=wA(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:d=>{const f=d.split(gx);return f[0]===""&&f.length!==1&&f.shift(),tS(f,n)||jA(d)},getConflictingClassGroupIds:(d,f)=>{const p=s[d]||[];return f&&o[d]?[...p,...o[d]]:p}}},tS=(e,n)=>{if(e.length===0)return n.classGroupId;const s=e[0],o=n.nextPart.get(s),l=o?tS(e.slice(1),o):void 0;if(l)return l;if(n.validators.length===0)return;const c=e.join(gx);return n.validators.find(({validator:d})=>d(c))?.classGroupId},q1=/^\[(.+)\]$/,jA=e=>{if(q1.test(e)){const n=q1.exec(e)[1],s=n?.substring(0,n.indexOf(":"));if(s)return"arbitrary.."+s}},wA=e=>{const{theme:n,prefix:s}=e,o={nextPart:new Map,validators:[]};return CA(Object.entries(e.classGroups),s).forEach(([c,d])=>{mh(d,o,c,n)}),o},mh=(e,n,s,o)=>{e.forEach(l=>{if(typeof l=="string"){const c=l===""?n:$1(n,l);c.classGroupId=s;return}if(typeof l=="function"){if(SA(l)){mh(l(o),n,s,o);return}n.validators.push({validator:l,classGroupId:s});return}Object.entries(l).forEach(([c,d])=>{mh(d,$1(n,c),s,o)})})},$1=(e,n)=>{let s=e;return n.split(gx).forEach(o=>{s.nextPart.has(o)||s.nextPart.set(o,{nextPart:new Map,validators:[]}),s=s.nextPart.get(o)}),s},SA=e=>e.isThemeGetter,CA=(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,kA=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)}}},nS="!",EA=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(nS),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},NA=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},RA=e=>({cache:kA(e.cacheSize),parseClassName:EA(e),..._A(e)}),TA=/\s+/,AA=(e,n)=>{const{parseClassName:s,getClassGroupId:o,getConflictingClassGroupIds:l}=n,c=[],d=e.trim().split(TA);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=NA(g).join(":"),k=b?w+nS: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 MA(){let e=0,n,s,o="";for(;e<arguments.length;)(n=arguments[e++])&&(s=aS(n))&&(o&&(o+=" "),o+=s);return o}const aS=e=>{if(typeof e=="string")return e;let n,s="";for(let o=0;o<e.length;o++)e[o]&&(n=aS(e[o]))&&(s&&(s+=" "),s+=n);return s};function OA(e,...n){let s,o,l,c=d;function d(p){const m=n.reduce((g,b)=>b(g),e());return s=RA(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=AA(p,s);return l(p,g),g}return function(){return c(MA.apply(null,arguments))}}const Kt=e=>{const n=s=>s[e]||[];return n.isThemeGetter=!0,n},sS=/^\[(?:([a-z-]+):)?(.+)\]$/i,zA=/^\d+\/\d+$/,DA=new Set(["px","full","screen"]),LA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,PA=/\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$/,IA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,BA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,UA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Rs=e=>ml(e)||DA.has(e)||zA.test(e),mr=e=>Dl(e,"length",XA),ml=e=>!!e&&!Number.isNaN(Number(e)),Jm=e=>Dl(e,"number",ml),Oi=e=>!!e&&Number.isInteger(Number(e)),HA=e=>e.endsWith("%")&&ml(e.slice(0,-1)),dt=e=>sS.test(e),gr=e=>LA.test(e),VA=new Set(["length","size","percentage"]),qA=e=>Dl(e,VA,rS),$A=e=>Dl(e,"position",rS),GA=new Set(["image","url"]),FA=e=>Dl(e,GA,QA),YA=e=>Dl(e,"",KA),zi=()=>!0,Dl=(e,n,s)=>{const o=sS.exec(e);return o?o[1]?typeof n=="string"?o[1]===n:n.has(o[1]):s(o[2]):!1},XA=e=>PA.test(e)&&!IA.test(e),rS=()=>!1,KA=e=>BA.test(e),QA=e=>UA.test(e),ZA=()=>{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"),M=Kt("skew"),O=Kt("space"),P=Kt("translate"),B=()=>["auto","contain","none"],L=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",dt,n],z=()=>[dt,n],H=()=>["",Rs,mr],q=()=>["auto",ml,dt],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",dt],X=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[ml,dt];return{cacheSize:500,separator:":",theme:{colors:[zi],spacing:[Rs,mr],blur:["none","",gr,dt],brightness:U(),borderColor:[e],borderRadius:["none","","full",gr,dt],borderSpacing:z(),borderWidth:H(),contrast:U(),grayscale:G(),hueRotate:U(),invert:G(),gap:z(),gradientColorStops:[e],gradientColorStopPositions:[HA,mr],inset:D(),margin:D(),opacity:U(),padding:z(),saturate:U(),scale:U(),sepia:G(),skew:U(),space:z(),translate:z()},classGroups:{aspect:[{aspect:["auto","square","video",dt]}],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(),dt]}],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",Oi,dt]}],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",dt]}],grow:[{grow:G()}],shrink:[{shrink:G()}],order:[{order:["first","last","none",Oi,dt]}],"grid-cols":[{"grid-cols":[zi]}],"col-start-end":[{col:["auto",{span:["full",Oi,dt]},dt]}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":[zi]}],"row-start-end":[{row:["auto",{span:[Oi,dt]},dt]}],"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",dt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",dt]}],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":[O]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[O]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",dt,n]}],"min-w":[{"min-w":[dt,n,"min","max","fit"]}],"max-w":[{"max-w":[dt,n,"none","full","min","max","fit","prose",{screen:[gr]},gr]}],h:[{h:[dt,n,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[dt,n,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[dt,n,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[dt,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",Jm]}],"font-family":[{font:[zi]}],"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",dt]}],"line-clamp":[{"line-clamp":["none",ml,Jm]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Rs,dt]}],"list-image":[{"list-image":["none",dt]}],"list-style-type":[{list:["none","disc","decimal",dt]}],"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",Rs,mr]}],"underline-offset":[{"underline-offset":["auto",Rs,dt]}],"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:z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",dt]}],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",dt]}],"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(),$A]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",qA]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},FA]}],"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":[Rs,dt]}],"outline-w":[{outline:[Rs,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":[Rs,mr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",gr,YA]}],"shadow-color":[{shadow:[zi]}],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,dt]}],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",dt]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",dt]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",dt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[Oi,dt]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[M]}],"skew-y":[{"skew-y":[M]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",dt]}],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",dt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"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",dt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Rs,mr,Jm]}],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"]}}},oS=OA(ZA);function Me(...e){return oS(mx(e))}const G1={};function va(e,n){const s=x.useRef(G1);return s.current===G1&&(s.current=e(n)),s}const gh=[];let hh;function WA(){return hh}function JA(e){gh.push(e)}function lS(e){const n=(s,o)=>{const l=va(tM).current;let c;try{hh=l;for(const d of gh)d.before(l);c=e(s,o);for(const d of gh)d.after(l);l.didInitialize=!0}finally{hh=void 0}return c};return n.displayName=e.displayName||e.name,n}function eM(e){return x.forwardRef(lS(e))}function tM(){return{didInitialize:!1}}function hx(e){const n=x.useRef(!0);n.current&&(n.current=!1,e())}const nM=()=>{},Oe=typeof document<"u"?x.useLayoutEffect:nM;function aM(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 On=aM("https://base-ui.com/production-error","Base UI"),iS=x.createContext(void 0);function Rc(e){const n=x.useContext(iS);if(n===void 0&&!e)throw new Error(On(72));return n}const sM=[];function xx(e){x.useEffect(e,sM)}const Di=0;class Ga{static create(){return new Ga}currentId=Di;start(n,s){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Di,s()},n)}isStarted(){return this.currentId!==Di}clear=()=>{this.currentId!==Di&&(clearTimeout(this.currentId),this.currentId=Di)};disposeEffect=()=>this.clear}function aa(){const e=va(Ga.create).current;return xx(e.disposeEffect),e}const Ll=typeof navigator<"u",eg=oM(),cS=iM(),uS=lM(),bx=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),dS=eg.platform==="MacIntel"&&eg.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(eg.platform),fS=Ll&&/apple/i.test(navigator.vendor),xh=Ll&&/android/i.test(cS)||/android/i.test(uS),rM=Ll&&cS.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,pS=uS.includes("jsdom/");function oM(){if(!Ll)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 lM(){if(!Ll)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:n,version:s})=>`${n}/${s}`).join(" "):navigator.userAgent}function iM(){if(!Ll)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}function xa(e){e.preventDefault(),e.stopPropagation()}function cM(e){return"nativeEvent"in e}function vx(e){return e.pointerType===""&&e.isTrusted?!0:xh&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function mS(e){return pS?!1:!xh&&e.width===0&&e.height===0||xh&&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 co(e,n){const s=["mouse","pen"];return n||s.push("",void 0),s.includes(e)}function uM(e){const n=e.type;return n==="click"||n==="mousedown"||n==="keydown"||n==="keyup"}function df(){return typeof window<"u"}function Vn(e){return yx(e)?(e.nodeName||"").toLowerCase():"#document"}function Qt(e){var n;return(e==null||(n=e.ownerDocument)==null?void 0:n.defaultView)||window}function ls(e){var n;return(n=(yx(e)?e.ownerDocument:e.document)||window.document)==null?void 0:n.documentElement}function yx(e){return df()?e instanceof Node||e instanceof Qt(e).Node:!1}function ft(e){return df()?e instanceof Element||e instanceof Qt(e).Element:!1}function Gt(e){return df()?e instanceof HTMLElement||e instanceof Qt(e).HTMLElement:!1}function _l(e){return!df()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qt(e).ShadowRoot}function Tr(e){const{overflow:n,overflowX:s,overflowY:o,display:l}=ra(e);return/auto|scroll|overlay|hidden|clip/.test(n+o+s)&&l!=="inline"&&l!=="contents"}function dM(e){return/^(table|td|th)$/.test(Vn(e))}function ff(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const fM=/transform|translate|scale|rotate|perspective|filter/,pM=/paint|layout|strict|content/,Jr=e=>!!e&&e!=="none";let tg;function _x(e){const n=ft(e)?ra(e):e;return Jr(n.transform)||Jr(n.translate)||Jr(n.scale)||Jr(n.rotate)||Jr(n.perspective)||!pf()&&(Jr(n.backdropFilter)||Jr(n.filter))||fM.test(n.willChange||"")||pM.test(n.contain||"")}function mM(e){let n=Bs(e);for(;Gt(n)&&!Ds(n);){if(_x(n))return n;if(ff(n))return null;n=Bs(n)}return null}function pf(){return tg==null&&(tg=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),tg}function Ds(e){return/^(html|body|#document)$/.test(Vn(e))}function ra(e){return Qt(e).getComputedStyle(e)}function mf(e){return ft(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Bs(e){if(Vn(e)==="html")return e;const n=e.assignedSlot||e.parentNode||_l(e)&&e.host||ls(e);return _l(n)?n.host:n}function gS(e){const n=Bs(e);return Ds(n)?e.ownerDocument?e.ownerDocument.body:e.body:Gt(n)&&Tr(n)?n:gS(n)}function mc(e,n,s){var o;n===void 0&&(n=[]),s===void 0&&(s=!0);const l=gS(e),c=l===((o=e.ownerDocument)==null?void 0:o.body),d=Qt(l);if(c){const f=bh(d);return n.concat(d,d.visualViewport||[],Tr(l)?l:[],f&&s?mc(f):[])}else return n.concat(l,mc(l,[],s))}function bh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const vh="data-base-ui-focusable",hS="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",jr="ArrowLeft",wr="ArrowRight",jx="ArrowUp",Tc="ArrowDown";function In(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 Dd(e,n){if(!ft(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 ng(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 gM(e){return e.matches("html,body")}function gf(e){return Gt(e)&&e.matches(hS)}function hM(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${hS}`)!=null}function yh(e){return e?e.getAttribute("role")==="combobox"&&gf(e):!1}function xM(e){if(!e||pS)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Ld(e){return e?e.hasAttribute(vh)?e:e.querySelector(`[${vh}]`)||e:null}function bM(e,n){return n!=null&&!co(n)?0:typeof e=="function"?e():e}function Pd(e,n,s){const o=bM(e,s);return typeof o=="number"?o:o?.[n]}function F1(e){return typeof e=="function"?e():e}function xS(e,n){return n||e==="click"||e==="mousedown"}function vM(e){return e?.includes("mouse")&&e!=="mousedown"}function Un(){}const gc=Object.freeze([]),cn=Object.freeze({}),Us="none",hc="trigger-press",$n="trigger-hover",_d="trigger-focus",wx="outside-press",ag="item-press",yM="close-press",hf="focus-out",Sx="escape-key",Y1="list-navigation",_M="cancel-open",bS="disabled",X1="missing",K1="initial",vS="imperative-action",jM="window-resize";function lt(e,n,s,o){let l=!1,c=!1;const d=o??cn;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 yS=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Ga,currentIdRef:{current:null},currentContextRef:{current:null}});function wM(e){const{children:n,delay:s,timeoutMs:o=0}=e,l=x.useRef(s),c=x.useRef(s),d=x.useRef(null),f=x.useRef(null),p=aa();return r.jsx(yS.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:l,initialDelayRef:c,currentIdRef:d,timeoutMs:o,currentContextRef:f,timeout:p}),[o,p]),children:n})}function SM(e,n={open:!1}){const{open:s}=n,o="rootStore"in e?e.rootStore:e,l=o.useState("floatingId"),c=x.useContext(yS),{currentIdRef:d,delayRef:f,timeoutMs:p,initialDelayRef:m,currentContextRef:g,hasProvider:b,timeout:v}=c,[S,C]=x.useState(!1);return Oe(()=>{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]),Oe(()=>{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:Pd(m.current,"close")},w!==null&&w!==l?(C(!0),_?.setIsInstantPhase(!0),_?.onOpenChange(!1,lt(Us))):(C(!1),_?.setIsInstantPhase(!1))},[s,l,o,d,f,m,g,v]),Oe(()=>()=>{g.current=null},[g]),x.useMemo(()=>({hasProvider:b,delayRef:f,isInstantPhase:S}),[b,f,S])}function pt(e,n,s,o){return e.addEventListener(n,s,o),()=>{e.removeEventListener(n,s,o)}}function ns(...e){return()=>{for(let n=0;n<e.length;n+=1){const s=e[n];s&&s()}}}function Hs(e,n,s,o){const l=va(_S).current;return kM(l,e,n,s,o)&&jS(l,[e,n,s,o]),l.callback}function CM(e){const n=va(_S).current;return EM(n,e)&&jS(n,e),n.callback}function _S(){return{callback:null,cleanup:null,refs:[]}}function kM(e,n,s,o,l){return e.refs[0]!==n||e.refs[1]!==s||e.refs[2]!==o||e.refs[3]!==l}function EM(e,n){return e.refs.length!==n.length||e.refs.some((s,o)=>s!==n[o])}function jS(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(NM,e).current;return n.next=e,Oe(n.effect),n}function NM(e){const n={current:e,next:e,effect:()=>{n.current=n.next}};return n}const Cx={...LN},sg=Cx.useInsertionEffect,RM=sg&&sg!==Cx.useLayoutEffect?sg:e=>e();function Le(e){const n=va(TM).current;return n.next=e,RM(n.effect),n.trampoline}function TM(){const e={next:void 0,callback:AM,trampoline:(...n)=>e.callback?.(...n),effect:()=>{e.callback=e.next}};return e}function AM(){}const Qu=null;class MM{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 MM;class Wa{static create(){return new Wa}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(Wa.create).current;return xx(e.disposeEffect),e}function yt(e){return e?.ownerDocument||document}const wS={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},kx={...wS,position:"fixed",top:0,left:0},SS={...wS,position:"absolute"},Id=x.forwardRef(function(n,s){const[o,l]=x.useState();Oe(()=>{fS&&l("button")},[]);const c={tabIndex:0,role:o};return r.jsx("span",{...n,ref:s,style:kx,"aria-hidden":o?void 0:!0,...c,"data-base-ui-focus-guard":""})}),OM=["top","right","bottom","left"],wl=Math.min,ba=Math.max,Bd=Math.round,so=Math.floor,as=e=>({x:e,y:e}),zM={left:"right",right:"left",bottom:"top",top:"bottom"};function _h(e,n,s){return ba(e,wl(n,s))}function Vs(e,n){return typeof e=="function"?e(n):e}function sa(e){return e.split("-")[0]}function Ar(e){return e.split("-")[1]}function Ex(e){return e==="x"?"y":"x"}function Nx(e){return e==="y"?"height":"width"}function Aa(e){const n=e[0];return n==="t"||n==="b"?"y":"x"}function Rx(e){return Ex(Aa(e))}function DM(e,n,s){s===void 0&&(s=!1);const o=Ar(e),l=Rx(e),c=Nx(l);let d=l==="x"?o===(s?"end":"start")?"right":"left":o==="start"?"bottom":"top";return n.reference[c]>n.floating[c]&&(d=Ud(d)),[d,Ud(d)]}function LM(e){const n=Ud(e);return[jh(e),n,jh(n)]}function jh(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Q1=["left","right"],Z1=["right","left"],PM=["top","bottom"],IM=["bottom","top"];function BM(e,n,s){switch(e){case"top":case"bottom":return s?n?Z1:Q1:n?Q1:Z1;case"left":case"right":return n?PM:IM;default:return[]}}function UM(e,n,s,o){const l=Ar(e);let c=BM(sa(e),s==="start",o);return l&&(c=c.map(d=>d+"-"+l),n&&(c=c.concat(c.map(jh)))),c}function Ud(e){const n=sa(e);return zM[n]+e.slice(n.length)}function HM(e){return{top:0,right:0,bottom:0,left:0,...e}}function CS(e){return typeof e!="number"?HM(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 jd(e,n){return Pn(e.current,{disabledIndices:n})}function wh(e,n){return Pn(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:n})}function Pn(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&&Ls(e,c,o));return c}function kS(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===jx?S="up":n.key===Tc&&(S="down"),S){const C=[],_=[];let w=!1,k=0;{let B=null,L=-1;e.forEach((D,z)=>{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(z),_[z]=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,M=B=>{if(!E||g===-1)return;const L=_[g];if(L==null)return;const D=C[L].indexOf(g),z=B==="up"?-1:1;for(let H=L+z,q=0;q<C.length;q+=1,H+=z){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(!Ls(e,$,f))return $}}},O=B=>{if(!R||g===-1)return;const L=g%T,D=B==="up"?-T:T,z=m-m%T,H=so(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?z:0}const V=Math.min(q+T-1,m);for(let $=Math.min(q+L,V);$>=q;$-=1)if(!Ls(e,$,f))return $}};b&&xa(n);const P=M(S)??O(S);if(P!==void 0)v=P;else if(g===-1)v=S==="up"?m:p;else if(v=Pn(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=Pn(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=so(g/d);n.key===(c?jr:wr)&&(b&&xa(n),g%d!==d-1?(v=Pn(e,{startingIndex:g,disabledIndices:f}),o&&Wu(v,d,C)&&(v=Pn(e,{startingIndex:g-g%d-1,disabledIndices:f}),l&&(v=l(n,g,v)))):o&&(v=Pn(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=Pn(e,{startingIndex:g,decrement:!0,disabledIndices:f}),o&&Wu(v,d,C)&&(v=Pn(e,{startingIndex:g+(d-g%d),decrement:!0,disabledIndices:f}),l&&(v=l(n,g,v)))):o&&(v=Pn(e,{startingIndex:g+(d-g%d),decrement:!0,disabledIndices:f}),l&&(v=l(n,g,v))),Wu(v,d,C)&&(v=g));const _=so(m/d)===C;bc(e,v)&&(o&&_?(v=n.key===(c?wr:jr)?m:Pn(e,{startingIndex:g-g%d-1,disabledIndices:f}),l&&(v=l(n,g,v))):v=g)}return v}function ES(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 NS(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 RS(e,n){return n.flatMap((s,o)=>e.includes(s)?[o]:[])}function Ls(e,n,s){if(typeof s=="function"?s(n):s?.includes(n)??!1)return!0;const l=e[n];return l?xf(l)?!s&&(l.hasAttribute("disabled")||l.getAttribute("aria-disabled")==="true"):!0:!1}function VM(e){return e.visibility==="hidden"||e.visibility==="collapse"}function xf(e,n=e?ra(e):null){return!e||!e.isConnected||!n||VM(n)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():n.display!=="none"&&n.display!=="contents"}const qM='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function $M(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 Sh(e){for(const n of Array.from(e.children))if(Vn(n)==="summary")return n;return null}function GM(e,n){const s=Sh(n);return!!s&&(e===s||Ze(s,e))}function TS(e){const n=e?Vn(e):"";return e!=null&&e.matches(qM)&&(n!=="summary"||e.parentElement!=null&&Vn(e.parentElement)==="details"&&Sh(e.parentElement)===e)&&(n!=="details"||Sh(e)==null)&&(n!=="input"||e.type!=="hidden")}function AS(e){if(!TS(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let n=e;n;n=$M(n)){const s=n!==e,o=Vn(n)==="slot";if(n.hasAttribute("inert")||s&&Vn(n)==="details"&&!n.open&&!GM(e,n)||n.hasAttribute("hidden")||!o&&!FM(n,s))return!1}return!0}function FM(e,n){const s=ra(e);return n?s.display!=="none":xf(e,s)}function MS(e){const n=e.tabIndex;if(n<0){const s=Vn(e);if(s==="details"||s==="audio"||s==="video"||Gt(e)&&e.isContentEditable)return 0}return n}function rg(e){if(Vn(e)!=="input")return null;const n=e;return n.type==="radio"&&n.name!==""?n:null}function YM(e,n){const s=rg(e);if(!s)return!0;const o=n.find(l=>{const c=rg(l);return c?.name===s.name&&c.form===s.form&&c.checked});return o?o===s:n.find(l=>{const c=rg(l);return c?.name===s.name&&c.form===s.form})===s}function OS(e){if(Gt(e)&&Vn(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 zS(e,n){OS(e).forEach(s=>{TS(s)&&n.push(s),zS(s,n)})}function DS(e,n,s){OS(e).forEach(o=>{Gt(o)&&o.matches(n)&&s.push(o),DS(o,n,s)})}function Tx(e){return AS(e)&&MS(e)>=0}function LS(e){const n=[];return zS(e,n),n.filter(AS)}function bf(e){const n=LS(e);return n.filter(s=>MS(s)>=0&&YM(s,n))}function PS(e,n){const s=bf(e),o=s.length;if(o===0)return;const l=In(yt(e)),c=s.indexOf(l),d=c===-1?n===1?0:o-1:c+n;return s[d]}function IS(e){return PS(yt(e).body,1)||e}function BS(e){return PS(yt(e).body,-1)||e}function sc(e,n){const s=n||e.currentTarget,o=e.relatedTarget;return!o||!Ze(s,o)}function XM(e){bf(e).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function W1(e){const n=[];DS(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 J1(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 wd(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(),Un;const d=requestAnimationFrame(c);return Ju=d,()=>{Ju===d&&(cancelAnimationFrame(d),Ju=0)}}const og={inert:new WeakMap,"aria-hidden":new WeakMap},e_="data-base-ui-inert",Ch={inert:new WeakSet,"aria-hidden":new WeakSet};let Li=new WeakMap,lg=0;function KM(e){return Ch[e]}function US(e){return e?_l(e)?e.host:US(e.parentNode):null}const ig=(e,n)=>n.map(s=>{if(e.contains(s))return s;const o=US(s);return e.contains(o)?o:null}).filter(s=>s!=null),t_=e=>{const n=new Set;return e.forEach(s=>{let o=s;for(;o&&!n.has(o);)n.add(o),o=o.parentNode}),n},n_=(e,n,s)=>{const o=[],l=c=>{!c||s.has(c)||Array.from(c.children).forEach(d=>{Vn(d)!=="script"&&(n.has(d)?l(d):o.push(d))})};return l(e),o};function QM(e,n,s,o,{mark:l=!0,markerIgnoreElements:c=[]}){const d=o?"inert":s?"aria-hidden":null;let f=null,p=null;const m=ig(n,e),g=l?ig(n,c):[],b=new Set(g),v=l?n_(n,t_(m),new Set(m)).filter(_=>!b.has(_)):[],S=[],C=[];if(d){const _=og[d],w=KM(d);p=w,f=_;const k=ig(n,Array.from(n.querySelectorAll("[aria-live]"))),E=m.concat(k);n_(n,t_(E),new Set(E)).forEach(R=>{const T=R.getAttribute(d),M=T!==null&&T!=="false",O=(_.get(R)||0)+1;_.set(R,O),S.push(R),O===1&&M&&w.add(R),M||R.setAttribute(d,d==="inert"?"":"true")})}return l&&v.forEach(_=>{const w=(Li.get(_)||0)+1;Li.set(_,w),C.push(_),w===1&&_.setAttribute(e_,"")}),lg+=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=(Li.get(_)||0)-1;Li.set(_,w),w||_.removeAttribute(e_)}),lg-=1,lg||(og.inert=new WeakMap,og["aria-hidden"]=new WeakMap,Ch.inert=new WeakSet,Ch["aria-hidden"]=new WeakSet,Li=new WeakMap)}}function a_(e,n={}){const{ariaHidden:s=!1,inert:o=!1,mark:l=!0,markerIgnoreElements:c=[]}=n,d=yt(e[0]).body;return QM(e,d,s,o,{mark:l,markerIgnoreElements:c})}let s_=0;function ZM(e,n="mui"){const[s,o]=x.useState(e),l=e||s;return x.useEffect(()=>{s==null&&(s_+=1,o(`${n}-${s_}`))},[s,n]),l}const r_=Cx.useId;function vf(e,n){if(r_!==void 0){const s=r_();return e??(n?`${n}-${s}`:s)}return ZM(e,n)}const WM=parseInt(x.version,10);function Ax(e){return WM>=e}function o_(e){if(!x.isValidElement(e))return null;const n=e,s=n.props;return(Ax(19)?s?.ref:n.ref)??null}function kh(e,n){if(e&&!n)return e;if(!e&&n)return n;if(e||n)return{...e,...n}}function JM(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 e3(e,n){return typeof e=="function"?e(n):e}function t3(e,n){return typeof e=="function"?e(n):e}const Mx={};function Oa(e,n,s,o,l){if(!s&&!o&&!l&&!e)return Hd(n);let c=Hd(e);return n&&(c=Ki(c,n)),s&&(c=Ki(c,s)),o&&(c=Ki(c,o)),l&&(c=Ki(c,l)),c}function n3(e){if(e.length===0)return Mx;if(e.length===1)return Hd(e[0]);let n=Hd(e[0]);for(let s=1;s<e.length;s+=1)n=Ki(n,e[s]);return n}function Hd(e){return Ox(e)?{...VS(e,Mx)}:a3(e)}function Ki(e,n){return Ox(n)?VS(n,e):s3(e,n)}function a3(e){const n={...e};for(const s in n){const o=n[s];HS(s,o)&&(n[s]=qS(o))}return n}function s3(e,n){if(!n)return e;for(const s in n){const o=n[s];switch(s){case"style":{e[s]=kh(e.style,o);break}case"className":{e[s]=$S(e.className,o);break}default:HS(s,o)?e[s]=r3(e[s],o):e[s]=o}}return e}function HS(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 Ox(e){return typeof e=="function"}function VS(e,n){return Ox(e)?e(n):e??Mx}function r3(e,n){return n?e?(...s)=>{const o=s[0];if(GS(o)){const c=o;Vd(c);const d=n(...s);return c.baseUIHandlerPrevented||e?.(...s),d}const l=n(...s);return e?.(...s),l}:qS(n):e}function qS(e){return e&&((...n)=>{const s=n[0];return GS(s)&&Vd(s),e(...n)})}function Vd(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function $S(e,n){return n?e?n+" "+e:n:e}function GS(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Ht(e,n,s={}){const o=n.render,l=o3(n,s);if(s.enabled===!1)return null;const c=s.state??cn;return c3(e,o,l,c)}function o3(e,n={}){const{className:s,style:o,render:l}=e,{state:c=cn,ref:d,props:f,stateAttributesMapping:p,enabled:m=!0}=n,g=m?e3(s,c):void 0,b=m?t3(o,c):void 0,v=m?JM(c,p):cn,S=m&&f?l3(f):void 0,C=m?kh(v,S)??{}:cn;return typeof document<"u"&&(m?Array.isArray(d)?C.ref=CM([C.ref,o_(l),...d]):C.ref=Hs(C.ref,o_(l),d):Hs(null,null)),m?(g!==void 0&&(C.className=$S(C.className,g)),b!==void 0&&(C.style=kh(C.style,b)),C):cn}function l3(e){return Array.isArray(e)?n3(e):Oa(void 0,e)}const i3=Symbol.for("react.lazy");function c3(e,n,s,o){if(n){if(typeof n=="function")return n(s,o);const l=Oa(s,n.props);l.ref=s.ref;let c=n;return c?.$$typeof===i3&&(c=x.Children.toArray(n)[0]),x.cloneElement(c,l)}if(e&&typeof e=="string")return u3(e,s);throw new Error(On(8))}function u3(e,n){return e==="button"?x.createElement("button",{type:"button",...n,key:n.key}):e==="img"?x.createElement("img",{alt:"",...n,key:n.key}):x.createElement(e,n)}const d3={style:{transition:"none"}},f3="data-base-ui-click-trigger",p3={fallbackAxisSide:"none"},m3={fallbackAxisSide:"end"},g3={clipPath:"inset(50%)",position:"fixed",top:0,left:0},FS=x.createContext(null),YS=()=>x.useContext(FS),h3=vc("portal");function XS(e={}){const{ref:n,container:s,componentProps:o=cn,elementProps:l}=e,c=vf(),f=YS()?.portalNode,[p,m]=x.useState(null),[g,b]=x.useState(null),v=Le(w=>{w!==null&&b(w)}),S=x.useRef(null);Oe(()=>{if(s===null){S.current&&(S.current=null,b(null),m(null));return}if(c==null)return;const w=(s&&(yx(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,[h3]:""},l]});return{portalNode:g,portalSubtree:p&&C?Rr.createPortal(C,p):null}}const KS=x.forwardRef(function(n,s){const{render:o,className:l,style:c,children:d,container:f,renderGuards:p,...m}=n,{portalNode:g,portalSubtree:b}=XS({container:f,ref:s,componentProps:n,elementProps:m}),v=x.useRef(null),S=x.useRef(null),C=x.useRef(null),_=x.useRef(null),[w,k]=x.useState(null),E=x.useRef(!1),N=w?.modal,R=w?.open,T=typeof p=="boolean"?p:!!w&&!w.modal&&w.open&&!!g;x.useEffect(()=>{if(!g||N)return;function O(P){g&&P.relatedTarget&&sc(P)&&(P.type==="focusin"?E.current&&(W1(g),E.current=!1):(XM(g),E.current=!0))}return ns(pt(g,"focusin",O,!0),pt(g,"focusout",O,!0))},[g,N]),x.useEffect(()=>{!g||R!==!1||(W1(g),E.current=!1)},[R,g]);const M=x.useMemo(()=>({beforeOutsideRef:v,afterOutsideRef:S,beforeInsideRef:C,afterInsideRef:_,portalNode:g,setFocusManagerState:k}),[g]);return r.jsxs(x.Fragment,{children:[b,r.jsxs(FS.Provider,{value:M,children:[T&&g&&r.jsx(Id,{"data-type":"outside",ref:v,onFocus:O=>{if(sc(O,g))C.current?.focus();else{const P=w?w.domReference:null;BS(P)?.focus()}}}),T&&g&&r.jsx("span",{"aria-owns":g.id,style:g3}),g&&Rr.createPortal(d,g),T&&g&&r.jsx(Id,{"data-type":"outside",ref:S,onFocus:O=>{if(sc(O,g))_.current?.focus();else{const P=w?w.domReference:null;IS(P)?.focus(),w?.closeOnFocusOut&&w?.onOpenChange(!1,lt(hf,O.nativeEvent))}}})]})]})});function x3(){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 b3=x.createContext(null),v3=x.createContext(null),yf=()=>x.useContext(b3)?.id||null,Pl=e=>{const n=x.useContext(v3);return e??n};function Ms(e){return e==null?e:"current"in e?e.current:e}function y3(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 l_=20;let yr=[];function zx(){yr=yr.filter(e=>e.deref()?.isConnected)}function _3(e){zx(),e&&Vn(e)!=="body"&&(yr.push(new WeakRef(e)),yr.length>l_&&(yr=yr.slice(-l_)))}function cg(){return zx(),yr[yr.length-1]?.deref()}function j3(e){return e?Tx(e)?e:bf(e)[0]||e:null}function i_(e,n){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!n.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const o=LS(e).filter(c=>{const d=c.getAttribute("data-tabindex")||"";return Tx(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 QS(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),M=l===!1,O=yh(k)&&M,P=x.useRef(["content"]),B=mn(l),L=mn(c),D=mn(m),z=Pl(S),H=YS(),q=x.useRef(!1),Y=x.useRef(!1),V=x.useRef(!1),$=x.useRef(null),Z=x.useRef(""),G=x.useRef(""),X=x.useRef(null),U=x.useRef(null),K=Hs(X,v,H?.beforeInsideRef),F=Hs(U,H?.afterInsideRef),J=aa(),ie=aa(),re=jl(),oe=H!=null,ce=Ld(E),ee=Le((ve=ce)=>ve?bf(ve):[]),Te=Le(()=>C?.().filter(ve=>ve!=null)??[]);x.useEffect(()=>{if(o||!f)return;function ve(Ne){Ne.key==="Tab"&&Ze(ce,In(yt(ce)))&&ee().length===0&&!O&&xa(Ne)}const Ce=yt(ce);return pt(Ce,"keydown",ve)},[o,ce,f,O,ee]),x.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(`[${f3}]`)&&(Y.current=!0)}function Pe(){G.current="keyboard"}return ns(pt(ve,"pointerdown",Ne,!0),pt(ve,"pointerup",Ce,!0),pt(ve,"pointercancel",Ce,!0),pt(ve,"keydown",Pe,!0))},[o,E,k,ce,w,H,Te]),x.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);Tx(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,Ms(b),Ms(g)].includes(we),_e=!(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||z&&(Er(z.nodesRef.current,Ye).find(Se=>Ze(Se.context?.elements.floating,we)||Ze(Se.context?.elements.domReference,we))||J1(z.nodesRef.current,Ye).find(Se=>[Se.context?.elements.floating,Ld(Se.context?.elements.floating)].includes(we)||Se.context?.elements.domReference===we)));if(Be===k&&ce&&i_(ce,P),d&&Be!==k&&!xf(Xe)&&In(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}(O||!f)&&we&&_e&&!Y.current&&(O||we!==cg())&&(q.current=!0,_.setOpen(!1,lt(hf,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 ns(be&&pt(be,"focusout",Pe),be&&pt(be,"pointerdown",Ce),E&&pt(E,"focusin",Ne),E&&pt(E,"focusout",Pe),E&&H&&pt(E,"focusout",Ie,!0))},[o,k,E,ce,f,z,H,_,p,d,ee,O,T,P,R,J,ie,re,g,b,Te]),x.useEffect(()=>{if(o||!E||!w)return;const ve=Array.from(H?.portalNode?.querySelectorAll(`[${vc("portal")}]`)||[]),Ne=(z?J1(z.nodesRef.current,T()):[]).find(Be=>yh(Be.context?.elements.domReference||null))?.context?.elements.domReference,Ie=[...[E,...ve,X.current,U.current,H?.beforeOutsideRef.current,H?.afterOutsideRef.current,...Te()],Ne,Ms(b),Ms(g),O?k:null].filter(Be=>Be!=null),be=a_(Ie,{ariaHidden:f||O,mark:!1}),Ae=[E,...ve].filter(Be=>Be!=null),we=a_(Ae);return()=>{we(),be()}},[w,o,k,E,f,H,O,z,T,g,b,Te]),Oe(()=>{if(!w||o||!Gt(ce))return;const ve=yt(ce),Ce=In(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=Ms(Pe),we=we||Ae();const Be=Ze(ce,In(ve));wd(we,{preventScroll:we===ce,shouldFocus(){if(Be)return!0;const Xe=In(ve);return!(Xe!==we&&Ze(ce,Xe))}})})},[o,w,ce,ee,B,D]),Oe(()=>{if(o||!ce)return;const ve=yt(ce),Ce=In(ve);_3(Ce);function Ne(Ie){if(Ie.open||(Z.current=y3(Ie.nativeEvent,G.current)),Ie.reason===$n&&Ie.nativeEvent.type==="mouseleave"&&(q.current=!0),Ie.reason===wx)if(Ie.nested)q.current=!1;else if(vx(Ie.nativeEvent)||mS(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:cg()||null;const Ae=k?.isConnected?k:cg();return Ms(be)||Ae||null}return()=>{N.off("openchange",Ne);const Ie=In(ve),be=Te(),Ae=Ze(E,Ie)||be.some(Xe=>Xe===Ie||Ze(Xe,Ie))||z&&Er(z.nodesRef.current,T(),!1).some(Xe=>Ze(Xe.context?.elements.floating,Ie)),we=L.current,Be=Pe();queueMicrotask(()=>{const Xe=j3(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,z,k,T,Te]),Oe(()=>{if(!bx||w||!E)return;const ve=In(yt(E));!Gt(ve)||!gf(ve)||Ze(E,ve)&&ve.blur()},[w,E]),Oe(()=>{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]),Oe(()=>{if(!(o||!ce))return i_(ce,P),()=>{queueMicrotask(zx)}},[o,ce,P]);const Fe=!o&&(f?!O:!0)&&(oe||f);return r.jsxs(x.Fragment,{children:[Fe&&r.jsx(Id,{"data-type":"inside",ref:K,onFocus:ve=>{if(f){const Ce=ee();wd(Ce[Ce.length-1])}else H?.portalNode&&(q.current=!1,sc(ve,H.portalNode)?IS(k)?.focus():Ms(b??H.beforeOutsideRef)?.focus())}}),s,Fe&&r.jsx(Id,{"data-type":"inside",ref:F,onFocus:ve=>{f?wd(ee()[0]):H?.portalNode&&(p&&(q.current=!0),sc(ve,H.portalNode)?BS(k)?.focus():Ms(g??H.afterOutsideRef)?.focus())}})]})}function w3(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=x.useRef(void 0),v=jl(),S=aa(),C=x.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"||co(E,!0)&&c)return;const T=w(R,k.currentTarget,P=>P==="click"||P==="mousedown"),M=Tn(N);if(gf(M)){_(T,N,M,E);return}const O=k.currentTarget;v.request(()=>{_(T,N,O,E)})},onClick(k){if(o==="mousedown-only")return;const E=b.current;if(o==="mousedown"&&E){b.current=void 0;return}if(co(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 x.useMemo(()=>s?{reference:C}:cn,[s,C])}function S3(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 c_(e){return e!=null&&e.clientX!=null}function C3(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=x.useRef(!1),g=x.useRef(null),[b,v]=x.useState(),[S,C]=x.useState([]),_=Le(R=>{l.set("positionReference",R)}),w=Le((R,T,M)=>{m.current||p.current.openEvent&&!c_(p.current.openEvent)||l.set("positionReference",S3(M??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=co(b)?d:c;x.useEffect(()=>{if(!s){_(f);return}if(!E)return;function R(){g.current?.(),g.current=null}const T=Qt(d);function M(O){const P=Tn(O);Ze(d,P)?R():w(O.clientX,O.clientY)}return!p.current.openEvent||c_(p.current.openEvent)?g.current=pt(T,"mousemove",M):_(f),R},[E,s,d,p,f,l,w,_,S]),x.useEffect(()=>()=>{l.set("positionReference",null)},[l]),x.useEffect(()=>{s&&!d&&(m.current=!1)},[s,d]),x.useEffect(()=>{!s&&c&&(m.current=!0)},[s,c]);const N=x.useMemo(()=>{function R(T){v(T.pointerType)}return{onPointerDown:R,onPointerEnter:R,onMouseMove:k,onMouseEnter:k}},[k]);return x.useMemo(()=>s?{reference:N,trigger:N}:{},[s,N])}const k3={intentional:"onClick",sloppy:"onPointerDown"};function E3(){return!1}function N3(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Dx(e,n={}){const{enabled:s=!0,escapeKey:o=!0,outsidePress:l=!0,outsidePressEvent:c="sloppy",referencePress:d=E3,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=Pl(m),_=Le(typeof l=="function"?l:()=>!1),w=typeof l=="function"?_:l,k=w!==!1,E=Le(()=>c),{escapeKey:N,outsidePress:R}=N3(p),T=x.useRef(!1),M=x.useRef(!1),O=x.useRef(!1),P=x.useRef(!1),B=x.useRef(""),L=x.useRef(null),D=aa(),z=aa(),H=Le(()=>{z.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=>ng(F,g.select("floatingElement"))||ng(F,g.select("domReferenceElement"))),V=Le(F=>{d()&&g.setOpen(!1,lt(hc,F.nativeEvent))}),$=Le(F=>{if(!b||!s||!o||F.key!=="Escape"||P.current||!N&&q("__escapeKeyBubbles"))return;const J=cM(F)?F.nativeEvent:F,ie=lt(Sx,J);g.setOpen(!1,ie),ie.isCanceled||F.preventDefault(),!N&&!ie.isPropagationAllowed&&F.stopPropagation()}),Z=Le(()=>{S.current.insideReactTree=!0,z.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,M.current=!1))}),X=Le(F=>{!b||!s||(F.defaultPrevented||F.nativeEvent.defaultPrevented)&&T.current&&(M.current=!0)});x.useEffect(()=>{if(!b||!s)return;S.current.__escapeKeyBubbles=N,S.current.__outsidePressBubbles=R;const F=new Ga,J=new Ga;function ie(){F.clear(),P.current=!0}function re(){F.start(pf()?5:0,()=>{P.current=!1})}function oe(){O.current=!0,J.start(0,()=>{O.current=!1})}function ce(){T.current=!1,M.current=!1}function ee(){const le=B.current,_e=le==="pen"||!le?"mouse":le,Se=E(),Ue=typeof Se=="function"?Se():Se;return typeof Ue=="string"?Ue:Ue[_e]}function Te(le){const _e=ee();return _e==="intentional"&&le.type!=="click"||_e==="sloppy"&&le.type==="click"}function Fe(le){const _e=S.current.floatingContext?.nodeId,Se=C&&Er(C.nodesRef.current,_e).some(Ue=>ng(le,Ue.context?.elements.floating));return Y(le)||Se}function ve(le){if(Te(le)){le.type!=="click"&&!Y(le)&&(J.clear(),O.current=!1),H();return}if(S.current.insideReactTree){H();return}const _e=Tn(le),Se=`[${vc("inert")}]`,Ue=ft(_e)?_e.getRootNode():null,Je=Array.from((_l(Ue)?Ue:yt(g.select("floatingElement"))).querySelectorAll(Se)),_t=g.context.triggerElements;if(_e&&(_t.hasElement(_e)||_t.hasMatchingElement(pe=>Ze(pe,_e))))return;let zt=ft(_e)?_e:null;for(;zt&&!Ds(zt);){const pe=Bs(zt);if(Ds(pe)||!ft(pe))break;zt=pe}if(!(Je.length&&ft(_e)&&!gM(_e)&&!Ze(_e,g.select("floatingElement"))&&Je.every(pe=>!Ze(zt,pe)))){if(Gt(_e)&&!("touches"in le)){const pe=Ds(_e),Ee=ra(_e),Re=/auto|scroll/,qe=pe||Re.test(Ee.overflowX),st=pe||Re.test(Ee.overflowY),nn=qe&&_e.clientWidth>0&&_e.scrollWidth>_e.clientWidth,Vt=st&&_e.clientHeight>0&&_e.scrollHeight>_e.clientHeight,mt=Ee.direction==="rtl",Nt=Vt&&(mt?le.offsetX<=_e.offsetWidth-_e.clientWidth:le.offsetX>_e.clientWidth),Wt=nn&&le.offsetY>_e.clientHeight;if(Nt||Wt)return}if(!Fe(le)){if(ee()==="intentional"&&O.current){J.clear(),O.current=!1;return}typeof w=="function"&&!w(le)||q("__outsidePressBubbles")||(g.setOpen(!1,lt(wx,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 _e=le.touches[0];_e&&(L.current={startTime:Date.now(),startX:_e.clientX,startY:_e.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},D.start(1e3,()=>{L.current&&(L.current.dismissOnTouchEnd=!1,L.current.dismissOnMouseDown=!1)}))}function Pe(le,_e){const Se=Tn(le);if(!Se)return;const Ue=pt(Se,le.type,()=>{_e(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,_e=>{_e.type==="pointerdown"?Ce(_e):ve(_e)})}function Ae(le){if(!T.current)return;const _e=M.current;if(ce(),ee()==="intentional"){if(le.type==="pointercancel"){_e&&oe();return}if(!Fe(le)){if(_e){oe();return}typeof w=="function"&&!w(le)||(J.clear(),O.current=!0,H())}}}function we(le){if(ee()!=="sloppy"||!L.current||Y(le))return;const _e=le.touches[0];if(!_e)return;const Se=Math.abs(_e.clientX-L.current.startX),Ue=Math.abs(_e.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=ns(o&&ns(pt(De,"keydown",$),pt(De,"compositionstart",ie),pt(De,"compositionend",re)),k&&ns(pt(De,"click",be,!0),pt(De,"pointerdown",be,!0),pt(De,"pointerup",Ae,!0),pt(De,"pointercancel",Ae,!0),pt(De,"mousedown",be,!0),pt(De,"mouseup",Ae,!0),pt(De,"touchstart",Ie,!0),pt(De,"touchmove",Be,!0),pt(De,"touchend",Ye,!0)));return()=>{ye(),F.clear(),J.clear(),ce(),O.current=!1}},[S,v,o,k,w,b,s,N,R,$,H,E,q,Y,C,g,D]),x.useEffect(H,[w,H]);const U=x.useMemo(()=>({onKeyDown:$,[k3[f]]:V,...f!=="intentional"&&{onClick:V}}),[$,V,f]),K=x.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 x.useMemo(()=>s?{reference:U,floating:K,trigger:U}:{},[s,U,K])}function u_(e,n,s){let{reference:o,floating:l}=e;const c=Aa(n),d=Rx(n),f=Nx(d),p=sa(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(Ar(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 R3(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}=Vs(n,e),C=CS(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 T3=50,A3=async(e,n,s)=>{const{placement:o="bottom",strategy:l="absolute",middleware:c=[],platform:d}=s,f=d.detectOverflow?d:{...d,detectOverflow:R3},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}=u_(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:M}=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},M&&S<T3&&(S++,typeof M=="object"&&(M.placement&&(v=M.placement),M.rects&&(m=M.rects===!0?await d.getElementRects({reference:e,floating:n,strategy:l}):M.rects),{x:g,y:b}=u_(m,v,p)),_=-1)}return{x:g,y:b,placement:v,strategy:l,middlewareData:C}},M3=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}=Vs(e,n);if((s=c.arrow)!=null&&s.alignmentOffset)return{};const k=sa(l),E=Aa(f),N=sa(f)===f,R=await(p.isRTL==null?void 0:p.isRTL(m.floating)),T=v||(N||!_?[Ud(f)]:LM(f)),M=C!=="none";!v&&M&&T.push(...UM(f,_,C,R));const O=[f,...T],P=await p.detectOverflow(n,w),B=[];let L=((o=c.flip)==null?void 0:o.overflows)||[];if(g&&B.push(P[k]),b){const q=DM(l,d,R);B.push(P[q[0]],P[q[1]])}if(L=[...L,{placement:l,overflows:B}],!B.every(q=>q<=0)){var D,z;const q=(((D=c.flip)==null?void 0:D.index)||0)+1,Y=O[q];if(Y&&(!(b==="alignment"?E!==Aa(Y):!1)||L.every(Z=>Aa(Z.placement)===E?Z.overflows[0]>0:!0)))return{data:{index:q,overflows:L},reset:{placement:Y}};let V=(z=L.filter($=>$.overflows[0]<=0).sort(($,Z)=>$.overflows[1]-Z.overflows[1])[0])==null?void 0:z.placement;if(!V)switch(S){case"bestFit":{var H;const $=(H=L.filter(Z=>{if(M){const G=Aa(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 d_(e,n){return{top:e.top-n.height,right:e.right-n.width,bottom:e.bottom-n.height,left:e.left-n.width}}function f_(e){return OM.some(n=>e[n]>=0)}const O3=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(n){const{rects:s,platform:o}=n,{strategy:l="referenceHidden",...c}=Vs(e,n);switch(l){case"referenceHidden":{const d=await o.detectOverflow(n,{...c,elementContext:"reference"}),f=d_(d,s.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:f_(f)}}}case"escaped":{const d=await o.detectOverflow(n,{...c,altBoundary:!0}),f=d_(d,s.floating);return{data:{escapedOffsets:f,escaped:f_(f)}}}default:return{}}}}},ZS=new Set(["left","top"]);async function z3(e,n){const{placement:s,platform:o,elements:l}=e,c=await(o.isRTL==null?void 0:o.isRTL(l.floating)),d=sa(s),f=Ar(s),p=Aa(s)==="y",m=ZS.has(d)?-1:1,g=c&&p?-1:1,b=Vs(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 D3=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 z3(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}}}}},L3=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}=Vs(e,n),g={x:s,y:o},b=await c.detectOverflow(n,m),v=Aa(sa(l)),S=Ex(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=_h(N,C,R)}if(f){const k=v==="y"?"top":"left",E=v==="y"?"bottom":"right",N=_+b[k],R=_-b[E];_=_h(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}}}}}},P3=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}=Vs(e,n),g={x:s,y:o},b=Aa(l),v=Ex(b);let S=g[v],C=g[b];const _=Vs(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=ZS.has(sa(l)),T=c.reference[b]-c.floating[N]+(R&&((k=d.offset)==null?void 0:k[b])||0)+(R?0:w.crossAxis),M=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>M&&(C=M)}return{[v]:S,[b]:C}}}},I3=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}=Vs(e,n),g=await d.detectOverflow(n,m),b=sa(l),v=Ar(l),S=Aa(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),M=!n.middlewareData.shift;let O=R,P=T;if((s=n.middlewareData.shift)!=null&&s.enabled.x&&(P=N),(o=n.middlewareData.shift)!=null&&o.enabled.y&&(O=E),M&&!v){const L=ba(g.left,0),D=ba(g.right,0),z=ba(g.top,0),H=ba(g.bottom,0);S?P=C-2*(L!==0||D!==0?L+D:ba(g.left,g.right)):O=_-2*(z!==0||H!==0?z+H:ba(g.top,g.bottom))}await p({...n,availableWidth:P,availableHeight:O});const B=await d.getDimensions(f.floating);return C!==B.width||_!==B.height?{reset:{rects:!0}}:{}}}};function WS(e){const n=ra(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=Bd(s)!==c||Bd(o)!==d;return f&&(s=c,o=d),{width:s,height:o,$:f}}function Lx(e){return ft(e)?e:e.contextElement}function gl(e){const n=Lx(e);if(!Gt(n))return as(1);const s=n.getBoundingClientRect(),{width:o,height:l,$:c}=WS(n);let d=(c?Bd(s.width):s.width)/o,f=(c?Bd(s.height):s.height)/l;return(!d||!Number.isFinite(d))&&(d=1),(!f||!Number.isFinite(f))&&(f=1),{x:d,y:f}}const B3=as(0);function JS(e){const n=Qt(e);return!pf()||!n.visualViewport?B3:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function U3(e,n,s){return n===void 0&&(n=!1),!s||n&&s!==Qt(e)?!1:n}function uo(e,n,s,o){n===void 0&&(n=!1),s===void 0&&(s=!1);const l=e.getBoundingClientRect(),c=Lx(e);let d=as(1);n&&(o?ft(o)&&(d=gl(o)):d=gl(e));const f=U3(c,s,o)?JS(c):as(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&&ft(o)?Qt(o):o;let C=v,_=bh(C);for(;_&&o&&S!==C;){const w=gl(_),k=_.getBoundingClientRect(),E=ra(_),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(_),_=bh(C)}}return xc({width:g,height:b,x:p,y:m})}function _f(e,n){const s=mf(e).scrollLeft;return n?n.left+s:uo(ls(e)).left+s}function e2(e,n){const s=e.getBoundingClientRect(),o=s.left+n.scrollLeft-_f(e,s),l=s.top+n.scrollTop;return{x:o,y:l}}function H3(e){let{elements:n,rect:s,offsetParent:o,strategy:l}=e;const c=l==="fixed",d=ls(o),f=n?ff(n.floating):!1;if(o===d||f&&c)return s;let p={scrollLeft:0,scrollTop:0},m=as(1);const g=as(0),b=Gt(o);if((b||!b&&!c)&&((Vn(o)!=="body"||Tr(d))&&(p=mf(o)),b)){const S=uo(o);m=gl(o),g.x=S.x+o.clientLeft,g.y=S.y+o.clientTop}const v=d&&!b&&!c?e2(d,p):as(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 V3(e){return Array.from(e.getClientRects())}function q3(e){const n=ls(e),s=mf(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+_f(e);const f=-s.scrollTop;return ra(o).direction==="rtl"&&(d+=ba(n.clientWidth,o.clientWidth)-l),{width:l,height:c,x:d,y:f}}const p_=25;function $3(e,n){const s=Qt(e),o=ls(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=pf();(!g||g&&n==="fixed")&&(f=l.offsetLeft,p=l.offsetTop)}const m=_f(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<=p_&&(c-=C)}else m<=p_&&(c+=m);return{width:c,height:d,x:f,y:p}}function G3(e,n){const s=uo(e,!0,n==="fixed"),o=s.top+e.clientTop,l=s.left+e.clientLeft,c=Gt(e)?gl(e):as(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 m_(e,n,s){let o;if(n==="viewport")o=$3(e,s);else if(n==="document")o=q3(ls(e));else if(ft(n))o=G3(n,s);else{const l=JS(e);o={x:n.x-l.x,y:n.y-l.y,width:n.width,height:n.height}}return xc(o)}function t2(e,n){const s=Bs(e);return s===n||!ft(s)||Ds(s)?!1:ra(s).position==="fixed"||t2(s,n)}function F3(e,n){const s=n.get(e);if(s)return s;let o=mc(e,[],!1).filter(f=>ft(f)&&Vn(f)!=="body"),l=null;const c=ra(e).position==="fixed";let d=c?Bs(e):e;for(;ft(d)&&!Ds(d);){const f=ra(d),p=_x(d);!p&&f.position==="fixed"&&(l=null),(c?!p&&!l:!p&&f.position==="static"&&!!l&&(l.position==="absolute"||l.position==="fixed")||Tr(d)&&!p&&t2(e,d))?o=o.filter(g=>g!==d):l=f,d=Bs(d)}return n.set(e,o),o}function Y3(e){let{element:n,boundary:s,rootBoundary:o,strategy:l}=e;const d=[...s==="clippingAncestors"?ff(n)?[]:F3(n,this._c):[].concat(s),o],f=m_(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=m_(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 X3(e){const{width:n,height:s}=WS(e);return{width:n,height:s}}function K3(e,n,s){const o=Gt(n),l=ls(n),c=s==="fixed",d=uo(e,!0,c,n);let f={scrollLeft:0,scrollTop:0};const p=as(0);function m(){p.x=_f(l)}if(o||!o&&!c)if((Vn(n)!=="body"||Tr(l))&&(f=mf(n)),o){const S=uo(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?e2(l,f):as(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 ug(e){return ra(e).position==="static"}function g_(e,n){if(!Gt(e)||ra(e).position==="fixed")return null;if(n)return n(e);let s=e.offsetParent;return ls(e)===s&&(s=s.ownerDocument.body),s}function n2(e,n){const s=Qt(e);if(ff(e))return s;if(!Gt(e)){let l=Bs(e);for(;l&&!Ds(l);){if(ft(l)&&!ug(l))return l;l=Bs(l)}return s}let o=g_(e,n);for(;o&&dM(o)&&ug(o);)o=g_(o,n);return o&&Ds(o)&&ug(o)&&!_x(o)?s:o||mM(e)||s}const Q3=async function(e){const n=this.getOffsetParent||n2,s=this.getDimensions,o=await s(e.floating);return{reference:K3(e.reference,await n(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Z3(e){return ra(e).direction==="rtl"}const a2={convertOffsetParentRelativeRectToViewportRelativeRect:H3,getDocumentElement:ls,getClippingRect:Y3,getOffsetParent:n2,getElementRects:Q3,getClientRects:V3,getDimensions:X3,getScale:gl,isElement:ft,isRTL:Z3};function s2(e,n){return e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height}function W3(e,n){let s=null,o;const l=ls(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=so(b),_=so(l.clientWidth-(g+v)),w=so(l.clientHeight-(b+S)),k=so(g),N={rootMargin:-C+"px "+-_+"px "+-w+"px "+-k+"px",threshold:ba(0,wl(1,p))||1};let R=!0;function T(M){const O=M[0].intersectionRatio;if(O!==p){if(!R)return d();O?d(!1,O):o=setTimeout(()=>{d(!1,1e-7)},1e3)}O===1&&!s2(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 h_(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=Lx(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?W3(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?uo(e):null;p&&w();function w(){const k=uo(e);_&&!s2(_,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 J3=D3,e5=L3,t5=M3,n5=I3,a5=O3,s5=P3,r5=(e,n,s)=>{const o=new Map,l={platform:a2,...s},c={...l.platform,_c:o};return A3(e,n,{...l,platform:c})};var o5=typeof document<"u",l5=function(){},Sd=o5?x.useLayoutEffect:l5;function qd(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(!qd(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)&&!qd(e[c],n[c]))return!1}return!0}return e!==e&&n!==n}function r2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function x_(e,n){const s=r2(e);return Math.round(n*s)/s}function dg(e){const n=x.useRef(e);return Sd(()=>{n.current=e}),n}function i5(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]=x.useState({x:0,y:0,strategy:s,placement:n,middlewareData:{},isPositioned:!1}),[v,S]=x.useState(o);qd(v,o)||S(o);const[C,_]=x.useState(null),[w,k]=x.useState(null),E=x.useCallback(Z=>{Z!==M.current&&(M.current=Z,_(Z))},[]),N=x.useCallback(Z=>{Z!==O.current&&(O.current=Z,k(Z))},[]),R=c||C,T=d||w,M=x.useRef(null),O=x.useRef(null),P=x.useRef(g),B=p!=null,L=dg(p),D=dg(l),z=dg(m),H=x.useCallback(()=>{if(!M.current||!O.current)return;const Z={placement:n,strategy:s,middleware:v};D.current&&(Z.platform=D.current),r5(M.current,O.current,Z).then(G=>{const X={...G,isPositioned:z.current!==!1};q.current&&!qd(P.current,X)&&(P.current=X,Rr.flushSync(()=>{b(X)}))})},[v,n,s,D,z]);Sd(()=>{m===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,b(Z=>({...Z,isPositioned:!1})))},[m]);const q=x.useRef(!1);Sd(()=>(q.current=!0,()=>{q.current=!1}),[]),Sd(()=>{if(R&&(M.current=R),T&&(O.current=T),R&&T){if(L.current)return L.current(R,T,H);H()}},[R,T,H,L,B]);const Y=x.useMemo(()=>({reference:M,floating:O,setReference:E,setFloating:N}),[E,N]),V=x.useMemo(()=>({reference:R,floating:T}),[R,T]),$=x.useMemo(()=>{const Z={position:s,left:0,top:0};if(!V.floating)return Z;const G=x_(V.floating,g.x),X=x_(V.floating,g.y);return f?{...Z,transform:"translate("+G+"px, "+X+"px)",...r2(V.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:G,top:X}},[s,f,V.floating,g.x,g.y]);return x.useMemo(()=>({...g,update:H,refs:Y,elements:V,floatingStyles:$}),[g,H,Y,V,$])}const c5=(e,n)=>{const s=J3(e);return{name:s.name,fn:s.fn,options:[e,n]}},u5=(e,n)=>{const s=e5(e);return{name:s.name,fn:s.fn,options:[e,n]}},d5=(e,n)=>({fn:s5(e).fn,options:[e,n]}),f5=(e,n)=>{const s=t5(e);return{name:s.name,fn:s.fn,options:[e,n]}},p5=(e,n)=>{const s=n5(e);return{name:s.name,fn:s.fn,options:[e,n]}},m5=(e,n)=>{const s=a5(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(On(1));let f;if(e)f=e;else throw new Error("Missing arguments");return f};var fg={exports:{}},pg={};/**
566
- * @license React
567
- * use-sync-external-store-shim.production.js
568
- *
569
- * Copyright (c) Meta Platforms, Inc. and affiliates.
570
- *
571
- * This source code is licensed under the MIT license found in the
572
- * LICENSE file in the root directory of this source tree.
573
- */var b_;function g5(){if(b_)return pg;b_=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 pg.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,pg}var v_;function o2(){return v_||(v_=1,fg.exports=g5()),fg.exports}var $d=o2(),mg={exports:{}},gg={};/**
574
- * @license React
575
- * use-sync-external-store-shim/with-selector.production.js
576
- *
577
- * Copyright (c) Meta Platforms, Inc. and affiliates.
578
- *
579
- * This source code is licensed under the MIT license found in the
580
- * LICENSE file in the root directory of this source tree.
581
- */var y_;function h5(){if(y_)return gg;y_=1;var e=Sc(),n=o2();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 gg.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(M){if(!E){if(E=!0,N=M,M=v(M),S!==void 0&&_.hasValue){var O=_.value;if(S(O,M))return R=O}return R=M}if(O=R,o(N,M))return O;var P=v(M);return S!==void 0&&S(O,P)?(N=M,O):(N=M,R=P)}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},gg}var __;function x5(){return __||(__=1,mg.exports=h5()),mg.exports}var b5=x5();const v5=Ax(19),y5=v5?j5:w5;function tt(e,n,s,o,l){return y5(e,n,s,o,l)}function _5(e,n,s,o,l){const c=x.useCallback(()=>n(e.getSnapshot(),s,o,l),[e,n,s,o,l]);return $d.useSyncExternalStore(e.subscribe,c,c)}JA({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()}}),$d.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function j5(e,n,s,o,l){const c=WA();if(!c)return _5(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 w5(e,n,s,o,l){return b5.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,c=>n(c,s,o,l))}class l2{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 Px extends l2{constructor(n,s={},o){super(n),this.context=s,this.selectors=o}useSyncedValue(n,s){x.useDebugValue(n);const o=this;Oe(()=>{o.state[n]!==s&&o.set(n,s)},[o,n,s])}useSyncedValueWithCleanup(n,s){const o=this;Oe(()=>(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);Oe(()=>{s.update(n)},[s,...o])}useControlledProp(n,s){x.useDebugValue(n);const o=this,l=s!==void 0;Oe(()=>{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 x.useDebugValue(n),tt(this,this.selectors[n],s,o,l)}useContextCallback(n,s){x.useDebugValue(n);const o=Le(s??Un);this.context[n]=o}useStateSetter(n){const s=x.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 S5={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 jf extends Px{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:x3(),nested:o,triggerElements:c},S5),this.syncOnly=s}syncOpenEvent=(n,s)=>{(!n||!this.state.open||s!=null&&uM(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 C5(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=x.useRef(null);o===void 0&&v.current===null&&(v.current=new jf({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),Oe(()=>{const C={open:f,floatingId:l,referenceElement:p,floatingElement:m};ft(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]=x.useState(e&&n?"idle":void 0),[c,d]=x.useState(e);return e&&!c&&(d(!0),l("starting")),!e&&c&&o!=="ending"&&!s&&l("ending"),!e&&!c&&o==="ending"&&l(void 0),Oe(()=>{if(!e&&c&&o!=="ending"&&s){const f=Wa.request(()=>{l("ending")});return()=>{Wa.cancel(f)}}},[e,c,o,s]),Oe(()=>{if(!e||n)return;const f=Wa.request(()=>{l(void 0)});return()=>{Wa.cancel(f)}},[n,e]),Oe(()=>{if(!e||!n)return;e&&c&&o!=="idle"&&l("starting");const f=Wa.request(()=>{l("idle")});return()=>{Wa.cancel(f)}},[n,e,c,o]),{mounted:c,setMounted:d,transitionStatus:o}}let fo=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const k5={[fo.startingStyle]:""},E5={[fo.endingStyle]:""},Il={transitionStatus(e){return e==="starting"?k5:e==="ending"?E5:null}};function N5(e,n=!1,s=!0){const o=jl();return Le((l,c=null)=>{o.cancel();const d=Ms(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=fo.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 Mr(e){const{enabled:n=!0,open:s,ref:o,onComplete:l}=e,c=Le(l),d=N5(o,s,!1);x.useEffect(()=>{if(!n)return;const f=new AbortController;return d(c,f.signal),()=>{f.abort()}},[n,s,c,d])}const wf={tabIndex:-1,[vh]:""};function i2(e,n,s=!1){const o=vf(),l=yf()!=null,c=x.useRef(null);e===void 0&&c.current===null&&(c.current=n(o,l));const d=e??c.current;return C5({popupStore:d,treatPopupAsFloatingElement:s,floatingRootContext:d.state.floatingRootContext,floatingId:o,nested:l,onOpenChange:d.setOpen}),{store:d,internalStore:c.current}}function R5(e,n){const s=x.useRef(null),o=x.useRef(null);return x.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 c2(e,n,s){const o=s?.id??null;(o||n)&&(e.activeTriggerId=o,e.activeTriggerElement=s??null)}function T5(e,n,s,o){const l=s.useState("isMountedByTrigger",e),c=R5(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 Oe(()=>{l&&s.update({activeTriggerElement:n.current,...o})},[l,s,n,...Object.values(o)]),{registerTrigger:d,isMountedByThisTrigger:l}}function u2(e){const n=e.useState("open"),s=e.useState("triggerCount");Oe(()=>{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 d2(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 Mr({enabled:o&&!e&&!f,open:e,ref:n.context.popupRef,onComplete(){e||d()}}),{forceUnmount:d,transitionStatus:c}}function f2(e,n){e.useSyncedValues(n),Oe(()=>()=>{e.update({activeTriggerProps:cn,inactiveTriggerProps:cn,popupProps:cn})},[e])}function A5(e,n){Oe(()=>{!n&&e.state.openMethod!==null&&e.set("openMethod",null)},[n,e]),Oe(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Sf{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 M5(){return new jf({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Sf,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function p2(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:M5(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:cn,inactiveTriggerProps:cn,popupProps:cn}}function m2(e,n,s=!1){return new jf({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:n,syncOnly:!0,nested:s,onOpenChange:void 0})}const rc=ze(e=>e.triggerIdProp??e.activeTriggerId),Ix=ze(e=>e.openProp??e.open),j_=ze(e=>(e.popupElement?.id??e.floatingId)||void 0);function g2(e,n){return n!==void 0&&Ix(e)&&rc(e)===n}function O5(e,n){return g2(e,n)?!0:n!==void 0&&Ix(e)&&rc(e)==null&&e.triggerCount===1}const h2={open:Ix,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:rc,activeTriggerElement:ze(e=>e.mounted?e.activeTriggerElement:null),popupId:j_,isTriggerActive:ze((e,n)=>n!==void 0&&rc(e)===n),isOpenedByTrigger:ze((e,n)=>g2(e,n)),isMountedByTrigger:ze((e,n)=>n!==void 0&&rc(e)===n&&e.mounted),triggerProps:ze((e,n)=>n?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:ze((e,n)=>O5(e,n)?j_(e):void 0),popupProps:ze(e=>e.popupProps),popupElement:ze(e=>e.popupElement),positionerElement:ze(e=>e.positionerElement)};function x2(e){const{open:n=!1,onOpenChange:s,elements:o={}}=e,l=vf(),c=yf()!=null,d=va(()=>new jf({open:n,transitionStatus:void 0,onOpenChange:s,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new Sf,floatingId:l,syncOnly:!1,nested:c})).current;return Oe(()=>{const f={open:n,floatingId:l};o.reference!==void 0&&(f.referenceElement=o.reference,f.domReferenceElement=ft(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 z5(e={}){const{nodeId:n,externalTree:s}=e,o=x2(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]=x.useState(null),[v,S]=x.useState(void 0),[C,_]=x.useState(void 0),w=x.useRef(null),k=Pl(s),E=x.useMemo(()=>({reference:c,floating:d,domReference:f}),[c,d,f]),N=i5({...e,elements:{...E,...g&&{reference:g}}}),R=ft(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 M=x.useCallback(z=>{const H=ft(z)?{getBoundingClientRect:()=>z.getBoundingClientRect(),getClientRects:()=>z.getClientRects(),contextElement:z}:z;b(H),N.refs.setReference(H)},[N.refs]),O=x.useCallback(z=>{(ft(z)||z===null)&&(w.current=z,S(z)),(ft(N.refs.reference.current)||N.refs.reference.current===null||z!==null&&!ft(z))&&N.refs.setReference(z)},[N.refs,S]),P=x.useCallback(z=>{_(z),N.refs.setFloating(z)},[N.refs]),B=x.useMemo(()=>({...N.refs,setReference:O,setFloating:P,setPositionReference:M,domReference:w}),[N.refs,O,P,M]),L=x.useMemo(()=>({...N.elements,domReference:f}),[N.elements,f]),D=x.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 Oe(()=>{f&&(w.current=f)},[f]),Oe(()=>{l.context.dataRef.current.floatingContext=D;const z=k?.nodesRef.current.find(H=>H.id===n);z&&(z.context=D)}),x.useMemo(()=>({...N,context:D,refs:B,elements:L,rootStore:l}),[N,B,L,D,l])}const hg=rM&&fS;function D5(e,n={}){const{enabled:s=!0,delay:o}=n,l="rootStore"in e?e.rootStore:e,{events:c,dataRef:d}=l.context,f=x.useRef(!1),p=x.useRef(null),m=x.useRef(!0),g=aa();x.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===In(yt(k))&&(f.current=!0)}function _(){m.current=!0}function w(){m.current=!1}return ns(pt(S,"blur",C),hg&&pt(S,"keydown",_,!0),hg&&pt(S,"pointerdown",w,!0))},[l,s]),x.useEffect(()=>{if(!s)return;function v(S){if(S.reason===hc||S.reason===Sx){const C=l.select("domReferenceElement");ft(C)&&(p.current=C,f.current=!0)}}return c.on("openchange",v),()=>{c.off("openchange",v)}},[c,s,l]);const b=x.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(ft(_)){if(hg&&!S.relatedTarget){if(!m.current&&!gf(_))return}else if(!xM(_))return}const w=Dd(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(_d,k,E));return}g.start(N,()=>{f.current||l.setOpen(!0,lt(_d,k,E))})},onBlur(S){v();const C=S.relatedTarget,_=S.nativeEvent,w=ft(C)&&C.hasAttribute(vc("focus-guard"))&&C.getAttribute("data-type")==="outside";g.start(0,()=>{const k=l.select("domReferenceElement"),E=In(yt(k));!C&&E===k||Ze(d.current.floatingContext?.refs.floating.current,E)||Ze(k,E)||w||Dd(C??E,l.context.triggerElements)||l.setOpen(!1,lt(_d,_))})}}},[d,o,l,g]);return x.useMemo(()=>s?{reference:b,trigger:b}:{},[s,b])}class Bx{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 Bx}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const Gd=new WeakMap;function Fd(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&Gd.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),Gd.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function b2(e,n){const{scopeElement:s,referenceElement:o,floatingElement:l}=n,c=Gd.get(s);c&&c!==e&&Fd(c),Fd(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=s,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=l,Gd.set(s,e),s.style.pointerEvents="none",o.style.pointerEvents="auto",l.style.pointerEvents="auto"}function Ux(e){const n=e.context.dataRef.current,s=va(()=>n.hoverInteractionState??Bx.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=s),xx(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function L5(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=Pl(),b=yf(),v=Ux(c),S=aa(),C=Le(()=>xS(m.current.openEvent?.type,v.interactedInside)),_=Le(()=>vM(m.current.openEvent?.type)),w=Le(()=>{Fd(v)});Oe(()=>{d||(v.pointerType=void 0,v.restTimeoutPending=!1,v.interactedInside=!1,w())},[d,v,w]),x.useEffect(()=>w,[w]),Oe(()=>{if(s&&d&&v.handleCloseOptions?.blockPointerEvents&&_()&&ft(p)&&f){const k=p,E=f,N=yt(f),R=g?.nodesRef.current.find(P=>P.id===b)?.context?.elements.floating;R&&(R.style.pointerEvents="");const T=v.pointerEventsScopeElement!==E?v.pointerEventsScopeElement:null,M=R!==E?R:null,O=v.handleCloseOptions?.getScope?.()??T??M??k.closest("[data-rootownerid]")??N.body;return b2(v,{scopeElement:O,referenceElement:k,floatingElement:E}),()=>{w()}}},[s,d,p,f,v,_,g,b,w]),x.useEffect(()=>{if(!s)return;function k(){return!!(g&&b&&Er(g.nodesRef.current,b).length>0)}function E(P){const B=Pd(o,"close",v.pointerType),L=()=>{c.setOpen(!1,lt($n,P)),g?.events.emit("floating.closed",P)};B?v.openChangeTimeout.start(B,L):(v.openChangeTimeout.clear(),L())}function N(P){const B=Tn(P);if(!hM(B)){v.interactedInside=!1;return}v.interactedInside=B?.closest("[aria-haspopup]")!=null}function R(){v.openChangeTimeout.clear(),S.clear(),g?.events.off("floating.closed",M),w()}function T(P){if(k()&&g){g.events.on("floating.closed",M);return}if(Dd(P.relatedTarget,c.context.triggerElements))return;const B=m.current.floatingContext?.nodeId??l,L=P.relatedTarget;if(!(g&&B&&ft(L)&&Er(g.nodesRef.current,B,!1).some(z=>Ze(z.context?.elements.floating,L)))){if(v.handler){v.handler(P);return}w(),C()||E(P)}}function M(P){!g||!b||k()||S.start(0,()=>{g.events.off("floating.closed",M),c.setOpen(!1,lt($n,P)),g.events.emit("floating.closed",P)})}const O=f;return ns(O&&pt(O,"mouseenter",R),O&&pt(O,"mouseleave",T),O&&pt(O,"pointerdown",N,!0),()=>{g?.events.off("floating.closed",M)})},[s,f,c,m,o,l,C,w,v,g,b,S])}const P5={current:null};function I5(e,n={}){const{enabled:s=!0,delay:o=0,handleClose:l=null,mouseOnly:c=!1,restMs:d=0,move:f=!0,triggerElementRef:p=P5,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=Pl(m),E=Ux(C),N=x.useRef(!1),R=mn(l),T=mn(o),M=mn(d),O=mn(s),P=mn(S),B=mn(v),L=Le(()=>xS(_.current.openEvent?.type,E.interactedInside)),D=Le(()=>P.current?.()!==!1),z=Le((Y,V,$)=>{const Z=C.context.triggerElements;if(Z.hasElement(V))return!Y||!Ze(Y,V);if(!ft($))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(()=>{Fd(E)});return g&&(E.handleCloseOptions=R.current?.__options),x.useEffect(()=>H,[H]),x.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]),x.useEffect(()=>{if(!s)return;function Y(G,X=!0){const U=Pd(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(!ft(V))return;function $(G){if(E.openChangeTimeout.clear(),E.blockMouseMove=!1,c&&!co(E.pointerType))return;const X=F1(M.current),U=Pd(T.current,"open",E.pointerType),K=Tn(G),F=G.currentTarget??null,J=C.select("domReferenceElement");let ie=F;if(ft(K)&&!C.context.triggerElements.hasElement(K)){for(const Ne of C.context.triggerElements.elements())if(Ze(Ne,K)){ie=Ne;break}}ft(F)&&ft(J)&&!C.context.triggerElements.hasElement(F)&&Ze(F,J)&&(ie=J);const re=ie==null?!1:z(J,ie,K),oe=C.select("open"),ce=B.current?.()??C.select("transitionStatus")==="ending",ee=!oe&&ce&&N.current,Te=!re&&ft(ie)&&ft(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(Dd(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(),O.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?ns(pt(V,"mousemove",$,{once:!0}),pt(V,"mouseenter",$),pt(V,"mouseleave",Z)):ns(pt(V,"mouseenter",$),pt(V,"mouseleave",Z))},[H,q,_,T,C,s,R,E,g,z,L,c,f,M,p,k,O,b,B,D]),x.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=z(G,Z,V.target);if(c&&!co(E.pointerType))return;if(X&&U&&E.handleCloseOptions?.blockPointerEvents){const J=C.select("floatingElement");if(J){const ie=E.handleCloseOptions?.getScope?.()??Z.ownerDocument.body;b2(E,{scopeElement:ie,referenceElement:Z,floatingElement:J})}}const K=F1(M.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,z,c,C,M,D])}const B5="Escape";function Cf(e,n,s){switch(e){case"vertical":return n;case"horizontal":return s;default:return n||s}}function ed(e,n){return Cf(n,e===jx||e===Tc,e===jr||e===wr)}function xg(e,n,s){return Cf(n,e===Tc,s?e===jr:e===wr)||e==="Enter"||e===" "||e===""}function U5(e,n,s){return Cf(n,s?e===jr:e===wr,e===Tc)}function H5(e,n,s,o){const l=s?e===wr:e===jr,c=e===jx;return n==="both"||n==="horizontal"&&o&&o>1?e===B5:Cf(n,l,c)}function V5(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,M="rootStore"in e?e.rootStore:e,O=M.useState("open"),P=M.useState("floatingElement"),B=M.useState("domReferenceElement"),L=M.context.dataRef,D=Ld(P),z=yh(B),H=mn(D),q=yf(),Y=Pl(T),V=x.useRef(v),$=x.useRef(d??-1),Z=x.useRef(null),G=x.useRef(!0),X=Le(ye=>{l($.current===-1?null:$.current,ye)}),U=x.useRef(X),K=x.useRef(!!P),F=x.useRef(O),J=x.useRef(!1),ie=x.useRef(!1),re=x.useRef(null),oe=mn(_),ce=mn(O),ee=mn(d),Te=mn(R),Fe=jl(),ve=jl(),Ce=Le(()=>{function ye(Ue){b?Y?.events.emit("virtualfocus",Ue):re.current=wd(Ue,{sync:J.current,preventScroll:!0})}const le=s.current[$.current],_e=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&&(_e||!G.current)&&Ue.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Oe(()=>{L.current.orientation=w},[L,w]),Oe(()=>{c&&(O&&P?($.current=d??-1,V.current&&d!=null&&(ie.current=!0,X())):K.current&&($.current=-1,U.current()))},[c,O,P,d,X]),Oe(()=>{if(c){if(!O){J.current=!1;return}if(P)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||xg(Z.current,w,g)||m?jd(s):wh(s),Z.current=null,X())};le()}}else bc(s.current,o)||($.current=o,Ce(),ie.current=!1)}},[c,O,P,o,ee,m,s,w,g,X,Ce,ve]),Oe(()=>{if(!c||P||!Y||b||!K.current)return;const ye=Y.nodesRef.current,le=ye.find(Ue=>Ue.id===q)?.context?.elements.floating,_e=In(yt(P)),Se=ye.some(Ue=>Ue.context&&Ze(Ue.context.elements.floating,_e));le&&!Se&&G.current&&le.focus({preventScroll:!0})},[c,P,Y,q,b]),Oe(()=>{U.current=X,F.current=O,K.current=!!P}),Oe(()=>{O||(Z.current=null,V.current=v)},[O,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(()=>jd(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&&H5(ye.key,w,g,E)){ed(ye.key,Ie())||xa(ye),M.setOpen(!1,lt(Y1,ye.nativeEvent)),Gt(B)&&(b?Y?.events.emit("virtualfocus",B):B.focus());return}const le=$.current,_e=jd(s,_),Se=wh(s,_);if(z||(ye.key==="Home"&&(xa(ye),$.current=_e,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=ES(Ue,E,!1),_t=Je.findIndex(Ee=>Ee!=null&&!Ls(s.current,Ee,_)),zt=Je.reduce((Ee,Re,qe)=>Re!=null&&!Ls(s.current,Re,_)?qe:Ee,-1),pe=Je[kS(Je.map(Ee=>Ee!=null?s.current[Ee]:null),{event:ye,orientation:w,loopFocus:p,rtl:g,cols:E,disabledIndices:RS([...(typeof _!="function"?_:null)||s.current.map((Ee,Re)=>Ls(s.current,Re,_)?Re:void 0),void 0],Je),minIndex:_t,maxIndex:zt,prevIndex:NS($.current>Se?_e:$.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),O&&!b&&In(ye.currentTarget.ownerDocument)===ye.currentTarget){$.current=xg(ye.key,w,g)?_e:Se,X(ye);return}xg(ye.key,w,g)?p?le>=Se?f&&le!==s.current.length?$.current=-1:(J.current=!1,$.current=_e):$.current=Pn(s.current,{startingIndex:le,disabledIndices:_}):$.current=Math.min(Se,Pn(s.current,{startingIndex:le,disabledIndices:_})):p?le<=_e?f&&le!==-1?$.current=s.current.length:(J.current=!1,$.current=Se):$.current=Pn(s.current,{startingIndex:le,decrement:!0,disabledIndices:_}):$.current=Math.max(_e,Pn(s.current,{startingIndex:le,decrement:!0,disabledIndices:_})),bc(s.current,$.current)&&($.current=-1),X(ye)}}),we=x.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 _e=le.relatedTarget;if(!(!S||s.current.includes(_e))&&Te.current&&(re.current?.(),re.current=null,$.current=-1,X(le),!b)){const Se=H.current,Ue=In(yt(Se));Se&&Ze(Se,Ue)&&Se.focus({preventScroll:!0})}}}),[Pe,ce,H,S,s,X,Te,b]),Be=x.useMemo(()=>b&&O&&Ne&&{"aria-activedescendant":`${N}-${o}`},[b,O,Ne,N,o]),Xe=x.useMemo(()=>({"aria-orientation":w==="both"?void 0:w,...z?{}:Be,onKeyDown(ye){if(ye.key==="Tab"&&ye.shiftKey&&O&&!b){const le=Tn(ye.nativeEvent);if(le&&!Ze(H.current,le))return;xa(ye),M.setOpen(!1,lt(hf,ye.nativeEvent)),Gt(B)&&B.focus();return}Ae(ye)},onPointerMove(){G.current=!0}}),[Be,Ae,H,w,z,M,O,b,B]),Ye=x.useMemo(()=>{function ye(Se){M.setOpen(!0,lt(Y1,Se.nativeEvent,Se.currentTarget))}function le(Se){v==="auto"&&vx(Se.nativeEvent)&&(V.current=!b)}function _e(Se){V.current=v,v==="auto"&&mS(Se.nativeEvent)&&(V.current=!0)}return{onKeyDown(Se){const Ue=M.select("open");G.current=!1;const Je=Se.key.startsWith("Arrow"),_t=U5(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){M.select("open")&&!b&&($.current=-1,X(Se))},onPointerDown:_e,onPointerEnter:_e,onMouseDown:le,onClick:le}},[Ae,v,be,m,X,M,C,w,Ie,g,ee,b]),De=x.useMemo(()=>({...Be,...Ye}),[Be,Ye]);return x.useMemo(()=>c?{reference:De,floating:Xe,item:we,trigger:Ye}:{},[c,De,Xe,Ye,we])}function q5(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=aa(),S=x.useRef(""),C=x.useRef(m??l??-1),_=x.useRef(null),w=Le(N=>{function R(z){const H=o?.current[z];return!H||xf(H)}function T(z,H,q=0){if(z.length===0)return-1;const Y=(q%z.length+z.length)%z.length,V=H.toLocaleLowerCase();for(let $=0;$<z.length;$+=1){const Z=(Y+$)%z.length;if(!(!z[Z]?.toLocaleLowerCase().startsWith(V)||!R(Z)))return Z}return-1}const M=s.current;if(S.current.length>0&&N.key===" "&&(xa(N),d?.(!0)),S.current.length>0&&S.current[0]!==" "&&T(M,S.current)===-1&&N.key!==" "&&d?.(!1),M==null||N.key.length!==1||N.ctrlKey||N.metaKey||N.altKey)return;b&&N.key!==" "&&(xa(N),d?.(!0));const O=S.current==="";O&&(C.current=m??l??-1),M.every(z=>z?z[0]?.toLocaleLowerCase()!==z[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=((O?m??l??-1:C.current)??0)+1,D=T(M,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"),M=g.select("floatingElement");Ze(T,R)||Ze(M,R)||(v.clear(),S.current="",C.current=_.current,d?.(!1))});Oe(()=>{!b&&m!==null||(v.clear(),_.current=null,S.current!==""&&(S.current=""))},[b,m,v]),Oe(()=>{b&&S.current===""&&(C.current=m??l??-1)},[b,m,l]);const E=x.useMemo(()=>({onKeyDown:w,onBlur:k}),[w,k]);return x.useMemo(()=>f?{reference:E,floating:E}:{},[f,E])}const w_=.1,$5=w_*w_,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 G5(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 F5(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 M=E-S,O=N-C,P=M*M+O*O,B=T*T*$5;return S=E,C=N,_=R,P<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:M,clientY:O}=N,P=Tn(N),B=N.type==="mouseleave",L=Ze(T,P),D=Ze(R,P);if(L&&(v=!0,!B))return;if(D&&(v=!1,!B)){v=!0;return}if(B&&ft(N.relatedTarget)&&Ze(T,N.relatedTarget))return;function z(){return!!(g&&Er(g.nodesRef.current,m).length>0)}function H(){z()||k()}if(z())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(M,O,X,q.top+1,U,Y.bottom-1);break;case"bottom":J=ad(M,O,X,Y.top+1,U,q.bottom-1);break;case"left":J=ad(M,O,Y.right-1,F,q.left+1,K);break;case"right":J=ad(M,O,q.right-1,F,Y.left+1,K);break}if(J)return;if(v&&!G5(M,O,q)){H();return}if(!B&&w(M,O)){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(M,O,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(M,O,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(M,O,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(M,O,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 Y5={...h2,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 Hx extends Px{constructor(n,s,o=!1){const l=new Sf,c={...X5(),...n};c.floatingRootContext=m2(l,s,o),super(c,{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:l},Y5)}setOpen=(n,s)=>{const o=s.reason,l=o===$n,c=n&&o===_d,d=!n&&(o===hc||o===Sx);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),c2(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 i2(n,(l,c)=>new Hx(s,l,c)).store}}function X5(){return{...p2(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}const K5=lS(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=Hx.useStore(g?.store,{open:o,openProp:l,activeTriggerId:v,triggerIdProp:b});hx(()=>{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),u2(C);const{forceUnmount:R,transitionStatus:T}=d2(w,C),M=C.useState("isInstantPhase"),O=C.useState("instantType"),P=C.useState("lastOpenChangeReason"),B=x.useRef(null);Oe(()=>{_&&s&&C.setOpen(!1,lt(bS))},[_,s,C]),Oe(()=>{T==="ending"&&P===Us||T!=="ending"&&M?(O!=="delay"&&(B.current=O),C.set("instantType","delay")):B.current!==null&&(C.set("instantType",B.current),B.current=null)},[T,M,P,O,C]),Oe(()=>{w&&k==null&&C.set("payload",void 0)},[C,k,w]);const L=x.useCallback(()=>{C.setOpen(!1,lt(vS))},[C]);x.useImperativeHandle(f,()=>({unmount:R,close:L}),[R,L]);const D=w||E||!s&&d!=="none";return r.jsxs(iS.Provider,{value:C,children:[D&&r.jsx(Q5,{store:C,disabled:s,trackCursorAxis:d}),typeof S=="function"?S({payload:N}):S]})});function Q5({store:e,disabled:n,trackCursorAxis:s}){const o=e.useState("floatingRootContext"),l=Dx(o,{enabled:!n,referencePress:()=>e.select("closeOnClick")}),c=C3(o,{enabled:!n&&s!=="none",axis:s==="none"?void 0:s}),d=x.useMemo(()=>Oa(c.reference,l.reference),[c.reference,l.reference]),f=x.useMemo(()=>Oa(c.trigger,l.trigger),[c.trigger,l.trigger]),p=x.useMemo(()=>Oa(wf,c.floating,l.floating),[c.floating,l.floating]);return f2(e,{activeTriggerProps:d,inactiveTriggerProps:f,popupProps:p}),null}let ro=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=fo.startingStyle]="startingStyle",e[e.endingStyle=fo.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),Yd=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const Z5={[Yd.popupOpen]:""},W5={[Yd.popupOpen]:"",[Yd.pressed]:""},J5={[ro.open]:""},e4={[ro.closed]:""},t4={[ro.anchorHidden]:""},v2={open(e){return e?Z5:null}},n4={open(e){return e?W5:null}},Bl={open(e){return e?J5:e4},anchorHidden(e){return e?t4:null}};function Or(e){return vf(e,"base-ui")}const y2=x.createContext(void 0);function a4(){return x.useContext(y2)}let s4=(function(e){return e[e.popupOpen=Yd.popupOpen]="popupOpen",e.triggerDisabled="data-trigger-disabled",e})({});const r4=600,_2="data-base-ui-tooltip-trigger";function S_(e){if("composedPath"in e){const s=e.composedPath();for(let o=0;o<s.length;o+=1){const l=s[o];if(ft(l))return l}}const n=e.target;return ft(n)?n:null}function o4(e){let n=e;for(;n;){if(n.hasAttribute(_2))return n;const s=n.parentElement;if(s){n=s;continue}const o=n.getRootNode();n="host"in o&&ft(o.host)?o.host:null}return null}const l4=eM(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(On(82));const w=Or(v),k=_.useState("isTriggerActive",w),E=_.useState("isOpenedByTrigger",w),N=_.useState("floatingRootContext"),R=x.useRef(null),T=m??r4,M=b??0,{registerTrigger:O,isMountedByThisTrigger:P}=T5(w,R,_,{payload:f,closeOnClick:g,closeDelay:M}),B=a4(),{delayRef:L,isInstantPhase:D,hasProvider:z}=SM(N,{open:E}),H=Ux(N);_.useSyncedValue("isInstantPhase",D);const q=_.useState("disabled"),Y=p??q,V=mn(Y),$=_.useState("trackCursorAxis"),Z=_.useState("disableHoverablePopup"),G=x.useRef(!1),X=aa(),U=x.useRef(void 0);function K(){const ve=B?.delay,Ce=typeof L.current=="object"?L.current.open:void 0;let Ne=T;return z&&(Ce!==0?Ne=m??ve??T:Ne=0),Ne}function F(ve){const Ce=R.current;if(!Ce||!ve)return!1;const Ne=o4(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=I5(N,{enabled:!Y,mouseOnly:!0,move:!1,handleClose:!Z&&$!=="both"?F5():null,restMs:K,delay(){const ve=typeof L.current=="object"?L.current.close:void 0;let Ce=M;return b==null&&z&&(Ce=ve),{close:Ce}},triggerElementRef:R,isActiveTrigger:k,isClosing:()=>_.select("transitionStatus")==="ending",shouldOpen(){return!G.current}}),re=D5(N,{enabled:!Y}).reference,oe=ve=>{const Ce=G.current,Ne=S_(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&&co(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",P);return Ht("button",n,{state:{open:E},ref:[s,O,R],props:[ie,re,P||$!=="none"?ce:void 0,{onMouseOver(ve){oe(ve.nativeEvent)},onFocus(ve){F(S_(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,[s4.triggerDisabled]:Y?"":void 0,[_2]:Y?void 0:""},S],stateAttributesMapping:v2})}),j2=x.createContext(void 0);function i4(){const e=x.useContext(j2);if(e===void 0)throw new Error(On(70));return e}const c4=x.forwardRef(function(n,s){const{children:o,container:l,className:c,render:d,style:f,...p}=n,{portalNode:m,portalSubtree:g}=XS({container:l,ref:s,componentProps:n,elementProps:p});return!g&&!m?null:r.jsxs(x.Fragment,{children:[g,m&&Rr.createPortal(o,m)]})}),u4=x.forwardRef(function(n,s){const{keepMounted:o=!1,...l}=n;return Rc().useState("mounted")||o?r.jsx(j2.Provider,{value:o,children:r.jsx(c4,{ref:s,...l})}):null}),w2=x.createContext(void 0);function S2(){const e=x.useContext(w2);if(e===void 0)throw new Error(On(71));return e}const d4=x.createContext(void 0);function Vx(){return x.useContext(d4)?.direction??"ltr"}const f4=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"}=Vs(e,n)||{};if(m==null)return{};const v=CS(g),S={x:s,y:o},C=Rx(l),_=Nx(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[_],M=S[C]-c.reference[C],O=b==="real"?await d.getOffsetParent?.(m):f.floating;let P=f.floating[R]||c.floating[_];(!P||!await d.isElement?.(O))&&(P=f.floating[R]||c.floating[_]);const B=T/2-M/2,L=P/2-w[_]/2-1,D=Math.min(v[E],L),z=Math.min(v[N],L),H=D,q=P-w[_]-z,Y=P/2-w[_]/2+B,V=_h(H,Y,q),$=!p.arrow&&Ar(l)!=null&&Y!==V&&c.reference[_]/2-(Y<H?D:z)-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:$}}}),p4=(e,n)=>({...f4(e),options:[e,n]}),m4={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 m5().fn(e)).data?.referenceHidden||c}}}},Cd={sideX:"left",sideY:"top"},g4={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:Cd};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=sa(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":Cd.sideX,k=S==="top"?"bottom":Cd.sideY;return{x:C,y:_,data:{sideX:w,sideY:k}}}};function C2(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 C_(e,n,s){const{rects:o,placement:l}=e;return{side:C2(n,sa(l),s),align:Ar(l)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function k2(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,[M,O]=x.useState(null);!_&&M!==null&&O(null);const P=w.side||"flip",B=w.align||"flip",L=w.fallbackAxisSide||"end",D=typeof n=="function"?n:void 0,z=Le(D),H=D?z:n,q=mn(n),Y=mn(_),$=Vx()==="rtl",Z=M||{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=x.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(c5(mt=>{const Nt=C_(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"&&P!=="shift",Ne=!Ce&&(m||k||P==="shift"),Pe=P==="none"?null:f5({...re,padding:{top:X.top+U,right:X.right+U,bottom:X.bottom+U,left:X.left+U},mainAxis:!k&&P==="flip",crossAxis:B==="flip"?"alignment":!1,fallbackAxisSideDirection:L}),Ie=Ce?null:u5(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:d5(Wt=>{if(!oe.current)return{};const{width:St,height:an}=oe.current.getBoundingClientRect(),Ft=Aa(sa(Wt.placement)),dn=Ft==="y"?St:an,zn=Ft==="y"?X.left+X.right:X.top+X.bottom;return{offset:dn/2+zn/2}})}},[re,m,k,X,B]);P==="shift"||B==="shift"||c==="center"?ve.push(Ie,Pe):ve.push(Pe,Ie),ve.push(p5({...re,apply({elements:{floating:mt},availableWidth:Nt,availableHeight:Wt,rects:St}){if(!Y.current)return;const an=mt.style;an.setProperty("--available-width",`${Nt}px`),an.setProperty("--available-height",`${Wt}px`);const Ft=Qt(mt).devicePixelRatio||1,{x:dn,y:zn,width:Xn,height:ia}=St.reference,Kn=(Math.round((dn+Xn)*Ft)-Math.round(dn*Ft))/Ft,cs=(Math.round((zn+ia)*Ft)-Math.round(zn*Ft))/Ft;an.setProperty("--anchor-width",`${Kn}px`),an.setProperty("--anchor-height",`${cs}px`)}}),p4(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:an,y:Ft}=mt,dn=sa(St),zn=Aa(dn),Xn=oe.current,ia=Wt.arrow?.x||0,Kn=Wt.arrow?.y||0,cs=Xn?.clientWidth||0,Dn=Xn?.clientHeight||0,ca=ia+cs/2,Pa=Kn+Dn/2,us=Math.abs(Wt.shift?.y||0),ct=an.reference.height/2,Dt=typeof l=="function"?l(C_(mt,o,$)):l,Sn=us>Dt,sn={top:`${ca}px calc(100% + ${Dt}px)`,bottom:`${ca}px ${-Dt}px`,left:`calc(100% + ${Dt}px) ${Pa}px`,right:`${-Dt}px ${Pa}px`}[dn],Rt=`${ca}px ${an.reference.y+ct-Ft}px`;return Nt.floating.style.setProperty("--transform-origin",Ne&&zn==="y"&&Sn?Rt:sn),{}}},m4,N),Oe(()=>{!_&&C&&C.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[_,C]);const be=x.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:_e,floatingStyles:Se}=z5({rootContext:C,open:S?_:void 0,placement:G,middleware:ve,strategy:s,whileElementsMounted:S?void 0:(...mt)=>h_(...mt,be),nodeId:E,externalTree:T}),{sideX:Ue,sideY:Je}=Ye.adaptiveOrigin||Cd,_t=_e?s:"fixed",zt=x.useMemo(()=>{const mt=N?{position:_t,[Ue]:Be,[Je]:Xe}:{position:_t,...Se};return _e||(mt.opacity=0),mt},[N,_t,Ue,Be,Je,Xe,Se,_e]),pe=x.useRef(null);Oe(()=>{if(!_)return;const mt=q.current,Nt=typeof mt=="function"?mt():mt,St=(k_(Nt)?Nt.current:Nt)||null||null;St!==pe.current&&(Ae.setPositionReference(St),pe.current=St)},[_,Ae,H,q]),x.useEffect(()=>{if(!_)return;const mt=q.current;typeof mt!="function"&&k_(mt)&&mt.current!==pe.current&&(Ae.setPositionReference(mt.current),pe.current=mt.current)},[_,Ae,H,q]),x.useEffect(()=>{if(S&&_&&we.domReference&&we.floating)return h_(we.domReference,we.floating,De,be)},[S,_,we,De,be]);const Ee=sa(ye),Re=C2(o,Ee,$),qe=Ar(ye)||"center",st=!!Ye.hide?.referenceHidden;Oe(()=>{R&&_&&_e&&O(Ee)},[R,_,_e,Ee]);const nn=x.useMemo(()=>({position:"absolute",top:Ye.arrow?.y,left:Ye.arrow?.x}),[Ye.arrow]),Vt=Ye.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:zt,arrowStyles:nn,arrowRef:oe,arrowUncentered:Vt,side:Re,align:qe,physicalSide:Ee,anchorHidden:st,refs:Ae,context:le,isPositioned:_e,update:De}),[zt,nn,oe,Vt,Re,qe,Ee,st,Ae,le,_e,De])}function k_(e){return e!=null&&"current"in e}function qx(e){return e==="starting"?d3:cn}function E2(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},qx(o),l],stateAttributesMapping:Bl})}const h4=x.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=m3,style:k,...E}=n,N=Rc(),R=i4(),T=N.useState("open"),M=N.useState("mounted"),O=N.useState("trackCursorAxis"),P=N.useState("disableHoverablePopup"),B=N.useState("floatingRootContext"),L=N.useState("instantType"),D=N.useState("transitionStatus"),z=N.useState("hasViewport"),H=k2({anchor:c,positionMethod:d,floatingRootContext:B,mounted:M,side:f,sideOffset:m,align:p,alignOffset:g,collisionBoundary:b,collisionPadding:v,sticky:C,arrowPadding:S,disableAnchorTracking:_,keepMounted:R,collisionAvoidance:w,adaptiveOrigin:z?g4:void 0}),q=x.useMemo(()=>({open:T,side:H.side,align:H.align,anchorHidden:H.anchorHidden,instant:O!=="none"?"tracking-cursor":L}),[T,H.side,H.align,H.anchorHidden,O,L]),Y=E2(n,q,{styles:H.positionerStyles,transitionStatus:D,props:E,refs:[s,N.useStateSetter("positionerElement")],hidden:!M,inert:!T||O==="both"||P});return r.jsx(w2.Provider,{value:H,children:Y})}),x4={...Bl,...Il},b4=x.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,f=Rc(),{side:p,align:m}=S2(),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");Mr({open:g,ref:f.context.popupRef,onComplete(){g&&f.context.onOpenChangeComplete?.(!0)}}),L5(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,qx(v),d],stateAttributesMapping:x4})}),v4=x.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}=S2(),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:Bl})}),y4=function(n){const{delay:s,closeDelay:o,timeout:l=400}=n,c=x.useMemo(()=>({delay:s,closeDelay:o}),[s,o]),d=x.useMemo(()=>({open:s,close:o}),[s,o]);return r.jsx(y2.Provider,{value:c,children:r.jsx(wM,{delay:d,timeoutMs:l,children:n.children})})};function $x(e){return Ax(19)?e:e?"true":void 0}function _4(e){const[n,s]=x.useState({current:e,previous:null});return e!==n.current&&s({current:e,previous:n.current}),n.previous}function Ot(...e){return oS(mx(e))}function j4({delay:e=0,...n}){return r.jsx(y4,{"data-slot":"tooltip-provider",delay:e,...n})}function Gx({...e}){return r.jsx(K5,{"data-slot":"tooltip",...e})}function Fx({...e}){return r.jsx(l4,{"data-slot":"tooltip-trigger",...e})}function Yx({className:e,side:n="top",sideOffset:s=4,align:o="center",alignOffset:l=0,children:c,...d}){return r.jsx(u4,{children:r.jsx(h4,{align:o,alignOffset:l,side:n,sideOffset:s,className:"isolate z-50",children:r.jsxs(b4,{"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(v4,{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 Pi({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}=w4(m),v=o||l?"indigo":C4(m),S=b&&!o&&!l&&!c;return r.jsxs(Gx,{children:[r.jsx(Fx,{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:Me("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&&R4(v),!o&&!l&&!c&&!n&&N4(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(Yx,{side:"right",children:f||e})]})}function w4(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:S4(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 S4(e){return e.length>6?e.slice(0,5)+"…":e}function C4(e){let n=0;for(let s=0;s<e.length;s++)n=n*31+e.charCodeAt(s)|0;return V1[Math.abs(n)%V1.length]}const k4={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"},E4={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 N4(e){return k4[e]}function R4(e){return E4[e]}function Mt({content:e,side:n="top",children:s}){return e?r.jsxs(Gx,{children:[r.jsx(Fx,{render:s}),r.jsx(Yx,{side:n,children:e})]}):s}const N2=0,R2=1,T2=2,E_=3;var N_=Object.prototype.hasOwnProperty;function Eh(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--&&Eh(e[o],n[o]););return o===-1}if(!s||typeof e=="object"){o=0;for(s in e)if(N_.call(e,s)&&++o&&!N_.call(n,s)||!(s in n)||!Eh(e[s],n[s]))return!1;return Object.keys(n).length===o}}return e!==e&&n!==n}const Os=new WeakMap,zs=()=>{},Hn=zs(),Nh=Object,vt=e=>e===Hn,Ja=e=>typeof e=="function",Nr=(e,n)=>({...e,...n}),A2=e=>Ja(e.then),bg={},sd={},Xx="undefined",Mc=typeof window!=Xx,Rh=typeof document!=Xx,T4=Mc&&"Deno"in window,A4=()=>Mc&&typeof window.requestAnimationFrame!=Xx,M2=(e,n)=>{const s=Os.get(e);return[()=>!vt(n)&&e.get(n)||bg,o=>{if(!vt(n)){const l=e.get(n);n in sd||(sd[n]=l),s[5](n,Nr(l,o),l||bg)}},s[6],()=>!vt(n)&&n in sd?sd[n]:!vt(n)&&e.get(n)||bg]};let Th=!0;const M4=()=>Th,[Ah,Mh]=Mc&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[zs,zs],O4=()=>{const e=Rh&&document.visibilityState;return vt(e)||e!=="hidden"},z4=e=>(Rh&&document.addEventListener("visibilitychange",e),Ah("focus",e),()=>{Rh&&document.removeEventListener("visibilitychange",e),Mh("focus",e)}),D4=e=>{const n=()=>{Th=!0,e()},s=()=>{Th=!1};return Ah("online",n),Ah("offline",s),()=>{Mh("online",n),Mh("offline",s)}},L4={isOnline:M4,isVisible:O4},P4={initFocus:z4,initReconnect:D4},R_=!Cc.useId,hl=!Mc||T4,I4=e=>A4()?window.requestAnimationFrame(e):setTimeout(e,1),vg=hl?x.useEffect:x.useLayoutEffect,yg=typeof navigator<"u"&&navigator.connection,T_=!hl&&yg&&(["slow-2g","2g"].includes(yg.effectiveType)||yg.saveData),rd=new WeakMap,B4=e=>Nh.prototype.toString.call(e),_g=(e,n)=>e===`[object ${n}]`;let U4=0;const Oh=e=>{const n=typeof e,s=B4(e),o=_g(s,"Date"),l=_g(s,"RegExp"),c=_g(s,"Object");let d,f;if(Nh(e)===e&&!o&&!l){if(d=rd.get(e),d)return d;if(d=++U4+"~",rd.set(e,d),Array.isArray(e)){for(d="@",f=0;f<e.length;f++)d+=Oh(e[f])+",";rd.set(e,d)}if(c){d="#";const p=Nh.keys(e).sort();for(;!vt(f=p.pop());)vt(e[f])||(d+=f+":"+Oh(e[f])+",");rd.set(e,d)}}else d=o?e.toJSON():n=="symbol"?e.toString():n=="string"?JSON.stringify(e):""+e;return d},Kx=e=>{if(Ja(e))try{e=e()}catch{e=""}const n=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Oh(e):"",[e,n]};let H4=0;const zh=()=>++H4;async function O2(...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(Ja(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]=Kx(v);if(!S)return;const[C,_]=M2(n,S),[w,k,E,N]=Os.get(n),R=()=>{const q=w[S];return(Ja(c.revalidate)?c.revalidate(C().data,v):c.revalidate!==!1)&&(delete E[S],delete N[S],q&&q[0])?q[0](T2).then(()=>C().data):C().data};if(e.length<3)return R();let T=o,M,O=!1;const P=zh();k[S]=[P,0];const B=!vt(p),L=C(),D=L.data,z=L._c,H=vt(z)?D:z;if(B&&(p=Ja(p)?p(H,D):p,_({data:p,_c:H})),Ja(T))try{T=T(H)}catch(q){M=q,O=!0}if(T&&A2(T))if(T=await T.catch(q=>{M=q,O=!0}),P!==k[S][0]){if(O)throw M;return T}else O&&B&&m(M)&&(d=!0,_({data:H,_c:Hn}));if(d&&!O)if(Ja(d)){const q=d(T,H);_({data:q,error:Hn,_c:Hn})}else _({data:T,error:Hn,_c:Hn});if(k[S][1]=zh(),Promise.resolve(R()).then(()=>{_({_c:Hn})}),O){if(g)throw M;return}return T}}const A_=(e,n)=>{for(const s in e)e[s][0]&&e[s][0](n)},V4=(e,n)=>{if(!Os.has(e)){const s=Nr(P4,n),o=Object.create(null),l=O2.bind(Hn,e);let c=zs;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(!Os.has(e)&&(Os.set(e,[o,Object.create(null),Object.create(null),Object.create(null),l,p,f]),!hl)){const g=s.initFocus(setTimeout.bind(Hn,A_.bind(Hn,o,N2))),b=s.initReconnect(setTimeout.bind(Hn,A_.bind(Hn,o,R2)));c=()=>{g&&g(),b&&b(),Os.delete(e)}}};return m(),[e,l,m,c]}return[e,Os.get(e)[4]]},q4=(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)},$4=Eh,[z2,G4]=V4(new Map),F4=Nr({onLoadingSlow:zs,onSuccess:zs,onError:zs,onErrorRetry:q4,onDiscarded:zs,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:T_?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:T_?5e3:3e3,compare:$4,isPaused:()=>!1,cache:z2,mutate:G4,fallback:{}},L4),Y4=(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},X4=x.createContext({}),K4="$inf$",D2=Mc&&window.__SWR_DEVTOOLS_USE__,Q4=D2?window.__SWR_DEVTOOLS_USE__:[],Z4=()=>{D2&&(window.__SWR_DEVTOOLS_REACT__=Cc)},W4=e=>Ja(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],L2=()=>{const e=x.useContext(X4);return x.useMemo(()=>Nr(F4,e),[e])},J4=e=>(n,s,o)=>e(n,s&&((...c)=>{const[d]=Kx(n),[,,,f]=Os.get(z2);if(d.startsWith(K4))return s(...c);const p=f[d];return vt(p)?s(...c):(delete f[d],p)}),o),eO=Q4.concat(J4),tO=e=>function(...s){const o=L2(),[l,c,d]=W4(s),f=Y4(o,d);let p=e;const{use:m}=f,g=(m||[]).concat(eO);for(let b=g.length;b--;)p=g[b](p);return p(l,c||f.fetcher||null,f)},nO=(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())}};Z4();const jg=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}}),wg={dedupe:!0},M_=Promise.resolve(Hn),aO=()=>zs,sO=(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]=Os.get(o),[E,N]=Kx(e),R=x.useRef(!1),T=x.useRef(!1),M=x.useRef(E),O=x.useRef(n),P=x.useRef(s),B=()=>P.current,L=()=>B().isVisible()&&B().isOnline(),[D,z,H,q]=M2(o,E),Y=x.useRef({}).current,V=vt(d)?vt(s.fallback)?Hn: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=x.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 _e=vt(V)?ye.data:V;return vt(_e)||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=$d.useSyncExternalStore(x.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&&A2(V)?jg(V):V:K,J=X.error,ie=x.useRef(F),re=v?vt(K)?vt(ie.current)?F:ie.current:K:F,oe=E&&vt(F),ce=x.useRef(null);!hl&&$d.useSyncExternalStore(aO,()=>(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=x.useCallback(async be=>{const Ae=O.current;if(!E||!Ae||T.current||B().isPaused())return!1;let we,Be,Xe=!0;const Ye=be||{},De=!w[E]||!Ye.dedupe,ye=()=>R_?!T.current&&E===M.current&&R.current:E===M.current,le={isValidating:!1,isLoading:!1},_e=()=>{z(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&&(z(Ue),s.loadingTimeout&&vt(D().data)&&setTimeout(()=>{Xe&&ye()&&B().onLoadingSlow(E,s)},s.loadingTimeout),w[E]=[Ae(N),zh()]),[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=Hn;const Je=_[E];if(!vt(Je)&&(Be<=Je[0]||Be<=Je[1]||Je[1]===0))return _e(),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||Ja(zt)&&zt(Je))&&(!B().revalidateOnFocus||!B().revalidateOnReconnect||L())&&_t.onErrorRetry(Je,E,_t,pe=>{const Ee=C[E];Ee&&Ee[0]&&Ee[0](E_,pe)},{retryCount:(Ye.retryCount||0)+1,dedupe:!0})))}return Xe=!1,_e(),!0},[E,o]),Pe=x.useCallback((...be)=>O2(o,M.current,...be),[]);if(vg(()=>{O.current=n,P.current=s,vt(K)||(ie.current=K)}),vg(()=>{if(!E)return;const be=Ne.bind(Hn,wg);let Ae=0;B().revalidateOnFocus&&(Ae=Date.now()+B().focusThrottleInterval);const Be=nO(E,C,(Xe,Ye={})=>{if(Xe==N2){const De=Date.now();B().revalidateOnFocus&&De>Ae&&L()&&(Ae=De+B().focusThrottleInterval,be())}else if(Xe==R2)B().revalidateOnReconnect&&L()&&be();else{if(Xe==T2)return Ne();if(Xe==E_)return Ne(Ye)}});return T.current=!1,M.current=E,R.current=!0,z({_k:N}),Te&&(w[E]||(vt(F)||hl?be():I4(be))),()=>{T.current=!0,Be()}},[E]),vg(()=>{let be;function Ae(){const Be=Ja(m)?m(D().data):m;Be&&be!==-1&&(be=setTimeout(we,Be))}function we(){!D().error&&(g||B().isVisible())&&(b||B().isOnline())?Ne(wg).then(Ae):Ae()}return Ae(),()=>{be&&(clearTimeout(be),be=-1)}},[m,g,b,E]),x.useDebugValue(re),c){if(!R_&&hl&&oe)throw new Error("Fallback data is required when using Suspense in SSR.");oe&&(O.current=n,P.current=s,T.current=!1);const be=k[E],Ae=!vt(be)&&oe?Pe(be):M_;if(jg(Ae),!vt(J)&&oe)throw J;const we=oe?Ne(wg):M_;!vt(re)&&oe&&(we.status="fulfilled",we.value=!0),jg(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}}},Ke=tO(sO);let Sl=null;function ao(e){Sl=e}function Qx(){return Sl}class Oc extends Error{status;body;constructor(n,s,o){super(s),this.status=n,this.body=o}}async function Ii(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=>Ii("GET",e),post:(e,n)=>Ii("POST",e,n),put:(e,n)=>Ii("PUT",e,n),patch:(e,n)=>Ii("PATCH",e,n),del:e=>Ii("DELETE",e)};async function P2(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(`
582
- `);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(`
583
- `)}}if(f.trim())try{s(JSON.parse(f.trim()))}catch{}}const rO={get:()=>me.get("/health")},na={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})}},en={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})},Zx={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}`)},Sg=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}`:""},Dh={global:(e={})=>me.get(`/messages/global${Sg(e)}`),project:(e,n={})=>me.get(`/projects/${e}/messages${Sg(n)}`),search:(e,n,s=50)=>me.get(`/projects/${e}/messages/search${Sg({q:n,limit:s})}`)},oO={global:e=>me.get(`/sessions${e?`?engine=${encodeURIComponent(e)}`:""}`)},lO={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)},Xd={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)},O_={get:()=>me.get("/identity"),patch:e=>me.patch("/identity",e)},I2={send:(e,n)=>me.post(`/projects/${e}/super-agent/chat`,n),stream:(e,n,s,o)=>P2(`/projects/${e}/super-agent/chat/stream`,n,s,o),summarize:e=>me.post("/super-agent/summarize",e)},iO={dirs:e=>me.get(`/admin/fs/dirs?path=${encodeURIComponent(e)}`)},cO=["alloy","echo","fable","onyx","nova","shimmer"],uO=["Kore","Puck","Charon","Fenrir","Aoede"],dO=["eleven_multilingual_v2","eleven_turbo_v2_5","eleven_flash_v2_5"],fO=["tts-1","tts-1-hd"],pO=["tiny","base","small","medium","large-v2","large-v3"],Kd={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 mO(e){const n=Qx(),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 B2={providers:()=>me.get("/tts/providers"),say:e=>me.post("/tts/say",e),turn:e=>me.post("/voice/turn",e)},z_={manifest:()=>me.get("/deck/manifest"),setWidget:(e,n)=>me.patch(`/deck/widgets/${encodeURIComponent(e)}`,n),exec:e=>me.post("/deck/exec",e)},eo=e=>`/projects/${e}/code/sessions`,Ts={sessions:{list:e=>me.get(eo(e)).then(n=>n.sessions),get:(e,n)=>me.get(`${eo(e)}/${n}`),create:(e,n={})=>me.post(eo(e),n),update:(e,n,s)=>me.patch(`${eo(e)}/${n}`,s),remove:(e,n)=>me.del(`${eo(e)}/${n}`)},changes:(e,n)=>me.get(`${eo(e)}/${n}/changes`),stream:(e,n,s,o,l)=>P2(`${eo(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}=Ke("/projects",()=>na.list(),{refreshInterval:uf.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 Wx(e){const{projects:n,isLoading:s,mutate:o}=zc();return{project:n.find(c=>String(c.id)===e)??null,isLoading:s,mutate:o}}const gO={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",threads:"Chats",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).",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"},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
584
-
585
- 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"}},hO={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",threads:"Chats",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).",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"},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
586
-
587
- 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"}},Jx={es:gO,en:hO};function xO(){try{const e=localStorage.getItem(Rn.language);if(e&&e in Jx)return e}catch{}return"es"}let kf=xO();function bO(e){kf=e;try{localStorage.setItem(Rn.language,e)}catch{}}const vO=[{value:"es",label:"Español"},{value:"en",label:"English"}];function yO(){return kf}function _O(e){const n=Jx[kf],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 jO(e,n){return n?e.replace(/\{(\w+)\}/g,(s,o)=>o in n?String(n[o]):`{${o}}`):e}function wO(e){const n=_O(e);if(n!==void 0)return n;if(kf!=="es"){const s=Jx.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=wO(e);return s===void 0?e:jO(s,n)}function eb(){const{data:e,error:n,isLoading:s,mutate:o}=Ke("/identity",()=>O_.get());return{identity:e||{},error:n,isLoading:s,mutate:o,save:async c=>{const d=await O_.patch(c);return await o(d,{revalidate:!1}),d}}}function tb(){const{identity:e}=eb();return e?.agent_name?.trim()||"APX"}function SO(){return[{id:"voice",label:j("nav.modules.voice"),href:"/m/voice",icon:eA},{id:"desktop",label:j("nav.modules.desktop"),href:"/m/desktop",icon:tA},{id:"deck",label:j("nav.modules.deck"),href:"/m/deck",icon:ZT},{id:"code",label:j("nav.modules.code"),href:"/m/code",icon:kr}]}function CO({onSelect:e,onOpenRoby:n}){const{projects:s,isLoading:o}=zc(),l=oa(),c=SO(),d=tb(),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(yA,{size:36})})}),o&&r.jsx("div",{className:"size-10 animate-pulse rounded-xl bg-muted"}),p&&r.jsx(Pi,{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(Pi,{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(Pi,{label:b,testId:`project-avatar-${g.id}`,title:`${b} — ${g.path}`,active:f(v),onClick:()=>e(v)},g.id)}),r.jsx(Pi,{label:"Add",isAdd:!0,testId:"nav-add-project",icon:r.jsx(un,{size:18}),active:!1,onClick:()=>e("/?action=add-project"),title:j("nav.add_project")}),r.jsx("div",{className:"flex-1"}),r.jsx(Pi,{label:"Settings",isSettings:!0,testId:"nav-settings",icon:r.jsx(zd,{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(yn,{size:18})})})]})}function U2(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 $e({title:e,description:n,action:s,className:o,children:l}){return r.jsxs("section",{className:Me("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 D_({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 Ef({ok:e}){return r.jsx("span",{className:Me("inline-block size-2 rounded-full",e===null?"bg-muted-fg":e?"bg-emerald-500":"bg-red-500")})}const H2=x.createContext(void 0);function V2(e=!1){const n=x.useContext(H2);if(n===void 0&&!e)throw new Error(On(16));return n}function kO(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:x.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 Ul(e={}){const{disabled:n=!1,focusableWhenDisabled:s,tabIndex:o=0,native:l=!0,composite:c}=e,d=x.useRef(null),f=V2(!0),p=c??f!==void 0,{props:m}=kO({focusableWhenDisabled:s,disabled:n,composite:p,tabIndex:o,isNativeButton:l}),g=x.useCallback(()=>{const S=d.current;Cg(S)&&p&&n&&m.disabled===void 0&&S.disabled&&(S.disabled=!1)},[n,m.disabled,p]);Oe(g,[g]);const b=x.useCallback((S={})=>{const{onClick:C,onMouseDown:_,onKeyUp:w,onKeyDown:k,onPointerDown:E,...N}=S;return Oa({onClick(R){if(n){R.preventDefault();return}C?.(R)},onMouseDown(R){n||_?.(R)},onKeyDown(R){if(n||(Vd(R),k?.(R),R.baseUIHandlerPrevented))return;const T=R.target===R.currentTarget,M=R.currentTarget,O=Cg(M),P=!l&&EO(M),B=T&&(l?O:!P),L=R.key==="Enter",D=R.key===" ",z=M.getAttribute("role"),H=z?.startsWith("menuitem")||z==="option"||z==="gridcell";if(T&&p&&D){if(R.defaultPrevented&&H)return;R.preventDefault(),P||l&&O?(M.click(),R.preventBaseUIHandler()):B&&(C?.(R),R.preventBaseUIHandler());return}B&&(!l&&(D||L)&&R.preventDefault(),!l&&L&&C?.(R))},onKeyUp(R){if(!n){if(Vd(R),w?.(R),R.target===R.currentTarget&&l&&p&&Cg(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 Cg(e){return Gt(e)&&e.tagName==="BUTTON"}function EO(e){return!!(e?.tagName==="A"&&e?.href)}const NO=x.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}=Ul({disabled:c,focusableWhenDisabled:d,native:f});return Ht("button",n,{state:{disabled:c},ref:[s,b],props:[m,g]})}),L_=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,P_=mx,nb=(e,n)=>s=>{var o;if(n?.variants==null)return P_(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=L_(g)||L_(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 P_(e,d,p,s?.class,s?.className)},RO=nb("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 po({className:e,variant:n="default",size:s="default",...o}){return r.jsx(NO,{"data-slot":"button",className:Ot(RO({variant:n,size:s,className:e})),...o})}let I_=(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 TO={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},AO={disabled:!1,...Zi},ab={valid(e){return e===null?null:e?{[I_.valid]:""}:{[I_.invalid]:""}}},MO={invalid:void 0,name:void 0,validityData:{state:TO,errors:[],error:"",value:"",initialValue:null},setValidityData:Un,disabled:void 0,touched:Zi.touched,setTouched:Un,dirty:Zi.dirty,setDirty:Un,filled:Zi.filled,setFilled:Un,focused:Zi.focused,setFocused:Un,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:AO,markedDirtyRef:{current:!1},registerFieldControl:Un,validation:{getValidationProps:(e=cn)=>e,getInputValidationProps:(e=cn)=>e,inputRef:{current:null},commit:async()=>{}}},OO=x.createContext(MO);function Dc(e=!0){const n=x.useContext(OO);if(n.setValidityData===Un&&!e)throw new Error(On(28));return n}const zO=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Un,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function q2(){return x.useContext(zO)}const DO=x.createContext({controlId:void 0,registerControlId:Un,labelId:void 0,setLabelId:Un,messageIds:[],setMessageIds:Un,getDescriptionProps:e=>e});function Nf(){return x.useContext(DO)}function LO(e,n,s,o=!0,l){const[c,d]=x.useState(),f=Or(l?`${l}-label`:void 0),p=e??n??c;return Oe(()=>{const m=e||n||!o?void 0:PO(s.current,f);c!==m&&d(m)}),p}function PO(e,n){const s=IO(e);if(s)return!s.id&&n&&(s.id=n),s.id||void 0}function IO(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 Rf(e={}){const{id:n,implicit:s=!1,controlRef:o}=e,{controlId:l,registerControlId:c}=Nf(),d=Or(n),f=s?l:void 0,p=va(()=>Symbol("labelable-control")),m=x.useRef(!1),g=x.useRef(n!=null),b=Le(()=>{!m.current||c===Un||(m.current=!1,c(p.current,void 0))});return Oe(()=>{if(c===Un)return;let v;if(s){const S=o?.current;ft(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]),x.useEffect(()=>b,[b]),l??d}function _c({controlled:e,default:n,name:s,state:o="value"}){const{current:l}=x.useRef(e!==void 0),[c,d]=x.useState(n),f=l?e:c,p=x.useCallback(m=>{l||d(m)},[]);return[f,p]}function sb(e,n,s,o,l=!0){const{registerFieldControl:c}=Dc(),d=x.useRef(null);d.current||(d.current=Symbol()),Oe(()=>{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 BO=x.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:M,validation:O}=Dc(),P=w||p,B=_??d,L={...C,disabled:P},{labelId:D}=Nf(),z=Rf({id:c});Oe(()=>{const G=f!=null;O.inputRef.current?.value||G&&f!==""?T(!0):G&&f===""&&T(!1)},[O.inputRef,T,f]);const H=x.useRef(null);Oe(()=>{b&&H.current===In(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(()=>O.inputRef.current?.value);return sb(O.inputRef,z,V,$),Ht("input",n,{ref:[s,H],state:L,props:[{id:z,disabled:P,name:B,ref:O.inputRef,"aria-labelledby":D,autoFocus:b,...Y?{value:V}:{defaultValue:g},onChange(G){const X=G.currentTarget.value;m?.(X,lt(Us,G.nativeEvent)),E(X!==N.initialValue),T(X!=="")},onFocus(){R(!0)},onBlur(G){k(!0),R(!1),M==="onBlur"&&O.commit(G.currentTarget.value)},onKeyDown(G){G.currentTarget.tagName==="INPUT"&&G.key==="Enter"&&(k(!0),O.commit(G.currentTarget.value))}},O.getInputValidationProps(),S],stateAttributesMapping:ab})}),UO=x.forwardRef(function(n,s){return r.jsx(BO,{ref:s,...n})});function HO({className:e,type:n,...s}){return r.jsx(UO,{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 VO({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 qO(e){return Ht(e.defaultTagName??"div",e,e)}const $O=nb("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 GO({className:e,variant:n="default",render:s,...o}){return qO({defaultTagName:"span",props:Oa({className:Ot($O({variant:n}),e)},o),render:s,state:{slot:"badge",variant:n}})}const $2=x.createContext(void 0);function FO(){const e=x.useContext($2);if(e===void 0)throw new Error(On(63));return e}let B_=(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 G2={...ab,checked(e){return e?{[B_.checked]:""}:{[B_.unchecked]:""}}};function rb(e,n){const s=x.useRef(e),o=Le(n);Oe(()=>{s.current!==e&&o(s.current)},[e,o]),Oe(()=>{s.current=e},[e])}const YO=x.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}=q2(),{state:M,setTouched:O,setDirty:P,validityData:B,setFilled:L,setFocused:D,shouldValidateOnChange:z,validationMode:H,disabled:q,name:Y,validation:V}=Dc(),{labelId:$}=Nf(),Z=q||_,G=Y??g,X=x.useRef(null),U=Hs(X,m,V.inputRef),K=x.useRef(null),F=Or(),J=Rf({id:p,implicit:!1,controlRef:K}),ie=b?void 0:J,[re,oe]=_c({controlled:o,default:!!c,name:"Switch",state:"checked"});sb(K,F,re),Oe(()=>{X.current&&L(X.current.checked)},[X,L]),rb(re,()=>{T(G),P(re!==B.initialValue),L(re),z()?V.commit(re):V.commit(re,!0)});const{getButtonProps:ce,buttonRef:ee}=Ul({disabled:Z,native:b}),Te=LO(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||(O(!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=Oa({checked:re,disabled:Z,form:f,id:ie,name:G,required:C,style:G?SS:kx,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(Us,Pe.nativeEvent);v?.(Ie,be),!be.isCanceled&&oe(Ie)},onFocus(){K.current?.focus()}},V.getInputValidationProps,E!==void 0?{value:E}:cn),Ce=x.useMemo(()=>({...M,checked:re,disabled:Z,readOnly:S,required:C}),[M,re,Z,S,C]),Ne=Ht("span",n,{state:Ce,ref:[s,K,ee],props:[Fe,V.getValidationProps,R,ce],stateAttributesMapping:G2});return r.jsxs($2.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})]})}),XO=x.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,f=FO();return Ht("span",n,{state:f,ref:s,stateAttributesMapping:G2,props:d})});function KO({className:e,size:n="default",...s}){return r.jsx(YO,{"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(XO,{"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 QO({className:e,...n}){return r.jsx(lf,{role:"status","aria-label":"Loading",className:Ot("size-4 animate-spin",e),...n})}const F2=x.createContext(!1),Y2=x.createContext(void 0);function yo(e){const n=x.useContext(Y2);if(e===!1&&n===void 0)throw new Error(On(27));return n}const ZO={...Bl,...Il},X2=x.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:ZO,props:[{role:"presentation",hidden:!b,style:{userSelect:"none",WebkitUserSelect:"none"}},f],enabled:d||!g})}),Tf=x.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}=Ul({disabled:d,native:f}),S={disabled:d};function C(_){g&&m.setOpen(!1,lt(yM,_.nativeEvent))}return Ht("button",n,{state:S,ref:[s,v],props:[{onClick:C},p,b]})}),K2=x.forwardRef(function(n,s){const{render:o,className:l,style:c,id:d,...f}=n,{store:p}=yo(),m=Or(d);return p.useSyncedValueWithCleanup("descriptionElementId",m),Ht("p",n,{ref:s,props:[{id:m},f]})});let WO=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),JO=(function(e){return e[e.open=ro.open]="open",e[e.closed=ro.closed]="closed",e[e.startingStyle=ro.startingStyle]="startingStyle",e[e.endingStyle=ro.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Q2=x.createContext(void 0);function ez(){const e=x.useContext(Q2);if(e===void 0)throw new Error(On(26));return e}const oc="ArrowUp",fl="ArrowDown",Qd="ArrowLeft",lc="ArrowRight",Af="Home",Mf="End",Z2=new Set([Qd,lc]),tz=new Set([Qd,lc,Af,Mf]),W2=new Set([oc,fl]),nz=new Set([oc,fl,Af,Mf]),J2=new Set([...Z2,...W2]),ob=new Set([...J2,Af,Mf]),az="Shift",sz="Control",rz="Alt",oz="Meta",lz=new Set([az,sz,rz,oz]);function iz(e){return Gt(e)&&e.tagName==="INPUT"}function U_(e){return!!(iz(e)&&e.selectionStart!=null||Gt(e)&&e.tagName==="TEXTAREA")}function H_(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=V_(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=V_(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 V_(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 cz={...Bl,...Il,nestedDialogOpen(e){return e?{[JO.nestedDialogOpen]:""}:null}},eC=x.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"),M=m.useState("role"),O=v.useState("floatingId"),P=p.id??O;ez(),Mr({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,z=m.useStateSetter("popupElement"),q=Ht("div",n,{state:{open:E,nested:w,transitionStatus:T,nestedDialogOpen:D},props:[S,{id:P,"aria-labelledby":R??void 0,"aria-describedby":g??void 0,role:M,...wf,hidden:!_,onKeyDown(Y){ob.has(Y.key)&&Y.stopPropagation()},style:{[WO.nestedDialogs]:k}},p],ref:[s,m.context.popupRef,z],stateAttributesMapping:cz});return r.jsx(QS,{context:v,openInteractionType:N,disabled:!_,closeOnFocusOut:!b,initialFocus:L,returnFocus:d,modal:C!==!1,restoreFocus:"popup",children:q})}),tC=x.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}})}),nC=x.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(Q2.Provider,{value:o,children:r.jsxs(KS,{ref:s,...l,children:[d&&f===!0&&r.jsx(tC,{ref:c.context.internalBackdropRef,inert:$x(!p)}),n.children]})}):null});let q_={},$_={},G_="";function uz(e){if(typeof document>"u")return!1;const n=yt(e);return Qt(n).innerWidth-n.documentElement.clientWidth>0}function dz(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=Tr(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 fz(e){const n=yt(e),s=n.documentElement,o=n.body,l=Tr(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 pz(e){const n=yt(e),s=n.documentElement,o=n.body,l=Qt(s);let c=0,d=0,f=!1;const p=Wa.create();if(bx&&(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,q_={scrollbarGutter:s.style.scrollbarGutter,overflowY:s.style.overflowY,overflowX:s.style.overflowX},G_=s.style.scrollBehavior,$_={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",M=Math.max(0,l.innerWidth-o.clientWidth),O=Math.max(0,l.innerHeight-o.clientHeight),P=parseFloat(C.marginTop)+parseFloat(C.marginBottom),B=parseFloat(C.marginLeft)+parseFloat(C.marginRight),L=Tr(s)?s:o;if(f=dz(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:P||O?`calc(100dvh - ${P+O}px)`:"100dvh",width:B||M?`calc(100vw - ${B+M}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,q_),Object.assign(o.style,$_),f||(s.scrollTop=c,s.scrollLeft=d,s.removeAttribute("data-base-ui-scroll-locked"),s.style.scrollBehavior=G_)}function b(){g(),p.request(m)}m();const v=pt(l,"resize",b);return()=>{p.cancel(),g(),typeof l.removeEventListener=="function"&&v()}}class mz{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=Un;return}const c=dS||!uz(n);this.restore=c?fz(n):pz(n)}}const gz=new mz;function aC(e=!0,n=null){Oe(()=>{if(e)return gz.acquire(n)},[e,n])}function hz(e){const{store:n,parentContext:s,actionsRef:o,isDrawer:l}=e,c=n.useState("open");A5(n,c),u2(n);const{forceUnmount:d}=d2(c,n),f=x.useCallback(()=>{n.setOpen(!1,lt(vS))},[n]);return x.useImperativeHandle(o,()=>({unmount:d,close:f}),[d,f]),{parentContext:s,isDrawer:l}}function xz({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]=x.useState(0),[b,v]=x.useState(0),S=m===0,C=Dx(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});aC(l&&d===!0,f),e.useContextCallback("onNestedDialogOpen",(E,N)=>{g(E),v(N)}),e.useContextCallback("onNestedDialogClose",()=>{g(0),v(0)}),x.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??cn,w=C.trigger??cn,k=x.useMemo(()=>Oa(wf,C.floating),[C.floating]);return f2(e,{activeTriggerProps:_,inactiveTriggerProps:w,popupProps:k,nestedOpenDialogCount:m,nestedOpenDrawerCount:b}),null}const bz={...h2,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 lb extends Px{constructor(n,s,o=!1){const l=new Sf,c=vz(n);c.floatingRootContext=m2(l,s,o),super(c,{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:l,onOpenChange:void 0,onOpenChangeComplete:void 0},bz)}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};c2(o,n,s.trigger),this.update(o)};static useStore(n,s){return i2(n,(l,c)=>new lb(s,l,c),!0).store}}function vz(e={}){return{...p2(),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 yz(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=lb.useStore(g?.store,{open:l,openProp:o,activeTriggerId:v,triggerIdProp:b,...R});hx(()=>{const z=o===void 0&&T.state.open===!1&&l===!0?{open:!0,activeTriggerId:v}:null;C?T.update(z?{...R,...z}:R):z&&T.update(z)}),T.useControlledProp("openProp",o),T.useControlledProp("triggerIdProp",b),T.useSyncedValues(R),T.useContextCallback("onOpenChange",c),T.useContextCallback("onOpenChangeComplete",d);const M=T.useState("open"),O=T.useState("mounted"),P=T.useState("payload"),B=hz({store:T,actionsRef:m,parentContext:E?.store.context,isDrawer:S}),L=M||O,D=x.useMemo(()=>({store:T}),[T]);return r.jsx(F2.Provider,{value:!1,children:r.jsxs(Y2.Provider,{value:D,children:[L&&r.jsx(xz,{store:T,dialogRoot:B}),typeof s=="function"?s({payload:P}):s]})})}function sC(e){const n=x.useContext(F2)?"drawer":"dialog";return yz(e,n)}const rC=x.forwardRef(function(n,s){const{render:o,className:l,style:c,id:d,...f}=n,{store:p}=yo(),m=Or(d);return p.useSyncedValueWithCleanup("titleElementId",m),Ht("h2",n,{ref:s,props:[{id:m},f]})});function _z(e){const n=x.useRef(""),s=x.useCallback(l=>{l.defaultPrevented||(n.current=l.pointerType,e(l,l.pointerType))},[e]);return{onClick:x.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 jz(e,n){const s=Le((c,d)=>{(typeof e=="function"?e():e)||n(d||(dS?"touch":""))}),{onClick:o,onPointerDown:l}=_z(s);return x.useMemo(()=>({onClick:o,onPointerDown:l}),[o,l])}function wz(e){const[n,s]=x.useState(null),o=jz(e,s);return rb(e,l=>{l&&!e&&s(null)}),x.useMemo(()=>({openMethod:n,triggerProps:o}),[n,o])}function Lh({...e}){return r.jsx(sC,{"data-slot":"dialog",...e})}function Sz({...e}){return r.jsx(nC,{"data-slot":"dialog-portal",...e})}function Cz({...e}){return r.jsx(Tf,{"data-slot":"dialog-close",...e})}function kz({className:e,...n}){return r.jsx(X2,{"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 Ph({className:e,children:n,showCloseButton:s=!0,...o}){return r.jsxs(Sz,{children:[r.jsx(kz,{}),r.jsxs(eC,{"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(Tf,{"data-slot":"dialog-close",render:r.jsx(po,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[r.jsx(vo,{}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Ih({className:e,...n}){return r.jsx("div",{"data-slot":"dialog-header",className:Ot("flex flex-col gap-2",e),...n})}function F_({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(Tf,{render:r.jsx(po,{variant:"outline"}),children:"Close"})]})}function Bh({className:e,...n}){return r.jsx(rC,{"data-slot":"dialog-title",className:Ot("font-heading text-base leading-none font-medium",e),...n})}function Ez({className:e,...n}){return r.jsx(K2,{"data-slot":"dialog-description",className:Ot("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...n})}const Nz={primary:"default",secondary:"outline",ghost:"ghost",destructive:"destructive"},Rz={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(po,{type:d,variant:Nz[e],size:Rz[n],disabled:c||s,className:o,...f,children:[s?r.jsx(za,{size:14}):null,l]})}function ke(e){return r.jsx(HO,{...e})}function ln(e){return r.jsx(VO,{...e})}function Tz(e){return r.jsx("select",{...e,className:Me("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:Me("inline-flex items-center gap-2",o&&"opacity-50"),children:[r.jsx(KO,{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(GO,{variant:o,className:Me("rounded-md",l[n],s),children:e})}function Mn({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(Lh,{open:e,onOpenChange:p=>{p||n()},children:r.jsxs(Ph,{className:Me("flex max-h-[88vh] w-full flex-col gap-0 p-0",f[d]),children:[(s||o)&&r.jsxs(Ih,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[s&&r.jsx(Bh,{children:s}),o&&r.jsx(Ez,{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 za({size:e=14}){return r.jsx(QO,{style:{width:e,height:e}})}function it({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(za,{})," ",e]})}const oC=x.createContext(null);let Az=1;function Mz({children:e}){const[n,s]=x.useState([]),o=x.useCallback((c,d)=>{const f=Az++;s(p=>[...p,{id:f,kind:c,message:d}]),setTimeout(()=>{s(p=>p.filter(m=>m.id!==f))},4500)},[]),l=x.useMemo(()=>({show:o,success:c=>o("success",c),error:c=>o("error",c),info:c=>o("info",c)}),[o]);return x.useEffect(()=>(window.__apxToast=l,()=>{delete window.__apxToast}),[l]),r.jsxs(oC.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:Me("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:Me("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=x.useContext(oC);if(!e)throw new Error("useToast must be used inside <ToastProvider>");return e}function lC(){const{data:e,error:n,isLoading:s}=Ke("/health",()=>rO.get(),{refreshInterval:uf.health});return{health:e,error:n,isLoading:s,isUp:!n&&!!e}}function Oz(){const{data:e,error:n,isLoading:s,mutate:o}=Ke("/engines",()=>Xd.list());return{engines:e?.engines||[],error:n,isLoading:s,mutate:o}}function zz(){const{data:e,error:n,isLoading:s,mutate:o}=Ke("/telegram/status",()=>An.status(),{refreshInterval:uf.telegramStatus});return{status:e,error:n,isLoading:s,mutate:o}}function ib(){const{data:e,error:n,isLoading:s,mutate:o}=Ke("/telegram/channels",()=>An.channels.list());return{channels:e?.channels||[],error:n,isLoading:s,mutate:o}}function cb(){const{data:e,error:n,isLoading:s,mutate:o}=Ke("/telegram/contacts",()=>An.contacts.list());return{contacts:e?.contacts||[],roles:e?.roles||{},channelOwners:e?.channel_owners||[],error:n,isLoading:s,mutate:o}}function Va(e){return typeof e=="string"&&e.startsWith("*** set ***")}function Sr(e,n="(no seteada)"){return Va(e)?e:n}function El(e){if(typeof e!="string")return null;const n=e.match(/\(\.\.\.([^)]+)\)/);return n?n[1]:null}function iC({channel:e,onClose:n,onSaved:s}){const o=at(),[l,c]=x.useState(!1),[d,f]=x.useState({name:""});x.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(Mn,{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 cC({channel:e,onClose:n}){const s=at(),[o,l]=x.useState(j("admin.telegram_default_message")),[c,d]=x.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(Mn,{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(ln,{rows:4,value:o,onChange:p=>l(p.target.value)})})})}function uC({bare:e=!1}){const n=at(),{contacts:s,roles:o,channelOwners:l,isLoading:c,mutate:d}=cb(),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(it,{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(Tz,{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:Dz(o[C])})]})]},String(v.user_id))})})]});return e?b:r.jsx($e,{title:j("telegram_contacts.title"),description:j("telegram_contacts.desc"),children:b})}function Dz(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 Lz(){const e=La(),n=at(),{health:s,isUp:o}=lC(),{projects:l,isLoading:c,mutate:d}=zc(),{engines:f,isLoading:p}=Oz(),{status:m,mutate:g}=zz(),{channels:b,isLoading:v,mutate:S}=ib(),[C,_]=x.useState(null),[w,k]=x.useState(null),E=async()=>{try{await Cl.reload(),n.success(j("admin.reload_success"))}catch(M){n.error(M.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(M){n.error(M.message)}},R=async M=>{if(confirm(j("telegram_channels.delete_confirm",{name:M})))try{await An.channels.remove(M),n.success(j("admin.telegram_channel_removed")),S()}catch(O){n.error(O.message)}},T=async(M,O)=>{if(confirm(j("admin.unregister_confirm",{label:O})))try{await na.remove(M),n.success(j("project.unregistered")),d()}catch(P){n.error(P.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(un,{size:14})," ",j("nav.project")]})]})]}),r.jsx($e,{title:j("daemon.version"),children:r.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[r.jsx(kg,{label:j("daemon.version"),value:s?.version||"—"}),r.jsx(kg,{label:j("daemon.uptime"),value:s?`${s.uptime_s}s`:"—"}),r.jsx(kg,{label:j("daemon.status"),value:j(o?"daemon.running":"daemon.down"),ok:o})]})}),r.jsxs($e,{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(M=>r.jsx(Ve,{tone:"info",children:M},M))})]}),r.jsxs($e,{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(un,{size:14})," ",j("admin.telegram_add_channel")]})]}),children:[v&&r.jsx(nt,{}),b.length===0&&r.jsx(it,{children:j("common.none_yet")}),r.jsx("ul",{className:"space-y-2 text-sm",children:b.map(M=>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:M.name}),r.jsxs("div",{className:"flex items-center gap-2",children:[M.project&&r.jsxs(Ve,{tone:"success",children:["project = ",M.project]}),r.jsxs(ge,{size:"sm",variant:"ghost",onClick:()=>k(M),children:[r.jsx(os,{size:13})," ",j("admin.telegram_send_test")]}),r.jsx(ge,{size:"sm",variant:"secondary",onClick:()=>_(M),children:j("common.edit")}),r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>R(M.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: ",M.chat_id||"—"]}),r.jsxs("span",{children:["route_to_agent: ",M.route_to_agent||"default APX"]}),r.jsxs("span",{children:["engine: ",M.respond_with_engine?j("admin.engine_badge"):j("admin.engine_badge_no")]})]})]},M.name))})]}),r.jsx(uC,{}),r.jsxs($e,{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(M=>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:["#",M.id]}),r.jsxs("button",{type:"button",className:"flex-1 text-left hover:underline",onClick:()=>e(`/p/${M.id}`),children:[r.jsx("span",{className:"font-medium",children:M.name||M.path.split("/").pop()}),r.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:M.path})]}),r.jsxs(Ve,{children:[M.agents??0," ",j("admin.agents_badge")]}),Number(M.id)!==0&&r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>T(String(M.id),M.name||M.path),children:j("admin.unregister")})]},M.id))})]}),r.jsx(iC,{channel:C,onClose:()=>_(null),onSaved:()=>{_(null),S()}}),r.jsx(cC,{channel:w,onClose:()=>k(null)})]})}function kg({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(Ef,{ok:s}),r.jsx("span",{children:n})]})]})}function dC(e){const[n,s]=x.useState(!1);x.useEffect(()=>{try{s(localStorage.getItem(e)==="true")}catch{}},[e]);const o=x.useCallback(()=>s(l=>{const c=!l;try{localStorage.setItem(e,String(c))}catch{}return c}),[e]);return{collapsed:n,toggle:o}}function Pz({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(Xw,{className:Me("size-4 transition-transform",e&&"rotate-180")})})})}function Iz({sections:e,active:n,onChange:s,collapsed:o=!1}){return r.jsx("nav",{className:Me("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:Me("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:Me("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(x.Fragment,{children:b},d)})})]},c))})}const fC=x.createContext(null),pC=x.createContext(null),mC=x.createContext(""),gC=x.createContext(null),hC=x.createContext(null),xC=x.createContext(null);function Bz({children:e}){const[n,s]=x.useState(null),[o,l]=x.useState(""),[c,d]=x.useState(null);return r.jsx(pC.Provider,{value:s,children:r.jsx(fC.Provider,{value:n,children:r.jsx(gC.Provider,{value:l,children:r.jsx(mC.Provider,{value:o,children:r.jsx(xC.Provider,{value:d,children:r.jsx(hC.Provider,{value:c,children:e})})})})})})}function Uz(){return x.useContext(fC)}function Hz(e,n){const s=x.useContext(pC);x.useEffect(()=>(s?.({collapsed:e,toggle:n}),()=>s?.(null)),[e,n,s])}function Vz(){return x.useContext(mC)}function qz(e){const n=x.useContext(gC);x.useEffect(()=>(n?.(e),()=>n?.("")),[e,n])}function $z(){return x.useContext(hC)}function Gz(e){const n=x.useContext(xC);x.useEffect(()=>(n?.(e),()=>n?.(null)),[e,n])}function bC({sections:e,active:n,onChange:s,collapsed:o,onToggleCollapse:l,actions:c,contentClassName:d,testId:f,children:p}){return Hz(o,l),r.jsxs("div",{className:"flex h-full",children:[r.jsx(Iz,{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:Me("flex-1 min-h-0 overflow-y-auto",d),"data-testid":f,children:p})]})]})}function Y_({pid:e}){const n=Ke(`/projects/${e}/tasks?state=open`,()=>br.list(e)),s=Ke(`/projects/${e}/routines`,()=>xr.list(e)),o=Ke(`/projects/${e}/agents`,()=>en.list(e)),l=Ke(`/projects/${e}/mcps`,()=>vr.list(e));return r.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3",children:[r.jsx(Bi,{title:j("project.overview.tasks_open"),value:n.data?.length??"…",href:`/p/${e}/tasks`,icon:pc}),r.jsx(Bi,{title:j("project.overview.routines"),value:s.data?.length??"…",href:`/p/${e}/routines`,icon:yl}),r.jsx(Bi,{title:j("project.overview.agents"),value:o.data?.length??"…",href:`/p/${e}/agents`,icon:yn}),r.jsx(Bi,{title:j("project.overview.mcps"),value:l.data?.length??"…",href:`/p/${e}/mcps`,icon:ph}),r.jsx(Bi,{title:j("project.overview.chat"),value:j("project.overview.chat_value"),href:`/p/${e}/chat`,icon:ac})]})}function Bi({title:e,value:n,href:s,icon:o}){return r.jsxs(Mw,{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 Fz(){const e=La(),{projects:n,isLoading:s}=zc();return r.jsxs($e,{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(un,{size:14})," ",j("base.workspaces_new")]}),children:[s&&r.jsx(nt,{}),!s&&n.length===0&&r.jsx(it,{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(qw,{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"):U2(o.kind)})]}),r.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:o.path})]},o.id)})})]})}const vC=x.createContext(null),yC=x.createContext(null);function is(){const e=x.useContext(vC);if(e===null)throw new Error(On(60));return e}function _C(){const e=x.useContext(yC);if(e===null)throw new Error(On(61));return e}const Yz=(e,n)=>Object.is(e,n);function Nl(e,n,s){return e==null||n==null?Object.is(e,n):s(e,n)}function Xz(e,n,s){return!e||e.length===0?!1:e.some(o=>o===void 0?!1:Nl(n,o,s))}function ic(e,n,s){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Nl(o,n,s))}function Kz(e,n,s){return e.filter(o=>!Nl(n,o,s))}function Uh(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function jC(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Qz(e){if(!Array.isArray(e))return e!=null&&"null"in e;const n=e;if(jC(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 wC(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 Uh(e)}function ul(e,n){return n&&e!=null?n(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Uh(e.value):Uh(e)}function SC(e,n,s){function o(){return wC(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=jC(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 Zz(e,n,s){return e.reduce((o,l,c)=>(c>0&&o.push(", "),o.push(r.jsx(x.Fragment,{children:SC(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?Qz(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 Ha=1;function ub(e,n){return Math.max(0,e-n)}function Zd(e,n){if(n<=0)return 0;const s=Wi(e,0,n),o=s,l=n-s,c=o<=Ha,d=l<=Ha;return c&&d?o<=l?0:n:c?0:d?n:s}function Wz(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:M=Yz,highlightItemOnHover:O=!0,children:P}=e,{clearErrors:B}=q2(),{setDirty:L,setTouched:D,setFocused:z,shouldValidateOnChange:H,validityData:q,setFilled:Y,name:V,disabled:$,validation:Z,validationMode:G}=Dc(),X=Rf({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=x.useRef([]),ce=x.useRef([]),ee=x.useRef(null),Te=x.useRef(null),Fe=x.useRef(0),ve=x.useRef(null),Ce=x.useRef([]),Ne=x.useRef(!1),Pe=x.useRef(!1),Ie=x.useRef(null),be=x.useRef(null),Ae=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),we=x.useRef(!1),{mounted:Be,setMounted:Xe,transitionStatus:Ye}=Ac(ie),{openMethod:De,triggerProps:ye}=wz(ie),le=va(()=>new l2({id:X,labelId:void 0,modal:C,multiple:N,itemToStringLabel:R,itemToStringValue:T,isItemEqualToValue:M,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,_e=tt(le,We.activeIndex),Se=tt(le,We.selectedIndex),Ue=tt(le,We.triggerElement),Je=tt(le,We.positionerElement),_t=_4(De),zt=De??_t,pe=x.useMemo(()=>N&&Array.isArray(F)&&F.length===0?"":ul(F,T),[N,F,T]),Ee=x.useMemo(()=>N&&Array.isArray(F)?F.map(ct=>ul(ct,T)):ul(F,T),[N,F,T]),Re=mn(le.state.triggerElement),qe=Le(()=>Ee);sb(Re,X,F,qe);const st=x.useRef(F),nn=N?Array.isArray(F)&&F.length>0:F!=null;Oe(()=>{F!==st.current&&le.set("forceMount",!0)},[le,F]),Oe(()=>{Y(nn)},[nn,Y]),Oe(function(){const Dt=Ce.current;let Sn;if(N){const sn=Array.isArray(F)?F:[];if(sn.length===0)Sn=null;else{const Rt=sn[sn.length-1],gn=ic(Dt,Rt,M);Sn=gn===-1?null:gn}}else{const sn=ic(Dt,F,M);Sn=sn===-1?null:sn}Sn===null&&(be.current=null),!ie&&le.set("selectedIndex",Sn)},[nn,N,ie,F,Ce,M,le,be]),rb(F,()=>{B(K),L(F!==q.initialValue),H()?Z.commit(F):Z.commit(F,!0)});const Vt=Le((ct,Dt)=>{if(f?.(ct,Dt),!Dt.isCanceled&&(re(ct),!ct&&(Dt.reason===hf||Dt.reason===wx)&&(D(!0),z(!1),G==="onBlur"&&Z.commit(F)),!ct&&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)});Mr({enabled:!_,open:ie,ref:ee,onComplete(){ie||mt()}}),x.useImperativeHandle(_,()=>({unmount:mt}),[mt]);const Nt=Le((ct,Dt)=>{l?.(ct,Dt),!Dt.isCanceled&&J(ct)}),Wt=Le(()=>{const ct=le.state.listElement||ee.current;if(!ct)return;const Dt=ub(ct.scrollHeight,ct.clientHeight),Sn=Zd(ct.scrollTop,Dt),sn=Sn>0,Rt=Sn<Dt;le.state.scrollUpArrowVisible!==sn&&le.set("scrollUpArrowVisible",sn),le.state.scrollDownArrowVisible!==Rt&&le.set("scrollDownArrowVisible",Rt)}),St=x2({open:ie,onOpenChange:Vt,elements:{reference:Ue,floating:Je}}),an=w3(St,{enabled:!v&&!U,event:"mousedown"}),Ft=Dx(St),dn=V5(St,{enabled:!v&&!U,listRef:oe,activeIndex:_e,selectedIndex:Se,disabledIndices:gc,onNavigate(ct){ct===null&&!ie||le.set("activeIndex",ct)},focusItemOnHover:O}),zn=q5(St,{enabled:!v&&!U&&(ie||!N),listRef:ce,activeIndex:_e,selectedIndex:Se,onMatch(ct){ie?le.set("activeIndex",ct):Nt(Ce.current[ct],lt("none"))},onTyping(ct){Ne.current=ct}}),Xn=x.useMemo(()=>{const ct=Oa(zn.reference,dn.reference,Ft.reference,an.reference,ye);return X&&(ct.id=X),ct},[an.reference,zn.reference,dn.reference,Ft.reference,ye,X]),ia=x.useMemo(()=>Oa(wf,zn.floating,dn.floating,Ft.floating),[zn.floating,dn.floating,Ft.floating]),Kn=dn.item??cn;hx(()=>{le.update({popupProps:ia,triggerProps:Xn})}),Oe(()=>{le.update({id:X,modal:C,multiple:N,value:F,open:ie,mounted:Be,transitionStatus:Ye,popupProps:ia,triggerProps:Xn,items:E,itemToStringLabel:R,itemToStringValue:T,isItemEqualToValue:M,openMethod:zt})},[le,X,C,N,F,ie,Be,Ye,ia,Xn,E,R,T,M,zt]);const cs=x.useMemo(()=>({store:le,name:K,required:S,disabled:U,readOnly:v,multiple:N,highlightItemOnHover:O,setValue:Nt,setOpen:Vt,listRef:oe,popupRef:ee,scrollHandlerRef:Te,handleScrollArrowVisibility:Wt,scrollArrowsMountedCountRef:Fe,itemProps:Kn,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,O,Nt,Vt,Kn,St.context.events,Z,k,Wt]),Dn=Hs(w,Z.inputRef),ca=N&&Array.isArray(F)&&F.length>0,Pa=N?void 0:K,us=x.useMemo(()=>!N||!Array.isArray(F)||!K?null:F.map(ct=>{const Dt=ul(ct,T);return r.jsx("input",{type:"hidden",form:m,name:K,value:Dt},Dt)}),[N,F,m,K,T]);return r.jsx(vC.Provider,{value:cs,children:r.jsxs(yC.Provider,{value:St,children:[P,r.jsx("input",{...Z.getInputValidationProps({onFocus(){le.state.triggerElement?.focus({focusVisible:!0})},onChange(ct){if(ct.nativeEvent.defaultPrevented||U||v){ct.preventBaseUIHandler?.();return}const Dt=ct.currentTarget.value,Sn=lt(Us,ct.nativeEvent);function sn(){if(N)return;const Rt=Ce.current.find(gn=>ul(gn,T).toLowerCase()===Dt.toLowerCase()||wC(gn,R).toLowerCase()===Dt.toLowerCase());Rt!=null&&(L(Rt!==q.initialValue),Nt(Rt,Sn),H()&&Z.commit(Rt))}le.set("forceMount",!0),queueMicrotask(sn)}}),id:X&&Pa==null?`${X}-hidden-input`:void 0,form:m,name:Pa,autoComplete:g,value:pe,disabled:U,required:S&&!ca,readOnly:v,ref:Dn,style:K?SS:kx,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),us]})})}function Jz(e,n){return e??n}function eD(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,tD=400,nD={...n4,...ab,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},aD=x.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:_}=Nf(),{store:w,setOpen:k,selectionRef:E,validation:N,readOnly:R,required:T,alignItemWithTriggerActiveRef:M,disabled:O,keyboardActiveRef:P}=is(),B=C||O||d,L=tt(w,We.open),D=tt(w,We.mounted),z=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=Jz(_,Z);Rf({id:U});const F=mn(q),J=x.useRef(null),{getButtonProps:ie,buttonRef:re}=Ul({disabled:B,native:f}),oe=Le(Ne=>{w.set("triggerElement",Ne)}),ce=Hs(s,J,re,oe),ee=aa(),Te=aa(),Fe=aa();x.useEffect(()=>{if(L)return Fe.start(tD,()=>{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=Oa(H,{id:U,role:"combobox","aria-expanded":L?"true":"false","aria-haspopup":"listbox","aria-controls":L?Y?.id??Ld(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&&M.current&&k(!1,lt(Us,Ne.nativeEvent)),ee.start(0,()=>{w.set("forceMount",!0)})},onBlur(Ne){Ze(q,Ne.relatedTarget)||(g(!0),b(!1),v==="onBlur"&&N.commit(z))},onPointerMove(){P.current=!1},onKeyDown(){P.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=eD(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(_M,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:z,readOnly:R,popupSide:X,placeholder:!G};return Ht("button",n,{ref:[s,J],state:Ce,stateAttributesMapping:nD,props:ve})}),sD={value:()=>null},rD=x.forwardRef(function(n,s){const{className:o,render:l,children:c,placeholder:d,style:f,...p}=n,{store:m,valueRef:g}=is(),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=Zz(b,v,S):E=SC(b,v,S),Ht("span",n,{state:k,ref:[s,g],props:[{children:E},p],stateAttributesMapping:sD})}),oD=x.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,{store:f}=is(),m={open:tt(f,We.open)};return Ht("span",n,{state:m,ref:s,props:[{"aria-hidden":!0,children:"▼"},d],stateAttributesMapping:v2})}),lD=x.createContext(void 0),iD=x.forwardRef(function(n,s){const{store:o}=is(),l=tt(o,We.mounted),c=tt(o,We.forceMount);return l||c?r.jsx(lD.Provider,{value:!0,children:r.jsx(KS,{ref:s,...n})}):null}),CC=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function cD(){return x.useContext(CC)}function db(e){const{children:n,elementsRef:s,labelsRef:o,onMapChange:l}=e,c=Le(l),d=x.useRef(0),f=va(dD).current,p=va(uD).current,[m,g]=x.useState(0),b=x.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=x.useMemo(()=>{const k=new Map;return Array.from(p.keys()).filter(N=>N.isConnected).sort(fD).forEach((N,R)=>{const T=p.get(N)??{};k.set(N,{...T,index:R})}),k},[p,m]);Oe(()=>{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]),Oe(()=>{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]),Oe(()=>()=>{s.current=[]},[s]),Oe(()=>()=>{o&&(o.current=[])},[o]);const _=Le(k=>(f.add(k),()=>{f.delete(k)}));Oe(()=>{f.forEach(k=>k(C))},[f,C]);const w=x.useMemo(()=>({register:v,unregister:S,subscribeMapChange:_,elementsRef:s,labelsRef:o,nextIndexRef:d}),[v,S,_,s,o,d]);return r.jsx(CC.Provider,{value:w,children:n})}function uD(){return new Map}function dD(){return new Set}function fD(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 kC=x.createContext(void 0);function fb(){const e=x.useContext(kC);if(!e)throw new Error(On(59));return e}function Wd(e,n){e&&Object.assign(e.style,n)}const EC={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},pD=20;function mD(e,n,s,o){const[l,c]=x.useState(!1);Oe(()=>{if(!e||!n||s==null){c(!1);return}const d=yt(s).documentElement.clientWidth,f=s.offsetWidth;c(d>0&&f>0&&f>=d-pD)},[e,n,s]),aC(e&&(!n||l),o)}const gD={position:"fixed"},hD=x.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=p3,style:E,...N}=n,{store:R,listRef:T,labelsRef:M,alignItemWithTriggerActiveRef:O,selectedItemTextRef:P,valuesRef:B,initialValueRef:L,popupRef:D,setValue:z}=is(),H=_C(),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=x.useRef(null),J=x.useRef(null),[ie,re]=x.useState(w),oe=Y&&ie&&Z!=="touch";!Y&&ie!==w&&re(w),Oe(()=>{Y||(We.scrollUpArrowVisible(R.state)&&R.set("scrollUpArrowVisible",!1),We.scrollDownArrowVisible(R.state)&&R.set("scrollDownArrowVisible",!1))},[R,Y]),x.useImperativeHandle(O,()=>oe),mD((oe||V)&&q,Z==="touch",G,X);const ce=k2({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?gD:ce.positionerStyles,Fe={open:q,side:ee,align:ce.align,anchorHidden:ce.anchorHidden};Oe(()=>{R.set("popupSide",ce.side)},[R,ce.side]);const ve=Le(be=>{R.set("positionerElement",be)}),Ce=E2(n,Fe,{styles:Te,transitionStatus:K,props:N,refs:[s,ve],hidden:!Y,inert:!q}),Ne=x.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(Us);if(Ae!==0&&!R.state.multiple&&$!==null&&ic(B.current,$,U)===-1){const Xe=L.current,De=Xe!=null&&ic(B.current,Xe,U)!==-1?Xe:null;z(De,we),De===null&&(R.set("selectedIndex",null),P.current=null)}if(Ae!==0&&R.state.multiple&&Array.isArray($)){const Be=Ye=>ic(B.current,Ye,U)!==-1,Xe=$.filter(Ye=>Be(Ye));(Xe.length!==$.length||Xe.some(Ye=>!Xz($,Ye,U)))&&(z(Xe,we),Xe.length===0&&(R.set("selectedIndex",null),P.current=null))}if(q&&oe){R.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Be={height:""};Wd(G,Be),Wd(D.current,Be)}}),Ie=x.useMemo(()=>({...ce,side:ee,alignItemWithTriggerActive:oe,setControlledAlignItemWithTrigger:re,scrollUpArrowRef:F,scrollDownArrowRef:J}),[ce,ee,oe,re]);return r.jsx(db,{elementsRef:T,labelsRef:M,onMapChange:Pe,children:r.jsxs(kC.Provider,{value:Ie,children:[Y&&V&&r.jsx(tC,{inert:$x(!q),cutout:X}),Ce]})})}),id="base-ui-disable-scrollbar",Hh={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}`})}},xD=x.createContext(void 0);function bD(e){return x.useContext(xD)}const vD=x.createContext(void 0),yD={disableStyleElements:!1};function _D(){return x.useContext(vD)??yD}const jD={...Bl,...Il},wD=x.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}=is(),{side:T,align:M,alignItemWithTriggerActive:O,isPositioned:P,setControlledAlignItemWithTrigger:B,scrollDownArrowRef:L,scrollUpArrowRef:D}=fb(),z=bD()!=null,H=_C(),q=Vx(),{nonce:Y,disableStyleElements:V}=_D(),$=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=x.useRef(!1),re=x.useRef(!1),oe=x.useRef({}),ce=jl(),ee=Le(Ce=>{if(!F||!m.current||!re.current)return;if(ie.current||!O){k();return}const Ne=F.style.top==="0px",Pe=F.style.bottom==="0px";if(!Ne&&!Pe){k();return}const Ie=K_(F),be=Ji(F.getBoundingClientRect().height,"y",Ie),Ae=yt(F),we=getComputedStyle(F),Be=parseFloat(we.marginTop),Xe=parseFloat(we.marginBottom),Ye=X_(getComputedStyle(m.current)),De=Math.min(Ae.documentElement.clientHeight-Be-Xe,Ye),ye=Ce.scrollTop,le=cd(Ce);let _e=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)<=Ha&&(ie.current=!0),k()},pe=Ne?le-ye:ye,Ee=Math.min(be+pe,De);if(_e=Ee,pe<=Ha){zt(pe,Ne?le:0);return}if(De-Ee>Ha)Ne?Je=!0:Se=0;else if(Ue=!0,Pe&&ye<le){const Re=be+pe-De;Se=ye-(pe-Re)}if(_e=Math.ceil(_e),_e!==0&&_t(_e),Je||Se!=null){const Re=cd(Ce),qe=Je?Re:Wi(Se,0,Re);Math.abs(Ce.scrollTop-qe)>Ha&&(Ce.scrollTop=qe)}(Ue||_e>=De-Ha)&&(ie.current=!0),k()});x.useImperativeHandle(E,()=>ee,[ee]),Mr({open:Z,ref:m,onComplete(){Z&&g?.(!0)}});const Te={open:Z,transitionStatus:U,side:T,align:M};Oe(()=>{!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]),Oe(()=>{Z||O||(re.current=!1,ie.current=!1,Wd(F,oe.current))},[Z,O,F,m]),Oe(()=>{const Ce=m.current;if(!Z||!K||!F||!Ce||O&&!P||p.state.transitionStatus==="ending")return;if(!O){re.current=!0,ce.request(k),Ce.style.removeProperty("--transform-origin");return}const Ne=SD(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=K_(K),Ye=ud(K.getBoundingClientRect(),Xe),De=ud(F.getBoundingClientRect(),Xe),ye=Ye.height,le=J||Ce,_e=le.scrollHeight,Se=parseFloat(Ae.borderBottomWidth),Ue=parseFloat(be.marginTop)||10,Je=parseFloat(be.marginBottom)||10,_t=parseFloat(be.minHeight)||100,zt=X_(Ae),pe=5,Ee=5,Re=20,qe=we.documentElement.clientHeight-Ue-Je,st=we.documentElement.clientWidth,nn=qe-Ye.bottom+ye;let Vt,mt=q==="rtl"?Ye.right-De.width:Ye.left,Nt=0;if(Pe&&Ie){const Dn=ud(Ie.getBoundingClientRect(),Xe);Vt=ud(Pe.getBoundingClientRect(),Xe),mt=De.left+(q==="rtl"?Dn.right-Vt.right:Dn.left-Vt.left);const ca=Dn.top-Ye.top+Dn.height/2;Nt=Vt.top-De.top+Vt.height/2-ca}const Wt=nn+Nt+Je+Se;let St=Math.min(qe,Wt);const an=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 zn=cd(le),Xn=Ft>=zn-Ha;Xn&&(St=Math.min(qe,De.height)-(Ft-zn));const ia=Ye.top<Re||Ye.bottom>qe-Re||Math.ceil(St)+Ha<Math.min(_e,_t),Kn=(Be.visualViewport?.scale??1)!==1&&bx;if(ia||Kn){re.current=!0,Wd(F,oe.current),B(!1);return}const cs=Math.max(_t,St);if(Xn){const Dn=Math.max(0,qe-Wt);F.style.top=De.height>=an?"0":`${Dn}px`,F.style.height=`${St}px`,le.scrollTop=cd(le)}else F.style.bottom="0",le.scrollTop=Ft;if(Vt){const Dn=De.top,ca=De.height,Pa=Vt.top+Vt.height/2,us=ca>0?(Pa-Dn)/ca*100:50,ct=Wi(us,0,100);Ce.style.setProperty("--transform-origin",`50% ${ct}%`)}(cs===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,O,B,ce,L,D,J,N,R,q,P]),x.useEffect(()=>{if(!O||!F||!Z)return;const Ce=Qt(F);function Ne(Pe){b(!1,lt(jM,Pe))}return pt(Ce,"resize",Ne)},[b,O,F,Z]);const Fe={...J?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":w||void 0,id:`${$}-list`},onKeyDown(Ce){_.current=!0,z&&ob.has(Ce.key)&&Ce.stopPropagation()},onMouseMove(){_.current=!1},onScroll(Ce){J||ee(Ce.currentTarget)},...O&&{style:J?{height:"100%"}:EC}},ve=Ht("div",n,{ref:[s,m],state:Te,stateAttributesMapping:jD,props:[X,Fe,qx(U),{className:!J&&O?Hh.className:void 0},f]});return r.jsxs(x.Fragment,{children:[!V&&Hh.getElement(Y),r.jsx(QS,{context:H,modal:!1,disabled:!G,returnFocus:d,restoreFocus:!0,children:ve})]})});function X_(e){const n=e.maxHeight||"";return n.endsWith("px")&&parseFloat(n)||1/0}function cd(e){return ub(e.scrollHeight,e.clientHeight)}function K_(e){return a2.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 Q_=[["transform","none"],["scale","1"],["translate","0 0"]];function SD(e){const{style:n}=e,s={};for(const[o,l]of Q_)s[o]=n.getPropertyValue(o),n.setProperty(o,l,"important");return()=>{for(const[o]of Q_){const l=s[o];l?n.setProperty(o,l):n.removeProperty(o)}}}const CD=x.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,{store:f,scrollHandlerRef:p}=is(),{alignItemWithTriggerActive:m}=fb(),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:EC},className:g&&b!=="touch"?Hh.className:void 0},_=Le(w=>{f.set("listElement",w)});return Ht("div",n,{ref:[s,_],props:[C,d]})});let NC=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function pb(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}=cD(),v=x.useRef(-1),[S,C]=x.useState(c??(l===NC.GuessFromOrder?()=>{if(v.current===-1){const k=b.current;b.current+=1,v.current=k}return v.current}:-1)),_=x.useRef(null),w=x.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 Oe(()=>{if(c!=null)return;const k=_.current;if(k)return d(k,s),()=>{f(k)}},[c,d,f,s]),Oe(()=>{if(c==null)return p(k=>{const E=_.current?k.get(_.current)?.index:null;E!=null&&C(E)})},[c,p,C]),x.useMemo(()=>({ref:w,index:S}),[S,w])}const RC=x.createContext(void 0);function mb(){const e=x.useContext(RC);if(!e)throw new Error(On(57));return e}const kD=x.memo(x.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=x.useRef(null),v=pb({label:f,textRef:b,indexGuessBehavior:NC.GuessFromOrder}),{store:S,itemProps:C,setOpen:_,setValue:w,selectionRef:k,typingRef:E,valuesRef:N,multiple:R,selectedItemTextRef:T}=is(),M=tt(S,We.isActive,v.index),O=tt(S,We.isSelected,v.index,d),P=tt(S,We.isSelectedByFocus,v.index),B=tt(S,We.isItemEqualToValue),L=v.index,D=L!==-1,z=x.useRef(null);Oe(()=>{if(!D)return;const J=N.current;return J[L]=d,()=>{delete J[L]}},[D,L,d,N]),Oe(()=>{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=x.useRef(null),q=x.useRef("mouse"),Y=x.useRef(!1),{getButtonProps:V,buttonRef:$}=Ul({disabled:p,focusableWhenDisabled:!0,native:m,composite:!0}),Z={disabled:p,selected:O,highlighted:M};function G(J){const ie=S.state.value;if(R){const re=Array.isArray(ie)?ie:[],oe=O?Kz(re,d,B):[...re,d];w(oe,lt(ag,J))}else w(d,lt(ag,J)),_(!1,lt(ag,J))}function X(){k.current.dragY=0}const U={role:"option","aria-selected":O,tabIndex:M?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&&vx(J.nativeEvent)&&(re!==void 0||M),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&&O,ie=!k.current.allowUnselectedMouseUp&&!O;J||ie||(Y.current=!0,z.current?.click(),Y.current=!1)}},K=Ht("div",n,{ref:[$,s,v.ref,z],state:Z,props:[C,U,g,V]}),F=x.useMemo(()=>({selected:O,index:L,textRef:b,selectedByFocus:P,hasRegistered:D}),[O,L,b,P,D]);return r.jsx(RC.Provider,{value:F,children:K})})),ED=x.forwardRef(function(n,s){const o=n.keepMounted??!1,{selected:l}=mb();return o||l?r.jsx(ND,{...n,ref:s}):null}),ND=x.memo(x.forwardRef((e,n)=>{const{render:s,className:o,style:l,keepMounted:c,...d}=e,{selected:f}=mb(),p=x.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:Il});return Mr({open:f,ref:p,onComplete(){f||g(!1)}}),v})),RD=x.memo(x.forwardRef(function(n,s){const{index:o,textRef:l,selectedByFocus:c,hasRegistered:d}=mb(),{firstItemTextRef:f,selectedItemTextRef:p}=is(),{render:m,className:g,style:b,...v}=n,S=x.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})})),TC=x.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}=is(),{side:_,scrollDownArrowRef:w,scrollUpArrowRef:k}=fb(),E=m?We.scrollUpArrowVisible:We.scrollDownArrowVisible,N=tt(g,E),R=tt(g,We.openMethod),T=N&&R!=="touch",M=aa(),O=m?k:w,{transitionStatus:P,setMounted:B}=Ac(T);Oe(()=>(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]),Mr({open:T,ref:O,onComplete(){T||B(!1)}});const z=Ht("div",n,{ref:[s,O],state:{direction:d,visible:T,side:_,transitionStatus:P},props:[{"aria-hidden":!0,children:m?"▲":"▼",style:{position:"absolute"},onMouseMove(q){if(q.movementX===0&&q.movementY===0||M.isStarted())return;g.set("activeIndex",null);function Y(){const V=g.state.listElement??b.current;if(!V)return;g.set("activeIndex",null),S();const $=ub(V.scrollHeight,V.clientHeight),Z=Zd(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){M.clear();return}if(X.length>0){const U=O.current?.offsetHeight||0;V.scrollTop=TD(X,m,Z,V.clientHeight,U,$)}M.start(40,Y)}M.start(40,Y)},onMouseLeave(){M.clear()}},p]});return T||f?z:null});function TD(e,n,s,o,l,c){if(n){let g=0;const b=s+l-Ha;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?Zd(S.offsetTop-l,c):0}let d=e.length-1;const f=s+o-l+Ha;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?Zd(m.offsetTop+m.offsetHeight-o+l,c):c}const AD=x.forwardRef(function(n,s){return r.jsx(TC,{...n,ref:s,direction:"down"})}),MD=x.forwardRef(function(n,s){return r.jsx(TC,{...n,ref:s,direction:"up"})}),OD=Wz;function zD({className:e,...n}){return r.jsx(rD,{"data-slot":"select-value",className:Ot("flex flex-1 text-left",e),...n})}function DD({className:e,size:n="default",children:s,...o}){return r.jsxs(aD,{"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(oD,{render:r.jsx(bo,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function LD({className:e,children:n,side:s="bottom",sideOffset:o=4,align:l="center",alignOffset:c=0,alignItemWithTrigger:d=!0,...f}){return r.jsx(iD,{children:r.jsx(hD,{side:s,sideOffset:o,align:l,alignOffset:c,alignItemWithTrigger:d,className:"isolate z-50",children:r.jsxs(wD,{"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(ID,{}),r.jsx(CD,{children:n}),r.jsx(BD,{})]})})})}function PD({className:e,children:n,...s}){return r.jsxs(kD,{"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(RD,{className:"flex min-w-0 flex-1 gap-2 overflow-hidden whitespace-nowrap",children:n}),r.jsx(ED,{render:r.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:r.jsx(fc,{className:"pointer-events-none"})})]})}function ID({className:e,...n}){return r.jsx(MD,{"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(Uw,{})})}function BD({className:e,...n}){return r.jsx(AD,{"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(bo,{})})}function wt({value:e,onChange:n,options:s,placeholder:o="— elegir —",disabled:l,className:c,showIcon:d=!1}){return r.jsxs(OD,{value:e,onValueChange:f=>n(f??""),disabled:l,children:[r.jsx(DD,{className:Me("h-9 w-full",c),children:r.jsx(zD,{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(LD,{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(PD,{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 Z_=320;function UD(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 HD(e){return e.agent_slug||e.actor_id||e.author||e.actor_kind||"—"}function VD({m:e}){const[n,s]=x.useState(!1),o=(e.body?.length||0)>Z_,l=!o||n?e.body:`${e.body.slice(0,Z_)}…`;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(Pw,{size:14,className:"text-blue-400"}):r.jsx(Bw,{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:UD(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:HD(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 qD(){const[e,n]=x.useState(!1),s=Ke(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 $D({pid:e}){const n=!e||String(e)==="0",[s,o]=x.useState(""),[l,c]=x.useState(""),[d,f]=x.useState(""),[p,m]=x.useState(""),g=s.trim()||void 0,b=n?`/messages/global?channel=${g??""}`:`/projects/${e}/messages?channel=${g??""}`,v=Ke(b,()=>n?Dh.global({channel:g,limit:300}):Dh.project(e,{channel:g,limit:300})),S=x.useMemo(()=>[...v.data||[]].sort((w,k)=>(k.ts||"").localeCompare(w.ts||"")),[v.data]),C=x.useMemo(()=>Array.from(new Set(S.map(w=>w.type).filter(Boolean))),[S]),_=x.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($e,{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(ss,{size:13})})]}),children:[n&&r.jsx(qD,{}),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(it,{children:j("logs.error",{msg:v.error.message})}),!v.isLoading&&!v.error&&_.length===0&&r.jsx(it,{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(VD,{m:w},`${w.ts}-${k}`))})]})}function AC({value:e,onChange:n,options:s,placeholder:o="elegí o escribí un modelo…",invalid:l,invalidHint:c,className:d}){const[f,p]=x.useState(!1),[m,g]=x.useState(e),b=x.useRef(null),v=x.useRef(null),[S,C]=x.useState(null);x.useEffect(()=>{g(e)},[e]),x.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]),x.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:Me("relative",d),children:[r.jsxs("div",{className:Me("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(Zw,{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(bo,{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:Me("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 zr(){const{data:e,error:n,isLoading:s,mutate:o}=Ke("/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 MC(){const{data:e,error:n,isLoading:s,mutate:o}=Ke("/admin/super-agent",()=>Cl.superAgent());return{superAgent:e,error:n,isLoading:s,mutate:o}}const GD={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"},FD={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"},cc=[{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 Eg(e,n){return n&&n in e?e[n]:e.custom}const Jd={anthropic:$s,openai:yn,gemini:$T,groq:pc,openrouter:cx,ollama:Kw,azure:AT,mock:Vw,custom:zl},oo={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 OC(e){const n=e.indexOf(":");return n<0?{provider:e,model:""}:{provider:e.slice(0,n),model:e.slice(n+1)}}function Ng({value:e,onChange:n,providers:s}){const{provider:o,model:l}=OC(e),c=s.find(g=>g.slug===o),d=!!o&&!c,f=x.useMemo(()=>{const g=c?oo[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||oo[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:Jd[g.engine]}))}),r.jsx(AC,{value:l,onChange:m,options:f,invalid:d,invalidHint:`El proveedor "${o}" no está configurado.`})]})}function YD(){const e=at(),{superAgent:n,isLoading:s,mutate:o}=MC(),{config:l,patch:c}=zr(),[d,f]=x.useState(""),[p,m]=x.useState([]),[g,b]=x.useState(""),[v,S]=x.useState(null),[C,_]=x.useState(!1),[w,k]=x.useState({model:"",fallback:[]});x.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=x.useMemo(()=>{const L=l.engines||{};return Object.entries(L).map(([D,z])=>({slug:D,engine:z?.engine||D,default_model:z?.default_model||oo[z?.engine||D]?.default_model}))},[l.engines]),N=L=>{const{provider:D}=OC(L);return E.some(z=>z.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)}},M=()=>{const L=g.trim().replace(/:$/,"");!L||!L.includes(":")||p.includes(L)||(m([...p,L]),b(""))},O=(L,D)=>{const z=[...p];z[L]=D,m(z)},P=L=>{m(p.filter((D,z)=>z!==L)),v===L&&S(null)},B=(L,D)=>{const z=L+D;if(z<0||z>=p.length)return;const H=[...p];[H[L],H[z]]=[H[z],H[L]],m(H)};return r.jsx($e,{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(cx,{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(Iw,{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(Ng,{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 z=!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(Ng,{value:L,onChange:q=>O(D,q),providers:E})}):r.jsxs("button",{type:"button",onClick:()=>S(D),className:"flex flex-1 items-center gap-1.5 text-left",children:[z&&r.jsx(Zw,{size:12,className:"text-amber-400"}),r.jsx("span",{className:`font-mono ${z?"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(Ol,{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:()=>P(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(Ng,{value:g,onChange:b,providers:E}),r.jsxs(ge,{size:"sm",variant:"secondary",onClick:M,disabled:!g.includes(":")||g.endsWith(":"),children:[r.jsx(un,{size:13})," Agregar a la cadena"]})]})]}),r.jsx(ge,{variant:"primary",loading:C,disabled:!R,onClick:T,children:R?"Guardar router":"Guardado"})]})})}function XD({provider:e,onEdit:n,onDelete:s,onToggle:o}){const l=Eg(GD,e.engine),c=Eg(FD,e.engine),d=Eg(Jd,e.engine),f=cc.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:Me("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:Me("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:Me("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:Me("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(Ui,{label:"Modelo",value:e.default_model||"—",mono:!0}),e.base_url&&r.jsx(Ui,{label:"Base URL",value:e.base_url,mono:!0,truncate:!0}),r.jsx(Ui,{label:"API key",value:p?m?`…${m}`:"✓ seteada":"—",mono:!!m}),e.default_temperature!==void 0&&r.jsx(Ui,{label:"Temp",value:e.default_temperature.toFixed(1)}),e.pricing?.input_per_million!==void 0&&r.jsx(Ui,{label:"$ in/out (1M)",value:`${e.pricing.input_per_million??0} / ${e.pricing.output_per_million??0}`})]})]})}function Ui({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:Me("text-foreground",s&&"font-mono",o&&"max-w-[180px] truncate"),children:n})]})}const W_={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:""},KD=["anthropic","openai","gemini","groq","openrouter","ollama","custom"];function Hi(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 QD(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 ZD({open:e,initial:n,existingSlugs:s,onClose:o,onSave:l}){const c=!!n,[d,f]=x.useState(W_),[p,m]=x.useState(!1),[g,b]=x.useState(null),[v,S]=x.useState([]),[C,_]=x.useState(!1),[w,k]=x.useState(null),[E,N]=x.useState(!1),[R,T]=x.useState("");x.useEffect(()=>{if(!e)return;const G=n?QD(n):W_;f(G),b(null),k(null),N(!1);const X=oo[G.engine];S(X?.known_models||[])},[e,n]);const M=G=>f(X=>({...X,...G})),O=G=>{const X=oo[G];M({engine:G,name:G==="custom"?d.name:cc.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)},P=G=>{const X=oo[G];M({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 Xd.models({engine:d.engine,slug:d.slug||Hi(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=x.useMemo(()=>d.default_model&&!v.includes(d.default_model)?[d.default_model,...v]:v,[v,d.default_model]),D=()=>{const G=(d.slug||Hi(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}},z=()=>{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||Hi(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&&Va(n?.api_key),Y=El(n?.api_key),V=q?`…${Y??""} (ya seteada)`:"sk-…",$=d.engine==="ollama",Z=oo[d.engine]?.api_key_env;return r.jsx(Mn,{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:KD.map(G=>{const X=Jd[G],U=G==="custom"?"Custom":cc.find(F=>F.value===G)?.label||G,K=d.engine===G;return r.jsxs("button",{type:"button",onClick:()=>O(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):z(),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(kT,{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||Hi(d.name)||"<slug>"} en config.json`,children:r.jsx(ln,{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=>M({name:G.target.value,slug:c?d.slug:Hi(G.target.value)}),placeholder:"Mi provider"})}),r.jsx(de,{label:"Motor (engine)",children:r.jsx(wt,{value:d.engine,onChange:G=>P(G),options:cc.map(G=>({value:G.value,label:G.label,icon:Jd[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=>M({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=>M({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(AC,{value:d.default_model,onChange:G=>M({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(lf,{className:"size-3.5 animate-spin"}):r.jsx(ss,{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=>M({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=>M({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=>M({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=>M({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=>M({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=>M({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=>M({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(ln,{rows:3,className:"font-mono text-xs",value:d.model_context_limits_json,onChange:G=>M({model_context_limits_json:G.target.value})})})]})]}),r.jsx(Zt,{checked:d.is_active,onChange:G=>M({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 WD=new Set(cc.map(e=>e.value));function JD(e,n){const s=typeof n.engine=="string"&&n.engine||(WD.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 e6(){const e=at(),{config:n,isLoading:s,patch:o,mutate:l}=zr(),[c,d]=x.useState(!1),[f,p]=x.useState(null);if(s)return r.jsx(nt,{});const m=n.engines||{},g=Object.entries(m).map(([k,E])=>JD(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},M=[],O=(P,B)=>{B===void 0||B===""?M.push(`${R}.${P}`):T[`${R}.${P}`]=B};O("base_url",k.base_url),O("default_model",k.default_model),O("context_limit_tokens",k.context_limit_tokens),O("pricing",k.pricing),O("model_context_limits",k.model_context_limits),E&&(T[`${R}.api_key`]=E),await o(T,M),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($e,{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(un,{size:14})," ",j("engines_panel.new_btn")]}),children:[g.length===0?r.jsx(it,{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(XD,{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(un,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:"Agregar provider"})]})]}),r.jsx(ZD,{open:c,initial:f,existingSlugs:b,onClose:()=>{d(!1),p(null)},onSave:C})]})}function zC(){return r.jsxs("div",{className:"space-y-6",children:[r.jsx(YD,{}),r.jsx(e6,{})]})}function t6(){const e=at(),[n,s]=x.useState(!1),l=Ke(n?"/agents/vault?include_removed=1":"/agents/vault",()=>en.vault({includeRemoved:n})),c=l.data||[],[d,f]=x.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 en.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 en.vaultRestore(g),e.success(j("base.defaults_restored")),l.mutate()}catch(b){e.error(b.message)}};return r.jsxs($e,{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(un,{size:14})," ",j("base.defaults_new")]})]}),children:[l.isLoading&&r.jsx(nt,{}),!l.isLoading&&c.length===0&&r.jsx(it,{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(Is,{className:"size-4 text-white"}):r.jsx(yn,{className:"size-4 text-white"})}),r.jsx("span",{className:"truncate text-sm font-semibold",children:g.slug}),r.jsx(n6,{source:g.source})]}),r.jsx("div",{className:"flex shrink-0 items-center gap-0.5",children:b?r.jsx(Rg,{label:j("base.defaults_restore"),onClick:()=>m(g.slug),variant:"secondary",children:r.jsx(dx,{size:13})}):r.jsxs(r.Fragment,{children:[r.jsx(Rg,{label:j("base.defaults_edit"),onClick:()=>f(g),variant:"ghost",children:r.jsx(Ol,{size:13})}),r.jsx(Rg,{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($s,{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(zl,{size:9})," ",v]},v))]})]},g.slug)})}),d!==null&&r.jsx(a6,{agent:d==="new"?null:d,onClose:()=>f(null),onSaved:()=>{f(null),l.mutate()}})]})}function n6({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 Rg({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(Gx,{children:[r.jsx(Fx,{render:r.jsx("button",{type:"button",onClick:n,"aria-label":e,className:`${l} ${c[s]}`,children:o})}),r.jsx(Yx,{children:e})]})}function a6({agent:e,onClose:n,onSaved:s}){const o=at(),[l,c]=x.useState(!1),d=!e,[f,p]=x.useState(e?.slug??""),[m,g]=x.useState(e?.role??""),[b,v]=x.useState(e?.model??""),[S,C]=x.useState(e?.description??""),[_,w]=x.useState(e?.language??"es"),[k,E]=x.useState((e?.skills??[]).join(", ")),[N,R]=x.useState((e?.tools??[]).join(", ")),[T,M]=x.useState(!!e?.is_master),[O,P]=x.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 en.vaultCreate(f,L,O),o.success(j("base.defaults_created",{slug:f}))}else await en.vaultPatch(e.slug,{fields:L,body:O}),o.success(j("base.defaults_saved",{slug:e.slug}));s()}catch(D){o.error(D.message)}finally{c(!1)}};return r.jsx(Mn,{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:M,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(ln,{value:O,onChange:L=>P(L.target.value),rows:10,placeholder:"# Mission\\n..."})})]})})}const s6={apx:"success",claude:"info",codex:"warning"};function r6(){const[e,n]=x.useState(""),s=Ke(`/sessions?engine=${e}`,()=>oO.global(e||void 0)),o=s.data?.sessions||[];return r.jsxs($e,{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(ss,{size:13})})]}),children:[s.isLoading&&r.jsx(nt,{}),s.error&&r.jsx(it,{children:j("base.sessions_error",{msg:s.error.message})}),!s.isLoading&&!s.error&&o.length===0&&r.jsx(it,{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:s6[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 o6(){const e=La(),[n,s]=x.useState("open"),o=Ke(`/tasks?state=${n}`,()=>br.global(n));return r.jsxs($e,{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(it,{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 DC=x.createContext(void 0);function gb(){const e=x.useContext(DC);if(e===void 0)throw new Error(On(64));return e}let l6=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const hb={tabActivationDirection:e=>({[l6.activationDirection]:e})},i6=x.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=x.useRef([]),[S,C]=x.useState(()=>new Map),[_,w]=_c({controlled:p,default:l,name:"Tabs",state:"value"}),k=p!==void 0,[E,N]=x.useState(()=>new Map),R=x.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,M]=x.useState(()=>({previousValue:_,tabActivationDirection:"none"})),{previousValue:O,tabActivationDirection:P}=T;let B=P,L=!1;O!==_&&(B=J_(O,_,d,E),L=O!=null&&_!=null&&R(_)==null);const D=L?O:_,z=O!==D||P!==B;Oe(()=>{z&&M({previousValue:D,tabActivationDirection:B})},[D,z,B]);const H=Le((oe,ce)=>{const ee=J_(_,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})}),$=x.useCallback(oe=>S.get(oe),[S]),Z=x.useCallback(oe=>{for(const ce of E.values())if(oe===ce?.value)return ce?.id},[E]),G=x.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=x.useMemo(()=>{for(const oe of E.values())if(oe!=null&&oe.value===_)return oe},[E,_]),U=x.useMemo(()=>{for(const oe of E.values())if(oe!=null&&!oe.disabled)return oe.value},[E]),K=x.useRef(!b),F=x.useRef(b),J=x.useRef(!1);Oe(()=>{if(k)return;function oe(Fe,ve){w(Fe),M(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,X1);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=X1;Te?ve=K1:ce&&(ve=bS),oe(Fe,ve);return}Te&&X!=null&&(q(_,K1),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:hb});return r.jsx(DC.Provider,{value:G,children:r.jsx(db,{elementsRef:v,children:re})})});function J_(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 LC="data-composite-item-active";function c6(e={}){const{highlightItemOnHover:n,highlightedIndex:s,onHighlightedIndexChange:o}=V2(),{ref:l,index:c}=pb(e),d=s===c,f=x.useRef(null),p=Hs(l,f);return{compositeProps:x.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 PC=x.createContext(void 0);function u6(){const e=x.useContext(PC);if(e===void 0)throw new Error(On(65));return e}const d6=x.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}=gb(),{activateOnFocus:C,highlightedTabIndex:_,onTabActivation:w,registerTabResizeObserverElement:k,setHighlightedTabIndex:E,tabsListElement:N}=u6(),R=Or(f),T=x.useMemo(()=>({disabled:l,id:R,value:d}),[l,R,d]),{compositeProps:M,compositeRef:O,index:P}=c6({metadata:T}),B=d===b,L=x.useRef(!1),D=x.useRef(null);x.useEffect(()=>{const K=D.current;if(K)return k(K)},[k]),Oe(()=>{if(L.current){L.current=!1;return}if(!(B&&P>-1&&_!==P))return;const K=N;if(K!=null){const F=In(yt(K));if(F&&Ze(K,F))return}l||E(P)},[B,P,_,E,l,N]);const{getButtonProps:z,buttonRef:H}=Ul({disabled:l,native:p,focusableWhenDisabled:!0}),q=v(d),Y=x.useRef(!1),V=x.useRef(!1);function $(K){B||l||w(d,lt(Us,K.nativeEvent,void 0,{activationDirection:"none"}))}function Z(K){B||(P>-1&&!l&&E(P),!l&&C&&(!Y.current||Y.current&&V.current)&&w(d,lt(Us,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,O,D],props:[M,{role:"tab","aria-controls":q,"aria-selected":B,id:R,onClick:$,onFocus:Z,onPointerDown:G,[LC]:B?"":void 0,onKeyDownCapture(){L.current=!0}},g,z]})});let f6=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e[e.startingStyle=fo.startingStyle]="startingStyle",e[e.endingStyle=fo.endingStyle]="endingStyle",e})({});const p6={...hb,...Il},m6=x.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}=gb(),_=Or(),w=x.useMemo(()=>({id:_,value:l}),[_,l]),{ref:k,index:E}=pb({metadata:w}),N=l===m,{mounted:R,transitionStatus:T,setMounted:M}=Ac(N),O=!R,P=g(l),B={hidden:O,orientation:b,tabActivationDirection:v,transitionStatus:T},L=x.useRef(null),D=Ht("div",n,{state:B,ref:[s,k,L],props:[{"aria-labelledby":P,hidden:O,id:_,role:"tabpanel",tabIndex:N?0:-1,inert:$x(!N),[f6.index]:E},p],stateAttributesMapping:p6});return Mr({open:N,ref:L,onComplete(){N||M(!1)}}),Oe(()=>{if(!(O&&!d)&&_!=null)return S(l,_),()=>{C(l,_)}},[O,d,l,_,S,C]),d||R?D:null});function g6(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const h6=[];function x6(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=h6}=e,[_,w]=x.useState(0),k=s>1,E=x.useRef(null),N=Hs(E,g),R=x.useRef([]),T=x.useRef(!1),M=p??_,O=Le((D,z=!1)=>{if((m??w)(D),z){const H=R.current[D];H_(E.current,H,f,d)}}),P=Le(D=>{if(D.size===0||T.current)return;T.current=!0;const z=Array.from(D.keys()),H=z.find(Y=>Y?.hasAttribute(LC))??null,q=H?z.indexOf(H):-1;q!==-1&&O(q),H_(E.current,H,f,d)}),B=Le((D,z,H)=>l?l?.(D,z,H,R):H),L=x.useMemo(()=>({"aria-orientation":d==="both"?void 0:d,ref:N,onFocus(D){const z=E.current,H=Tn(D.nativeEvent);!z||H==null||!U_(H)||H.setSelectionRange(0,H.value.length??0)},onKeyDown(D){const z=b?ob:J2;if(!z.has(D.key)||b6(D,C)||!E.current)return;const q=f==="rtl",Y=q?Qd:lc,V={horizontal:Y,vertical:fl,both:Y}[d],$=q?lc:Qd,Z={horizontal:$,vertical:oc,both:$}[d],G=Tn(D.nativeEvent);if(G!=null&&U_(G)&&!g6(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=M;const U=jd(R,S),K=wh(R,S);if(k){const re=n||Array.from({length:R.current.length},()=>({width:1,height:1})),oe=ES(re,s,c),ce=oe.findIndex(Te=>Te!=null&&!Ls(R.current,Te,S)),ee=oe.reduce((Te,Fe,ve)=>Fe!=null&&!Ls(R.current,Fe,S)?ve:Te,-1);X=oe[kS(oe.map(Te=>Te!=null?R.current[Te]:null),{event:D,orientation:d,loopFocus:o,onLoop:B,cols:s,disabledIndices:RS([...S||R.current.map((Te,Fe)=>Ls(R.current,Fe)?Fe:void 0),void 0],oe),minIndex:ce,maxIndex:ee,prevIndex:NS(M>K?U:M,re,oe,s,D.key===fl?"bl":D.key===lc?"tr":"tl"),rtl:q})]}const F={horizontal:[Y],vertical:[fl],both:[Y,fl]}[d],J={horizontal:[$],vertical:[oc],both:[$,oc]}[d],ie=k?z:{horizontal:b?tz:Z2,vertical:b?nz:W2,both:z}[d];b&&(D.key===Af?X=U:D.key===Mf&&(X=K)),X===M&&(F.includes(D.key)||J.includes(D.key))&&(o&&X===K&&F.includes(D.key)?(X=U,l&&(X=l(D,M,X,R))):o&&X===U&&J.includes(D.key)?(X=K,l&&(X=l(D,M,X,R))):X=Pn(R.current,{startingIndex:X,decrement:J.includes(D.key),disabledIndices:S})),X!==M&&!bc(R.current,X)&&(v&&D.stopPropagation(),ie.has(D.key)&&D.preventDefault(),O(X,!0),queueMicrotask(()=>{R.current[X]?.focus()}))}}),[s,c,f,S,R,b,M,k,n,o,l,B,N,C,O,d,v]);return x.useMemo(()=>({props:L,highlightedIndex:M,onHighlightedIndexChange:O,elementsRef:R,disabledIndices:S,onMapChange:P,relayKeyboardEvent:L.onKeyDown}),[L,M,O,R,S,P])}function b6(e,n){for(const s of lz.values())if(!n.includes(s)&&e.getModifierState(s))return!0;return!1}function v6(e){const{render:n,className:s,style:o,refs:l=gc,props:c=gc,state:d=cn,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:M=!1,tag:O="div",...P}=e,B=Vx(),{props:L,highlightedIndex:D,onHighlightedIndexChange:z,elementsRef:H,onMapChange:q,relayKeyboardEvent:Y}=x6({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(O,e,{state:d,ref:l,props:[L,...c,P],stateAttributesMapping:f}),$=x.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:z,highlightItemOnHover:M,relayKeyboardEvent:Y}),[D,z,M,Y]);return r.jsx(H2.Provider,{value:$,children:r.jsx(db,{elementsRef:H,onMapChange:Z=>{k?.(Z),q(Z)},children:V})})}const y6=x.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}=gb(),[C,_]=x.useState(0),[w,k]=x.useState(null),E=x.useRef(new Set),N=x.useRef(new Set),R=x.useRef(null);x.useEffect(()=>{if(typeof ResizeObserver>"u")return;const D=new ResizeObserver(()=>{E.current.forEach(z=>{z()})});return R.current=D,w&&D.observe(w),N.current.forEach(z=>{D.observe(z)}),()=>{D.disconnect(),R.current=null}},[w]);const T=Le(D=>(E.current.add(D),()=>{E.current.delete(D)})),M=Le(D=>(N.current.add(D),R.current?.observe(D),()=>{N.current.delete(D),R.current?.unobserve(D)})),O=Le((D,z)=>{D!==b&&m(D,z)}),P={orientation:g,tabActivationDirection:S},B={"aria-orientation":g==="vertical"?"vertical":void 0,role:"tablist"},L=x.useMemo(()=>({activateOnFocus:o,highlightedTabIndex:C,registerIndicatorUpdateListener:T,registerTabResizeObserverElement:M,onTabActivation:O,setHighlightedTabIndex:_,tabsListElement:w}),[o,C,T,M,O,_,w]);return r.jsx(PC.Provider,{value:L,children:r.jsx(v6,{render:d,className:l,style:f,state:P,refs:[s,k],props:[B,p],stateAttributesMapping:hb,highlightedIndex:C,enableHomeAndEndKeys:!0,loopFocus:c,orientation:g,onHighlightedIndexChange:_,onMapChange:v,disabledIndices:gc})})});function Of({className:e,...n}){return r.jsx(i6,{"data-slot":"tabs",className:Ot("flex flex-col gap-4",e),...n})}const _6=nb("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 zf({className:e,variant:n="default",...s}){return r.jsx(y6,{"data-slot":"tabs-list","data-variant":n,className:Ot(_6({variant:n}),e),...s})}function es({className:e,...n}){return r.jsx(d6,{"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 Ma({className:e,...n}){return r.jsx(m6,{"data-slot":"tabs-content",className:Ot("text-sm outline-none",e),...n})}function ej(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 xb(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,xb(l,c)):s[c]=l}return s}function j6(e){const n=JSON.parse(e);if(!n||typeof n!="object"||Array.isArray(n))throw new Error("JSON debe ser objeto.");return n}function Vh({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]=x.useState({}),[v,S]=x.useState(""),[C,_]=x.useState("");x.useEffect(()=>{const N={};for(const R of e.flatMap(T=>T.fields))N[R.path]=ej(n,R.path)??"";b(N),S(JSON.stringify(n||{},null,2)),_("")},[n,e]);const w=x.useMemo(()=>new Set(e.flatMap(N=>N.fields.map(R=>R.path))),[e]),k=async()=>{const N={},R=[];for(const T of e.flatMap(M=>M.fields)){const M=g[T.path];if(!Va(M)){if(M===""||M===void 0||M===null){R.push(T.path);continue}if(T.kind==="number"){const O=Number(M);Number.isFinite(O)&&(N[T.path]=O)}else N[T.path]=M}}await d(N,R.filter(T=>w.has(T)))},E=async()=>{_("");try{await f(j6(v))}catch(N){_(N.message)}};return r.jsxs(Of,{defaultValue:m,className:"space-y-4",children:[r.jsxs(zf,{className:"flex flex-wrap",children:[e.map(N=>r.jsx(es,{value:N.key,children:N.label},N.key)),r.jsx(es,{value:"json",children:"JSON"})]}),e.map(N=>r.jsx(Ma,{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(w6,{field:R,value:g[R.path],inherited:ej(s,R.path),onChange:T=>b(M=>({...M,[R.path]:T}))},R.path))}),r.jsx(ge,{variant:"primary",loading:p,onClick:k,children:c})]})},N.key)),r.jsx(Ma,{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(ln,{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 w6({field:e,value:n,inherited:s,onChange:o}){const l=e.placeholder||tj(s)||(Va(n)?Sr(n):""),c=e.hint||(s!==void 0?`Heredado: ${tj(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(ln,{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(Va(n)?"":n||""),placeholder:e.kind==="password"&&Va(n)?Sr(n):e.kind==="password"&&Va(s)?Sr(s):l,onChange:d=>o(d.target.value)})})}function tj(e){return e==null||e===""?"":Va(e)?Sr(e):Array.isArray(e)?e.join(", "):typeof e=="object"?JSON.stringify(e):String(e)}const S6=[{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:fx.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"}]}],C6=[{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 k6({pid:e}){const n=at(),s=La(),{project:o,mutate:l}=Wx(e),c=Ke(`/projects/${e}/config`,()=>na.config.show(e)),d=String(e)==="0";if(c.isLoading)return r.jsx(nt,{});if(!c.data)return r.jsx(it,{children:j("project.config.no_data")});const f=async m=>{await na.apcProject.put(e,m),n.success(j("project.config.save_project")),c.mutate()},p=async m=>{await na.config.put(e,m),n.success(j("project.config.save_override")),c.mutate()};return r.jsxs("div",{className:"space-y-6",children:[r.jsx($e,{title:j("project.config.section_title"),description:j("project.config.section_desc"),children:r.jsxs(Of,{defaultValue:"override",className:"space-y-4",children:[r.jsxs(zf,{children:[r.jsx(es,{value:"override",children:"Override"}),r.jsx(es,{value:"project",children:"APC project"}),r.jsx(es,{value:"effective",children:"Effective"})]}),r.jsx(Ma,{value:"override",children:r.jsx(Vh,{sections:S6,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 na.config.set(e,m),g.length&&await na.config.unset(e,g),n.success(j("project.config.save_fields_success")),c.mutate()},onSaveJson:p})}),r.jsx(Ma,{value:"project",children:r.jsx(Vh,{sections:C6,source:c.data.apc_project||{},jsonTitle:c.data.project_json_path,jsonDescription:".apc/project.json. Metadata APC portable.",onSaveFields:async(m,g)=>{await na.apcProject.set(e,N6(m),g),n.success(j("project.config.save_meta_success")),c.mutate()},onSaveJson:f})}),r.jsx(Ma,{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(E6,{pid:e,label:o.name||o.path,onRebuilt:()=>c.mutate(),onUnregistered:()=>{l(),s("/")}}):null]})}function E6({pid:e,label:n,onRebuilt:s,onUnregistered:o}){const l=at(),[c,d]=x.useState(null),[f,p]=x.useState(null),m=async()=>{d("rebuild");try{await na.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 na.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($e,{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(ss,{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(Mn,{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(Mn,{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 N6(e){const n={};for(const[s,o]of Object.entries(xb(e)))Va(o)||(n[s]=o);return n}const R6=["","es","en","pt","fr","it","de"],nj=e=>e.split(",").map(n=>n.trim()).filter(Boolean);function IC(e){return e.is_master?{gradient:"from-violet-600 to-indigo-600",Icon:Is}:{gradient:"from-slate-600 to-gray-600",Icon:yn}}function T6(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 A6({pid:e}){const n=La();at();const s=Ke(`/projects/${e}/agents`,()=>en.list(e)),[o,l]=x.useState("hierarchy"),[c,d]=x.useState(!1),[f,p]=x.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}=x.useMemo(()=>T6(m),[m]);return r.jsxs($e,{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:Me("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(cx,{size:13})," ",j("project.agents.hierarchy")]}),r.jsxs("button",{onClick:()=>l("list"),className:Me("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(JT,{size:13})," ",j("project.agents.list_view")]})]}),r.jsxs(ge,{size:"sm",variant:"ghost",onClick:()=>p(!0),children:[r.jsx(fA,{size:13})," ",j("project.agents.import")]}),r.jsxs(ge,{size:"sm",variant:"secondary",onClick:()=>b(),children:[r.jsx(os,{size:13})," ",j("project.agents.chat")]}),r.jsxs(ge,{size:"sm",variant:"primary","data-testid":"agent-new",onClick:()=>d(!0),children:[r.jsx(un,{size:14})," ",j("project.agents.new")]})]}),children:[s.isLoading&&r.jsx(nt,{}),!s.isLoading&&m.length===0&&r.jsx(it,{children:j("project.agents.empty_text")}),!s.isLoading&&m.length>0&&(o==="hierarchy"?r.jsx(O6,{roots:v,childrenByParent:S,onOpen:g,onChat:b}):r.jsx(z6,{agents:m,onOpen:g,onChat:b})),r.jsx(D6,{open:c,pid:e,agents:m,onClose:()=>d(!1),onCreated:()=>{d(!1),s.mutate()}}),r.jsx(M6,{open:f,pid:e,existing:m.map(C=>C.slug),onClose:()=>p(!1),onImported:()=>s.mutate()})]})}function M6({open:e,onClose:n,onImported:s,pid:o,existing:l}){const c=at(),d=Ke(e?"/agents/vault":null,()=>en.vault()),[f,p]=x.useState(""),m=d.data||[],g=async b=>{p(b);try{await en.import(o,b),c.success(j("project.agents.import_success",{slug:b})),s()}catch(v){c.error(v.message)}finally{p("")}};return r.jsxs(Mn,{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(it,{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(yn,{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(Is,{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 O6({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(Tg,{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(Tg,{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(Tg,{agent:f,onOpen:s,onChat:o,compact:!0},f.slug))})]})]},d.slug))})]})]},l.slug)})})}function Tg({agent:e,onOpen:n,onChat:s,wide:o,compact:l}){const{gradient:c,Icon:d}=IC(e);return r.jsxs("div",{"data-testid":`agent-card-${e.slug}`,className:Me("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:Me("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(Is,{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(rf,{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(os,{size:12})," ",j("project.agents.chat")]})]})]})}function z6({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}=IC(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:Me("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(Is,{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($s,{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(zl,{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(rf,{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(os,{size:12})," ",j("project.agents.chat")]})]})]},l.slug)})})}function D6({open:e,onClose:n,onCreated:s,pid:o,agents:l}){const c=at(),[d,f]=x.useState(""),[p,m]=x.useState(""),[g,b]=x.useState(""),[v,S]=x.useState(""),[C,_]=x.useState(""),[w,k]=x.useState(""),[E,N]=x.useState(""),[R,T]=x.useState(!1),[M,O]=x.useState(""),[P,B]=x.useState(!1),L=()=>{f(""),m(""),b(""),S(""),_(""),k(""),N(""),T(!1),O("")},D=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(d)){c.error(j("project.agents.slug_invalid"));return}B(!0);try{await en.create(o,{slug:d,role:p||void 0,model:g||void 0,language:v||void 0,description:C||void 0,skills:nj(w),tools:nj(E),is_master:R,parent:M||void 0}),c.success(j("project.agents.create_success",{slug:d})),s(),L()}catch(z){c.error(z?.message||j("project.agents.create_error"))}finally{B(!1)}};return r.jsx(Mn,{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:P,children:j("common.cancel")}),r.jsx(ge,{variant:"primary","data-testid":"agent-create-submit",onClick:D,loading:P,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:z=>f(z.target.value),placeholder:j("project.agents.slug_ph")})}),r.jsx(de,{label:j("project.agents.role_label"),children:r.jsx(ke,{value:p,onChange:z=>m(z.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:z=>b(z.target.value)})}),r.jsx(de,{label:j("project.agents.lang_label"),children:r.jsx(wt,{value:v,onChange:S,options:R6.map(z=>({value:z,label:z||"—"}))})})]}),r.jsx(de,{label:j("project.agents.desc_label"),children:r.jsx(ln,{rows:2,value:C,onChange:z=>_(z.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:z=>k(z.target.value),placeholder:j("project.agents.skills_ph")})}),r.jsx(de,{label:j("project.agents.tools_label"),children:r.jsx(ke,{value:E,onChange:z=>N(z.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:M,onChange:O,placeholder:j("project.agents.none_parent"),options:[{value:"",label:j("project.agents.none_parent")},...l.filter(z=>z.slug!==d).map(z=>({value:z.slug,label:z.slug}))]})}),r.jsx(Zt,{checked:R,onChange:T,label:j("project.agents.master_label")})]})]})})}function fd(e){return e.split(`
588
- `).map(n=>n.trim()).filter(Boolean)}const lo={exec_agent:{label:"Agente del proyecto",desc:"Ejecuta un agente del proyecto con un prompt. Elegís cuál.",icon:yn},super_agent:{label:"Super-agente",desc:"Llama al super-agente de APX con un prompt.",icon:Is},telegram:{label:"Telegram",desc:"Manda un mensaje fijo a un canal de Telegram. No usa modelo ni agente.",icon:os},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}},L6=Object.keys(lo).map(e=>({value:e,label:lo[e].label,description:lo[e].desc,icon:lo[e].icon}));function BC(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 P6=[{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"}],I6=[{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 B6(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 U6({pid:e}){const n=at(),s=Ke(`/projects/${e}/routines`,()=>xr.list(e)),[o,l]=x.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($e,{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(un,{size:14})," ",j("project.routines.new_btn")]}),children:[s.isLoading&&r.jsx(nt,{}),!s.isLoading&&(s.data?.length??0)===0&&r.jsx(it,{children:j("project.routines.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:(s.data||[]).map(p=>{const m=lo[p.kind],g=m?.icon||pc,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:Me("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(ux,{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:["⏱ ",BC(p.schedule)]}),r.jsx("span",{children:B6(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:Me(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(H6,{draft:o,onClose:()=>l(null),onSaved:()=>{l(null),s.mutate()},pid:e})]})}function H6({draft:e,onClose:n,onSaved:s,pid:o}){const l=at(),c=Ke(e?`/projects/${o}/agents`:null,()=>en.list(o)),[d,f]=x.useState(!1),[p,m]=x.useState(""),[g,b]=x.useState("super_agent"),[v,S]=x.useState("every:10m"),[C,_]=x.useState(!0),[w,k]=x.useState(""),[E,N]=x.useState(""),[R,T]=x.useState("default"),[M,O]=x.useState(""),[P,B]=x.useState(""),[L,D]=x.useState(""),[z,H]=x.useState("heartbeat"),[q,Y]=x.useState(""),[V,$]=x.useState(""),[Z,G]=x.useState("");x.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"),O(ee.chat_id?String(ee.chat_id):""),B(ee.text||""),D(ee.command||""),H(ee.channel||"heartbeat"),Y(ee.message||""),$((e.pre_commands||[]).join(`
589
- `)),G((e.post_commands||[]).join(`
590
- `))},[e]);const X=()=>{switch(g){case"exec_agent":return{agent:w,prompt:E};case"super_agent":return{prompt:E};case"telegram":return{channel:R,...M?{chat_id:M}:{},text:P};case"shell":return{command:L};case"heartbeat":return{channel:z,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=lo[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(Mn,{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:L6})}),r.jsx("p",{className:"-mt-1 text-[11px] text-muted-fg",children:lo[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:[P6.map(ee=>r.jsx("button",{type:"button",onClick:()=>S(ee.value),className:Me("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:Me("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(ln,{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(ln,{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(ln,{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:M,onChange:ee=>O(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(ln,{rows:8,value:P,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(ln,{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:z,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(ln,{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:I6.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:["· ⏱ ",BC(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:Me("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:Me("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(Iw,{size:14,className:"shrink-0 self-center text-muted-fg"})]},ee.id))})]})]})})}function V6({pid:e}){const[n,s]=x.useState("open"),o=at(),l=Ke(`/projects/${e}/tasks?state=${n}`,()=>br.list(e,n),{dedupingInterval:0,revalidateOnFocus:!0}),[c,d]=x.useState(""),[f,p]=x.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($e,{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(un,{size:14})," ",j("project.tasks.add")]})]}),l.isLoading&&r.jsx(nt,{}),!l.isLoading&&(l.data?.length??0)===0&&r.jsxs(it,{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(fc,{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(dx,{size:13})})]})]},b.id))})]})}const q6="\\$\\{var\\.([^}\\s]+)\\}";function UC(e="g"){return new RegExp(q6,e)}function HC(e){return UC("").test(e)}function $6(e){const n=[];let s=0;for(const o of e.matchAll(UC("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 Ag(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 aj(e,n){e.replaceChildren();const s=$6(n);for(const o of s)o.type==="text"?e.appendChild(document.createTextNode(o.value)):e.appendChild(VC(o.value));(s.length===0||s[s.length-1].type==="var")&&e.appendChild(document.createTextNode(""))}function VC(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 G6(e,n){e.deleteContents(),e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const s=window.getSelection();s?.removeAllRanges(),s?.addRange(e)}function F6(e){const n=document.createRange();n.selectNodeContents(e),n.collapse(!1);const s=window.getSelection();s?.removeAllRanges(),s?.addRange(n)}const bb=x.forwardRef(function({value:n,onChange:s,placeholder:o,className:l,varNames:c=[],onCreateVar:d},f){const p=x.useRef(null),m=x.useRef(null),[g,b]=x.useState(!1),[v,S]=x.useState(""),C=x.useRef(n);x.useEffect(()=>{const T=p.current;T&&(n===C.current&&T.childNodes.length>0||(aj(T,n),C.current=n))},[n]);const _=x.useCallback(()=>{const T=p.current;if(!T)return;const M=Ag(T);C.current=M,M!==n&&s(M)},[s,n]),w=x.useCallback(()=>{const T=p.current;if(!T)return;const M=Ag(T);if(HC(M)&&X6(T)){const O=K6(T);aj(T,M),O!=null&&Q6(T,O)}C.current=Ag(T),C.current!==n&&s(C.current)},[s,n]),k=x.useCallback(()=>{const T=window.getSelection();if(!T||T.rangeCount===0)return;const M=T.getRangeAt(0),O=p.current;O&&O.contains(M.startContainer)&&(m.current=M.cloneRange())},[]),E=x.useCallback(T=>{if(T.key==="Enter"){T.preventDefault(),T.currentTarget.blur();return}if(T.key==="Backspace"){const M=window.getSelection();if(!M||M.rangeCount===0)return;const O=M.getRangeAt(0);if(!O.collapsed)return;const{startContainer:P,startOffset:B}=O;if(P.nodeType===Node.TEXT_NODE&&B===0){const L=P.previousSibling;if(L instanceof HTMLElement&&L.dataset.varName){T.preventDefault(),L.remove(),_();return}}else if(P===p.current){const L=P.childNodes[B-1];if(L instanceof HTMLElement&&L.dataset.varName){T.preventDefault(),L.remove(),_();return}}}},[_]),N=x.useCallback(T=>{const M=p.current;if(!M)return;const O=m.current;M.focus();let P;O&&M.contains(O.startContainer)?P=O:(P=document.createRange(),P.selectNodeContents(M),P.collapse(!1)),G6(P,VC(T)),m.current=null,_()},[_]);x.useImperativeHandle(f,()=>({insertVar:N,focus:()=>p.current?.focus()}),[N]);const R=c.filter(T=>T.toLowerCase().includes(v.toLowerCase()));return r.jsxs("div",{className:Me("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:Me("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:Me("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(un,{size:14})}),g&&r.jsx(Y6,{query:v,onQuery:S,varNames:R,onPick:T=>{N(T),b(!1),S("")},onClose:()=>{b(!1),S("")},onCreateVar:d})]})]})});function Y6({query:e,onQuery:n,varNames:s,onPick:o,onClose:l,onCreateVar:c}){const d=x.useRef(null),f=x.useRef(null);return x.useEffect(()=>{f.current?.focus({preventScroll:!0})},[]),x.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(un,{size:12})," Crear nueva variable…"]})})]})}function X6(e){for(const n of Array.from(e.childNodes))if(n.nodeType===Node.TEXT_NODE&&HC(n.textContent??""))return!0;return!1}function K6(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 Q6(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()}F6(e)}function sj(e){return e?Object.entries(e).map(([n,s])=>({key:n,value:String(s)})):[]}function rj(e){const n={};for(const s of e)s.key.trim()&&(n[s.key.trim()]=s.value);return n}function oj({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(bb,{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(un,{size:12})," Agregar fila"]})]})}const Z6={apc:"Shared",runtime:"Runtime",global:"Global"},W6={apc:"info",runtime:"success",global:"muted"};function qh(e){return e==="runtime"?"runtime":e==="global"?"global":"shared"}function J6(e){return Z6[e]??e}function eL({pid:e}){const n=at(),s=Ke(`/projects/${e}/mcps`,()=>vr.list(e)),o=Ke(`/projects/${e}/mcps/check`,()=>vr.check(e)),l=Ke(`/projects/${e}/vars`,()=>yc.list(e)),[c,d]=x.useState(null),[f,p]=x.useState(null),[m,g]=x.useState(null),b=x.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,qh(_.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($e,{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(un,{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(it,{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=qh(_.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:W6[_.source]??"muted",children:J6(_.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(Vw,{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(Od,{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(Ol,{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(tL,{result:m.result,busy:!!m.busy,onClose:()=>g(null)})]},`${_.source}-${_.name}`)})}),c&&r.jsx(aL,{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(nL,{pid:e,mcpName:f,runningTest:!!m?.busy})})]})}function tL({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(lx,{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(NT,{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 nL({pid:e,mcpName:n,runningTest:s}){const[o,l]=x.useState(null),[c,d]=x.useState(null),f=x.useRef(null);x.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=x.useRef(null);return x.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 aL({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]=x.useState(!1),[b,v]=x.useState(p?qh(p.source):"runtime"),[S,C]=x.useState(p?.name||""),[_,w]=x.useState(p?.transport==="http"||p?.url?"http":"stdio"),[k,E]=x.useState(p?.command||""),[N,R]=x.useState(p?.args&&p.args.length?p.args:[""]),[T,M]=x.useState(sj(p?.env)),[O,P]=x.useState(p?.url||""),[B,L]=x.useState(sj(p?.headers)),[D,z]=x.useState(p?.enabled!==!1),[H,q]=x.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?rj(T):void 0,enabled:D}:{name:S.trim(),url:O.trim(),headers:B.length?rj(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(Mn,{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(sL,{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(oj,{rows:T,onChange:M,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(bb,{value:O,onChange:P,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(oj,{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:z,label:j("project.mcps.enabled_label")})]})}),H&&r.jsx(rL,{pid:n,onClose:()=>q(!1),onCreated:()=>{q(!1),c()}})]})}function sL({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(bb,{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(un,{size:12})," ",j("project.mcps.add_arg")]})]})}function rL({pid:e,onClose:n,onCreated:s}){const o=at(),l=String(e)==="0",[c,d]=x.useState(""),[f,p]=x.useState(""),[m,g]=x.useState(!1),[b,v]=x.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(Mn,{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 oL({pid:e}){const n=at(),s=String(e)==="0",[o,l]=x.useState(s?"global":"all"),[c,d]=x.useState(!1),f=Ke(`/projects/${e}/vars?reveal=${c?1:0}`,()=>yc.list(e,{reveal:c})),[p,m]=x.useState(null),g=x.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($e,{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(un,{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(Mg,{active:o==="all",onClick:()=>l("all"),children:j("project.vars.filter_all")}),r.jsx(Mg,{active:o==="project",onClick:()=>l("project"),children:j("project.vars.filter_project")}),r.jsx(Mg,{active:o==="global",onClick:()=>l("global"),children:j("project.vars.filter_global")})]}),f.isLoading&&r.jsx(nt,{}),!f.isLoading&&g.length===0&&r.jsx(it,{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(Ol,{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(lL,{open:p!==null,initial:p||void 0,onClose:()=>m(null),pid:e,isBase:s,onSaved:()=>{m(null),f.mutate()}})]})}function Mg({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 lL({open:e,onClose:n,pid:s,isBase:o,initial:l,onSaved:c}){const d=at(),[f,p]=x.useState(!1),[m,g]=x.useState(!1),[b,v]=x.useState(l?.name||""),[S,C]=x.useState(l?.value||""),[_,w]=x.useState(l?.scope||(o?"global":"project")),k=!!l?.name;x.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(Mn,{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(DT,{size:14}):r.jsx(rf,{size:14})})]})})]})})}function iL({pid:e}){const n=Ke(`/projects/${e}/agents`,()=>en.list(e)),[s,o]=x.useState(null),[l,c]=x.useState(null);return r.jsxs($e,{title:j("project.threads.title"),description:j("project.threads.subtitle"),children:[n.isLoading&&r.jsx(nt,{}),!n.isLoading&&(n.data?.length??0)===0&&r.jsx(it,{children:j("project.threads.no_agents")}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:[r.jsx("ul",{className:"space-y-1 md:col-span-1",children:(n.data||[]).map(d=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>o(d.slug),className:Me("flex w-full items-center justify-between rounded-md px-2.5 py-1.5 text-sm",s===d.slug?"bg-accent text-accent-fg":"text-foreground hover:bg-accent/60"),children:[r.jsx("span",{children:d.slug}),d.model&&r.jsx(Ve,{tone:"info",children:d.model})]})},d.slug))}),r.jsx("div",{className:"md:col-span-2",children:s?r.jsx(cL,{pid:e,slug:s,onOpen:c}):r.jsx(it,{children:j("project.threads.pick")})})]}),s&&l&&r.jsx(uL,{pid:e,slug:s,id:l,onClose:()=>c(null)})]})}function cL({pid:e,slug:n,onOpen:s}){const o=Ke(`/projects/${e}/agents/${n}/conversations`,()=>Zx.list(e,n));return o.isLoading?r.jsx(nt,{}):o.data?.length?r.jsx("ul",{className:"space-y-1 text-sm",children:o.data.map(l=>r.jsxs("li",{className:"cursor-pointer rounded-md border border-border bg-muted/30 px-3 py-2 hover:bg-accent/40",onClick:()=>s(l.id),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium",children:l.title||l.filename}),r.jsx("span",{className:"text-xs text-muted-fg",children:new Date(l.started_at).toLocaleString()})]}),r.jsxs("div",{className:"mt-0.5 text-xs text-muted-fg",children:[l.channel&&r.jsxs(r.Fragment,{children:[j("project.threads.via")," ",l.channel," · "]}),l.messages??0," ",j("project.threads.messages")]})]},l.id))}):r.jsx(it,{children:j("project.threads.empty",{slug:n})})}function uL({pid:e,slug:n,id:s,onClose:o}){const l=Ke(`/projects/${e}/agents/${n}/conversations/${s}`,()=>Zx.get(e,n,s));return r.jsxs(Mn,{open:!0,onClose:o,title:j("project.threads.conversation_title",{id:s}),size:"lg",children:[l.isLoading&&r.jsx(nt,{}),l.data&&r.jsx("div",{className:"max-h-[60vh] space-y-3 overflow-y-auto pr-2",children:l.data.messages.map((c,d)=>r.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3 text-sm",children:[r.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs text-muted-fg",children:[r.jsxs("span",{className:"uppercase tracking-wide",children:[c.role,c.name?` (${c.name})`:""]}),c.ts&&r.jsx("span",{children:new Date(c.ts).toLocaleString()})]}),r.jsx("div",{className:"whitespace-pre-wrap",children:c.content})]},d))})]})}function vb({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=x.useRef(null);x.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(po,{type:"button",size:"icon-sm",variant:"destructive",onClick:o,"aria-label":j("chat_ui.stop"),title:j("chat_ui.stop"),children:r.jsx(Qw,{className:"size-3.5",fill:"currentColor"})}):r.jsx(po,{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(ST,{className:"size-4"})})]})]})}function yb({value:e,onChange:n,disabled:s}){const[o,l]=x.useState(!1),[c,d]=x.useState(""),[f,p]=x.useState([]),[m,g]=x.useState(!1),b=x.useRef(null);x.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]),x.useEffect(()=>{if(!o||m)return;let w=!1;return(async()=>{try{const{engines:k}=await Xd.list(),E=await Promise.all(k.map(N=>Xd.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:Me("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(Kw,{className:"size-3 shrink-0"}),r.jsx("span",{className:"truncate font-mono",children:C}),r.jsx(bo,{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:Me("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(fc,{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:Me("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(fc,{className:"size-3 shrink-0"})]})},w))]})]})]})}function dL({onSend:e,onStop:n,streaming:s,model:o,onModelChange:l}){const[c,d]=x.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(vb,{value:c,onValueChange:d,onSubmit:f,onStop:n,busy:s,placeholder:j("project.chat.placeholder"),maxRows:12,footer:l?r.jsx(yb,{value:o||"",onChange:l,disabled:s}):void 0})})}const fL={read_file:{icon:BT,label:"Leer archivo"},write_file:{icon:IT,label:"Escribir archivo"},edit_file:{icon:Md,label:"Editar archivo"},list_files:{icon:Gw,label:"Listar archivos"},search_files:{icon:yd,label:"Buscar en archivos"},search_messages:{icon:yd,label:"Buscar mensajes"},tail_messages:{icon:yd,label:"Últimos mensajes"},run_shell:{icon:kr,label:"Ejecutar shell"},send_telegram:{icon:os,label:"Enviar Telegram"},call_agent:{icon:yn,label:"Llamar agente"},call_mcp:{icon:oA,label:"Llamar MCP"},call_runtime:{icon:yn,label:"Llamar runtime"},create_task:{icon:WT,label:"Crear tarea"}},qC=new Set(["write_file","edit_file"]);function pL(e){return fL[e]||{icon:zl,label:e}}function mL(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 lj(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function gL({status:e}){return e==="running"?r.jsx(lf,{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(OT,{className:"size-3 shrink-0 text-amber-400"}):r.jsx(fc,{className:"size-3 shrink-0 text-emerald-400"})}function hL({part:e}){const[n,s]=x.useState(!1),{icon:o,label:l}=pL(e.tool),c=mL(e.tool,e.args),d=qC.has(e.tool),f=!!e.args||e.result!==void 0;return r.jsxs("div",{className:Me("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(sf,{className:Me("size-3 shrink-0 text-muted-foreground transition-transform",n&&"rotate-90")}):r.jsx("span",{className:"size-3 shrink-0"}),r.jsx(o,{className:Me("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(gL,{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:lj(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:Me("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:lj(e.result)})]})]})]})}function xL(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 bL({part:e,pending:n}){const s=xL(e),o=j(n?"ask_panel.status_waiting":"ask_panel.status_received");return r.jsxs("div",{className:Me("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(lf,{className:"size-3.5 shrink-0 animate-spin text-amber-600 dark:text-amber-400"}):r.jsx(lx,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),r.jsx(Fw,{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 $C(e){const n=e.split(`
591
- `),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 vL({text:e}){const n=$C(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(Fw,{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:Me("whitespace-pre-wrap text-[13px] leading-snug",s.skipped?"italic text-muted-foreground/70":"text-muted-foreground"),children:s.answer})]},o))})]})}):null}function $h(e){return e.parts.filter(n=>n.kind==="text").map(n=>n.text).join(`
592
-
593
- `).trim()}function yL(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]
594
- ${s.join(`
595
- `)}`}function _L(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=yL(s);o&&n.push(o)}return n.join(`
596
-
597
- `).trim()}const jL=e=>[{kind:"text",text:e}];function wL(e){if(!e||typeof e!="object")return!1;const n=e;return"error"in n&&!!n.error}function _b(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=wL(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 SL(e,n){const[s,o]=x.useState([]),[l,c]=x.useState(!1),d=x.useRef(null),f=x.useRef(void 0),p=x.useCallback(S=>{o(C=>{const _=[...C],w=_[_.length-1];return w&&w.role==="assistant"&&(_[_.length-1]=S(w)),_})},[]),m=x.useCallback(S=>{if(S.type==="error"){n?.(S.error||"stream error");return}p(C=>_b(C,S))},[p,n]),g=x.useCallback(async(S,C={})=>{const _=S.trim();if(!_||l)return;const w=()=>new Date().toISOString(),k=s.map(N=>({role:N.role,content:_L(N)}));if(o(N=>[...N,{role:"user",parts:jL(_),ts:w()},{role:"assistant",parts:[],ts:w(),pending:!0}]),c(!0),C.agentSlug){try{const N=await en.chat(e,C.agentSlug,{prompt:_,conversation_id:f.current,model:C.model||void 0});f.current=N.conversation_id,p(R=>({...R,pending:!1,model:N.engine,parts:[{kind:"text",text:N.text}]}))}catch(N){n?.(N?.message||"fallo"),o(R=>R.filter((T,M)=>M!==R.length-1))}finally{c(!1)}return}const E=new AbortController;d.current=E;try{await I2.stream(e,{prompt:_,previousMessages:k,model:C.model||void 0,channel:"web"},m,E.signal),p(N=>({...N,pending:!1}))}catch(N){E.signal.aborted?p(R=>({...R,pending:!1,parts:[...R.parts,{kind:"text",text:"[detenido]"}]})):(n?.(N?.message||"stream falló"),o(R=>R.filter((T,M)=>M!==R.length-1)))}finally{c(!1),d.current=null}},[e,s,l,m,p,n]),b=x.useCallback(()=>d.current?.abort(),[]),v=x.useCallback(()=>{l||(f.current=void 0,o([]))},[l]);return{msgs:s,send:g,stop:b,clear:v,streaming:l}}function CL({msg:e,isLast:n,isAskAnswer:s,onCopy:o}){const l=e.role==="user",c=$h(e),d=e.parts.some(f=>f.kind==="tool");if(l&&s){const f=$h(e);if($C(f))return r.jsx(vL,{text:f})}return r.jsxs("div",{className:Me("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(yn,{size:14})}),r.jsxs("div",{className:Me("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(KT,{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($s,{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(bL,{part:f,pending:!!n},`${f.id}-${p}`):r.jsx(hL,{part:f},`${f.id}-${p}`):f.text?r.jsx("div",{className:Me("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:kL(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(Ad,{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(Ww,{size:14})})]})}function kL(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function jb({msgs:e,onCopy:n}){const s=x.useRef(null);if(x.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(it,{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(CL,{msg:l,isLast:c===o,isAskAnswer:EL(e,c),onCopy:n},c)),r.jsx("div",{ref:s})]})}function EL(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 NL(e){if(!e)return;const n=e.path??e.file??e.filename;return typeof n=="string"?n:void 0}function GC({msgs:e}){const[n,s]=x.useState(!1),{inTok:o,outTok:l,toolCount:c,changed:d,model:f}=x.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,qC.has(w.tool)&&w.status!=="error")){const k=NL(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:Me("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(of,{size:12})," ",Og(p)," tok",r.jsxs("span",{className:"text-muted-foreground/60",children:["(",Og(o),"↑ / ",Og(l),"↓)"]})]}),c>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(zl,{size:12})," ",c," tools"]}),d.length>0&&r.jsxs("span",{className:"flex items-center gap-1 text-violet-400",children:[r.jsx(Md,{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(bo,{className:Me("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(Md,{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 Og(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function dl(){return{picked:new Set,text:"",skipped:!1}}function ij(e,n){const s=[];return e.forEach((o,l)=>{const c=n[l]||dl();if(c.skipped){s.push(`- ${o.question}
598
- → (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}
599
- → ${p}`)}),s.join(`
600
- `)}function FC({turnKey:e,questions:n,onSubmit:s,onDismiss:o,disabled:l}){const c=n.length,[d,f]=x.useState(0),[p,m]=x.useState(()=>n.map(()=>dl()));x.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,_=M=>{m(O=>{const P=[...O],B=P[d]||dl();return P[d]={...B,...M,skipped:!1},P})},w=M=>{m(O=>{const P=[...O],B=P[d]||dl(),L=new Set(B.picked);return S?L.has(M)?L.delete(M):L.add(M):(L.clear(),L.add(M)),P[d]={...B,picked:L,skipped:!1},P})},k=x.useMemo(()=>!0,[]),E=d===c-1,N=()=>f(M=>Math.max(0,M-1)),R=()=>{if(E){s(ij(n,p));return}f(M=>Math.min(c-1,M+1))},T=()=>{if(m(M=>{const O=[...M];return O[d]={picked:new Set,text:"",skipped:!0},O}),E){const M=p.map((O,P)=>P===d?{picked:new Set,text:"",skipped:!0}:O);s(ij(n,M))}else f(M=>Math.min(c-1,M+1))};return x.useEffect(()=>{const M=O=>{if(l)return;const P=O.target?.tagName?.toLowerCase(),B=P==="input"||P==="textarea";if(O.key==="Enter"&&(O.metaKey||O.ctrlKey)){O.preventDefault(),R();return}if(!B&&v&&/^[1-9]$/.test(O.key)){const L=parseInt(O.key,10)-1;L<(g?.options?.length||0)&&(O.preventDefault(),w(L))}};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)}),!g||c===0?null:r.jsxs("div",{className:Me("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((M,O)=>{const P=b.picked.has(O);return r.jsxs("button",{type:"button",onClick:()=>w(O),className:Me("flex w-full items-start gap-2 rounded-md border border-transparent px-2 py-1.5 text-left transition",P?"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:M.label}),M.description&&r.jsx("div",{className:"text-[11px] text-muted-foreground",children:M.description})]}),S?r.jsx("span",{className:Me("mt-0.5 grid size-4 shrink-0 place-items-center rounded border",P?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-background"),children:P&&r.jsx("span",{className:"text-[10px] leading-none",children:"✓"})}):r.jsx("span",{className:Me("mt-0.5 grid size-4 shrink-0 place-items-center rounded border font-mono text-[10px]",P?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-muted text-muted-foreground"),children:O+1})]},`${O}:${M.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:M=>_({text:M.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(MT,{className:"size-3 opacity-60"})]})]})]})]})}function RL(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 YC(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(RL).filter(g=>!!g),d.length>0)break;return d.length?{turnKey:`${n.ts||""}#${o}`,questions:d}:null}const Vi="__super_agent__";function TL({pid:e}){const n=at(),[s]=zw(),o=Ke(`/projects/${e}/agents`,()=>en.list(e)),[l,c]=x.useState(s.get("agent")||""),[d,f]=x.useState(!1),[p,m]=x.useState(""),[g,b]=x.useState(null),{msgs:v,send:S,stop:C,clear:_,streaming:w}=SL(e,z=>n.error(z)),k=tb(),E=o.data||[],N=z=>z===Vi,R=x.useMemo(()=>[{value:Vi,label:`${k} (super-agent)`},...E.map(z=>({value:z.slug,label:z.slug}))],[E,k]),T=x.useMemo(()=>E.find(z=>z.slug===l)||E[0],[E,l]),M=N(l)?Vi:T?.slug||Vi,O=M===Vi;x.useEffect(()=>{!l&&T?.slug&&c(T.slug)},[T?.slug,l]);const P=()=>_(),B=async z=>{!O&&!T||await S(z,{model:p||void 0,agentSlug:O?void 0:T.slug})},L=async z=>{try{await navigator.clipboard.writeText(z),n.info(j("project.chat.copied"))}catch{}};if(o.isLoading)return r.jsx(nt,{});const D=O?j("project.chat.superagent_subtitle",{persona:k}):j("project.chat.subtitle");return r.jsxs("div",{className:"flex h-full flex-col overflow-hidden rounded-xl border border-border bg-card/40",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:"text-sm font-semibold",children:O?j("project.chat.superagent_title",{persona:k}):j("project.chat.title")}),r.jsx("p",{className:"truncate text-[11px] text-muted-fg",children:D})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-52",children:r.jsx(wt,{value:M,onChange:z=>{c(z),P()},options:R})}),O?r.jsx(Ve,{tone:"success",children:"super-agent"}):T?.model&&r.jsx(Ve,{tone:"info",children:T.model}),!E.length&&!O&&r.jsxs(ge,{variant:"primary",size:"sm",onClick:()=>f(!0),children:[r.jsx(un,{size:14})," ",j("project.chat.create_agent")]}),r.jsxs(ge,{variant:"ghost",size:"sm",disabled:w||v.length===0,onClick:P,children:[r.jsx(la,{size:13})," ",j("project.chat.clear")]})]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:v.length?r.jsx(jb,{msgs:v,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(GC,{msgs:v}),(()=>{const z=w?null:YC(v);return!z||z.turnKey===g?null:r.jsx(FC,{turnKey:z.turnKey,questions:z.questions,onSubmit:H=>void B(H),onDismiss:()=>b(z.turnKey),disabled:w})})(),r.jsx(dL,{onSend:B,onStop:C,streaming:w,model:p,onModelChange:m}),r.jsx(AL,{open:d,pid:e,onClose:()=>f(!1),onCreated:()=>{f(!1),o.mutate()}})]})}function AL({open:e,onClose:n,onCreated:s,pid:o}){const l=at(),[c,d]=x.useState(""),[f,p]=x.useState("master"),[m,g]=x.useState(""),[b,v]=x.useState(!0),[S,C]=x.useState(!1),_=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(c)){l.error(j("project.agents.slug_invalid"));return}C(!0);try{await en.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(Mn,{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 ML({pid:e}){const n=at(),{project:s}=Wx(e),{channels:o,isLoading:l,mutate:c}=ib(),d=String(e),f=s?.name||s?.path?.split("/").pop()||d,p=`proj-${d}`,m=o.find(O=>O.project===d||O.project===f||O.name===p),[g,b]=x.useState(!!m),[v,S]=x.useState(""),[C,_]=x.useState(""),[w,k]=x.useState(""),[E,N]=x.useState(!0),[R,T]=x.useState(!1);if(x.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 M=async()=>{T(!0);try{if(!g){m&&(await An.channels.remove(m.name),n.success(j("project.telegram.cleared"))),await c();return}const O={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,O):await An.channels.upsert(O),n.success(j("project.telegram.saved")),await c(),S("")}catch(O){n.error(O.message)}finally{T(!1)}};return r.jsx($e,{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:O=>S(O.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:O=>_(O.target.value)})}),r.jsx(de,{label:j("project.telegram.route_agent"),hint:j("project.telegram.route_hint"),children:r.jsx(ke,{value:w,onChange:O=>k(O.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:M,children:j("common.save")})}),!g&&!m&&r.jsx(it,{children:j("project.telegram.no_override")})]})})}function XC({load:e,save:n,rows:s=10,placeholder:o}){const l=at(),[c,d]=x.useState(null),[f,p]=x.useState(""),[m,g]=x.useState(!1);if(x.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(ln,{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(cf,{size:12})," ",j("project.memories.save_btn")]})]})]})}function OL({pid:e,agent:n}){const[s,o]=x.useState(!1),l=n.is_master?Is:yn;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(bo,{size:14,className:"text-muted-fg"}):r.jsx(sf,{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(XC,{rows:8,load:()=>en.memory.get(e,n.slug).then(c=>c.body),save:c=>en.memory.put(e,n.slug,c).then(()=>{})})})]})}function zL({pid:e}){const n=Ke(`/projects/${e}/agents`,()=>en.list(e));return r.jsxs("div",{className:"space-y-6",children:[r.jsx($e,{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(Td,{className:"size-4 text-white"})}),r.jsx("div",{className:"min-w-0 flex-1",children:r.jsx(XC,{rows:12,load:()=>na.memory.get(e).then(s=>s.body),save:s=>na.memory.put(e,s).then(()=>{}),placeholder:j("project.memories.project_ph")})})]})}),r.jsxs($e,{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(it,{children:j("project.memories.no_agents")}),r.jsx("ul",{className:"space-y-2",children:(n.data||[]).map(s=>r.jsx(OL,{pid:e,agent:s},s.slug))})]})]})}function DL(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 LL(e){const n=+this._x.call(null,e),s=+this._y.call(null,e);return KC(this.cover(n,s),n,s,e)}function KC(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 PL(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)KC(this,d[s],f[s],e[s]);return this}function IL(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 BL(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function UL(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 HL(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 VL(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 $L(){return this._root}function GL(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function FL(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 YL(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 XL(e){return e[0]}function KL(e){return arguments.length?(this._x=e,this):this._x}function QL(e){return e[1]}function ZL(e){return arguments.length?(this._y=e,this):this._y}function wb(e,n,s){var o=new Sb(n??XL,s??QL,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function Sb(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 cj(e){for(var n={data:e.data},s=n;e=e.next;)s=s.next={data:e.data};return n}var Yn=wb.prototype=Sb.prototype;Yn.copy=function(){var e=new Sb(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=cj(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]=cj(o));return e};Yn.add=LL;Yn.addAll=PL;Yn.cover=IL;Yn.data=BL;Yn.extent=UL;Yn.find=HL;Yn.remove=VL;Yn.removeAll=qL;Yn.root=$L;Yn.size=GL;Yn.visit=FL;Yn.visitAfter=YL;Yn.x=KL;Yn.y=ZL;function io(e){return function(){return e}}function _r(e){return(e()-.5)*1e-6}function WL(e){return e.x+e.vx}function JL(e){return e.y+e.vy}function eP(e){var n,s,o,l=1,c=1;typeof e!="function"&&(e=io(e==null?1:+e));function d(){for(var m,g=n.length,b,v,S,C,_,w,k=0;k<c;++k)for(b=wb(n,WL,JL).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,M,O){var P=N.data,B=N.r,L=_+B;if(P){if(P.index>v.index){var D=S-P.x-P.vx,z=C-P.y-P.vy,H=D*D+z*z;H<L*L&&(D===0&&(D=_r(o),H+=D*D),z===0&&(z=_r(o),H+=z*z),H=(L-(H=Math.sqrt(H)))/H*l,v.vx+=(D*=H)*(L=(B*=B)/(w+B)),v.vy+=(z*=H)*L,P.vx-=D*(L=1-L),P.vy-=z*L)}return}return R>S+L||M<S-L||T>C+L||O<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:io(+m),p(),d):e},d}function tP(e){return e.index}function uj(e,n){var s=e.get(n);if(!s)throw new Error("node not found: "+n);return s}function nP(e){var n=tP,s=b,o,l=io(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,M,O,P,B,L;N<E;++N)R=e[N],T=R.source,M=R.target,O=M.x+M.vx-T.x-T.vx||_r(m),P=M.y+M.vy-T.y-T.vy||_r(m),B=Math.sqrt(O*O+P*P),B=(B-c[N])/B*w*o[N],O*=B,P*=B,M.vx-=O*(L=p[N]),M.vy-=P*L,T.vx+=O*(L=1-L),T.vy+=P*L}function S(){if(d){var w,k=d.length,E=e.length,N=new Map(d.map((T,M)=>[n(T,M,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=uj(N,R.source)),typeof R.target!="object"&&(R.target=uj(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:io(+w),C(),v):s},v.distance=function(w){return arguments.length?(l=typeof w=="function"?w:io(+w),_(),v):l},v}var aP={value:()=>{}};function QC(){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 kd(s)}function kd(e){this._=e}function sP(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}})}kd.prototype=QC.prototype={constructor:kd,on:function(e,n){var s=this._,o=sP(e+"",s),l,c=-1,d=o.length;if(arguments.length<2){for(;++c<d;)if((l=(e=o[c]).type)&&(l=rP(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]=dj(s[l],e.name,n);else if(n==null)for(l in s)s[l]=dj(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 kd(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 rP(e,n){for(var s=0,o=e.length,l;s<o;++s)if((l=e[s]).name===n)return l.value}function dj(e,n,s){for(var o=0,l=e.length;o<l;++o)if(e[o].name===n){e[o]=aP,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,ZC=1e3,ef,tc,tf=0,mo=0,Df=0,jc=typeof performance=="object"&&performance.now?performance:Date,WC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function JC(){return mo||(WC(oP),mo=jc.now()+Df)}function oP(){mo=0}function Gh(){this._call=this._time=this._next=null}Gh.prototype=ek.prototype={constructor:Gh,restart:function(e,n,s){if(typeof e!="function")throw new TypeError("callback is not a function");s=(s==null?JC():+s)+(n==null?0:+n),!this._next&&tc!==this&&(tc?tc._next=this:ef=this,tc=this),this._call=e,this._time=s,Fh()},stop:function(){this._call&&(this._call=null,this._time=1/0,Fh())}};function ek(e,n,s){var o=new Gh;return o.restart(e,n,s),o}function lP(){JC(),++Rl;for(var e=ef,n;e;)(n=mo-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Rl}function fj(){mo=(tf=jc.now())+Df,Rl=ec=0;try{lP()}finally{Rl=0,cP(),mo=0}}function iP(){var e=jc.now(),n=e-tf;n>ZC&&(Df-=n,tf=e)}function cP(){for(var e,n=ef,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:ef=s);tc=e,Fh(o)}function Fh(e){if(!Rl){ec&&(ec=clearTimeout(ec));var n=e-mo;n>24?(e<1/0&&(ec=setTimeout(fj,e-jc.now()-Df)),qi&&(qi=clearInterval(qi))):(qi||(tf=jc.now(),qi=setInterval(iP,ZC)),Rl=1,WC(fj))}}const uP=1664525,dP=1013904223,pj=4294967296;function fP(){let e=1;return()=>(e=(uP*e+dP)%pj)/pj}function pP(e){return e.x}function mP(e){return e.y}var gP=10,hP=Math.PI*(3-Math.sqrt(5));function xP(e){var n,s=1,o=.001,l=1-Math.pow(o,1/300),c=0,d=.6,f=new Map,p=ek(b),m=QC("tick","end"),g=fP();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=gP*Math.sqrt(.5+_),N=_*hP;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,M,O,P;for(k==null?k=1/0:k*=k,E=0;E<N;++E)O=e[E],R=_-O.x,T=w-O.y,M=R*R+T*T,M<k&&(P=O,k=M);return P},on:function(_,w){return arguments.length>1?(m.on(_,w),n):m.on(_)}}}function bP(){var e,n,s,o,l=io(-30),c,d=1,f=1/0,p=.81;function m(S){var C,_=e.length,w=wb(e,pP,mP).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:io(+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"},mj={agent:"agente",memory:"memoria",thread:"thread",task:"task",routine:"rutina",agentlink:"jerarquía"},Gi=760,Fi=460;function vP({center:e,nodes:n}){const s=x.useRef(null),o=x.useRef(null),l=x.useRef([]),c=x.useRef([]),d=x.useRef(null),[,f]=x.useState(0),[p,m]=x.useState(null);x.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=xP(k).force("link",nP(E).distance(120).strength(.5)).force("charge",bP().strength(-220)).force("center",DL(Gi/2,Fi/2).strength(.05)).force("collide",eP(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(mj).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]}})," ",mj[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 yP(){return[{key:"overview",label:"Explorer",icon:of},{key:"memories",label:j("project.nav.memories"),icon:Td},{key:"records",label:j("project.agent_detail.records_title"),icon:Lw},{key:"sleep",label:j("project.agent_detail.sleep_title"),icon:yl},{key:"brain",label:j("project.agent_detail.brain_title"),icon:$s},{key:"config",label:j("settings.tabs.advanced"),icon:zd}]}const _P=[{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."}],Yh=e=>e.split(",").map(n=>n.trim()).filter(Boolean),jP=(e,n)=>e.filter(s=>s.spec?.agent===n||n==="super-agent"&&s.kind==="super_agent");function wP(e){return e.split(`
601
- `).map(n=>n.replace(/^[-*#>\s]+/,"").trim()).filter(n=>n.length>2&&!n.startsWith("```")).slice(0,12)}function SP({pid:e}){const{slug:n=""}=Cw(),s=La(),[o,l]=x.useState("overview"),c=yP(),d=Ke(`/projects/${e}/agents/${n}`,()=>en.get(e,n)),f=Ke(`/projects/${e}/agents`,()=>en.list(e)),p=Ke(`/projects/${e}/routines`,()=>xr.list(e)),m=Ke(`/projects/${e}/messages?agent=${n}`,()=>Dh.project(e,{agent:n,limit:200})),g=Ke(`/projects/${e}/agents/${n}/conversations`,()=>Zx.list(e,n)),b=Ke(`/projects/${e}/tasks?all`,()=>br.list(e,"all")),v=d.data,S=jP(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?Is:yn;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(wT,{size:16})}),r.jsx("div",{className:Me("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(Is,{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(os,{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:Me("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(pd,{label:"Threads",value:g.data?.length??0,icon:ac}),r.jsx(pd,{label:"Records",value:m.data?.length??0,icon:Lw}),r.jsx(pd,{label:"Tasks",value:C.length,icon:of}),r.jsx(pd,{label:"Heartbeats",value:S.length,icon:yl})]}),r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsx($e,{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($s,{size:10})," ",k]},k)),v.tools?.map(k=>r.jsxs(Ve,{children:[r.jsx(zl,{size:10})," ",k]},k)),!v.skills?.length&&!v.tools?.length&&r.jsx("span",{className:"text-xs text-muted-fg",children:"—"})]})}),r.jsx($e,{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($e,{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(yn,{size:14,className:"text-muted-fg"})," ",k.slug]},k.slug))})})]}),o==="memories"&&r.jsx(kP,{pid:e,slug:n,initial:v.memory||"",onSaved:()=>d.mutate()}),o==="records"&&r.jsx(EP,{records:m.data||[],loading:m.isLoading}),o==="sleep"&&r.jsx(NP,{routines:S}),o==="brain"&&r.jsx(TP,{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(CP,{pid:e,agent:v,agents:f.data||[],onSaved:()=>{d.mutate(),f.mutate()},onDeleted:()=>{f.mutate(),s(`/p/${e}/agents`)}})]})}function CP({pid:e,agent:n,agents:s,onSaved:o,onDeleted:l}){const c=at(),[d,f]=x.useState(n.type||""),[p,m]=x.useState(n.area||""),[g,b]=x.useState(n.role||""),[v,S]=x.useState(n.model||""),[C,_]=x.useState(n.parent||""),[w,k]=x.useState(!!n.is_master),[E,N]=x.useState((n.skills||[]).join(", ")),[R,T]=x.useState((n.tools||[]).join(", ")),[M,O]=x.useState(n.description||""),[P,B]=x.useState(n.system||""),[L,D]=x.useState(!1),z=async()=>{D(!0);try{await en.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:Yh(E),tools:Yh(R),description:M||null,system:P}),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 en.remove(e,n.slug),c.success(j("project.agent_detail.delete_success")),l()}catch(q){c.error(q.message)}};return r.jsx($e,{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:_P})}),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(RP,{value:R,onChange:T}),r.jsx(de,{label:j("project.agent_detail.bio_label"),children:r.jsx(ln,{rows:2,value:M,onChange:q=>O(q.target.value)})}),r.jsx(de,{label:j("project.agent_detail.system_label"),hint:j("project.agent_detail.system_hint"),children:r.jsx(ln,{rows:10,className:"font-mono text-xs",value:P,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:z,children:[r.jsx(cf,{size:13})," ",j("project.agent_detail.save_btn")]})]})]})})}function pd({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 kP({pid:e,slug:n,initial:s,onSaved:o}){const l=at(),[c,d]=x.useState(s),[f,p]=x.useState(!1);x.useEffect(()=>{d(s)},[s]);const m=c!==s,g=async()=>{p(!0);try{await en.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($e,{title:j("project.agent_detail.memory_title"),description:`~/.apx/projects/<id>/agents/${n}/memory.md — hechos durables que el agente recuerda.`,children:[r.jsx(ln,{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(cf,{size:12})," ",j("project.memories.save_btn")]})]})]})}function EP({records:e,loading:n}){const s=x.useMemo(()=>[...e].sort((o,l)=>(l.ts||"").localeCompare(o.ts||"")),[e]);return r.jsxs($e,{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(Pw,{size:13,className:"text-blue-400"}):r.jsx(Bw,{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 NP({routines:e}){return e.length===0?r.jsx($e,{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($e,{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:Me("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(md,{label:"Tick",value:n.schedule}),r.jsx(md,{label:"Next tick",value:n.next_run_at?new Date(n.next_run_at).toLocaleString():"—"}),r.jsx(md,{label:"Last tick",value:n.last_run_at?new Date(n.last_run_at).toLocaleString():"—"}),r.jsx(md,{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 md({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 RP({value:e,onChange:n}){const s=Ke("/tools",()=>lO.list()),o=Yh(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:Me("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 TP({slug:e,memory:n,threads:s,tasks:o,routines:l,parent:c,children:d}){const f=x.useMemo(()=>{const p=[];return wP(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($e,{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(vP,{center:e,nodes:f})})}function AP(){const e=La(),n=oa(),{pid:s=""}=Cw(),{project:o}=Wx(s),{collapsed:l,toggle:c}=dC(Rn.sidebarCollapsed+".project"),d=String(s)==="0",f=x.useMemo(()=>d?[{title:j("base.nav_general"),items:[{key:"",label:"Dashboard",icon:QT},{key:"workspaces",label:j("base.workspaces_title"),icon:CT},{key:"models",label:j("settings.tabs.engines"),icon:ix},{key:"agent-defaults",label:j("base.defaults_title"),icon:yn}]},{title:j("base.nav_activity"),items:[{key:"chat",label:j("project.nav.chat"),icon:ac},{key:"sessions",label:j("base.sessions_title"),icon:YT},{key:"tasks",label:j("project.nav.tasks"),icon:pc},{key:"logs",label:j("project.nav.logs"),icon:Od}]},{title:j("base.nav_system"),items:[{key:"agents",label:j("project.nav.agents"),icon:yn},{key:"memories",label:j("project.nav.memories"),icon:Td},{key:"routines",label:j("project.nav.routines"),icon:yl},{key:"mcps",label:j("project.nav.mcps"),icon:ph},{key:"vars",label:j("project.nav.vars"),icon:fh},{key:"config",label:j("project.nav.config"),icon:zd}]}]:[{title:j("project.sections.workspace"),items:[{key:"",label:j("project.nav.overview"),icon:qw},{key:"telegram",label:j("project.nav.telegram"),icon:os},{key:"chat",label:j("project.nav.chat"),icon:ac},{key:"threads",label:j("project.nav.threads"),icon:ac},{key:"agents",label:j("project.nav.agents"),icon:yn},{key:"memories",label:j("project.nav.memories"),icon:Td}]},{title:j("project.sections.automation"),items:[{key:"routines",label:j("project.nav.routines"),icon:yl},{key:"tasks",label:j("project.nav.tasks"),icon:pc},{key:"mcps",label:j("project.nav.mcps"),icon:ph},{key:"vars",label:j("project.nav.vars"),icon:fh},{key:"logs",label:j("project.nav.logs"),icon:Od}]},{title:j("project.sections.config"),items:[{key:"config",label:j("project.nav.config"),icon:zd}]}],[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(bC,{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(Rw,{children:[r.jsx($t,{index:!0,element:r.jsx(Y_,{pid:s})}),r.jsx($t,{path:"workspaces",element:r.jsx(Fz,{})}),r.jsx($t,{path:"models",element:r.jsx(zC,{})}),r.jsx($t,{path:"agent-defaults",element:r.jsx(t6,{})}),r.jsx($t,{path:"sessions",element:r.jsx(r6,{})}),r.jsx($t,{path:"logs",element:r.jsx($D,{pid:s})}),r.jsx($t,{path:"config",element:r.jsx(k6,{pid:s})}),r.jsx($t,{path:"telegram",element:r.jsx(ML,{pid:s})}),r.jsx($t,{path:"agents",element:r.jsx(A6,{pid:s})}),r.jsx($t,{path:"agents/:slug",element:r.jsx(SP,{pid:s})}),r.jsx($t,{path:"memories",element:r.jsx(zL,{pid:s})}),r.jsx($t,{path:"routines",element:r.jsx(U6,{pid:s})}),r.jsx($t,{path:"tasks",element:d?r.jsx(o6,{}):r.jsx(V6,{pid:s})}),r.jsx($t,{path:"mcps",element:r.jsx(eL,{pid:s})}),r.jsx($t,{path:"vars",element:r.jsx(oL,{pid:s})}),r.jsx($t,{path:"threads",element:r.jsx(iL,{pid:s})}),r.jsx($t,{path:"chat",element:r.jsx(TL,{pid:s})}),r.jsx($t,{path:"*",element:r.jsx(Y_,{pid:s})})]})})}const MP=["es","en","pt","fr","it","de"];function OP(){const e=at(),{identity:n,isLoading:s,save:o}=eb(),[l,c]=x.useState({}),[d,f]=x.useState(!1);if(x.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($e,{title:j("settings.identity.title"),description:j("settings.identity.subtitle"),children:[n?null:r.jsx(it,{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:MP.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(ln,{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 zP(){const e=at(),n=La(),{superAgent:s,isLoading:o,mutate:l}=MC(),{patch:c}=zr(),{identity:d,save:f}=eb(),[p,m]=x.useState(!0),[g,b]=x.useState(""),[v,S]=x.useState(""),[C,_]=x.useState("permiso"),[w,k]=x.useState(!1);if(x.useEffect(()=>{s&&(m(!!s.enabled),b(s.system||""),_(s.permission_mode||"permiso"))},[s]),x.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($e,{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(ix,{size:13})," Configurar en Modelos"]})]}),r.jsx(de,{label:j("settings.super_agent.permission_mode"),children:r.jsx(wt,{value:C,onChange:_,options:fx.map(N=>({value:N,label:N}))})}),r.jsx(de,{label:j("settings.super_agent.personality"),children:r.jsx(ln,{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(ln,{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 zg={providers:()=>me.get("/embeddings/providers"),test:(e={})=>me.post("/embeddings/test",e),reindex:()=>me.post("/embeddings/reindex",{})},DP=[{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)"}],LP=[{value:"chain",label:"Cadena (fallback automático)"},{value:"single",label:"Único (usa solo el elegido)"}],gj=e=>e.startsWith("***");function PP(){const e=at(),{config:n,isLoading:s,patch:o}=zr(),{data:l,mutate:c}=Ke("/embeddings/providers",()=>zg.providers()),[d,f]=x.useState(!1),[p,m]=x.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 zg.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 zg.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:"space-y-6",children:[r.jsx($e,{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:DP,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:LP,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($s,{size:14})," Probar embedding"]}),r.jsxs(ge,{variant:"secondary",onClick:k,loading:d,children:[r.jsx(Hw,{size:14})," Reindexar memoria"]}),p&&r.jsx("span",{className:"text-sm text-muted-foreground",children:p})]})]})}),r.jsxs($e,{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($e,{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&&!gj(N)&&_({"memory.embeddings.openai.api_key":N})},className:"max-w-md"})})]}),r.jsxs($e,{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&&!gj(N)&&_({"memory.embeddings.gemini.api_key":N})},className:"max-w-md"})})]}),r.jsxs($e,{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 IP=[{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 BP(){const e=at(),{data:n,mutate:s,isLoading:o}=Ke("/skills/inspector",()=>Qi.inspector()),[l,c]=x.useState(!1),[d,f]=x.useState(""),[p,m]=x.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:"space-y-6",children:[r.jsx($e,{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(ss,{size:14})," Reindexar"]}),r.jsxs(ge,{variant:"secondary",onClick:()=>S(!0),loading:l,children:[r.jsx(ss,{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($e,{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:IP.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($e,{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(mA,{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($s,{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 UP(){const e=at(),{config:n,isLoading:s,patch:o,mutate:l}=zr(),c=n.telegram?.channels||[],d=Math.max(0,c.findIndex(T=>T.name==="default")),f=c[d],[p,m]=x.useState(!0),[g,b]=x.useState(1500),[v,S]=x.useState(!0),[C,_]=x.useState(""),[w,k]=x.useState(""),[E,N]=x.useState(!1);if(x.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(),M={name:"default",chat_id:w,respond_with_engine:v,...C?{bot_token:C}:{}};c.length===0?T.push(M):T[d]={...f,...M},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($e,{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 HP(){const e=at(),{channels:n,isLoading:s,mutate:o}=ib(),{contacts:l}=cb(),[c,d]=x.useState(null),[f,p]=x.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($e,{title:j("telegram_channels.title"),description:j("telegram_channels.desc"),action:r.jsxs(ge,{size:"sm",onClick:()=>d({name:""}),children:[r.jsx(un,{size:14})," ",j("telegram_channels.new_btn")]}),children:[s&&r.jsx(nt,{}),!s&&n.length===0&&r.jsx(it,{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(os,{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(iC,{channel:c,onClose:()=>d(null),onSaved:()=>{d(null),o()}}),r.jsx(cC,{channel:f,onClose:()=>p(null)})]})}const hj=new Set(["owner","guest"]);function VP(){const e=at(),{roles:n,mutate:s,isLoading:o}=cb(),[l,c]=x.useState(""),[d,f]=x.useState(""),[p,m]=x.useState(!1),[g,b]=x.useState(!1),v=async()=>{const _=l.trim();if(!_){e.error(j("telegram_roles.name_required"));return}if(hj.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($e,{title:j("telegram_roles.title"),description:j("telegram_roles.desc"),children:[o&&r.jsx(nt,{}),C.length===0&&!o&&r.jsx(it,{children:j("telegram_roles.empty")}),C.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:C.map(([_,w])=>{const k=hj.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(un,{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 tk="apx.settings.telegramTab";function qP(){if(typeof window>"u")return"default";const e=window.localStorage.getItem(tk);return e==="channels"||e==="contacts"||e==="roles"||e==="default"?e:"default"}function $P(){const[e,n]=x.useState("default");x.useEffect(()=>{n(qP())},[]);const s=o=>{const l=o==="channels"||o==="contacts"||o==="roles"||o==="default"?o:"default";n(l);try{window.localStorage.setItem(tk,l)}catch{}};return r.jsxs(Of,{value:e,onValueChange:s,className:"w-full",children:[r.jsxs(zf,{children:[r.jsx(es,{value:"default",children:j("settings.telegram_global.title")}),r.jsx(es,{value:"channels",children:j("telegram_channels.title")}),r.jsx(es,{value:"contacts",children:j("telegram_contacts.title")}),r.jsx(es,{value:"roles",children:j("telegram_roles.title")})]}),r.jsx(Ma,{value:"default",className:"mt-4",children:r.jsx(UP,{})}),r.jsx(Ma,{value:"channels",className:"mt-4",children:r.jsx(HP,{})}),r.jsx(Ma,{value:"contacts",className:"mt-4",children:r.jsx(uC,{})}),r.jsx(Ma,{value:"roles",className:"mt-4",children:r.jsx(VP,{})})]})}function GP(){const{data:e,error:n,isLoading:s,mutate:o}=Ke("/pair/list",()=>kl.list(),{refreshInterval:uf.pairList});return{clients:e?.clients||[],error:n,isLoading:s,mutate:o}}var il={},Dg,xj;function FP(){return xj||(xj=1,Dg=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Dg}var Lg={},hr={},bj;function _o(){if(bj)return hr;bj=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 Pg={},vj;function Cb(){return vj||(vj=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}}})(Pg)),Pg}var Ig,yj;function YP(){if(yj)return Ig;yj=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++}},Ig=e,Ig}var Bg,_j;function XP(){if(_j)return Bg;_j=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]},Bg=e,Bg}var Ug={},jj;function KP(){return jj||(jj=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}})(Ug)),Ug}var Hg={},wj;function QP(){if(wj)return Hg;wj=1;const e=_o().getSymbolSize,n=7;return Hg.getPositions=function(o){const l=e(o);return[[0,0],[l-n,0],[0,l-n]]},Hg}var Vg={},Sj;function ZP(){return Sj||(Sj=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}})(Vg)),Vg}var gd={},Cj;function nk(){if(Cj)return gd;Cj=1;const e=Cb(),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 gd.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}},gd.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}},gd}var qg={},Yi={},kj;function WP(){if(kj)return Yi;kj=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 Ej;function JP(){return Ej||(Ej=1,(function(e){const n=WP();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}})(qg)),qg}var $g,Nj;function e8(){if(Nj)return $g;Nj=1;const e=JP();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},$g=n,$g}var Gg={},Fg={},Yg={},Rj;function ak(){return Rj||(Rj=1,Yg.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}),Yg}var Qa={},Tj;function sk(){if(Tj)return Qa;Tj=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
602
- ]))+`;Qa.KANJI=new RegExp(s,"g"),Qa.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Qa.BYTE=new RegExp(o,"g"),Qa.NUMERIC=new RegExp(e,"g"),Qa.ALPHANUMERIC=new RegExp(n,"g");const l=new RegExp("^"+s+"$"),c=new RegExp("^"+e+"$"),d=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Qa.testKanji=function(p){return l.test(p)},Qa.testNumeric=function(p){return c.test(p)},Qa.testAlphanumeric=function(p){return d.test(p)},Qa}var Aj;function jo(){return Aj||(Aj=1,(function(e){const n=ak(),s=sk();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}}})(Fg)),Fg}var Mj;function t8(){return Mj||(Mj=1,(function(e){const n=_o(),s=nk(),o=Cb(),l=jo(),c=ak(),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}})(Gg)),Gg}var Xg={},Oj;function n8(){if(Oj)return Xg;Oj=1;const e=_o(),n=1335,s=21522,o=e.getBCHDigit(n);return Xg.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},Xg}var Kg={},Qg,zj;function a8(){if(zj)return Qg;zj=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))},Qg=n,Qg}var Zg,Dj;function s8(){if(Dj)return Zg;Dj=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)},Zg=s,Zg}var Wg,Lj;function r8(){if(Lj)return Wg;Lj=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)},Wg=n,Wg}var Jg,Pj;function o8(){if(Pj)return Jg;Pj=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]+`
603
- Make sure your charset is UTF-8`);c=(c>>>8&255)*192+(c&255),o.put(c,13)}},Jg=s,Jg}var eh={exports:{}},Ij;function l8(){return Ij||(Ij=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})(eh)),eh.exports}var Bj;function i8(){return Bj||(Bj=1,(function(e){const n=jo(),s=a8(),o=s8(),l=r8(),c=o8(),d=sk(),f=_o(),p=l8();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(O,P){return O.index-P.index}).map(function(O){return{data:O.data,mode:O.mode,length:O.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 M=0;M<k.length;M++){const O=k[M],P=[];for(let B=0;B<O.length;B++){const L=O[B],D=""+M+B;P.push(D),N[D]={node:L,lastCount:0},R[D]={};for(let z=0;z<T.length;z++){const H=T[z];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=P}for(let M=0;M<T.length;M++)R[T[M]].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)+`.
604
- 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),M=_(T,N),O=p.find_path(M.map,"start","end"),P=[];for(let B=1;B<O.length-1;B++)P.push(M.table[O[B]].node);return e.fromArray(S(P))},e.rawSplit=function(E){return e.fromArray(b(E,f.isKanjiModeEnabled()))}})(Kg)),Kg}var Uj;function c8(){if(Uj)return Lg;Uj=1;const e=_o(),n=Cb(),s=YP(),o=XP(),l=KP(),c=QP(),d=ZP(),f=nk(),p=e8(),m=t8(),g=n8(),b=jo(),v=i8();function S(M,O){const P=M.size,B=c.getPositions(O);for(let L=0;L<B.length;L++){const D=B[L][0],z=B[L][1];for(let H=-1;H<=7;H++)if(!(D+H<=-1||P<=D+H))for(let q=-1;q<=7;q++)z+q<=-1||P<=z+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?M.set(D+H,z+q,!0,!0):M.set(D+H,z+q,!1,!0))}}function C(M){const O=M.size;for(let P=8;P<O-8;P++){const B=P%2===0;M.set(P,6,B,!0),M.set(6,P,B,!0)}}function _(M,O){const P=l.getPositions(O);for(let B=0;B<P.length;B++){const L=P[B][0],D=P[B][1];for(let z=-2;z<=2;z++)for(let H=-2;H<=2;H++)z===-2||z===2||H===-2||H===2||z===0&&H===0?M.set(L+z,D+H,!0,!0):M.set(L+z,D+H,!1,!0)}}function w(M,O){const P=M.size,B=m.getEncodedBits(O);let L,D,z;for(let H=0;H<18;H++)L=Math.floor(H/3),D=H%3+P-8-3,z=(B>>H&1)===1,M.set(L,D,z,!0),M.set(D,L,z,!0)}function k(M,O,P){const B=M.size,L=g.getEncodedBits(O,P);let D,z;for(D=0;D<15;D++)z=(L>>D&1)===1,D<6?M.set(D,8,z,!0):D<8?M.set(D+1,8,z,!0):M.set(B-15+D,8,z,!0),D<8?M.set(8,B-D-1,z,!0):D<9?M.set(8,15-D-1+1,z,!0):M.set(8,15-D-1,z,!0);M.set(B-8,8,1,!0)}function E(M,O){const P=M.size;let B=-1,L=P-1,D=7,z=0;for(let H=P-1;H>0;H-=2)for(H===6&&H--;;){for(let q=0;q<2;q++)if(!M.isReserved(L,H-q)){let Y=!1;z<O.length&&(Y=(O[z]>>>D&1)===1),M.set(L,H-q,Y),D--,D===-1&&(z++,D=7)}if(L+=B,L<0||P<=L){L-=B,B=-B;break}}}function N(M,O,P){const B=new s;P.forEach(function(q){B.put(q.mode.bit,4),B.put(q.getLength(),b.getCharCountIndicator(q.mode,M)),q.write(B)});const L=e.getSymbolTotalCodewords(M),D=f.getTotalCodewordsCount(M,O),z=(L-D)*8;for(B.getLengthInBits()+4<=z&&B.put(0,4);B.getLengthInBits()%8!==0;)B.putBit(0);const H=(z-B.getLengthInBits())/8;for(let q=0;q<H;q++)B.put(q%2?17:236,8);return R(B,M,O)}function R(M,O,P){const B=e.getSymbolTotalCodewords(O),L=f.getTotalCodewordsCount(O,P),D=B-L,z=f.getBlocksCount(O,P),H=B%z,q=z-H,Y=Math.floor(B/z),V=Math.floor(D/z),$=V+1,Z=Y-V,G=new p(Z);let X=0;const U=new Array(z),K=new Array(z);let F=0;const J=new Uint8Array(M.buffer);for(let ee=0;ee<z;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<z;ce++)oe<U[ce].length&&(ie[re++]=U[ce][oe]);for(oe=0;oe<Z;oe++)for(ce=0;ce<z;ce++)ie[re++]=K[ce][oe];return ie}function T(M,O,P,B){let L;if(Array.isArray(M))L=v.fromArray(M);else if(typeof M=="string"){let Y=O;if(!Y){const V=v.rawSplit(M);Y=m.getBestVersionForData(V,P)}L=v.fromString(M,Y||40)}else throw new Error("Invalid data");const D=m.getBestVersionForData(L,P);if(!D)throw new Error("The amount of data is too big to be stored in a QR Code");if(!O)O=D;else if(O<D)throw new Error(`
605
- The chosen QR Code version cannot contain this amount of data.
606
- Minimum version required to store current data is: `+D+`.
607
- `);const z=N(O,P,L),H=e.getSymbolSize(O),q=new o(H);return S(q,O),C(q),_(q,O),k(q,P,0),O>=7&&w(q,O),E(q,z),isNaN(B)&&(B=d.getBestMask(q,k.bind(null,q,P))),d.applyMask(B,q),k(q,P,B),{modules:q,version:O,errorCorrectionLevel:P,maskPattern:B,segments:L}}return Lg.create=function(O,P){if(typeof O>"u"||O==="")throw new Error("No input text");let B=n.M,L,D;return typeof P<"u"&&(B=n.from(P.errorCorrectionLevel,n.M),L=m.from(P.version),D=d.from(P.maskPattern),P.toSJISFunc&&e.setToSJISFunction(P.toSJISFunc)),T(O,L,B,D)},Lg}var th={},nh={},Hj;function rk(){return Hj||(Hj=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}}})(nh)),nh}var Vj;function u8(){return Vj||(Vj=1,(function(e){const n=rk();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)}})(th)),th}var ah={},qj;function d8(){if(qj)return ah;qj=1;const e=rk();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 ah.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>
608
- `;return typeof f=="function"&&f(null,w),w},ah}var $j;function f8(){if($j)return il;$j=1;const e=FP(),n=c8(),s=u8(),o=d8();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 p8=f8();const m8=Zh(p8);function g8({value:e,size:n=200}){const[s,o]=x.useState(null);return x.useEffect(()=>{let l=!0;return m8.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 h8(e){return e.find(n=>!n.includes("127.0.0.1")&&!n.includes("localhost"))||e[0]||window.location.origin}function x8({open:e,onClose:n,onPaired:s}){const o=at(),[l,c]=x.useState(null),[d,f]=x.useState(null),[p,m]=x.useState(0),[g,b]=x.useState(!1),v=x.useRef(null),S=x.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)}},[]);x.useEffect(()=>{e?S():(c(null),f(null),b(!1))},[e,S]),x.useEffect(()=>{if(!l||g||p<=0)return;const E=window.setTimeout(()=>m(N=>N-1),1e3);return()=>window.clearTimeout(E)},[l,p,g]),x.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?h8(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(Mn,{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(za,{})," ",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(g8,{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(za,{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(Ad,{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(Ad,{size:14})})]})]})]})]})]})]})}function b8(){const e=at(),{clients:n,isLoading:s,mutate:o}=GP(),[l,c]=x.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($e,{title:j("settings.devices"),description:j("settings.devices_sub"),action:r.jsxs(ge,{size:"sm",variant:"primary",onClick:()=>c(!0),children:[r.jsx(lA,{size:14})," ",j("settings.devices_pair_btn")]}),children:[s&&r.jsx(nt,{}),!s&&n.length===0&&r.jsx(it,{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(x8,{open:l,onClose:()=>c(!1),onPaired:()=>o()})]})}const v8=[{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:fx.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 y8(){const{config:e,isLoading:n,patch:s,mutate:o}=zr();if(n)return r.jsx(nt,{});const l=async c=>{const d={};for(const[f,p]of Object.entries(xb(c)))Va(p)||(d[f]=p);await s(d),o()};return r.jsx($e,{title:j("global_config.title"),description:"Config general en ~/.apx/config.json. Editable por tabs; JSON queda separado.",children:r.jsx(Vh,{sections:v8,source:e,jsonTitle:"~/.apx/config.json",jsonDescription:"Secretos redacted no se sobrescriben.",onSaveFields:async(c,d)=>{await s(c,d),o()},onSaveJson:l})})}function _8(){const e=at(),{health:n,isUp:s}=lC(),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($e,{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(sh,{label:j("daemon.version"),value:n?.version||"—"}),r.jsx(sh,{label:j("daemon.uptime"),value:n?`${n.uptime_s}s`:"—"}),r.jsx(sh,{label:j("daemon.status"),value:j(s?"daemon.running":"daemon.down"),ok:s})]})}),r.jsx(y8,{})]})}function sh({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(Ef,{ok:s}),r.jsx("span",{children:n})]})]})}function j8(){const e=at(),{theme:n,set:s}=px(),[o,l]=x.useState(""),[c,d]=x.useState(yO()),f=()=>{const m=o.trim();if(m){ao(m);try{localStorage.setItem(Rn.token,m)}catch{}l(""),e.success(j("settings.token_saved"))}},p=m=>{bO(m),d(m),window.location.reload()};return r.jsxs("div",{className:"space-y-6",children:[r.jsx($e,{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($e,{title:j("settings.language"),children:r.jsx("div",{className:"flex items-center gap-2",children:vO.map(m=>r.jsx(ge,{variant:c===m.value?"primary":"secondary",onClick:()=>p(m.value),children:m.label},m.value))})}),r.jsxs($e,{title:j("settings.token"),description:j("settings.token_sub"),children:[r.jsx(de,{label:"Bearer",children:r.jsx(ke,{type:"password",placeholder:Qx()?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 w8=[{title:j("settings.account_section"),items:[{key:"identity",label:j("settings.tabs.identity"),icon:Ww},{key:"appearance",label:j("settings.appearance"),icon:sA}]},{title:j("settings.agents_section"),items:[{key:"super_agent",label:j("settings.tabs.super_agent"),icon:yn},{key:"engines",label:j("settings.tabs.engines"),icon:ix},{key:"memory",label:"Memoria (RAG)",icon:Hw},{key:"skills",label:"Skills (RAG)",icon:$s}]},{title:j("settings.channels_section"),items:[{key:"telegram",label:j("settings.tabs.telegram"),icon:os},{key:"devices",label:j("settings.tabs.devices"),icon:cA}]},{title:j("settings.advanced_section"),items:[{key:"advanced",label:j("settings.tabs.advanced"),icon:Od}]}],S8=new Set(["engines","telegram"]),C8={identity:()=>r.jsx(OP,{}),super_agent:()=>r.jsx(zP,{}),engines:()=>r.jsx(zC,{}),memory:()=>r.jsx(PP,{}),skills:()=>r.jsx(BP,{}),telegram:()=>r.jsx($P,{}),devices:()=>r.jsx(b8,{}),appearance:()=>r.jsx(j8,{}),advanced:()=>r.jsx(_8,{})};function k8(){const e=La(),n=oa(),s=E8(n.pathname),o=C8[s],{collapsed:l,toggle:c}=dC(Rn.sidebarCollapsed+".settings");return r.jsx(bC,{sections:w8,active:s,onChange:d=>e(d==="identity"?"/settings":`/settings/${N8(d)}`),collapsed:l,onToggleCollapse:c,contentClassName:`mx-auto w-full ${S8.has(s)?"max-w-6xl":"max-w-3xl"} space-y-6 p-6 pt-3`,testId:`settings-tab-${s}`,children:r.jsx(o,{})})}function E8(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 N8(e){return e==="super_agent"?"super-agent":e==="advanced"?"config":e}function R8({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:Me("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:Me("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=Kd[C]||{name:C,note:""},E=!v&&o===C,N=C==="mock";return r.jsxs("div",{"data-testid":`voice-provider-${C}`,className:Me("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(Uw,{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(bo,{className:"size-3.5"})})]}),r.jsx(Ef,{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(RT,{className:"size-3.5"})," Usar por defecto"]}),E&&r.jsx(lx,{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(iA,{className:"size-3.5"})," Configurar"]})]})]},C)})})]})}function Ta(e){return typeof e=="string"?e:e==null?"":String(e)}function T8({open:e,providerId:n,config:s,onClose:o,onSave:l}){const[c,d]=x.useState(!1),[f,p]=x.useState(null),[m,g]=x.useState(""),[b,v]=x.useState({});if(x.useEffect(()=>{if(!e||!n)return;p(null),g("");const R=s||{};if(n==="piper"){const T=R;v({bin:Ta(T.bin),model:Ta(T.model),speaker:Ta(T.speaker)})}else if(n==="elevenlabs"){const T=R;v({model:Ta(T.model),voice_id:Ta(T.voice_id),output_format:Ta(T.output_format)})}else if(n==="openai"){const T=R;v({model:Ta(T.model)||"tts-1",voice:Ta(T.voice)||"alloy",format:Ta(T.format)||"mp3"})}else if(n==="gemini"){const T=R;v({model:Ta(T.model),voice:Ta(T.voice)||"Kore",style:Ta(T.style)})}else v({})},[e,n,s]),!n)return null;const S=Kd[n],C=`voice.tts.${n}`,_=R=>v(T=>({...T,...R})),w=n!=="piper"&&n!=="mock",k=w&&Va(s?.api_key),E=k?`…${El(s?.api_key)??""} (ya seteada)`:"API key",N=async()=>{d(!0),p(null);try{const R={},T=[],M=(O,P)=>{P.trim()?R[`${C}.${O}`]=P.trim():T.push(`${C}.${O}`)};n==="piper"?(M("bin",b.bin),M("model",b.model),b.speaker.trim()?R[`${C}.speaker`]=b.speaker.trim():T.push(`${C}.speaker`)):n==="elevenlabs"?(M("model",b.model),M("voice_id",b.voice_id),M("output_format",b.output_format)):n==="openai"?(M("model",b.model),M("voice",b.voice),M("format",b.format)):n==="gemini"&&(M("model",b.model),M("voice",b.voice),M("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(Mn,{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:dO.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:fO.map(R=>({value:R,label:R}))})}),r.jsx(de,{label:"Voz",children:r.jsx(wt,{value:b.voice||"alloy",onChange:R=>_({voice:R}),options:cO.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:uO.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(ln,{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 A8(){const e=x.useRef(null),n=x.useRef(null),[s,o]=x.useState(!1),[l,c]=x.useState(!1),d=x.useCallback(()=>{n.current&&(URL.revokeObjectURL(n.current),n.current=null)},[]);x.useEffect(()=>()=>{e.current&&(e.current.pause(),e.current=null),d()},[d]);const f=x.useCallback(async m=>{c(!0);try{d();const g=await mO(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=x.useCallback(()=>{e.current&&(e.current.pause(),e.current.currentTime=0),o(!1)},[]);return{play:f,stop:p,playing:s,loading:l}}function M8({engines:e,defaultProvider:n,mode:s}){const o=at(),{play:l,stop:c,playing:d,loading:f}=A8(),[p,m]=x.useState("Hola, soy APX. Esto es una prueba de voz."),[g,b]=x.useState(""),[v,S]=x.useState(""),[C,_]=x.useState(!1),[w,k]=x.useState(null),N=[{value:"",label:s==="single"&&n&&n!=="auto"?`Por defecto (${Kd[n]?.name||n})`:"Por defecto (cadena)"},...e.map(T=>({value:T.id,label:`${Kd[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 M=await B2.say({text:T,provider:g||void 0,style:v.trim()||void 0});k(M),await l(M.audio_path)}catch(M){o.error(M.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(ln,{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(pA,{className:"size-4"})," Decir esto"]}),d?r.jsxs(ge,{variant:"secondary",onClick:c,"data-testid":"voice-test-stop",children:[r.jsx(Qw,{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(ux,{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 O8=[{value:"auto",label:"Automático (local, luego OpenAI)"},{value:"local",label:"Local — faster-whisper (offline)"},{value:"openai",label:"OpenAI — Whisper-1 (cloud)"}],z8=[{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 D8({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:O8,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:pO.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:z8,disabled:s})})]})]})}function L8(){const e=at(),{config:n,isLoading:s,patch:o,mutate:l}=zr(),{data:c,isLoading:d,error:f,mutate:p}=Ke("/tts/providers",()=>B2.providers()),[m,g]=x.useState(null),[b,v]=x.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=x.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(z){e.error(z.message)}finally{v(!1)}},M=async D=>{v(!0);try{const z={"voice.tts.mode":D};if(D==="single"&&(w==="auto"||!w)){const H=E.find(q=>q.available)?.id||N[0]||"mock";z["voice.tts.provider"]=H}await o(z),await p(),e.success(D==="chain"?"Modo: cadena con fallback.":"Modo: solo el motor por defecto.")}catch(z){e.error(z.message)}finally{v(!1)}},O=async(D,z)=>{v(!0);try{await o({[`voice.tts.${D}.enabled`]:z}),await p()}catch(H){e.error(H.message)}finally{v(!1)}},P=async D=>{v(!0);try{await o({"voice.tts.order":D}),await p()}catch(z){e.error(z.message)}finally{v(!1)}},B=async({set:D,unset:z})=>{await o(D,z.length?z:void 0),await p(),await l(),e.success("Configuración de voz guardada.")},L=async(D,z)=>{try{await o(D,z),e.success("Transcripción actualizada.")}catch(H){e.error(H.message)}};return r.jsxs("div",{className:"mx-auto max-w-6xl p-6","data-testid":"screen-voice",children:[r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2",children:[r.jsx($e,{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(it,{children:["No se pudieron cargar los proveedores: ",f.message]}):r.jsx(R8,{engines:E,order:N,mode:k,configuredProvider:w,onSetMode:M,onSetDefault:T,onToggleEnabled:O,onReorder:P,onConfigure:D=>g(D),busy:b})}),r.jsxs("div",{className:"space-y-6",children:[r.jsx($e,{title:j("voice_screen.test_title"),description:"Elegí con qué motor sintetizar y, si aplica, cómo querés que hable.",children:r.jsx(M8,{engines:E,defaultProvider:w,mode:k})}),r.jsx($e,{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(D8,{config:_,onPatch:L})})]})]}),r.jsx(T8,{open:!!m,providerId:m,config:R,onClose:()=>g(null),onSave:B})]})}const rh={status:()=>me.get("/desktop/status"),autostartGet:()=>me.get("/desktop/autostart"),autostartSet:e=>me.post("/desktop/autostart",{enable:e})};function P8(e=30){return me.get(`/messages/global?channel=desktop&limit=${e}`)}const Gj="CommandOrControl+G",I8=[{value:"left",label:"Izquierda"},{value:"center",label:"Centro"},{value:"right",label:"Derecha"}],B8=[{value:"light",label:"Claro"},{value:"dark",label:"Oscuro"}];function U8(){const e=at(),{config:n,isLoading:s,patch:o}=zr(),l=n,c=l.desktop?.shortcut||l.overlay?.shortcut||Gj,d=l.desktop?.enabled!==!1,f=l.desktop?.theme||"light",p=l.desktop?.position||"right",{data:m,isLoading:g,mutate:b}=Ke("/desktop/status",()=>rh.status(),{refreshInterval:5e3}),v=!!m?.running,{data:S,mutate:C}=Ke("/desktop/autostart",()=>rh.autostartGet()),{data:_,isLoading:w,mutate:k}=Ke("/messages/global?channel=desktop",()=>P8(40),{refreshInterval:8e3}),[E,N]=x.useState(c),[R,T]=x.useState(!1),[M,O]=x.useState(!1);x.useEffect(()=>N(c),[c]);const P=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(z){e.error(z.message)}finally{T(!1)}}},B=async(D,z,H)=>{T(!0);try{await o({[D]:z}),e.success(H)}catch(q){e.error(q.message)}finally{T(!1)}},L=async D=>{O(!0);try{await rh.autostartSet(D),await C(),e.success(D?"Autostart activado para el próximo login.":"Autostart desactivado.")}catch(z){e.error(z.message)}finally{O(!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($e,{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(Ef,{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(D_,{children:"apx desktop start"})," · ",r.jsx(D_,{children:"apx desktop --debug"})]})]}),r.jsx($e,{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:M,label:S.enabled?"Activado":"Desactivado"}),r.jsxs("span",{className:"text-xs text-muted-fg",children:["platform: ",S.platform]})]}):r.jsx(nt,{})}),r.jsx($e,{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"&&P()},placeholder:Gj,className:"max-w-md font-mono",disabled:R})})}),r.jsx(ge,{variant:"primary",onClick:P,loading:R,disabled:!E.trim()||E.trim()===c,children:"Guardar"})]})}),r.jsx($e,{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:B8,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:I8,disabled:R})})]})}),r.jsx($e,{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(ox,{to:"/m/voice",className:"font-medium text-fg underline underline-offset-2",children:"Voces"})," ","(whisper local, idioma, modelo)."]})]})})]}),r.jsx("div",{children:r.jsx($e,{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(H8,{messages:_||[],loading:w})})})]})})}function H8({messages:e,loading:n}){const s=x.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(V8,{m:c},d))},l))}):r.jsx(it,{children:"Sin mensajes todavía. Mandale algo a la ventana de escritorio para que aparezca aquí."})}function V8({m:e}){const n=e.direction==="in",s=$8(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 $8(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 G8(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 F8({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 · ",G8(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 Y8(e){return e==="available"?"success":e==="configured"?"info":"muted"}function X8(e){return e==="available"?"activo":e==="configured"?"configurado":e==="disabled"?"deshabilitado":"sin configurar"}function K8(e){return e==="voice"?"warning":e==="plugin"?"info":"muted"}function Q8({widget:e,onToggle:n}){const s=e.source==="external",[o,l]=x.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:Me("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:Me("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:K8(e.kind),children:e.kind}),r.jsx(Ve,{tone:Y8(e.status),children:X8(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 Z8({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(Q8,{widget:o,onToggle:o.source==="external"?l=>s(o.id,l):void 0},o.id))})]})}function W8(){const e=at(),{data:n,error:s,isLoading:o,mutate:l}=Ke("/deck/manifest",()=>z_.manifest(),{refreshInterval:3e4}),c=async(b,v)=>{try{await z_.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(F8,{manifest:n}),r.jsxs($e,{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(ss,{size:14,className:o?"animate-spin":""})}),children:[o&&r.jsx(nt,{label:"Cargando manifest del Deck…"}),!o&&s&&r.jsxs(it,{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(it,{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(Z8,{desktop:b.desktop,widgets:b.widgets,onToggle:c},b.desktop.id))})]}),n?.apx&&r.jsx($e,{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 J8(e,n){const s=getComputedStyle(e),o=parseFloat(s.fontSize);return n*o}function e7(e,n){const s=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(s.fontSize);return n*o}function t7(e){return e/100*window.innerHeight}function n7(e){return e/100*window.innerWidth}function a7(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]=a7(s);switch(c){case"%":{o=l/100*e;break}case"px":{o=l;break}case"rem":{o=e7(n,l);break}case"em":{o=J8(n,l);break}case"vh":{o=t7(l);break}case"vw":{o=n7(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 Xh(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 Kh(e,n){return Array.from(n).sort(e==="horizontal"?s7:r7)}function s7(e,n){const s=e.element.offsetLeft-n.element.offsetLeft;return s!==0?s:e.element.offsetWidth-n.element.offsetWidth}function r7(e,n){const s=e.element.offsetTop-n.element.offsetTop;return s!==0?s:e.element.offsetHeight-n.element.offsetHeight}function ok(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function lk(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 o7({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}=lk(o,d),m=e==="horizontal"?f:p;m<c&&(c=m,l=d)}return Ut(l,"No rect found"),l}let hd;function l7(){return hd===void 0&&(typeof matchMedia=="function"?hd=!!matchMedia("(pointer:coarse)").matches:hd=!1),hd}function ik(e){const{element:n,orientation:s,panels:o,separators:l}=e,c=Kh(s,Array.from(n.children).filter(ok).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 M=S[0],O=o7({orientation:s,rects:[k,E],targetRect:M.element.getBoundingClientRect()});N=[M,O===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 M=l7()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(T.width<M){const P=M-T.width;T=new DOMRect(T.x-P/2,T.y,T.width+P,T.height)}if(T.height<M){const P=M-T.height;T=new DOMRect(T.x,T.y-P/2,T.width,T.height+P)}const O=C<=m||C>g;!f&&!O&&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 ck{#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 ts=new Map;const uk=new ck;function i7(e){ts=new Map(ts),ts.delete(e)}function Fj(e,n){for(const[s]of ts)if(s.id===e)return s}function Cr(e,n){for(const[s,o]of ts)if(s.id===e)return o;if(n)throw Error(`Could not find data for Group with id ${e}`)}function wo(){return ts}function kb(e,n){return uk.addListener("groupChange",s=>{s.group.id===e&&n(s)})}function qs(e,n){const s=ts.get(e);ts=new Map(ts),ts.set(e,n),uk.emit("groupChange",{group:e,prev:s,next:n})}function c7(e,n,s){let o,l={x:1/0,y:1/0};for(const c of n){const d=lk(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 u7(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function d7(e,n){if(e===n)throw new Error("Cannot compare node with itself");const s={a:Kj(e),b:Kj(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:Xj(Yj(s.a)),b:Xj(Yj(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 f7=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function p7(e){const n=getComputedStyle(dk(e)??e).display;return n==="flex"||n==="inline-flex"}function m7(e){const n=getComputedStyle(e);return!!(n.position==="fixed"||n.zIndex!=="auto"&&(n.position!=="static"||p7(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"||f7.test(n.willChange)||n.webkitOverflowScrolling==="touch")}function Yj(e){let n=e.length;for(;n--;){const s=e[n];if(Ut(s,"Missing node"),m7(s))return s}return null}function Xj(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Kj(e){const n=[];for(;e;)n.push(e),e=dk(e);return n}function dk(e){const{parentNode:n}=e;return u7(n)?n.host:n}function g7(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 h7({groupElement:e,hitRegion:n,pointerEventTarget:s}){if(!ok(s)||s.contains(e)||e.contains(s))return!0;if(d7(s,e)>0){let o=s;for(;o;){if(o.contains(e))return!0;if(g7(o.getBoundingClientRect(),n))return!1;o=o.parentElement}}return!0}function Eb(e,n){const s=[];return n.forEach((o,l)=>{if(l.disabled)return;const c=ik(l),d=c7(l.orientation,c,{x:e.clientX,y:e.clientY});d&&d.distance.x<=0&&d.distance.y<=0&&h7({groupElement:l.element,hitRegion:d.hitRegion.rect,pointerEventTarget:e.target})&&s.push(d.hitRegion)}),s}function x7(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 Bn(e,n,s=0){return Math.abs(Fn(e)-Fn(n))<=s}function Za(e,n){return Bn(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(Za(o,p)<0)if(c){const m=(l+p)/2;Za(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(Bn(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 ${_}`),Bn(R,k)){const T=N-R;Za(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 ${_}`),Bn(R,N)){const T=R-k;Za(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&&Za(k,R)<0)if(e>0){const T=R-N,M=T/2,O=k+e;Za(O,R)<0&&(e=Za(e,M)<=0?0:T)}else{const T=R-N,M=100-T/2,O=k-e;Za(O,R)<0&&(e=Za(100+e,M)>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(!Bn(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(x7(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,!Bn(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 M=T+N,O=pl({overrideDisabledPanels:d,panelConstraints:s[R],prevSize:T,size:M});if(Bn(T,O)||(N-=O-T,m[R]=O),Bn(N,0))break;e>0?R--:R++}}}const S=Object.values(m).reduce((_,w)=>w+_,0);if(!Bn(S,100,.1))return l;const C=Object.keys(l);return m.reduce((_,w,k)=>(_[C[k]]=w,_),{})}function go(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const s in e)if(n[s]===void 0||Za(e[s],n[s])!==0)return!1;return!0}function ho({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(!Bn(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(!Bn(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,Bn(c,0)))break}const d=Object.keys(e);return o.reduce((f,p,m)=>(f[d[m]]=p,f),{})}function fk({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&&Bn(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=ho({layout:w,panelConstraints:b});go(C,k)||qs(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&&Bn(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 Qj(e){if(e.defaultPrevented)return;const n=wo();Eb(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=fk({groupId:s.group.id,panelId:o.id});c&&l!==void 0&&(c.resize(l),e.preventDefault())}}})}function Ed(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 pk({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=ho({layout:s,panelConstraints:l});return o?f:(go(f,m)||qs(c,{defaultLayoutDeferred:o,derivedPanelConstraints:l,groupSize:d,layout:m,separatorToPanels:p}),m)}}}function to(e,n){const s=Ed(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=pk({groupId:s.id}).getLayout(),p=wc({delta:n,initialLayout:f,panelConstraints:o.derivedPanelConstraints,pivotIndices:d,prevLayout:f,trigger:"keyboard"}),m=ho({layout:p,panelConstraints:o.derivedPanelConstraints});go(f,m)||qs(s,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:m,separatorToPanels:o.separatorToPanels})}function Zj(e){if(e.defaultPrevented)return;const n=e.currentTarget,s=Ed(n);if(!s.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),s.orientation==="vertical"&&to(n,5);break}case"ArrowLeft":{e.preventDefault(),s.orientation==="horizontal"&&to(n,-5);break}case"ArrowRight":{e.preventDefault(),s.orientation==="horizontal"&&to(n,5);break}case"ArrowUp":{e.preventDefault(),s.orientation==="vertical"&&to(n,-5);break}case"End":{e.preventDefault(),to(n,100);break}case"Enter":{e.preventDefault();const o=Ed(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;to(n,S-v)}break}case"F6":{e.preventDefault();const o=Ed(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(),to(n,-100);break}}}let bl={cursorFlags:0,state:"inactive"};const Nb=new ck;function xo(){return bl}function b7(e){return Nb.addListener("change",e)}function v7(e){const n=bl,s={...bl};s.cursorFlags=e,bl=s,Nb.emit("change",{prev:n,next:s})}function vl(e){const n=bl;bl=e,Nb.emit("change",{prev:n,next:e})}function Wj(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const n=wo(),s=Eb(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 y7=e=>e,oh=()=>{},mk=1,gk=2,hk=4,xk=8,Jj=3,ew=12;let xd;function tw(){return xd===void 0&&(xd=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(xd=!0)),xd}function _7({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&&tw()){const c=(e&mk)!==0,d=(e&gk)!==0,f=(e&hk)!==0,p=(e&xk)!==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 tw()?o>0&&l>0?"move":o>0?"ew-resize":"ns-resize":o>0&&l>0?"grab":o>0?"col-resize":"row-resize"}}const nw=new WeakMap;function Rb(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:n,styleSheet:s}=nw.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=xo();switch(o.state){case"active":case"hover":{const l=_7({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}}nw.set(e,{prevStyle:n,styleSheet:s})}function bk({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:M}=k;if(N&&T&&M){const O=wc({delta:_,initialLayout:w,panelConstraints:N,pivotIndices:m.panels.map(P=>S.indexOf(P)),prevLayout:T,trigger:"mouse-or-touch"});if(go(O,T)){if(_!==0&&!C)switch(v){case"horizontal":{f|=_<0?mk:gk;break}case"vertical":{f|=_<0?hk:xk;break}}}else qs(m.group,{defaultLayoutDeferred:E,derivedPanelConstraints:N,groupSize:R,layout:O,separatorToPanels:M})}});let p=0;n.movementX===0?p|=d&Jj:p|=f&Jj,n.movementY===0?p|=d&ew:p|=f&ew,v7(p),Rb(e)}function aw(e){const n=wo(),s=xo();switch(s.state){case"active":bk({document:e.currentTarget,event:e,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedGroups:n,prevCursorFlags:s.cursorFlags})}}function sw(e){if(e.defaultPrevented)return;const n=xo(),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);qs(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)}bk({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:s,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags});break}default:{const o=Eb(e,s);o.length===0?n.state!=="inactive"&&vl({cursorFlags:0,state:"inactive"}):vl({cursorFlags:0,hitRegions:o,state:"hover"}),Rb(e.currentTarget);break}}}function rw(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(xo().state){case"hover":vl({cursorFlags:0,state:"inactive"})}}function ow(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const n=xo();switch(n.state){case"active":vl({cursorFlags:0,state:"inactive"}),n.hitRegions.length>0&&(Rb(e.currentTarget),n.hitRegions.forEach(s=>{const o=Cr(s.group.id,!0);qs(s.group,o)}),e.preventDefault())}}function lw(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 j7(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 w7(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 S7({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 C7(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 k7(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=Xh(e),T=N.defaultLayoutDeferred?lw(R):N.layout,M=S7({group:e,nextGroupSize:E,prevGroupSize:N.groupSize,prevLayout:T}),O=ho({layout:M,panelConstraints:R});if(!N.defaultLayoutDeferred&&go(N.layout,O)&&w7(N.derivedPanelConstraints,R)&&N.groupSize===E)return;qs(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:R,groupSize:E,layout:O,separatorToPanels:N.separatorToPanels})}}else j7(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=Xh(e),p=e.panels.map(({id:C})=>C).join(",");let m=e.mutableState.defaultLayout;m&&(C7(e.panels,m)||(m=void 0));const g=e.mutableState.layouts[p]??m??lw(f),b=ho({layout:g,panelConstraints:f}),v=e.element.ownerDocument;cl.set(v,(cl.get(v)??0)+1);const S=new Map;return ik(e).forEach(C=>{C.separator&&S.set(C.separator,C.panels)}),qs(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",Zj)}),cl.get(v)===1&&(v.addEventListener("dblclick",Qj,!0),v.addEventListener("pointerdown",Wj,!0),v.addEventListener("pointerleave",aw),v.addEventListener("pointermove",sw),v.addEventListener("pointerout",rw),v.addEventListener("pointerup",ow,!0)),function(){n=!1,cl.set(v,Math.max(0,(cl.get(v)??0)-1)),i7(e),e.separators.forEach(C=>{C.element.removeEventListener("keydown",Zj)}),cl.get(v)||(v.removeEventListener("dblclick",Qj,!0),v.removeEventListener("pointerdown",Wj,!0),v.removeEventListener("pointerleave",aw),v.removeEventListener("pointermove",sw),v.removeEventListener("pointerout",rw),v.removeEventListener("pointerup",ow,!0)),c.disconnect()}}function E7(){const[e,n]=x.useState({}),s=x.useCallback(()=>n({}),[]);return[e,s]}function Tb(e){const n=x.useId();return`${e??n}`}const So=typeof window<"u"?x.useLayoutEffect:x.useEffect;function uc(e){const n=x.useRef(e);return So(()=>{n.current=e},[e]),x.useCallback((...s)=>n.current?.(...s),[n])}function Ab(...e){return uc(n=>{e.forEach(s=>{if(s)switch(typeof s){case"function":{s(n);break}case"object":{s.current=n;break}}})})}function Mb(e){const n=x.useRef({...e});return So(()=>{for(const s in e)n.current[s]=e[s]},[e]),n.current}const vk=x.createContext(null);function N7(e,n){const s=x.useRef({getLayout:()=>({}),setLayout:y7});x.useImperativeHandle(n,()=>s.current,[]),So(()=>{Object.assign(s.current,pk({groupId:e}))})}function Qh({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=x.useRef({onLayoutChange:{},onLayoutChanged:{}}),_=uc(D=>{go(C.current.onLayoutChange,D)||(C.current.onLayoutChange=D,p?.(D))}),w=uc(D=>{go(C.current.onLayoutChanged,D)||(C.current.onLayoutChanged=D,m?.(D))}),k=Tb(f),E=x.useRef(null),[N,R]=E7(),T=x.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:b,separators:[]}),M=Ab(E,c);N7(k,d);const O=uc((D,z)=>{const H=xo(),q=Fj(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[z]??1,pointerEvents:V?"none":void 0}}if(s?.[z])return{flexGrow:s?.[z]}}),P=Mb({defaultLayout:s,disableCursor:o}),B=x.useMemo(()=>({get disableCursor(){return!!P.disableCursor},getPanelStyles:O,id:k,orientation:g,registerPanel:D=>{const z=T.current;return z.panels=Kh(g,[...z.panels,D]),R(),()=>{z.panels=z.panels.filter(H=>H!==D),R()}},registerSeparator:D=>{const z=T.current;return z.separators=Kh(g,[...z.separators,D]),R(),()=>{z.separators=z.separators.filter(H=>H!==D),R()}},updatePanelProps:(D,{disabled:z})=>{const H=T.current.panels.find(V=>V.id===D);H&&(H.panelConstraints.disabled=z);const q=Fj(k),Y=Cr(k);q&&Y&&qs(q,{...Y,derivedPanelConstraints:Xh(q)})},updateSeparatorProps:(D,{disabled:z,disableDoubleClick:H})=>{const q=T.current.separators.find(Y=>Y.id===D);q&&(q.disabled=z,q.disableDoubleClick=H)}}),[O,k,R,g,P]),L=x.useRef(null);return So(()=>{const D=E.current;if(D===null)return;const z=T.current;let H;if(P.defaultLayout!==void 0&&Object.keys(P.defaultLayout).length===z.panels.length){H={};for(const X of z.panels){const U=P.defaultLayout[X.id];U!==void 0&&(H[X.id]=U)}}const q={disabled:!!l,element:D,id:k,mutableState:{defaultLayout:H,disableCursor:!!P.disableCursor,expandedPanelSizes:T.current.lastExpandedPanelSizes,layouts:T.current.layouts},orientation:g,panels:z.panels,resizeTargetMinimumSize:z.resizeTargetMinimumSize,separators:z.separators};L.current=q;const Y=k7(q),{defaultLayoutDeferred:V,derivedPanelConstraints:$,layout:Z}=Cr(q.id,!0);!V&&$.length>0&&(_(Z),w(Z));const G=kb(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=Bn(re.collapsedSize,F[re.panelId]),ee=Bn(re.collapsedSize,oe[re.panelId]);ce&&!ee&&(q.mutableState.expandedPanelSizes[re.panelId]=oe[re.panelId])}}});const ie=xo().state!=="active";_(F),ie&&w(F)});return()=>{L.current=null,Y(),G()}},[l,k,w,_,g,N,P]),x.useEffect(()=>{const D=L.current;D&&(D.mutableState.defaultLayout=s,D.mutableState.disableCursor=!!o)}),r.jsx(vk.Provider,{value:B,children:r.jsx("div",{...S,className:n,"data-group":!0,"data-testid":k,id:k,ref:M,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})})}Qh.displayName="Group";function Ob(){const e=x.useContext(vk);return Ut(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function R7(e,n){const{id:s}=Ob(),o=x.useRef({collapse:oh,expand:oh,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:oh});x.useImperativeHandle(n,()=>o.current,[]),So(()=>{Object.assign(o.current,fk({groupId:s,panelId:e}))})}function no({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=Tb(p),k=Mb({disabled:c}),E=x.useRef(null),N=Ab(E,d),{getPanelStyles:R,id:T,orientation:M,registerPanel:O,updatePanelProps:P}=Ob(),B=b!==null,L=uc((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 O(Y)}},[f,s,o,l,B,w,_,m,g,L,O,k]),x.useEffect(()=>{P(w,{disabled:c})},[c,w,P]),R7(w,v);const D=()=>{const q=R(T,w);if(q)return JSON.stringify(q)},z=x.useSyncExternalStore(q=>kb(T,q),D,D);let H;return z?H=JSON.parse(z):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:{...T7,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:M==="horizontal"?"pan-y":"pan-x"},children:e})})}no.displayName="Panel";const T7={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function A7({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=ho({layout:wc({delta:m-d,initialLayout:e,panelConstraints:n,pivotIndices:g,prevLayout:e}),panelConstraints:n})[s],l=ho({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 zb({children:e,className:n,disabled:s,disableDoubleClick:o,elementRef:l,id:c,style:d,...f}){const p=Tb(c),m=Mb({disabled:s,disableDoubleClick:o}),[g,b]=x.useState({}),[v,S]=x.useState("inactive"),[C,_]=x.useState(!1),w=x.useRef(null),k=Ab(w,l),{disableCursor:E,id:N,orientation:R,registerSeparator:T,updateSeparatorProps:M}=Ob(),O=R==="horizontal"?"vertical":"horizontal";So(()=>{const L=w.current;if(L!==null){const D={disabled:m.disabled,disableDoubleClick:m.disableDoubleClick,element:L,id:p},z=T(D),H=b7(Y=>{S(Y.next.state!=="inactive"&&Y.next.hitRegions.some(V=>V.separator===D)?Y.next.state:"inactive")}),q=kb(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(A7({layout:$,panelConstraints:V,panelId:X.id,panelIndex:U}))}});return()=>{H(),q(),z()}}},[N,p,T,m]),x.useEffect(()=>{M(p,{disabled:s,disableDoubleClick:o})},[s,o,p,M]);let P;s&&!E&&(P="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":O,"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:P,...d,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:s?void 0:0})}zb.displayName="Separator";function M7({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:VT,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 O7({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(un,{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(it,{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:Me("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(Yw,{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(Ol,{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 z7({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:Me("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"),FT),o("plan",j("code_module.mode_plan"),j("code_module.mode_plan_hint"),TT)]})}function D7({value:e,onValueChange:n,onSubmit:s,onStop:o,busy:l,disabled:c,mode:d,onModeChange:f,model:p,onModelChange:m}){return r.jsx(vb,{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(z7,{mode:d,onChange:f,disabled:l}),r.jsx(yb,{value:p,onChange:m,disabled:l})]})})}function lh(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 L7(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 P7(e){let n=0,s=0,o=0;for(const d of e)d.role==="user"?n+=lh(d,{text:!0}):s+=lh(d,{text:!0}),o+=lh(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 iw={user:"bg-emerald-500",assistant:"bg-sky-500",tool:"bg-amber-500"};function As({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 cw(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 I7({turns:e,session:n}){const s=x.useMemo(()=>L7(e),[e]),o=x.useMemo(()=>P7(e),[e]);return e.length===0?r.jsx("div",{className:"p-3",children:r.jsx(it,{children:j("code_module.ctx_none")})}):r.jsxs("div",{className:"space-y-1 p-3","data-testid":"code-context-tab",children:[r.jsx(As,{label:j("code_module.ctx_model"),value:s.model||"auto"}),n?.mode&&r.jsx(As,{label:"Modo",value:n.mode}),n?.agentSlug&&r.jsx(As,{label:"Agente",value:n.agentSlug}),r.jsx(As,{label:j("code_module.ctx_messages"),value:`${s.userMsgs} usuario · ${s.assistantMsgs} asistente`}),r.jsx(As,{label:j("code_module.ctx_input"),value:s.input.toLocaleString()}),r.jsx(As,{label:j("code_module.ctx_output"),value:s.output.toLocaleString()}),r.jsx(As,{label:"Tokens Total",value:(s.input+s.output).toLocaleString()}),n?.createdAt&&r.jsx(As,{label:"Creado",value:cw(n.createdAt)}),n?.updatedAt&&r.jsx(As,{label:"Actividad",value:cw(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:iw[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 ${iw[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 B7(e){const n=[];for(const s of(e||"").split(`
609
- `))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 U7({patch:e}){const n=x.useMemo(()=>B7(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:Me("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 H7={added:PT,modified:Md,deleted:UT},V7={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]=x.useState(!1),o=H7[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(sf,{className:Me("size-3 shrink-0 transition-transform",n&&"rotate-90")}),r.jsx(o,{className:Me("size-3.5 shrink-0",V7[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(U7,{patch:e.patch})})]})}function $7({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(za,{size:12}):r.jsx(ss,{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(it,{children:j("code_module.changes_no_git")}):o.length===0?r.jsx(it,{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 G7({pid:e,entry:n,onDeleted:s,onRenamed:o,onRunInTerminal:l,onEditArtifact:c}){const[d,f]=x.useState(!1),[p,m]=x.useState(null),g=at(),[b,v]=x.useState(!1),[S,C]=x.useState(n.name),_=x.useRef(null),[w,k]=x.useState(!1),[E,N]=x.useState(!1),[R,T]=x.useState(!1),M=w?["artifact",e,n.name]:null,O=Ke(M,()=>xl.read(e,n.name),{revalidateOnFocus:!1}),P=!O.data?.content||O.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())},z=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(LT,{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 z(),onKeyDown:H=>{H.key==="Enter"&&z(),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(Ol,{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(Ad,{className:"size-3"})})})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1 mt-1",children:[r.jsxs(Lh,{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(rf,{className:"size-3"}),"Ver"]})}),r.jsxs(Ph,{className:"sm:max-w-lg",children:[r.jsx(Ih,{children:r.jsx(Bh,{className:"font-mono text-sm",children:n.name})}),O.isLoading?r.jsx("div",{className:"flex justify-center py-6",children:r.jsx(za,{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:O.data?.content??""}),r.jsx(F_,{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(uA,{className:"size-3"}),"Editar"]})}),P&&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(ux,{className:"size-3"}),j("code_module.artifacts_run")]})}),r.jsxs(Lh,{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(Ph,{className:"sm:max-w-sm",children:[r.jsx(Ih,{children:r.jsxs(Bh,{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(F_,{children:[r.jsx(Cz,{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:Me("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(za,{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:Me("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 F7({pid:e,onRunInTerminal:n,onEditArtifact:s}){const o=Ke(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(za,{size:12}):r.jsx(ss,{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(it,{children:j("code_module.artifacts_none")}):r.jsx("ul",{className:"space-y-1.5",children:l.map(c=>r.jsx(G7,{pid:e,entry:c,onDeleted:()=>void o.mutate(),onRenamed:()=>void o.mutate(),onRunInTerminal:n,onEditArtifact:s},c.name))})})]})}const Y7=[{value:"context",icon:of,label:"tab_context"},{value:"changes",icon:GT,label:"tab_changes"},{value:"artifacts",icon:aA,label:"tab_artifacts"}];function X7({pid:e,turns:n,changes:s,changesLoading:o,onRefreshChanges:l,session:c,onRunInTerminal:d,onEditArtifact:f}){const[p,m]=x.useState("context"),g=s?.files.length||0;return r.jsxs(Of,{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(zf,{variant:"line",className:"w-full",children:Y7.map(({value:b,icon:v,label:S})=>{const C=p===b,_=j(`code_module.${S}`);return r.jsx(Mt,{content:_,children:r.jsxs(es,{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(Ma,{value:"context",className:"min-h-0 flex-1 overflow-y-auto",children:r.jsx(I7,{turns:n,session:c})}),r.jsx(Ma,{value:"changes",className:"min-h-0 flex-1 overflow-hidden",children:r.jsx($7,{changes:s,loading:o,onRefresh:l})}),r.jsx(Ma,{value:"artifacts",className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(F7,{pid:e,onRunInTerminal:d,onEditArtifact:f})})]})}function K7(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 yk({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:Me("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(sf,{className:Me("size-3 shrink-0 transition-transform",d&&"rotate-90")}),d?r.jsx($w,{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(HT,{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(yk,{node:f,depth:n+1,onOpenFile:s,openDirs:o,toggleDir:l},f.path))})]})}function Q7({pid:e,projectPath:n,className:s,onOpenFile:o}){const[l,c]=x.useState([]),[d,f]=x.useState(!1),[p,m]=x.useState(!1),[g,b]=x.useState(()=>new Set),v=x.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(`
610
- `).map(N=>N.trim()).filter(Boolean);c(E),m(!0)}catch{m(!0)}finally{f(!1)}},[e]);x.useEffect(()=>{b(new Set),v()},[v]);const S=x.useCallback(k=>{b(E=>{const N=new Set(E);return N.has(k)?N.delete(k):N.add(k),N})},[]),C=x.useCallback(()=>{b(new Set)},[]),_=K7(l),w=g.size>0;return r.jsxs("div",{className:Me("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(ET,{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(za,{size:12}):r.jsx(ss,{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(it,{children:"Sin archivos"})}):r.jsx("ul",{children:_.map(k=>r.jsx(yk,{node:k,depth:0,onOpenFile:o??(()=>{}),openDirs:g,toggleDir:S},k.path))}):r.jsx("div",{className:"flex justify-center pt-6",children:r.jsx(za,{size:14})})})]})}function Z7({path:e,content:n,loading:s,onSave:o}){const l=typeof o=="function",[c,d]=x.useState(n),[f,p]=x.useState(!1);x.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(dx,{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:Me("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(za,{size:10}):r.jsx(cf,{className:"size-3"}),"Guardar"]})})]})]}),s?r.jsx("div",{className:"flex flex-1 items-center justify-center",children:r.jsx(za,{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(`
611
- `).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 W7({pid:e,className:n,initCmd:s,onClose:o}){const[l,c]=x.useState([]),[d,f]=x.useState(""),[p,m]=x.useState(!1),[g,b]=x.useState([]),[v,S]=x.useState(-1),C=x.useRef(null),_=x.useRef(null);x.useEffect(()=>{C.current?.scrollIntoView({behavior:"smooth"})},[l]),x.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:Me("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(zT,{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:Me("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 ih(){return r.jsx(zb,{className:"relative z-10 w-px shrink-0 cursor-col-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function J7(){return r.jsx(zb,{className:"relative z-10 h-px shrink-0 cursor-row-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function eI(){const e=at(),n=Ke("/projects",()=>na.list()),s=x.useMemo(()=>n.data||[],[n.data]),[o,l]=x.useState(""),[c,d]=x.useState(null),[f,p]=x.useState(Xi),[m,g]=x.useState([]),[b,v]=x.useState(""),[S,C]=x.useState(!1),[_,w]=x.useState(!0),[k,E]=x.useState(!0),[N,R]=x.useState(!1),[T,M]=x.useState(""),[O,P]=x.useState(!1),B=x.useRef(null),[L,D]=x.useState([]),[z,H]=x.useState("chat"),q=x.useCallback(pe=>{R(!0),M(pe)},[]);x.useEffect(()=>{!o&&s.length&&l(String(s[0].id))},[o,s]);const Y=Ke(o?["code-sessions",o]:null,()=>Ts.sessions.list(o)),V=Ke(o?["agents",o]:null,()=>en.list(o)),$=Ke(o&&c?["code-session",o,c]:null,()=>Ts.sessions.get(o,c)),Z=Ke(o&&c?["code-changes",o,c]:null,()=>Ts.changes(o,c));x.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]),x.useEffect(()=>{$.data&&p($.data.agentSlug||Xi)},[$.data]),x.useEffect(()=>{S||($.data?g($.data.messages||[]):c||g([]))},[$.data,c,S]),x.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 Ts.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 Ts.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 Ts.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 Ts.sessions.update(o,c,{agentSlug:pe!==Xi?pe:null}),await Promise.all([$.mutate(),Y.mutate()])}catch(Ee){e.error(Ee.message)}},ce=x.useCallback(async pe=>{if(c)try{await Ts.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(nn=>[...nn,{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=nn=>{if(nn.type==="error"){e.error(nn.error||"error");return}Te(Vt=>_b(Vt,nn))};try{await Ts.stream(o,c,{prompt:Ee},st,qe.signal),Te(nn=>({...nn,pending:!1}))}catch(nn){qe.signal.aborted?Te(Vt=>({...Vt,pending:!1,parts:[...Vt.parts,{kind:"text",text:j("code_module.stopped")}]})):(e.error(nn.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=x.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=x.useCallback(pe=>{D(Ee=>Ee.filter(Re=>Re.path!==pe)),H(Ee=>Ee===pe?"chat":Ee)},[]),Pe=x.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=x.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=x.useMemo(()=>{const pe=[{value:Xi,label:"super-agent",icon:yn,description:"Agente principal con todas las herramientas"}],Ee=(V.data||[]).map(Re=>({value:Re.slug,label:Re.slug,icon:yn,description:Re.description||Re.role||void 0}));return[...pe,...Ee]},[V.data]),we=x.useMemo(()=>m,[m]),Be=x.useMemo(()=>Y.data?.find(pe=>pe.id===c)?.title||"",[Y.data,c]),Xe=x.useMemo(()=>s.find(pe=>String(pe.id)===o),[s,o]);qz(Be);const[Ye,De]=x.useState(null),ye=S?null:YC(m),le=ye&&ye.turnKey!==Ye,_e=pe=>{Fe(pe)},Se=x.useCallback(()=>w(pe=>!pe),[]),Ue=x.useCallback(()=>P(pe=>!pe),[]),Je=x.useCallback(()=>R(pe=>!pe),[]),_t=x.useCallback(()=>E(pe=>!pe),[]),zt=x.useMemo(()=>c?r.jsx("div",{className:"flex items-center gap-0.5",children:[{Icon:Xw,open:_,toggle:Se,title:"Lista de sesiones"},{Icon:Gw,open:O,toggle:Ue,title:"Árbol de archivos"},{Icon:kr,open:N,toggle:Je,title:"Terminal"},{Icon:rA,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,_,O,N,k,Se,Ue,Je,_t]);return Gz(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(Qh,{orientation:"vertical",id:"code-layout-v",className:"min-h-0 flex-1",children:[r.jsx(no,{id:"top",defaultSize:N?"55%":"100%",minSize:"20%",children:r.jsxs(Qh,{orientation:"horizontal",id:"code-layout",className:"h-full",children:[_&&r.jsxs(r.Fragment,{children:[r.jsx(no,{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(M7,{projects:s,value:o,onChange:K,disabled:S})}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(O7,{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(ih,{})]}),O&&r.jsxs(r.Fragment,{children:[r.jsx(no,{id:"tree",defaultSize:"13%",minSize:"8%",children:r.jsx("div",{className:"h-full",children:r.jsx(Q7,{pid:o,projectPath:Xe?.path,onOpenFile:Ce})})}),r.jsx(ih,{})]}),r.jsx(no,{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":z==="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(Yw,{className:"size-3 shrink-0"}),"Chat"]}),L.map(pe=>{const Ee=pe.path.split("/").pop()??pe.path,Re=z===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)})]}),z==="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(jb,{msgs:m,onCopy:ve}):r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(it,{children:j("code_module.empty_chat")})}):r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(it,{children:j("code_module.pick_project")})})}),le&&ye&&r.jsx(FC,{turnKey:ye.turnKey,questions:ye.questions,onSubmit:_e,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===z);return pe?r.jsx(Z7,{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(D7,{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(ih,{}),r.jsx(no,{id:"right",defaultSize:"22%",minSize:"15%",children:r.jsx("aside",{className:"flex h-full flex-col",children:r.jsx(X7,{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(J7,{}),r.jsx(no,{id:"terminal",defaultSize:"45%",minSize:"10%",maxSize:"80%",children:r.jsx(W7,{pid:o,initCmd:T,onClose:Je,className:"h-full"})})]})]}):r.jsx("div",{className:"grid flex-1 place-items-center",children:r.jsx(it,{children:j("code_module.no_projects")})})})}function tI({open:e,onClose:n}){const{mutate:s}=L2(),o=at(),[l,c]=x.useState(""),[d,f]=x.useState(""),[p,m]=x.useState([]),[g,b]=x.useState(null),[v,S]=x.useState(""),[C,_]=x.useState(!1),[w,k]=x.useState(!1),E=async(R,T=!1)=>{_(!0),S("");try{const M=await iO.dirs(R||"~");f(M.path),c(M.path),b(M.parent),m(M.entries)}catch(M){const O=M.message;S(O),T||o.error(O)}finally{_(!1)}};x.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 na.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(Mn,{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(yd,{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(XT,{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(it,{children:j("add_project.browser_unavailable")}),!C&&!v&&p.length===0&&r.jsx(it,{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($w,{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 nI({onPaired:e}){const[n,s]=x.useState(""),[o,l]=x.useState(aI()),[c,d]=x.useState(!1),[f,p]=x.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});ao(b.token);try{localStorage.setItem(Rn.token,b.token)}catch{}e()}catch(b){p(sI(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(fh,{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 aI(){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 sI(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 rI({...e}){return r.jsx(sC,{"data-slot":"sheet",...e})}function oI({...e}){return r.jsx(nC,{"data-slot":"sheet-portal",...e})}function lI({className:e,...n}){return r.jsx(X2,{"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 iI({className:e,children:n,side:s="right",showCloseButton:o=!0,...l}){return r.jsxs(oI,{children:[r.jsx(lI,{}),r.jsxs(eC,{"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(Tf,{"data-slot":"sheet-close",render:r.jsx(po,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[r.jsx(vo,{}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function cI({className:e,...n}){return r.jsx("div",{"data-slot":"sheet-header",className:Ot("flex flex-col gap-0.5 p-4",e),...n})}function uI({className:e,...n}){return r.jsx(rC,{"data-slot":"sheet-title",className:Ot("font-heading text-base font-medium text-foreground",e),...n})}function dI({className:e,...n}){return r.jsx(K2,{"data-slot":"sheet-description",className:Ot("text-sm text-muted-foreground",e),...n})}function fI({value:e,projectPath:n,onPick:s}){const o=pI(e),l=o?mI(e):"",{data:c}=Ke(o?["/skills",n||""]:null,()=>Qi.list(n)),d=c?.skills||[],f=x.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 pI(e){return!!e.match(/^\s*\/([A-Za-z0-9_-]*)$/)}function mI(e){const n=e.match(/^\s*\/([A-Za-z0-9_-]*)$/);return n?n[1]:""}function gI(){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 hI({open:e,onOpenChange:n}){const s=tb(),o=at(),[l,c]=x.useState(gI),[d,f]=x.useState(""),[p,m]=x.useState(!1),[g,b]=x.useState(""),v=x.useRef(null);x.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{}}};x.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(P=>!P.pending).map(P=>({role:P.role,content:$h(P)}));c(P=>[...P,{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 M=!1;const O=P=>{if(P?.type==="error"){M=!0,o.error(P.error||"error"),c(B=>{const L=[...B],D=L[L.length-1];return D?.role==="assistant"&&D.pending&&L.pop(),L});return}_(B=>_b(B,P))};try{await I2.stream(0,{prompt:E,previousMessages:R,model:g||void 0,channel:"web_sidebar"},O,T.signal),_(P=>({...P,pending:!1}))}catch(P){T.signal.aborted?_(B=>({...B,pending:!1,parts:[...B.parts,{kind:"text",text:j("project.chat.stopped_marker")}]})):M||(o.error(P.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(rI,{open:e,onOpenChange:n,children:r.jsxs(iI,{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(cI,{className:"pr-12",children:[r.jsxs(uI,{className:"flex items-center gap-2",children:[r.jsx(yn,{size:18})," ",j("superagent.title",{persona:s}),r.jsx("span",{className:"text-xs font-normal text-muted-fg",children:j("superagent.badge")})]}),r.jsx(dI,{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(jb,{msgs:l,onCopy:k})}),r.jsx(GC,{msgs:l}),r.jsxs("div",{className:"border-t border-border p-3",children:[r.jsx("div",{className:"mb-1.5",children:r.jsx(fI,{value:d,onPick:E=>f(`/${E} `)})}),r.jsx(vb,{value:d,onValueChange:f,onSubmit:()=>void w(),onStop:C,busy:p,placeholder:j("superagent.placeholder"),footer:r.jsx(yb,{value:g,onChange:b,disabled:p})}),r.jsx("div",{className:"mt-1.5 flex justify-end",children:r.jsxs(po,{size:"xs",variant:"ghost",onClick:S,disabled:p||l.length===0,children:[r.jsx(un,{className:"size-3"})," ",j("superagent.new_chat")]})})]})]})})}function xI(){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 bI(){const[e,n]=x.useState({status:"loading"}),[s,o]=x.useState(0),l=x.useCallback(()=>{n({status:"loading"}),o(c=>c+1)},[]);return x.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:xI(),kind:"web"});ao(g.token);try{localStorage.setItem(Rn.token,g.token)}catch{}c||n({status:"ok"});return}catch{}}const m=f.get("token");if(m){ao(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&&ao(g)}catch{}try{const g=await fetch("/admin/web-token");if(g.ok){const b=await g.json();if(b?.token){ao(b.token);try{localStorage.setItem(Rn.token,b.token)}catch{}}}}catch{}if(!Qx()){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)){ao(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 vI(){const e=bI();return e.status==="loading"?r.jsx(uw,{text:j("daemon.connecting")}):e.status==="error"?r.jsx(uw,{text:j("daemon.unreachable"),sub:`${j("daemon.unreachable_hint")}
612
-
613
- ${e.reason}`}):e.status==="unpaired"?r.jsx(nI,{onPaired:e.reload}):r.jsx(Mz,{children:r.jsx(j4,{delay:300,children:r.jsx(yI,{})})})}function yI(){const e=La(),n=oa(),[s,o]=zw(),{theme:l,toggle:c}=px(),d=s.get("action")==="add-project",[f,p]=x.useState(!1),m=()=>{const g=new URLSearchParams(s);g.delete("action"),o(g,{replace:!0})};return r.jsx(Bz,{children:r.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground","data-testid":"app-shell",children:[r.jsx(CO,{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(_I,{onToggleTheme:c,isDark:l==="dark",pathname:n.pathname}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:r.jsxs(Rw,{children:[r.jsx($t,{path:"/",element:r.jsx(Lz,{})}),r.jsx($t,{path:"/settings/*",element:r.jsx(k8,{})}),r.jsx($t,{path:"/m/voice/*",element:r.jsx(L8,{})}),r.jsx($t,{path:"/m/desktop/*",element:r.jsx(U8,{})}),r.jsx($t,{path:"/m/deck/*",element:r.jsx(W8,{})}),r.jsx($t,{path:"/m/code/*",element:r.jsx(eI,{})}),r.jsx($t,{path:"/p/:pid/*",element:r.jsx(AP,{})}),r.jsx($t,{path:"*",element:r.jsx(CI,{})})]})})]}),r.jsx(tI,{open:d,onClose:m}),r.jsx(hI,{open:f,onOpenChange:p})]})})}function _I({onToggleTheme:e,isDark:n,pathname:s}){const{projects:o}=zc(),l=Vz(),c=s.split("/").filter(Boolean),d=c[0]==="p"?o.find(C=>String(C.id)===c[1]):void 0,f=c[0]==="settings"?wI(c[1]):c[0]==="p"?SI(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"),jI(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?`${U2(d.kind)} · ${d.path}`:"":"",v=Uz(),S=$z();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(Pz,{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(dA,{size:14}):r.jsx(nA,{size:14})})]})}function jI(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 wI(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 SI(e){switch(e){case"chat":return j("project.nav.chat");case"threads":return j("project.nav.threads");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 uw({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:` ▄███████▄
614
- █ ██ ██ █
615
- █ ◔ ◔ █
616
- █ ╰~╯ █
617
- ▀███████▀`}),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 CI(){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")})]})}qN.createRoot(document.getElementById("root")).render(r.jsx(Cc.StrictMode,{children:r.jsx(dT,{children:r.jsx(xA,{children:r.jsx(vI,{})})})}));
618
- //# sourceMappingURL=index-C0fm31dY.js.map